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

131 lines
323 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.

/*! third party licenses: js/vendor.LICENSE.txt */
var bu=Object.defineProperty;var _u=(r,e,t)=>e in r?bu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Je=(r,e,t)=>_u(r,typeof e!="symbol"?e+"":e,t);import{_ as ft}from"./whiteboard-main.mjs";import{aR as Ou,aS as Pu,I as Sl,aB as Mu,M as Du,J as te,u as Fu,v as Ta,am as Uu,av as Cl,aw as Nl,an as Gu,aG as va,o as At,q as D,K as Ra,E as Bu}from"./isEmpty-nTVdZyYD.chunk.mjs";import{k as Qt,l as Ks,g as ir,S as Ku,w as Vu,x as ju,d as wl,v as z,y as Ll,m as Hu,z as Wu,A as zu,B as Yu,C as qu,c as bl,a as C,i as qe,r as le,f as ke,D as q}from"./_baseUniq-CE6homwJ.chunk.mjs";import{i as Vs,m as k,d as Xu,f as Ne,h as Zt,e as js,l as Jt,g as Qu}from"./_basePickBy-0DU--7tw.chunk.mjs";import{h as N}from"./has-DJswI7NS.chunk.mjs";import{c as ne}from"./clone-Dt8ItUbV.chunk.mjs";import{p as Li}from"./index-Bn0s6V7w.chunk.mjs";var Zu=Object.prototype,Ju=Zu.hasOwnProperty,Ae=Ou(function(r,e){if(Pu(e)||Sl(e)){Mu(e,Qt(e),r);return}for(var t in e)Ju.call(e,t)&&Du(r,t,e[t])});function _l(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 en(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 ed(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 td(r,e,t,n){return Ks(r,function(i,s,a){e(n,i,t(i),a)}),n}function rd(r,e){return function(t,n){var i=te(t)?ed:td,s=e?e():{};return i(t,r,ir(n),s)}}var nd=200;function id(r,e,t,n){var i=-1,s=Vu,a=!0,o=r.length,l=[],c=e.length;if(!o)return l;e.length>=nd&&(s=ju,a=!1,e=new Ku(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 pi=Fu(function(r,e){return Ta(r)?id(r,wl(e,1,Ta,!0)):[]});function Z(r,e,t){var n=r==null?0:r.length;return n?(e=e===void 0?1:Vs(e),_l(r,e<0?0:e,n)):[]}function qr(r,e,t){var n=r==null?0:r.length;return n?(e=e===void 0?1:Vs(e),e=n-e,_l(r,0,e<0?0:e)):[]}function sd(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 ad(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)?sd:ad;return n(r,ir(e))}function Pe(r){return r&&r.length?r[0]:void 0}function Ee(r,e){return wl(k(r,e))}var od=Object.prototype,ld=od.hasOwnProperty,cd=rd(function(r,e,t){ld.call(r,t)?r[t].push(e):Uu(r,t,[e])}),ud="[object String]";function fe(r){return typeof r=="string"||!te(r)&&Cl(r)&&Nl(r)==ud}var dd=Math.max;function de(r,e,t,n){r=Sl(r)?r:z(r),t=t?Vs(t):0;var i=r.length;return t<0&&(t=dd(i+t,0)),fe(r)?t<=i&&r.indexOf(e,t)>-1:!!i&&Ll(r,e,t)>-1}function $a(r,e,t){var n=r==null?0:r.length;if(!n)return-1;var i=0;return Ll(r,e,i)}var hd="[object RegExp]";function fd(r){return Cl(r)&&Nl(r)==hd}var Ea=va&&va.isRegExp,Xe=Ea?Gu(Ea):fd,pd="Expected a function";function md(r){if(typeof r!="function")throw new TypeError(pd);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=Hu(Wu(r),function(n){return[n]});return e=ir(e),Xu(r,t,function(n,i){return e(n,i[0])})}function mi(r,e){var t=te(r)?zu:Yu;return t(r,md(ir(e)))}function gd(r,e){var t;return Ks(r,function(n,i,s){return t=e(n,i,s),!t}),!!t}function Ol(r,e,t){var n=te(r)?qu:gd;return n(r,ir(e))}function Hs(r){return r&&r.length?bl(r):[]}function yd(r,e){return r&&r.length?bl(r,ir(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 Td(r){return typeof r=="object"&&r!==null&&typeof r.name=="string"&&typeof r.type=="string"&&typeof r.path=="string"}function wn(r){return typeof r=="object"&&r!==null&&ae(r.container)&&Ge(r.reference)&&typeof r.message=="string"}class Pl{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 Xr(r){return typeof r=="object"&&r!==null&&Array.isArray(r.content)}function Ml(r){return typeof r=="object"&&r!==null&&typeof r.tokenType=="object"}function Dl(r){return Xr(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+=vd(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(Hn(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(Hn(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 vd(r){return typeof r=="string"?r:typeof r>"u"?"undefined":typeof r.toString=="function"?r.toString():Object.prototype.toString.call(r)}function Hn(r){return!!r&&typeof r[Symbol.iterator]=="function"}const Rd=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(Hn(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++];Hn(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}):Rd}class Ws 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 as;(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})(as||(as={}));function os(r){return new Ws(r,e=>Xr(e)?e.content:[],{includeRoot:!0})}function $d(r,e){for(;r.container;)if(r=r.container,r===e)return!0;return!1}function ls(r){return{start:{character:r.startColumn-1,line:r.startLine-1},end:{character:r.endColumn,line:r.endLine-1}}}function Wn(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 Ed(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 Ad(r,e){return Ed(r,e)>We.After}const kd=/^[\w\p{L}]$/u;function xd(r,e){if(r){const t=Id(r,!0);if(t&&Aa(t,e))return t;if(Dl(r)){const n=r.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){const s=r.content[i];if(Aa(s,e))return s}}}}function Aa(r,e){return Ml(r)&&e.includes(r.tokenType.name)}function Id(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 Fl extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function tn(r){throw new Error("Error! The input value was not handled.")}const ln="AbstractRule",cn="AbstractType",bi="Condition",ka="TypeDefinition",_i="ValueLiteral",hr="AbstractElement";function Sd(r){return M.isInstance(r,hr)}const un="ArrayLiteral",dn="ArrayType",fr="BooleanLiteral";function Cd(r){return M.isInstance(r,fr)}const pr="Conjunction";function Nd(r){return M.isInstance(r,pr)}const mr="Disjunction";function wd(r){return M.isInstance(r,mr)}const hn="Grammar",Oi="GrammarImport",gr="InferredType";function Ul(r){return M.isInstance(r,gr)}const yr="Interface";function Gl(r){return M.isInstance(r,yr)}const Pi="NamedArgument",Tr="Negation";function Ld(r){return M.isInstance(r,Tr)}const fn="NumberLiteral",pn="Parameter",vr="ParameterReference";function bd(r){return M.isInstance(r,vr)}const Rr="ParserRule";function we(r){return M.isInstance(r,Rr)}const mn="ReferenceType",Ln="ReturnType";function _d(r){return M.isInstance(r,Ln)}const $r="SimpleType";function Od(r){return M.isInstance(r,$r)}const gn="StringLiteral",wt="TerminalRule";function kt(r){return M.isInstance(r,wt)}const Er="Type";function Bl(r){return M.isInstance(r,Er)}const Mi="TypeAttribute",yn="UnionType",Ar="Action";function gi(r){return M.isInstance(r,Ar)}const kr="Alternatives";function Kl(r){return M.isInstance(r,kr)}const xr="Assignment";function yt(r){return M.isInstance(r,xr)}const Ir="CharacterRange";function Pd(r){return M.isInstance(r,Ir)}const Sr="CrossReference";function zs(r){return M.isInstance(r,Sr)}const Cr="EndOfFile";function Md(r){return M.isInstance(r,Cr)}const Nr="Group";function Ys(r){return M.isInstance(r,Nr)}const wr="Keyword";function Tt(r){return M.isInstance(r,wr)}const Lr="NegatedToken";function Dd(r){return M.isInstance(r,Lr)}const br="RegexToken";function Fd(r){return M.isInstance(r,br)}const _r="RuleCall";function vt(r){return M.isInstance(r,_r)}const Or="TerminalAlternatives";function Ud(r){return M.isInstance(r,Or)}const Pr="TerminalGroup";function Gd(r){return M.isInstance(r,Pr)}const Mr="TerminalRuleCall";function Bd(r){return M.isInstance(r,Mr)}const Dr="UnorderedGroup";function Vl(r){return M.isInstance(r,Dr)}const Fr="UntilToken";function Kd(r){return M.isInstance(r,Fr)}const Ur="Wildcard";function Vd(r){return M.isInstance(r,Ur)}class jl extends Pl{getAllTypes(){return[hr,ln,cn,Ar,kr,un,dn,xr,fr,Ir,bi,pr,Sr,mr,Cr,hn,Oi,Nr,gr,yr,wr,Pi,Lr,Tr,fn,pn,vr,Rr,mn,br,Ln,_r,$r,gn,Or,Pr,wt,Mr,Er,Mi,ka,yn,Dr,Fr,_i,Ur]}computeIsSubtype(e,t){switch(e){case Ar:case kr:case xr:case Ir:case Sr:case Cr:case Nr:case wr:case Lr:case br:case _r:case Or:case Pr:case Mr:case Dr:case Fr:case Ur:return this.isSubtype(hr,t);case un:case fn:case gn:return this.isSubtype(_i,t);case dn:case mn:case $r:case yn:return this.isSubtype(ka,t);case fr:return this.isSubtype(bi,t)||this.isSubtype(_i,t);case pr:case mr:case Tr:case vr:return this.isSubtype(bi,t);case gr:case yr:case Er:return this.isSubtype(cn,t);case Rr:return this.isSubtype(ln,t)||this.isSubtype(cn,t);case wt:return this.isSubtype(ln,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 cn;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return ln;case"Grammar:usedGrammars":return hn;case"NamedArgument:parameter":case"ParameterReference:parameter":return pn;case"TerminalRuleCall:rule":return wt;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case hr:return{name:hr,properties:[{name:"cardinality"},{name:"lookahead"}]};case un:return{name:un,properties:[{name:"elements",defaultValue:[]}]};case dn:return{name:dn,properties:[{name:"elementType"}]};case fr:return{name:fr,properties:[{name:"true",defaultValue:!1}]};case pr:return{name:pr,properties:[{name:"left"},{name:"right"}]};case mr:return{name:mr,properties:[{name:"left"},{name:"right"}]};case hn:return{name:hn,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 Oi:return{name:Oi,properties:[{name:"path"}]};case gr:return{name:gr,properties:[{name:"name"}]};case yr:return{name:yr,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Pi:return{name:Pi,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Tr:return{name:Tr,properties:[{name:"value"}]};case fn:return{name:fn,properties:[{name:"value"}]};case pn:return{name:pn,properties:[{name:"name"}]};case vr:return{name:vr,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 mn:return{name:mn,properties:[{name:"referenceType"}]};case Ln:return{name:Ln,properties:[{name:"name"}]};case $r:return{name:$r,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case gn:return{name:gn,properties:[{name:"value"}]};case wt:return{name:wt,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case Er:return{name:Er,properties:[{name:"name"},{name:"type"}]};case Mi:return{name:Mi,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case yn:return{name:yn,properties:[{name:"types",defaultValue:[]}]};case Ar:return{name:Ar,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case kr:return{name:kr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case xr:return{name:xr,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case Ir:return{name:Ir,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Sr:return{name:Sr,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case Cr:return{name:Cr,properties:[{name:"cardinality"},{name:"lookahead"}]};case Nr:return{name:Nr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case wr:return{name:wr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Lr:return{name:Lr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case br:return{name:br,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case _r:return{name:_r,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Or:return{name:Or,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Pr:return{name:Pr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Mr:return{name:Mr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Dr:return{name:Dr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Fr:return{name:Fr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Ur:return{name:Ur,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const M=new jl;function jd(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 yi(r,e){let t=r;for(;t;){if(e(t))return t;t=t.$container}}function et(r){const e=cs(r).$document;if(!e)throw new Error("AST node has no document.");return e}function cs(r){for(;r.$container;)r=r.$container;return r}function qs(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++,xa(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)&&xa(o,t))return{done:!1,value:o}}n.arrayIndex=0}}n.keyIndex++}return Re})}function rn(r,e){if(!r)throw new Error("Root node must be an AstNode.");return new Ws(r,t=>qs(t,e))}function bt(r,e){if(!r)throw new Error("Root node must be an AstNode.");return new Ws(r,t=>qs(t,e),{includeRoot:!0})}function xa(r,e){var t;if(!e)return!0;const n=(t=r.$cstNode)===null||t===void 0?void 0:t.range;return n?Ad(n,e):!1}function Hl(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 Hd(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]=Wl(i.defaultValue))}function Wl(r){return Array.isArray(r)?[...r.map(Wl)]:r}function w(r){return r.charCodeAt(0)}function Di(r,e){Array.isArray(r)?r.forEach(function(t){e.push(t)}):e.push(r)}function cr(r,e){if(r[e]===!0)throw"duplicate flag "+e;r[e],r[e]=!0}function Nt(r){if(r===void 0)throw Error("Internal Error - Should never get here!");return!0}function Wd(){throw Error("Internal Error - Should never get here!")}function Ia(r){return r.type==="Character"}const zn=[];for(let r=w("0");r<=w("9");r++)zn.push(r);const Yn=[w("_")].concat(zn);for(let r=w("a");r<=w("z");r++)Yn.push(r);for(let r=w("A");r<=w("Z");r++)Yn.push(r);const Sa=[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")],zd=/[0-9a-fA-F]/,Tn=/[0-9]/,Yd=/[1-9]/;class zl{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":cr(n,"global");break;case"i":cr(n,"ignoreCase");break;case"m":cr(n,"multiLine");break;case"u":cr(n,"unicode");break;case"y":cr(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}Nt(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return Wd()}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;Nt(t);break}if(!(e===!0&&t===void 0)&&Nt(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()),Nt(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=zn;break;case"D":e=zn,t=!0;break;case"s":e=Sa;break;case"S":e=Sa,t=!0;break;case"w":e=Yn;break;case"W":e=Yn,t=!0;break}if(Nt(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(Nt(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,Ia(n)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,Ia(i)){if(i.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:i.value})}else Di(n.value,e),e.push(w("-")),Di(i.value,e)}else Di(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;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}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(Yd.test(e)===!1)throw Error("Expecting a positive integer");for(;Tn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Tn.test(e)===!1)throw Error("Expecting an integer");for(;Tn.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 Tn.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(zd.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 Ti{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 qd=/\r?\n/gm,Xd=new zl;class Qd extends Ti{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=vi(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 Fi=new Qd;function Zd(r){try{return typeof r=="string"&&(r=new RegExp(r)),r=r.toString(),Fi.reset(r),Fi.visit(Xd.pattern(r)),Fi.multiline}catch{return!1}}const Jd=`\f
\r \v   \u2028\u2029 \uFEFF`.split("");function us(r){const e=typeof r=="string"?new RegExp(r):r;return Jd.some(t=>e.test(t))}function vi(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eh(r){return Array.prototype.map.call(r,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:vi(e)).join("")}function th(r,e){const t=rh(r),n=e.match(t);return!!n&&n[0].length>0}function rh(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 nh(r){return r.rules.find(e=>we(e)&&e.entry)}function ih(r){return r.rules.filter(e=>kt(e)&&e.hidden)}function Yl(r,e){const t=new Set,n=nh(r);if(!n)return new Set(r.rules);const i=[n].concat(ih(r));for(const a of i)ql(a,t,e);const s=new Set;for(const a of r.rules)(t.has(a.name)||kt(a)&&a.hidden)&&s.add(a);return s}function ql(r,e,t){e.add(r.name),rn(r).forEach(n=>{if(vt(n)||t){const i=n.rule.ref;i&&!e.has(i.name)&&ql(i,e,t)}})}function sh(r){if(r.terminal)return r.terminal;if(r.type.ref)return Ql(r.type.ref)?.terminal}function ah(r){return r.hidden&&!us(Js(r))}function oh(r,e){return!r||!e?[]:Xs(r,e,r.astNode,!0)}function Xl(r,e,t){if(!r||!e)return;const n=Xs(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 Xs(r,e,t,n){if(!n){const i=yi(r.grammarSource,yt);if(i&&i.feature===e)return[r]}return Xr(r)&&r.astNode===t?r.content.flatMap(i=>Xs(i,e,t,!1)):[]}function lh(r,e,t){if(!r)return;const n=ch(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 ch(r,e,t){if(r.astNode!==t)return[];if(Tt(r.grammarSource)&&r.grammarSource.value===e)return[r];const n=os(r).iterator();let i;const s=[];do if(i=n.next(),!i.done){const a=i.value;a.astNode===t?Tt(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):n.prune()}while(!i.done);return s}function uh(r){var e;const t=r.astNode;for(;t===((e=r.container)===null||e===void 0?void 0:e.astNode);){const n=yi(r.grammarSource,yt);if(n)return n;r=r.container}}function Ql(r){let e=r;return Ul(e)&&(gi(e.$container)?e=e.$container.$container:we(e.$container)?e=e.$container:tn(e.$container)),Zl(r,e,new Map)}function Zl(r,e,t){var n;function i(s,a){let o;return yi(s,yt)||(o=Zl(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 rn(e)){if(yt(s)&&s.feature.toLowerCase()==="name")return t.set(r,s),s;if(vt(s)&&we(s.rule.ref))return i(s,s.rule.ref);if(Od(s)&&!((n=s.typeRef)===null||n===void 0)&&n.ref)return i(s,s.typeRef.ref)}}function Jl(r){return ec(r,new Set)}function ec(r,e){if(e.has(r))return!0;e.add(r);for(const t of rn(r))if(vt(t)){if(!t.rule.ref||we(t.rule.ref)&&!ec(t.rule.ref,e))return!1}else if(yt(t)||gi(t))return!1;return!!r.definition}function Qs(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)||Gl(e)||Bl(e)))return e.name}}function Zs(r){var e;if(we(r))return Jl(r)?r.name:(e=Qs(r))!==null&&e!==void 0?e:r.name;if(Gl(r)||Bl(r)||_d(r))return r.name;if(gi(r)){const t=dh(r);if(t)return t}else if(Ul(r))return r.name;throw new Error("Cannot get name of Unknown Type")}function dh(r){var e;if(r.inferredType)return r.inferredType.name;if(!((e=r.type)===null||e===void 0)&&e.ref)return Zs(r.type.ref)}function hh(r){var e,t,n;return kt(r)?(t=(e=r.type)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"string":(n=Qs(r))!==null&&n!==void 0?n:r.name}function Js(r){const e={s:!1,i:!1,u:!1},t=sr(r.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(t,n)}const ea=/[\s\S]/.source;function sr(r,e){if(Ud(r))return fh(r);if(Gd(r))return ph(r);if(Pd(r))return yh(r);if(Bd(r)){const t=r.rule.ref;if(!t)throw new Error("Missing rule reference.");return Ye(sr(t.definition),{cardinality:r.cardinality,lookahead:r.lookahead})}else{if(Dd(r))return gh(r);if(Kd(r))return mh(r);if(Fd(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(Vd(r))return Ye(ea,{cardinality:r.cardinality,lookahead:r.lookahead});throw new Error(`Invalid terminal element: ${r?.$type}`)}}}function fh(r){return Ye(r.elements.map(e=>sr(e)).join("|"),{cardinality:r.cardinality,lookahead:r.lookahead})}function ph(r){return Ye(r.elements.map(e=>sr(e)).join(""),{cardinality:r.cardinality,lookahead:r.lookahead})}function mh(r){return Ye(`${ea}*?${sr(r.terminal)}`,{cardinality:r.cardinality,lookahead:r.lookahead})}function gh(r){return Ye(`(?!${sr(r.terminal)})${ea}*?`,{cardinality:r.cardinality,lookahead:r.lookahead})}function yh(r){return r.right?Ye(`[${Ui(r.left)}-${Ui(r.right)}]`,{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1}):Ye(Ui(r.left),{cardinality:r.cardinality,lookahead:r.lookahead,wrap:!1})}function Ui(r){return vi(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 Th(r){const e=[],t=r.Grammar;for(const n of t.rules)kt(n)&&ah(n)&&Zd(Js(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:kd}}function ds(r){console&&console.error&&console.error(`Error: ${r}`)}function tc(r){console&&console.warn&&console.warn(`Warning: ${r}`)}function rc(r){const e=new Date().getTime(),t=r();return{time:new Date().getTime()-e,value:t}}function nc(r){function e(){}e.prototype=r;const t=new e;function n(){return typeof t.bar}return n(),n(),r}function vh(r){return Rh(r)?r.LABEL:r.name}function Rh(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 ar 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 $h(r){return k(r,bn)}function bn(r){function e(t){return k(t,bn)}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:bn(new F({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof me)return{type:"RepetitionWithSeparator",idx:r.idx,separator:bn(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:vh(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 ar)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}class or{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 ar: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 Eh(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 ar}function qn(r,e=[]){return r instanceof re||r instanceof j||r instanceof me?!0:r instanceof ge?Ol(r.definition,t=>qn(t,e)):r instanceof ce&&de(e,r)?!1:r instanceof Be?(r instanceof ce&&e.push(r),Oe(r.definition,t=>qn(t,e))):!1}function Ah(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=Ca(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=Ca(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 Ca(r,e,t){return[new re({definition:[new F({terminalType:r.separator})].concat(r.definition)})].concat(e,t)}function nn(r){if(r instanceof ce)return nn(r.referencedRule);if(r instanceof F)return Ih(r);if(Eh(r))return kh(r);if(Ah(r))return xh(r);throw Error("non exhaustive match")}function kh(r){let e=[];const t=r.definition;let n=0,i=t.length>n,s,a=!0;for(;i&&a;)s=t[n],a=qn(s),e=e.concat(nn(s)),n=n+1,i=t.length>n;return Hs(e)}function xh(r){const e=k(r.definition,t=>nn(t));return Hs(Ne(e))}function Ih(r){return[r.terminalType]}const ic="_~IN~_";class Sh 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=Nh(e.referencedRule,e.idx)+this.topProd.name,s=t.concat(n),a=new pe({definition:s}),o=nn(a);this.follows[i]=o}}function Ch(r){const e={};return C(r,t=>{const n=new Sh(t).startWalking();Ae(e,n)}),e}function Nh(r,e){return r.name+e+ic}let _n={};const wh=new zl;function $i(r){const e=r.toString();if(_n.hasOwnProperty(e))return _n[e];{const t=wh.pattern(e);return _n[e]=t,t}}function Lh(){_n={}}const sc="Complement Sets are not supported for first char optimization",Xn=`Unable to use "first char" lexer optimizations:
`;function bh(r,e=!1){try{const t=$i(r);return hs(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===sc)e&&tc(`${Xn} 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.`),ds(`${Xn}
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 hs(r,e,t){switch(r.type){case"Disjunction":for(let i=0;i<r.value.length;i++)hs(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":vn(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(sc);C(a.value,l=>{if(typeof l=="number")vn(l,e,t);else{const c=l;if(t===!0)for(let u=c.from;u<=c.to;u++)vn(u,e,t);else{for(let u=c.from;u<=c.to&&u<Br;u++)vn(u,e,t);if(c.to>=Br){const u=c.from>=Br?c.from:Br,d=c.to,h=tt(u),f=tt(d);for(let m=h;m<=f;m++)e[m]=m}}}});break;case"Group":hs(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"&&fs(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return z(e)}function vn(r,e,t){const n=tt(r);e[n]=n,t===!0&&_h(r,e)}function _h(r,e){const t=String.fromCharCode(r),n=t.toUpperCase();if(n!==t){const i=tt(n.charCodeAt(0));e[i]=i}else{const i=t.toLowerCase();if(i!==t){const s=tt(i.charCodeAt(0));e[s]=s}}}function Na(r,e){return Zt(r.value,t=>{if(typeof t=="number")return de(e,t);{const n=t;return Zt(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function fs(r){const e=r.quantifier;return e&&e.atLeast===0?!0:r.value?te(r.value)?Oe(r.value,fs):fs(r.value):!1}class Oh extends Ti{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?Na(e,this.targetCharCodes)===void 0&&(this.found=!0):Na(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function ta(r,e){if(e instanceof RegExp){const t=$i(e),n=new Oh(r);return n.visit(t),n.found}else return Zt(e,t=>de(r,t.charCodeAt(0)))!==void 0}const Rt="PATTERN",Gr="defaultMode",Rn="modes";let ac=typeof new RegExp("(?:)").sticky=="boolean";function Ph(r,e){e=js(e,{useSticky:ac,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:(E,T)=>T()});const t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{sf()});let n;t("Reject Lexer.NA",()=>{n=mi(r,E=>E[Rt]===he.NA)});let i=!1,s;t("Transform Patterns",()=>{i=!1,s=k(n,E=>{const T=E[Rt];if(Xe(T)){const S=T.source;return S.length===1&&S!=="^"&&S!=="$"&&S!=="."&&!T.ignoreCase?S:S.length===2&&S[0]==="\\"&&!de(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],S[1])?S[1]:e.useSticky?La(T):wa(T)}else{if(At(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 S=T.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),G=new RegExp(S);return e.useSticky?La(G):wa(G)}}else throw Error("non exhaustive match")}})});let a,o,l,c,u;t("misc mapping",()=>{a=k(n,E=>E.tokenTypeIdx),o=k(n,E=>{const T=E.GROUP;if(T!==he.SKIPPED){if(fe(T))return T;if(qe(T))return!1;throw Error("non exhaustive match")}}),l=k(n,E=>{const T=E.LONGER_ALT;if(T)return te(T)?k(T,S=>$a(n,S)):[$a(n,T)]}),c=k(n,E=>E.PUSH_MODE),u=k(n,E=>N(E,"POP_MODE"))});let d;t("Line Terminator Handling",()=>{const E=cc(e.lineTerminatorCharacters);d=k(n,T=>!1),e.positionTracking!=="onlyOffset"&&(d=k(n,T=>N(T,"LINE_BREAKS")?!!T.LINE_BREAKS:lc(T,E)===!1&&ta(E,T.PATTERN)))});let h,f,m,g;t("Misc Mapping #2",()=>{h=k(n,oc),f=k(s,tf),m=le(n,(E,T)=>{const S=T.GROUP;return fe(S)&&S!==he.SKIPPED&&(E[S]=[]),E},{}),g=k(s,(E,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 x=!0,R=[];return e.safeMode||t("First Char Optimization",()=>{R=le(n,(E,T,S)=>{if(typeof T.PATTERN=="string"){const G=T.PATTERN.charCodeAt(0),ie=tt(G);Gi(E,ie,g[S])}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=tt(Le);G!==ye&&(G=ye,Gi(E,ye,g[S]))})}else if(Xe(T.PATTERN))if(T.PATTERN.unicode)x=!1,e.ensureOptimizations&&ds(`${Xn} 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=bh(T.PATTERN,e.ensureOptimizations);D(G)&&(x=!1),C(G,ie=>{Gi(E,ie,g[S])})}else e.ensureOptimizations&&ds(`${Xn} 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`),x=!1;return E},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:R,hasCustom:i,canBeOptimized:x}}function Mh(r,e){let t=[];const n=Fh(r);t=t.concat(n.errors);const i=Uh(n.valid),s=i.valid;return t=t.concat(i.errors),t=t.concat(Dh(s)),t=t.concat(zh(s)),t=t.concat(Yh(s,e)),t=t.concat(qh(s)),t}function Dh(r){let e=[];const t=ke(r,n=>Xe(n[Rt]));return e=e.concat(Bh(t)),e=e.concat(jh(t)),e=e.concat(Hh(t)),e=e.concat(Wh(t)),e=e.concat(Kh(t)),e}function Fh(r){const e=ke(r,i=>!N(i,Rt)),t=k(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:H.MISSING_PATTERN,tokenTypes:[i]})),n=pi(r,e);return{errors:t,valid:n}}function Uh(r){const e=ke(r,i=>{const s=i[Rt];return!Xe(s)&&!At(s)&&!N(s,"exec")&&!fe(s)}),t=k(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=pi(r,e);return{errors:t,valid:n}}const Gh=/[^\\][$]/;function Bh(r){class e extends Ti{constructor(){super(...arguments),this.found=!1}visitEndAnchor(i){this.found=!0}}const t=ke(r,n=>{const i=n.PATTERN;try{const s=$i(i),a=new e;return a.visit(s),a.found}catch{return Gh.test(i.source)}});return k(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 Kh(r){const e=ke(r,t=>t.PATTERN.test(""));return k(e,t=>({message:"Token Type: ->"+t.name+"<- static 'PATTERN' must not match an empty string",type:H.EMPTY_MATCH_PATTERN,tokenTypes:[t]}))}const Vh=/[^\\[][\^]|^\^/;function jh(r){class e extends Ti{constructor(){super(...arguments),this.found=!1}visitStartAnchor(i){this.found=!0}}const t=ke(r,n=>{const i=n.PATTERN;try{const s=$i(i),a=new e;return a.visit(s),a.found}catch{return Vh.test(i.source)}});return k(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 Hh(r){const e=ke(r,t=>{const n=t[Rt];return n instanceof RegExp&&(n.multiline||n.global)});return k(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 Wh(r){const e=[];let t=k(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=en(t);const n=ke(t,i=>i.length>1);return k(n,i=>{const s=k(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 zh(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 k(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 Yh(r,e){const t=ke(r,n=>n.PUSH_MODE!==void 0&&!de(e,n.PUSH_MODE));return k(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 qh(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)&&Qh(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&&Xh(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 Xh(r,e){if(Xe(e)){const t=e.exec(r);return t!==null&&t.index===0}else{if(At(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 Qh(r){return Zt([".","\\","[","]","|","^","$","(",")","?","*","+","{"],e=>r.source.indexOf(e)!==-1)===void 0}function wa(r){const e=r.ignoreCase?"i":"";return new RegExp(`^(?:${r.source})`,e)}function La(r){const e=r.ignoreCase?"iy":"y";return new RegExp(`${r.source}`,e)}function Zh(r,e,t){const n=[];return N(r,Gr)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Gr+`> property in its definition
`,type:H.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),N(r,Rn)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Rn+`> property in its definition
`,type:H.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),N(r,Rn)&&N(r,Gr)&&!N(r.modes,r.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Gr}: <${r.defaultMode}>which does not exist
`,type:H.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),N(r,Rn)&&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 Jh(r,e,t){const n=[];let i=!1;const s=en(Ne(z(r.modes))),a=mi(s,l=>l[Rt]===he.NA),o=cc(t);return e&&C(a,l=>{const c=lc(l,o);if(c!==!1){const u={message:nf(l,c),type:c.issue,tokenType:l};n.push(u)}else N(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):ta(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 ef(r){const e={},t=Qt(r);return C(t,n=>{const i=r[n];if(te(i))e[n]=[];else throw Error("non exhaustive match")}),e}function oc(r){const e=r.PATTERN;if(Xe(e))return!1;if(At(e)||N(e,"exec"))return!0;if(fe(e))return!1;throw Error("non exhaustive match")}function tf(r){return fe(r)&&r.length===1?r.charCodeAt(0):!1}const rf={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 lc(r,e){if(N(r,"LINE_BREAKS"))return!1;if(Xe(r.PATTERN)){try{ta(e,r.PATTERN)}catch(t){return{issue:H.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if(fe(r.PATTERN))return!1;if(oc(r))return{issue:H.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function nf(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 cc(r){return k(r,e=>fe(e)?e.charCodeAt(0):e)}function Gi(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}const Br=256;let On=[];function tt(r){return r<Br?r:On[r]}function sf(){if(D(On)){On=new Array(65536);for(let r=0;r<65536;r++)On[r]=r>255?255+~~(r/255):r}}function sn(r,e){const t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function Qn(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}let ba=1;const uc={};function an(r){const e=af(r);of(e),cf(e),lf(e),C(e,t=>{t.isParent=t.categoryMatches.length>0})}function af(r){let e=ne(r),t=r,n=!0;for(;n;){t=en(Ne(k(t,s=>s.CATEGORIES)));const i=pi(t,e);e=e.concat(i),D(i)?n=!1:t=i}return e}function of(r){C(r,e=>{hc(e)||(uc[ba]=e,e.tokenTypeIdx=ba++),_a(e)&&!te(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),_a(e)||(e.CATEGORIES=[]),uf(e)||(e.categoryMatches=[]),df(e)||(e.categoryMatchesMap={})})}function lf(r){C(r,e=>{e.categoryMatches=[],C(e.categoryMatchesMap,(t,n)=>{e.categoryMatches.push(uc[n].tokenTypeIdx)})})}function cf(r){C(r,e=>{dc([],e)})}function dc(r,e){C(r,t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),C(e.CATEGORIES,t=>{const n=r.concat(e);de(n,t)||dc(n,t)})}function hc(r){return N(r,"tokenTypeIdx")}function _a(r){return N(r,"CATEGORIES")}function uf(r){return N(r,"categoryMatches")}function df(r){return N(r,"categoryMatchesMap")}function hf(r){return N(r,"tokenTypeIdx")}const ps={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:ps,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}=rc(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=rf;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:Gr}:(s=!1,i=ne(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Zh(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Jh(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},C(i.modes,(o,l)=>{i.modes[l]=mi(o,c=>qe(c))});const a=Qt(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(Mh(o,a))}),D(this.lexerDefinitionErrors)){an(o);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=Ph(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=k(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+o)}C(this.lexerDefinitionWarning,o=>{tc(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(ac?(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",()=>{Lh()}),this.TRACE_INIT("toFastProperties",()=>{nc(this)})})}tokenize(e,t=this.defaultMode){if(!D(this.lexerDefinitionErrors)){const n=k(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,x,R;const E=e,T=E.length;let S=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 A=ef(this.emptyGroups),y=this.trackStartLines,$=this.config.lineTerminatorsPattern;let I=0,_=[],b=[];const L=[],Te=[];Object.freeze(Te);let Y;function V(){return _}function dt(se){const Ce=tt(se),Ct=b[Ce];return Ct===void 0?Te:Ct}const Lu=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=Jt(L);_=this.patternIdxToConfig[Ce],b=this.charCodeToPatternIdxToConfig[Ce],I=_.length;const Ct=this.canModeBeOptimized[Ce]&&this.config.safeMode===!1;b&&Ct?Y=dt:Y=V}};function ma(se){L.push(se),b=this.charCodeToPatternIdxToConfig[se],_=this.patternIdxToConfig[se],I=_.length,I=_.length;const Ce=this.canModeBeOptimized[se]&&this.config.safeMode===!1;b&&Ce?Y=dt:Y=V}ma.call(this,t);let be;const ga=this.config.recoveryEnabled;for(;S<T;){l=null;const se=E.charCodeAt(S),Ce=Y(se),Ct=Ce.length;for(n=0;n<Ct;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(E,S,Le,A),R!==null?(l=R[0],R.payload!==void 0&&(c=R.payload)):l=null):(this.updateLastIndex(ve,S),l=this.match(ve,e,S)),l!==null){if(o=be.longerAlt,o!==void 0){const Ze=o.length;for(s=0;s<Ze;s++){const Ve=_[o[s]],ht=Ve.pattern;if(u=null,Ve.isCustom===!0?(R=ht.exec(E,S,Le,A),R!==null?(a=R[0],R.payload!==void 0&&(u=R.payload)):a=null):(this.updateLastIndex(ht,S),a=this.match(ht,e,S)),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,S,f,be.tokenType,Fe,Se,d),this.handlePayload(m,c),h===!1?G=this.addToken(Le,G,m):A[h].push(m)),e=this.chopInput(e,d),S=S+d,Se=this.computeNewColumn(Se,d),y===!0&&be.canLineTerminator===!0){let ve=0,Ke,Ze;$.lastIndex=0;do Ke=$.test(l),Ke===!0&&(Ze=$.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,Lu,ma,m)}else{const ve=S,Ke=Fe,Ze=Se;let Ve=ga===!1;for(;Ve===!1&&S<T;)for(e=this.chopInput(e,1),S++,i=0;i<I;i++){const ht=_[i],wi=ht.pattern,ya=ht.short;if(ya!==!1?E.charCodeAt(S)===ya&&(Ve=!0):ht.isCustom===!0?Ve=wi.exec(E,S,Le,A)!==null:(this.updateLastIndex(wi,S),Ve=wi.exec(e)!==null),Ve===!0)break}if(g=S-ve,Se=this.computeNewColumn(Se,g),x=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(E,ve,g,Ke,Ze),ye.push({offset:ve,line:Ke,column:Ze,length:g,message:x}),ga===!1)break}}return this.hasCustom||(Le.length=G),{tokens:Le,groups:A,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 _t(r){return fc(r)?r.LABEL:r.name}function fc(r){return fe(r.LABEL)&&r.LABEL!==""}const ff="parent",Oa="categories",Pa="label",Ma="group",Da="push_mode",Fa="pop_mode",Ua="longer_alt",Ga="line_breaks",Ba="start_chars_hint";function pc(r){return pf(r)}function pf(r){const e=r.pattern,t={};if(t.name=r.name,qe(e)||(t.PATTERN=e),N(r,ff))throw`The parent property is no longer supported.
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return N(r,Oa)&&(t.CATEGORIES=r[Oa]),an([t]),N(r,Pa)&&(t.LABEL=r[Pa]),N(r,Ma)&&(t.GROUP=r[Ma]),N(r,Fa)&&(t.POP_MODE=r[Fa]),N(r,Da)&&(t.PUSH_MODE=r[Da]),N(r,Ua)&&(t.LONGER_ALT=r[Ua]),N(r,Ga)&&(t.LINE_BREAKS=r[Ga]),N(r,Ba)&&(t.START_CHARS_HINT=r[Ba]),t}const rt=pc({name:"EOF",pattern:he.NA});an([rt]);function ra(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 mc(r,e){return sn(r,e)}const Lt={buildMismatchTokenMessage({expected:r,actual:e,previous:t,ruleName:n}){return`Expecting ${fc(r)?`--> ${_t(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=k(o,u=>`[${k(u,d=>_t(d)).join(", ")}]`),c=`one of these possible Token sequences:
${k(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::
<${k(r,o=>`[${k(o,l=>_t(l)).join(",")}]`).join(" ,")}>`;return i+a+s}}};Object.freeze(Lt);const mf={buildRuleNotFoundError(r,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+r.name+"<-"}},gt={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=k(r.prefixPath,n=>_t(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=k(r.prefixPath,i=>_t(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=k(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 ar?e=r.topLevelRule.name:e=r.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${r.grammarName}<-`}};function gf(r,e){const t=new yf(r,e);return t.resolveRefs(),t.errors}class yf extends or{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 Tf 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 vf extends Tf{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=nn(s),this.found=!0}}}class Ei 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 Rf extends Ei{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 Ei{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 $f extends Ei{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 Va extends Ei{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 ms(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=ms(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 gc(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&&Jt(d).idx<=c&&d.pop();continue}const f=h.def,m=h.idx,g=h.ruleStack,x=h.occurrenceStack;if(D(f))continue;const R=f[0];if(R===i){const E={idx:m,def:Z(f),ruleStack:qr(g),occurrenceStack:qr(x)};d.push(E)}else if(R instanceof F)if(m<l-1){const E=m+1,T=e[E];if(t(T,R.terminalType)){const S={idx:E,def:Z(f),ruleStack:g,occurrenceStack:x};d.push(S)}}else if(m===l-1)u.push({nextTokenType:R.terminalType,nextTokenOccurrence:R.idx,ruleStack:g,occurrenceStack:x}),o=!0;else throw Error("non exhaustive match");else if(R instanceof ce){const E=ne(g);E.push(R.nonTerminalName);const T=ne(x);T.push(R.idx);const S={idx:m,def:R.definition.concat(s,Z(f)),ruleStack:E,occurrenceStack:T};d.push(S)}else if(R instanceof re){const E={idx:m,def:Z(f),ruleStack:g,occurrenceStack:x};d.push(E),d.push(a);const T={idx:m,def:R.definition.concat(Z(f)),ruleStack:g,occurrenceStack:x};d.push(T)}else if(R instanceof xe){const E=new j({definition:R.definition,idx:R.idx}),T=R.definition.concat([E],Z(f)),S={idx:m,def:T,ruleStack:g,occurrenceStack:x};d.push(S)}else if(R instanceof Ie){const E=new F({terminalType:R.separator}),T=new j({definition:[E].concat(R.definition),idx:R.idx}),S=R.definition.concat([T],Z(f)),G={idx:m,def:S,ruleStack:g,occurrenceStack:x};d.push(G)}else if(R instanceof me){const E={idx:m,def:Z(f),ruleStack:g,occurrenceStack:x};d.push(E),d.push(a);const T=new F({terminalType:R.separator}),S=new j({definition:[T].concat(R.definition),idx:R.idx}),G=R.definition.concat([S],Z(f)),ie={idx:m,def:G,ruleStack:g,occurrenceStack:x};d.push(ie)}else if(R instanceof j){const E={idx:m,def:Z(f),ruleStack:g,occurrenceStack:x};d.push(E),d.push(a);const T=new j({definition:R.definition,idx:R.idx}),S=R.definition.concat([T],Z(f)),G={idx:m,def:S,ruleStack:g,occurrenceStack:x};d.push(G)}else if(R instanceof ge)for(let E=R.definition.length-1;E>=0;E--){const T=R.definition[E],S={idx:m,def:T.definition.concat(Z(f)),ruleStack:g,occurrenceStack:x};d.push(S),d.push(a)}else if(R instanceof pe)d.push({idx:m,def:R.definition.concat(Z(f)),ruleStack:g,occurrenceStack:x});else if(R instanceof ar)d.push(Ef(R,m,g,x));else throw Error("non exhaustive match")}return u}function Ef(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 na(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 ja(r){const{occurrence:e,rule:t,prodType:n,maxLookahead:i}=r,s=na(n);return s===B.ALTERNATION?Ai(e,t,i):ki(e,t,s,i)}function Af(r,e,t,n,i,s){const a=Ai(r,e,t),o=vc(a)?Qn:sn;return s(a,n,o,i)}function kf(r,e,t,n,i,s){const a=ki(r,e,i,t),o=vc(a)?Qn:sn;return s(a[0],o,n)}function xf(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=k(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 x=this.LA(g+1);if(t(x,f[g])===!1)continue e}return l}}};if(s&&!n){const a=k(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 If(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 Sf 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 yc extends or{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 Ha(r){const e=new Array(r);for(let t=0;t<r;t++)e[t]=[];return e}function Bi(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 Cf(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 Tc(r,e){const t=k(r,a=>ms([a],1)),n=Ha(t.length),i=k(t,a=>{const o={};return C(a,l=>{const c=Bi(l.partialPath);C(c,u=>{o[u]=!0})}),o});let s=t;for(let a=1;a<=e;a++){const o=s;s=Ha(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=Bi(d);if(Cf(i,f,l)||D(h)||d.length===e){const m=n[l];if(gs(m,d)===!1){m.push(d);for(let g=0;g<f.length;g++){const x=f[g];i[l][x]=!0}}}else{const m=ms(h,a+1,d);s[l]=s[l].concat(m),C(m,g=>{const x=Bi(g.partialPath);C(x,R=>{i[l][R]=!0})})}}}}return n}function Ai(r,e,t,n){const i=new yc(r,B.ALTERNATION,n);return e.accept(i),Tc(i.result,t)}function ki(r,e,t,n){const i=new yc(r,t);e.accept(i);const s=i.result,a=new Sf(e,r,t).startWalking(),o=new pe({definition:s}),l=new pe({definition:a});return Tc([o,l],n)}function gs(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 Nf(r,e){return r.length<e.length&&Oe(r,(t,n)=>{const i=e[n];return t===i||i.categoryMatchesMap[t.tokenTypeIdx]})}function vc(r){return Oe(r,e=>Oe(e,t=>Oe(t,n=>D(n.categoryMatches))))}function wf(r){const e=r.lookaheadStrategy.validate({rules:r.rules,tokenTypes:r.tokenTypes,grammarName:r.grammarName});return k(e,t=>Object.assign({type:ue.CUSTOM_LOOKAHEAD_VALIDATION},t))}function Lf(r,e,t,n){const i=Ee(r,l=>bf(l,t)),s=jf(r,e,t),a=Ee(r,l=>Gf(l,t)),o=Ee(r,l=>Pf(l,r,n,t));return i.concat(s,a,o)}function bf(r,e){const t=new Of;r.accept(t);const n=t.allProductions,i=cd(n,_f),s=Me(i,a=>a.length>1);return k(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 _f(r){return`${Ue(r)}_#_${r.idx}_#_${Rc(r)}`}function Rc(r){return r instanceof F?r.terminalType.name:r instanceof ce?r.nonTerminalName:""}class Of extends or{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 Pf(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 Mf(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 $c(r,e,t,n=[]){const i=[],s=Pn(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=pi(s,n.concat([r])),l=Ee(o,c=>{const u=ne(n);return u.push(c),$c(r,c,t,u)});return i.concat(l)}}function Pn(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(Pn(t.definition));else if(t instanceof ge)e=Ne(k(t.definition,s=>Pn(s.definition)));else if(!(t instanceof F))throw Error("non exhaustive match");const n=qn(t),i=r.length>1;if(n&&i){const s=Z(r);return e.concat(Pn(s))}else return e}class ia extends or{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Df(r,e){const t=new ia;r.accept(t);const n=t.alternations;return Ee(n,i=>{const s=qr(i.definition);return Ee(s,(a,o)=>{const l=gc([a],[],sn,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 Ff(r,e,t){const n=new ia;r.accept(n);let i=n.alternations;return i=mi(i,s=>s.ignoreAmbiguities===!0),Ee(i,s=>{const a=s.idx,o=s.maxLookahead||e,l=Ai(a,r,o,s),c=Kf(l,s,r,t),u=Vf(l,s,r,t);return c.concat(u)})}class Uf extends or{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 Gf(r,e){const t=new ia;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 Bf(r,e,t){const n=[];return C(r,i=>{const s=new Uf;i.accept(s);const a=s.allProductions;C(a,o=>{const l=na(o),c=o.maxLookahead||e,u=o.idx,d=ki(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 Kf(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&&gs(d,c)&&e.definition[h].ignoreAmbiguities!==!0&&u.push(h)}),u.length>1&&!gs(i,c)&&(i.push(c),a.push({alts:u,path:c}))}),a),[]);return k(s,a=>{const o=k(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 Vf(r,e,t,n){const i=le(r,(s,a,o)=>{const l=k(a,c=>({idx:o,path:c}));return s.concat(l)},[]);return en(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&&Nf(c.path,o));return k(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 jf(r,e,t){const n=[],i=k(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 Hf(r){const e=js(r,{errMsgProvider:mf}),t={};return C(r.rules,n=>{t[n.name]=n}),gf(t,e.errMsgProvider)}function Wf(r){return r=js(r,{errMsgProvider:gt}),Lf(r.rules,r.tokenTypes,r.errMsgProvider,r.grammarName)}const Ec="MismatchedTokenException",Ac="NoViableAltException",kc="EarlyExitException",xc="NotAllInputParsedException",Ic=[Ec,Ac,kc,xc];Object.freeze(Ic);function Zn(r){return de(Ic,r.name)}class xi 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 Sc extends xi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Ec}}class zf extends xi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Ac}}class Yf extends xi{constructor(e,t){super(e,t),this.name=xc}}class qf extends xi{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=kc}}const Ki={},Cc="InRuleRecoveryException";class Xf extends Error{constructor(e){super(e),this.name=Cc}}class Qf{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=N(e,"recoveryEnabled")?e.recoveryEnabled:Qe.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Zf)}getTokenToInsert(e){const t=ra(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 Sc(f,c,this.LA(0));m.resyncedTokens=qr(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 Xf("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 Zt(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=Zt(e,s=>mc(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 k(e,(n,i)=>i===0?Ki:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=k(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return Ne(e)}getFollowSetFromFollowKey(e){if(e===Ki)return[rt];const t=e.ruleName+e.idxInCallingRule+ic+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,rt)||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 qr(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 k(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function Zf(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=rt,u=1),!(c===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,u,a)&&this.tryInRepetitionRecovery(r,e,t,c)}const Jf=4,st=8,Nc=1<<st,wc=2<<st,ys=3<<st,Ts=4<<st,vs=5<<st,Mn=6<<st;function Vi(r,e,t){return t|e|r}class sa{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=>$c(t,t,gt))}validateEmptyOrAlternatives(e){return Ee(e,t=>Df(t,gt))}validateAmbiguousAlternationAlternatives(e,t){return Ee(e,n=>Ff(n,t,gt))}validateSomeNonEmptyLookaheadPath(e,t){return Bf(e,t,gt)}buildLookaheadForAlternation(e){return Af(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,xf)}buildLookaheadForOptional(e){return kf(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,na(e.prodType),If)}}class ep{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 sa({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}=rp(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=Vi(this.fullRuleNameToShort[t.name],Nc,c.idx);this.setLaFuncCache(h,d)})}),C(i,c=>{this.computeLookaheadFunc(t,c.idx,ys,"Repetition",c.maxLookahead,Ue(c))}),C(s,c=>{this.computeLookaheadFunc(t,c.idx,wc,"Option",c.maxLookahead,Ue(c))}),C(a,c=>{this.computeLookaheadFunc(t,c.idx,Ts,"RepetitionMandatory",c.maxLookahead,Ue(c))}),C(o,c=>{this.computeLookaheadFunc(t,c.idx,Mn,"RepetitionMandatoryWithSeparator",c.maxLookahead,Ue(c))}),C(l,c=>{this.computeLookaheadFunc(t,c.idx,vs,"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=Vi(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(l,o)})}getKeyForAutomaticLookahead(e,t){const n=this.getLastExplicitRuleShortName();return Vi(n,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}}class tp extends or{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 $n=new tp;function rp(r){$n.reset(),r.accept($n);const e=$n.dslMethods;return $n.reset(),e}function Wa(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset)}function za(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 np(r,e,t){r.children[t]===void 0?r.children[t]=[e]:r.children[t].push(e)}function ip(r,e,t){r.children[e]===void 0?r.children[e]=[t]:r.children[e].push(t)}const sp="name";function Lc(r,e){Object.defineProperty(r,sp,{enumerable:!1,configurable:!0,writable:!1,value:e})}function ap(r,e){const t=Qt(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 op(r,e){const t=function(){};Lc(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=cp(this,e);if(!D(i)){const s=k(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 lp(r,e,t){const n=function(){};Lc(n,r+"BaseSemanticsWithDefaults");const i=Object.create(t.prototype);return C(e,s=>{i[s]=ap}),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 cp(r,e){return up(r,e)}function up(r,e){const t=ke(e,i=>At(r[i])===!1),n=k(t,i=>({msg:`Missing visitor method: <${i}> on ${r.constructor.name} CST Visitor.`,type:Rs.MISSING_METHOD,methodName:i}));return en(n)}class dp{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=za,this.setNodeLocationFromNode=za,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=Wa,this.setNodeLocationFromNode=Wa,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];np(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];ip(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(qe(this.baseCstVisitorConstructor)){const e=op(this.className,Qt(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(qe(this.baseCstVisitorWithDefaultsConstructor)){const e=lp(this.className,Qt(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 hp{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)):ei}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?ei: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 fp{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=ti){if(de(this.definedRulesNames,e)){const s={message:gt.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=ti){const i=Mf(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(Zn(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return $h(z(this.gastProductionsCache))}}class pp{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Qn,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)),hf)){const s=Ne(z(e.modes)),a=Hs(s);this.tokensMap=le(a,(o,l)=>(o[l.name]=l,o),{})}else if(Bu(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=rt;const n=N(e,"modes")?Ne(z(e.modes)):z(e),i=Oe(n,s=>D(s.categoryMatches));this.tokenMatcher=i?Qn:sn,an(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:ti.resyncEnabled,s=N(n,"recoveryValueFunc")?n.recoveryValueFunc:ti.recoveryValueFunc,a=this.ruleShortNameIdx<<Jf+st;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(Zn(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(wc,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(Ts,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,Ts,e,$f)}atLeastOneSepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(Mn,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,Va],a,Mn,e,Va)}else throw this.raiseEarlyExitException(e,B.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){const n=this.getKeyForAutomaticLookahead(ys,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,ys,e,Rf,a)}manySepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(vs,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,vs,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,Mn,e,s)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const n=this.getKeyForAutomaticLookahead(Nc,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 Yf(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 Zn(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 Sc(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===Cc?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),rt)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class mp{initErrorHandler(e){this._errors=[],this.errorMessageProvider=N(e,"errorMessageProvider")?e.errorMessageProvider:Qe.errorMessageProvider}SAVE_ERROR(e){if(Zn(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=ki(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 qf(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],s=Ai(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 zf(l,this.LA(1),o))}}class gp{initContentAssist(){}computeContentAssist(e,t){const n=this.gastProductionsCache[e];if(qe(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return gc([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=Pe(e.ruleStack),n=this.getGAstProductions()[t];return new vf(n,e).startWalking()}}const Ii={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Ii);const Ya=!0,qa=Math.pow(2,st)-1,bc=pc({name:"RECORDING_PHASE_TOKEN",pattern:he.NA});an([bc]);const _c=ra(bc,`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(_c);const yp={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Tp{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 ei}topLevelRuleRecord(e,t){try{const n=new ar({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 ur.call(this,re,e,t)}atLeastOneInternalRecord(e,t){ur.call(this,xe,t,e)}atLeastOneSepFirstInternalRecord(e,t){ur.call(this,Ie,t,e,Ya)}manyInternalRecord(e,t){ur.call(this,j,t,e)}manySepFirstInternalRecord(e,t){ur.call(this,me,t,e,Ya)}orInternalRecord(e,t){return vp.call(this,e,t)}subruleInternalRecord(e,t,n){if(Jn(t),!e||N(e,"ruleName")===!1){const o=new Error(`<SUBRULE${Xa(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=Jt(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?yp:Ii}consumeInternalRecord(e,t,n){if(Jn(t),!hc(e)){const a=new Error(`<CONSUME${Xa(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=Jt(this.recordingProdStack),s=new F({idx:t,terminalType:e,label:n?.LABEL});return i.definition.push(s),_c}}function ur(r,e,t,n=!1){Jn(t);const i=Jt(this.recordingProdStack),s=At(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(),Ii}function vp(r,e){Jn(e);const t=Jt(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=Ol(i,o=>At(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()}),Ii}function Xa(r){return r===0?"":`${r}`}function Jn(r){if(r<0||r>qa){const e=new Error(`Invalid DSL Method idx value: <${r}>
Idx value must be a none negative value smaller than ${qa+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Rp{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}=rc(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 $p(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 ei=ra(rt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ei);const Qe=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Lt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ti=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 Qa(r=void 0){return function(){return r}}class Qr{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",()=>{nc(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=Hf({rules:z(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(D(n)&&this.skipValidations===!1){const i=Wf({rules:z(this.gastProductionsCache),tokenTypes:z(this.tokensMap),errMsgProvider:gt,grammarName:t}),s=wf({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=Ch(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))})),!Qr.DEFER_DEFINITION_ERRORS_HANDLING&&!D(this.definitionErrors))throw e=k(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}}Qr.DEFER_DEFINITION_ERRORS_HANDLING=!1,$p(Qr,[Qf,ep,dp,hp,pp,fp,mp,gp,Tp,Rp]);class Ep extends Qr{constructor(e,t=Qe){const n=ne(t);n.outputCst=!1,super(e,n)}}function er(r,e,t){return`${r.name}_${e}_${t}`}const nt=1,Ap=2,Oc=4,Pc=5,on=7,kp=8,xp=9,Ip=10,Sp=11,Mc=12;class aa{constructor(e){this.target=e}isEpsilon(){return!1}}class oa extends aa{constructor(e,t){super(e),this.tokenType=t}}class Dc extends aa{constructor(e){super(e)}isEpsilon(){return!0}}class la extends aa{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}}function Cp(r){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};Np(e,r);const t=r.length;for(let n=0;n<t;n++){const i=r[n],s=xt(e,i,i);s!==void 0&&Gp(e,i,s)}return e}function Np(r,e){const t=e.length;for(let n=0;n<t;n++){const i=e[n],s=X(r,i,void 0,{type:Ap}),a=X(r,i,void 0,{type:on});s.stop=a,r.ruleToStartState.set(i,s),r.ruleToStopState.set(i,a)}}function Fc(r,e,t){return t instanceof F?ca(r,e,t.terminalType,t):t instanceof ce?Up(r,e,t):t instanceof ge?Op(r,e,t):t instanceof re?Pp(r,e,t):t instanceof j?wp(r,e,t):t instanceof me?Lp(r,e,t):t instanceof xe?bp(r,e,t):t instanceof Ie?_p(r,e,t):xt(r,e,t)}function wp(r,e,t){const n=X(r,e,t,{type:Pc});at(r,n);const i=lr(r,e,n,t,xt(r,e,t));return Gc(r,e,t,i)}function Lp(r,e,t){const n=X(r,e,t,{type:Pc});at(r,n);const i=lr(r,e,n,t,xt(r,e,t)),s=ca(r,e,t.separator,t);return Gc(r,e,t,i,s)}function bp(r,e,t){const n=X(r,e,t,{type:Oc});at(r,n);const i=lr(r,e,n,t,xt(r,e,t));return Uc(r,e,t,i)}function _p(r,e,t){const n=X(r,e,t,{type:Oc});at(r,n);const i=lr(r,e,n,t,xt(r,e,t)),s=ca(r,e,t.separator,t);return Uc(r,e,t,i,s)}function Op(r,e,t){const n=X(r,e,t,{type:nt});at(r,n);const i=k(t.definition,s=>Fc(r,e,s));return lr(r,e,n,t,...i)}function Pp(r,e,t){const n=X(r,e,t,{type:nt});at(r,n);const i=lr(r,e,n,t,xt(r,e,t));return Mp(r,e,t,i)}function xt(r,e,t){const n=ke(k(t.definition,i=>Fc(r,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:Fp(r,n)}function Uc(r,e,t,n,i){const s=n.left,a=n.right,o=X(r,e,t,{type:Sp});at(r,o);const l=X(r,e,t,{type:Mc});return s.loopback=o,l.loopback=o,r.decisionMap[er(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 Gc(r,e,t,n,i){const s=n.left,a=n.right,o=X(r,e,t,{type:Ip});at(r,o);const l=X(r,e,t,{type:Mc}),c=X(r,e,t,{type:xp});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[er(e,i?"RepetitionWithSeparator":"Repetition",t.idx)]=o,{left:o,right:l}}function Mp(r,e,t,n){const i=n.left,s=n.right;return W(i,s),r.decisionMap[er(e,"Option",t.idx)]=i,n}function at(r,e){return r.decisionStates.push(e),e.decision=r.decisionStates.length-1,e.decision}function lr(r,e,t,n,...i){const s=X(r,e,n,{type:kp,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[er(e,Dp(n),n.idx)]=t,a}function Dp(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 Fp(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 la,c=o,u=e[s+1].left;a.left.type===nt&&a.right.type===nt&&o!==void 0&&(l&&c.followState===a.right||o.target===a.right)?(l?c.followState=u:o.target=u,Bp(r,a.right)):W(a.right,u)}const n=e[0],i=e[t-1];return{left:n.left,right:i.right}}function ca(r,e,t,n){const i=X(r,e,n,{type:nt}),s=X(r,e,n,{type:nt});return ua(i,new oa(s,t)),{left:i,right:s}}function Up(r,e,t){const n=t.referencedRule,i=r.ruleToStartState.get(n),s=X(r,e,t,{type:nt}),a=X(r,e,t,{type:nt}),o=new la(i,n,a);return ua(s,o),{left:s,right:a}}function Gp(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 Dc(e);ua(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 ua(r,e){r.transitions.length===0&&(r.epsilonOnlyTransitions=e.isEpsilon()),r.transitions.push(e)}function Bp(r,e){r.states.splice(r.states.indexOf(e),1)}const ri={};class $s{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Bc(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return k(this.configs,e=>e.alt)}get key(){let e="";for(const t in this.map)e+=t+":";return e}}function Bc(r,e=!0){return`${e?`a${r.alt}`:""}s${r.state.stateNumber}:${r.stack.map(t=>t.stateNumber.toString()).join("_")}`}function Kp(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 Za=new Kc;class Vp extends sa{constructor(e){var t;super(),this.logging=(t=e?.logging)!==null&&t!==void 0?t:n=>console.log(n)}initialize(e){this.atn=Cp(e.rules),this.dfas=jp(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=er(n,"Alternation",t),c=this.atn.decisionMap[l].decision,u=k(ja({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:n}),d=>k(d,h=>h[0]));if(Ja(u,!1)&&!s){const d=le(u,(h,f,m)=>(C(f,g=>{g&&(h[g.tokenTypeIdx]=m,C(g.categoryMatches,x=>{h[x]=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 x=(f=h[g])===null||f===void 0?void 0:f.GATE;if(x!==void 0&&x.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 x=d?.[g].GATE;h.set(g,x===void 0||x.call(this))}const m=ji.call(this,a,c,h,o);return typeof m=="number"?m:void 0}:function(){const d=ji.call(this,a,c,Za,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=er(n,i,t),c=this.atn.decisionMap[l].decision,u=k(ja({maxLookahead:1,occurrence:t,prodType:i,rule:n}),d=>k(d,h=>h[0]));if(Ja(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,x=>{m[x]=!0})),m),{});return function(){const m=this.LA(1);return f[m.tokenTypeIdx]===!0}}}return function(){const d=ji.call(this,a,c,Za,o);return typeof d=="object"?!1:d===0}}}function Ja(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 jp(r){const e=r.decisionStates.length,t=Array(e);for(let n=0;n<e;n++)t[n]=Kp(r.decisionStates[n],n);return t}function ji(r,e,t,n){const i=r[e](t);let s=i.start;if(s===void 0){const a=tm(i.atnStartState);s=jc(i,Vc(a)),i.start=s}return Hp.apply(this,[i,s,t,n])}function Hp(r,e,t,n){let i=e,s=1;const a=[];let o=this.LA(s++);for(;;){let l=Qp(i,o);if(l===void 0&&(l=Wp.apply(this,[r,i,o,s,t,n])),l===ri)return Xp(a,i,o);if(l.isAcceptState===!0)return l.prediction;i=l,a.push(o),o=this.LA(s++)}}function Wp(r,e,t,n,i,s){const a=Zp(e.configs,t,i);if(a.size===0)return eo(r,e,t,ri),ri;let o=Vc(a);const l=em(a,i);if(l!==void 0)o.isAcceptState=!0,o.prediction=l,o.configs.uniqueAlt=l;else if(sm(a)){const c=Qu(a.alts);o.isAcceptState=!0,o.prediction=c,o.configs.uniqueAlt=c,zp.apply(this,[r,n,a.alts,s])}return o=eo(r,e,t,o),o}function zp(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=Yp({topLevelRule:a,ambiguityIndices:t,production:o,prefixPath:i});n(l)}function Yp(r){const e=k(r.prefixPath,i=>_t(i)).join(", "),t=r.production.idx===0?"":r.production.idx;let n=`Ambiguous Alternatives Detected: <${r.ambiguityIndices.join(", ")}> in <${qp(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 qp(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 Xp(r,e,t){const n=Ee(e.configs.elements,s=>s.state.transitions),i=yd(n.filter(s=>s instanceof oa).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:t,possibleTokenTypes:i,tokenPath:r}}function Qp(r,e){return r.edges[e.tokenTypeIdx]}function Zp(r,e,t){const n=new $s,i=[];for(const a of r.elements){if(t.is(a.alt)===!1)continue;if(a.state.type===on){i.push(a);continue}const o=a.state.transitions.length;for(let l=0;l<o;l++){const c=a.state.transitions[l],u=Jp(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 $s;for(const a of n.elements)ni(a,s)}if(i.length>0&&!nm(s))for(const a of i)s.add(a);return s}function Jp(r,e){if(r instanceof oa&&mc(e,r.tokenType))return r.target}function em(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 Vc(r){return{configs:r,edges:{},isAcceptState:!1,prediction:-1}}function eo(r,e,t,n){return n=jc(r,n),e.edges[t.tokenTypeIdx]=n,n}function jc(r,e){if(e===ri)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 tm(r){const e=new $s,t=r.transitions.length;for(let n=0;n<t;n++){const i={state:r.transitions[n].target,alt:n,stack:[]};ni(i,e)}return e}function ni(r,e){const t=r.state;if(t.type===on){if(r.stack.length>0){const i=[...r.stack],s={state:i.pop(),alt:r.alt,stack:i};ni(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=rm(r,s);a!==void 0&&ni(a,e)}}function rm(r,e){if(e instanceof Dc)return{state:e.target,alt:r.alt,stack:r.stack};if(e instanceof la){const t=[...r.stack,e.followState];return{state:e.target,alt:r.alt,stack:t}}}function nm(r){for(const e of r.elements)if(e.state.type===on)return!0;return!1}function im(r){for(const e of r.elements)if(e.state.type!==on)return!1;return!0}function sm(r){if(im(r))return!0;const e=am(r.elements);return om(e)&&!lm(e)}function am(r){const e=new Map;for(const t of r){const n=Bc(t,!1);let i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[t.alt]=!0}return e}function om(r){for(const e of Array.from(r.values()))if(Object.keys(e).length>1)return!0;return!1}function lm(r){for(const e of Array.from(r.values()))if(Object.keys(e).length===1)return!0;return!1}var to;(function(r){function e(t){return typeof t=="string"}r.is=e})(to||(to={}));var Es;(function(r){function e(t){return typeof t=="string"}r.is=e})(Es||(Es={}));var ro;(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})(ro||(ro={}));var ii;(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})(ii||(ii={}));var P;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=ii.MAX_VALUE),i===Number.MAX_VALUE&&(i=ii.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 si;(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})(si||(si={}));var no;(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})(no||(no={}));var As;(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})(As||(As={}));var io;(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)&&As.is(i.color)}r.is=t})(io||(io={}));var so;(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)||rr.is(i))&&(p.undefined(i.additionalTextEdits)||p.typedArray(i.additionalTextEdits,rr.is))}r.is=t})(so||(so={}));var ao;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(ao||(ao={}));var oo;(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})(oo||(oo={}));var ks;(function(r){function e(n,i){return{location:n,message:i}}r.create=e;function t(n){let i=n;return p.defined(i)&&si.is(i.location)&&p.string(i.message)}r.is=t})(ks||(ks={}));var lo;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(lo||(lo={}));var co;(function(r){r.Unnecessary=1,r.Deprecated=2})(co||(co={}));var uo;(function(r){function e(t){const n=t;return p.objectLiteral(n)&&p.string(n.href)}r.is=e})(uo||(uo={}));var ai;(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,ks.is))}r.is=t})(ai||(ai={}));var tr;(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})(tr||(tr={}));var rr;(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})(rr||(rr={}));var xs;(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})(xs||(xs={}));var nr;(function(r){function e(t){const n=t;return p.string(n)}r.is=e})(nr||(nr={}));var ho;(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 rr.is(a)&&(xs.is(a.annotationId)||nr.is(a.annotationId))}r.is=i})(ho||(ho={}));var Is;(function(r){function e(n,i){return{textDocument:n,edits:i}}r.create=e;function t(n){let i=n;return p.defined(i)&&Ls.is(i.textDocument)&&Array.isArray(i.edits)}r.is=t})(Is||(Is={}));var Ss;(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||nr.is(i.annotationId))}r.is=t})(Ss||(Ss={}));var Cs;(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||nr.is(i.annotationId))}r.is=t})(Cs||(Cs={}));var Ns;(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||nr.is(i.annotationId))}r.is=t})(Ns||(Ns={}));var ws;(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)?Ss.is(i)||Cs.is(i)||Ns.is(i):Is.is(i)))}r.is=e})(ws||(ws={}));var fo;(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})(fo||(fo={}));var po;(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})(po||(po={}));var Ls;(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})(Ls||(Ls={}));var mo;(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})(mo||(mo={}));var bs;(function(r){r.PlainText="plaintext",r.Markdown="markdown";function e(t){const n=t;return n===r.PlainText||n===r.Markdown}r.is=e})(bs||(bs={}));var Zr;(function(r){function e(t){const n=t;return p.objectLiteral(t)&&bs.is(n.kind)&&p.string(n.value)}r.is=e})(Zr||(Zr={}));var go;(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})(go||(go={}));var yo;(function(r){r.PlainText=1,r.Snippet=2})(yo||(yo={}));var To;(function(r){r.Deprecated=1})(To||(To={}));var vo;(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})(vo||(vo={}));var Ro;(function(r){r.asIs=1,r.adjustIndentation=2})(Ro||(Ro={}));var $o;(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})($o||($o={}));var Eo;(function(r){function e(t){return{label:t}}r.create=e})(Eo||(Eo={}));var Ao;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}r.create=e})(Ao||(Ao={}));var oi;(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})(oi||(oi={}));var ko;(function(r){function e(t){let n=t;return!!n&&p.objectLiteral(n)&&(Zr.is(n.contents)||oi.is(n.contents)||p.typedArray(n.contents,oi.is))&&(t.range===void 0||O.is(t.range))}r.is=e})(ko||(ko={}));var xo;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}r.create=e})(xo||(xo={}));var Io;(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})(Io||(Io={}));var So;(function(r){r.Text=1,r.Read=2,r.Write=3})(So||(So={}));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 No;(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})(No||(No={}));var wo;(function(r){r.Deprecated=1})(wo||(wo={}));var Lo;(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})(Lo||(Lo={}));var bo;(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})(bo||(bo={}));var _o;(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})(_o||(_o={}));var Oo;(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"})(Oo||(Oo={}));var li;(function(r){r.Invoked=1,r.Automatic=2})(li||(li={}));var Po;(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,ai.is)&&(i.only===void 0||p.typedArray(i.only,p.string))&&(i.triggerKind===void 0||i.triggerKind===li.Invoked||i.triggerKind===li.Automatic)}r.is=t})(Po||(Po={}));var Mo;(function(r){function e(n,i,s){let a={title:n},o=!0;return typeof i=="string"?(o=!1,a.kind=i):tr.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,ai.is))&&(i.kind===void 0||p.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||tr.is(i.command))&&(i.isPreferred===void 0||p.boolean(i.isPreferred))&&(i.edit===void 0||ws.is(i.edit))}r.is=t})(Mo||(Mo={}));var Do;(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)||tr.is(i.command))}r.is=t})(Do||(Do={}));var Fo;(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})(Fo||(Fo={}));var Uo;(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})(Uo||(Uo={}));var Go;(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})(Go||(Go={}));var Bo;(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"})(Bo||(Bo={}));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 Vo;(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})(Vo||(Vo={}));var jo;(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})(jo||(jo={}));var Ho;(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})(Ho||(Ho={}));var Wo;(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})(Wo||(Wo={}));var zo;(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})(zo||(zo={}));var _s;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}r.is=e})(_s||(_s={}));var Os;(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)||Zr.is(i.tooltip))&&(i.location===void 0||si.is(i.location))&&(i.command===void 0||tr.is(i.command))}r.is=t})(Os||(Os={}));var Yo;(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,Os.is))&&(i.kind===void 0||_s.is(i.kind))&&i.textEdits===void 0||p.typedArray(i.textEdits,rr.is)&&(i.tooltip===void 0||p.string(i.tooltip)||Zr.is(i.tooltip))&&(i.paddingLeft===void 0||p.boolean(i.paddingLeft))&&(i.paddingRight===void 0||p.boolean(i.paddingRight))}r.is=t})(Yo||(Yo={}));var qo;(function(r){function e(t){return{kind:"snippet",value:t}}r.createSnippet=e})(qo||(qo={}));var Xo;(function(r){function e(t,n,i,s){return{insertText:t,filterText:n,range:i,command:s}}r.create=e})(Xo||(Xo={}));var Qo;(function(r){function e(t){return{items:t}}r.create=e})(Qo||(Qo={}));var Zo;(function(r){r.Invoked=0,r.Automatic=1})(Zo||(Zo={}));var Jo;(function(r){function e(t,n){return{range:t,text:n}}r.create=e})(Jo||(Jo={}));var el;(function(r){function e(t,n){return{triggerKind:t,selectedCompletionInfo:n}}r.create=e})(el||(el={}));var tl;(function(r){function e(t){const n=t;return p.objectLiteral(n)&&Es.is(n.uri)&&p.string(n.name)}r.is=e})(tl||(tl={}));var rl;(function(r){function e(s,a,o,l){return new cm(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}})(rl||(rl={}));let cm=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 um{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 Wc(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new da;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const n=new Ps(e.startOffset,e.image.length,ls(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 Ps(s.startOffset,s.image.length,ls(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 Hc{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 Ps extends Hc{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 da extends Hc{constructor(){super(...arguments),this.content=new ha(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 ha extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,ha.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 Wc extends da{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const Ms=Symbol("Datatype");function Hi(r){return r.$type===Ms}const nl="",zc=r=>r.endsWith(nl)?r:r+nl;class Yc{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 mm(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 dm extends Yc{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new um,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(zc(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 Jl(e)?Ms:Qs(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===Ms&&(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=Tt(n)?i.image:this.converter.convert(i.image,a);this.assign(o.operator,o.feature,u,a,l)}else if(Hi(c)){let u=i.image;Tt(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(Hi(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 jd(e),this.nodeBuilder.construct(e),this.stack.pop(),Hi(e)?this.converter.convert(e.value,e.$cstNode):(Hd(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const t=yi(e,yt);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?zs(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 hm{buildMismatchTokenMessage(e){return Lt.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Lt.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Lt.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Lt.buildEarlyExitMessage(e)}}class qc extends hm{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 fm extends Yc{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(zc(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 pm={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new qc};class mm extends Ep{constructor(e,t){const n=t&&"maxLookahead"in t;super(e,Object.assign(Object.assign(Object.assign({},pm),{lookaheadStrategy:n?new sa({maxLookahead:t.maxLookahead}):new Vp({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 Xc(r,e,t){return gm({parser:e,tokens:t,ruleNames:new Map},r),e}function gm(r,e){const t=Yl(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,$t(s,i.definition))}}function $t(r,e,t=!1){let n;if(Tt(e))n=Am(r,e);else if(gi(e))n=ym(r,e);else if(yt(e))n=$t(r,e.terminal);else if(zs(e))n=Qc(r,e);else if(vt(e))n=Tm(r,e);else if(Kl(e))n=Rm(r,e);else if(Vl(e))n=$m(r,e);else if(Ys(e))n=Em(r,e);else if(Md(e)){const i=r.consume++;n=()=>r.parser.consume(i,rt,e)}else throw new Fl(e.$cstNode,`Unexpected element type: ${e.$type}`);return Zc(r,t?void 0:ci(e),n,e.cardinality)}function ym(r,e){const t=Zs(e);return()=>r.parser.action(t,e)}function Tm(r,e){const t=e.rule.ref;if(we(t)){const n=r.subrule++,i=t.fragment,s=e.arguments.length>0?vm(t,e.arguments):()=>({});return a=>r.parser.subrule(n,Jc(r,t),i,e,s(a))}else if(kt(t)){const n=r.consume++,i=Ds(r,t.name);return()=>r.parser.consume(n,i,e)}else if(t)tn();else throw new Fl(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function vm(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(wd(r)){const e=ze(r.left),t=ze(r.right);return n=>e(n)||t(n)}else if(Nd(r)){const e=ze(r.left),t=ze(r.right);return n=>e(n)&&t(n)}else if(Ld(r)){const e=ze(r.value);return t=>!e(t)}else if(bd(r)){const e=r.parameter.ref.name;return t=>t!==void 0&&t[e]===!0}else if(Cd(r)){const e=!!r.true;return()=>e}tn()}function Rm(r,e){if(e.elements.length===1)return $t(r,e.elements[0]);{const t=[];for(const i of e.elements){const s={ALT:$t(r,i,!0)},a=ci(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 $m(r,e){if(e.elements.length===1)return $t(r,e.elements[0]);const t=[];for(const o of e.elements){const l={ALT:$t(r,o,!0)},c=ci(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=Zc(r,ci(e),s,"*");return o=>{a(o),r.parser.isRecording()||r.parser.unorderedGroups.delete(i(n,r.parser))}}function Em(r,e){const t=e.elements.map(n=>$t(r,n));return n=>t.forEach(i=>i(n))}function ci(r){if(Ys(r))return r.guardCondition}function Qc(r,e,t=e.terminal){if(t)if(vt(t)&&we(t.rule.ref)){const n=t.rule.ref,i=r.subrule++;return s=>r.parser.subrule(i,Jc(r,n),!1,e,s)}else if(vt(t)&&kt(t.rule.ref)){const n=r.consume++,i=Ds(r,t.rule.ref.name);return()=>r.parser.consume(n,i,e)}else if(Tt(t)){const n=r.consume++,i=Ds(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=Ql(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Zs(e.type.ref));return Qc(r,e,i)}}function Am(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 Zc(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:Qa(),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:Qa(),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 tn()}function Jc(r,e){const t=km(r,e),n=r.parser.getRule(t);if(!n)throw new Error(`Rule "${t}" not found."`);return n}function km(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);)(Ys(n)||Kl(n)||Vl(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 Ds(r,e){const t=r.tokens[e];if(!t)throw new Error(`Token "${e}" not found."`);return t}function xm(r){const e=r.Grammar,t=r.parser.Lexer,n=new fm(r);return Xc(e,n,t.definition),n.finalize(),n}function Im(r){const e=Sm(r);return e.finalize(),e}function Sm(r){const e=r.Grammar,t=r.parser.Lexer,n=new dm(r);return Xc(e,n,t.definition)}class eu{constructor(){this.diagnostics=[]}buildTokens(e,t){const n=ee(Yl(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&&us(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(kt).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){const t=Js(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=us(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=>rn(i).filter(Tt)).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(eh(e.value)):e.value}findLongerAlt(e,t){return t.reduce((n,i)=>{const s=i?.PATTERN;return s?.source&&th("^"+s.source+"$",e.value)&&n.push(i),n},[])}}class tu{convert(e,t){let n=t.grammarSource;if(zs(n)&&(n=sh(n)),vt(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=hh(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 pt={},En={},il;function ru(){if(il)return En;il=1,Object.defineProperty(En,"__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={})),En.default=e,En}var Q={},sl;function Cm(){if(sl)return Q;sl=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 mt={},al;function nu(){if(al)return mt;al=1,Object.defineProperty(mt,"__esModule",{value:!0}),mt.Emitter=mt.Event=void 0;const r=ru();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(mt.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 mt.Emitter=n,n._noop=function(){},mt}var ol;function Nm(){if(ol)return pt;ol=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.CancellationTokenSource=pt.CancellationToken=void 0;const r=ru(),e=Cm(),t=nu();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||(pt.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 pt.CancellationTokenSource=a,pt}var K=Nm();function wm(){return new Promise(r=>{typeof setImmediate>"u"?setTimeout(r,0):setImmediate(r)})}let Dn=0,Lm=10;function bm(){return Dn=performance.now(),new K.CancellationTokenSource}const ui=Symbol("OperationCancelled");function Si(r){return r===ui}async function $e(r){if(r===K.CancellationToken.None)return;const e=performance.now();if(e-Dn>=Lm&&(Dn=e,await wm(),Dn=performance.now()),r.isCancellationRequested)throw ui}class fa{constructor(){this.promise=new Promise((e,t)=>{this.resolve=n=>(e(n),this),this.reject=n=>(t(n),this)})}}class Jr{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(Jr.isIncremental(n)){const i=su(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=ll(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(Jr.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=ll(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&&iu(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 Fs;(function(r){function e(i,s,a,o){return new Jr(i,s,a,o)}r.create=e;function t(i,s,a){if(i instanceof Jr)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=Us(s.map(_m),(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})(Fs||(Fs={}));function Us(r,e){if(r.length<=1)return r;const t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Us(n,e),Us(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 ll(r,e,t=0){const n=e?[t]:[];for(let i=0;i<r.length;i++){const s=r.charCodeAt(i);iu(s)&&(s===13&&i+1<r.length&&r.charCodeAt(i+1)===10&&i++,n.push(t+i+1))}return n}function iu(r){return r===13||r===10}function su(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 _m(r){const e=su(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var au;(()=>{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 x=d.lastIndexOf("/");if(x!==d.length-1){x===-1?(d="",h=0):h=(d=d.slice(0,x)).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=Li.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,x=-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?x=R:R===0&&(x=0));break}var E=l.charCodeAt(u+R);if(E!==c.charCodeAt(f+R))break;E===47&&(x=R)}var T="";for(R=u+x+1;R<=d;++R)R!==d&&l.charCodeAt(R)!==47||(T.length===0?T+="..":T+="/..");return T.length>0?T+c.slice(f+x):(f+=x,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 x=l.charCodeAt(u);if(x===47){if(!f){d=u+1;break}}else g===-1&&(f=!1,g=u+1),m>=0&&(x===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,x=!0,R=l.length-1,E=0;R>=u;--R)if((d=l.charCodeAt(R))!==47)g===-1&&(x=!1,g=R+1),d===46?f===-1?f=R:E!==1&&(E=1):f!==-1&&(E=-1);else if(!x){m=R+1;break}return f===-1||g===-1||E===0||E===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 Li=="object"?i=Li.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,a=/^\//,o=/^\/\//;function l(A,y){if(!A.scheme&&y)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${A.authority}", path: "${A.path}", query: "${A.query}", fragment: "${A.fragment}"}`);if(A.scheme&&!s.test(A.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(A.path){if(A.authority){if(!a.test(A.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(A.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{constructor(y,$,I,_,b,L=!1){Je(this,"scheme");Je(this,"authority");Je(this,"path");Je(this,"query");Je(this,"fragment");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=$||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,I||c),this.query=_||c,this.fragment=b||c,l(this,L))}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"}get fsPath(){return E(this)}with(y){if(!y)return this;let{scheme:$,authority:I,path:_,query:b,fragment:L}=y;return $===void 0?$=this.scheme:$===null&&($=c),I===void 0?I=this.authority:I===null&&(I=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),$===this.scheme&&I===this.authority&&_===this.path&&b===this.query&&L===this.fragment?this:new m($,I,_,b,L)}static parse(y,$=!1){const I=d.exec(y);return I?new m(I[2]||c,ie(I[4]||c),ie(I[5]||c),ie(I[7]||c),ie(I[9]||c),$):new m(c,c,c,c,c)}static file(y){let $=c;if(i&&(y=y.replace(/\\/g,u)),y[0]===u&&y[1]===u){const I=y.indexOf(u,2);I===-1?($=y.substring(2),y=u):($=y.substring(2,I),y=y.substring(I)||u)}return new m("file",$,y,c,c)}static from(y){const $=new m(y.scheme,y.authority,y.path,y.query,y.fragment);return l($,!0),$}toString(y=!1){return T(this,y)}toJSON(){return this}static revive(y){if(y){if(y instanceof h)return y;{const $=new m(y);return $._formatted=y.external,$._fsPath=y._sep===f?y.fsPath:null,$}}return y}}const f=i?1:void 0;class m extends h{constructor(){super(...arguments);Je(this,"_formatted",null);Je(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=E(this)),this._fsPath}toString($=!1){return $?T(this,!0):(this._formatted||(this._formatted=T(this,!1)),this._formatted)}toJSON(){const $={$mid:1};return this._fsPath&&($.fsPath=this._fsPath,$._sep=f),this._formatted&&($.external=this._formatted),this.path&&($.path=this.path),this.scheme&&($.scheme=this.scheme),this.authority&&($.authority=this.authority),this.query&&($.query=this.query),this.fragment&&($.fragment=this.fragment),$}}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 x(A,y,$){let I,_=-1;for(let b=0;b<A.length;b++){const L=A.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||$&&L===91||$&&L===93||$&&L===58)_!==-1&&(I+=encodeURIComponent(A.substring(_,b)),_=-1),I!==void 0&&(I+=A.charAt(b));else{I===void 0&&(I=A.substr(0,b));const Te=g[L];Te!==void 0?(_!==-1&&(I+=encodeURIComponent(A.substring(_,b)),_=-1),I+=Te):_===-1&&(_=b)}}return _!==-1&&(I+=encodeURIComponent(A.substring(_))),I!==void 0?I:A}function R(A){let y;for(let $=0;$<A.length;$++){const I=A.charCodeAt($);I===35||I===63?(y===void 0&&(y=A.substr(0,$)),y+=g[I]):y!==void 0&&(y+=A[$])}return y!==void 0?y:A}function E(A,y){let $;return $=A.authority&&A.path.length>1&&A.scheme==="file"?`//${A.authority}${A.path}`:A.path.charCodeAt(0)===47&&(A.path.charCodeAt(1)>=65&&A.path.charCodeAt(1)<=90||A.path.charCodeAt(1)>=97&&A.path.charCodeAt(1)<=122)&&A.path.charCodeAt(2)===58?A.path[1].toLowerCase()+A.path.substr(2):A.path,i&&($=$.replace(/\//g,"\\")),$}function T(A,y){const $=y?R:x;let I="",{scheme:_,authority:b,path:L,query:Te,fragment:Y}=A;if(_&&(I+=_,I+=":"),(b||_==="file")&&(I+=u,I+=u),b){let V=b.indexOf("@");if(V!==-1){const dt=b.substr(0,V);b=b.substr(V+1),V=dt.lastIndexOf(":"),V===-1?I+=$(dt,!1,!1):(I+=$(dt.substr(0,V),!1,!1),I+=":",I+=$(dt.substr(V+1),!1,!0)),I+="@"}b=b.toLowerCase(),V=b.lastIndexOf(":"),V===-1?I+=$(b,!1,!0):(I+=$(b.substr(0,V),!1,!0),I+=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)}`)}I+=$(L,!0,!1)}return Te&&(I+="?",I+=$(Te,!1,!1)),Y&&(I+="#",I+=y?Y:x(Y,!1,!1)),I}function S(A){try{return decodeURIComponent(A)}catch{return A.length>3?A.substr(0,3)+S(A.substr(3)):A}}const G=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function ie(A){return A.match(G)?A.replace(G,y=>S(y)):A}var Le=t(470);const ye=Le.posix||Le,Fe="/";var Se;(function(A){A.joinPath=function(y,...$){return y.with({path:ye.join(y.path,...$)})},A.resolvePath=function(y,...$){let I=y.path,_=!1;I[0]!==Fe&&(I=Fe+I,_=!0);let b=ye.resolve(I,...$);return _&&b[0]===Fe&&!y.authority&&(b=b.substring(1)),y.with({path:b})},A.dirname=function(y){if(y.path.length===0||y.path===Fe)return y;let $=ye.dirname(y.path);return $.length===1&&$.charCodeAt(0)===46&&($=""),y.with({path:$})},A.basename=function(y){return ye.basename(y.path)},A.extname=function(y){return ye.extname(y.path)}})(Se||(Se={}))})(),au=n})();const{URI:Et,Utils:dr}=au;var it;(function(r){r.basename=dr.basename,r.dirname=dr.dirname,r.extname=dr.extname,r.joinPath=dr.joinPath,r.resolvePath=dr.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 Et.parse(i.toString()).toString()}r.normalize=n})(it||(it={}));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 Om{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??Et.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=Fs.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,t??""))}}class Pm{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 Wi=Symbol("ref_resolving");class Mm{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 bt(e.parseResult.value))await $e(t),Hl(n).forEach(i=>this.doLink(i,e))}doLink(e,t){var n;const i=e.reference;if(i._ref===void 0){i._ref=Wi;try{const s=this.getCandidate(e);if(wn(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(Td(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=Wi;const l=cs(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===Wi)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 wn(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){var t;try{const n=this.getCandidate(e);if(wn(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=cs(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 Dm(r){return typeof r.name=="string"}class Fm{getName(e){if(Dm(e))return e.name}getNameNode(e){return Xl(e.$cstNode,"name")}}class Um{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const t=uh(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||$d(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=>it.equals(s.sourceUri,t.documentUri))),n.push(...i),ee(n)}getReferenceToSelf(e){const t=this.nameProvider.getNameNode(e);if(t){const n=et(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Wn(t),local:!0}}}}class di{constructor(e){if(this.map=new Map,e)for(const[t,n]of e)this.add(t,n)}get size(){return as.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 cl{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 Gm{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=qs,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 di;for(const s of rn(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 ul{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 Bm{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 ou{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 Km extends ou{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 Vm extends ou{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 jm extends Km{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 Hm{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 jm(e.shared)}getScope(e){const t=[],n=this.reflection.getReferenceType(e),i=et(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 ul(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 ul(i,t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new Bm(this.indexManager.allElements(e)))}}function Wm(r){return typeof r.$comment=="string"}function dl(r){return typeof r=="object"&&!!r&&("$ref"in r||"$error"in r)}class zm{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=et(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=et(h);let g="";this.currentDocument&&this.currentDocument!==m&&(o?g=o(m.uri,t):g=m.uri.toString());const x=this.astNodeLocator.getAstNodePath(h);return{$ref:`${g}#${x}`,$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=oh(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];dl(d)?c[u]=this.reviveReference(e,l,t,d,n):ae(d)&&this.linkNode(d,t,n,e,l,u)}else dl(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):Et.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)):Et.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 Ym{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=it.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 Vr(r){return{code:r}}var hi;(function(r){r.all=["fast","slow","built-in"]})(hi||(hi={}));class qm{constructor(e){this.entries=new di,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 tn()}}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(Si(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 Xm{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(Si(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:zi(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:Zm(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=ls(i.token);if(s){const a={severity:zi("error"),range:s,message:i.message,data:Vr(_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(bt(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:Qm(n),severity:zi(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 Qm(r){if(r.range)return r.range;let e;return typeof r.property=="string"?e=Xl(r.node.$cstNode,r.property,r.index):typeof r.keyword=="string"&&(e=lh(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 zi(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 Zm(r){switch(r){case"error":return Vr(_e.LexingError);case"warning":return Vr(_e.LexingWarning);case"info":return Vr(_e.LexingInfo);case"hint":return Vr(_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 Jm{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n){const i=n??et(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=Wn((l=this.nameProvider.getNameNode(e))!==null&&l!==void 0?l:e.$cstNode))};return{node:e,name:t,get nameSegment(){return o()},selectionSegment:Wn(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class eg{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=K.CancellationToken.None){const n=[],i=e.parseResult.value;for(const s of bt(i))await $e(t),Hl(s).filter(a=>!wn(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=et(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:Wn(n),local:it.equals(t.documentUri,i)}}}class tg{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 rg=nu();class ng{constructor(e){this._ready=new fa,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new rg.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 Yr;(function(r){function e(t){return{dispose:async()=>await t()}}r.create=e})(Yr||(Yr={}));class ig{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new di,this.documentPhaseListeners=new di,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:hi.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),Yr.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),Yr.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),Yr.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(ui):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(ui)})})}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(!Si(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:hi.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 sg{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Vm,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){const n=et(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(a=>{it.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 ag{constructor(e){this.initialBuildOptions={},this._ready=new fa,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 Et.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=it.basename(t.uri);if(i.startsWith("."))return!1;if(t.isDirectory)return i!=="node_modules"&&i!=="out";if(t.isFile){const s=it.extname(t.uri);return n.includes(s)}return!1}}class og{buildUnexpectedCharactersMessage(e,t,n,i,s){return ps.buildUnexpectedCharactersMessage(e,t,n,i,s)}buildUnableToPopLexerModeMessage(e){return ps.buildUnableToPopLexerModeMessage(e)}}const lg={mode:"full"};class cg{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=hl(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=lg){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(hl(e))return e;const t=lu(e)?Object.values(e.modes).flat():e,n={};return t.forEach(i=>n[i.name]=i),n}}function ug(r){return Array.isArray(r)&&(r.length===0||"name"in r[0])}function lu(r){return r&&"modes"in r&&"defaultMode"in r}function hl(r){return!ug(r)&&!lu(r)}function dg(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=cu(r),a=pa(n),o=pg({lines:s,position:i,options:a});return vg({index:0,tokens:o,position:i})}function hg(r,e){const t=pa(e),n=cu(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 cu(r){let e="";return typeof r=="string"?e=r:e=r.text,e.split(qd)}const fl=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,fg=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function pg(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,Tg(u)),Gs(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{fl.lastIndex=d;const h=fl.exec(u);if(h){const f=h[0],m=h[1],g=P.create(s,a+d),x=P.create(s,a+d+f.length);i.push({type:"tag",content:m,range:O.create(g,x)}),d+=f.length,d=Gs(u,d)}if(d<u.length){const f=u.substring(d),m=Array.from(f.matchAll(fg));i.push(...mg(m,f,s,a+d))}}s++,a=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function mg(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 gg=/\S/,yg=/\s*$/;function Gs(r,e){const t=r.substring(e).match(gg);return t?e+t.index:r.length}function Tg(r){const e=r.match(yg);if(e&&typeof e.index=="number")return e.index}function vg(r){var e,t,n,i;const s=P.create(r.position.line,r.position.character);if(r.tokens.length===0)return new pl([],O.create(s,s));const a=[];for(;r.index<r.tokens.length;){const c=Rg(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 pl(a,O.create(o,l))}function Rg(r,e){const t=r.tokens[r.index];if(t.type==="tag")return du(r,!1);if(t.type==="text"||t.type==="inline-tag")return uu(r);$g(t,e),r.index++}function $g(r,e){if(e){const t=new fu("",r.range);"inlines"in e?e.inlines.push(t):e.content.inlines.push(t)}}function uu(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(Eg(r)),n=e,e=r.tokens[r.index];return new Bs(i,O.create(t.range.start,n.range.end))}function Eg(r){return r.tokens[r.index].type==="inline-tag"?du(r,!0):hu(r)}function du(r,e){const t=r.tokens[r.index++],n=t.content.substring(1);if(r.tokens[r.index]?.type==="text")if(e){const s=hu(r);return new qi(n,new Bs([s],s.range),e,O.create(t.range.start,s.range.end))}else{const s=uu(r);return new qi(n,s,e,O.create(t.range.start,s.range.end))}else{const s=t.range;return new qi(n,new Bs([],s),e,s)}}function hu(r){const e=r.tokens[r.index++];return new fu(e.content,e.range)}function pa(r){if(!r)return pa({start:"/**",end:"*/",line:"*"});const{start:e,end:t,line:n}=r;return{start:Yi(e,!0),end:Yi(t,!1),line:Yi(n,!0)}}function Yi(r,e){if(typeof r=="string"||typeof r=="object"){const t=typeof r=="string"?vi(r):r.source;return e?new RegExp(`^\\s*${t}`):new RegExp(`\\s*${t}\\s*$`)}else return r}class pl{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+=ml(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+=ml(t)+i}return t.trim()}}class qi{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=Ag(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 Ag(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=Gs(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:kg(e,a)}}function kg(r,e){try{return Et.parse(r,!0),`[${e}](${r})`}catch{return r}}class Bs{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 fu{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function ml(r){return r.endsWith(`
`)?`
`:`
`}class xg{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const t=this.commentProvider.getComment(e);if(t&&hg(t))return dg(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=et(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 Ig{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return Wm(e)?e.$comment:(t=xd(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||t===void 0?void 0:t.text}}class Sg{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}}class Cg{constructor(){this.previousTokenSource=new K.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=bm();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 fa,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){Si(s)?n.resolve(void 0):n.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class Ng{constructor(e){this.grammarElementIdMap=new cl,this.tokenTypeIdMap=new cl,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 bt(e))t.set(i,{});if(e.$cstNode)for(const i of os(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 Dl(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),Xr(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,t)):Ml(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 bt(e))t.set(s,{});let i;if(e.$cstNode)for(const s of os(e.$cstNode)){let a;"fullText"in s?(a=new Wc(s.fullText),i=a):"content"in s?a=new da:"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),Xr(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 Ps(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 bt(this.grammar))Sd(t)&&this.grammarElementIdMap.set(t,e++)}}function ot(r){return{documentation:{CommentProvider:e=>new Ig(e),DocumentationProvider:e=>new xg(e)},parser:{AsyncParser:e=>new Sg(e),GrammarConfig:e=>Th(e),LangiumParser:e=>Im(e),CompletionParser:e=>xm(e),ValueConverter:()=>new tu,TokenBuilder:()=>new eu,Lexer:e=>new cg(e),ParserErrorMessageProvider:()=>new qc,LexerErrorMessageProvider:()=>new og},workspace:{AstNodeLocator:()=>new tg,AstNodeDescriptionProvider:e=>new Jm(e),ReferenceDescriptionProvider:e=>new eg(e)},references:{Linker:e=>new Mm(e),NameProvider:()=>new Fm,ScopeProvider:e=>new Hm(e),ScopeComputation:e=>new Gm(e),References:e=>new Um(e)},serializer:{Hydrator:e=>new Ng(e),JsonSerializer:e=>new zm(e)},validation:{DocumentValidator:e=>new Xm(e),ValidationRegistry:e=>new qm(e)},shared:()=>r.shared}}function lt(r){return{ServiceRegistry:e=>new Ym(e),workspace:{LangiumDocuments:e=>new Pm(e),LangiumDocumentFactory:e=>new Om(e),DocumentBuilder:e=>new ig(e),IndexManager:e=>new sg(e),WorkspaceManager:e=>new ag(e),FileSystemProvider:e=>r.fileSystemProvider(e),WorkspaceLock:()=>new Cg,ConfigurationProvider:e=>new ng(e)}}}var gl;(function(r){r.merge=(e,t)=>fi(fi({},e),t)})(gl||(gl={}));function oe(r,e,t,n,i,s,a,o,l){const c=[r,e,t,n,i,s,a,o,l].reduce(fi,{});return pu(c)}const wg=Symbol("isProxy");function pu(r,e){const t=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(n,i)=>i===wg?!0:Tl(n,i,r,e||t),getOwnPropertyDescriptor:(n,i)=>(Tl(n,i,r,e||t),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in r,ownKeys:()=>[...Object.getOwnPropertyNames(r)]});return t}const yl=Symbol();function Tl(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]===yl)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]=yl;try{r[e]=typeof i=="function"?i(n):pu(i,n)}catch(s){throw r[e]=s instanceof Error?s:void 0,s}return r[e]}else return}function fi(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]=fi(i,n):r[t]=n}}return r}class Lg{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const ct={fileSystemProvider:()=>new Lg},bg={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},_g={AstReflection:()=>new jl};function Og(){const r=oe(lt(ct),_g),e=oe(ot({shared:r}),bg);return r.ServiceRegistry.register(e),e}function It(r){var e;const t=Og(),n=t.serializer.JsonSerializer.deserialize(r);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,Et.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}var Pg=Object.defineProperty,v=(r,e)=>Pg(r,"name",{value:e,configurable:!0}),vl="Statement",Fn="Architecture";function Mg(r){return De.isInstance(r,Fn)}v(Mg,"isArchitecture");var An="Axis",jr="Branch";function Dg(r){return De.isInstance(r,jr)}v(Dg,"isBranch");var kn="Checkout",xn="CherryPicking",Xi="ClassDefStatement",Hr="Commit";function Fg(r){return De.isInstance(r,Hr)}v(Fg,"isCommit");var Qi="Curve",Zi="Edge",Ji="Entry",Wr="GitGraph";function Ug(r){return De.isInstance(r,Wr)}v(Ug,"isGitGraph");var es="Group",Un="Info";function Gg(r){return De.isInstance(r,Un)}v(Gg,"isInfo");var In="Item",ts="Junction",zr="Merge";function Bg(r){return De.isInstance(r,zr)}v(Bg,"isMerge");var rs="Option",Gn="Packet";function Kg(r){return De.isInstance(r,Gn)}v(Kg,"isPacket");var Bn="PacketBlock";function Vg(r){return De.isInstance(r,Bn)}v(Vg,"isPacketBlock");var Kn="Pie";function jg(r){return De.isInstance(r,Kn)}v(jg,"isPie");var Vn="PieSection";function Hg(r){return De.isInstance(r,Vn)}v(Hg,"isPieSection");var ns="Radar",is="Service",jn="Treemap";function Wg(r){return De.isInstance(r,jn)}v(Wg,"isTreemap");var ss="TreemapRow",Sn="Direction",Cn="Leaf",Nn="Section",Ot,mu=(Ot=class extends Pl{getAllTypes(){return[Fn,An,jr,kn,xn,Xi,Hr,Qi,Sn,Zi,Ji,Wr,es,Un,In,ts,Cn,zr,rs,Gn,Bn,Kn,Vn,ns,Nn,is,vl,jn,ss]}computeIsSubtype(e,t){switch(e){case jr:case kn:case xn:case Hr:case zr:return this.isSubtype(vl,t);case Sn:return this.isSubtype(Wr,t);case Cn:case Nn:return this.isSubtype(In,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;switch(t){case"Entry:axis":return An;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Fn:return{name:Fn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case An:return{name:An,properties:[{name:"label"},{name:"name"}]};case jr:return{name:jr,properties:[{name:"name"},{name:"order"}]};case kn:return{name:kn,properties:[{name:"branch"}]};case xn:return{name:xn,properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case Xi:return{name:Xi,properties:[{name:"className"},{name:"styleText"}]};case Hr:return{name:Hr,properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case Qi:return{name:Qi,properties:[{name:"entries",defaultValue:[]},{name:"label"},{name:"name"}]};case Zi:return{name:Zi,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 Ji:return{name:Ji,properties:[{name:"axis"},{name:"value"}]};case Wr:return{name:Wr,properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case es:return{name:es,properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case Un:return{name:Un,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case In:return{name:In,properties:[{name:"classSelector"},{name:"name"}]};case ts:return{name:ts,properties:[{name:"id"},{name:"in"}]};case zr:return{name:zr,properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case rs:return{name:rs,properties:[{name:"name"},{name:"value",defaultValue:!1}]};case Gn:return{name:Gn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case Bn:return{name:Bn,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 Vn:return{name:Vn,properties:[{name:"label"},{name:"value"}]};case ns:return{name:ns,properties:[{name:"accDescr"},{name:"accTitle"},{name:"axes",defaultValue:[]},{name:"curves",defaultValue:[]},{name:"options",defaultValue:[]},{name:"title"}]};case is:return{name:is,properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case jn:return{name:jn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"},{name:"TreemapRows",defaultValue:[]}]};case ss:return{name:ss,properties:[{name:"indent"},{name:"item"}]};case Sn:return{name:Sn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};case Cn:return{name:Cn,properties:[{name:"classSelector"},{name:"name"},{name:"value"}]};case Nn:return{name:Nn,properties:[{name:"classSelector"},{name:"name"}]};default:return{name:e,properties:[]}}}},v(Ot,"MermaidAstReflection"),Ot),De=new mu,Rl,zg=v(()=>Rl??(Rl=It(`{"$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"),$l,Yg=v(()=>$l??($l=It(`{"$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"),El,qg=v(()=>El??(El=It(`{"$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"),Al,Xg=v(()=>Al??(Al=It(`{"$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"),kl,Qg=v(()=>kl??(kl=It(`{"$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"),xl,Zg=v(()=>xl??(xl=It(`{"$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"),Il,Jg=v(()=>Il??(Il=It(`{"$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"),ey={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ty={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ry={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ny={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},iy={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},sy={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ay={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},St={AstReflection:v(()=>new mu,"AstReflection")},oy={Grammar:v(()=>zg(),"Grammar"),LanguageMetaData:v(()=>ey,"LanguageMetaData"),parser:{}},ly={Grammar:v(()=>Yg(),"Grammar"),LanguageMetaData:v(()=>ty,"LanguageMetaData"),parser:{}},cy={Grammar:v(()=>qg(),"Grammar"),LanguageMetaData:v(()=>ry,"LanguageMetaData"),parser:{}},uy={Grammar:v(()=>Xg(),"Grammar"),LanguageMetaData:v(()=>ny,"LanguageMetaData"),parser:{}},dy={Grammar:v(()=>Qg(),"Grammar"),LanguageMetaData:v(()=>iy,"LanguageMetaData"),parser:{}},hy={Grammar:v(()=>Zg(),"Grammar"),LanguageMetaData:v(()=>sy,"LanguageMetaData"),parser:{}},fy={Grammar:v(()=>Jg(),"Grammar"),LanguageMetaData:v(()=>ay,"LanguageMetaData"),parser:{}},py=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,my=/accTitle[\t ]*:([^\n\r]*)/,gy=/title([\t ][^\n\r]*|)/,yy={ACC_DESCR:py,ACC_TITLE:my,TITLE:gy},Pt,Ci=(Pt=class extends tu{runConverter(e,t,n){let i=this.runCommonConverter(e,t,n);return i===void 0&&(i=this.runCustomConverter(e,t,n)),i===void 0?super.runConverter(e,t,n):i}runCommonConverter(e,t,n){const i=yy[e.name];if(i===void 0)return;const s=i.exec(t);if(s!==null){if(s[1]!==void 0)return s[1].trim().replace(/[\t ]{2,}/gm," ");if(s[2]!==void 0)return s[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,`
`)}}},v(Pt,"AbstractMermaidValueConverter"),Pt),Mt,Ni=(Mt=class extends Ci{runCustomConverter(e,t,n){}},v(Mt,"CommonValueConverter"),Mt),Dt,ut=(Dt=class extends eu{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,n){const i=super.buildKeywordTokens(e,t,n);return i.forEach(s=>{this.keywords.has(s.name)&&s.PATTERN!==void 0&&(s.PATTERN=new RegExp(s.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),i}},v(Dt,"AbstractMermaidTokenBuilder"),Dt),Ft;Ft=class extends ut{},v(Ft,"CommonTokenBuilder");var Ut,Ty=(Ut=class extends ut{constructor(){super(["gitGraph"])}},v(Ut,"GitGraphTokenBuilder"),Ut),gu={parser:{TokenBuilder:v(()=>new Ty,"TokenBuilder"),ValueConverter:v(()=>new Ni,"ValueConverter")}};function yu(r=ct){const e=oe(lt(r),St),t=oe(ot({shared:e}),dy,gu);return e.ServiceRegistry.register(t),{shared:e,GitGraph:t}}v(yu,"createGitGraphServices");var Gt,vy=(Gt=class extends ut{constructor(){super(["info","showInfo"])}},v(Gt,"InfoTokenBuilder"),Gt),Tu={parser:{TokenBuilder:v(()=>new vy,"TokenBuilder"),ValueConverter:v(()=>new Ni,"ValueConverter")}};function vu(r=ct){const e=oe(lt(r),St),t=oe(ot({shared:e}),oy,Tu);return e.ServiceRegistry.register(t),{shared:e,Info:t}}v(vu,"createInfoServices");var Bt,Ry=(Bt=class extends ut{constructor(){super(["packet"])}},v(Bt,"PacketTokenBuilder"),Bt),Ru={parser:{TokenBuilder:v(()=>new Ry,"TokenBuilder"),ValueConverter:v(()=>new Ni,"ValueConverter")}};function $u(r=ct){const e=oe(lt(r),St),t=oe(ot({shared:e}),ly,Ru);return e.ServiceRegistry.register(t),{shared:e,Packet:t}}v($u,"createPacketServices");var Kt,$y=(Kt=class extends ut{constructor(){super(["pie","showData"])}},v(Kt,"PieTokenBuilder"),Kt),Vt,Ey=(Vt=class extends Ci{runCustomConverter(e,t,n){if(e.name==="PIE_SECTION_LABEL")return t.replace(/"/g,"").trim()}},v(Vt,"PieValueConverter"),Vt),Eu={parser:{TokenBuilder:v(()=>new $y,"TokenBuilder"),ValueConverter:v(()=>new Ey,"ValueConverter")}};function Au(r=ct){const e=oe(lt(r),St),t=oe(ot({shared:e}),cy,Eu);return e.ServiceRegistry.register(t),{shared:e,Pie:t}}v(Au,"createPieServices");var jt,Ay=(jt=class extends ut{constructor(){super(["architecture"])}},v(jt,"ArchitectureTokenBuilder"),jt),Ht,ky=(Ht=class extends Ci{runCustomConverter(e,t,n){if(e.name==="ARCH_ICON")return t.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return t.replace(/["()]/g,"");if(e.name==="ARCH_TITLE")return t.replace(/[[\]]/g,"").trim()}},v(Ht,"ArchitectureValueConverter"),Ht),ku={parser:{TokenBuilder:v(()=>new Ay,"TokenBuilder"),ValueConverter:v(()=>new ky,"ValueConverter")}};function xu(r=ct){const e=oe(lt(r),St),t=oe(ot({shared:e}),uy,ku);return e.ServiceRegistry.register(t),{shared:e,Architecture:t}}v(xu,"createArchitectureServices");var Wt,xy=(Wt=class extends ut{constructor(){super(["radar-beta"])}},v(Wt,"RadarTokenBuilder"),Wt),Iu={parser:{TokenBuilder:v(()=>new xy,"TokenBuilder"),ValueConverter:v(()=>new Ni,"ValueConverter")}};function Su(r=ct){const e=oe(lt(r),St),t=oe(ot({shared:e}),hy,Iu);return e.ServiceRegistry.register(t),{shared:e,Radar:t}}v(Su,"createRadarServices");var zt,Iy=(zt=class extends ut{constructor(){super(["treemap"])}},v(zt,"TreemapTokenBuilder"),zt),Sy=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,Yt,Cy=(Yt=class extends Ci{runCustomConverter(e,t,n){if(e.name==="NUMBER2")return parseFloat(t.replace(/,/g,""));if(e.name==="SEPARATOR"||e.name==="STRING2")return t.substring(1,t.length-1);if(e.name==="INDENTATION")return t.length;if(e.name==="ClassDef"){if(typeof t!="string")return t;const i=Sy.exec(t);if(i)return{$type:"ClassDefStatement",className:i[1],styleText:i[2]||void 0}}}},v(Yt,"TreemapValueConverter"),Yt);function Cu(r){const e=r.validation.TreemapValidator,t=r.validation.ValidationRegistry;if(t){const n={Treemap:e.checkSingleRoot.bind(e)};t.register(n,e)}}v(Cu,"registerValidationChecks");var qt,Ny=(qt=class{checkSingleRoot(e,t){let n;for(const i of e.TreemapRows)i.item&&(n===void 0&&i.indent===void 0?n=0:i.indent===void 0?t("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}):n!==void 0&&n>=parseInt(i.indent,10)&&t("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}))}},v(qt,"TreemapValidator"),qt),Nu={parser:{TokenBuilder:v(()=>new Iy,"TokenBuilder"),ValueConverter:v(()=>new Cy,"ValueConverter")},validation:{TreemapValidator:v(()=>new Ny,"TreemapValidator")}};function wu(r=ct){const e=oe(lt(r),St),t=oe(ot({shared:e}),fy,Nu);return e.ServiceRegistry.register(t),Cu(t),{shared:e,Treemap:t}}v(wu,"createTreemapServices");var He={},wy={info:v(async()=>{const{createInfoServices:r}=await ft(async()=>{const{createInfoServices:t}=await Promise.resolve().then(()=>_y);return{createInfoServices:t}},void 0,import.meta.url),e=r().Info.parser.LangiumParser;He.info=e},"info"),packet:v(async()=>{const{createPacketServices:r}=await ft(async()=>{const{createPacketServices:t}=await Promise.resolve().then(()=>Oy);return{createPacketServices:t}},void 0,import.meta.url),e=r().Packet.parser.LangiumParser;He.packet=e},"packet"),pie:v(async()=>{const{createPieServices:r}=await ft(async()=>{const{createPieServices:t}=await Promise.resolve().then(()=>Py);return{createPieServices:t}},void 0,import.meta.url),e=r().Pie.parser.LangiumParser;He.pie=e},"pie"),architecture:v(async()=>{const{createArchitectureServices:r}=await ft(async()=>{const{createArchitectureServices:t}=await Promise.resolve().then(()=>My);return{createArchitectureServices:t}},void 0,import.meta.url),e=r().Architecture.parser.LangiumParser;He.architecture=e},"architecture"),gitGraph:v(async()=>{const{createGitGraphServices:r}=await ft(async()=>{const{createGitGraphServices:t}=await Promise.resolve().then(()=>Dy);return{createGitGraphServices:t}},void 0,import.meta.url),e=r().GitGraph.parser.LangiumParser;He.gitGraph=e},"gitGraph"),radar:v(async()=>{const{createRadarServices:r}=await ft(async()=>{const{createRadarServices:t}=await Promise.resolve().then(()=>Fy);return{createRadarServices:t}},void 0,import.meta.url),e=r().Radar.parser.LangiumParser;He.radar=e},"radar"),treemap:v(async()=>{const{createTreemapServices:r}=await ft(async()=>{const{createTreemapServices:t}=await Promise.resolve().then(()=>Uy);return{createTreemapServices:t}},void 0,import.meta.url),e=r().Treemap.parser.LangiumParser;He.treemap=e},"treemap")};async function Ly(r,e){const t=wy[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 by(n);return n.value}v(Ly,"parse");var Xt,by=(Xt=class extends Error{constructor(e){const t=e.lexerErrors.map(i=>i.message).join(`
`),n=e.parserErrors.map(i=>i.message).join(`
`);super(`Parsing failed: ${t} ${n}`),this.result=e}},v(Xt,"MermaidParseError"),Xt);const _y=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:Tu,createInfoServices:vu},Symbol.toStringTag,{value:"Module"})),Oy=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:Ru,createPacketServices:$u},Symbol.toStringTag,{value:"Module"})),Py=Object.freeze(Object.defineProperty({__proto__:null,PieModule:Eu,createPieServices:Au},Symbol.toStringTag,{value:"Module"})),My=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:ku,createArchitectureServices:xu},Symbol.toStringTag,{value:"Module"})),Dy=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:gu,createGitGraphServices:yu},Symbol.toStringTag,{value:"Module"})),Fy=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:Iu,createRadarServices:Su},Symbol.toStringTag,{value:"Module"})),Uy=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:Nu,createTreemapServices:wu},Symbol.toStringTag,{value:"Module"}));export{Ly as p};
//# sourceMappingURL=treemap-KMMF4GRG-BMzvQTWV.chunk.mjs.map