f7cloud_client/apps/text/js/treemap-KMMF4GRG-DJhEU9NB.chunk.mjs
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

130 lines
322 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{p as fi,_ as ht}from"./index-CYtgifWR.chunk.mjs";import{bA as pu,bB as mu,aP as cl,bk as gu,aT as yu,aQ as te,as as Tu,at as ea,ba as vu,bd as ul,be as dl,bb as Ru,bp as ta,av as Et,aw as D,aR as ra,aL as $u}from"./mermaid.core-BxtrgwOm.chunk.mjs";import{k as _t,j as ks,g as Gt,S as Eu,w as Au,x as ku,c as hl,v as z,y as fl,l as xu,z as Iu,A as Su,B as Cu,C as Nu,a as pl,d as C,i as qe,r as le,f as ke,D as q}from"./_baseUniq-08qBA_if.chunk.mjs";import{j as xs,m as A,d as wu,f as Ne,g as Ot,h as N,i as Is,l as Pt,e as Lu}from"./_basePickBy-D4Ve5JSk.chunk.mjs";import{c as ne}from"./clone-Cq87TdKW.chunk.mjs";var bu=Object.prototype,_u=bu.hasOwnProperty,Ae=pu(function(r,e){if(mu(e)||cl(e)){gu(e,_t(e),r);return}for(var t in e)_u.call(e,t)&&yu(r,t,e[t])});function ml(r,e,t){var n=-1,i=r.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(i);++n<i;)s[n]=r[n+e];return s}function Mr(r){for(var e=-1,t=r==null?0:r.length,n=0,i=[];++e<t;){var s=r[e];s&&(i[n++]=s)}return i}function Ou(r,e,t,n){for(var i=-1,s=r==null?0:r.length;++i<s;){var a=r[i];e(n,a,t(a),r)}return n}function Pu(r,e,t,n){return ks(r,function(i,s,a){e(n,i,t(i),a)}),n}function Mu(r,e){return function(t,n){var i=te(t)?Ou:Pu,s=e?e():{};return i(t,r,Gt(n),s)}}var Du=200;function Fu(r,e,t,n){var i=-1,s=Au,a=!0,o=r.length,l=[],c=e.length;if(!o)return l;e.length>=Du&&(s=ku,a=!1,e=new Eu(e));e:for(;++i<o;){var u=r[i],d=u;if(u=u!==0?u:0,a&&d===d){for(var h=c;h--;)if(e[h]===d)continue e;l.push(u)}else s(e,d,n)||l.push(u)}return l}var Xn=Tu(function(r,e){return ea(r)?Fu(r,hl(e,1,ea,!0)):[]});function Z(r,e,t){var n=r==null?0:r.length;return n?(e=e===void 0?1:xs(e),ml(r,e<0?0:e,n)):[]}function Lr(r,e,t){var n=r==null?0:r.length;return n?(e=e===void 0?1:xs(e),e=n-e,ml(r,0,e<0?0:e)):[]}function Uu(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(!e(r[t],t,r))return!1;return!0}function Gu(r,e){var t=!0;return ks(r,function(n,i,s){return t=!!e(n,i,s),t}),t}function Oe(r,e,t){var n=te(r)?Uu:Gu;return n(r,Gt(e))}function Pe(r){return r&&r.length?r[0]:void 0}function Ee(r,e){return hl(A(r,e))}var Bu=Object.prototype,Ku=Bu.hasOwnProperty,Vu=Mu(function(r,e,t){Ku.call(r,t)?r[t].push(e):vu(r,t,[e])}),ju="[object String]";function fe(r){return typeof r=="string"||!te(r)&&ul(r)&&dl(r)==ju}var Hu=Math.max;function de(r,e,t,n){r=cl(r)?r:z(r),t=t?xs(t):0;var i=r.length;return t<0&&(t=Hu(i+t,0)),fe(r)?t<=i&&r.indexOf(e,t)>-1:!!i&&fl(r,e,t)>-1}function na(r,e,t){var n=r==null?0:r.length;if(!n)return-1;var i=0;return fl(r,e,i)}var Wu="[object RegExp]";function zu(r){return ul(r)&&dl(r)==Wu}var ia=ta&&ta.isRegExp,Xe=ia?Ru(ia):zu,Yu="Expected a function";function qu(r){if(typeof r!="function")throw new TypeError(Yu);return function(){var e=arguments;switch(e.length){case 0:return!r.call(this);case 1:return!r.call(this,e[0]);case 2:return!r.call(this,e[0],e[1]);case 3:return!r.call(this,e[0],e[1],e[2])}return!r.apply(this,e)}}function Me(r,e){if(r==null)return{};var t=xu(Iu(r),function(n){return[n]});return e=Gt(e),wu(r,t,function(n,i){return e(n,i[0])})}function Qn(r,e){var t=te(r)?Su:Cu;return t(r,qu(Gt(e)))}function Xu(r,e){var t;return ks(r,function(n,i,s){return t=e(n,i,s),!t}),!!t}function gl(r,e,t){var n=te(r)?Nu:Xu;return n(r,Gt(e))}function Ss(r){return r&&r.length?pl(r):[]}function Qu(r,e){return r&&r.length?pl(r,Gt(e)):[]}function ae(r){return typeof r=="object"&&r!==null&&typeof r.$type=="string"}function Ge(r){return typeof r=="object"&&r!==null&&typeof r.$refText=="string"}function Zu(r){return typeof r=="object"&&r!==null&&typeof r.name=="string"&&typeof r.type=="string"&&typeof r.path=="string"}function hn(r){return typeof r=="object"&&r!==null&&ae(r.container)&&Ge(r.reference)&&typeof r.message=="string"}class yl{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return ae(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});const i=n[t];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,t);return n[t]=s,s}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const n=this.getAllTypes(),i=[];for(const s of n)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function br(r){return typeof r=="object"&&r!==null&&Array.isArray(r.content)}function Tl(r){return typeof r=="object"&&r!==null&&typeof r.tokenType=="object"}function vl(r){return br(r)&&typeof r.fullText=="string"}class J{constructor(e,t){this.startFn=e,this.nextFn=t}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 t=0,n=e.next();for(;!n.done;)t++,n=e.next();return t}toArray(){const e=[],t=this.iterator();let n;do n=t.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){const n=this.map(i=>[e?e(i):i,t?t(i):i]);return new Map(n)}toString(){return this.join()}concat(e){return new J(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),t=>{let n;if(!t.firstDone){do if(n=this.nextFn(t.first),!n.done)return n;while(!n.done);t.firstDone=!0}do if(n=t.iterator.next(),!n.done)return n;while(!n.done);return Re})}join(e=","){const t=this.iterator();let n="",i,s=!1;do i=t.next(),i.done||(s&&(n+=e),n+=Ju(i.value)),s=!0;while(!i.done);return n}indexOf(e,t=0){const n=this.iterator();let i=0,s=n.next();for(;!s.done;){if(i>=t&&s.value===e)return i;s=n.next(),i++}return-1}every(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(!e(n.value))return!1;n=t.next()}return!0}some(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(e(n.value))return!0;n=t.next()}return!1}forEach(e){const t=this.iterator();let n=0,i=t.next();for(;!i.done;)e(i.value,n),i=t.next(),n++}map(e){return new J(this.startFn,t=>{const{done:n,value:i}=this.nextFn(t);return n?Re:{done:!1,value:e(i)}})}filter(e){return new J(this.startFn,t=>{let n;do if(n=this.nextFn(t),!n.done&&e(n.value))return n;while(!n.done);return Re})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){const n=this.iterator();let i=t,s=n.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=n.next();return i}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){const i=e.next();if(i.done)return n;const s=this.recursiveReduce(e,t,n);return s===void 0?i.value:t(s,i.value)}find(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(e(n.value))return n.value;n=t.next()}}findIndex(e){const t=this.iterator();let n=0,i=t.next();for(;!i.done;){if(e(i.value))return n;i=t.next(),n++}return-1}includes(e){const t=this.iterator();let n=t.next();for(;!n.done;){if(n.value===e)return!0;n=t.next()}return!1}flatMap(e){return new J(()=>({this:this.startFn()}),t=>{do{if(t.iterator){const s=t.iterator.next();if(s.done)t.iterator=void 0;else return s}const{done:n,value:i}=this.nextFn(t.this);if(!n){const s=e(i);if(Sn(s))t.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(t.iterator);return Re})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new J(()=>({this:t.startFn()}),n=>{do{if(n.iterator){const a=n.iterator.next();if(a.done)n.iterator=void 0;else return a}const{done:i,value:s}=t.nextFn(n.this);if(!i)if(Sn(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(n.iterator);return Re})}head(){const e=this.iterator().next();if(!e.done)return e.value}tail(e=1){return new J(()=>{const t=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(t).done)return t;return t},this.nextFn)}limit(e){return new J(()=>({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?Re:this.nextFn(t.state)))}distinct(e){return new J(()=>({set:new Set,internalState:this.startFn()}),t=>{let n;do if(n=this.nextFn(t.internalState),!n.done){const i=e?e(n.value):n.value;if(!t.set.has(i))return t.set.add(i),n}while(!n.done);return Re})}exclude(e,t){const n=new Set;for(const i of e){const s=t?t(i):i;n.add(s)}return this.filter(i=>{const s=t?t(i):i;return!n.has(s)})}}function Ju(r){return typeof r=="string"?r:typeof r>"u"?"undefined":typeof r.toString=="function"?r.toString():Object.prototype.toString.call(r)}function Sn(r){return!!r&&typeof r[Symbol.iterator]=="function"}const ed=new J(()=>{},()=>Re),Re=Object.freeze({done:!0,value:void 0});function ee(...r){if(r.length===1){const e=r[0];if(e instanceof J)return e;if(Sn(e))return new J(()=>e[Symbol.iterator](),t=>t.next());if(typeof e.length=="number")return new J(()=>({index:0}),t=>t.index<e.length?{done:!1,value:e[t.index++]}:Re)}return r.length>1?new J(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<r.length){const t=r[e.collIndex++];Sn(t)?e.iterator=t[Symbol.iterator]():t&&typeof t.length=="number"&&(e.array=t)}}while(e.iterator||e.array||e.collIndex<r.length);return Re}):ed}class Cs extends J{constructor(e,t,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(t(s.value)[Symbol.iterator]()),s}return Re})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Ki;(function(r){function e(s){return s.reduce((a,o)=>a+o,0)}r.sum=e;function t(s){return s.reduce((a,o)=>a*o,0)}r.product=t;function n(s){return s.reduce((a,o)=>Math.min(a,o))}r.min=n;function i(s){return s.reduce((a,o)=>Math.max(a,o))}r.max=i})(Ki||(Ki={}));function Vi(r){return new Cs(r,e=>br(e)?e.content:[],{includeRoot:!0})}function td(r,e){for(;r.container;)if(r=r.container,r===e)return!0;return!1}function ji(r){return{start:{character:r.startColumn-1,line:r.startLine-1},end:{character:r.endColumn,line:r.endLine-1}}}function Cn(r){if(!r)return;const{offset:e,end:t,range:n}=r;return{range:n,offset:e,end:t,length:t-e}}var We;(function(r){r[r.Before=0]="Before",r[r.After=1]="After",r[r.OverlapFront=2]="OverlapFront",r[r.OverlapBack=3]="OverlapBack",r[r.Inside=4]="Inside",r[r.Outside=5]="Outside"})(We||(We={}));function rd(r,e){if(r.end.line<e.start.line||r.end.line===e.start.line&&r.end.character<=e.start.character)return We.Before;if(r.start.line>e.end.line||r.start.line===e.end.line&&r.start.character>=e.end.character)return We.After;const t=r.start.line>e.start.line||r.start.line===e.start.line&&r.start.character>=e.start.character,n=r.end.line<e.end.line||r.end.line===e.end.line&&r.end.character<=e.end.character;return t&&n?We.Inside:t?We.OverlapBack:n?We.OverlapFront:We.Outside}function nd(r,e){return rd(r,e)>We.After}const id=/^[\w\p{L}]$/u;function sd(r,e){if(r){const t=ad(r,!0);if(t&&sa(t,e))return t;if(vl(r)){const n=r.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){const s=r.content[i];if(sa(s,e))return s}}}}function sa(r,e){return Tl(r)&&e.includes(r.tokenType.name)}function ad(r,e=!0){for(;r.container;){const t=r.container;let n=t.content.indexOf(r);for(;n>0;){n--;const i=t.content[n];if(e||!i.hidden)return i}r=t}}class Rl extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function Dr(r){throw new Error("Error! The input value was not handled.")}const Vr="AbstractRule",jr="AbstractType",pi="Condition",aa="TypeDefinition",mi="ValueLiteral",Yt="AbstractElement";function od(r){return M.isInstance(r,Yt)}const Hr="ArrayLiteral",Wr="ArrayType",qt="BooleanLiteral";function ld(r){return M.isInstance(r,qt)}const Xt="Conjunction";function cd(r){return M.isInstance(r,Xt)}const Qt="Disjunction";function ud(r){return M.isInstance(r,Qt)}const zr="Grammar",gi="GrammarImport",Zt="InferredType";function $l(r){return M.isInstance(r,Zt)}const Jt="Interface";function El(r){return M.isInstance(r,Jt)}const yi="NamedArgument",er="Negation";function dd(r){return M.isInstance(r,er)}const Yr="NumberLiteral",qr="Parameter",tr="ParameterReference";function hd(r){return M.isInstance(r,tr)}const rr="ParserRule";function we(r){return M.isInstance(r,rr)}const Xr="ReferenceType",fn="ReturnType";function fd(r){return M.isInstance(r,fn)}const nr="SimpleType";function pd(r){return M.isInstance(r,nr)}const Qr="StringLiteral",Nt="TerminalRule";function At(r){return M.isInstance(r,Nt)}const ir="Type";function Al(r){return M.isInstance(r,ir)}const Ti="TypeAttribute",Zr="UnionType",sr="Action";function Zn(r){return M.isInstance(r,sr)}const ar="Alternatives";function kl(r){return M.isInstance(r,ar)}const or="Assignment";function gt(r){return M.isInstance(r,or)}const lr="CharacterRange";function md(r){return M.isInstance(r,lr)}const cr="CrossReference";function Ns(r){return M.isInstance(r,cr)}const ur="EndOfFile";function gd(r){return M.isInstance(r,ur)}const dr="Group";function ws(r){return M.isInstance(r,dr)}const hr="Keyword";function yt(r){return M.isInstance(r,hr)}const fr="NegatedToken";function yd(r){return M.isInstance(r,fr)}const pr="RegexToken";function Td(r){return M.isInstance(r,pr)}const mr="RuleCall";function Tt(r){return M.isInstance(r,mr)}const gr="TerminalAlternatives";function vd(r){return M.isInstance(r,gr)}const yr="TerminalGroup";function Rd(r){return M.isInstance(r,yr)}const Tr="TerminalRuleCall";function $d(r){return M.isInstance(r,Tr)}const vr="UnorderedGroup";function xl(r){return M.isInstance(r,vr)}const Rr="UntilToken";function Ed(r){return M.isInstance(r,Rr)}const $r="Wildcard";function Ad(r){return M.isInstance(r,$r)}class Il extends yl{getAllTypes(){return[Yt,Vr,jr,sr,ar,Hr,Wr,or,qt,lr,pi,Xt,cr,Qt,ur,zr,gi,dr,Zt,Jt,hr,yi,fr,er,Yr,qr,tr,rr,Xr,pr,fn,mr,nr,Qr,gr,yr,Nt,Tr,ir,Ti,aa,Zr,vr,Rr,mi,$r]}computeIsSubtype(e,t){switch(e){case sr:case ar:case or:case lr:case cr:case ur:case dr:case hr:case fr:case pr:case mr:case gr:case yr:case Tr:case vr:case Rr:case $r:return this.isSubtype(Yt,t);case Hr:case Yr:case Qr:return this.isSubtype(mi,t);case Wr:case Xr:case nr:case Zr:return this.isSubtype(aa,t);case qt:return this.isSubtype(pi,t)||this.isSubtype(mi,t);case Xt:case Qt:case er:case tr:return this.isSubtype(pi,t);case Zt:case Jt:case ir:return this.isSubtype(jr,t);case rr:return this.isSubtype(Vr,t)||this.isSubtype(jr,t);case Nt:return this.isSubtype(Vr,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;switch(t){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return jr;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Vr;case"Grammar:usedGrammars":return zr;case"NamedArgument:parameter":case"ParameterReference:parameter":return qr;case"TerminalRuleCall:rule":return Nt;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Yt:return{name:Yt,properties:[{name:"cardinality"},{name:"lookahead"}]};case Hr:return{name:Hr,properties:[{name:"elements",defaultValue:[]}]};case Wr:return{name:Wr,properties:[{name:"elementType"}]};case qt:return{name:qt,properties:[{name:"true",defaultValue:!1}]};case Xt:return{name:Xt,properties:[{name:"left"},{name:"right"}]};case Qt:return{name:Qt,properties:[{name:"left"},{name:"right"}]};case zr:return{name:zr,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case gi:return{name:gi,properties:[{name:"path"}]};case Zt:return{name:Zt,properties:[{name:"name"}]};case Jt:return{name:Jt,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case yi:return{name:yi,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case er:return{name:er,properties:[{name:"value"}]};case Yr:return{name:Yr,properties:[{name:"value"}]};case qr:return{name:qr,properties:[{name:"name"}]};case tr:return{name:tr,properties:[{name:"parameter"}]};case rr:return{name:rr,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case Xr:return{name:Xr,properties:[{name:"referenceType"}]};case fn:return{name:fn,properties:[{name:"name"}]};case nr:return{name:nr,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case Qr:return{name:Qr,properties:[{name:"value"}]};case Nt:return{name:Nt,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case ir:return{name:ir,properties:[{name:"name"},{name:"type"}]};case Ti:return{name:Ti,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Zr:return{name:Zr,properties:[{name:"types",defaultValue:[]}]};case sr:return{name:sr,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case ar:return{name:ar,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case or:return{name:or,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case lr:return{name:lr,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case cr:return{name:cr,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case ur:return{name:ur,properties:[{name:"cardinality"},{name:"lookahead"}]};case dr:return{name:dr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case hr:return{name:hr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case fr:return{name:fr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case pr:return{name:pr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case mr:return{name:mr,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case gr:return{name:gr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case yr:return{name:yr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Tr:return{name:Tr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case vr:return{name:vr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Rr:return{name:Rr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case $r:return{name:$r,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const M=new Il;function kd(r){for(const[e,t]of Object.entries(r))e.startsWith("$")||(Array.isArray(t)?t.forEach((n,i)=>{ae(n)&&(n.$container=r,n.$containerProperty=e,n.$containerIndex=i)}):ae(t)&&(t.$container=r,t.$containerProperty=e))}function Jn(r,e){let t=r;for(;t;){if(e(t))return t;t=t.$container}}function Je(r){const e=Hi(r).$document;if(!e)throw new Error("AST node has no document.");return e}function Hi(r){for(;r.$container;)r=r.$container;return r}function Ls(r,e){if(!r)throw new Error("Node must be an AstNode.");const t=e?.range;return new J(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndex<n.keys.length;){const i=n.keys[n.keyIndex];if(!i.startsWith("$")){const s=r[i];if(ae(s)){if(n.keyIndex++,oa(s,t))return{done:!1,value:s}}else if(Array.isArray(s)){for(;n.arrayIndex<s.length;){const a=n.arrayIndex++,o=s[a];if(ae(o)&&oa(o,t))return{done:!1,value:o}}n.arrayIndex=0}}n.keyIndex++}return Re})}function Fr(r,e){if(!r)throw new Error("Root node must be an AstNode.");return new Cs(r,t=>Ls(t,e))}function Lt(r,e){if(!r)throw new Error("Root node must be an AstNode.");return new Cs(r,t=>Ls(t,e),{includeRoot:!0})}function oa(r,e){var t;if(!e)return!0;const n=(t=r.$cstNode)===null||t===void 0?void 0:t.range;return n?nd(n,e):!1}function Sl(r){return new J(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const t=e.keys[e.keyIndex];if(!t.startsWith("$")){const n=r[t];if(Ge(n))return e.keyIndex++,{done:!1,value:{reference:n,container:r,property:t}};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){const i=e.arrayIndex++,s=n[i];if(Ge(s))return{done:!1,value:{reference:s,container:r,property:t,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Re})}function xd(r,e){const t=r.getTypeMetaData(e.$type),n=e;for(const i of t.properties)i.defaultValue!==void 0&&n[i.name]===void 0&&(n[i.name]=Cl(i.defaultValue))}function Cl(r){return Array.isArray(r)?[...r.map(Cl)]:r}function w(r){return r.charCodeAt(0)}function vi(r,e){Array.isArray(r)?r.forEach(function(t){e.push(t)}):e.push(r)}function Ht(r,e){if(r[e]===!0)throw"duplicate flag "+e;r[e],r[e]=!0}function Ct(r){if(r===void 0)throw Error("Internal Error - Should never get here!");return!0}function Id(){throw Error("Internal Error - Should never get here!")}function la(r){return r.type==="Character"}const Nn=[];for(let r=w("0");r<=w("9");r++)Nn.push(r);const wn=[w("_")].concat(Nn);for(let r=w("a");r<=w("z");r++)wn.push(r);for(let r=w("A");r<=w("Z");r++)wn.push(r);const ca=[w(" "),w("\f"),w(`
`),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")],Sd=/[0-9a-fA-F]/,Jr=/[0-9]/,Cd=/[1-9]/;class Nl{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 t=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Ht(n,"global");break;case"i":Ht(n,"ignoreCase");break;case"m":Ht(n,"multiLine");break;case"u":Ht(n,"unicode");break;case"y":Ht(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}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 t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break}Ct(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return Id()}quantifier(e=!1){let t;const n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),t={atLeast:i,atMost:s}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Ct(t);break}if(!(e===!0&&t===void 0)&&Ct(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t}atom(){let e;const t=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()),Ct(e))return e.loc=this.loc(t),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,t=!1;switch(this.popChar()){case"d":e=Nn;break;case"D":e=Nn,t=!0;break;case"s":e=ca;break;case"S":e=ca,t=!0;break;case"w":e=wn;break;case"W":e=wn,t=!0;break}if(Ct(e))return{type:"Set",value:e,complement:t}}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(Ct(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 t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const n=this.classAtom();if(n.type,la(n)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,la(i)){if(i.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:i.value})}else vi(n.value,e),e.push(w("-")),vi(i.value,e)}else vi(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,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;(this.consumeChar("("),this.peekChar(0))==="?"?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;const t=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(Cd.test(e)===!1)throw Error("Expecting a positive integer");for(;Jr.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Jr.test(e)===!1)throw Error("Expecting an integer");for(;Jr.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 Jr.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)==="!");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 t="";for(let n=0;n<e;n++){const i=this.popChar();if(Sd.test(i)===!1)throw Error("Expecting a HexDecimal digits");t+=i}return{type:"Character",value:parseInt(t,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 ei{visitChildren(e){for(const t in e){const n=e[t];e.hasOwnProperty(t)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const Nd=/\r?\n/gm,wd=new Nl;class Ld extends ei{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 t=String.fromCharCode(e.value);if(!this.multiline&&t===`
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=ti(t);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitSet(e){if(!this.multiline){const t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=!!`
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Ri=new Ld;function bd(r){try{return typeof r=="string"&&(r=new RegExp(r)),r=r.toString(),Ri.reset(r),Ri.visit(wd.pattern(r)),Ri.multiline}catch{return!1}}const _d=`\f
\r \v   \u2028\u2029 \uFEFF`.split("");function Wi(r){const e=typeof r=="string"?new RegExp(r):r;return _d.some(t=>e.test(t))}function ti(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Od(r){return Array.prototype.map.call(r,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:ti(e)).join("")}function Pd(r,e){const t=Md(r),n=e.match(t);return!!n&&n[0].length>0}function Md(r){typeof r=="string"&&(r=new RegExp(r));const e=r,t=r.source;let n=0;function i(){let s="",a;function o(c){s+=t.substr(n,c),n+=c}function l(c){s+="(?:"+t.substr(n,c)+"|$)",n+=c}for(;n<t.length;)switch(t[n]){case"\\":switch(t[n+1]){case"c":l(3);break;case"x":l(4);break;case"u":e.unicode?t[n+2]==="{"?l(t.indexOf("}",n)-n+1):l(6):l(2);break;case"p":case"P":e.unicode?l(t.indexOf("}",n)-n+1):l(2);break;case"k":l(t.indexOf(">",n)-n+1);break;default:l(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=n,a=a.exec(t)||[],l(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=n,a=a.exec(t),a?o(a[0].length):l(1);break;case"(":if(t[n+1]==="?")switch(t[n+2]){case":":s+="(?:",n+=3,s+=i()+"|$)";break;case"=":s+="(?=",n+=3,s+=i()+")";break;case"!":a=n,n+=3,i(),s+=t.substr(a,n-a);break;case"<":switch(t[n+3]){case"=":case"!":a=n,n+=4,i(),s+=t.substr(a,n-a);break;default:o(t.indexOf(">",n)-n+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++n,s;default:l(1);break}return s}return new RegExp(i(),r.flags)}function Dd(r){return r.rules.find(e=>we(e)&&e.entry)}function Fd(r){return r.rules.filter(e=>At(e)&&e.hidden)}function wl(r,e){const t=new Set,n=Dd(r);if(!n)return new Set(r.rules);const i=[n].concat(Fd(r));for(const a of i)Ll(a,t,e);const s=new Set;for(const a of r.rules)(t.has(a.name)||At(a)&&a.hidden)&&s.add(a);return s}function Ll(r,e,t){e.add(r.name),Fr(r).forEach(n=>{if(Tt(n)||t){const i=n.rule.ref;i&&!e.has(i.name)&&Ll(i,e,t)}})}function Ud(r){if(r.terminal)return r.terminal;if(r.type.ref)return _l(r.type.ref)?.terminal}function Gd(r){return r.hidden&&!Wi(Ps(r))}function Bd(r,e){return!r||!e?[]:bs(r,e,r.astNode,!0)}function bl(r,e,t){if(!r||!e)return;const n=bs(r,e,r.astNode,!0);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}function bs(r,e,t,n){if(!n){const i=Jn(r.grammarSource,gt);if(i&&i.feature===e)return[r]}return br(r)&&r.astNode===t?r.content.flatMap(i=>bs(i,e,t,!1)):[]}function Kd(r,e,t){if(!r)return;const n=Vd(r,e,r?.astNode);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}function Vd(r,e,t){if(r.astNode!==t)return[];if(yt(r.grammarSource)&&r.grammarSource.value===e)return[r];const n=Vi(r).iterator();let i;const s=[];do if(i=n.next(),!i.done){const a=i.value;a.astNode===t?yt(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):n.prune()}while(!i.done);return s}function jd(r){var e;const t=r.astNode;for(;t===((e=r.container)===null||e===void 0?void 0:e.astNode);){const n=Jn(r.grammarSource,gt);if(n)return n;r=r.container}}function _l(r){let e=r;return $l(e)&&(Zn(e.$container)?e=e.$container.$container:we(e.$container)?e=e.$container:Dr(e.$container)),Ol(r,e,new Map)}function Ol(r,e,t){var n;function i(s,a){let o;return Jn(s,gt)||(o=Ol(a,a,t)),t.set(r,o),o}if(t.has(r))return t.get(r);t.set(r,void 0);for(const s of Fr(e)){if(gt(s)&&s.feature.toLowerCase()==="name")return t.set(r,s),s;if(Tt(s)&&we(s.rule.ref))return i(s,s.rule.ref);if(pd(s)&&!((n=s.typeRef)===null||n===void 0)&&n.ref)return i(s,s.typeRef.ref)}}function Pl(r){return Ml(r,new Set)}function Ml(r,e){if(e.has(r))return!0;e.add(r);for(const t of Fr(r))if(Tt(t)){if(!t.rule.ref||we(t.rule.ref)&&!Ml(t.rule.ref,e))return!1}else if(gt(t)||Zn(t))return!1;return!!r.definition}function _s(r){if(r.inferredType)return r.inferredType.name;if(r.dataType)return r.dataType;if(r.returnType){const e=r.returnType.ref;if(e&&(we(e)||El(e)||Al(e)))return e.name}}function Os(r){var e;if(we(r))return Pl(r)?r.name:(e=_s(r))!==null&&e!==void 0?e:r.name;if(El(r)||Al(r)||fd(r))return r.name;if(Zn(r)){const t=Hd(r);if(t)return t}else if($l(r))return r.name;throw new Error("Cannot get name of Unknown Type")}function Hd(r){var e;if(r.inferredType)return r.inferredType.name;if(!((e=r.type)===null||e===void 0)&&e.ref)return Os(r.type.ref)}function Wd(r){var e,t,n;return At(r)?(t=(e=r.type)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"string":(n=_s(r))!==null&&n!==void 0?n:r.name}function Ps(r){const e={s:!1,i:!1,u:!1},t=Bt(r.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(t,n)}const Ms=/[\s\S]/.source;function Bt(r,e){if(vd(r))return zd(r);if(Rd(r))return Yd(r);if(md(r))return Qd(r);if($d(r)){const t=r.rule.ref;if(!t)throw new Error("Missing rule reference.");return Ye(Bt(t.definition),{cardinality:r.cardinality,lookahead:r.lookahead})}else{if(yd(r))return Xd(r);if(Ed(r))return qd(r);if(Td(r)){const t=r.regex.lastIndexOf("/"),n=r.regex.substring(1,t),i=r.regex.substring(t+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),Ye(n,{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1})}else{if(Ad(r))return Ye(Ms,{cardinality:r.cardinality,lookahead:r.lookahead});throw new Error(`Invalid terminal element: ${r?.$type}`)}}}function zd(r){return Ye(r.elements.map(e=>Bt(e)).join("|"),{cardinality:r.cardinality,lookahead:r.lookahead})}function Yd(r){return Ye(r.elements.map(e=>Bt(e)).join(""),{cardinality:r.cardinality,lookahead:r.lookahead})}function qd(r){return Ye(`${Ms}*?${Bt(r.terminal)}`,{cardinality:r.cardinality,lookahead:r.lookahead})}function Xd(r){return Ye(`(?!${Bt(r.terminal)})${Ms}*?`,{cardinality:r.cardinality,lookahead:r.lookahead})}function Qd(r){return r.right?Ye(`[${$i(r.left)}-${$i(r.right)}]`,{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1}):Ye($i(r.left),{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1})}function $i(r){return ti(r.value)}function Ye(r,e){var t;return(e.wrap!==!1||e.lookahead)&&(r=`(${(t=e.lookahead)!==null&&t!==void 0?t:""}${r})`),e.cardinality?`${r}${e.cardinality}`:r}function Zd(r){const e=[],t=r.Grammar;for(const n of t.rules)At(n)&&Gd(n)&&bd(Ps(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:id}}function zi(r){console&&console.error&&console.error(`Error: ${r}`)}function Dl(r){console&&console.warn&&console.warn(`Warning: ${r}`)}function Fl(r){const e=new Date().getTime(),t=r();return{time:new Date().getTime()-e,value:t}}function Ul(r){function e(){}e.prototype=r;const t=new e;function n(){return typeof t.bar}return n(),n(),r}function Jd(r){return eh(r)?r.LABEL:r.name}function eh(r){return fe(r.LABEL)&&r.LABEL!==""}class Be{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),C(this.definition,t=>{t.accept(e)})}}class ce extends Be{constructor(e){super([]),this.idx=1,Ae(this,Me(e,t=>t!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Kt extends Be{constructor(e){super(e.definition),this.orgText="",Ae(this,Me(e,t=>t!==void 0))}}class pe extends Be{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Ae(this,Me(e,t=>t!==void 0))}}let re=class extends Be{constructor(r){super(r.definition),this.idx=1,Ae(this,Me(r,e=>e!==void 0))}};class xe extends Be{constructor(e){super(e.definition),this.idx=1,Ae(this,Me(e,t=>t!==void 0))}}class Ie extends Be{constructor(e){super(e.definition),this.idx=1,Ae(this,Me(e,t=>t!==void 0))}}class j extends Be{constructor(e){super(e.definition),this.idx=1,Ae(this,Me(e,t=>t!==void 0))}}class me extends Be{constructor(e){super(e.definition),this.idx=1,Ae(this,Me(e,t=>t!==void 0))}}class ge extends Be{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Ae(this,Me(e,t=>t!==void 0))}}class F{constructor(e){this.idx=1,Ae(this,Me(e,t=>t!==void 0))}accept(e){e.visit(this)}}function th(r){return A(r,pn)}function pn(r){function e(t){return A(t,pn)}if(r instanceof ce){const t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return fe(r.label)&&(t.label=r.label),t}else{if(r instanceof pe)return{type:"Alternative",definition:e(r.definition)};if(r instanceof re)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof xe)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof Ie)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:pn(new F({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof me)return{type:"RepetitionWithSeparator",idx:r.idx,separator:pn(new F({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof j)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof ge)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof F){const t={type:"Terminal",name:r.terminalType.name,label:Jd(r.terminalType),idx:r.idx};fe(r.label)&&(t.terminalLabel=r.label);const n=r.terminalType.PATTERN;return r.terminalType.PATTERN&&(t.pattern=Xe(n)?n.source:n),t}else{if(r instanceof Kt)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}class Vt{visit(e){const t=e;switch(t.constructor){case ce:return this.visitNonTerminal(t);case pe:return this.visitAlternative(t);case re:return this.visitOption(t);case xe:return this.visitRepetitionMandatory(t);case Ie:return this.visitRepetitionMandatoryWithSeparator(t);case me:return this.visitRepetitionWithSeparator(t);case j:return this.visitRepetition(t);case ge:return this.visitAlternation(t);case F:return this.visitTerminal(t);case Kt:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function rh(r){return r instanceof pe||r instanceof re||r instanceof j||r instanceof xe||r instanceof Ie||r instanceof me||r instanceof F||r instanceof Kt}function Ln(r,e=[]){return r instanceof re||r instanceof j||r instanceof me?!0:r instanceof ge?gl(r.definition,t=>Ln(t,e)):r instanceof ce&&de(e,r)?!1:r instanceof Be?(r instanceof ce&&e.push(r),Oe(r.definition,t=>Ln(t,e))):!1}function nh(r){return r instanceof ge}function Ue(r){if(r instanceof ce)return"SUBRULE";if(r instanceof re)return"OPTION";if(r instanceof ge)return"OR";if(r instanceof xe)return"AT_LEAST_ONE";if(r instanceof Ie)return"AT_LEAST_ONE_SEP";if(r instanceof me)return"MANY_SEP";if(r instanceof j)return"MANY";if(r instanceof F)return"CONSUME";throw Error("non exhaustive match")}class ri{walk(e,t=[]){C(e.definition,(n,i)=>{const s=Z(e.definition,i+1);if(n instanceof ce)this.walkProdRef(n,s,t);else if(n instanceof F)this.walkTerminal(n,s,t);else if(n instanceof pe)this.walkFlat(n,s,t);else if(n instanceof re)this.walkOption(n,s,t);else if(n instanceof xe)this.walkAtLeastOne(n,s,t);else if(n instanceof Ie)this.walkAtLeastOneSep(n,s,t);else if(n instanceof me)this.walkManySep(n,s,t);else if(n instanceof j)this.walkMany(n,s,t);else if(n instanceof ge)this.walkOr(n,s,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){const i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){const i=[new re({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){const i=ua(e,t,n);this.walk(e,i)}walkMany(e,t,n){const i=[new re({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){const i=ua(e,t,n);this.walk(e,i)}walkOr(e,t,n){const i=t.concat(n);C(e.definition,s=>{const a=new pe({definition:[s]});this.walk(a,i)})}}function ua(r,e,t){return[new re({definition:[new F({terminalType:r.separator})].concat(r.definition)})].concat(e,t)}function Ur(r){if(r instanceof ce)return Ur(r.referencedRule);if(r instanceof F)return ah(r);if(rh(r))return ih(r);if(nh(r))return sh(r);throw Error("non exhaustive match")}function ih(r){let e=[];const t=r.definition;let n=0,i=t.length>n,s,a=!0;for(;i&&a;)s=t[n],a=Ln(s),e=e.concat(Ur(s)),n=n+1,i=t.length>n;return Ss(e)}function sh(r){const e=A(r.definition,t=>Ur(t));return Ss(Ne(e))}function ah(r){return[r.terminalType]}const Gl="_~IN~_";class oh extends ri{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const i=ch(e.referencedRule,e.idx)+this.topProd.name,s=t.concat(n),a=new pe({definition:s}),o=Ur(a);this.follows[i]=o}}function lh(r){const e={};return C(r,t=>{const n=new oh(t).startWalking();Ae(e,n)}),e}function ch(r,e){return r.name+e+Gl}let mn={};const uh=new Nl;function ni(r){const e=r.toString();if(mn.hasOwnProperty(e))return mn[e];{const t=uh.pattern(e);return mn[e]=t,t}}function dh(){mn={}}const Bl="Complement Sets are not supported for first char optimization",bn=`Unable to use "first char" lexer optimizations:
`;function hh(r,e=!1){try{const t=ni(r);return Yi(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===Bl)e&&Dl(`${bn} Unable to optimize: < ${r.toString()} >
Complement Sets cannot be automatically optimized.
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=`
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),zi(`${bn}
Failed parsing: < ${r.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Yi(r,e,t){switch(r.type){case"Disjunction":for(let i=0;i<r.value.length;i++)Yi(r.value[i],e,t);break;case"Alternative":const n=r.value;for(let i=0;i<n.length;i++){const s=n[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":en(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(Bl);C(a.value,l=>{if(typeof l=="number")en(l,e,t);else{const c=l;if(t===!0)for(let u=c.from;u<=c.to;u++)en(u,e,t);else{for(let u=c.from;u<=c.to&&u<Ar;u++)en(u,e,t);if(c.to>=Ar){const u=c.from>=Ar?c.from:Ar,d=c.to,h=et(u),f=et(d);for(let m=h;m<=f;m++)e[m]=m}}}});break;case"Group":Yi(a.value,e,t);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&qi(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return z(e)}function en(r,e,t){const n=et(r);e[n]=n,t===!0&&fh(r,e)}function fh(r,e){const t=String.fromCharCode(r),n=t.toUpperCase();if(n!==t){const i=et(n.charCodeAt(0));e[i]=i}else{const i=t.toLowerCase();if(i!==t){const s=et(i.charCodeAt(0));e[s]=s}}}function da(r,e){return Ot(r.value,t=>{if(typeof t=="number")return de(e,t);{const n=t;return Ot(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function qi(r){const e=r.quantifier;return e&&e.atLeast===0?!0:r.value?te(r.value)?Oe(r.value,qi):qi(r.value):!1}class ph extends ei{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){de(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?da(e,this.targetCharCodes)===void 0&&(this.found=!0):da(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Ds(r,e){if(e instanceof RegExp){const t=ni(e),n=new ph(r);return n.visit(t),n.found}else return Ot(e,t=>de(r,t.charCodeAt(0)))!==void 0}const vt="PATTERN",Er="defaultMode",tn="modes";let Kl=typeof new RegExp("(?:)").sticky=="boolean";function mh(r,e){e=Is(e,{useSticky:Kl,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:($,T)=>T()});const t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{Fh()});let n;t("Reject Lexer.NA",()=>{n=Qn(r,$=>$[vt]===he.NA)});let i=!1,s;t("Transform Patterns",()=>{i=!1,s=A(n,$=>{const T=$[vt];if(Xe(T)){const I=T.source;return I.length===1&&I!=="^"&&I!=="$"&&I!=="."&&!T.ignoreCase?I:I.length===2&&I[0]==="\\"&&!de(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],I[1])?I[1]:e.useSticky?fa(T):ha(T)}else{if(Et(T))return i=!0,{exec:T};if(typeof T=="object")return i=!0,T;if(typeof T=="string"){if(T.length===1)return T;{const I=T.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),G=new RegExp(I);return e.useSticky?fa(G):ha(G)}}else throw Error("non exhaustive match")}})});let a,o,l,c,u;t("misc mapping",()=>{a=A(n,$=>$.tokenTypeIdx),o=A(n,$=>{const T=$.GROUP;if(T!==he.SKIPPED){if(fe(T))return T;if(qe(T))return!1;throw Error("non exhaustive match")}}),l=A(n,$=>{const T=$.LONGER_ALT;if(T)return te(T)?A(T,I=>na(n,I)):[na(n,T)]}),c=A(n,$=>$.PUSH_MODE),u=A(n,$=>N($,"POP_MODE"))});let d;t("Line Terminator Handling",()=>{const $=Hl(e.lineTerminatorCharacters);d=A(n,T=>!1),e.positionTracking!=="onlyOffset"&&(d=A(n,T=>N(T,"LINE_BREAKS")?!!T.LINE_BREAKS:jl(T,$)===!1&&Ds($,T.PATTERN)))});let h,f,m,g;t("Misc Mapping #2",()=>{h=A(n,Vl),f=A(s,Ph),m=le(n,($,T)=>{const I=T.GROUP;return fe(I)&&I!==he.SKIPPED&&($[I]=[]),$},{}),g=A(s,($,T)=>({pattern:s[T],longerAlt:l[T],canLineTerminator:d[T],isCustom:h[T],short:f[T],group:o[T],push:c[T],pop:u[T],tokenTypeIdx:a[T],tokenType:n[T]}))});let k=!0,R=[];return e.safeMode||t("First Char Optimization",()=>{R=le(n,($,T,I)=>{if(typeof T.PATTERN=="string"){const G=T.PATTERN.charCodeAt(0),ie=et(G);Ei($,ie,g[I])}else if(te(T.START_CHARS_HINT)){let G;C(T.START_CHARS_HINT,ie=>{const Le=typeof ie=="string"?ie.charCodeAt(0):ie,ye=et(Le);G!==ye&&(G=ye,Ei($,ye,g[I]))})}else if(Xe(T.PATTERN))if(T.PATTERN.unicode)k=!1,e.ensureOptimizations&&zi(`${bn} Unable to analyze < ${T.PATTERN.toString()} > pattern.
The regexp unicode flag is not currently supported by the regexp-to-ast library.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const G=hh(T.PATTERN,e.ensureOptimizations);D(G)&&(k=!1),C(G,ie=>{Ei($,ie,g[I])})}else e.ensureOptimizations&&zi(`${bn} TokenType: <${T.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`),k=!1;return $},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:R,hasCustom:i,canBeOptimized:k}}function gh(r,e){let t=[];const n=Th(r);t=t.concat(n.errors);const i=vh(n.valid),s=i.valid;return t=t.concat(i.errors),t=t.concat(yh(s)),t=t.concat(Sh(s)),t=t.concat(Ch(s,e)),t=t.concat(Nh(s)),t}function yh(r){let e=[];const t=ke(r,n=>Xe(n[vt]));return e=e.concat($h(t)),e=e.concat(kh(t)),e=e.concat(xh(t)),e=e.concat(Ih(t)),e=e.concat(Eh(t)),e}function Th(r){const e=ke(r,i=>!N(i,vt)),t=A(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:H.MISSING_PATTERN,tokenTypes:[i]})),n=Xn(r,e);return{errors:t,valid:n}}function vh(r){const e=ke(r,i=>{const s=i[vt];return!Xe(s)&&!Et(s)&&!N(s,"exec")&&!fe(s)}),t=A(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:H.INVALID_PATTERN,tokenTypes:[i]})),n=Xn(r,e);return{errors:t,valid:n}}const Rh=/[^\\][$]/;function $h(r){class e extends ei{constructor(){super(...arguments),this.found=!1}visitEndAnchor(i){this.found=!0}}const t=ke(r,n=>{const i=n.PATTERN;try{const s=ni(i),a=new e;return a.visit(s),a.found}catch{return Rh.test(i.source)}});return A(t,n=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:H.EOI_ANCHOR_FOUND,tokenTypes:[n]}))}function Eh(r){const e=ke(r,t=>t.PATTERN.test(""));return A(e,t=>({message:"Token Type: ->"+t.name+"<- static 'PATTERN' must not match an empty string",type:H.EMPTY_MATCH_PATTERN,tokenTypes:[t]}))}const Ah=/[^\\[][\^]|^\^/;function kh(r){class e extends ei{constructor(){super(...arguments),this.found=!1}visitStartAnchor(i){this.found=!0}}const t=ke(r,n=>{const i=n.PATTERN;try{const s=ni(i),a=new e;return a.visit(s),a.found}catch{return Ah.test(i.source)}});return A(t,n=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:H.SOI_ANCHOR_FOUND,tokenTypes:[n]}))}function xh(r){const e=ke(r,t=>{const n=t[vt];return n instanceof RegExp&&(n.multiline||n.global)});return A(e,t=>({message:"Token Type: ->"+t.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:H.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[t]}))}function Ih(r){const e=[];let t=A(r,i=>le(r,(s,a)=>(i.PATTERN.source===a.PATTERN.source&&!de(e,a)&&a.PATTERN!==he.NA&&(e.push(a),s.push(a)),s),[]));t=Mr(t);const n=ke(t,i=>i.length>1);return A(n,i=>{const s=A(i,a=>a.name);return{message:`The same RegExp pattern ->${Pe(i).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:H.DUPLICATE_PATTERNS_FOUND,tokenTypes:i}})}function Sh(r){const e=ke(r,t=>{if(!N(t,"GROUP"))return!1;const n=t.GROUP;return n!==he.SKIPPED&&n!==he.NA&&!fe(n)});return A(e,t=>({message:"Token Type: ->"+t.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:H.INVALID_GROUP_TYPE_FOUND,tokenTypes:[t]}))}function Ch(r,e){const t=ke(r,n=>n.PUSH_MODE!==void 0&&!de(e,n.PUSH_MODE));return A(t,n=>({message:`Token Type: ->${n.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${n.PUSH_MODE}<-which does not exist`,type:H.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[n]}))}function Nh(r){const e=[],t=le(r,(n,i,s)=>{const a=i.PATTERN;return a===he.NA||(fe(a)?n.push({str:a,idx:s,tokenType:i}):Xe(a)&&Lh(a)&&n.push({str:a.source,idx:s,tokenType:i})),n},[]);return C(r,(n,i)=>{C(t,({str:s,idx:a,tokenType:o})=>{if(i<a&&wh(s,n.PATTERN)){const l=`Token: ->${o.name}<- can never be matched.
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:H.UNREACHABLE_PATTERN,tokenTypes:[n,o]})}})}),e}function wh(r,e){if(Xe(e)){const t=e.exec(r);return t!==null&&t.index===0}else{if(Et(e))return e(r,0,[],{});if(N(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}function Lh(r){return Ot([".","\\","[","]","|","^","$","(",")","?","*","+","{"],e=>r.source.indexOf(e)!==-1)===void 0}function ha(r){const e=r.ignoreCase?"i":"";return new RegExp(`^(?:${r.source})`,e)}function fa(r){const e=r.ignoreCase?"iy":"y";return new RegExp(`${r.source}`,e)}function bh(r,e,t){const n=[];return N(r,Er)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Er+`> property in its definition
`,type:H.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),N(r,tn)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+tn+`> property in its definition
`,type:H.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),N(r,tn)&&N(r,Er)&&!N(r.modes,r.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Er}: <${r.defaultMode}>which does not exist
`,type:H.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),N(r,tn)&&C(r.modes,(i,s)=>{C(i,(a,o)=>{if(qe(a))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
`,type:H.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(N(a,"LONGER_ALT")){const l=te(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];C(l,c=>{!qe(c)&&!de(i,c)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${a.name}> outside of mode <${s}>
`,type:H.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function _h(r,e,t){const n=[];let i=!1;const s=Mr(Ne(z(r.modes))),a=Qn(s,l=>l[vt]===he.NA),o=Hl(t);return e&&C(a,l=>{const c=jl(l,o);if(c!==!1){const u={message:Dh(l,c),type:c.issue,tokenType:l};n.push(u)}else N(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):Ds(o,l.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
This Lexer has been defined to track line and column information,
But none of the Token Types can be identified as matching a line terminator.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
for details.`,type:H.NO_LINE_BREAKS_FLAGS}),n}function Oh(r){const e={},t=_t(r);return C(t,n=>{const i=r[n];if(te(i))e[n]=[];else throw Error("non exhaustive match")}),e}function Vl(r){const e=r.PATTERN;if(Xe(e))return!1;if(Et(e)||N(e,"exec"))return!0;if(fe(e))return!1;throw Error("non exhaustive match")}function Ph(r){return fe(r)&&r.length===1?r.charCodeAt(0):!1}const Mh={test:function(r){const e=r.length;for(let t=this.lastIndex;t<e;t++){const n=r.charCodeAt(t);if(n===10)return this.lastIndex=t+1,!0;if(n===13)return r.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function jl(r,e){if(N(r,"LINE_BREAKS"))return!1;if(Xe(r.PATTERN)){try{Ds(e,r.PATTERN)}catch(t){return{issue:H.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if(fe(r.PATTERN))return!1;if(Vl(r))return{issue:H.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Dh(r,e){if(e.issue===H.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
The problem is in the <${r.name}> Token Type
Root cause: ${e.errMsg}.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===H.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
The problem is in the <${r.name}> Token Type
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Hl(r){return A(r,e=>fe(e)?e.charCodeAt(0):e)}function Ei(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}const Ar=256;let gn=[];function et(r){return r<Ar?r:gn[r]}function Fh(){if(D(gn)){gn=new Array(65536);for(let r=0;r<65536;r++)gn[r]=r>255?255+~~(r/255):r}}function Gr(r,e){const t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function _n(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}let pa=1;const Wl={};function Br(r){const e=Uh(r);Gh(e),Kh(e),Bh(e),C(e,t=>{t.isParent=t.categoryMatches.length>0})}function Uh(r){let e=ne(r),t=r,n=!0;for(;n;){t=Mr(Ne(A(t,s=>s.CATEGORIES)));const i=Xn(t,e);e=e.concat(i),D(i)?n=!1:t=i}return e}function Gh(r){C(r,e=>{Yl(e)||(Wl[pa]=e,e.tokenTypeIdx=pa++),ma(e)&&!te(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),ma(e)||(e.CATEGORIES=[]),Vh(e)||(e.categoryMatches=[]),jh(e)||(e.categoryMatchesMap={})})}function Bh(r){C(r,e=>{e.categoryMatches=[],C(e.categoryMatchesMap,(t,n)=>{e.categoryMatches.push(Wl[n].tokenTypeIdx)})})}function Kh(r){C(r,e=>{zl([],e)})}function zl(r,e){C(r,t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),C(e.CATEGORIES,t=>{const n=r.concat(e);de(n,t)||zl(n,t)})}function Yl(r){return N(r,"tokenTypeIdx")}function ma(r){return N(r,"CATEGORIES")}function Vh(r){return N(r,"categoryMatches")}function jh(r){return N(r,"categoryMatchesMap")}function Hh(r){return N(r,"tokenTypeIdx")}const Xi={buildUnableToPopLexerModeMessage(r){return`Unable to pop Lexer Mode after encountering Token ->${r.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(r,e,t,n,i){return`unexpected character: ->${r.charAt(e)}<- at offset: ${e}, skipped ${t} characters.`}};var H;(function(r){r[r.MISSING_PATTERN=0]="MISSING_PATTERN",r[r.INVALID_PATTERN=1]="INVALID_PATTERN",r[r.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",r[r.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",r[r.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",r[r.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",r[r.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",r[r.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",r[r.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",r[r.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",r[r.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",r[r.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",r[r.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",r[r.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",r[r.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",r[r.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",r[r.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",r[r.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(H||(H={}));const kr={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Xi,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(kr);class he{constructor(e,t=kr){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:l}=Fl(s),c=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,l}else return s()},typeof t=="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=Ae({},kr,t);const n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===kr.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Mh;else if(this.config.lineTerminatorCharacters===kr.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(t.safeMode&&t.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),te(e)?i={modes:{defaultMode:ne(e)},defaultMode:Er}:(s=!1,i=ne(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(bh(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(_h(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},C(i.modes,(o,l)=>{i.modes[l]=Qn(o,c=>qe(c))});const a=_t(i.modes);if(C(i.modes,(o,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(gh(o,a))}),D(this.lexerDefinitionErrors)){Br(o);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=mh(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=c.charCodeToPatternIdxToConfig,this.emptyGroups=Ae({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,!D(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const o=A(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+o)}C(this.lexerDefinitionWarning,o=>{Dl(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(Kl?(this.chopInput=ra,this.match=this.matchWithTest):(this.updateLastIndex=q,this.match=this.matchWithExec),s&&(this.handleModes=q),this.trackStartLines===!1&&(this.computeNewColumn=ra),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=q),/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=le(this.canModeBeOptimized,(l,c,u)=>(c===!1&&l.push(u),l),[]);if(t.ensureOptimizations&&!D(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",()=>{dh()}),this.TRACE_INIT("toFastProperties",()=>{Ul(this)})})}tokenize(e,t=this.defaultMode){if(!D(this.lexerDefinitionErrors)){const n=A(this.lexerDefinitionErrors,i=>i.message).join(`-----------------------
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+n)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,i,s,a,o,l,c,u,d,h,f,m,g,k,R;const $=e,T=$.length;let I=0,G=0;const ie=this.hasCustom?0:Math.floor(e.length/10),Le=new Array(ie),ye=[];let Fe=this.trackStartLines?1:void 0,Se=this.trackStartLines?1:void 0;const E=Oh(this.emptyGroups),y=this.trackStartLines,S=this.config.lineTerminatorsPattern;let x=0,_=[],b=[];const L=[],Te=[];Object.freeze(Te);let Y;function V(){return _}function ut(se){const Ce=et(se),St=b[Ce];return St===void 0?Te:St}const fu=se=>{if(L.length===1&&se.tokenType.PUSH_MODE===void 0){const Ce=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(se);ye.push({offset:se.startOffset,line:se.startLine,column:se.startColumn,length:se.image.length,message:Ce})}else{L.pop();const Ce=Pt(L);_=this.patternIdxToConfig[Ce],b=this.charCodeToPatternIdxToConfig[Ce],x=_.length;const St=this.canModeBeOptimized[Ce]&&this.config.safeMode===!1;b&&St?Y=ut:Y=V}};function Qs(se){L.push(se),b=this.charCodeToPatternIdxToConfig[se],_=this.patternIdxToConfig[se],x=_.length,x=_.length;const Ce=this.canModeBeOptimized[se]&&this.config.safeMode===!1;b&&Ce?Y=ut:Y=V}Qs.call(this,t);let be;const Zs=this.config.recoveryEnabled;for(;I<T;){l=null;const se=$.charCodeAt(I),Ce=Y(se),St=Ce.length;for(n=0;n<St;n++){be=Ce[n];const ve=be.pattern;c=null;const Ke=be.short;if(Ke!==!1?se===Ke&&(l=ve):be.isCustom===!0?(R=ve.exec($,I,Le,E),R!==null?(l=R[0],R.payload!==void 0&&(c=R.payload)):l=null):(this.updateLastIndex(ve,I),l=this.match(ve,e,I)),l!==null){if(o=be.longerAlt,o!==void 0){const Ze=o.length;for(s=0;s<Ze;s++){const Ve=_[o[s]],dt=Ve.pattern;if(u=null,Ve.isCustom===!0?(R=dt.exec($,I,Le,E),R!==null?(a=R[0],R.payload!==void 0&&(u=R.payload)):a=null):(this.updateLastIndex(dt,I),a=this.match(dt,e,I)),a&&a.length>l.length){l=a,c=u,be=Ve;break}}}break}}if(l!==null){if(d=l.length,h=be.group,h!==void 0&&(f=be.tokenTypeIdx,m=this.createTokenInstance(l,I,f,be.tokenType,Fe,Se,d),this.handlePayload(m,c),h===!1?G=this.addToken(Le,G,m):E[h].push(m)),e=this.chopInput(e,d),I=I+d,Se=this.computeNewColumn(Se,d),y===!0&&be.canLineTerminator===!0){let ve=0,Ke,Ze;S.lastIndex=0;do Ke=S.test(l),Ke===!0&&(Ze=S.lastIndex-1,ve++);while(Ke===!0);ve!==0&&(Fe=Fe+ve,Se=d-Ze,this.updateTokenEndLineColumnLocation(m,h,Ze,ve,Fe,Se,d))}this.handleModes(be,fu,Qs,m)}else{const ve=I,Ke=Fe,Ze=Se;let Ve=Zs===!1;for(;Ve===!1&&I<T;)for(e=this.chopInput(e,1),I++,i=0;i<x;i++){const dt=_[i],hi=dt.pattern,Js=dt.short;if(Js!==!1?$.charCodeAt(I)===Js&&(Ve=!0):dt.isCustom===!0?Ve=hi.exec($,I,Le,E)!==null:(this.updateLastIndex(hi,I),Ve=hi.exec(e)!==null),Ve===!0)break}if(g=I-ve,Se=this.computeNewColumn(Se,g),k=this.config.errorMessageProvider.buildUnexpectedCharactersMessage($,ve,g,Ke,Ze),ye.push({offset:ve,line:Ke,column:Ze,length:g,message:k}),Zs===!1)break}}return this.hasCustom||(Le.length=G),{tokens:Le,groups:E,errors:ye}}handleModes(e,t,n,i){if(e.pop===!0){const s=e.push;t(i),s!==void 0&&n.call(this,s)}else e.push!==void 0&&n.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,n,i,s,a,o){let l,c;t!==void 0&&(l=n===o-1,c=l?-1:0,i===1&&l===!0||(e.endLine=s+c,e.endColumn=a-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,i){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,t,n,i,s,a){return{image:e,startOffset:t,startLine:s,startColumn:a,tokenTypeIdx:n,tokenType:i}}createFullToken(e,t,n,i,s,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:i}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}matchWithTest(e,t,n){return e.test(t)===!0?t.substring(n,e.lastIndex):null}matchWithExec(e,t){const n=e.exec(t);return n!==null?n[0]:null}}he.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",he.NA=/NOT_APPLICABLE/;function bt(r){return ql(r)?r.LABEL:r.name}function ql(r){return fe(r.LABEL)&&r.LABEL!==""}const Wh="parent",ga="categories",ya="label",Ta="group",va="push_mode",Ra="pop_mode",$a="longer_alt",Ea="line_breaks",Aa="start_chars_hint";function Xl(r){return zh(r)}function zh(r){const e=r.pattern,t={};if(t.name=r.name,qe(e)||(t.PATTERN=e),N(r,Wh))throw`The parent property is no longer supported.
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return N(r,ga)&&(t.CATEGORIES=r[ga]),Br([t]),N(r,ya)&&(t.LABEL=r[ya]),N(r,Ta)&&(t.GROUP=r[Ta]),N(r,Ra)&&(t.POP_MODE=r[Ra]),N(r,va)&&(t.PUSH_MODE=r[va]),N(r,$a)&&(t.LONGER_ALT=r[$a]),N(r,Ea)&&(t.LINE_BREAKS=r[Ea]),N(r,Aa)&&(t.START_CHARS_HINT=r[Aa]),t}const tt=Xl({name:"EOF",pattern:he.NA});Br([tt]);function Fs(r,e,t,n,i,s,a,o){return{image:e,startOffset:t,endOffset:n,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:r.tokenTypeIdx,tokenType:r}}function Ql(r,e){return Gr(r,e)}const wt={buildMismatchTokenMessage({expected:r,actual:e,previous:t,ruleName:n}){return`Expecting ${ql(r)?`--> ${bt(r)} <--`:`token of type --> ${r.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:r,ruleName:e}){return"Redundant input, expecting EOF but found: "+r.image},buildNoViableAltMessage({expectedPathsPerAlt:r,actual:e,previous:t,customUserDescription:n,ruleName:i}){const s="Expecting: ",a=`
but found: '`+Pe(e).image+"'";if(n)return s+n+a;{const o=le(r,(u,d)=>u.concat(d),[]),l=A(o,u=>`[${A(u,d=>bt(d)).join(", ")}]`),c=`one of these possible Token sequences:
${A(l,(u,d)=>` ${d+1}. ${u}`).join(`
`)}`;return s+c+a}},buildEarlyExitMessage({expectedIterationPaths:r,actual:e,customUserDescription:t,ruleName:n}){const i="Expecting: ",s=`
but found: '`+Pe(e).image+"'";if(t)return i+t+s;{const a=`expecting at least one iteration which starts with one of these possible Token sequences::
<${A(r,o=>`[${A(o,l=>bt(l)).join(",")}]`).join(" ,")}>`;return i+a+s}}};Object.freeze(wt);const Yh={buildRuleNotFoundError(r,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+r.name+"<-"}},mt={buildDuplicateFoundError(r,e){function t(u){return u instanceof F?u.terminalType.name:u instanceof ce?u.nonTerminalName:""}const n=r.name,i=Pe(e),s=i.idx,a=Ue(i),o=t(i),l=s>0;let c=`->${a}${l?s:""}<- ${o?`with argument: ->${o}<-`:""}
appears more than once (${e.length} times) in the top level rule: ->${n}<-.
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
`;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
`),c},buildNamespaceConflictError(r){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${r.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(r){const e=A(r.prefixPath,n=>bt(n)).join(", "),t=r.alternation.idx===0?"":r.alternation.idx;return`Ambiguous alternatives: <${r.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${t}> inside <${r.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(r){const e=A(r.prefixPath,i=>bt(i)).join(", "),t=r.alternation.idx===0?"":r.alternation.idx;let n=`Ambiguous Alternatives Detected: <${r.ambiguityIndices.join(" ,")}> in <OR${t}> inside <${r.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,n},buildEmptyRepetitionError(r){let e=Ue(r.repetition);return r.repetition.idx!==0&&(e+=r.repetition.idx),`The repetition <${e}> within Rule <${r.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(r){return"deprecated"},buildEmptyAlternationError(r){return`Ambiguous empty alternative: <${r.emptyChoiceIdx+1}> in <OR${r.alternation.idx}> inside <${r.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(r){return`An Alternation cannot have more than 256 alternatives:
<OR${r.alternation.idx}> inside <${r.topLevelRule.name}> Rule.
has ${r.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(r){const e=r.topLevelRule.name,t=A(r.leftRecursionPath,i=>i.name),n=`${e} --> ${t.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
rule: <${e}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is:
${n}
To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(r){return"deprecated"},buildDuplicateRuleNameError(r){let e;return r.topLevelRule instanceof Kt?e=r.topLevelRule.name:e=r.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${r.grammarName}<-`}};function qh(r,e){const t=new Xh(r,e);return t.resolveRefs(),t.errors}class Xh extends Vt{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){C(z(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:ue.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Qh extends ri{constructor(e,t){super(),this.topProd=e,this.path=t,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=ne(this.path.ruleStack).reverse(),this.occurrenceStack=ne(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){D(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Zh extends Qh{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=t.concat(n),s=new pe({definition:i});this.possibleTokTypes=Ur(s),this.found=!0}}}class ii extends ri{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Jh extends ii{walkMany(e,t,n){if(e.idx===this.occurrence){const i=Pe(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,t,n)}}class ka extends ii{walkManySep(e,t,n){if(e.idx===this.occurrence){const i=Pe(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,t,n)}}class ef extends ii{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){const i=Pe(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,t,n)}}class xa extends ii{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){const i=Pe(t.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,t,n)}}function Qi(r,e,t=[]){t=ne(t);let n=[],i=0;function s(o){return o.concat(Z(r,i+1))}function a(o){const l=Qi(s(o),e,t);return n.concat(l)}for(;t.length<e&&i<r.length;){const o=r[i];if(o instanceof pe||o instanceof ce)return a(o.definition);if(o instanceof re)n=a(o.definition);else if(o instanceof xe){const l=o.definition.concat([new j({definition:o.definition})]);return a(l)}else if(o instanceof Ie){const l=[new pe({definition:o.definition}),new j({definition:[new F({terminalType:o.separator})].concat(o.definition)})];return a(l)}else if(o instanceof me){const l=o.definition.concat([new j({definition:[new F({terminalType:o.separator})].concat(o.definition)})]);n=a(l)}else if(o instanceof j){const l=o.definition.concat([new j({definition:o.definition})]);n=a(l)}else{if(o instanceof ge)return C(o.definition,l=>{D(l.definition)===!1&&(n=a(l.definition))}),n;if(o instanceof F)t.push(o.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:t,suffixDef:Z(r,i)}),n}function Zl(r,e,t,n){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const l=e.length,c=l-n-1,u=[],d=[];for(d.push({idx:-1,def:r,ruleStack:[],occurrenceStack:[]});!D(d);){const h=d.pop();if(h===a){o&&Pt(d).idx<=c&&d.pop();continue}const f=h.def,m=h.idx,g=h.ruleStack,k=h.occurrenceStack;if(D(f))continue;const R=f[0];if(R===i){const $={idx:m,def:Z(f),ruleStack:Lr(g),occurrenceStack:Lr(k)};d.push($)}else if(R instanceof F)if(m<l-1){const $=m+1,T=e[$];if(t(T,R.terminalType)){const I={idx:$,def:Z(f),ruleStack:g,occurrenceStack:k};d.push(I)}}else if(m===l-1)u.push({nextTokenType:R.terminalType,nextTokenOccurrence:R.idx,ruleStack:g,occurrenceStack:k}),o=!0;else throw Error("non exhaustive match");else if(R instanceof ce){const $=ne(g);$.push(R.nonTerminalName);const T=ne(k);T.push(R.idx);const I={idx:m,def:R.definition.concat(s,Z(f)),ruleStack:$,occurrenceStack:T};d.push(I)}else if(R instanceof re){const $={idx:m,def:Z(f),ruleStack:g,occurrenceStack:k};d.push($),d.push(a);const T={idx:m,def:R.definition.concat(Z(f)),ruleStack:g,occurrenceStack:k};d.push(T)}else if(R instanceof xe){const $=new j({definition:R.definition,idx:R.idx}),T=R.definition.concat([$],Z(f)),I={idx:m,def:T,ruleStack:g,occurrenceStack:k};d.push(I)}else if(R instanceof Ie){const $=new F({terminalType:R.separator}),T=new j({definition:[$].concat(R.definition),idx:R.idx}),I=R.definition.concat([T],Z(f)),G={idx:m,def:I,ruleStack:g,occurrenceStack:k};d.push(G)}else if(R instanceof me){const $={idx:m,def:Z(f),ruleStack:g,occurrenceStack:k};d.push($),d.push(a);const T=new F({terminalType:R.separator}),I=new j({definition:[T].concat(R.definition),idx:R.idx}),G=R.definition.concat([I],Z(f)),ie={idx:m,def:G,ruleStack:g,occurrenceStack:k};d.push(ie)}else if(R instanceof j){const $={idx:m,def:Z(f),ruleStack:g,occurrenceStack:k};d.push($),d.push(a);const T=new j({definition:R.definition,idx:R.idx}),I=R.definition.concat([T],Z(f)),G={idx:m,def:I,ruleStack:g,occurrenceStack:k};d.push(G)}else if(R instanceof ge)for(let $=R.definition.length-1;$>=0;$--){const T=R.definition[$],I={idx:m,def:T.definition.concat(Z(f)),ruleStack:g,occurrenceStack:k};d.push(I),d.push(a)}else if(R instanceof pe)d.push({idx:m,def:R.definition.concat(Z(f)),ruleStack:g,occurrenceStack:k});else if(R instanceof Kt)d.push(tf(R,m,g,k));else throw Error("non exhaustive match")}return u}function tf(r,e,t,n){const i=ne(t);i.push(r.name);const s=ne(n);return s.push(1),{idx:e,def:r.definition,ruleStack:i,occurrenceStack:s}}var B;(function(r){r[r.OPTION=0]="OPTION",r[r.REPETITION=1]="REPETITION",r[r.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",r[r.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",r[r.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",r[r.ALTERNATION=5]="ALTERNATION"})(B||(B={}));function Us(r){if(r instanceof re||r==="Option")return B.OPTION;if(r instanceof j||r==="Repetition")return B.REPETITION;if(r instanceof xe||r==="RepetitionMandatory")return B.REPETITION_MANDATORY;if(r instanceof Ie||r==="RepetitionMandatoryWithSeparator")return B.REPETITION_MANDATORY_WITH_SEPARATOR;if(r instanceof me||r==="RepetitionWithSeparator")return B.REPETITION_WITH_SEPARATOR;if(r instanceof ge||r==="Alternation")return B.ALTERNATION;throw Error("non exhaustive match")}function Ia(r){const{occurrence:e,rule:t,prodType:n,maxLookahead:i}=r,s=Us(n);return s===B.ALTERNATION?si(e,t,i):ai(e,t,s,i)}function rf(r,e,t,n,i,s){const a=si(r,e,t),o=tc(a)?_n:Gr;return s(a,n,o,i)}function nf(r,e,t,n,i,s){const a=ai(r,e,i,t),o=tc(a)?_n:Gr;return s(a[0],o,n)}function sf(r,e,t,n){const i=r.length,s=Oe(r,a=>Oe(a,o=>o.length===1));if(e)return function(a){const o=A(a,l=>l.GATE);for(let l=0;l<i;l++){const c=r[l],u=c.length,d=o[l];if(!(d!==void 0&&d.call(this)===!1))e:for(let h=0;h<u;h++){const f=c[h],m=f.length;for(let g=0;g<m;g++){const k=this.LA(g+1);if(t(k,f[g])===!1)continue e}return l}}};if(s&&!n){const a=A(r,l=>Ne(l)),o=le(a,(l,c,u)=>(C(c,d=>{N(l,d.tokenTypeIdx)||(l[d.tokenTypeIdx]=u),C(d.categoryMatches,h=>{N(l,h)||(l[h]=u)})}),l),{});return function(){const l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){const o=r[a],l=o.length;e:for(let c=0;c<l;c++){const u=o[c],d=u.length;for(let h=0;h<d;h++){const f=this.LA(h+1);if(t(f,u[h])===!1)continue e}return a}}}}function af(r,e,t){const n=Oe(r,s=>s.length===1),i=r.length;if(n&&!t){const s=Ne(r);if(s.length===1&&D(s[0].categoryMatches)){const a=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{const a=le(s,(o,l,c)=>(o[l.tokenTypeIdx]=!0,C(l.categoryMatches,u=>{o[u]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const a=r[s],o=a.length;for(let l=0;l<o;l++){const c=this.LA(l+1);if(e(c,a[l])===!1)continue e}return!0}return!1}}class of extends ri{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=n.concat(i),!0):!1}walkOption(e,t,n){this.checkIsTarget(e,B.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,B.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,B.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,B.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,B.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}}class Jl extends Vt{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,B.OPTION)}visitRepetition(e){this.checkIsTarget(e,B.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,B.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,B.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,B.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,B.ALTERNATION)}}function Sa(r){const e=new Array(r);for(let t=0;t<r;t++)e[t]=[];return e}function Ai(r){let e=[""];for(let t=0;t<r.length;t++){const n=r[t],i=[];for(let s=0;s<e.length;s++){const a=e[s];i.push(a+"_"+n.tokenTypeIdx);for(let o=0;o<n.categoryMatches.length;o++){const l="_"+n.categoryMatches[o];i.push(a+l)}}e=i}return e}function lf(r,e,t){for(let n=0;n<r.length;n++){if(n===t)continue;const i=r[n];for(let s=0;s<e.length;s++){const a=e[s];if(i[a]===!0)return!1}}return!0}function ec(r,e){const t=A(r,a=>Qi([a],1)),n=Sa(t.length),i=A(t,a=>{const o={};return C(a,l=>{const c=Ai(l.partialPath);C(c,u=>{o[u]=!0})}),o});let s=t;for(let a=1;a<=e;a++){const o=s;s=Sa(o.length);for(let l=0;l<o.length;l++){const c=o[l];for(let u=0;u<c.length;u++){const d=c[u].partialPath,h=c[u].suffixDef,f=Ai(d);if(lf(i,f,l)||D(h)||d.length===e){const m=n[l];if(Zi(m,d)===!1){m.push(d);for(let g=0;g<f.length;g++){const k=f[g];i[l][k]=!0}}}else{const m=Qi(h,a+1,d);s[l]=s[l].concat(m),C(m,g=>{const k=Ai(g.partialPath);C(k,R=>{i[l][R]=!0})})}}}}return n}function si(r,e,t,n){const i=new Jl(r,B.ALTERNATION,n);return e.accept(i),ec(i.result,t)}function ai(r,e,t,n){const i=new Jl(r,t);e.accept(i);const s=i.result,a=new of(e,r,t).startWalking(),o=new pe({definition:s}),l=new pe({definition:a});return ec([o,l],n)}function Zi(r,e){e:for(let t=0;t<r.length;t++){const n=r[t];if(n.length===e.length){for(let i=0;i<n.length;i++){const s=e[i],a=n[i];if(!(s===a||a.categoryMatchesMap[s.tokenTypeIdx]!==void 0))continue e}return!0}}return!1}function cf(r,e){return r.length<e.length&&Oe(r,(t,n)=>{const i=e[n];return t===i||i.categoryMatchesMap[t.tokenTypeIdx]})}function tc(r){return Oe(r,e=>Oe(e,t=>Oe(t,n=>D(n.categoryMatches))))}function uf(r){const e=r.lookaheadStrategy.validate({rules:r.rules,tokenTypes:r.tokenTypes,grammarName:r.grammarName});return A(e,t=>Object.assign({type:ue.CUSTOM_LOOKAHEAD_VALIDATION},t))}function df(r,e,t,n){const i=Ee(r,l=>hf(l,t)),s=kf(r,e,t),a=Ee(r,l=>Rf(l,t)),o=Ee(r,l=>mf(l,r,n,t));return i.concat(s,a,o)}function hf(r,e){const t=new pf;r.accept(t);const n=t.allProductions,i=Vu(n,ff),s=Me(i,a=>a.length>1);return A(z(s),a=>{const o=Pe(a),l=e.buildDuplicateFoundError(r,a),c=Ue(o),u={message:l,type:ue.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:c,occurrence:o.idx},d=rc(o);return d&&(u.parameter=d),u})}function ff(r){return`${Ue(r)}_#_${r.idx}_#_${rc(r)}`}function rc(r){return r instanceof F?r.terminalType.name:r instanceof ce?r.nonTerminalName:""}class pf extends Vt{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function mf(r,e,t,n){const i=[];if(le(e,(s,a)=>a.name===r.name?s+1:s,0)>1){const s=n.buildDuplicateRuleNameError({topLevelRule:r,grammarName:t});i.push({message:s,type:ue.DUPLICATE_RULE_NAME,ruleName:r.name})}return i}function gf(r,e,t){const n=[];let i;return de(e,r)||(i=`Invalid rule override, rule: ->${r}<- cannot be overridden in the grammar: ->${t}<-as it is not defined in any of the super grammars `,n.push({message:i,type:ue.INVALID_RULE_OVERRIDE,ruleName:r})),n}function nc(r,e,t,n=[]){const i=[],s=yn(e.definition);if(D(s))return[];{const a=r.name;de(s,r)&&i.push({message:t.buildLeftRecursionError({topLevelRule:r,leftRecursionPath:n}),type:ue.LEFT_RECURSION,ruleName:a});const o=Xn(s,n.concat([r])),l=Ee(o,c=>{const u=ne(n);return u.push(c),nc(r,c,t,u)});return i.concat(l)}}function yn(r){let e=[];if(D(r))return e;const t=Pe(r);if(t instanceof ce)e.push(t.referencedRule);else if(t instanceof pe||t instanceof re||t instanceof xe||t instanceof Ie||t instanceof me||t instanceof j)e=e.concat(yn(t.definition));else if(t instanceof ge)e=Ne(A(t.definition,s=>yn(s.definition)));else if(!(t instanceof F))throw Error("non exhaustive match");const n=Ln(t),i=r.length>1;if(n&&i){const s=Z(r);return e.concat(yn(s))}else return e}class Gs extends Vt{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function yf(r,e){const t=new Gs;r.accept(t);const n=t.alternations;return Ee(n,i=>{const s=Lr(i.definition);return Ee(s,(a,o)=>{const l=Zl([a],[],Gr,1);return D(l)?[{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:i,emptyChoiceIdx:o}),type:ue.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:i.idx,alternative:o+1}]:[]})})}function Tf(r,e,t){const n=new Gs;r.accept(n);let i=n.alternations;return i=Qn(i,s=>s.ignoreAmbiguities===!0),Ee(i,s=>{const a=s.idx,o=s.maxLookahead||e,l=si(a,r,o,s),c=Ef(l,s,r,t),u=Af(l,s,r,t);return c.concat(u)})}class vf extends Vt{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function Rf(r,e){const t=new Gs;r.accept(t);const n=t.alternations;return Ee(n,i=>i.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:r,alternation:i}),type:ue.TOO_MANY_ALTS,ruleName:r.name,occurrence:i.idx}]:[])}function $f(r,e,t){const n=[];return C(r,i=>{const s=new vf;i.accept(s);const a=s.allProductions;C(a,o=>{const l=Us(o),c=o.maxLookahead||e,u=o.idx,d=ai(u,i,l,c)[0];if(D(Ne(d))){const h=t.buildEmptyRepetitionError({topLevelRule:i,repetition:o});n.push({message:h,type:ue.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Ef(r,e,t,n){const i=[],s=le(r,(a,o,l)=>(e.definition[l].ignoreAmbiguities===!0||C(o,c=>{const u=[l];C(r,(d,h)=>{l!==h&&Zi(d,c)&&e.definition[h].ignoreAmbiguities!==!0&&u.push(h)}),u.length>1&&!Zi(i,c)&&(i.push(c),a.push({alts:u,path:c}))}),a),[]);return A(s,a=>{const o=A(a.alts,l=>l+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:o,prefixPath:a.path}),type:ue.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:a.alts}})}function Af(r,e,t,n){const i=le(r,(s,a,o)=>{const l=A(a,c=>({idx:o,path:c}));return s.concat(l)},[]);return Mr(Ee(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];const a=s.idx,o=s.path,l=ke(i,c=>e.definition[c.idx].ignoreAmbiguities!==!0&&c.idx<a&&cf(c.path,o));return A(l,c=>{const u=[c.idx+1,a+1],d=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:u,prefixPath:c.path}),type:ue.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:d,alternatives:u}})}))}function kf(r,e,t){const n=[],i=A(e,s=>s.name);return C(r,s=>{const a=s.name;if(de(i,a)){const o=t.buildNamespaceConflictError(s);n.push({message:o,type:ue.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}function xf(r){const e=Is(r,{errMsgProvider:Yh}),t={};return C(r.rules,n=>{t[n.name]=n}),qh(t,e.errMsgProvider)}function If(r){return r=Is(r,{errMsgProvider:mt}),df(r.rules,r.tokenTypes,r.errMsgProvider,r.grammarName)}const ic="MismatchedTokenException",sc="NoViableAltException",ac="EarlyExitException",oc="NotAllInputParsedException",lc=[ic,sc,ac,oc];Object.freeze(lc);function On(r){return de(lc,r.name)}class oi extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class cc extends oi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=ic}}class Sf extends oi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=sc}}class Cf extends oi{constructor(e,t){super(e,t),this.name=oc}}class Nf extends oi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=ac}}const ki={},uc="InRuleRecoveryException";class wf extends Error{constructor(e){super(e),this.name=uc}}class Lf{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=N(e,"recoveryEnabled")?e.recoveryEnabled:Qe.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=bf)}getTokenToInsert(e){const t=Fs(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,i){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let l=!1;const c=this.LA(1);let u=this.LA(1);const d=()=>{const h=this.LA(0),f=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:h,ruleName:this.getCurrRuleFullName()}),m=new cc(f,c,this.LA(0));m.resyncedTokens=Lr(o),this.SAVE_ERROR(m)};for(;!l;)if(this.tokenMatcher(u,i)){d();return}else if(n.call(this)){d(),e.apply(this,t);return}else this.tokenMatcher(u,s)?l=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){const n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new wf("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||D(t))return!1;const n=this.LA(1);return Ot(t,i=>this.tokenMatcher(n,i))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return de(n,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),n=2;for(;;){const i=Ot(e,s=>Ql(t,s));if(i!==void 0)return i;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return ki;const e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return A(e,(n,i)=>i===0?ki:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=A(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return Ne(e)}getFollowSetFromFollowKey(e){if(e===ki)return[tt];const t=e.ruleName+e.idxInCallingRule+Gl+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,tt)||t.push(e),t}reSyncTo(e){const t=[];let n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return Lr(t)}attemptInRepetitionRecovery(e,t,n,i,s,a,o){}getCurrentGrammarPath(e,t){const n=this.getHumanReadableRuleStack(),i=ne(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return A(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function bf(r,e,t,n,i,s,a){const o=this.getKeyForAutomaticLookahead(n,i);let l=this.firstAfterRepMap[o];if(l===void 0){const h=this.getCurrRuleFullName(),f=this.getGAstProductions()[h];l=new s(f,i).startWalking(),this.firstAfterRepMap[o]=l}let c=l.token,u=l.occurrence;const d=l.isEndOfRule;this.RULE_STACK.length===1&&d&&c===void 0&&(c=tt,u=1),!(c===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,u,a)&&this.tryInRepetitionRecovery(r,e,t,c)}const _f=4,it=8,dc=1<<it,hc=2<<it,Ji=3<<it,es=4<<it,ts=5<<it,Tn=6<<it;function xi(r,e,t){return t|e|r}class Bs{constructor(e){var t;this.maxLookahead=(t=e?.maxLookahead)!==null&&t!==void 0?t:Qe.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if(D(t)){const n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...i,...s]}return t}validateNoLeftRecursion(e){return Ee(e,t=>nc(t,t,mt))}validateEmptyOrAlternatives(e){return Ee(e,t=>yf(t,mt))}validateAmbiguousAlternationAlternatives(e,t){return Ee(e,n=>Tf(n,t,mt))}validateSomeNonEmptyLookaheadPath(e,t){return $f(e,t,mt)}buildLookaheadForAlternation(e){return rf(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,sf)}buildLookaheadForOptional(e){return nf(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Us(e.prodType),af)}}class Of{initLooksAhead(e){this.dynamicTokensEnabled=N(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Qe.dynamicTokensEnabled,this.maxLookahead=N(e,"maxLookahead")?e.maxLookahead:Qe.maxLookahead,this.lookaheadStrategy=N(e,"lookaheadStrategy")?e.lookaheadStrategy:new Bs({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){C(e,t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{const{alternation:n,repetition:i,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=Mf(t);C(n,c=>{const u=c.idx===0?"":c.idx;this.TRACE_INIT(`${Ue(c)}${u}`,()=>{const d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:t,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),h=xi(this.fullRuleNameToShort[t.name],dc,c.idx);this.setLaFuncCache(h,d)})}),C(i,c=>{this.computeLookaheadFunc(t,c.idx,Ji,"Repetition",c.maxLookahead,Ue(c))}),C(s,c=>{this.computeLookaheadFunc(t,c.idx,hc,"Option",c.maxLookahead,Ue(c))}),C(a,c=>{this.computeLookaheadFunc(t,c.idx,es,"RepetitionMandatory",c.maxLookahead,Ue(c))}),C(o,c=>{this.computeLookaheadFunc(t,c.idx,Tn,"RepetitionMandatoryWithSeparator",c.maxLookahead,Ue(c))}),C(l,c=>{this.computeLookaheadFunc(t,c.idx,ts,"RepetitionWithSeparator",c.maxLookahead,Ue(c))})})})}computeLookaheadFunc(e,t,n,i,s,a){this.TRACE_INIT(`${a}${t===0?"":t}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),l=xi(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(l,o)})}getKeyForAutomaticLookahead(e,t){const n=this.getLastExplicitRuleShortName();return xi(n,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}}class Pf extends Vt{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const rn=new Pf;function Mf(r){rn.reset(),r.accept(rn);const e=rn.dslMethods;return rn.reset(),e}function Ca(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset)}function Na(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.startColumn=e.startColumn,r.startLine=e.startLine,r.endOffset=e.endOffset,r.endColumn=e.endColumn,r.endLine=e.endLine):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset,r.endColumn=e.endColumn,r.endLine=e.endLine)}function Df(r,e,t){r.children[t]===void 0?r.children[t]=[e]:r.children[t].push(e)}function Ff(r,e,t){r.children[e]===void 0?r.children[e]=[t]:r.children[e].push(t)}const Uf="name";function fc(r,e){Object.defineProperty(r,Uf,{enumerable:!1,configurable:!0,writable:!1,value:e})}function Gf(r,e){const t=_t(r),n=t.length;for(let i=0;i<n;i++){const s=t[i],a=r[s],o=a.length;for(let l=0;l<o;l++){const c=a[l];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}function Bf(r,e){const t=function(){};fc(t,r+"BaseSemantics");const n={visit:function(i,s){if(te(i)&&(i=i[0]),!qe(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=Vf(this,e);if(!D(i)){const s=A(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
${s.join(`
`).replace(/\n/g,`
`)}`)}}};return t.prototype=n,t.prototype.constructor=t,t._RULE_NAMES=e,t}function Kf(r,e,t){const n=function(){};fc(n,r+"BaseSemanticsWithDefaults");const i=Object.create(t.prototype);return C(e,s=>{i[s]=Gf}),n.prototype=i,n.prototype.constructor=n,n}var rs;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(rs||(rs={}));function Vf(r,e){return jf(r,e)}function jf(r,e){const t=ke(e,i=>Et(r[i])===!1),n=A(t,i=>({msg:`Missing visitor method: <${i}> on ${r.constructor.name} CST Visitor.`,type:rs.MISSING_METHOD,methodName:i}));return Mr(n)}class Hf{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=N(e,"nodeLocationTracking")?e.nodeLocationTracking:Qe.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=q,this.cstFinallyStateUpdate=q,this.cstPostTerminal=q,this.cstPostNonTerminal=q,this.cstPostRule=q;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Na,this.setNodeLocationFromNode=Na,this.cstPostRule=q,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ca,this.setNodeLocationFromNode=Ca,this.cstPostRule=q,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=q,this.setInitialNodeLocation=q;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 t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];Df(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];Ff(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(qe(this.baseCstVisitorConstructor)){const e=Bf(this.className,_t(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(qe(this.baseCstVisitorWithDefaultsConstructor)){const e=Kf(this.className,_t(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 Wf{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Mn}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Mn:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class zf{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Dn){if(de(this.definedRulesNames,e)){const s={message:mt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:ue.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);const i=this.defineRule(e,t,n);return this[e]=i,i}OVERRIDE_RULE(e,t,n=Dn){const i=gf(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,t,n);return this[e]=s,s}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return e.apply(this,t),!0}catch(i){if(On(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return th(z(this.gastProductionsCache))}}class Yf{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=_n,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},N(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(te(e)){if(D(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(te(e))this.tokensMap=le(e,(s,a)=>(s[a.name]=a,s),{});else if(N(e,"modes")&&Oe(Ne(z(e.modes)),Hh)){const s=Ne(z(e.modes)),a=Ss(s);this.tokensMap=le(a,(o,l)=>(o[l.name]=l,o),{})}else if($u(e))this.tokensMap=ne(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=tt;const n=N(e,"modes")?Ne(z(e.modes)):z(e),i=Oe(n,s=>D(s.categoryMatches));this.tokenMatcher=i?_n:Gr,Br(z(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=N(n,"resyncEnabled")?n.resyncEnabled:Dn.resyncEnabled,s=N(n,"recoveryValueFunc")?n.recoveryValueFunc:Dn.recoveryValueFunc,a=this.ruleShortNameIdx<<_f+it;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...l){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,l);const c=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(c),c}catch(c){return this.invokeRuleCatch(c,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...l){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,l)}catch(c){return this.invokeRuleCatch(c,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){const i=this.RULE_STACK.length===1,s=t&&!this.isBackTracking()&&this.recoveryEnabled;if(On(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return n(e);else{if(this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,a.partialCstResult=l}throw a}}else{if(i)return this.moveToTerminatedState(),n(e);throw a}}else throw e}optionInternal(e,t){const n=this.getKeyForAutomaticLookahead(hc,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let i=this.getLaFuncFromCache(n),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,t){const n=this.getKeyForAutomaticLookahead(es,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let i=this.getLaFuncFromCache(n),s;if(typeof t!="function"){s=t.DEF;const a=t.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=t;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,B.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,es,e,ef)}atLeastOneSepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(Tn,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){const i=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);const a=()=>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,a,i,xa],a,Tn,e,xa)}else throw this.raiseEarlyExitException(e,B.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){const n=this.getKeyForAutomaticLookahead(Ji,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let i=this.getLaFuncFromCache(n),s;if(typeof t!="function"){s=t.DEF;const o=t.GATE;if(o!==void 0){const l=i;i=()=>o.call(this)&&l.call(this)}}else s=t;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,Ji,e,Jh,a)}manySepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(ts,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){const i=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);const a=()=>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,a,i,ka],a,ts,e,ka)}}repetitionSepSecondInternal(e,t,n,i,s){for(;n();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,i,s],n,Tn,e,s)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const n=this.getKeyForAutomaticLookahead(dc,t),i=te(e)?e:e.DEF,s=this.getLaFuncFromCache(n).call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Cf(t,e))}}subruleInternal(e,t,n){let i;try{const s=n!==void 0?n.ARGS:void 0;return this.subruleIdx=t,i=e.apply(this,s),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,n,e.ruleName)}}subruleInternalError(e,t,n){throw On(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,n)}catch(s){i=this.consumeInternalRecovery(e,t,s)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,t,n){let i;const s=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new cc(i,t,s))}consumeInternalRecovery(e,t,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===uc?n:s}}else throw n}saveRecogState(){const e=this.errors,t=ne(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),tt)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class qf{initErrorHandler(e){this._errors=[],this.errorMessageProvider=N(e,"errorMessageProvider")?e.errorMessageProvider:Qe.errorMessageProvider}SAVE_ERROR(e){if(On(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:ne(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return ne(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],a=ai(e,s,t,this.maxLookahead)[0],o=[];for(let c=1;c<=this.maxLookahead;c++)o.push(this.LA(c));const l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new Nf(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],s=si(e,i,this.maxLookahead),a=[];for(let c=1;c<=this.maxLookahead;c++)a.push(this.LA(c));const o=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Sf(l,this.LA(1),o))}}class Xf{initContentAssist(){}computeContentAssist(e,t){const n=this.gastProductionsCache[e];if(qe(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Zl([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=Pe(e.ruleStack),n=this.getGAstProductions()[t];return new Zh(n,e).startWalking()}}const li={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(li);const wa=!0,La=Math.pow(2,it)-1,pc=Xl({name:"RECORDING_PHASE_TOKEN",pattern:he.NA});Br([pc]);const mc=Fs(pc,`This IToken indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(mc);const Qf={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Zf{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 t=e>0?e:"";this[`CONSUME${t}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${t}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${t}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${t}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${t}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${t}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${t}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${t}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},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 t=0;t<10;t++){const n=t>0?t:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Mn}topLevelRuleRecord(e,t){try{const n=new Kt({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
This error was thrown during the "grammar recording phase" For more info see:
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,t){return Wt.call(this,re,e,t)}atLeastOneInternalRecord(e,t){Wt.call(this,xe,t,e)}atLeastOneSepFirstInternalRecord(e,t){Wt.call(this,Ie,t,e,wa)}manyInternalRecord(e,t){Wt.call(this,j,t,e)}manySepFirstInternalRecord(e,t){Wt.call(this,me,t,e,wa)}orInternalRecord(e,t){return Jf.call(this,e,t)}subruleInternalRecord(e,t,n){if(Pn(t),!e||N(e,"ruleName")===!1){const o=new Error(`<SUBRULE${ba(t)}> 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=Pt(this.recordingProdStack),s=e.ruleName,a=new ce({idx:t,nonTerminalName:s,label:n?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?Qf:li}consumeInternalRecord(e,t,n){if(Pn(t),!Yl(e)){const a=new Error(`<CONSUME${ba(t)}> 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=Pt(this.recordingProdStack),s=new F({idx:t,terminalType:e,label:n?.LABEL});return i.definition.push(s),mc}}function Wt(r,e,t,n=!1){Pn(t);const i=Pt(this.recordingProdStack),s=Et(e)?e:e.DEF,a=new r({definition:[],idx:t});return n&&(a.separator=e.SEP),N(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),li}function Jf(r,e){Pn(e);const t=Pt(this.recordingProdStack),n=te(r)===!1,i=n===!1?r:r.DEF,s=new ge({definition:[],idx:e,ignoreAmbiguities:n&&r.IGNORE_AMBIGUITIES===!0});N(r,"MAX_LOOKAHEAD")&&(s.maxLookahead=r.MAX_LOOKAHEAD);const a=gl(i,o=>Et(o.GATE));return s.hasPredicates=a,t.definition.push(s),C(i,o=>{const l=new pe({definition:[]});s.definition.push(l),N(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:N(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),li}function ba(r){return r===0?"":`${r}`}function Pn(r){if(r<0||r>La){const e=new Error(`Invalid DSL Method idx value: <${r}>
Idx value must be a none negative value smaller than ${La+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class ep{initPerformanceTracer(e){if(N(e,"traceInitPerf")){const t=e.traceInitPerf,n=typeof t=="number";this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Qe.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);const{time:i,value:s}=Fl(t),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return t()}}function tp(r,e){e.forEach(t=>{const n=t.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(n,i);s&&(s.get||s.set)?Object.defineProperty(r.prototype,i,s):r.prototype[i]=t.prototype[i]})})}const Mn=Fs(tt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Mn);const Qe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:wt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Dn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var ue;(function(r){r[r.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",r[r.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",r[r.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",r[r.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",r[r.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",r[r.LEFT_RECURSION=5]="LEFT_RECURSION",r[r.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",r[r.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",r[r.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",r[r.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",r[r.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",r[r.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",r[r.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",r[r.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(ue||(ue={}));function _a(r=void 0){return function(){return r}}class _r{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 t=this.className;this.TRACE_INIT("toFastProps",()=>{Ul(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),C(this.definedRulesNames,i=>{const s=this[i].originalGrammarAction;let a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=xf({rules:z(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(D(n)&&this.skipValidations===!1){const i=If({rules:z(this.gastProductionsCache),tokenTypes:z(this.tokensMap),errMsgProvider:mt,grammarName:t}),s=uf({lookaheadStrategy:this.lookaheadStrategy,rules:z(this.gastProductionsCache),tokenTypes:z(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(i,s)}}),D(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=lh(z(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:z(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(z(this.gastProductionsCache))})),!_r.DEFER_DEFINITION_ERRORS_HANDLING&&!D(this.definitionErrors))throw e=A(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
${e.join(`
-------------------------------
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;const n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initContentAssist(),n.initGastRecorder(t),n.initPerformanceTracer(t),N(t,"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=N(t,"skipValidations")?t.skipValidations:Qe.skipValidations}}_r.DEFER_DEFINITION_ERRORS_HANDLING=!1,tp(_r,[Lf,Of,Hf,Wf,Yf,zf,qf,Xf,Zf,ep]);class rp extends _r{constructor(e,t=Qe){const n=ne(t);n.outputCst=!1,super(e,n)}}function Mt(r,e,t){return`${r.name}_${e}_${t}`}const rt=1,np=2,gc=4,yc=5,Kr=7,ip=8,sp=9,ap=10,op=11,Tc=12;class Ks{constructor(e){this.target=e}isEpsilon(){return!1}}class Vs extends Ks{constructor(e,t){super(e),this.tokenType=t}}class vc extends Ks{constructor(e){super(e)}isEpsilon(){return!0}}class js extends Ks{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}}function lp(r){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};cp(e,r);const t=r.length;for(let n=0;n<t;n++){const i=r[n],s=kt(e,i,i);s!==void 0&&Rp(e,i,s)}return e}function cp(r,e){const t=e.length;for(let n=0;n<t;n++){const i=e[n],s=X(r,i,void 0,{type:np}),a=X(r,i,void 0,{type:Kr});s.stop=a,r.ruleToStartState.set(i,s),r.ruleToStopState.set(i,a)}}function Rc(r,e,t){return t instanceof F?Hs(r,e,t.terminalType,t):t instanceof ce?vp(r,e,t):t instanceof ge?pp(r,e,t):t instanceof re?mp(r,e,t):t instanceof j?up(r,e,t):t instanceof me?dp(r,e,t):t instanceof xe?hp(r,e,t):t instanceof Ie?fp(r,e,t):kt(r,e,t)}function up(r,e,t){const n=X(r,e,t,{type:yc});st(r,n);const i=jt(r,e,n,t,kt(r,e,t));return Ec(r,e,t,i)}function dp(r,e,t){const n=X(r,e,t,{type:yc});st(r,n);const i=jt(r,e,n,t,kt(r,e,t)),s=Hs(r,e,t.separator,t);return Ec(r,e,t,i,s)}function hp(r,e,t){const n=X(r,e,t,{type:gc});st(r,n);const i=jt(r,e,n,t,kt(r,e,t));return $c(r,e,t,i)}function fp(r,e,t){const n=X(r,e,t,{type:gc});st(r,n);const i=jt(r,e,n,t,kt(r,e,t)),s=Hs(r,e,t.separator,t);return $c(r,e,t,i,s)}function pp(r,e,t){const n=X(r,e,t,{type:rt});st(r,n);const i=A(t.definition,s=>Rc(r,e,s));return jt(r,e,n,t,...i)}function mp(r,e,t){const n=X(r,e,t,{type:rt});st(r,n);const i=jt(r,e,n,t,kt(r,e,t));return gp(r,e,t,i)}function kt(r,e,t){const n=ke(A(t.definition,i=>Rc(r,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:Tp(r,n)}function $c(r,e,t,n,i){const s=n.left,a=n.right,o=X(r,e,t,{type:op});st(r,o);const l=X(r,e,t,{type:Tc});return s.loopback=o,l.loopback=o,r.decisionMap[Mt(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",t.idx)]=o,W(a,o),i===void 0?(W(o,s),W(o,l)):(W(o,l),W(o,i.left),W(i.right,s)),{left:s,right:l}}function Ec(r,e,t,n,i){const s=n.left,a=n.right,o=X(r,e,t,{type:ap});st(r,o);const l=X(r,e,t,{type:Tc}),c=X(r,e,t,{type:sp});return o.loopback=c,l.loopback=c,W(o,s),W(o,l),W(a,c),i!==void 0?(W(c,l),W(c,i.left),W(i.right,s)):W(c,o),r.decisionMap[Mt(e,i?"RepetitionWithSeparator":"Repetition",t.idx)]=o,{left:o,right:l}}function gp(r,e,t,n){const i=n.left,s=n.right;return W(i,s),r.decisionMap[Mt(e,"Option",t.idx)]=i,n}function st(r,e){return r.decisionStates.push(e),e.decision=r.decisionStates.length-1,e.decision}function jt(r,e,t,n,...i){const s=X(r,e,n,{type:ip,start:t});t.end=s;for(const o of i)o!==void 0?(W(t,o.left),W(o.right,s)):W(t,s);const a={left:t,right:s};return r.decisionMap[Mt(e,yp(n),n.idx)]=t,a}function yp(r){if(r instanceof ge)return"Alternation";if(r instanceof re)return"Option";if(r instanceof j)return"Repetition";if(r instanceof me)return"RepetitionWithSeparator";if(r instanceof xe)return"RepetitionMandatory";if(r instanceof Ie)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function Tp(r,e){const t=e.length;for(let s=0;s<t-1;s++){const a=e[s];let o;a.left.transitions.length===1&&(o=a.left.transitions[0]);const l=o instanceof js,c=o,u=e[s+1].left;a.left.type===rt&&a.right.type===rt&&o!==void 0&&(l&&c.followState===a.right||o.target===a.right)?(l?c.followState=u:o.target=u,$p(r,a.right)):W(a.right,u)}const n=e[0],i=e[t-1];return{left:n.left,right:i.right}}function Hs(r,e,t,n){const i=X(r,e,n,{type:rt}),s=X(r,e,n,{type:rt});return Ws(i,new Vs(s,t)),{left:i,right:s}}function vp(r,e,t){const n=t.referencedRule,i=r.ruleToStartState.get(n),s=X(r,e,t,{type:rt}),a=X(r,e,t,{type:rt}),o=new js(i,n,a);return Ws(s,o),{left:s,right:a}}function Rp(r,e,t){const n=r.ruleToStartState.get(e);W(n,t.left);const i=r.ruleToStopState.get(e);return W(t.right,i),{left:n,right:i}}function W(r,e){const t=new vc(e);Ws(r,t)}function X(r,e,t,n){const i=Object.assign({atn:r,production:t,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:r.states.length},n);return r.states.push(i),i}function Ws(r,e){r.transitions.length===0&&(r.epsilonOnlyTransitions=e.isEpsilon()),r.transitions.push(e)}function $p(r,e){r.states.splice(r.states.indexOf(e),1)}const Fn={};class ns{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Ac(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return A(this.configs,e=>e.alt)}get key(){let e="";for(const t in this.map)e+=t+":";return e}}function Ac(r,e=!0){return`${e?`a${r.alt}`:""}s${r.state.stateNumber}:${r.stack.map(t=>t.stateNumber.toString()).join("_")}`}function Ep(r,e){const t={};return n=>{const i=n.toString();let s=t[i];return s!==void 0||(s={atnStartState:r,decision:e,states:{}},t[i]=s),s}}class kc{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e="";const t=this.predicates.length;for(let n=0;n<t;n++)e+=this.predicates[n]===!0?"1":"0";return e}}const Oa=new kc;class Ap extends Bs{constructor(e){var t;super(),this.logging=(t=e?.logging)!==null&&t!==void 0?t:n=>console.log(n)}initialize(e){this.atn=lp(e.rules),this.dfas=kp(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:t,rule:n,hasPredicates:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,l=Mt(n,"Alternation",t),c=this.atn.decisionMap[l].decision,u=A(Ia({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:n}),d=>A(d,h=>h[0]));if(Pa(u,!1)&&!s){const d=le(u,(h,f,m)=>(C(f,g=>{g&&(h[g.tokenTypeIdx]=m,C(g.categoryMatches,k=>{h[k]=m}))}),h),{});return i?function(h){var f;const m=this.LA(1),g=d[m.tokenTypeIdx];if(h!==void 0&&g!==void 0){const k=(f=h[g])===null||f===void 0?void 0:f.GATE;if(k!==void 0&&k.call(this)===!1)return}return g}:function(){const h=this.LA(1);return d[h.tokenTypeIdx]}}else return i?function(d){const h=new kc,f=d===void 0?0:d.length;for(let g=0;g<f;g++){const k=d?.[g].GATE;h.set(g,k===void 0||k.call(this))}const m=Ii.call(this,a,c,h,o);return typeof m=="number"?m:void 0}:function(){const d=Ii.call(this,a,c,Oa,o);return typeof d=="number"?d:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:t,rule:n,prodType:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,l=Mt(n,i,t),c=this.atn.decisionMap[l].decision,u=A(Ia({maxLookahead:1,occurrence:t,prodType:i,rule:n}),d=>A(d,h=>h[0]));if(Pa(u)&&u[0][0]&&!s){const d=u[0],h=Ne(d);if(h.length===1&&D(h[0].categoryMatches)){const f=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===f}}else{const f=le(h,(m,g)=>(g!==void 0&&(m[g.tokenTypeIdx]=!0,C(g.categoryMatches,k=>{m[k]=!0})),m),{});return function(){const m=this.LA(1);return f[m.tokenTypeIdx]===!0}}}return function(){const d=Ii.call(this,a,c,Oa,o);return typeof d=="object"?!1:d===0}}}function Pa(r,e=!0){const t=new Set;for(const n of r){const i=new Set;for(const s of n){if(s===void 0){if(e)break;return!1}const a=[s.tokenTypeIdx].concat(s.categoryMatches);for(const o of a)if(t.has(o)){if(!i.has(o))return!1}else t.add(o),i.add(o)}}return!0}function kp(r){const e=r.decisionStates.length,t=Array(e);for(let n=0;n<e;n++)t[n]=Ep(r.decisionStates[n],n);return t}function Ii(r,e,t,n){const i=r[e](t);let s=i.start;if(s===void 0){const a=Pp(i.atnStartState);s=Ic(i,xc(a)),i.start=s}return xp.apply(this,[i,s,t,n])}function xp(r,e,t,n){let i=e,s=1;const a=[];let o=this.LA(s++);for(;;){let l=Lp(i,o);if(l===void 0&&(l=Ip.apply(this,[r,i,o,s,t,n])),l===Fn)return wp(a,i,o);if(l.isAcceptState===!0)return l.prediction;i=l,a.push(o),o=this.LA(s++)}}function Ip(r,e,t,n,i,s){const a=bp(e.configs,t,i);if(a.size===0)return Ma(r,e,t,Fn),Fn;let o=xc(a);const l=Op(a,i);if(l!==void 0)o.isAcceptState=!0,o.prediction=l,o.configs.uniqueAlt=l;else if(Up(a)){const c=Lu(a.alts);o.isAcceptState=!0,o.prediction=c,o.configs.uniqueAlt=c,Sp.apply(this,[r,n,a.alts,s])}return o=Ma(r,e,t,o),o}function Sp(r,e,t,n){const i=[];for(let c=1;c<=e;c++)i.push(this.LA(c).tokenType);const s=r.atnStartState,a=s.rule,o=s.production,l=Cp({topLevelRule:a,ambiguityIndices:t,production:o,prefixPath:i});n(l)}function Cp(r){const e=A(r.prefixPath,i=>bt(i)).join(", "),t=r.production.idx===0?"":r.production.idx;let n=`Ambiguous Alternatives Detected: <${r.ambiguityIndices.join(", ")}> in <${Np(r.production)}${t}> inside <${r.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,n}function Np(r){if(r instanceof ce)return"SUBRULE";if(r instanceof re)return"OPTION";if(r instanceof ge)return"OR";if(r instanceof xe)return"AT_LEAST_ONE";if(r instanceof Ie)return"AT_LEAST_ONE_SEP";if(r instanceof me)return"MANY_SEP";if(r instanceof j)return"MANY";if(r instanceof F)return"CONSUME";throw Error("non exhaustive match")}function wp(r,e,t){const n=Ee(e.configs.elements,s=>s.state.transitions),i=Qu(n.filter(s=>s instanceof Vs).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:t,possibleTokenTypes:i,tokenPath:r}}function Lp(r,e){return r.edges[e.tokenTypeIdx]}function bp(r,e,t){const n=new ns,i=[];for(const a of r.elements){if(t.is(a.alt)===!1)continue;if(a.state.type===Kr){i.push(a);continue}const o=a.state.transitions.length;for(let l=0;l<o;l++){const c=a.state.transitions[l],u=_p(c,e);u!==void 0&&n.add({state:u,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&n.size===1&&(s=n),s===void 0){s=new ns;for(const a of n.elements)Un(a,s)}if(i.length>0&&!Dp(s))for(const a of i)s.add(a);return s}function _p(r,e){if(r instanceof Vs&&Ql(e,r.tokenType))return r.target}function Op(r,e){let t;for(const n of r.elements)if(e.is(n.alt)===!0){if(t===void 0)t=n.alt;else if(t!==n.alt)return}return t}function xc(r){return{configs:r,edges:{},isAcceptState:!1,prediction:-1}}function Ma(r,e,t,n){return n=Ic(r,n),e.edges[t.tokenTypeIdx]=n,n}function Ic(r,e){if(e===Fn)return e;const t=e.configs.key,n=r.states[t];return n!==void 0?n:(e.configs.finalize(),r.states[t]=e,e)}function Pp(r){const e=new ns,t=r.transitions.length;for(let n=0;n<t;n++){const i={state:r.transitions[n].target,alt:n,stack:[]};Un(i,e)}return e}function Un(r,e){const t=r.state;if(t.type===Kr){if(r.stack.length>0){const i=[...r.stack],s={state:i.pop(),alt:r.alt,stack:i};Un(s,e)}else e.add(r);return}t.epsilonOnlyTransitions||e.add(r);const n=t.transitions.length;for(let i=0;i<n;i++){const s=t.transitions[i],a=Mp(r,s);a!==void 0&&Un(a,e)}}function Mp(r,e){if(e instanceof vc)return{state:e.target,alt:r.alt,stack:r.stack};if(e instanceof js){const t=[...r.stack,e.followState];return{state:e.target,alt:r.alt,stack:t}}}function Dp(r){for(const e of r.elements)if(e.state.type===Kr)return!0;return!1}function Fp(r){for(const e of r.elements)if(e.state.type!==Kr)return!1;return!0}function Up(r){if(Fp(r))return!0;const e=Gp(r.elements);return Bp(e)&&!Kp(e)}function Gp(r){const e=new Map;for(const t of r){const n=Ac(t,!1);let i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[t.alt]=!0}return e}function Bp(r){for(const e of Array.from(r.values()))if(Object.keys(e).length>1)return!0;return!1}function Kp(r){for(const e of Array.from(r.values()))if(Object.keys(e).length===1)return!0;return!1}var Da;(function(r){function e(t){return typeof t=="string"}r.is=e})(Da||(Da={}));var is;(function(r){function e(t){return typeof t=="string"}r.is=e})(is||(is={}));var Fa;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(Fa||(Fa={}));var Gn;(function(r){r.MIN_VALUE=0,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(Gn||(Gn={}));var P;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=Gn.MAX_VALUE),i===Number.MAX_VALUE&&(i=Gn.MAX_VALUE),{line:n,character:i}}r.create=e;function t(n){let i=n;return p.objectLiteral(i)&&p.uinteger(i.line)&&p.uinteger(i.character)}r.is=t})(P||(P={}));var O;(function(r){function e(n,i,s,a){if(p.uinteger(n)&&p.uinteger(i)&&p.uinteger(s)&&p.uinteger(a))return{start:P.create(n,i),end:P.create(s,a)};if(P.is(n)&&P.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${s}, ${a}]`)}r.create=e;function t(n){let i=n;return p.objectLiteral(i)&&P.is(i.start)&&P.is(i.end)}r.is=t})(O||(O={}));var Bn;(function(r){function e(n,i){return{uri:n,range:i}}r.create=e;function t(n){let i=n;return p.objectLiteral(i)&&O.is(i.range)&&(p.string(i.uri)||p.undefined(i.uri))}r.is=t})(Bn||(Bn={}));var Ua;(function(r){function e(n,i,s,a){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}r.create=e;function t(n){let i=n;return p.objectLiteral(i)&&O.is(i.targetRange)&&p.string(i.targetUri)&&O.is(i.targetSelectionRange)&&(O.is(i.originSelectionRange)||p.undefined(i.originSelectionRange))}r.is=t})(Ua||(Ua={}));var ss;(function(r){function e(n,i,s,a){return{red:n,green:i,blue:s,alpha:a}}r.create=e;function t(n){const i=n;return p.objectLiteral(i)&&p.numberRange(i.red,0,1)&&p.numberRange(i.green,0,1)&&p.numberRange(i.blue,0,1)&&p.numberRange(i.alpha,0,1)}r.is=t})(ss||(ss={}));var Ga;(function(r){function e(n,i){return{range:n,color:i}}r.create=e;function t(n){const i=n;return p.objectLiteral(i)&&O.is(i.range)&&ss.is(i.color)}r.is=t})(Ga||(Ga={}));var Ba;(function(r){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}r.create=e;function t(n){const i=n;return p.objectLiteral(i)&&p.string(i.label)&&(p.undefined(i.textEdit)||Ft.is(i))&&(p.undefined(i.additionalTextEdits)||p.typedArray(i.additionalTextEdits,Ft.is))}r.is=t})(Ba||(Ba={}));var Ka;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(Ka||(Ka={}));var Va;(function(r){function e(n,i,s,a,o,l){const c={startLine:n,endLine:i};return p.defined(s)&&(c.startCharacter=s),p.defined(a)&&(c.endCharacter=a),p.defined(o)&&(c.kind=o),p.defined(l)&&(c.collapsedText=l),c}r.create=e;function t(n){const i=n;return p.objectLiteral(i)&&p.uinteger(i.startLine)&&p.uinteger(i.startLine)&&(p.undefined(i.startCharacter)||p.uinteger(i.startCharacter))&&(p.undefined(i.endCharacter)||p.uinteger(i.endCharacter))&&(p.undefined(i.kind)||p.string(i.kind))}r.is=t})(Va||(Va={}));var as;(function(r){function e(n,i){return{location:n,message:i}}r.create=e;function t(n){let i=n;return p.defined(i)&&Bn.is(i.location)&&p.string(i.message)}r.is=t})(as||(as={}));var ja;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(ja||(ja={}));var Ha;(function(r){r.Unnecessary=1,r.Deprecated=2})(Ha||(Ha={}));var Wa;(function(r){function e(t){const n=t;return p.objectLiteral(n)&&p.string(n.href)}r.is=e})(Wa||(Wa={}));var Kn;(function(r){function e(n,i,s,a,o,l){let c={range:n,message:i};return p.defined(s)&&(c.severity=s),p.defined(a)&&(c.code=a),p.defined(o)&&(c.source=o),p.defined(l)&&(c.relatedInformation=l),c}r.create=e;function t(n){var i;let s=n;return p.defined(s)&&O.is(s.range)&&p.string(s.message)&&(p.number(s.severity)||p.undefined(s.severity))&&(p.integer(s.code)||p.string(s.code)||p.undefined(s.code))&&(p.undefined(s.codeDescription)||p.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(p.string(s.source)||p.undefined(s.source))&&(p.undefined(s.relatedInformation)||p.typedArray(s.relatedInformation,as.is))}r.is=t})(Kn||(Kn={}));var Dt;(function(r){function e(n,i,...s){let a={title:n,command:i};return p.defined(s)&&s.length>0&&(a.arguments=s),a}r.create=e;function t(n){let i=n;return p.defined(i)&&p.string(i.title)&&p.string(i.command)}r.is=t})(Dt||(Dt={}));var Ft;(function(r){function e(s,a){return{range:s,newText:a}}r.replace=e;function t(s,a){return{range:{start:s,end:s},newText:a}}r.insert=t;function n(s){return{range:s,newText:""}}r.del=n;function i(s){const a=s;return p.objectLiteral(a)&&p.string(a.newText)&&O.is(a.range)}r.is=i})(Ft||(Ft={}));var os;(function(r){function e(n,i,s){const a={label:n};return i!==void 0&&(a.needsConfirmation=i),s!==void 0&&(a.description=s),a}r.create=e;function t(n){const i=n;return p.objectLiteral(i)&&p.string(i.label)&&(p.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(p.string(i.description)||i.description===void 0)}r.is=t})(os||(os={}));var Ut;(function(r){function e(t){const n=t;return p.string(n)}r.is=e})(Ut||(Ut={}));var za;(function(r){function e(s,a,o){return{range:s,newText:a,annotationId:o}}r.replace=e;function t(s,a,o){return{range:{start:s,end:s},newText:a,annotationId:o}}r.insert=t;function n(s,a){return{range:s,newText:"",annotationId:a}}r.del=n;function i(s){const a=s;return Ft.is(a)&&(os.is(a.annotationId)||Ut.is(a.annotationId))}r.is=i})(za||(za={}));var ls;(function(r){function e(n,i){return{textDocument:n,edits:i}}r.create=e;function t(n){let i=n;return p.defined(i)&&fs.is(i.textDocument)&&Array.isArray(i.edits)}r.is=t})(ls||(ls={}));var cs;(function(r){function e(n,i,s){let a={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}r.create=e;function t(n){let i=n;return i&&i.kind==="create"&&p.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Ut.is(i.annotationId))}r.is=t})(cs||(cs={}));var us;(function(r){function e(n,i,s,a){let o={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(o.options=s),a!==void 0&&(o.annotationId=a),o}r.create=e;function t(n){let i=n;return i&&i.kind==="rename"&&p.string(i.oldUri)&&p.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Ut.is(i.annotationId))}r.is=t})(us||(us={}));var ds;(function(r){function e(n,i,s){let a={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}r.create=e;function t(n){let i=n;return i&&i.kind==="delete"&&p.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||p.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||p.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Ut.is(i.annotationId))}r.is=t})(ds||(ds={}));var hs;(function(r){function e(t){let n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>p.string(i.kind)?cs.is(i)||us.is(i)||ds.is(i):ls.is(i)))}r.is=e})(hs||(hs={}));var Ya;(function(r){function e(n){return{uri:n}}r.create=e;function t(n){let i=n;return p.defined(i)&&p.string(i.uri)}r.is=t})(Ya||(Ya={}));var qa;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){let i=n;return p.defined(i)&&p.string(i.uri)&&p.integer(i.version)}r.is=t})(qa||(qa={}));var fs;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){let i=n;return p.defined(i)&&p.string(i.uri)&&(i.version===null||p.integer(i.version))}r.is=t})(fs||(fs={}));var Xa;(function(r){function e(n,i,s,a){return{uri:n,languageId:i,version:s,text:a}}r.create=e;function t(n){let i=n;return p.defined(i)&&p.string(i.uri)&&p.string(i.languageId)&&p.integer(i.version)&&p.string(i.text)}r.is=t})(Xa||(Xa={}));var ps;(function(r){r.PlainText="plaintext",r.Markdown="markdown";function e(t){const n=t;return n===r.PlainText||n===r.Markdown}r.is=e})(ps||(ps={}));var Or;(function(r){function e(t){const n=t;return p.objectLiteral(t)&&ps.is(n.kind)&&p.string(n.value)}r.is=e})(Or||(Or={}));var Qa;(function(r){r.Text=1,r.Method=2,r.Function=3,r.Constructor=4,r.Field=5,r.Variable=6,r.Class=7,r.Interface=8,r.Module=9,r.Property=10,r.Unit=11,r.Value=12,r.Enum=13,r.Keyword=14,r.Snippet=15,r.Color=16,r.File=17,r.Reference=18,r.Folder=19,r.EnumMember=20,r.Constant=21,r.Struct=22,r.Event=23,r.Operator=24,r.TypeParameter=25})(Qa||(Qa={}));var Za;(function(r){r.PlainText=1,r.Snippet=2})(Za||(Za={}));var Ja;(function(r){r.Deprecated=1})(Ja||(Ja={}));var eo;(function(r){function e(n,i,s){return{newText:n,insert:i,replace:s}}r.create=e;function t(n){const i=n;return i&&p.string(i.newText)&&O.is(i.insert)&&O.is(i.replace)}r.is=t})(eo||(eo={}));var to;(function(r){r.asIs=1,r.adjustIndentation=2})(to||(to={}));var ro;(function(r){function e(t){const n=t;return n&&(p.string(n.detail)||n.detail===void 0)&&(p.string(n.description)||n.description===void 0)}r.is=e})(ro||(ro={}));var no;(function(r){function e(t){return{label:t}}r.create=e})(no||(no={}));var io;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}r.create=e})(io||(io={}));var Vn;(function(r){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}r.fromPlainText=e;function t(n){const i=n;return p.string(i)||p.objectLiteral(i)&&p.string(i.language)&&p.string(i.value)}r.is=t})(Vn||(Vn={}));var so;(function(r){function e(t){let n=t;return!!n&&p.objectLiteral(n)&&(Or.is(n.contents)||Vn.is(n.contents)||p.typedArray(n.contents,Vn.is))&&(t.range===void 0||O.is(t.range))}r.is=e})(so||(so={}));var ao;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}r.create=e})(ao||(ao={}));var oo;(function(r){function e(t,n,...i){let s={label:t};return p.defined(n)&&(s.documentation=n),p.defined(i)?s.parameters=i:s.parameters=[],s}r.create=e})(oo||(oo={}));var lo;(function(r){r.Text=1,r.Read=2,r.Write=3})(lo||(lo={}));var co;(function(r){function e(t,n){let i={range:t};return p.number(n)&&(i.kind=n),i}r.create=e})(co||(co={}));var uo;(function(r){r.File=1,r.Module=2,r.Namespace=3,r.Package=4,r.Class=5,r.Method=6,r.Property=7,r.Field=8,r.Constructor=9,r.Enum=10,r.Interface=11,r.Function=12,r.Variable=13,r.Constant=14,r.String=15,r.Number=16,r.Boolean=17,r.Array=18,r.Object=19,r.Key=20,r.Null=21,r.EnumMember=22,r.Struct=23,r.Event=24,r.Operator=25,r.TypeParameter=26})(uo||(uo={}));var ho;(function(r){r.Deprecated=1})(ho||(ho={}));var fo;(function(r){function e(t,n,i,s,a){let o={name:t,kind:n,location:{uri:s,range:i}};return a&&(o.containerName=a),o}r.create=e})(fo||(fo={}));var po;(function(r){function e(t,n,i,s){return s!==void 0?{name:t,kind:n,location:{uri:i,range:s}}:{name:t,kind:n,location:{uri:i}}}r.create=e})(po||(po={}));var mo;(function(r){function e(n,i,s,a,o,l){let c={name:n,detail:i,kind:s,range:a,selectionRange:o};return l!==void 0&&(c.children=l),c}r.create=e;function t(n){let i=n;return i&&p.string(i.name)&&p.number(i.kind)&&O.is(i.range)&&O.is(i.selectionRange)&&(i.detail===void 0||p.string(i.detail))&&(i.deprecated===void 0||p.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}r.is=t})(mo||(mo={}));var go;(function(r){r.Empty="",r.QuickFix="quickfix",r.Refactor="refactor",r.RefactorExtract="refactor.extract",r.RefactorInline="refactor.inline",r.RefactorRewrite="refactor.rewrite",r.Source="source",r.SourceOrganizeImports="source.organizeImports",r.SourceFixAll="source.fixAll"})(go||(go={}));var jn;(function(r){r.Invoked=1,r.Automatic=2})(jn||(jn={}));var yo;(function(r){function e(n,i,s){let a={diagnostics:n};return i!=null&&(a.only=i),s!=null&&(a.triggerKind=s),a}r.create=e;function t(n){let i=n;return p.defined(i)&&p.typedArray(i.diagnostics,Kn.is)&&(i.only===void 0||p.typedArray(i.only,p.string))&&(i.triggerKind===void 0||i.triggerKind===jn.Invoked||i.triggerKind===jn.Automatic)}r.is=t})(yo||(yo={}));var To;(function(r){function e(n,i,s){let a={title:n},o=!0;return typeof i=="string"?(o=!1,a.kind=i):Dt.is(i)?a.command=i:a.edit=i,o&&s!==void 0&&(a.kind=s),a}r.create=e;function t(n){let i=n;return i&&p.string(i.title)&&(i.diagnostics===void 0||p.typedArray(i.diagnostics,Kn.is))&&(i.kind===void 0||p.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Dt.is(i.command))&&(i.isPreferred===void 0||p.boolean(i.isPreferred))&&(i.edit===void 0||hs.is(i.edit))}r.is=t})(To||(To={}));var vo;(function(r){function e(n,i){let s={range:n};return p.defined(i)&&(s.data=i),s}r.create=e;function t(n){let i=n;return p.defined(i)&&O.is(i.range)&&(p.undefined(i.command)||Dt.is(i.command))}r.is=t})(vo||(vo={}));var Ro;(function(r){function e(n,i){return{tabSize:n,insertSpaces:i}}r.create=e;function t(n){let i=n;return p.defined(i)&&p.uinteger(i.tabSize)&&p.boolean(i.insertSpaces)}r.is=t})(Ro||(Ro={}));var $o;(function(r){function e(n,i,s){return{range:n,target:i,data:s}}r.create=e;function t(n){let i=n;return p.defined(i)&&O.is(i.range)&&(p.undefined(i.target)||p.string(i.target))}r.is=t})($o||($o={}));var Eo;(function(r){function e(n,i){return{range:n,parent:i}}r.create=e;function t(n){let i=n;return p.objectLiteral(i)&&O.is(i.range)&&(i.parent===void 0||r.is(i.parent))}r.is=t})(Eo||(Eo={}));var Ao;(function(r){r.namespace="namespace",r.type="type",r.class="class",r.enum="enum",r.interface="interface",r.struct="struct",r.typeParameter="typeParameter",r.parameter="parameter",r.variable="variable",r.property="property",r.enumMember="enumMember",r.event="event",r.function="function",r.method="method",r.macro="macro",r.keyword="keyword",r.modifier="modifier",r.comment="comment",r.string="string",r.number="number",r.regexp="regexp",r.operator="operator",r.decorator="decorator"})(Ao||(Ao={}));var ko;(function(r){r.declaration="declaration",r.definition="definition",r.readonly="readonly",r.static="static",r.deprecated="deprecated",r.abstract="abstract",r.async="async",r.modification="modification",r.documentation="documentation",r.defaultLibrary="defaultLibrary"})(ko||(ko={}));var xo;(function(r){function e(t){const n=t;return p.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}r.is=e})(xo||(xo={}));var Io;(function(r){function e(n,i){return{range:n,text:i}}r.create=e;function t(n){const i=n;return i!=null&&O.is(i.range)&&p.string(i.text)}r.is=t})(Io||(Io={}));var So;(function(r){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}r.create=e;function t(n){const i=n;return i!=null&&O.is(i.range)&&p.boolean(i.caseSensitiveLookup)&&(p.string(i.variableName)||i.variableName===void 0)}r.is=t})(So||(So={}));var Co;(function(r){function e(n,i){return{range:n,expression:i}}r.create=e;function t(n){const i=n;return i!=null&&O.is(i.range)&&(p.string(i.expression)||i.expression===void 0)}r.is=t})(Co||(Co={}));var No;(function(r){function e(n,i){return{frameId:n,stoppedLocation:i}}r.create=e;function t(n){const i=n;return p.defined(i)&&O.is(n.stoppedLocation)}r.is=t})(No||(No={}));var ms;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}r.is=e})(ms||(ms={}));var gs;(function(r){function e(n){return{value:n}}r.create=e;function t(n){const i=n;return p.objectLiteral(i)&&(i.tooltip===void 0||p.string(i.tooltip)||Or.is(i.tooltip))&&(i.location===void 0||Bn.is(i.location))&&(i.command===void 0||Dt.is(i.command))}r.is=t})(gs||(gs={}));var wo;(function(r){function e(n,i,s){const a={position:n,label:i};return s!==void 0&&(a.kind=s),a}r.create=e;function t(n){const i=n;return p.objectLiteral(i)&&P.is(i.position)&&(p.string(i.label)||p.typedArray(i.label,gs.is))&&(i.kind===void 0||ms.is(i.kind))&&i.textEdits===void 0||p.typedArray(i.textEdits,Ft.is)&&(i.tooltip===void 0||p.string(i.tooltip)||Or.is(i.tooltip))&&(i.paddingLeft===void 0||p.boolean(i.paddingLeft))&&(i.paddingRight===void 0||p.boolean(i.paddingRight))}r.is=t})(wo||(wo={}));var Lo;(function(r){function e(t){return{kind:"snippet",value:t}}r.createSnippet=e})(Lo||(Lo={}));var bo;(function(r){function e(t,n,i,s){return{insertText:t,filterText:n,range:i,command:s}}r.create=e})(bo||(bo={}));var _o;(function(r){function e(t){return{items:t}}r.create=e})(_o||(_o={}));var Oo;(function(r){r.Invoked=0,r.Automatic=1})(Oo||(Oo={}));var Po;(function(r){function e(t,n){return{range:t,text:n}}r.create=e})(Po||(Po={}));var Mo;(function(r){function e(t,n){return{triggerKind:t,selectedCompletionInfo:n}}r.create=e})(Mo||(Mo={}));var Do;(function(r){function e(t){const n=t;return p.objectLiteral(n)&&is.is(n.uri)&&p.string(n.name)}r.is=e})(Do||(Do={}));var Fo;(function(r){function e(s,a,o,l){return new Vp(s,a,o,l)}r.create=e;function t(s){let a=s;return!!(p.defined(a)&&p.string(a.uri)&&(p.undefined(a.languageId)||p.string(a.languageId))&&p.uinteger(a.lineCount)&&p.func(a.getText)&&p.func(a.positionAt)&&p.func(a.offsetAt))}r.is=t;function n(s,a){let o=s.getText(),l=i(a,(u,d)=>{let h=u.range.start.line-d.range.start.line;return h===0?u.range.start.character-d.range.start.character:h}),c=o.length;for(let u=l.length-1;u>=0;u--){let d=l[u],h=s.offsetAt(d.range.start),f=s.offsetAt(d.range.end);if(f<=c)o=o.substring(0,h)+d.newText+o.substring(f,o.length);else throw new Error("Overlapping edit");c=h}return o}r.applyEdits=n;function i(s,a){if(s.length<=1)return s;const o=s.length/2|0,l=s.slice(0,o),c=s.slice(o);i(l,a),i(c,a);let u=0,d=0,h=0;for(;u<l.length&&d<c.length;)a(l[u],c[d])<=0?s[h++]=l[u++]:s[h++]=c[d++];for(;u<l.length;)s[h++]=l[u++];for(;d<c.length;)s[h++]=c[d++];return s}})(Fo||(Fo={}));let Vp=class{constructor(r,e,t,n){this._uri=r,this._languageId=e,this._version=t,this._content=n,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(r){if(r){let e=this.offsetAt(r.start),t=this.offsetAt(r.end);return this._content.substring(e,t)}return this._content}update(r,e){this._content=r.text,this._version=e,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let r=[],e=this._content,t=!0;for(let n=0;n<e.length;n++){t&&(r.push(n),t=!1);let i=e.charAt(n);t=i==="\r"||i===`
`,i==="\r"&&n+1<e.length&&e.charAt(n+1)===`
`&&n++}t&&e.length>0&&r.push(e.length),this._lineOffsets=r}return this._lineOffsets}positionAt(r){r=Math.max(Math.min(r,this._content.length),0);let e=this.getLineOffsets(),t=0,n=e.length;if(n===0)return P.create(0,r);for(;t<n;){let s=Math.floor((t+n)/2);e[s]>r?n=s:t=s+1}let i=t-1;return P.create(i,r-e[i])}offsetAt(r){let e=this.getLineOffsets();if(r.line>=e.length)return this._content.length;if(r.line<0)return 0;let t=e[r.line],n=r.line+1<e.length?e[r.line+1]:this._content.length;return Math.max(Math.min(t+r.character,n),t)}get lineCount(){return this.getLineOffsets().length}};var p;(function(r){const e=Object.prototype.toString;function t(f){return typeof f<"u"}r.defined=t;function n(f){return typeof f>"u"}r.undefined=n;function i(f){return f===!0||f===!1}r.boolean=i;function s(f){return e.call(f)==="[object String]"}r.string=s;function a(f){return e.call(f)==="[object Number]"}r.number=a;function o(f,m,g){return e.call(f)==="[object Number]"&&m<=f&&f<=g}r.numberRange=o;function l(f){return e.call(f)==="[object Number]"&&-2147483648<=f&&f<=2147483647}r.integer=l;function c(f){return e.call(f)==="[object Number]"&&0<=f&&f<=2147483647}r.uinteger=c;function u(f){return e.call(f)==="[object Function]"}r.func=u;function d(f){return f!==null&&typeof f=="object"}r.objectLiteral=d;function h(f,m){return Array.isArray(f)&&f.every(m)}r.typedArray=h})(p||(p={}));class jp{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new Cc(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new zs;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const n=new ys(e.startOffset,e.image.length,ji(e),e.tokenType,!t);return n.grammarSource=t,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){const t=e.container;if(t){const n=t.content.indexOf(e);n>=0&&t.content.splice(n,1)}}addHiddenNodes(e){const t=[];for(const s of e){const a=new ys(s.startOffset,s.image.length,ji(s),s.tokenType,!0);a.root=this.rootNode,t.push(a)}let n=this.current,i=!1;if(n.content.length>0){n.content.push(...t);return}for(;n.container;){const s=n.container.content.indexOf(n);if(s>0){n.container.content.splice(s,0,...t),i=!0;break}n=n.container}i||this.rootNode.content.unshift(...t)}construct(e){const t=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=t;const n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}}class Sc{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,t;const n=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(t=this.container)===null||t===void 0?void 0:t.astNode;if(!n)throw new Error("This node has no associated AST element");return n}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class ys extends Sc{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,t,n,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=t,this._range=n}}class zs extends Sc{constructor(){super(...arguments),this.content=new Ys(this)}get children(){return this.content}get offset(){var e,t;return(t=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&t!==void 0?t:0}get length(){return this.end-this.offset}get end(){var e,t;return(t=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&t!==void 0?t:0}get range(){const e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){const{range:n}=e,{range:i}=t;this._rangeCache={start:n.start,end:i.end.line<n.start.line?n.start:i.end}}return this._rangeCache}else return{start:P.create(0,0),end:P.create(0,0)}}get firstNonHiddenNode(){for(const e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){const t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}}class Ys extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,Ys.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...n){return this.addParents(n),super.splice(e,t,...n)}addParents(e){for(const t of e)t.container=this.parent}}class Cc extends zs{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const Ts=Symbol("Datatype");function Si(r){return r.$type===Ts}const Uo="",Nc=r=>r.endsWith(Uo)?r:r+Uo;class wc{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const t=this.lexer.definition,n=e.LanguageMetaData.mode==="production";this.wrapper=new qp(t,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class Hp extends wc{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new jp,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){const n=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(Nc(e.name),this.startImplementation(n,t).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment)return Pl(e)?Ts:_s(e)??e.name}parse(e,t={}){this.nodeBuilder.buildRootNode(e);const n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;const i=t.rule?this.allRules.get(t.rule):this.mainRule;if(!i)throw new Error(t.rule?`No rule found with name '${t.rule}'`:"No main rule available.");const s=i.call(this.wrapper,{});return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:s,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}startImplementation(e,t){return n=>{const i=!this.isRecording()&&e!==void 0;if(i){const a={$type:e};this.stack.push(a),e===Ts&&(a.value="")}let s;try{s=t(n)}catch{s=void 0}return s===void 0&&i&&(s=this.construct()),s}}extractHiddenTokens(e){const t=this.lexerResult.hidden;if(!t.length)return[];const n=e.startOffset;for(let i=0;i<t.length;i++)if(t[i].startOffset>n)return t.splice(0,i);return t.splice(0,t.length)}consume(e,t,n){const i=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(i)){const s=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(s);const a=this.nodeBuilder.buildLeafNode(i,n),{assignment:o,isCrossRef:l}=this.getAssignment(n),c=this.current;if(o){const u=yt(n)?i.image:this.converter.convert(i.image,a);this.assign(o.operator,o.feature,u,a,l)}else if(Si(c)){let u=i.image;yt(n)||(u=this.converter.convert(u,a).toString()),c.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,t,n,i,s){let a;!this.isRecording()&&!n&&(a=this.nodeBuilder.buildCompositeNode(i));const o=this.wrapper.wrapSubrule(e,t,s);!this.isRecording()&&a&&a.length>0&&this.performSubruleAssignment(o,i,a)}performSubruleAssignment(e,t,n){const{assignment:i,isCrossRef:s}=this.getAssignment(t);if(i)this.assign(i.operator,i.feature,e,n,s);else if(!i){const a=this.current;if(Si(a))a.value+=e.toString();else if(typeof e=="object"&&e){const o=this.assignWithoutOverride(e,a);this.stack.pop(),this.stack.push(o)}}}action(e,t){if(!this.isRecording()){let n=this.current;if(t.feature&&t.operator){n=this.construct(),this.nodeBuilder.removeNode(n.$cstNode),this.nodeBuilder.buildCompositeNode(t).content.push(n.$cstNode);const i={$type:e};this.stack.push(i),this.assign(t.operator,t.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return kd(e),this.nodeBuilder.construct(e),this.stack.pop(),Si(e)?this.converter.convert(e.value,e.$cstNode):(xd(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const t=Jn(e,gt);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?Ns(t.terminal):!1})}return this.assignmentMap.get(e)}assign(e,t,n,i,s){const a=this.current;let o;switch(s&&typeof n=="string"?o=this.linker.buildReference(a,t,i,n):o=n,e){case"=":{a[t]=o;break}case"?=":{a[t]=!0;break}case"+=":Array.isArray(a[t])||(a[t]=[]),a[t].push(o)}}assignWithoutOverride(e,t){for(const[i,s]of Object.entries(t)){const a=e[i];a===void 0?e[i]=s:Array.isArray(a)&&Array.isArray(s)&&(s.push(...a),e[i]=s)}const n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class Wp{buildMismatchTokenMessage(e){return wt.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return wt.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return wt.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return wt.buildEarlyExitMessage(e)}}class Lc extends Wp{buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class zp extends wc{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const t=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=t.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){const n=this.wrapper.DEFINE_RULE(Nc(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,n),e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{const n=this.keepStackSize();try{e(t)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,n){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,n,i,s){this.before(i),this.wrapper.wrapSubrule(e,t,s),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){const t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}}const Yp={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Lc};class qp extends rp{constructor(e,t){const n=t&&"maxLookahead"in t;super(e,Object.assign(Object.assign(Object.assign({},Yp),{lookaheadStrategy:n?new Bs({maxLookahead:t.maxLookahead}):new Ap({logging:t.skipValidations?()=>{}:void 0})}),t))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t){return this.RULE(e,t)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t)}wrapSubrule(e,t,n){return this.subrule(e,t,{ARGS:[n]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}}function bc(r,e,t){return Xp({parser:e,tokens:t,ruleNames:new Map},r),e}function Xp(r,e){const t=wl(e,!1),n=ee(e.rules).filter(we).filter(i=>t.has(i));for(const i of n){const s=Object.assign(Object.assign({},r),{consume:1,optional:1,subrule:1,many:1,or:1});r.parser.rule(i,Rt(s,i.definition))}}function Rt(r,e,t=!1){let n;if(yt(e))n=nm(r,e);else if(Zn(e))n=Qp(r,e);else if(gt(e))n=Rt(r,e.terminal);else if(Ns(e))n=_c(r,e);else if(Tt(e))n=Zp(r,e);else if(kl(e))n=em(r,e);else if(xl(e))n=tm(r,e);else if(ws(e))n=rm(r,e);else if(gd(e)){const i=r.consume++;n=()=>r.parser.consume(i,tt,e)}else throw new Rl(e.$cstNode,`Unexpected element type: ${e.$type}`);return Oc(r,t?void 0:Hn(e),n,e.cardinality)}function Qp(r,e){const t=Os(e);return()=>r.parser.action(t,e)}function Zp(r,e){const t=e.rule.ref;if(we(t)){const n=r.subrule++,i=t.fragment,s=e.arguments.length>0?Jp(t,e.arguments):()=>({});return a=>r.parser.subrule(n,Pc(r,t),i,e,s(a))}else if(At(t)){const n=r.consume++,i=vs(r,t.name);return()=>r.parser.consume(n,i,e)}else if(t)Dr();else throw new Rl(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function Jp(r,e){const t=e.map(n=>ze(n.value));return n=>{const i={};for(let s=0;s<t.length;s++){const a=r.parameters[s],o=t[s];i[a.name]=o(n)}return i}}function ze(r){if(ud(r)){const e=ze(r.left),t=ze(r.right);return n=>e(n)||t(n)}else if(cd(r)){const e=ze(r.left),t=ze(r.right);return n=>e(n)&&t(n)}else if(dd(r)){const e=ze(r.value);return t=>!e(t)}else if(hd(r)){const e=r.parameter.ref.name;return t=>t!==void 0&&t[e]===!0}else if(ld(r)){const e=!!r.true;return()=>e}Dr()}function em(r,e){if(e.elements.length===1)return Rt(r,e.elements[0]);{const t=[];for(const i of e.elements){const s={ALT:Rt(r,i,!0)},a=Hn(i);a&&(s.GATE=ze(a)),t.push(s)}const n=r.or++;return i=>r.parser.alternatives(n,t.map(s=>{const a={ALT:()=>s.ALT(i)},o=s.GATE;return o&&(a.GATE=()=>o(i)),a}))}}function tm(r,e){if(e.elements.length===1)return Rt(r,e.elements[0]);const t=[];for(const o of e.elements){const l={ALT:Rt(r,o,!0)},c=Hn(o);c&&(l.GATE=ze(c)),t.push(l)}const n=r.or++,i=(o,l)=>{const c=l.getRuleStack().join("-");return`uGroup_${o}_${c}`},s=o=>r.parser.alternatives(n,t.map((l,c)=>{const u={ALT:()=>!0},d=r.parser;u.ALT=()=>{if(l.ALT(o),!d.isRecording()){const f=i(n,d);d.unorderedGroups.get(f)||d.unorderedGroups.set(f,[]);const m=d.unorderedGroups.get(f);typeof m?.[c]>"u"&&(m[c]=!0)}};const h=l.GATE;return h?u.GATE=()=>h(o):u.GATE=()=>!d.unorderedGroups.get(i(n,d))?.[c],u})),a=Oc(r,Hn(e),s,"*");return o=>{a(o),r.parser.isRecording()||r.parser.unorderedGroups.delete(i(n,r.parser))}}function rm(r,e){const t=e.elements.map(n=>Rt(r,n));return n=>t.forEach(i=>i(n))}function Hn(r){if(ws(r))return r.guardCondition}function _c(r,e,t=e.terminal){if(t)if(Tt(t)&&we(t.rule.ref)){const n=t.rule.ref,i=r.subrule++;return s=>r.parser.subrule(i,Pc(r,n),!1,e,s)}else if(Tt(t)&&At(t.rule.ref)){const n=r.consume++,i=vs(r,t.rule.ref.name);return()=>r.parser.consume(n,i,e)}else if(yt(t)){const n=r.consume++,i=vs(r,t.value);return()=>r.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const n=_l(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Os(e.type.ref));return _c(r,e,i)}}function nm(r,e){const t=r.consume++,n=r.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return()=>r.parser.consume(t,n,e)}function Oc(r,e,t,n){const i=e&&ze(e);if(!n)if(i){const s=r.or++;return a=>r.parser.alternatives(s,[{ALT:()=>t(a),GATE:()=>i(a)},{ALT:_a(),GATE:()=>!i(a)}])}else return t;if(n==="*"){const s=r.many++;return a=>r.parser.many(s,{DEF:()=>t(a),GATE:i?()=>i(a):void 0})}else if(n==="+"){const s=r.many++;if(i){const a=r.or++;return o=>r.parser.alternatives(a,[{ALT:()=>r.parser.atLeastOne(s,{DEF:()=>t(o)}),GATE:()=>i(o)},{ALT:_a(),GATE:()=>!i(o)}])}else return a=>r.parser.atLeastOne(s,{DEF:()=>t(a)})}else if(n==="?"){const s=r.optional++;return a=>r.parser.optional(s,{DEF:()=>t(a),GATE:i?()=>i(a):void 0})}else Dr()}function Pc(r,e){const t=im(r,e),n=r.parser.getRule(t);if(!n)throw new Error(`Rule "${t}" not found."`);return n}function im(r,e){if(we(e))return e.name;if(r.ruleNames.has(e))return r.ruleNames.get(e);{let t=e,n=t.$container,i=e.$type;for(;!we(n);)(ws(n)||kl(n)||xl(n))&&(i=n.elements.indexOf(t).toString()+":"+i),t=n,n=n.$container;return i=n.name+":"+i,r.ruleNames.set(e,i),i}}function vs(r,e){const t=r.tokens[e];if(!t)throw new Error(`Token "${e}" not found."`);return t}function sm(r){const e=r.Grammar,t=r.parser.Lexer,n=new zp(r);return bc(e,n,t.definition),n.finalize(),n}function am(r){const e=om(r);return e.finalize(),e}function om(r){const e=r.Grammar,t=r.parser.Lexer,n=new Hp(r);return bc(e,n,t.definition)}class Mc{constructor(){this.diagnostics=[]}buildTokens(e,t){const n=ee(wl(e,!1)),i=this.buildTerminalTokens(n),s=this.buildKeywordTokens(n,i,t);return i.forEach(a=>{const o=a.PATTERN;typeof o=="object"&&o&&"test"in o&&Wi(o)?s.unshift(a):s.push(a)}),s}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(At).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){const t=Ps(e),n=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,i={name:e.name,PATTERN:n};return typeof n=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=Wi(t)?he.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){const t=new RegExp(e,e.flags+"y");return(n,i)=>(t.lastIndex=i,t.exec(n))}buildKeywordTokens(e,t,n){return e.filter(we).flatMap(i=>Fr(i).filter(yt)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,t,!!n?.caseInsensitive))}buildKeywordToken(e,t,n){const i=this.buildKeywordPattern(e,n),s={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,t)};return typeof i=="function"&&(s.LINE_BREAKS=!0),s}buildKeywordPattern(e,t){return t?new RegExp(Od(e.value)):e.value}findLongerAlt(e,t){return t.reduce((n,i)=>{const s=i?.PATTERN;return s?.source&&Pd("^"+s.source+"$",e.value)&&n.push(i),n},[])}}class Dc{convert(e,t){let n=t.grammarSource;if(Ns(n)&&(n=Ud(n)),Tt(n)){const i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,t)}return e}runConverter(e,t,n){var i;switch(e.name.toUpperCase()){case"INT":return je.convertInt(t);case"STRING":return je.convertString(t);case"ID":return je.convertID(t)}switch((i=Wd(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return je.convertNumber(t);case"boolean":return je.convertBoolean(t);case"bigint":return je.convertBigint(t);case"date":return je.convertDate(t);default:return t}}}var je;(function(r){function e(c){let u="";for(let d=1;d<c.length-1;d++){const h=c.charAt(d);if(h==="\\"){const f=c.charAt(++d);u+=t(f)}else u+=h}return u}r.convertString=e;function t(c){switch(c){case"b":return"\b";case"f":return"\f";case"n":return`
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return c}}function n(c){return c.charAt(0)==="^"?c.substring(1):c}r.convertID=n;function i(c){return parseInt(c)}r.convertInt=i;function s(c){return BigInt(c)}r.convertBigint=s;function a(c){return new Date(c)}r.convertDate=a;function o(c){return Number(c)}r.convertNumber=o;function l(c){return c.toLowerCase()==="true"}r.convertBoolean=l})(je||(je={}));var ft={},nn={},Go;function Fc(){if(Go)return nn;Go=1,Object.defineProperty(nn,"__esModule",{value:!0});let r;function e(){if(r===void 0)throw new Error("No runtime abstraction layer installed");return r}return(function(t){function n(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");r=i}t.install=n})(e||(e={})),nn.default=e,nn}var Q={},Bo;function lm(){if(Bo)return Q;Bo=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.stringArray=Q.array=Q.func=Q.error=Q.number=Q.string=Q.boolean=void 0;function r(o){return o===!0||o===!1}Q.boolean=r;function e(o){return typeof o=="string"||o instanceof String}Q.string=e;function t(o){return typeof o=="number"||o instanceof Number}Q.number=t;function n(o){return o instanceof Error}Q.error=n;function i(o){return typeof o=="function"}Q.func=i;function s(o){return Array.isArray(o)}Q.array=s;function a(o){return s(o)&&o.every(l=>e(l))}return Q.stringArray=a,Q}var pt={},Ko;function Uc(){if(Ko)return pt;Ko=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.Emitter=pt.Event=void 0;const r=Fc();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(pt.Event=e={}));class t{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 l=0,c=this._callbacks.length;l<c;l++)if(this._callbacks[l]===s)if(this._contexts[l]===a){this._callbacks.splice(l,1),this._contexts.splice(l,1);return}else o=!0;if(o)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...s){if(!this._callbacks)return[];const a=[],o=this._callbacks.slice(0),l=this._contexts.slice(0);for(let c=0,u=o.length;c<u;c++)try{a.push(o[c].apply(l[c],s))}catch(d){(0,r.default)().console.error(d)}return a}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class n{constructor(s){this._options=s}get event(){return this._event||(this._event=(s,a,o)=>{this._callbacks||(this._callbacks=new t),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,a);const l={dispose:()=>{this._callbacks&&(this._callbacks.remove(s,a),l.dispose=n._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(o)&&o.push(l),l}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return pt.Emitter=n,n._noop=function(){},pt}var Vo;function cm(){if(Vo)return ft;Vo=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.CancellationTokenSource=ft.CancellationToken=void 0;const r=Fc(),e=lm(),t=Uc();var n;(function(o){o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:t.Event.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:t.Event.None});function l(c){const u=c;return u&&(u===o.None||u===o.Cancelled||e.boolean(u.isCancellationRequested)&&!!u.onCancellationRequested)}o.is=l})(n||(ft.CancellationToken=n={}));const i=Object.freeze(function(o,l){const c=(0,r.default)().timer.setTimeout(o.bind(l),0);return{dispose(){c.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 onCancellationRequested(){return this._isCancelled?i:(this._emitter||(this._emitter=new t.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class a{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=n.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=n.None}}return ft.CancellationTokenSource=a,ft}var K=cm();function um(){return new Promise(r=>{typeof setImmediate>"u"?setTimeout(r,0):setImmediate(r)})}let vn=0,dm=10;function hm(){return vn=performance.now(),new K.CancellationTokenSource}const Wn=Symbol("OperationCancelled");function ci(r){return r===Wn}async function $e(r){if(r===K.CancellationToken.None)return;const e=performance.now();if(e-vn>=dm&&(vn=e,await um(),vn=performance.now()),r.isCancellationRequested)throw Wn}class qs{constructor(){this.promise=new Promise((e,t)=>{this.resolve=n=>(e(n),this),this.reject=n=>(t(n),this)})}}class Pr{constructor(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){for(const n of e)if(Pr.isIncremental(n)){const i=Bc(n.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(a,this._content.length);const o=Math.max(i.start.line,0),l=Math.max(i.end.line,0);let c=this._lineOffsets;const u=jo(n.text,!1,s);if(l-o===u.length)for(let h=0,f=u.length;h<f;h++)c[h+o+1]=u[h];else u.length<1e4?c.splice(o+1,l-o,...u):this._lineOffsets=c=c.slice(0,o+1).concat(u,c.slice(l+1));const d=n.text.length-(a-s);if(d!==0)for(let h=o+1+u.length,f=c.length;h<f;h++)c[h]=c[h]+d}else if(Pr.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=t}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=jo(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const t=this.getLineOffsets();let n=0,i=t.length;if(i===0)return{line:0,character:e};for(;n<i;){const a=Math.floor((n+i)/2);t[a]>e?i=a:n=a+1}const s=n-1;return e=this.ensureBeforeEOL(e,t[s]),{line:s,character:e-t[s]}}offsetAt(e){const t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;const n=t[e.line];if(e.character<=0)return n;const i=e.line+1<t.length?t[e.line+1]:this._content.length,s=Math.min(n+e.character,i);return this.ensureBeforeEOL(s,n)}ensureBeforeEOL(e,t){for(;e>t&&Gc(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")}static isFull(e){const t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0}}var Rs;(function(r){function e(i,s,a,o){return new Pr(i,s,a,o)}r.create=e;function t(i,s,a){if(i instanceof Pr)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}r.update=t;function n(i,s){const a=i.getText(),o=$s(s.map(fm),(u,d)=>{const h=u.range.start.line-d.range.start.line;return h===0?u.range.start.character-d.range.start.character:h});let l=0;const c=[];for(const u of o){const d=i.offsetAt(u.range.start);if(d<l)throw new Error("Overlapping edit");d>l&&c.push(a.substring(l,d)),u.newText.length&&c.push(u.newText),l=i.offsetAt(u.range.end)}return c.push(a.substr(l)),c.join("")}r.applyEdits=n})(Rs||(Rs={}));function $s(r,e){if(r.length<=1)return r;const t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);$s(n,e),$s(i,e);let s=0,a=0,o=0;for(;s<n.length&&a<i.length;)e(n[s],i[a])<=0?r[o++]=n[s++]:r[o++]=i[a++];for(;s<n.length;)r[o++]=n[s++];for(;a<i.length;)r[o++]=i[a++];return r}function jo(r,e,t=0){const n=e?[t]:[];for(let i=0;i<r.length;i++){const s=r.charCodeAt(i);Gc(s)&&(s===13&&i+1<r.length&&r.charCodeAt(i+1)===10&&i++,n.push(t+i+1))}return n}function Gc(r){return r===13||r===10}function Bc(r){const e=r.start,t=r.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:r}function fm(r){const e=Bc(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var Kc;(()=>{var r={470:i=>{function s(l){if(typeof l!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(l))}function a(l,c){for(var u,d="",h=0,f=-1,m=0,g=0;g<=l.length;++g){if(g<l.length)u=l.charCodeAt(g);else{if(u===47)break;u=47}if(u===47){if(!(f===g-1||m===1))if(f!==g-1&&m===2){if(d.length<2||h!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var k=d.lastIndexOf("/");if(k!==d.length-1){k===-1?(d="",h=0):h=(d=d.slice(0,k)).length-1-d.lastIndexOf("/"),f=g,m=0;continue}}else if(d.length===2||d.length===1){d="",h=0,f=g,m=0;continue}}c&&(d.length>0?d+="/..":d="..",h=2)}else d.length>0?d+="/"+l.slice(f+1,g):d=l.slice(f+1,g),h=g-f-1;f=g,m=0}else u===46&&m!==-1?++m:m=-1}return d}var o={resolve:function(){for(var l,c="",u=!1,d=arguments.length-1;d>=-1&&!u;d--){var h;d>=0?h=arguments[d]:(l===void 0&&(l=fi.cwd()),h=l),s(h),h.length!==0&&(c=h+"/"+c,u=h.charCodeAt(0)===47)}return c=a(c,!u),u?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(l){if(s(l),l.length===0)return".";var c=l.charCodeAt(0)===47,u=l.charCodeAt(l.length-1)===47;return(l=a(l,!c)).length!==0||c||(l="."),l.length>0&&u&&(l+="/"),c?"/"+l:l},isAbsolute:function(l){return s(l),l.length>0&&l.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var l,c=0;c<arguments.length;++c){var u=arguments[c];s(u),u.length>0&&(l===void 0?l=u:l+="/"+u)}return l===void 0?".":o.normalize(l)},relative:function(l,c){if(s(l),s(c),l===c||(l=o.resolve(l))===(c=o.resolve(c)))return"";for(var u=1;u<l.length&&l.charCodeAt(u)===47;++u);for(var d=l.length,h=d-u,f=1;f<c.length&&c.charCodeAt(f)===47;++f);for(var m=c.length-f,g=h<m?h:m,k=-1,R=0;R<=g;++R){if(R===g){if(m>g){if(c.charCodeAt(f+R)===47)return c.slice(f+R+1);if(R===0)return c.slice(f+R)}else h>g&&(l.charCodeAt(u+R)===47?k=R:R===0&&(k=0));break}var $=l.charCodeAt(u+R);if($!==c.charCodeAt(f+R))break;$===47&&(k=R)}var T="";for(R=u+k+1;R<=d;++R)R!==d&&l.charCodeAt(R)!==47||(T.length===0?T+="..":T+="/..");return T.length>0?T+c.slice(f+k):(f+=k,c.charCodeAt(f)===47&&++f,c.slice(f))},_makeLong:function(l){return l},dirname:function(l){if(s(l),l.length===0)return".";for(var c=l.charCodeAt(0),u=c===47,d=-1,h=!0,f=l.length-1;f>=1;--f)if((c=l.charCodeAt(f))===47){if(!h){d=f;break}}else h=!1;return d===-1?u?"/":".":u&&d===1?"//":l.slice(0,d)},basename:function(l,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');s(l);var u,d=0,h=-1,f=!0;if(c!==void 0&&c.length>0&&c.length<=l.length){if(c.length===l.length&&c===l)return"";var m=c.length-1,g=-1;for(u=l.length-1;u>=0;--u){var k=l.charCodeAt(u);if(k===47){if(!f){d=u+1;break}}else g===-1&&(f=!1,g=u+1),m>=0&&(k===c.charCodeAt(m)?--m==-1&&(h=u):(m=-1,h=g))}return d===h?h=g:h===-1&&(h=l.length),l.slice(d,h)}for(u=l.length-1;u>=0;--u)if(l.charCodeAt(u)===47){if(!f){d=u+1;break}}else h===-1&&(f=!1,h=u+1);return h===-1?"":l.slice(d,h)},extname:function(l){s(l);for(var c=-1,u=0,d=-1,h=!0,f=0,m=l.length-1;m>=0;--m){var g=l.charCodeAt(m);if(g!==47)d===-1&&(h=!1,d=m+1),g===46?c===-1?c=m:f!==1&&(f=1):c!==-1&&(f=-1);else if(!h){u=m+1;break}}return c===-1||d===-1||f===0||f===1&&c===d-1&&c===u+1?"":l.slice(c,d)},format:function(l){if(l===null||typeof l!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof l);return(function(c,u){var d=u.dir||u.root,h=u.base||(u.name||"")+(u.ext||"");return d?d===u.root?d+h:d+"/"+h:h})(0,l)},parse:function(l){s(l);var c={root:"",dir:"",base:"",ext:"",name:""};if(l.length===0)return c;var u,d=l.charCodeAt(0),h=d===47;h?(c.root="/",u=1):u=0;for(var f=-1,m=0,g=-1,k=!0,R=l.length-1,$=0;R>=u;--R)if((d=l.charCodeAt(R))!==47)g===-1&&(k=!1,g=R+1),d===46?f===-1?f=R:$!==1&&($=1):f!==-1&&($=-1);else if(!k){m=R+1;break}return f===-1||g===-1||$===0||$===1&&f===g-1&&f===m+1?g!==-1&&(c.base=c.name=m===0&&h?l.slice(1,g):l.slice(m,g)):(m===0&&h?(c.name=l.slice(1,f),c.base=l.slice(1,g)):(c.name=l.slice(m,f),c.base=l.slice(m,g)),c.ext=l.slice(f,g)),m>0?c.dir=l.slice(0,m-1):h&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,i.exports=o}},e={};function t(i){var s=e[i];if(s!==void 0)return s.exports;var a=e[i]={exports:{}};return r[i](a,a.exports,t),a.exports}t.d=(i,s)=>{for(var a in s)t.o(s,a)&&!t.o(i,a)&&Object.defineProperty(i,a,{enumerable:!0,get:s[a]})},t.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),t.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var n={};(()=>{let i;t.r(n),t.d(n,{URI:()=>h,Utils:()=>Se}),typeof fi=="object"?i=fi.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,a=/^\//,o=/^\/\//;function l(E,y){if(!E.scheme&&y)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${E.authority}", path: "${E.path}", query: "${E.query}", fragment: "${E.fragment}"}`);if(E.scheme&&!s.test(E.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(E.path){if(E.authority){if(!a.test(E.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test(E.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const c="",u="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class h{static isUri(y){return y instanceof h||!!y&&typeof y.authority=="string"&&typeof y.fragment=="string"&&typeof y.path=="string"&&typeof y.query=="string"&&typeof y.scheme=="string"&&typeof y.fsPath=="string"&&typeof y.with=="function"&&typeof y.toString=="function"}scheme;authority;path;query;fragment;constructor(y,S,x,_,b,L=!1){typeof y=="object"?(this.scheme=y.scheme||c,this.authority=y.authority||c,this.path=y.path||c,this.query=y.query||c,this.fragment=y.fragment||c):(this.scheme=(function(Te,Y){return Te||Y?Te:"file"})(y,L),this.authority=S||c,this.path=(function(Te,Y){switch(Te){case"https":case"http":case"file":Y?Y[0]!==u&&(Y=u+Y):Y=u}return Y})(this.scheme,x||c),this.query=_||c,this.fragment=b||c,l(this,L))}get fsPath(){return $(this)}with(y){if(!y)return this;let{scheme:S,authority:x,path:_,query:b,fragment:L}=y;return S===void 0?S=this.scheme:S===null&&(S=c),x===void 0?x=this.authority:x===null&&(x=c),_===void 0?_=this.path:_===null&&(_=c),b===void 0?b=this.query:b===null&&(b=c),L===void 0?L=this.fragment:L===null&&(L=c),S===this.scheme&&x===this.authority&&_===this.path&&b===this.query&&L===this.fragment?this:new m(S,x,_,b,L)}static parse(y,S=!1){const x=d.exec(y);return x?new m(x[2]||c,ie(x[4]||c),ie(x[5]||c),ie(x[7]||c),ie(x[9]||c),S):new m(c,c,c,c,c)}static file(y){let S=c;if(i&&(y=y.replace(/\\/g,u)),y[0]===u&&y[1]===u){const x=y.indexOf(u,2);x===-1?(S=y.substring(2),y=u):(S=y.substring(2,x),y=y.substring(x)||u)}return new m("file",S,y,c,c)}static from(y){const S=new m(y.scheme,y.authority,y.path,y.query,y.fragment);return l(S,!0),S}toString(y=!1){return T(this,y)}toJSON(){return this}static revive(y){if(y){if(y instanceof h)return y;{const S=new m(y);return S._formatted=y.external,S._fsPath=y._sep===f?y.fsPath:null,S}}return y}}const f=i?1:void 0;class m extends h{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=$(this)),this._fsPath}toString(y=!1){return y?T(this,!0):(this._formatted||(this._formatted=T(this,!1)),this._formatted)}toJSON(){const y={$mid:1};return this._fsPath&&(y.fsPath=this._fsPath,y._sep=f),this._formatted&&(y.external=this._formatted),this.path&&(y.path=this.path),this.scheme&&(y.scheme=this.scheme),this.authority&&(y.authority=this.authority),this.query&&(y.query=this.query),this.fragment&&(y.fragment=this.fragment),y}}const g={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function k(E,y,S){let x,_=-1;for(let b=0;b<E.length;b++){const L=E.charCodeAt(b);if(L>=97&&L<=122||L>=65&&L<=90||L>=48&&L<=57||L===45||L===46||L===95||L===126||y&&L===47||S&&L===91||S&&L===93||S&&L===58)_!==-1&&(x+=encodeURIComponent(E.substring(_,b)),_=-1),x!==void 0&&(x+=E.charAt(b));else{x===void 0&&(x=E.substr(0,b));const Te=g[L];Te!==void 0?(_!==-1&&(x+=encodeURIComponent(E.substring(_,b)),_=-1),x+=Te):_===-1&&(_=b)}}return _!==-1&&(x+=encodeURIComponent(E.substring(_))),x!==void 0?x:E}function R(E){let y;for(let S=0;S<E.length;S++){const x=E.charCodeAt(S);x===35||x===63?(y===void 0&&(y=E.substr(0,S)),y+=g[x]):y!==void 0&&(y+=E[S])}return y!==void 0?y:E}function $(E,y){let S;return S=E.authority&&E.path.length>1&&E.scheme==="file"?`//${E.authority}${E.path}`:E.path.charCodeAt(0)===47&&(E.path.charCodeAt(1)>=65&&E.path.charCodeAt(1)<=90||E.path.charCodeAt(1)>=97&&E.path.charCodeAt(1)<=122)&&E.path.charCodeAt(2)===58?E.path[1].toLowerCase()+E.path.substr(2):E.path,i&&(S=S.replace(/\//g,"\\")),S}function T(E,y){const S=y?R:k;let x="",{scheme:_,authority:b,path:L,query:Te,fragment:Y}=E;if(_&&(x+=_,x+=":"),(b||_==="file")&&(x+=u,x+=u),b){let V=b.indexOf("@");if(V!==-1){const ut=b.substr(0,V);b=b.substr(V+1),V=ut.lastIndexOf(":"),V===-1?x+=S(ut,!1,!1):(x+=S(ut.substr(0,V),!1,!1),x+=":",x+=S(ut.substr(V+1),!1,!0)),x+="@"}b=b.toLowerCase(),V=b.lastIndexOf(":"),V===-1?x+=S(b,!1,!0):(x+=S(b.substr(0,V),!1,!0),x+=b.substr(V))}if(L){if(L.length>=3&&L.charCodeAt(0)===47&&L.charCodeAt(2)===58){const V=L.charCodeAt(1);V>=65&&V<=90&&(L=`/${String.fromCharCode(V+32)}:${L.substr(3)}`)}else if(L.length>=2&&L.charCodeAt(1)===58){const V=L.charCodeAt(0);V>=65&&V<=90&&(L=`${String.fromCharCode(V+32)}:${L.substr(2)}`)}x+=S(L,!0,!1)}return Te&&(x+="?",x+=S(Te,!1,!1)),Y&&(x+="#",x+=y?Y:k(Y,!1,!1)),x}function I(E){try{return decodeURIComponent(E)}catch{return E.length>3?E.substr(0,3)+I(E.substr(3)):E}}const G=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function ie(E){return E.match(G)?E.replace(G,y=>I(y)):E}var Le=t(470);const ye=Le.posix||Le,Fe="/";var Se;(function(E){E.joinPath=function(y,...S){return y.with({path:ye.join(y.path,...S)})},E.resolvePath=function(y,...S){let x=y.path,_=!1;x[0]!==Fe&&(x=Fe+x,_=!0);let b=ye.resolve(x,...S);return _&&b[0]===Fe&&!y.authority&&(b=b.substring(1)),y.with({path:b})},E.dirname=function(y){if(y.path.length===0||y.path===Fe)return y;let S=ye.dirname(y.path);return S.length===1&&S.charCodeAt(0)===46&&(S=""),y.with({path:S})},E.basename=function(y){return ye.basename(y.path)},E.extname=function(y){return ye.extname(y.path)}})(Se||(Se={}))})(),Kc=n})();const{URI:$t,Utils:zt}=Kc;var nt;(function(r){r.basename=zt.basename,r.dirname=zt.dirname,r.extname=zt.extname,r.joinPath=zt.joinPath,r.resolvePath=zt.resolvePath;function e(i,s){return i?.toString()===s?.toString()}r.equals=e;function t(i,s){const a=typeof i=="string"?i:i.path,o=typeof s=="string"?s:s.path,l=a.split("/").filter(f=>f.length>0),c=o.split("/").filter(f=>f.length>0);let u=0;for(;u<l.length&&l[u]===c[u];u++);const d="../".repeat(l.length-u),h=c.slice(u).join("/");return d+h}r.relative=t;function n(i){return $t.parse(i.toString()).toString()}r.normalize=n})(nt||(nt={}));var U;(function(r){r[r.Changed=0]="Changed",r[r.Parsed=1]="Parsed",r[r.IndexedContent=2]="IndexedContent",r[r.ComputedScopes=3]="ComputedScopes",r[r.Linked=4]="Linked",r[r.IndexedReferences=5]="IndexedReferences",r[r.Validated=6]="Validated"})(U||(U={}));class pm{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=K.CancellationToken.None){const n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,t)}fromTextDocument(e,t,n){return t=t??$t.parse(e.uri),K.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromString(e,t,n){return K.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,n){if(typeof t=="string"){const i=this.parse(e,t,n);return this.createLangiumDocument(i,e,void 0,t)}else if("$model"in t){const i={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{const i=this.parse(e,t.getText(),n);return this.createLangiumDocument(i,e,t)}}async createAsync(e,t,n){if(typeof t=="string"){const i=await this.parseAsync(e,t,n);return this.createLangiumDocument(i,e,void 0,t)}else{const i=await this.parseAsync(e,t.getText(),n);return this.createLangiumDocument(i,e,t)}}createLangiumDocument(e,t,n,i){let s;if(n)s={parseResult:e,uri:t,state:U.Parsed,references:[],textDocument:n};else{const a=this.createTextDocumentGetter(t,i);s={parseResult:e,uri:t,state:U.Parsed,references:[],get textDocument(){return a()}}}return e.value.$document=s,s}async update(e,t){var n,i;const s=(n=e.parseResult.value.$cstNode)===null||n===void 0?void 0:n.root.fullText,a=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),o=a?a.getText():await this.fileSystemProvider.readFile(e.uri);if(a)Object.defineProperty(e,"textDocument",{value:a});else{const l=this.createTextDocumentGetter(e.uri,o);Object.defineProperty(e,"textDocument",{get:l})}return s!==o&&(e.parseResult=await this.parseAsync(e.uri,o,t),e.parseResult.value.$document=e),e.state=U.Parsed,e}parse(e,t,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,n)}parseAsync(e,t,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,n)}createTextDocumentGetter(e,t){const n=this.serviceRegistry;let i;return()=>i??(i=Rs.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,t??""))}}class mm{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return ee(this.documentMap.values())}addDocument(e){const t=e.uri.toString();if(this.documentMap.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentMap.set(t,e)}getDocument(e){const t=e.toString();return this.documentMap.get(t)}async getOrCreateDocument(e,t){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(n),n)}createDocument(e,t,n){if(n)return this.langiumDocumentFactory.fromString(t,e,n).then(i=>(this.addDocument(i),i));{const i=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const t=e.toString(),n=this.documentMap.get(t);return n&&(this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=U.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0),n}deleteDocument(e){const t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=U.Changed,this.documentMap.delete(t)),n}}const Ci=Symbol("ref_resolving");class gm{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,t=K.CancellationToken.None){for(const n of Lt(e.parseResult.value))await $e(t),Sl(n).forEach(i=>this.doLink(i,e))}doLink(e,t){var n;const i=e.reference;if(i._ref===void 0){i._ref=Ci;try{const s=this.getCandidate(e);if(hn(s))i._ref=s;else if(i._nodeDescription=s,this.langiumDocuments().hasDocument(s.documentUri)){const a=this.loadAstNode(s);i._ref=a??this.createLinkingError(e,s)}else i._ref=void 0}catch(s){console.error(`An error occurred while resolving reference to '${i.$refText}':`,s);const a=(n=s.message)!==null&&n!==void 0?n:String(s);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${a}`})}t.references.push(i)}}unlink(e){for(const t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}buildReference(e,t,n,i){const s=this,a={$refNode:n,$refText:i,get ref(){var o;if(ae(this._ref))return this._ref;if(Zu(this._nodeDescription)){const l=s.loadAstNode(this._nodeDescription);this._ref=l??s.createLinkingError({reference:a,container:e,property:t},this._nodeDescription)}else if(this._ref===void 0){this._ref=Ci;const l=Hi(e).$document,c=s.getLinkedNode({reference:a,container:e,property:t});if(c.error&&l&&l.state<U.ComputedScopes)return this._ref=void 0;this._ref=(o=c.node)!==null&&o!==void 0?o:c.error,this._nodeDescription=c.descr,l?.references.push(this)}else if(this._ref===Ci)throw new Error(`Cyclic reference resolution detected: ${s.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${i}')`);return ae(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return hn(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){var t;try{const n=this.getCandidate(e);if(hn(n))return{error:n};const i=this.loadAstNode(n);return i?{node:i,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,n);const i=(t=n.message)!==null&&t!==void 0?t:String(n);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;const t=this.langiumDocuments().getDocument(e.documentUri);if(t)return this.astNodeLocator.getAstNode(t.parseResult.value,e.path)}createLinkingError(e,t){const n=Hi(e.container).$document;n&&n.state<U.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);const i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:t})}}function ym(r){return typeof r.name=="string"}class Tm{getName(e){if(ym(e))return e.name}getNameNode(e){return bl(e.$cstNode,"name")}}class vm{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const t=jd(e),n=e.astNode;if(t&&n){const i=n[t.feature];if(Ge(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(Ge(s)&&s.$refNode&&s.$refNode.offset<=e.offset&&s.$refNode.end>=e.end)return s.ref}}if(n){const i=this.nameProvider.getNameNode(n);if(i&&(i===e||td(e,i)))return n}}}findDeclarationNode(e){const t=this.findDeclaration(e);if(t?.$cstNode)return this.nameProvider.getNameNode(t)??t.$cstNode}findReferences(e,t){const n=[];if(t.includeDeclaration){const s=this.getReferenceToSelf(e);s&&n.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(i=i.filter(s=>nt.equals(s.sourceUri,t.documentUri))),n.push(...i),ee(n)}getReferenceToSelf(e){const t=this.nameProvider.getNameNode(e);if(t){const n=Je(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Cn(t),local:!0}}}}class zn{constructor(e){if(this.map=new Map,e)for(const[t,n]of e)this.add(t,n)}get size(){return Ki.sum(ee(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{const n=this.map.get(e);if(n){const i=n.indexOf(t);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var t;return(t=this.map.get(e))!==null&&t!==void 0?t:[]}has(e,t){if(t===void 0)return this.map.has(e);{const n=this.map.get(e);return n?n.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,n)=>t.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ee(this.map.entries()).flatMap(([e,t])=>t.map(n=>[e,n]))}keys(){return ee(this.map.keys())}values(){return ee(this.map.values()).flat()}entriesGroupedByKey(){return ee(this.map.entries())}}class Ho{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[t,n]of e)this.set(t,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const t=this.map.get(e);return t!==void 0?(this.map.delete(e),this.inverse.delete(t),!0):!1}}class Rm{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=K.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=Ls,i=K.CancellationToken.None){const s=[];this.exportNode(e,s,t);for(const a of n(e))await $e(i),this.exportNode(a,s,t);return s}exportNode(e,t,n){const i=this.nameProvider.getName(e);i&&t.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,t=K.CancellationToken.None){const n=e.parseResult.value,i=new zn;for(const s of Fr(n))await $e(t),this.processNode(s,e,i);return i}processNode(e,t,n){const i=e.$container;if(i){const s=this.nameProvider.getName(e);s&&n.add(i,this.descriptions.createDescription(e,s,t))}}}class Wo{constructor(e,t,n){var i;this.elements=e,this.outerScope=t,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const t=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(t)return t;if(this.outerScope)return this.outerScope.getElement(e)}}class $m{constructor(e,t,n){var i;this.elements=new Map,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1;for(const s of e){const a=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(a,s)}this.outerScope=t}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(t);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=ee(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class Vc{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class Em extends Vc{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){const n=t();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class Am extends Vc{constructor(e){super(),this.cache=new Map,this.converter=e??(t=>t)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,n){this.throwIfDisposed(),this.cacheForContext(e).set(t,n)}get(e,t,n){this.throwIfDisposed();const i=this.cacheForContext(e);if(i.has(t))return i.get(t);if(n){const s=n();return i.set(t,s),s}else return}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){const t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){const t=this.converter(e);let n=this.cache.get(t);return n||(n=new Map,this.cache.set(t,n)),n}}class km extends Em{constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class xm{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new km(e.shared)}getScope(e){const t=[],n=this.reflection.getReferenceType(e),i=Je(e.container).precomputedScopes;if(i){let a=e.container;do{const o=i.get(a);o.length>0&&t.push(ee(o).filter(l=>this.reflection.isSubtype(l.type,n))),a=a.$container}while(a)}let s=this.getGlobalScope(n,e);for(let a=t.length-1;a>=0;a--)s=this.createScope(t[a],s);return s}createScope(e,t,n){return new Wo(ee(e),t,n)}createScopeForNodes(e,t,n){const i=ee(e).map(s=>{const a=this.nameProvider.getName(s);if(a)return this.descriptions.createDescription(s,a)}).nonNullable();return new Wo(i,t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new $m(this.indexManager.allElements(e)))}}function Im(r){return typeof r.$comment=="string"}function zo(r){return typeof r=="object"&&!!r&&("$ref"in r||"$error"in r)}class Sm{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,t){const n=t??{},i=t?.replacer,s=(o,l)=>this.replacer(o,l,n),a=i?(o,l)=>i(o,l,s):s;try{return this.currentDocument=Je(e),JSON.stringify(e,a,t?.space)}finally{this.currentDocument=void 0}}deserialize(e,t){const n=t??{},i=JSON.parse(e);return this.linkNode(i,i,n),i}replacer(e,t,{refText:n,sourceText:i,textRegions:s,comments:a,uriConverter:o}){var l,c,u,d;if(!this.ignoreProperties.has(e))if(Ge(t)){const h=t.ref,f=n?t.$refText:void 0;if(h){const m=Je(h);let g="";this.currentDocument&&this.currentDocument!==m&&(o?g=o(m.uri,t):g=m.uri.toString());const k=this.astNodeLocator.getAstNodePath(h);return{$ref:`${g}#${k}`,$refText:f}}else return{$error:(c=(l=t.error)===null||l===void 0?void 0:l.message)!==null&&c!==void 0?c:"Could not resolve reference",$refText:f}}else if(ae(t)){let h;if(s&&(h=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},t)),(!e||t.$document)&&h?.$textRegion&&(h.$textRegion.documentURI=(u=this.currentDocument)===null||u===void 0?void 0:u.uri.toString())),i&&!e&&(h??(h=Object.assign({},t)),h.$sourceText=(d=t.$cstNode)===null||d===void 0?void 0:d.text),a){h??(h=Object.assign({},t));const f=this.commentProvider.getComment(t);f&&(h.$comment=f.replace(/\r/g,""))}return h??t}else return t}addAstNodeRegionWithAssignmentsTo(e){const t=n=>({offset:n.offset,end:n.end,length:n.length,range:n.range});if(e.$cstNode){const n=e.$textRegion=t(e.$cstNode),i=n.assignments={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const a=Bd(e.$cstNode,s).map(t);a.length!==0&&(i[s]=a)}),e}}linkNode(e,t,n,i,s,a){for(const[l,c]of Object.entries(e))if(Array.isArray(c))for(let u=0;u<c.length;u++){const d=c[u];zo(d)?c[u]=this.reviveReference(e,l,t,d,n):ae(d)&&this.linkNode(d,t,n,e,l,u)}else zo(c)?e[l]=this.reviveReference(e,l,t,c,n):ae(c)&&this.linkNode(c,t,n,e,l);const o=e;o.$container=i,o.$containerProperty=s,o.$containerIndex=a}reviveReference(e,t,n,i,s){let a=i.$refText,o=i.$error;if(i.$ref){const l=this.getRefNode(n,i.$ref,s.uriConverter);if(ae(l))return a||(a=this.nameProvider.getName(l)),{$refText:a??"",ref:l};o=l}if(o){const l={$refText:a??""};return l.error={container:e,property:t,message:o,reference:l},l}else return}getRefNode(e,t,n){try{const i=t.indexOf("#");if(i===0)return this.astNodeLocator.getAstNode(e,t.substring(1))||"Could not resolve path: "+t;if(i<0){const l=n?n(t):$t.parse(t),c=this.langiumDocuments.getDocument(l);return c?c.parseResult.value:"Could not find document for URI: "+t}const s=n?n(t.substring(0,i)):$t.parse(t.substring(0,i)),a=this.langiumDocuments.getDocument(s);return a?i===t.length-1?a.parseResult.value:this.astNodeLocator.getAstNode(a.parseResult.value,t.substring(i+1))||"Could not resolve URI: "+t:"Could not find document for URI: "+t}catch(i){return String(i)}}}class Cm{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){const t=e.LanguageMetaData;for(const n of t.fileExtensions)this.fileExtensionMap.has(n)&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileExtensionMap.set(n,e);this.languageIdMap.set(t.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var t,n;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const i=(n=(t=this.textDocuments)===null||t===void 0?void 0:t.get(e))===null||n===void 0?void 0:n.languageId;if(i!==void 0){const o=this.languageIdMap.get(i);if(o)return o}const s=nt.extname(e),a=this.fileExtensionMap.get(s);if(!a)throw i?new Error(`The service registry contains no services for the extension '${s}' for language '${i}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return a}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function xr(r){return{code:r}}var Yn;(function(r){r.all=["fast","slow","built-in"]})(Yn||(Yn={}));class Nm{constructor(e){this.entries=new zn,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,t=this,n="fast"){if(n==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[i,s]of Object.entries(e)){const a=s;if(Array.isArray(a))for(const o of a){const l={check:this.wrapValidationException(o,t),category:n};this.addEntry(i,l)}else if(typeof a=="function"){const o={check:this.wrapValidationException(a,t),category:n};this.addEntry(i,o)}else Dr()}}wrapValidationException(e,t){return async(n,i,s)=>{await this.handleException(()=>e.call(t,n,i,s),"An error occurred during validation",i,n)}}async handleException(e,t,n,i){try{await e()}catch(s){if(ci(s))throw s;console.error(`${t}:`,s),s instanceof Error&&s.stack&&console.error(s.stack);const a=s instanceof Error?s.message:String(s);n("error",`${t}: ${a}`,{node:i})}}addEntry(e,t){if(e==="AstNode"){this.entries.add("AstNode",t);return}for(const n of this.reflection.getAllSubTypes(e))this.entries.add(n,t)}getChecks(e,t){let n=ee(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(n=n.filter(i=>t.includes(i.category))),n.map(i=>i.check)}registerBeforeDocument(e,t=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",t))}registerAfterDocument(e,t=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",t))}wrapPreparationException(e,t,n){return async(i,s,a,o)=>{await this.handleException(()=>e.call(n,i,s,a,o),t,s,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}}class wm{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=K.CancellationToken.None){const i=e.parseResult,s=[];if(await $e(n),(!t.categories||t.categories.includes("built-in"))&&(this.processLexingErrors(i,s,t),t.stopAfterLexingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===_e.LexingError})||(this.processParsingErrors(i,s,t),t.stopAfterParsingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===_e.ParsingError}))||(this.processLinkingErrors(e,s,t),t.stopAfterLinkingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===_e.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,t,n))}catch(a){if(ci(a))throw a;console.error("An error occurred during validation:",a)}return await $e(n),s}processLexingErrors(e,t,n){var i,s,a;const o=[...e.lexerErrors,...(s=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&s!==void 0?s:[]];for(const l of o){const c=(a=l.severity)!==null&&a!==void 0?a:"error",u={severity:Ni(c),range:{start:{line:l.line-1,character:l.column-1},end:{line:l.line-1,character:l.column+l.length-1}},message:l.message,data:bm(c),source:this.getSource()};t.push(u)}}processParsingErrors(e,t,n){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const a=i.previousToken;if(isNaN(a.startOffset)){const o={line:0,character:0};s={start:o,end:o}}else{const o={line:a.endLine-1,character:a.endColumn};s={start:o,end:o}}}}else s=ji(i.token);if(s){const a={severity:Ni("error"),range:s,message:i.message,data:xr(_e.ParsingError),source:this.getSource()};t.push(a)}}}processLinkingErrors(e,t,n){for(const i of e.references){const s=i.error;if(s){const a={node:s.container,property:s.property,index:s.index,data:{code:_e.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};t.push(this.toDiagnostic("error",s.message,a))}}}async validateAst(e,t,n=K.CancellationToken.None){const i=[],s=(a,o,l)=>{i.push(this.toDiagnostic(a,o,l))};return await this.validateAstBefore(e,t,s,n),await this.validateAstNodes(e,t,s,n),await this.validateAstAfter(e,t,s,n),i}async validateAstBefore(e,t,n,i=K.CancellationToken.None){var s;const a=this.validationRegistry.checksBefore;for(const o of a)await $e(i),await o(e,n,(s=t.categories)!==null&&s!==void 0?s:[],i)}async validateAstNodes(e,t,n,i=K.CancellationToken.None){await Promise.all(Lt(e).map(async s=>{await $e(i);const a=this.validationRegistry.getChecks(s.$type,t.categories);for(const o of a)await o(s,n,i)}))}async validateAstAfter(e,t,n,i=K.CancellationToken.None){var s;const a=this.validationRegistry.checksAfter;for(const o of a)await $e(i),await o(e,n,(s=t.categories)!==null&&s!==void 0?s:[],i)}toDiagnostic(e,t,n){return{message:t,range:Lm(n),severity:Ni(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function Lm(r){if(r.range)return r.range;let e;return typeof r.property=="string"?e=bl(r.node.$cstNode,r.property,r.index):typeof r.keyword=="string"&&(e=Kd(r.node.$cstNode,r.keyword,r.index)),e??(e=r.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Ni(r){switch(r){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+r)}}function bm(r){switch(r){case"error":return xr(_e.LexingError);case"warning":return xr(_e.LexingWarning);case"info":return xr(_e.LexingInfo);case"hint":return xr(_e.LexingHint);default:throw new Error("Invalid diagnostic severity: "+r)}}var _e;(function(r){r.LexingError="lexing-error",r.LexingWarning="lexing-warning",r.LexingInfo="lexing-info",r.LexingHint="lexing-hint",r.ParsingError="parsing-error",r.LinkingError="linking-error"})(_e||(_e={}));class _m{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n){const i=n??Je(e);t??(t=this.nameProvider.getName(e));const s=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${s} has no name.`);let a;const o=()=>{var l;return a??(a=Cn((l=this.nameProvider.getNameNode(e))!==null&&l!==void 0?l:e.$cstNode))};return{node:e,name:t,get nameSegment(){return o()},selectionSegment:Cn(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class Om{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=K.CancellationToken.None){const n=[],i=e.parseResult.value;for(const s of Lt(i))await $e(t),Sl(s).filter(a=>!hn(a)).forEach(a=>{const o=this.createDescription(a);o&&n.push(o)});return n}createDescription(e){const t=e.reference.$nodeDescription,n=e.reference.$refNode;if(!t||!n)return;const i=Je(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:Cn(n),local:nt.equals(t.documentUri,i)}}}class Pm{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const t=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return t+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return t!==void 0?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((n,i)=>{if(!n||i.length===0)return n;const s=i.indexOf(this.indexSeparator);if(s>0){const a=i.substring(0,s),o=parseInt(i.substring(s+1));return n[a]?.[o]}return n[i]},e)}}var Mm=Uc();class Dm{constructor(e){this._ready=new qs,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Mm.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var t,n;this.workspaceConfig=(n=(t=e.capabilities.workspace)===null||t===void 0?void 0:t.configuration)!==null&&n!==void 0?n:!1}async initialized(e){if(this.workspaceConfig){if(e.register){const t=this.serviceRegistry.all;e.register({section:t.map(n=>this.toSectionName(n.LanguageMetaData.languageId))})}if(e.fetchConfiguration){const t=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(t);t.forEach((i,s)=>{this.updateSectionConfiguration(i.section,n[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(t=>{const n=e.settings[t];this.updateSectionConfiguration(t,n),this.onConfigurationSectionUpdateEmitter.fire({section:t,configuration:n})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;const n=this.toSectionName(e);if(this.settings[n])return this.settings[n][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var wr;(function(r){function e(t){return{dispose:async()=>await t()}}r.create=e})(wr||(wr={}));class Fm{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new zn,this.documentPhaseListeners=new zn,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=U.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=K.CancellationToken.None){var i,s;for(const a of e){const o=a.uri.toString();if(a.state===U.Validated){if(typeof t.validation=="boolean"&&t.validation)a.state=U.IndexedReferences,a.diagnostics=void 0,this.buildState.delete(o);else if(typeof t.validation=="object"){const l=this.buildState.get(o),c=(i=l?.result)===null||i===void 0?void 0:i.validationChecks;if(c){const u=((s=t.validation.categories)!==null&&s!==void 0?s:Yn.all).filter(d=>!c.includes(d));u.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:Object.assign(Object.assign({},t.validation),{categories:u})},result:l.result}),a.state=U.IndexedReferences)}}}else this.buildState.delete(o)}this.currentState=U.Changed,await this.emitUpdate(e.map(a=>a.uri),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=K.CancellationToken.None){this.currentState=U.Changed;for(const a of t)this.langiumDocuments.deleteDocument(a),this.buildState.delete(a.toString()),this.indexManager.remove(a);for(const a of e){if(!this.langiumDocuments.invalidateDocument(a)){const o=this.langiumDocumentFactory.fromModel({$type:"INVALID"},a);o.state=U.Changed,this.langiumDocuments.addDocument(o)}this.buildState.delete(a.toString())}const i=ee(e).concat(t).map(a=>a.toString()).toSet();this.langiumDocuments.all.filter(a=>!i.has(a.uri.toString())&&this.shouldRelink(a,i)).forEach(a=>{this.serviceRegistry.getServices(a.uri).references.Linker.unlink(a),a.state=Math.min(a.state,U.ComputedScopes),a.diagnostics=void 0}),await this.emitUpdate(e,t),await $e(n);const s=this.sortDocuments(this.langiumDocuments.all.filter(a=>{var o;return a.state<U.Linked||!(!((o=this.buildState.get(a.uri.toString()))===null||o===void 0)&&o.completed)}).toArray());await this.buildDocuments(s,this.updateBuildOptions,n)}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(n=>n(e,t)))}sortDocuments(e){let t=0,n=e.length-1;for(;t<n;){for(;t<e.length&&this.hasTextDocument(e[t]);)t++;for(;n>=0&&!this.hasTextDocument(e[n]);)n--;t<n&&([e[t],e[n]]=[e[n],e[t]])}return e}hasTextDocument(e){var t;return!!(!((t=this.textDocuments)===null||t===void 0)&&t.get(e.uri))}shouldRelink(e,t){return e.references.some(n=>n.error!==void 0)?!0:this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),wr.create(()=>{const t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}async buildDocuments(e,t,n){this.prepareBuild(e,t),await this.runCancelable(e,U.Parsed,n,s=>this.langiumDocumentFactory.update(s,n)),await this.runCancelable(e,U.IndexedContent,n,s=>this.indexManager.updateContent(s,n)),await this.runCancelable(e,U.ComputedScopes,n,async s=>{const a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,n)}),await this.runCancelable(e,U.Linked,n,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,n)),await this.runCancelable(e,U.IndexedReferences,n,s=>this.indexManager.updateReferences(s,n));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,U.Validated,n,s=>this.validate(s,n));for(const s of e){const a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,t){for(const n of e){const i=n.uri.toString(),s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:t,result:s?.result})}}async runCancelable(e,t,n,i){const s=e.filter(o=>o.state<t);for(const o of s)await $e(n),await i(o),o.state=t,await this.notifyDocumentPhase(o,t,n);const a=e.filter(o=>o.state===t);await this.notifyBuildPhase(a,t,n),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),wr.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),wr.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,n){let i;if(t&&"path"in t?i=t:n=t,n??(n=K.CancellationToken.None),i){const s=this.langiumDocuments.getDocument(i);if(s&&s.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Wn):new Promise((s,a)=>{const o=this.onBuildPhase(e,()=>{if(o.dispose(),l.dispose(),i){const c=this.langiumDocuments.getDocument(i);s(c?.uri)}else s(void 0)}),l=n.onCancellationRequested(()=>{o.dispose(),l.dispose(),a(Wn)})})}async notifyDocumentPhase(e,t,n){const i=this.documentPhaseListeners.get(t).slice();for(const s of i)try{await s(e,n)}catch(a){if(!ci(a))throw a}}async notifyBuildPhase(e,t,n){if(e.length===0)return;const i=this.buildPhaseListeners.get(t).slice();for(const s of i)await $e(n),await s(e,n)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,t){var n,i;const s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,a=this.getBuildOptions(e).validation,o=typeof a=="object"?a:void 0,l=await s.validateDocument(e,o,t);e.diagnostics?e.diagnostics.push(...l):e.diagnostics=l;const c=this.buildState.get(e.uri.toString());if(c){(n=c.result)!==null&&n!==void 0||(c.result={});const u=(i=o?.categories)!==null&&i!==void 0?i:Yn.all;c.result.validationChecks?c.result.validationChecks.push(...u):c.result.validationChecks=[...u]}}getBuildOptions(e){var t,n;return(n=(t=this.buildState.get(e.uri.toString()))===null||t===void 0?void 0:t.options)!==null&&n!==void 0?n:{}}}class Um{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Am,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){const n=Je(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(a=>{nt.equals(a.targetUri,n)&&a.targetPath===t&&i.push(a)})}),ee(i)}allElements(e,t){let n=ee(this.symbolIndex.keys());return t&&(n=n.filter(i=>!t||t.has(i))),n.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,t){var n;return t?this.symbolByTypeIndex.get(e,t,()=>{var i;return((i=this.symbolIndex.get(e))!==null&&i!==void 0?i:[]).filter(s=>this.astReflection.isSubtype(s.type,t))}):(n=this.symbolIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){const t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t),this.referenceIndex.delete(t)}async updateContent(e,t=K.CancellationToken.None){const n=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,t),i=e.uri.toString();this.symbolIndex.set(i,n),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=K.CancellationToken.None){const n=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),n)}isAffected(e,t){const n=this.referenceIndex.get(e.uri.toString());return n?n.some(i=>!i.local&&t.has(i.targetUri.toString())):!1}}class Gm{constructor(e){this.initialBuildOptions={},this._ready=new qs,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){var t;this.folders=(t=e.workspaceFolders)!==null&&t!==void 0?t:void 0}initialized(e){return this.mutex.write(t=>{var n;return this.initializeWorkspace((n=this.folders)!==null&&n!==void 0?n:[],t)})}async initializeWorkspace(e,t=K.CancellationToken.None){const n=await this.performStartup(e);await $e(t),await this.documentBuilder.build(n,this.initialBuildOptions,t)}async performStartup(e){const t=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),n=[],i=s=>{n.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,t,i))),this._ready.resolve(),n}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return $t.parse(e.uri)}async traverseFolder(e,t,n,i){const s=await this.fileSystemProvider.readDirectory(t);await Promise.all(s.map(async a=>{if(this.includeEntry(e,a,n)){if(a.isDirectory)await this.traverseFolder(e,a.uri,n,i);else if(a.isFile){const o=await this.langiumDocuments.getOrCreateDocument(a.uri);i(o)}}}))}includeEntry(e,t,n){const i=nt.basename(t.uri);if(i.startsWith("."))return!1;if(t.isDirectory)return i!=="node_modules"&&i!=="out";if(t.isFile){const s=nt.extname(t.uri);return n.includes(s)}return!1}}class Bm{buildUnexpectedCharactersMessage(e,t,n,i,s){return Xi.buildUnexpectedCharactersMessage(e,t,n,i,s)}buildUnableToPopLexerModeMessage(e){return Xi.buildUnableToPopLexerModeMessage(e)}}const Km={mode:"full"};class Vm{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;const t=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t);const n=Yo(t)?Object.values(t):t,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new he(n,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Km){var n,i,s;const a=this.chevrotainLexer.tokenize(e);return{tokens:a.tokens,errors:a.errors,hidden:(n=a.groups.hidden)!==null&&n!==void 0?n:[],report:(s=(i=this.tokenBuilder).flushLexingReport)===null||s===void 0?void 0:s.call(i,e)}}toTokenTypeDictionary(e){if(Yo(e))return e;const t=jc(e)?Object.values(e.modes).flat():e,n={};return t.forEach(i=>n[i.name]=i),n}}function jm(r){return Array.isArray(r)&&(r.length===0||"name"in r[0])}function jc(r){return r&&"modes"in r&&"defaultMode"in r}function Yo(r){return!jm(r)&&!jc(r)}function Hm(r,e,t){let n,i;typeof r=="string"?(i=e,n=t):(i=r.range.start,n=e),i||(i=P.create(0,0));const s=Hc(r),a=Xs(n),o=Ym({lines:s,position:i,options:a});return Jm({index:0,tokens:o,position:i})}function Wm(r,e){const t=Xs(e),n=Hc(r);if(n.length===0)return!1;const i=n[0],s=n[n.length-1],a=t.start,o=t.end;return!!a?.exec(i)&&!!o?.exec(s)}function Hc(r){let e="";return typeof r=="string"?e=r:e=r.text,e.split(Nd)}const qo=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,zm=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Ym(r){var e,t,n;const i=[];let s=r.position.line,a=r.position.character;for(let o=0;o<r.lines.length;o++){const l=o===0,c=o===r.lines.length-1;let u=r.lines[o],d=0;if(l&&r.options.start){const h=(e=r.options.start)===null||e===void 0?void 0:e.exec(u);h&&(d=h.index+h[0].length)}else{const h=(t=r.options.line)===null||t===void 0?void 0:t.exec(u);h&&(d=h.index+h[0].length)}if(c){const h=(n=r.options.end)===null||n===void 0?void 0:n.exec(u);h&&(u=u.substring(0,h.index))}if(u=u.substring(0,Zm(u)),Es(u,d)>=u.length){if(i.length>0){const h=P.create(s,a);i.push({type:"break",content:"",range:O.create(h,h)})}}else{qo.lastIndex=d;const h=qo.exec(u);if(h){const f=h[0],m=h[1],g=P.create(s,a+d),k=P.create(s,a+d+f.length);i.push({type:"tag",content:m,range:O.create(g,k)}),d+=f.length,d=Es(u,d)}if(d<u.length){const f=u.substring(d),m=Array.from(f.matchAll(zm));i.push(...qm(m,f,s,a+d))}}s++,a=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function qm(r,e,t,n){const i=[];if(r.length===0){const s=P.create(t,n),a=P.create(t,n+e.length);i.push({type:"text",content:e,range:O.create(s,a)})}else{let s=0;for(const o of r){const l=o.index,c=e.substring(s,l);c.length>0&&i.push({type:"text",content:e.substring(s,l),range:O.create(P.create(t,s+n),P.create(t,l+n))});let u=c.length+1;const d=o[1];if(i.push({type:"inline-tag",content:d,range:O.create(P.create(t,s+u+n),P.create(t,s+u+d.length+n))}),u+=d.length,o.length===4){u+=o[2].length;const h=o[3];i.push({type:"text",content:h,range:O.create(P.create(t,s+u+n),P.create(t,s+u+h.length+n))})}else i.push({type:"text",content:"",range:O.create(P.create(t,s+u+n),P.create(t,s+u+n))});s=l+o[0].length}const a=e.substring(s);a.length>0&&i.push({type:"text",content:a,range:O.create(P.create(t,s+n),P.create(t,s+n+a.length))})}return i}const Xm=/\S/,Qm=/\s*$/;function Es(r,e){const t=r.substring(e).match(Xm);return t?e+t.index:r.length}function Zm(r){const e=r.match(Qm);if(e&&typeof e.index=="number")return e.index}function Jm(r){var e,t,n,i;const s=P.create(r.position.line,r.position.character);if(r.tokens.length===0)return new Xo([],O.create(s,s));const a=[];for(;r.index<r.tokens.length;){const c=eg(r,a[a.length-1]);c&&a.push(c)}const o=(t=(e=a[0])===null||e===void 0?void 0:e.range.start)!==null&&t!==void 0?t:s,l=(i=(n=a[a.length-1])===null||n===void 0?void 0:n.range.end)!==null&&i!==void 0?i:s;return new Xo(a,O.create(o,l))}function eg(r,e){const t=r.tokens[r.index];if(t.type==="tag")return zc(r,!1);if(t.type==="text"||t.type==="inline-tag")return Wc(r);tg(t,e),r.index++}function tg(r,e){if(e){const t=new qc("",r.range);"inlines"in e?e.inlines.push(t):e.content.inlines.push(t)}}function Wc(r){let e=r.tokens[r.index];const t=e;let n=e;const i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(rg(r)),n=e,e=r.tokens[r.index];return new As(i,O.create(t.range.start,n.range.end))}function rg(r){return r.tokens[r.index].type==="inline-tag"?zc(r,!0):Yc(r)}function zc(r,e){const t=r.tokens[r.index++],n=t.content.substring(1);if(r.tokens[r.index]?.type==="text")if(e){const s=Yc(r);return new Li(n,new As([s],s.range),e,O.create(t.range.start,s.range.end))}else{const s=Wc(r);return new Li(n,s,e,O.create(t.range.start,s.range.end))}else{const s=t.range;return new Li(n,new As([],s),e,s)}}function Yc(r){const e=r.tokens[r.index++];return new qc(e.content,e.range)}function Xs(r){if(!r)return Xs({start:"/**",end:"*/",line:"*"});const{start:e,end:t,line:n}=r;return{start:wi(e,!0),end:wi(t,!1),line:wi(n,!0)}}function wi(r,e){if(typeof r=="string"||typeof r=="object"){const t=typeof r=="string"?ti(r):r.source;return e?new RegExp(`^\\s*${t}`):new RegExp(`\\s*${t}\\s*$`)}else return r}class Xo{constructor(e,t){this.elements=e,this.range=t}getTag(e){return this.getAllTags().find(t=>t.name===e)}getTags(e){return this.getAllTags().filter(t=>t.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const t of this.elements)if(e.length===0)e=t.toString();else{const n=t.toString();e+=Qo(e)+n}return e.trim()}toMarkdown(e){let t="";for(const n of this.elements)if(t.length===0)t=n.toMarkdown(e);else{const i=n.toMarkdown(e);t+=Qo(t)+i}return t.trim()}}class Li{constructor(e,t,n,i){this.name=e,this.content=t,this.inline=n,this.range=i}toString(){let e=`@${this.name}`;const t=this.content.toString();return this.content.inlines.length===1?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e}
${t}`),this.inline?`{${e}}`:e}toMarkdown(e){var t,n;return(n=(t=e?.renderTag)===null||t===void 0?void 0:t.call(e,this))!==null&&n!==void 0?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){const t=this.content.toMarkdown(e);if(this.inline){const s=ng(this.name,t,e??{});if(typeof s=="string")return s}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i}${t}`:this.content.inlines.length>1&&(i=`${i}
${t}`),this.inline?`{${i}}`:i}}function ng(r,e,t){var n,i;if(r==="linkplain"||r==="linkcode"||r==="link"){const s=e.indexOf(" ");let a=e;if(s>0){const o=Es(e,s);a=e.substring(o),e=e.substring(0,s)}return(r==="linkcode"||r==="link"&&t.link==="code")&&(a=`\`${a}\``),(i=(n=t.renderLink)===null||n===void 0?void 0:n.call(t,e,a))!==null&&i!==void 0?i:ig(e,a)}}function ig(r,e){try{return $t.parse(r,!0),`[${e}](${r})`}catch{return r}}class As{constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;t<this.inlines.length;t++){const n=this.inlines[t],i=this.inlines[t+1];e+=n.toString(),i&&i.range.start.line>n.range.start.line&&(e+=`
`)}return e}toMarkdown(e){let t="";for(let n=0;n<this.inlines.length;n++){const i=this.inlines[n],s=this.inlines[n+1];t+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(t+=`
`)}return t}}class qc{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function Qo(r){return r.endsWith(`
`)?`
`:`
`}class sg{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const t=this.commentProvider.getComment(e);if(t&&Wm(t))return Hm(t).toMarkdown({renderLink:(n,i)=>this.documentationLinkRenderer(e,n,i),renderTag:n=>this.documentationTagRenderer(e,n)})}documentationLinkRenderer(e,t,n){var i;const s=(i=this.findNameInPrecomputedScopes(e,t))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,t);if(s&&s.nameSegment){const a=s.nameSegment.range.start.line+1,o=s.nameSegment.range.start.character+1,l=s.documentUri.with({fragment:`L${a},${o}`});return`[${n}](${l.toString()})`}else return}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){const n=Je(e).precomputedScopes;if(!n)return;let i=e;do{const s=n.get(i).find(a=>a.name===t);if(s)return s;i=i.$container}while(i)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(n=>n.name===t)}}class ag{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return Im(e)?e.$comment:(t=sd(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||t===void 0?void 0:t.text}}class og{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}}class lg{constructor(){this.previousTokenSource=new K.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=hm();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n=K.CancellationToken.None){const i=new qs,s={action:t,deferred:i,cancellationToken:n};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:t,deferred:n,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>t(i));n.resolve(s)}catch(s){ci(s)?n.resolve(void 0):n.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class cg{constructor(e){this.grammarElementIdMap=new Ho,this.tokenTypeIdMap=new Ho,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(t=>Object.assign(Object.assign({},t),{message:t.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const t=new Map,n=new Map;for(const i of Lt(e))t.set(i,{});if(e.$cstNode)for(const i of Vi(e.$cstNode))n.set(i,{});return{astNodes:t,cstNodes:n}}dehydrateAstNode(e,t){const n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];n[i]=a;for(const o of s)ae(o)?a.push(this.dehydrateAstNode(o,t)):Ge(o)?a.push(this.dehydrateReference(o,t)):a.push(o)}else ae(s)?n[i]=this.dehydrateAstNode(s,t):Ge(s)?n[i]=this.dehydrateReference(s,t):s!==void 0&&(n[i]=s);return n}dehydrateReference(e,t){const n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=t.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,t){const n=t.cstNodes.get(e);return vl(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),br(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,t)):Tl(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){const t=e.value,n=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,n),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,n)}}createHydrationContext(e){const t=new Map,n=new Map;for(const s of Lt(e))t.set(s,{});let i;if(e.$cstNode)for(const s of Vi(e.$cstNode)){let a;"fullText"in s?(a=new Cc(s.fullText),i=a):"content"in s?a=new zs:"tokenType"in s&&(a=this.hydrateCstLeafNode(s)),a&&(n.set(s,a),a.root=i)}return{astNodes:t,cstNodes:n}}hydrateAstNode(e,t){const n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=t.cstNodes.get(e.$cstNode));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];n[i]=a;for(const o of s)ae(o)?a.push(this.setParent(this.hydrateAstNode(o,t),n)):Ge(o)?a.push(this.hydrateReference(o,n,i,t)):a.push(o)}else ae(s)?n[i]=this.setParent(this.hydrateAstNode(s,t),n):Ge(s)?n[i]=this.hydrateReference(s,n,i,t):s!==void 0&&(n[i]=s);return n}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,n,i){return this.linker.buildReference(t,n,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,n=0){const i=t.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=t.astNodes.get(e.astNode),br(i))for(const s of e.content){const a=this.hydrateCstNode(s,t,n++);i.content.push(a)}return i}hydrateCstLeafNode(e){const t=this.getTokenType(e.tokenType),n=e.offset,i=e.length,s=e.startLine,a=e.startColumn,o=e.endLine,l=e.endColumn,c=e.hidden;return new ys(n,i,{start:{line:s,character:a},end:{line:o,character:l}},t,c)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(const t of Lt(this.grammar))od(t)&&this.grammarElementIdMap.set(t,e++)}}function at(r){return{documentation:{CommentProvider:e=>new ag(e),DocumentationProvider:e=>new sg(e)},parser:{AsyncParser:e=>new og(e),GrammarConfig:e=>Zd(e),LangiumParser:e=>am(e),CompletionParser:e=>sm(e),ValueConverter:()=>new Dc,TokenBuilder:()=>new Mc,Lexer:e=>new Vm(e),ParserErrorMessageProvider:()=>new Lc,LexerErrorMessageProvider:()=>new Bm},workspace:{AstNodeLocator:()=>new Pm,AstNodeDescriptionProvider:e=>new _m(e),ReferenceDescriptionProvider:e=>new Om(e)},references:{Linker:e=>new gm(e),NameProvider:()=>new Tm,ScopeProvider:e=>new xm(e),ScopeComputation:e=>new Rm(e),References:e=>new vm(e)},serializer:{Hydrator:e=>new cg(e),JsonSerializer:e=>new Sm(e)},validation:{DocumentValidator:e=>new wm(e),ValidationRegistry:e=>new Nm(e)},shared:()=>r.shared}}function ot(r){return{ServiceRegistry:e=>new Cm(e),workspace:{LangiumDocuments:e=>new mm(e),LangiumDocumentFactory:e=>new pm(e),DocumentBuilder:e=>new Fm(e),IndexManager:e=>new Um(e),WorkspaceManager:e=>new Gm(e),FileSystemProvider:e=>r.fileSystemProvider(e),WorkspaceLock:()=>new lg,ConfigurationProvider:e=>new Dm(e)}}}var Zo;(function(r){r.merge=(e,t)=>qn(qn({},e),t)})(Zo||(Zo={}));function oe(r,e,t,n,i,s,a,o,l){const c=[r,e,t,n,i,s,a,o,l].reduce(qn,{});return Xc(c)}const ug=Symbol("isProxy");function Xc(r,e){const t=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(n,i)=>i===ug?!0:el(n,i,r,e||t),getOwnPropertyDescriptor:(n,i)=>(el(n,i,r,e||t),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in r,ownKeys:()=>[...Object.getOwnPropertyNames(r)]});return t}const Jo=Symbol();function el(r,e,t,n){if(e in r){if(r[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:r[e]});if(r[e]===Jo)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return r[e]}else if(e in t){const i=t[e];r[e]=Jo;try{r[e]=typeof i=="function"?i(n):Xc(i,n)}catch(s){throw r[e]=s instanceof Error?s:void 0,s}return r[e]}else return}function qn(r,e){if(e){for(const[t,n]of Object.entries(e))if(n!==void 0){const i=r[t];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?r[t]=qn(i,n):r[t]=n}}return r}class dg{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const lt={fileSystemProvider:()=>new dg},hg={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},fg={AstReflection:()=>new Il};function pg(){const r=oe(ot(lt),fg),e=oe(at({shared:r}),hg);return r.ServiceRegistry.register(e),e}function xt(r){var e;const t=pg(),n=t.serializer.JsonSerializer.deserialize(r);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,$t.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}var mg=Object.defineProperty,v=(r,e)=>mg(r,"name",{value:e,configurable:!0}),tl="Statement",Rn="Architecture";function gg(r){return De.isInstance(r,Rn)}v(gg,"isArchitecture");var sn="Axis",Ir="Branch";function yg(r){return De.isInstance(r,Ir)}v(yg,"isBranch");var an="Checkout",on="CherryPicking",bi="ClassDefStatement",Sr="Commit";function Tg(r){return De.isInstance(r,Sr)}v(Tg,"isCommit");var _i="Curve",Oi="Edge",Pi="Entry",Cr="GitGraph";function vg(r){return De.isInstance(r,Cr)}v(vg,"isGitGraph");var Mi="Group",$n="Info";function Rg(r){return De.isInstance(r,$n)}v(Rg,"isInfo");var ln="Item",Di="Junction",Nr="Merge";function $g(r){return De.isInstance(r,Nr)}v($g,"isMerge");var Fi="Option",En="Packet";function Eg(r){return De.isInstance(r,En)}v(Eg,"isPacket");var An="PacketBlock";function Ag(r){return De.isInstance(r,An)}v(Ag,"isPacketBlock");var kn="Pie";function kg(r){return De.isInstance(r,kn)}v(kg,"isPie");var xn="PieSection";function xg(r){return De.isInstance(r,xn)}v(xg,"isPieSection");var Ui="Radar",Gi="Service",In="Treemap";function Ig(r){return De.isInstance(r,In)}v(Ig,"isTreemap");var Bi="TreemapRow",cn="Direction",un="Leaf",dn="Section",Qc=class extends yl{static{v(this,"MermaidAstReflection")}getAllTypes(){return[Rn,sn,Ir,an,on,bi,Sr,_i,cn,Oi,Pi,Cr,Mi,$n,ln,Di,un,Nr,Fi,En,An,kn,xn,Ui,dn,Gi,tl,In,Bi]}computeIsSubtype(r,e){switch(r){case Ir:case an:case on:case Sr:case Nr:return this.isSubtype(tl,e);case cn:return this.isSubtype(Cr,e);case un:case dn:return this.isSubtype(ln,e);default:return!1}}getReferenceType(r){const e=`${r.container.$type}:${r.property}`;if(e==="Entry:axis")return sn;throw new Error(`${e} is not a valid reference id.`)}getTypeMetaData(r){switch(r){case Rn:return{name:Rn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case sn:return{name:sn,properties:[{name:"label"},{name:"name"}]};case Ir:return{name:Ir,properties:[{name:"name"},{name:"order"}]};case an:return{name:an,properties:[{name:"branch"}]};case on:return{name:on,properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case bi:return{name:bi,properties:[{name:"className"},{name:"styleText"}]};case Sr:return{name:Sr,properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case _i:return{name:_i,properties:[{name:"entries",defaultValue:[]},{name:"label"},{name:"name"}]};case Oi:return{name:Oi,properties:[{name:"lhsDir"},{name:"lhsGroup",defaultValue:!1},{name:"lhsId"},{name:"lhsInto",defaultValue:!1},{name:"rhsDir"},{name:"rhsGroup",defaultValue:!1},{name:"rhsId"},{name:"rhsInto",defaultValue:!1},{name:"title"}]};case Pi:return{name:Pi,properties:[{name:"axis"},{name:"value"}]};case Cr:return{name:Cr,properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case Mi:return{name:Mi,properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case $n:return{name:$n,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case ln:return{name:ln,properties:[{name:"classSelector"},{name:"name"}]};case Di:return{name:Di,properties:[{name:"id"},{name:"in"}]};case Nr:return{name:Nr,properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case Fi:return{name:Fi,properties:[{name:"name"},{name:"value",defaultValue:!1}]};case En:return{name:En,properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case An:return{name:An,properties:[{name:"bits"},{name:"end"},{name:"label"},{name:"start"}]};case kn:return{name:kn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case xn:return{name:xn,properties:[{name:"label"},{name:"value"}]};case Ui:return{name:Ui,properties:[{name:"accDescr"},{name:"accTitle"},{name:"axes",defaultValue:[]},{name:"curves",defaultValue:[]},{name:"options",defaultValue:[]},{name:"title"}]};case Gi:return{name:Gi,properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case In:return{name:In,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"},{name:"TreemapRows",defaultValue:[]}]};case Bi:return{name:Bi,properties:[{name:"indent"},{name:"item"}]};case cn:return{name:cn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};case un:return{name:un,properties:[{name:"classSelector"},{name:"name"},{name:"value"}]};case dn:return{name:dn,properties:[{name:"classSelector"},{name:"name"}]};default:return{name:r,properties:[]}}}},De=new Qc,rl,Sg=v(()=>rl??(rl=xt(`{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"InfoGrammar"),nl,Cg=v(()=>nl??(nl=xt(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"PacketGrammar"),il,Ng=v(()=>il??(il=xt(`{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"}}]},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"PieGrammar"),sl,wg=v(()=>sl??(sl=xt(`{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"ArchitectureGrammar"),al,Lg=v(()=>al??(al=xt(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"GitGraphGrammar"),ol,bg=v(()=>ol??(ol=xt(`{"$type":"Grammar","isDeclared":true,"name":"Radar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"}}]},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}}}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"definesHiddenTokens":false,"hiddenTokens":[],"types":[],"usedGrammars":[]}`)),"RadarGrammar"),ll,_g=v(()=>ll??(ll=xt(`{"$type":"Grammar","isDeclared":true,"name":"Treemap","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","}},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@14"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)),"TreemapGrammar"),Og={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Pg={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Mg={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Dg={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Fg={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Ug={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Gg={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},It={AstReflection:v(()=>new Qc,"AstReflection")},Bg={Grammar:v(()=>Sg(),"Grammar"),LanguageMetaData:v(()=>Og,"LanguageMetaData"),parser:{}},Kg={Grammar:v(()=>Cg(),"Grammar"),LanguageMetaData:v(()=>Pg,"LanguageMetaData"),parser:{}},Vg={Grammar:v(()=>Ng(),"Grammar"),LanguageMetaData:v(()=>Mg,"LanguageMetaData"),parser:{}},jg={Grammar:v(()=>wg(),"Grammar"),LanguageMetaData:v(()=>Dg,"LanguageMetaData"),parser:{}},Hg={Grammar:v(()=>Lg(),"Grammar"),LanguageMetaData:v(()=>Fg,"LanguageMetaData"),parser:{}},Wg={Grammar:v(()=>bg(),"Grammar"),LanguageMetaData:v(()=>Ug,"LanguageMetaData"),parser:{}},zg={Grammar:v(()=>_g(),"Grammar"),LanguageMetaData:v(()=>Gg,"LanguageMetaData"),parser:{}},Yg=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,qg=/accTitle[\t ]*:([^\n\r]*)/,Xg=/title([\t ][^\n\r]*|)/,Qg={ACC_DESCR:Yg,ACC_TITLE:qg,TITLE:Xg},ui=class extends Dc{static{v(this,"AbstractMermaidValueConverter")}runConverter(r,e,t){let n=this.runCommonConverter(r,e,t);return n===void 0&&(n=this.runCustomConverter(r,e,t)),n===void 0?super.runConverter(r,e,t):n}runCommonConverter(r,e,t){const n=Qg[r.name];if(n===void 0)return;const i=n.exec(e);if(i!==null){if(i[1]!==void 0)return i[1].trim().replace(/[\t ]{2,}/gm," ");if(i[2]!==void 0)return i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,`
`)}}},di=class extends ui{static{v(this,"CommonValueConverter")}runCustomConverter(r,e,t){}},ct=class extends Mc{static{v(this,"AbstractMermaidTokenBuilder")}constructor(r){super(),this.keywords=new Set(r)}buildKeywordTokens(r,e,t){const n=super.buildKeywordTokens(r,e,t);return n.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}};(class extends ct{static{v(this,"CommonTokenBuilder")}});var Zg=class extends ct{static{v(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},Zc={parser:{TokenBuilder:v(()=>new Zg,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function Jc(r=lt){const e=oe(ot(r),It),t=oe(at({shared:e}),Hg,Zc);return e.ServiceRegistry.register(t),{shared:e,GitGraph:t}}v(Jc,"createGitGraphServices");var Jg=class extends ct{static{v(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},eu={parser:{TokenBuilder:v(()=>new Jg,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function tu(r=lt){const e=oe(ot(r),It),t=oe(at({shared:e}),Bg,eu);return e.ServiceRegistry.register(t),{shared:e,Info:t}}v(tu,"createInfoServices");var ey=class extends ct{static{v(this,"PacketTokenBuilder")}constructor(){super(["packet"])}},ru={parser:{TokenBuilder:v(()=>new ey,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function nu(r=lt){const e=oe(ot(r),It),t=oe(at({shared:e}),Kg,ru);return e.ServiceRegistry.register(t),{shared:e,Packet:t}}v(nu,"createPacketServices");var ty=class extends ct{static{v(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},ry=class extends ui{static{v(this,"PieValueConverter")}runCustomConverter(r,e,t){if(r.name==="PIE_SECTION_LABEL")return e.replace(/"/g,"").trim()}},iu={parser:{TokenBuilder:v(()=>new ty,"TokenBuilder"),ValueConverter:v(()=>new ry,"ValueConverter")}};function su(r=lt){const e=oe(ot(r),It),t=oe(at({shared:e}),Vg,iu);return e.ServiceRegistry.register(t),{shared:e,Pie:t}}v(su,"createPieServices");var ny=class extends ct{static{v(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},iy=class extends ui{static{v(this,"ArchitectureValueConverter")}runCustomConverter(r,e,t){if(r.name==="ARCH_ICON")return e.replace(/[()]/g,"").trim();if(r.name==="ARCH_TEXT_ICON")return e.replace(/["()]/g,"");if(r.name==="ARCH_TITLE")return e.replace(/[[\]]/g,"").trim()}},au={parser:{TokenBuilder:v(()=>new ny,"TokenBuilder"),ValueConverter:v(()=>new iy,"ValueConverter")}};function ou(r=lt){const e=oe(ot(r),It),t=oe(at({shared:e}),jg,au);return e.ServiceRegistry.register(t),{shared:e,Architecture:t}}v(ou,"createArchitectureServices");var sy=class extends ct{static{v(this,"RadarTokenBuilder")}constructor(){super(["radar-beta"])}},lu={parser:{TokenBuilder:v(()=>new sy,"TokenBuilder"),ValueConverter:v(()=>new di,"ValueConverter")}};function cu(r=lt){const e=oe(ot(r),It),t=oe(at({shared:e}),Wg,lu);return e.ServiceRegistry.register(t),{shared:e,Radar:t}}v(cu,"createRadarServices");var ay=class extends ct{static{v(this,"TreemapTokenBuilder")}constructor(){super(["treemap"])}},oy=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,ly=class extends ui{static{v(this,"TreemapValueConverter")}runCustomConverter(r,e,t){if(r.name==="NUMBER2")return parseFloat(e.replace(/,/g,""));if(r.name==="SEPARATOR"||r.name==="STRING2")return e.substring(1,e.length-1);if(r.name==="INDENTATION")return e.length;if(r.name==="ClassDef"){if(typeof e!="string")return e;const n=oy.exec(e);if(n)return{$type:"ClassDefStatement",className:n[1],styleText:n[2]||void 0}}}};function uu(r){const e=r.validation.TreemapValidator,t=r.validation.ValidationRegistry;if(t){const n={Treemap:e.checkSingleRoot.bind(e)};t.register(n,e)}}v(uu,"registerValidationChecks");var cy=class{static{v(this,"TreemapValidator")}checkSingleRoot(r,e){let t;for(const n of r.TreemapRows)n.item&&(t===void 0&&n.indent===void 0?t=0:n.indent===void 0?e("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}):t!==void 0&&t>=parseInt(n.indent,10)&&e("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}))}},du={parser:{TokenBuilder:v(()=>new ay,"TokenBuilder"),ValueConverter:v(()=>new ly,"ValueConverter")},validation:{TreemapValidator:v(()=>new cy,"TreemapValidator")}};function hu(r=lt){const e=oe(ot(r),It),t=oe(at({shared:e}),zg,du);return e.ServiceRegistry.register(t),uu(t),{shared:e,Treemap:t}}v(hu,"createTreemapServices");var He={},uy={info:v(async()=>{const{createInfoServices:r}=await ht(async()=>{const{createInfoServices:t}=await Promise.resolve().then(()=>fy);return{createInfoServices:t}},void 0,import.meta.url),e=r().Info.parser.LangiumParser;He.info=e},"info"),packet:v(async()=>{const{createPacketServices:r}=await ht(async()=>{const{createPacketServices:t}=await Promise.resolve().then(()=>py);return{createPacketServices:t}},void 0,import.meta.url),e=r().Packet.parser.LangiumParser;He.packet=e},"packet"),pie:v(async()=>{const{createPieServices:r}=await ht(async()=>{const{createPieServices:t}=await Promise.resolve().then(()=>my);return{createPieServices:t}},void 0,import.meta.url),e=r().Pie.parser.LangiumParser;He.pie=e},"pie"),architecture:v(async()=>{const{createArchitectureServices:r}=await ht(async()=>{const{createArchitectureServices:t}=await Promise.resolve().then(()=>gy);return{createArchitectureServices:t}},void 0,import.meta.url),e=r().Architecture.parser.LangiumParser;He.architecture=e},"architecture"),gitGraph:v(async()=>{const{createGitGraphServices:r}=await ht(async()=>{const{createGitGraphServices:t}=await Promise.resolve().then(()=>yy);return{createGitGraphServices:t}},void 0,import.meta.url),e=r().GitGraph.parser.LangiumParser;He.gitGraph=e},"gitGraph"),radar:v(async()=>{const{createRadarServices:r}=await ht(async()=>{const{createRadarServices:t}=await Promise.resolve().then(()=>Ty);return{createRadarServices:t}},void 0,import.meta.url),e=r().Radar.parser.LangiumParser;He.radar=e},"radar"),treemap:v(async()=>{const{createTreemapServices:r}=await ht(async()=>{const{createTreemapServices:t}=await Promise.resolve().then(()=>vy);return{createTreemapServices:t}},void 0,import.meta.url),e=r().Treemap.parser.LangiumParser;He.treemap=e},"treemap")};async function dy(r,e){const t=uy[r];if(!t)throw new Error(`Unknown diagram type: ${r}`);He[r]||await t();const n=He[r].parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new hy(n);return n.value}v(dy,"parse");var hy=class extends Error{constructor(r){const e=r.lexerErrors.map(n=>n.message).join(`
`),t=r.parserErrors.map(n=>n.message).join(`
`);super(`Parsing failed: ${e} ${t}`),this.result=r}static{v(this,"MermaidParseError")}};const fy=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:eu,createInfoServices:tu},Symbol.toStringTag,{value:"Module"})),py=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:ru,createPacketServices:nu},Symbol.toStringTag,{value:"Module"})),my=Object.freeze(Object.defineProperty({__proto__:null,PieModule:iu,createPieServices:su},Symbol.toStringTag,{value:"Module"})),gy=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:au,createArchitectureServices:ou},Symbol.toStringTag,{value:"Module"})),yy=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:Zc,createGitGraphServices:Jc},Symbol.toStringTag,{value:"Module"})),Ty=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:lu,createRadarServices:cu},Symbol.toStringTag,{value:"Module"})),vy=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:du,createTreemapServices:hu},Symbol.toStringTag,{value:"Module"}));export{dy as p};
//# sourceMappingURL=treemap-KMMF4GRG-DJhEU9NB.chunk.mjs.map