@marimo-team/frontend 0.12.10-dev3 → 0.12.10-dev5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-DmrBl7Qm.js → ConnectedDataExplorerComponent-CddbWaEB.js} +1 -1
  2. package/dist/assets/{VegaLite-DBp7KmUn.js → VegaLite-xoXSu8Jj.js} +1 -1
  3. package/dist/assets/{_baseEach-rAXZtelz.js → _baseEach-DP3fzUd9.js} +1 -1
  4. package/dist/assets/_baseMap-Fz3xjdle.js +1 -0
  5. package/dist/assets/{_baseUniq-D66Qo79c.js → _baseUniq-C1UQCeSS.js} +1 -1
  6. package/dist/assets/{any-language-editor-Dl33VB_d.js → any-language-editor-CAvaiXsl.js} +1 -1
  7. package/dist/assets/{architectureDiagram-IEHRJDOE-SaSwbCnM.js → architectureDiagram-IEHRJDOE-9N0MifFY.js} +1 -1
  8. package/dist/assets/{blockDiagram-JOT3LUYC-4Cq53y6T.js → blockDiagram-JOT3LUYC-Dlqyiejz.js} +1 -1
  9. package/dist/assets/{c4Diagram-VJAJSXHY-DZDFjeHH.js → c4Diagram-VJAJSXHY-D0k3VHqb.js} +1 -1
  10. package/dist/assets/channel-JEHEft44.js +1 -0
  11. package/dist/assets/{chart-spec-DG-zlVlC.js → chart-spec-BtVsjexS.js} +1 -1
  12. package/dist/assets/{chunk-4BMEZGHF-CwwGLy_-.js → chunk-4BMEZGHF-Db3dKLso.js} +1 -1
  13. package/dist/assets/{chunk-A2AXSNBT-CxKatbsQ.js → chunk-A2AXSNBT-BWEaex_m.js} +1 -1
  14. package/dist/assets/{chunk-AEK57VVT-MeMXWAAg.js → chunk-AEK57VVT-CqKyWikN.js} +1 -1
  15. package/dist/assets/{chunk-D6G4REZN-BCKjh0v_.js → chunk-D6G4REZN-EDyBzjqm.js} +1 -1
  16. package/dist/assets/{chunk-RZ5BOZE2-Do90lYT8.js → chunk-RZ5BOZE2-BzXVDgOh.js} +1 -1
  17. package/dist/assets/{chunk-XZIHB7SX-BoQjePzP.js → chunk-XZIHB7SX-DzjlI0yE.js} +1 -1
  18. package/dist/assets/{circle-play-DAhsR559.js → circle-play-BwExEcSF.js} +1 -1
  19. package/dist/assets/classDiagram-GIVACNV2-D2s2iak2.js +1 -0
  20. package/dist/assets/classDiagram-v2-COTLJTTW-D2s2iak2.js +1 -0
  21. package/dist/assets/clone-Bcupu-7G.js +1 -0
  22. package/dist/assets/{compile-Cy3qPIy3.js → compile-BzYsKz9j.js} +1 -1
  23. package/dist/assets/{dagre-OKDRZEBW-D7y1xAb8.js → dagre-OKDRZEBW-BUPBAOLs.js} +1 -1
  24. package/dist/assets/{data-editor-B1qcGBrc.js → data-editor-pJ-yeJvx.js} +1 -1
  25. package/dist/assets/{diagram-SSKATNLV-D3zxH8Me.js → diagram-SSKATNLV-CIzZZd2y.js} +1 -1
  26. package/dist/assets/{diagram-VNBRO52H-DGhUKbRB.js → diagram-VNBRO52H-DbgIPdfx.js} +1 -1
  27. package/dist/assets/{edit-page-CTUiocG5.js → edit-page-BO3hueeB.js} +3 -3
  28. package/dist/assets/{erDiagram-Q7BY3M3F-BGhslJsG.js → erDiagram-Q7BY3M3F-Dhp7GMzZ.js} +1 -1
  29. package/dist/assets/{flowDiagram-4HSFHLVR--Z8xiCnV.js → flowDiagram-4HSFHLVR-CI1pTrf6.js} +1 -1
  30. package/dist/assets/{ganttDiagram-APWFNJXF-zKfOXq3H.js → ganttDiagram-APWFNJXF-BpFymuzA.js} +1 -1
  31. package/dist/assets/{gitGraphDiagram-7IBYFJ6S-BfBMa_Ba.js → gitGraphDiagram-7IBYFJ6S-rXOpjSv9.js} +1 -1
  32. package/dist/assets/{graph-CNwE4Wjk.js → graph-CtlWtEpl.js} +1 -1
  33. package/dist/assets/{home-page-C5yY-4mN.js → home-page-DAYvR4Rn.js} +1 -1
  34. package/dist/assets/{index-BjMasXPm.js → index-B6id6Prr.js} +1 -1
  35. package/dist/assets/{index-9stjzBo8.js → index-BN1414Sx.js} +1 -1
  36. package/dist/assets/{index-DPH-HhkO.js → index-BbgGyILO.js} +1 -1
  37. package/dist/assets/{index-wbGSPnn1.js → index-BfBmeZtM.js} +1 -1
  38. package/dist/assets/{index-D4kMAB5s.js → index-BgfHZbLB.js} +1 -1
  39. package/dist/assets/{index-BtBibZXb.js → index-C9MWjpOW.js} +1 -1
  40. package/dist/assets/{index-HMFwHOhQ.js → index-CNfw7UBu.js} +1 -1
  41. package/dist/assets/{index-BIkmOXnS.js → index-CUey_fKi.js} +1 -1
  42. package/dist/assets/{index-CSSsFrIx.js → index-CbcS8dje.js} +1 -1
  43. package/dist/assets/{index-BsXnFya1.js → index-Cw13EY89.js} +1 -1
  44. package/dist/assets/{index-BAAP3gVA.js → index-DAuXADVL.js} +1 -1
  45. package/dist/assets/{index-CHe_Kk1h.js → index-DOvSKxjU.js} +1 -1
  46. package/dist/assets/{index-D1IdOJyZ.js → index-DvlAPl7t.js} +1 -1
  47. package/dist/assets/{index-D2omUdzR.js → index-DwBKcFXe.js} +4 -4
  48. package/dist/assets/{index-CcJixb73.js → index-DyhY1Poh.js} +1 -1
  49. package/dist/assets/{index-BJ9mHY51.js → index-TH_uhyFN.js} +1 -1
  50. package/dist/assets/{index-BLUz0d8-.js → index-WsFBR0zz.js} +1 -1
  51. package/dist/assets/{infoDiagram-PH2N3AL5-DLBb5I4E.js → infoDiagram-PH2N3AL5-6SwN-_Pj.js} +1 -1
  52. package/dist/assets/{journeyDiagram-U35MCT3I-Eg71dWh0.js → journeyDiagram-U35MCT3I-B6Qb24v4.js} +1 -1
  53. package/dist/assets/{kanban-definition-NDS4AKOZ-DrlIyZXI.js → kanban-definition-NDS4AKOZ-Bdj4MhzM.js} +1 -1
  54. package/dist/assets/{layout-BQwQrlaR.js → layout-bT9yEdVU.js} +1 -1
  55. package/dist/assets/{linear-CJq3S4eb.js → linear-Bb1Hoqgz.js} +1 -1
  56. package/dist/assets/{mermaid-zU1sahUk.js → mermaid-u7JJGwGW.js} +2 -2
  57. package/dist/assets/{min-RICAEQQK.js → min-hX6ooyJu.js} +1 -1
  58. package/dist/assets/{mindmap-definition-ALO5MXBD-C66NGjfc.js → mindmap-definition-ALO5MXBD-BZexEfB5.js} +1 -1
  59. package/dist/assets/{pieDiagram-IB7DONF6-CrKtNdSb.js → pieDiagram-IB7DONF6-BvnVS1pO.js} +1 -1
  60. package/dist/assets/{quadrantDiagram-7GDLP6J5-BlwaWWXe.js → quadrantDiagram-7GDLP6J5-DwAZ9R9f.js} +1 -1
  61. package/dist/assets/{radar-MK3ICKWK-Cody2njo.js → radar-MK3ICKWK-Brm1H-WZ.js} +1 -1
  62. package/dist/assets/{react-plotly-Bz-gy26g.js → react-plotly-H9t-v3Ou.js} +1 -1
  63. package/dist/assets/{requirementDiagram-KVF5MWMF-C3tA4T3F.js → requirementDiagram-KVF5MWMF-CfZkBWxB.js} +1 -1
  64. package/dist/assets/{run-page-CRdiEI2a.js → run-page-Ds4kgU4P.js} +1 -1
  65. package/dist/assets/{sankeyDiagram-QLVOVGJD-B7rIn0Im.js → sankeyDiagram-QLVOVGJD-DqjOQIt9.js} +1 -1
  66. package/dist/assets/{sequenceDiagram-X6HHIX6F-DH6ilahB.js → sequenceDiagram-X6HHIX6F-r-15hGlH.js} +1 -1
  67. package/dist/assets/{slides-component-CQV79Kcl.js → slides-component-DnmPfY3n.js} +1 -1
  68. package/dist/assets/{sortBy-BgBAOEIP.js → sortBy-CWOFqA8G.js} +1 -1
  69. package/dist/assets/{stateDiagram-DGXRK772-Dc2uEnrY.js → stateDiagram-DGXRK772-Byf22nBu.js} +1 -1
  70. package/dist/assets/stateDiagram-v2-YXO3MK2T-D-WdSfy8.js +1 -0
  71. package/dist/assets/{terminal-b9nk-hZF.js → terminal-BJo7QKo6.js} +1 -1
  72. package/dist/assets/{time-BmB9hLf_.js → time-BWckLNMS.js} +1 -1
  73. package/dist/assets/{timeline-definition-BDJGKUSR-DxhV0lxZ.js → timeline-definition-BDJGKUSR-Cjik3YbC.js} +1 -1
  74. package/dist/assets/{tracing-Bu5thwnL.js → tracing-CC2PMHd9.js} +3 -3
  75. package/dist/assets/{tree-0UUXLt1Y.js → tree-wo4SadIU.js} +1 -1
  76. package/dist/assets/{useMarimoWebSocket-CRb2JgtF.js → useMarimoWebSocket-D39uAvcO.js} +3 -3
  77. package/dist/assets/{vega-component-D1a0J15Z.js → vega-component-CqXoyphd.js} +1 -1
  78. package/dist/assets/{xychartDiagram-VJFVF3MP-BAb2BrYZ.js → xychartDiagram-VJFVF3MP-B2dg_eBE.js} +1 -1
  79. package/dist/index.html +1 -1
  80. package/package.json +1 -1
  81. package/dist/assets/_baseMap-LCyDUswt.js +0 -1
  82. package/dist/assets/channel-DUnXq75q.js +0 -1
  83. package/dist/assets/classDiagram-GIVACNV2-B90XJA0V.js +0 -1
  84. package/dist/assets/classDiagram-v2-COTLJTTW-B90XJA0V.js +0 -1
  85. package/dist/assets/clone-BSLc6jsQ.js +0 -1
  86. package/dist/assets/stateDiagram-v2-YXO3MK2T-D9yGEeZ2.js +0 -1
@@ -1 +1 @@
1
- var e,t,n,r,i,s,a,o,l,c,u,d,h,p=Object.defineProperty,f=(e,t,n)=>((e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);import{n9 as m,df as g,r as y,cL as T,P as v,d0 as R,aw as E,d5 as A,d6 as k,H as $,K as x,J as S,bU as I,na as N,d7 as C,cU as w,nb as L,az as O,cW as _,av as b,nc as P,d1 as M,nd as D,d9 as U,O as G,ay as F,bY as B,ne as K,nf as V,ng as j,nh as H,al as W}from"./index-D2omUdzR.js";import{b as z,a as Y}from"./_baseEach-rAXZtelz.js";import{g as q,v as X,h as Q,j as J,k as Z,a as ee,c as te,i as ne,r as re,f as ie,n as se}from"./_baseUniq-D66Qo79c.js";import{m as ae,f as oe,h as le,d as ce,l as ue,c as de}from"./min-RICAEQQK.js";import{a9 as he}from"./mermaid-zU1sahUk.js";import{c as pe}from"./clone-BSLc6jsQ.js";var fe=Object.prototype.hasOwnProperty,me=m((function(e,t){if(g(t)||y(t))T(t,v(t),e);else for(var n in t)fe.call(t,n)&&R(e,n,t[n])}));function ge(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var s=e[t];s&&(i[r++]=s)}return i}function ye(e,t,n,r){for(var i=-1,s=null==e?0:e.length;++i<s;){var a=e[i];t(r,a,n(a),e)}return r}function Te(e,t,n,r){return z(e,(function(e,i,s){t(r,e,n(e),s)})),r}var ve=$((function(e,t){return x(e)?function(e,t,n,r){var i=-1,s=q,a=!0,o=e.length,l=[],c=t.length;if(!o)return l;t.length>=200&&(s=k,a=!1,t=new A(t));e:for(;++i<o;){var u=e[i],d=u;if(u=0!==u?u:0,a&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else s(t,d,r)||l.push(u)}return l}(e,S(t,1,x,!0)):[]}));function Re(e,t,n){var r=null==e?0:e.length;return r?(t=void 0===t?1:I(t),N(e,t<0?0:t,r)):[]}function Ee(e,t,n){var r=null==e?0:e.length;return r?(t=void 0===t?1:I(t),N(e,0,(t=r-t)<0?0:t)):[]}function Ae(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ke(e,t){var n=!0;return z(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function $e(e,t,n){return(E(e)?Ae:ke)(e,Y(t))}function xe(e){return e&&e.length?e[0]:void 0}function Se(e,t){return S(ae(e,t))}var Ie,Ne,Ce=Object.prototype.hasOwnProperty,we=(Ie=function(e,t,n){Ce.call(e,n)?e[n].push(t):C(e,n,[t])},function(e,t){var n=E(e)?ye:Te,r=Ne?Ne():{};return n(e,Ie,Y(t),r)});function Le(e){return"string"==typeof e||!E(e)&&w(e)&&"[object String]"==L(e)}var Oe=Math.max;function _e(e,t,n,r){e=y(e)?e:X(e),n=n?I(n):0;var i=e.length;return n<0&&(n=Oe(i+n,0)),Le(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Q(e,t,n)>-1}function be(e,t,n){if(!(null==e?0:e.length))return-1;return Q(e,t,0)}var Pe=_&&_.isRegExp,Me=Pe?O(Pe):function(e){return w(e)&&"[object RegExp]"==L(e)};function De(e,t){if(null==e)return{};var n=b(J(e),(function(e){return[e]}));return t=Y(t),P(e,n,(function(e,n){return t(e,n[0])}))}function Ue(e,t){return(E(e)?M:Z)(e,function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}(Y(t)))}function Ge(e,t){var n;return z(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Fe(e,t,n){return(E(e)?D:Ge)(e,Y(t))}function Be(e){return e&&e.length?ee(e):[]}function Ke(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$type}function Ve(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$refText}function je(e){return"object"==typeof e&&null!==e&&Ke(e.container)&&Ve(e.reference)&&"string"==typeof e.message}class He{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return Ke(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 r=n[t];if(void 0!==r)return r;{const r=this.computeIsSubtype(e,t);return n[t]=r,r}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const t=this.getAllTypes(),n=[];for(const r of t)this.isSubtype(r,e)&&n.push(r);return this.allSubtypes[e]=n,n}}}function We(e){return"object"==typeof e&&null!==e&&Array.isArray(e.content)}function ze(e){return"object"==typeof e&&null!==e&&"object"==typeof e.tokenType}function Ye(e){return We(e)&&"string"==typeof e.fullText}class qe{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(){const e=this.iterator();return Boolean(e.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(),void 0!==n.value&&e.push(n.value)}while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){const n=this.map((n=>[e?e(n):n,t?t(n):n]));return new Map(n)}toString(){return this.join()}concat(e){return new qe((()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()})),(e=>{let t;if(!e.firstDone){do{if(t=this.nextFn(e.first),!t.done)return t}while(!t.done);e.firstDone=!0}do{if(t=e.iterator.next(),!t.done)return t}while(!t.done);return Ze}))}join(e=","){const t=this.iterator();let n,r="",i=!1;do{n=t.next(),n.done||(i&&(r+=e),r+=Xe(n.value)),i=!0}while(!n.done);return r}indexOf(e,t=0){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(r>=t&&i.value===e)return r;i=n.next(),r++}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,r=t.next();for(;!r.done;)e(r.value,n),r=t.next(),n++}map(e){return new qe(this.startFn,(t=>{const{done:n,value:r}=this.nextFn(t);return n?Ze:{done:!1,value:e(r)}}))}filter(e){return new qe(this.startFn,(t=>{let n;do{if(n=this.nextFn(t),!n.done&&e(n.value))return n}while(!n.done);return Ze}))}nonNullable(){return this.filter((e=>null!=e))}reduce(e,t){const n=this.iterator();let r=t,i=n.next();for(;!i.done;)r=void 0===r?i.value:e(r,i.value),i=n.next();return r}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){const r=e.next();if(r.done)return n;const i=this.recursiveReduce(e,t,n);return void 0===i?r.value:t(i,r.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,r=t.next();for(;!r.done;){if(e(r.value))return n;r=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 qe((()=>({this:this.startFn()})),(t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}const{done:n,value:r}=this.nextFn(t.this);if(!n){const n=e(r);if(!Qe(n))return{done:!1,value:n};t.iterator=n[Symbol.iterator]()}}while(t.iterator);return Ze}))}flat(e){if(void 0===e&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new qe((()=>({this:t.startFn()})),(e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}const{done:n,value:r}=t.nextFn(e.this);if(!n){if(!Qe(r))return{done:!1,value:r};e.iterator=r[Symbol.iterator]()}}while(e.iterator);return Ze}))}head(){const e=this.iterator().next();if(!e.done)return e.value}tail(e=1){return new qe((()=>{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 qe((()=>({size:0,state:this.startFn()})),(t=>(t.size++,t.size>e?Ze:this.nextFn(t.state))))}distinct(e){return new qe((()=>({set:new Set,internalState:this.startFn()})),(t=>{let n;do{if(n=this.nextFn(t.internalState),!n.done){const r=e?e(n.value):n.value;if(!t.set.has(r))return t.set.add(r),n}}while(!n.done);return Ze}))}exclude(e,t){const n=new Set;for(const r of e){const e=t?t(r):r;n.add(e)}return this.filter((e=>{const r=t?t(e):e;return!n.has(r)}))}}function Xe(e){return"string"==typeof e?e:void 0===e?"undefined":"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}function Qe(e){return!!e&&"function"==typeof e[Symbol.iterator]}const Je=new qe((()=>{}),(()=>Ze)),Ze=Object.freeze({done:!0,value:void 0});function et(...e){if(1===e.length){const t=e[0];if(t instanceof qe)return t;if(Qe(t))return new qe((()=>t[Symbol.iterator]()),(e=>e.next()));if("number"==typeof t.length)return new qe((()=>({index:0})),(e=>e.index<t.length?{done:!1,value:t[e.index++]}:Ze))}return e.length>1?new qe((()=>({collIndex:0,arrIndex:0})),(t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}if(t.array){if(t.arrIndex<t.array.length)return{done:!1,value:t.array[t.arrIndex++]};t.array=void 0,t.arrIndex=0}if(t.collIndex<e.length){const n=e[t.collIndex++];Qe(n)?t.iterator=n[Symbol.iterator]():n&&"number"==typeof n.length&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return Ze})):Je}class tt extends qe{constructor(e,t,n){super((()=>({iterators:(null==n?void 0:n.includeRoot)?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1})),(e=>{for(e.pruned&&(e.iterators.pop(),e.pruned=!1);e.iterators.length>0;){const n=e.iterators[e.iterators.length-1].next();if(!n.done)return e.iterators.push(t(n.value)[Symbol.iterator]()),n;e.iterators.pop()}return Ze}))}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var nt,rt,it,st;function at(e){return new tt(e,(e=>We(e)?e.content:[]),{includeRoot:!0})}function ot(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function lt(e){if(!e)return;const{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}function ct(e,t){const n=function(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return it.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return it.After;const n=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,r=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return n&&r?it.Inside:n?it.OverlapBack:r?it.OverlapFront:it.Outside}(e,t);return n>it.After}(rt=nt||(nt={})).sum=function(e){return e.reduce(((e,t)=>e+t),0)},rt.product=function(e){return e.reduce(((e,t)=>e*t),0)},rt.min=function(e){return e.reduce(((e,t)=>Math.min(e,t)))},rt.max=function(e){return e.reduce(((e,t)=>Math.max(e,t)))},(st=it||(it={}))[st.Before=0]="Before",st[st.After=1]="After",st[st.OverlapFront=2]="OverlapFront",st[st.OverlapBack=3]="OverlapBack",st[st.Inside=4]="Inside",st[st.Outside=5]="Outside";const ut=/^[\w\p{L}]$/u;function dt(e,t){return ze(e)&&t.includes(e.tokenType.name)}class ht extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function pt(e){throw new Error("Error! The input value was not handled.")}const ft="AbstractRule",mt="AbstractType",gt="Condition",yt="TypeDefinition",Tt="ValueLiteral",vt="AbstractElement";const Rt="ArrayLiteral",Et="ArrayType",At="BooleanLiteral";const kt="Conjunction";const $t="Disjunction";const xt="Grammar",St="GrammarImport",It="InferredType";function Nt(e){return En.isInstance(e,It)}const Ct="Interface";function wt(e){return En.isInstance(e,Ct)}const Lt="NamedArgument",Ot="Negation";const _t="NumberLiteral",bt="Parameter",Pt="ParameterReference";const Mt="ParserRule";function Dt(e){return En.isInstance(e,Mt)}const Ut="ReferenceType",Gt="ReturnType";const Ft="SimpleType";const Bt="StringLiteral",Kt="TerminalRule";function Vt(e){return En.isInstance(e,Kt)}const jt="Type";function Ht(e){return En.isInstance(e,jt)}const Wt="TypeAttribute",zt="UnionType",Yt="Action";function qt(e){return En.isInstance(e,Yt)}const Xt="Alternatives";function Qt(e){return En.isInstance(e,Xt)}const Jt="Assignment";function Zt(e){return En.isInstance(e,Jt)}const en="CharacterRange";const tn="CrossReference";function nn(e){return En.isInstance(e,tn)}const rn="EndOfFile";const sn="Group";function an(e){return En.isInstance(e,sn)}const on="Keyword";function ln(e){return En.isInstance(e,on)}const cn="NegatedToken";const un="RegexToken";const dn="RuleCall";function hn(e){return En.isInstance(e,dn)}const pn="TerminalAlternatives";const fn="TerminalGroup";const mn="TerminalRuleCall";const gn="UnorderedGroup";function yn(e){return En.isInstance(e,gn)}const Tn="UntilToken";const vn="Wildcard";class Rn extends He{getAllTypes(){return[vt,ft,mt,Yt,Xt,Rt,Et,Jt,At,en,gt,kt,tn,$t,rn,xt,St,sn,It,Ct,on,Lt,cn,Ot,_t,bt,Pt,Mt,Ut,un,Gt,dn,Ft,Bt,pn,fn,Kt,mn,jt,Wt,yt,zt,gn,Tn,Tt,vn]}computeIsSubtype(e,t){switch(e){case Yt:case Xt:case Jt:case en:case tn:case rn:case sn:case on:case cn:case un:case dn:case pn:case fn:case mn:case gn:case Tn:case vn:return this.isSubtype(vt,t);case Rt:case _t:case Bt:return this.isSubtype(Tt,t);case Et:case Ut:case Ft:case zt:return this.isSubtype(yt,t);case At:return this.isSubtype(gt,t)||this.isSubtype(Tt,t);case kt:case $t:case Ot:case Pt:return this.isSubtype(gt,t);case It:case Ct:case jt:return this.isSubtype(mt,t);case Mt:return this.isSubtype(ft,t)||this.isSubtype(mt,t);case Kt:return this.isSubtype(ft,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 mt;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return ft;case"Grammar:usedGrammars":return xt;case"NamedArgument:parameter":case"ParameterReference:parameter":return bt;case"TerminalRuleCall:rule":return Kt;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case vt:return{name:vt,properties:[{name:"cardinality"},{name:"lookahead"}]};case Rt:return{name:Rt,properties:[{name:"elements",defaultValue:[]}]};case Et:return{name:Et,properties:[{name:"elementType"}]};case At:return{name:At,properties:[{name:"true",defaultValue:!1}]};case kt:return{name:kt,properties:[{name:"left"},{name:"right"}]};case $t:return{name:$t,properties:[{name:"left"},{name:"right"}]};case xt:return{name:xt,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 St:return{name:St,properties:[{name:"path"}]};case It:return{name:It,properties:[{name:"name"}]};case Ct:return{name:Ct,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Lt:return{name:Lt,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Ot:return{name:Ot,properties:[{name:"value"}]};case _t:return{name:_t,properties:[{name:"value"}]};case bt:return{name:bt,properties:[{name:"name"}]};case Pt:return{name:Pt,properties:[{name:"parameter"}]};case Mt:return{name:Mt,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 Ut:return{name:Ut,properties:[{name:"referenceType"}]};case Gt:return{name:Gt,properties:[{name:"name"}]};case Ft:return{name:Ft,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case Bt:return{name:Bt,properties:[{name:"value"}]};case Kt:return{name:Kt,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case jt:return{name:jt,properties:[{name:"name"},{name:"type"}]};case Wt:return{name:Wt,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case zt:return{name:zt,properties:[{name:"types",defaultValue:[]}]};case Yt:return{name:Yt,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Xt:return{name:Xt,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Jt:return{name:Jt,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case en:return{name:en,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case tn:return{name:tn,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case rn:return{name:rn,properties:[{name:"cardinality"},{name:"lookahead"}]};case sn:return{name:sn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case on:return{name:on,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case cn:return{name:cn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case un:return{name:un,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case dn:return{name:dn,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case pn:return{name:pn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case fn:return{name:fn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case mn:return{name:mn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case gn:return{name:gn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Tn:return{name:Tn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case vn:return{name:vn,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const En=new Rn;function An(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function kn(e){const t=$n(e).$document;if(!t)throw new Error("AST node has no document.");return t}function $n(e){for(;e.$container;)e=e.$container;return e}function xn(e,t){if(!e)throw new Error("Node must be an AstNode.");const n=null==t?void 0:t.range;return new qe((()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0})),(t=>{for(;t.keyIndex<t.keys.length;){const r=t.keys[t.keyIndex];if(!r.startsWith("$")){const i=e[r];if(Ke(i)){if(t.keyIndex++,Nn(i,n))return{done:!1,value:i}}else if(Array.isArray(i)){for(;t.arrayIndex<i.length;){const e=i[t.arrayIndex++];if(Ke(e)&&Nn(e,n))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return Ze}))}function Sn(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new tt(e,(e=>xn(e,t)))}function In(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new tt(e,(e=>xn(e,t)),{includeRoot:!0})}function Nn(e,t){var n;if(!t)return!0;const r=null===(n=e.$cstNode)||void 0===n?void 0:n.range;return!!r&&ct(r,t)}function Cn(e){return new qe((()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0})),(t=>{for(;t.keyIndex<t.keys.length;){const n=t.keys[t.keyIndex];if(!n.startsWith("$")){const r=e[n];if(Ve(r))return t.keyIndex++,{done:!1,value:{reference:r,container:e,property:n}};if(Array.isArray(r)){for(;t.arrayIndex<r.length;){const i=t.arrayIndex++,s=r[i];if(Ve(s))return{done:!1,value:{reference:s,container:e,property:n,index:i}}}t.arrayIndex=0}}t.keyIndex++}return Ze}))}function wn(e){return Array.isArray(e)?[...e.map(wn)]:e}function Ln(e){return e.charCodeAt(0)}function On(e,t){Array.isArray(e)?e.forEach((function(e){t.push(e)})):t.push(e)}function _n(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function bn(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function Pn(e){return"Character"===e.type}const Mn=[];for(let dd=Ln("0");dd<=Ln("9");dd++)Mn.push(dd);const Dn=[Ln("_")].concat(Mn);for(let dd=Ln("a");dd<=Ln("z");dd++)Dn.push(dd);for(let dd=Ln("A");dd<=Ln("Z");dd++)Dn.push(dd);const Un=[Ln(" "),Ln("\f"),Ln("\n"),Ln("\r"),Ln("\t"),Ln("\v"),Ln("\t"),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln("\u2028"),Ln("\u2029"),Ln(" "),Ln(" "),Ln(" "),Ln("\ufeff")],Gn=/[0-9a-fA-F]/,Fn=/[0-9]/,Bn=/[1-9]/;class Kn{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":_n(n,"global");break;case"i":_n(n,"ignoreCase");break;case"m":_n(n,"multiLine");break;case"u":_n(n,"unicode");break;case"y":_n(n,"sticky")}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"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead"}bn(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return function(){throw Error("Internal Error - Should never get here!")}()}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 n=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:n,atMost:n};break;case",":let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;bn(t)}if(!0!==e||void 0!==t)return bn(t)?("?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t):void 0}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()}if(void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),bn(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[Ln("\n"),Ln("\r"),Ln("\u2028"),Ln("\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=Mn;break;case"D":e=Mn,t=!0;break;case"s":e=Un;break;case"S":e=Un,t=!0;break;case"w":e=Dn;break;case"W":e=Dn,t=!0}if(bn(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=Ln("\f");break;case"n":e=Ln("\n");break;case"r":e=Ln("\r");break;case"t":e=Ln("\t");break;case"v":e=Ln("\v")}if(bn(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:Ln("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:Ln(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:Ln(this.popChar())}}}characterClass(){const e=[];let t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const t=this.classAtom();if(t.type,Pn(t)&&this.isRangeDash()){this.consumeChar("-");const n=this.classAtom();if(n.type,Pn(n)){if(n.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:n.value})}else On(t.value,e),e.push(Ln("-")),On(n.value,e)}else On(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":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:Ln("\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;if(this.consumeChar("("),"?"===this.peekChar(0))this.consumeChar("?"),this.consumeChar(":"),e=!1;else this.groupIdx++;const t=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(!1===Bn.test(e))throw Error("Expecting a positive integer");for(;Fn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===Fn.test(e))throw Error("Expecting an integer");for(;Fn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case"\n":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:Ln(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 Fn.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":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 void 0!==this.quantifier(!0)}catch(t){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let n=0;n<e;n++){const e=this.popChar();if(!1===Gn.test(e))throw Error("Expecting a HexDecimal digits");t+=e}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(void 0!==e&&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 Vn{visitChildren(e){for(const t in e){const n=e[t];e.hasOwnProperty(t)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach((e=>{this.visit(e)}),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)}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 jn=/\r?\n/gm,Hn=new Kn;const Wn=new class extends Vn{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||"\n"!==t||(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const e=Xn(t);this.endRegexpStack.push(e),this.isStarting&&(this.startRegexp+=e)}}visitSet(e){if(!this.multiline){const t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=Boolean("\n".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){if("Group"===e.type){if(e.quantifier)return}super.visitChildren(e)}};function zn(e){try{return"string"==typeof e&&(e=new RegExp(e)),e=e.toString(),Wn.reset(e),Wn.visit(Hn.pattern(e)),Wn.multiline}catch(t){return!1}}const Yn="\f\n\r\t\v              \u2028\u2029   \ufeff".split("");function qn(e){const t="string"==typeof e?new RegExp(e):e;return Yn.some((e=>t.test(e)))}function Xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qn(e,t){const n=function(e){"string"==typeof e&&(e=new RegExp(e));const t=e,n=e.source;let r=0;function i(){let e,s="";function a(e){s+=n.substr(r,e),r+=e}function o(e){s+="(?:"+n.substr(r,e)+"|$)",r+=e}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":o(3);break;case"x":o(4);break;case"u":t.unicode?"{"===n[r+2]?o(n.indexOf("}",r)-r+1):o(6):o(2);break;case"p":case"P":t.unicode?o(n.indexOf("}",r)-r+1):o(2);break;case"k":o(n.indexOf(">",r)-r+1);break;default:o(2)}break;case"[":e=/\[(?:\\.|.)*?\]/g,e.lastIndex=r,e=e.exec(n)||[],o(e[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":e=/\{\d+,?\d*\}/g,e.lastIndex=r,e=e.exec(n),e?a(e[0].length):o(1);break;case"(":if("?"===n[r+1])switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":e=r,r+=3,i(),s+=n.substr(e,r-e);break;case"<":switch(n[r+3]){case"=":case"!":e=r,r+=4,i(),s+=n.substr(e,r-e);break;default:a(n.indexOf(">",r)-r+1),s+=i()+"|$)"}}else a(1),s+=i()+"|$)";break;case")":return++r,s;default:o(1)}return s}return new RegExp(i(),e.flags)}(e),r=t.match(n);return!!r&&r[0].length>0}function Jn(e,t){const n=new Set,r=function(e){return e.rules.find((e=>Dt(e)&&e.entry))}(e);if(!r)return new Set(e.rules);const i=[r].concat(function(e){return e.rules.filter((e=>Vt(e)&&e.hidden))}(e));for(const a of i)Zn(a,n,t);const s=new Set;for(const a of e.rules)(n.has(a.name)||Vt(a)&&a.hidden)&&s.add(a);return s}function Zn(e,t,n){t.add(e.name),Sn(e).forEach((e=>{if(hn(e)||n){const r=e.rule.ref;r&&!t.has(r.name)&&Zn(r,t,n)}}))}function er(e,t,n){if(!e||!t)return;const r=tr(e,t,e.astNode,!0);return 0!==r.length?r[n=void 0!==n?Math.max(0,Math.min(n,r.length-1)):0]:void 0}function tr(e,t,n,r){if(!r){const n=An(e.grammarSource,Zt);if(n&&n.feature===t)return[e]}return We(e)&&e.astNode===n?e.content.flatMap((e=>tr(e,t,n,!1))):[]}function nr(e,t,n){if(!e)return;const r=function(e,t,n){if(e.astNode!==n)return[];if(ln(e.grammarSource)&&e.grammarSource.value===t)return[e];const r=at(e).iterator();let i;const s=[];do{if(i=r.next(),!i.done){const e=i.value;e.astNode===n?ln(e.grammarSource)&&e.grammarSource.value===t&&s.push(e):r.prune()}}while(!i.done);return s}(e,t,null==e?void 0:e.astNode);return 0!==r.length?r[n=void 0!==n?Math.max(0,Math.min(n,r.length-1)):0]:void 0}function rr(e){let t=e;return Nt(t)&&(qt(t.$container)?t=t.$container.$container:Dt(t.$container)?t=t.$container:pt(t.$container)),ir(e,t,new Map)}function ir(e,t,n){var r,i;function s(t,r){let i;return An(t,Zt)||(i=ir(r,r,n)),n.set(e,i),i}if(n.has(e))return n.get(e);n.set(e,void 0);for(const a of Sn(t)){if(Zt(a)&&"name"===a.feature.toLowerCase())return n.set(e,a),a;if(hn(a)&&Dt(a.rule.ref))return s(a,a.rule.ref);if(i=a,En.isInstance(i,Ft)&&(null===(r=a.typeRef)||void 0===r?void 0:r.ref))return s(a,a.typeRef.ref)}}function sr(e){return ar(e,new Set)}function ar(e,t){if(t.has(e))return!0;t.add(e);for(const n of Sn(e))if(hn(n)){if(!n.rule.ref)return!1;if(Dt(n.rule.ref)&&!ar(n.rule.ref,t))return!1}else{if(Zt(n))return!1;if(qt(n))return!1}return Boolean(e.definition)}function or(e){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){const t=e.returnType.ref;if(t){if(Dt(t))return t.name;if(wt(t)||Ht(t))return t.name}}}function lr(e){var t,n;if(Dt(e))return sr(e)?e.name:null!==(t=or(e))&&void 0!==t?t:e.name;if(wt(e)||Ht(e)||(n=e,En.isInstance(n,Gt)))return e.name;if(qt(e)){const t=function(e){var t;if(e.inferredType)return e.inferredType.name;if(null===(t=e.type)||void 0===t?void 0:t.ref)return lr(e.type.ref);return}(e);if(t)return t}else if(Nt(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function cr(e){const t={s:!1,i:!1,u:!1},n=dr(e.definition,t),r=Object.entries(t).filter((([,e])=>e)).map((([e])=>e)).join("");return new RegExp(n,r)}const ur=/[\s\S]/.source;function dr(e,t){if(a=e,En.isInstance(a,pn))return pr((s=e).elements.map((e=>dr(e))).join("|"),{cardinality:s.cardinality,lookahead:s.lookahead});if(function(e){return En.isInstance(e,fn)}(e))return pr((i=e).elements.map((e=>dr(e))).join(""),{cardinality:i.cardinality,lookahead:i.lookahead});if(function(e){return En.isInstance(e,en)}(e))return function(e){if(e.right)return pr(`[${hr(e.left)}-${hr(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1});return pr(hr(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}(e);if(function(e){return En.isInstance(e,mn)}(e)){const t=e.rule.ref;if(!t)throw new Error("Missing rule reference.");return pr(dr(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead})}if(function(e){return En.isInstance(e,cn)}(e))return pr(`(?!${dr((r=e).terminal)})${ur}*?`,{cardinality:r.cardinality,lookahead:r.lookahead});if(function(e){return En.isInstance(e,Tn)}(e))return pr(`${ur}*?${dr((n=e).terminal)}`,{cardinality:n.cardinality,lookahead:n.lookahead});if(function(e){return En.isInstance(e,un)}(e)){const n=e.regex.lastIndexOf("/"),r=e.regex.substring(1,n),i=e.regex.substring(n+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),pr(r,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}if(function(e){return En.isInstance(e,vn)}(e))return pr(ur,{cardinality:e.cardinality,lookahead:e.lookahead});throw new Error(`Invalid terminal element: ${null==e?void 0:e.$type}`);var n,r,i,s,a}function hr(e){return Xn(e.value)}function pr(e,t){var n;return(!1!==t.wrap||t.lookahead)&&(e=`(${null!==(n=t.lookahead)&&void 0!==n?n:""}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function fr(e){console&&console.error&&console.error(`Error: ${e}`)}function mr(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function gr(e){const t=(new Date).getTime(),n=e();return{time:(new Date).getTime()-t,value:n}}function yr(e){function t(){}t.prototype=e;const n=new t;function r(){return typeof n.bar}return r(),r(),e}function Tr(e){return Le((t=e).LABEL)&&""!==t.LABEL?e.LABEL:e.name;var t}class vr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),te(this.definition,(t=>{t.accept(e)}))}}class Rr extends vr{constructor(e){super([]),this.idx=1,me(this,De(e,(e=>void 0!==e)))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Er extends vr{constructor(e){super(e.definition),this.orgText="",me(this,De(e,(e=>void 0!==e)))}}class Ar extends vr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,me(this,De(e,(e=>void 0!==e)))}}let kr=class extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}};class $r extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class xr extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class Sr extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class Ir extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class Nr extends vr{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,me(this,De(e,(e=>void 0!==e)))}}class Cr{constructor(e){this.idx=1,me(this,De(e,(e=>void 0!==e)))}accept(e){e.visit(this)}}function wr(e){function t(e){return ae(e,wr)}if(e instanceof Rr){const t={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return Le(e.label)&&(t.label=e.label),t}if(e instanceof Ar)return{type:"Alternative",definition:t(e.definition)};if(e instanceof kr)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof $r)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof xr)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:wr(new Cr({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Ir)return{type:"RepetitionWithSeparator",idx:e.idx,separator:wr(new Cr({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Sr)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof Nr)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof Cr){const t={type:"Terminal",name:e.terminalType.name,label:Tr(e.terminalType),idx:e.idx};Le(e.label)&&(t.terminalLabel=e.label);const n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=Me(n)?n.source:n),t}if(e instanceof Er)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}class Lr{visit(e){const t=e;switch(t.constructor){case Rr:return this.visitNonTerminal(t);case Ar:return this.visitAlternative(t);case kr:return this.visitOption(t);case $r:return this.visitRepetitionMandatory(t);case xr:return this.visitRepetitionMandatoryWithSeparator(t);case Ir:return this.visitRepetitionWithSeparator(t);case Sr:return this.visitRepetition(t);case Nr:return this.visitAlternation(t);case Cr:return this.visitTerminal(t);case Er: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 Or(e,t=[]){return!!(e instanceof kr||e instanceof Sr||e instanceof Ir)||(e instanceof Nr?Fe(e.definition,(e=>Or(e,t))):!(e instanceof Rr&&_e(t,e))&&(e instanceof vr&&(e instanceof Rr&&t.push(e),$e(e.definition,(e=>Or(e,t))))))}function _r(e){if(e instanceof Rr)return"SUBRULE";if(e instanceof kr)return"OPTION";if(e instanceof Nr)return"OR";if(e instanceof $r)return"AT_LEAST_ONE";if(e instanceof xr)return"AT_LEAST_ONE_SEP";if(e instanceof Ir)return"MANY_SEP";if(e instanceof Sr)return"MANY";if(e instanceof Cr)return"CONSUME";throw Error("non exhaustive match")}class br{walk(e,t=[]){te(e.definition,((n,r)=>{const i=Re(e.definition,r+1);if(n instanceof Rr)this.walkProdRef(n,i,t);else if(n instanceof Cr)this.walkTerminal(n,i,t);else if(n instanceof Ar)this.walkFlat(n,i,t);else if(n instanceof kr)this.walkOption(n,i,t);else if(n instanceof $r)this.walkAtLeastOne(n,i,t);else if(n instanceof xr)this.walkAtLeastOneSep(n,i,t);else if(n instanceof Ir)this.walkManySep(n,i,t);else if(n instanceof Sr)this.walkMany(n,i,t);else{if(!(n instanceof Nr))throw Error("non exhaustive match");this.walkOr(n,i,t)}}))}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){const r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){const r=[new kr({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){const r=Pr(e,t,n);this.walk(e,r)}walkMany(e,t,n){const r=[new kr({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){const r=Pr(e,t,n);this.walk(e,r)}walkOr(e,t,n){const r=t.concat(n);te(e.definition,(e=>{const t=new Ar({definition:[e]});this.walk(t,r)}))}}function Pr(e,t,n){return[new kr({definition:[new Cr({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function Mr(e){if(e instanceof Rr)return Mr(e.referencedRule);if(e instanceof Cr)return[e.terminalType];if(function(e){return e instanceof Ar||e instanceof kr||e instanceof Sr||e instanceof $r||e instanceof xr||e instanceof Ir||e instanceof Cr||e instanceof Er}(e))return function(e){let t=[];const n=e.definition;let r,i=0,s=n.length>i,a=!0;for(;s&&a;)r=n[i],a=Or(r),t=t.concat(Mr(r)),i+=1,s=n.length>i;return Be(t)}(e);if(function(e){return e instanceof Nr}(e))return function(e){const t=ae(e.definition,(e=>Mr(e)));return Be(U(t))}(e);throw Error("non exhaustive match")}const Dr="_~IN~_";class Ur extends br{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 r=(i=e.referencedRule,s=e.idx,i.name+s+Dr+this.topProd.name);var i,s;const a=t.concat(n),o=Mr(new Ar({definition:a}));this.follows[r]=o}}let Gr={};const Fr=new Kn;function Br(e){const t=e.toString();if(Gr.hasOwnProperty(t))return Gr[t];{const e=Fr.pattern(t);return Gr[t]=e,e}}const Kr="Complement Sets are not supported for first char optimization",Vr='Unable to use "first char" lexer optimizations:\n';function jr(e,t=!1){try{const t=Br(e);return Hr(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Kr)t&&mr(`${Vr}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";t&&(n="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),fr(`${Vr}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Hr(e,t,n){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)Hr(e.value[i],t,n);break;case"Alternative":const r=e.value;for(let e=0;e<r.length;e++){const i=r[e];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=i;switch(s.type){case"Character":Wr(s.value,t,n);break;case"Set":if(!0===s.complement)throw Error(Kr);te(s.value,(e=>{if("number"==typeof e)Wr(e,t,n);else{const r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)Wr(e,t,n);else{for(let e=r.from;e<=r.to&&e<fi;e++)Wr(e,t,n);if(r.to>=fi){const e=r.from>=fi?r.from:fi,n=r.to,i=gi(e),s=gi(n);for(let r=i;r<=s;r++)t[r]=r}}}}));break;case"Group":Hr(s.value,t,n);break;default:throw Error("Non Exhaustive Match")}const a=void 0!==s.quantifier&&0===s.quantifier.atLeast;if("Group"===s.type&&!1===Yr(s)||"Group"!==s.type&&!1===a)break}break;default:throw Error("non exhaustive match!")}return X(t)}function Wr(e,t,n){const r=gi(e);t[r]=r,!0===n&&function(e,t){const n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){const e=gi(r.charCodeAt(0));t[e]=e}else{const e=n.toLowerCase();if(e!==n){const n=gi(e.charCodeAt(0));t[n]=n}}}(e,t)}function zr(e,t){return oe(e.value,(e=>{if("number"==typeof e)return _e(t,e);{const n=e;return void 0!==oe(t,(e=>n.from<=e&&e<=n.to))}}))}function Yr(e){const t=e.quantifier;return!(!t||0!==t.atLeast)||!!e.value&&(E(e.value)?$e(e.value,Yr):Yr(e.value))}class qr extends Vn{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}super.visitChildren(e)}}visitCharacter(e){_e(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===zr(e,this.targetCharCodes)&&(this.found=!0):void 0!==zr(e,this.targetCharCodes)&&(this.found=!0)}}function Xr(e,t){if(t instanceof RegExp){const n=Br(t),r=new qr(e);return r.visit(n),r.found}return void 0!==oe(t,(t=>_e(e,t.charCodeAt(0))))}const Qr="PATTERN",Jr="defaultMode",Zr="modes";let ei="boolean"==typeof new RegExp("(?:)").sticky;function ti(e,t){const n=(t=ce(t,{useSticky:ei,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer;let r;n("initCharCodeToOptimizedIndexMap",(()=>{!function(){if(he(mi)){mi=new Array(65536);for(let e=0;e<65536;e++)mi[e]=e>255?255+~~(e/255):e}}()})),n("Reject Lexer.NA",(()=>{r=Ue(e,(e=>e[Qr]===wi.NA))}));let i,s,a,o,l,c,u,d,h,p,f,m=!1;n("Transform Patterns",(()=>{m=!1,i=ae(r,(e=>{const n=e[Qr];if(Me(n)){const e=n.source;return 1!==e.length||"^"===e||"$"===e||"."===e||n.ignoreCase?2!==e.length||"\\"!==e[0]||_e(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?t.useSticky?ai(n):si(n):e[1]:e}if(G(n))return m=!0,{exec:n};if("object"==typeof n)return m=!0,n;if("string"==typeof n){if(1===n.length)return n;{const e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=new RegExp(e);return t.useSticky?ai(r):si(r)}}throw Error("non exhaustive match")}))})),n("misc mapping",(()=>{s=ae(r,(e=>e.tokenTypeIdx)),a=ae(r,(e=>{const t=e.GROUP;if(t!==wi.SKIPPED){if(Le(t))return t;if(ne(t))return!1;throw Error("non exhaustive match")}})),o=ae(r,(e=>{const t=e.LONGER_ALT;if(t){return E(t)?ae(t,(e=>be(r,e))):[be(r,t)]}})),l=ae(r,(e=>e.PUSH_MODE)),c=ae(r,(e=>le(e,"POP_MODE")))})),n("Line Terminator Handling",(()=>{const e=hi(t.lineTerminatorCharacters);u=ae(r,(e=>!1)),"onlyOffset"!==t.positionTracking&&(u=ae(r,(t=>le(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===di(t,e)&&Xr(e,t.PATTERN))))})),n("Misc Mapping #2",(()=>{d=ae(r,li),h=ae(i,ci),p=re(r,((e,t)=>{const n=t.GROUP;return Le(n)&&n!==wi.SKIPPED&&(e[n]=[]),e}),{}),f=ae(i,((e,t)=>({pattern:i[t],longerAlt:o[t],canLineTerminator:u[t],isCustom:d[t],short:h[t],group:a[t],push:l[t],pop:c[t],tokenTypeIdx:s[t],tokenType:r[t]})))}));let g=!0,y=[];return t.safeMode||n("First Char Optimization",(()=>{y=re(r,((e,n,r)=>{if("string"==typeof n.PATTERN){const t=gi(n.PATTERN.charCodeAt(0));pi(e,t,f[r])}else if(E(n.START_CHARS_HINT)){let t;te(n.START_CHARS_HINT,(n=>{const i=gi("string"==typeof n?n.charCodeAt(0):n);t!==i&&(t=i,pi(e,i,f[r]))}))}else if(Me(n.PATTERN))if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&fr(`${Vr}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const i=jr(n.PATTERN,t.ensureOptimizations);he(i)&&(g=!1),te(i,(t=>{pi(e,t,f[r])}))}else t.ensureOptimizations&&fr(`${Vr}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e}),[])})),{emptyGroups:p,patternIdxToConfig:f,charCodeToPatternIdxToConfig:y,hasCustom:m,canBeOptimized:g}}function ni(e,t){let n=[];const r=function(e){const t=ie(e,(e=>!le(e,Qr))),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:Ii.MISSING_PATTERN,tokenTypes:[e]}))),r=ve(e,t);return{errors:n,valid:r}}(e);n=n.concat(r.errors);const i=function(e){const t=ie(e,(e=>{const t=e[Qr];return!(Me(t)||G(t)||le(t,"exec")||Le(t))})),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Ii.INVALID_PATTERN,tokenTypes:[e]}))),r=ve(e,t);return{errors:n,valid:r}}(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[];const n=ie(e,(e=>Me(e[Qr])));return t=t.concat(function(e){class t extends Vn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}const n=ie(e,(e=>{const n=e.PATTERN;try{const e=Br(n),r=new t;return r.visit(e),r.found}catch(r){return ri.test(n.source)}})),r=ae(n,(e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:Ii.EOI_ANCHOR_FOUND,tokenTypes:[e]})));return r}(n)),t=t.concat(function(e){class t extends Vn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}const n=ie(e,(e=>{const n=e.PATTERN;try{const e=Br(n),r=new t;return r.visit(e),r.found}catch(r){return ii.test(n.source)}})),r=ae(n,(e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:Ii.SOI_ANCHOR_FOUND,tokenTypes:[e]})));return r}(n)),t=t.concat(function(e){const t=ie(e,(e=>{const t=e[Qr];return t instanceof RegExp&&(t.multiline||t.global)})),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Ii.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]})));return n}(n)),t=t.concat(function(e){const t=[];let n=ae(e,(n=>re(e,((e,r)=>(n.PATTERN.source!==r.PATTERN.source||_e(t,r)||r.PATTERN===wi.NA||(t.push(r),e.push(r)),e)),[])));n=ge(n);const r=ie(n,(e=>e.length>1)),i=ae(r,(e=>{const t=ae(e,(e=>e.name));return{message:`The same RegExp pattern ->${xe(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:Ii.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}}));return i}(n)),t=t.concat(function(e){const t=ie(e,(e=>e.PATTERN.test(""))),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:Ii.EMPTY_MATCH_PATTERN,tokenTypes:[e]})));return n}(n)),t}(s)),n=n.concat(function(e){const t=ie(e,(e=>{if(!le(e,"GROUP"))return!1;const t=e.GROUP;return t!==wi.SKIPPED&&t!==wi.NA&&!Le(t)})),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Ii.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]})));return n}(s)),n=n.concat(function(e,t){const n=ie(e,(e=>void 0!==e.PUSH_MODE&&!_e(t,e.PUSH_MODE))),r=ae(n,(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:Ii.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]})));return r}(s,t)),n=n.concat(function(e){const t=[],n=re(e,((e,t,n)=>{const r=t.PATTERN;return r===wi.NA||(Le(r)?e.push({str:r,idx:n,tokenType:t}):Me(r)&&(i=r,void 0===oe([".","\\","[","]","|","^","$","(",")","?","*","+","{"],(e=>-1!==i.source.indexOf(e))))&&e.push({str:r.source,idx:n,tokenType:t})),e;var i}),[]);return te(e,((e,r)=>{te(n,(({str:n,idx:i,tokenType:s})=>{if(r<i&&function(e,t){if(Me(t)){const n=t.exec(e);return null!==n&&0===n.index}if(G(t))return t(e,0,[],{});if(le(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(n,e.PATTERN)){const n=`Token: ->${s.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:Ii.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}}))})),t}(s)),n}const ri=/[^\\][$]/;const ii=/[^\\[][\^]|^\^/;function si(e){const t=e.ignoreCase?"i":"";return new RegExp(`^(?:${e.source})`,t)}function ai(e){const t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function oi(e,t,n){const r=[];let i=!1;const s=Ue(ge(U(X(e.modes))),(e=>e[Qr]===wi.NA)),a=hi(n);return t&&te(s,(e=>{const t=di(e,a);if(!1!==t){const n=function(e,t){if(t.issue===Ii.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===Ii.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(e,t),i={message:n,type:t.issue,tokenType:e};r.push(i)}else le(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(i=!0):Xr(a,e.PATTERN)&&(i=!0)})),t&&!i&&r.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n\tfor details.",type:Ii.NO_LINE_BREAKS_FLAGS}),r}function li(e){const t=e.PATTERN;if(Me(t))return!1;if(G(t))return!0;if(le(t,"exec"))return!0;if(Le(t))return!1;throw Error("non exhaustive match")}function ci(e){return!(!Le(e)||1!==e.length)&&e.charCodeAt(0)}const ui={test:function(e){const t=e.length;for(let n=this.lastIndex;n<t;n++){const t=e.charCodeAt(n);if(10===t)return this.lastIndex=n+1,!0;if(13===t)return 10===e.charCodeAt(n+1)?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function di(e,t){if(le(e,"LINE_BREAKS"))return!1;if(Me(e.PATTERN)){try{Xr(t,e.PATTERN)}catch(n){return{issue:Ii.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}if(Le(e.PATTERN))return!1;if(li(e))return{issue:Ii.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function hi(e){return ae(e,(e=>Le(e)?e.charCodeAt(0):e))}function pi(e,t,n){void 0===e[t]?e[t]=[n]:e[t].push(n)}const fi=256;let mi=[];function gi(e){return e<fi?e:mi[e]}function yi(e,t){const n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function Ti(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let vi=1;const Ri={};function Ei(e){const t=function(e){let t=pe(e),n=e,r=!0;for(;r;){n=ge(U(ae(n,(e=>e.CATEGORIES))));const e=ve(n,t);t=t.concat(e),he(e)?r=!1:n=e}return t}(e);!function(e){te(e,(e=>{ki(e)||(Ri[vi]=e,e.tokenTypeIdx=vi++),$i(e)&&!E(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),$i(e)||(e.CATEGORIES=[]),le(e,"categoryMatches")||(e.categoryMatches=[]),function(e){return le(e,"categoryMatchesMap")}(e)||(e.categoryMatchesMap={})}))}(t),function(e){te(e,(e=>{Ai([],e)}))}(t),function(e){te(e,(e=>{e.categoryMatches=[],te(e.categoryMatchesMap,((t,n)=>{e.categoryMatches.push(Ri[n].tokenTypeIdx)}))}))}(t),te(t,(e=>{e.isParent=e.categoryMatches.length>0}))}function Ai(e,t){te(e,(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0})),te(t.CATEGORIES,(n=>{const r=e.concat(t);_e(r,n)||Ai(r,n)}))}function ki(e){return le(e,"tokenTypeIdx")}function $i(e){return le(e,"CATEGORIES")}function xi(e){return le(e,"tokenTypeIdx")}const Si={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`};var Ii,Ni;(Ni=Ii||(Ii={}))[Ni.MISSING_PATTERN=0]="MISSING_PATTERN",Ni[Ni.INVALID_PATTERN=1]="INVALID_PATTERN",Ni[Ni.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",Ni[Ni.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",Ni[Ni.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",Ni[Ni.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",Ni[Ni.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",Ni[Ni.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",Ni[Ni.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",Ni[Ni.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",Ni[Ni.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",Ni[Ni.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",Ni[Ni.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",Ni[Ni.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",Ni[Ni.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",Ni[Ni.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",Ni[Ni.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",Ni[Ni.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const Ci={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Si,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Ci);class wi{constructor(e,t=Ci){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=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=gr(t),s=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=me({},Ci,t);const n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof n&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",(()=>{let n,r=!0;this.TRACE_INIT("Lexer Config handling",(()=>{if(this.config.lineTerminatorsPattern===Ci.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ui;else if(this.config.lineTerminatorCharacters===Ci.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n\tFor 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),E(e)?n={modes:{defaultMode:pe(e)},defaultMode:Jr}:(r=!1,n=pe(e))})),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",(()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){const t=[];return le(e,Jr)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+Jr+"> property in its definition\n",type:Ii.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),le(e,Zr)||t.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:Ii.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),le(e,Zr)&&le(e,Jr)&&!le(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${Jr}: <${e.defaultMode}>which does not exist\n`,type:Ii.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),le(e,Zr)&&te(e.modes,((e,n)=>{te(e,((r,i)=>{if(ne(r))t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${n}> at index: <${i}>\n`,type:Ii.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(le(r,"LONGER_ALT")){const i=E(r.LONGER_ALT)?r.LONGER_ALT:[r.LONGER_ALT];te(i,(i=>{ne(i)||_e(e,i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${r.name}> outside of mode <${n}>\n`,type:Ii.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})}))}}))})),t}(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),this.TRACE_INIT("performWarningRuntimeChecks",(()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(oi(n,this.trackStartLines,this.config.lineTerminatorCharacters))}))),n.modes=n.modes?n.modes:{},te(n.modes,((e,t)=>{n.modes[t]=Ue(e,(e=>ne(e)))}));const i=v(n.modes);if(te(n.modes,((e,n)=>{this.TRACE_INIT(`Mode: <${n}> processing`,(()=>{if(this.modes.push(n),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",(()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(ni(e,i))})),he(this.lexerDefinitionErrors)){let r;Ei(e),this.TRACE_INIT("analyzeTokenTypes",(()=>{r=ti(e,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})})),this.patternIdxToConfig[n]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[n]=r.charCodeToPatternIdxToConfig,this.emptyGroups=me({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[n]=r.canBeOptimized}}))})),this.defaultMode=n.defaultMode,!he(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const e=ae(this.lexerDefinitionErrors,(e=>e.message)).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+e)}te(this.lexerDefinitionWarning,(e=>{mr(e.message)})),this.TRACE_INIT("Choosing sub-methods implementations",(()=>{if(ei?(this.chopInput=F,this.match=this.matchWithTest):(this.updateLastIndex=se,this.match=this.matchWithExec),r&&(this.handleModes=se),!1===this.trackStartLines&&(this.computeNewColumn=F),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=se),/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))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}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 e=re(this.canModeBeOptimized,((e,t,n)=>(!1===t&&e.push(n),e)),[]);if(t.ensureOptimizations&&!he(e))throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)})),this.TRACE_INIT("clearRegExpParserCache",(()=>{Gr={}})),this.TRACE_INIT("toFastProperties",(()=>{yr(this)}))}))}tokenize(e,t=this.defaultMode){if(!he(this.lexerDefinitionErrors)){const e=ae(this.lexerDefinitionErrors,(e=>e.message)).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,s,a,o,l,c,u,d,h,p,f,m,g;const y=e,T=y.length;let R=0,A=0;const k=this.hasCustom?0:Math.floor(e.length/10),$=new Array(k),x=[];let S=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0;const N=function(e){const t={},n=v(e);return te(n,(n=>{const r=e[n];if(!E(r))throw Error("non exhaustive match");t[n]=[]})),t}(this.emptyGroups),C=this.trackStartLines,w=this.config.lineTerminatorsPattern;let L=0,O=[],_=[];const b=[],P=[];let M;function D(){return O}function U(e){const t=gi(e),n=_[t];return void 0===n?P:n}Object.freeze(P);const G=e=>{if(1===b.length&&void 0===e.tokenType.PUSH_MODE){const t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);x.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{b.pop();const e=ue(b);O=this.patternIdxToConfig[e],_=this.charCodeToPatternIdxToConfig[e],L=O.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=_&&t?U:D}};function F(e){b.push(e),_=this.charCodeToPatternIdxToConfig[e],O=this.patternIdxToConfig[e],L=O.length,L=O.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=_&&t?U:D}let B;F.call(this,t);const K=this.config.recoveryEnabled;for(;R<T;){o=null;const t=y.charCodeAt(R),v=M(t),E=v.length;for(n=0;n<E;n++){B=v[n];const r=B.pattern;l=null;const u=B.short;if(!1!==u?t===u&&(o=r):!0===B.isCustom?(g=r.exec(y,R,$,N),null!==g?(o=g[0],void 0!==g.payload&&(l=g.payload)):o=null):(this.updateLastIndex(r,R),o=this.match(r,e,R)),null!==o){if(a=B.longerAlt,void 0!==a){const t=a.length;for(i=0;i<t;i++){const t=O[a[i]],n=t.pattern;if(c=null,!0===t.isCustom?(g=n.exec(y,R,$,N),null!==g?(s=g[0],void 0!==g.payload&&(c=g.payload)):s=null):(this.updateLastIndex(n,R),s=this.match(n,e,R)),s&&s.length>o.length){o=s,l=c,B=t;break}}}break}}if(null!==o){if(u=o.length,d=B.group,void 0!==d&&(h=B.tokenTypeIdx,p=this.createTokenInstance(o,R,h,B.tokenType,S,I,u),this.handlePayload(p,l),!1===d?A=this.addToken($,A,p):N[d].push(p)),e=this.chopInput(e,u),R+=u,I=this.computeNewColumn(I,u),!0===C&&!0===B.canLineTerminator){let e,t,n=0;w.lastIndex=0;do{e=w.test(o),!0===e&&(t=w.lastIndex-1,n++)}while(!0===e);0!==n&&(S+=n,I=u-t,this.updateTokenEndLineColumnLocation(p,d,t,n,S,I,u))}this.handleModes(B,G,F,p)}else{const t=R,n=S,i=I;let s=!1===K;for(;!1===s&&R<T;)for(e=this.chopInput(e,1),R++,r=0;r<L;r++){const t=O[r],n=t.pattern,i=t.short;if(!1!==i?y.charCodeAt(R)===i&&(s=!0):!0===t.isCustom?s=null!==n.exec(y,R,$,N):(this.updateLastIndex(n,R),s=null!==n.exec(e)),!0===s)break}if(f=R-t,I=this.computeNewColumn(I,f),m=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,t,f,n,i),x.push({offset:t,line:n,column:i,length:f,message:m}),!1===K)break}}return this.hasCustom||($.length=A),{tokens:$,groups:N,errors:x}}handleModes(e,t,n,r){if(!0===e.pop){const i=e.push;t(r),void 0!==i&&n.call(this,i)}else void 0!==e.push&&n.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,n,r,i,s,a){let o,l;void 0!==t&&(o=n===a-1,l=o?-1:0,1===r&&!0===o||(e.endLine=i+l,e.endColumn=s-1-l))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,s){return{image:e,startOffset:t,startLine:i,startColumn:s,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,s,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:i,endLine:i,startColumn:s,endColumn:s+a-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}matchWithTest(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchWithExec(e,t){const n=e.exec(t);return null!==n?n[0]:null}}function Li(e){return Oi(e)?e.LABEL:e.name}function Oi(e){return Le(e.LABEL)&&""!==e.LABEL}wi.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.",wi.NA=/NOT_APPLICABLE/;const _i="parent",bi="categories",Pi="label",Mi="group",Di="push_mode",Ui="pop_mode",Gi="longer_alt",Fi="line_breaks",Bi="start_chars_hint";function Ki(e){return function(e){const t=e.pattern,n={};n.name=e.name,ne(t)||(n.PATTERN=t);if(le(e,_i))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";le(e,bi)&&(n.CATEGORIES=e[bi]);Ei([n]),le(e,Pi)&&(n.LABEL=e[Pi]);le(e,Mi)&&(n.GROUP=e[Mi]);le(e,Ui)&&(n.POP_MODE=e[Ui]);le(e,Di)&&(n.PUSH_MODE=e[Di]);le(e,Gi)&&(n.LONGER_ALT=e[Gi]);le(e,Fi)&&(n.LINE_BREAKS=e[Fi]);le(e,Bi)&&(n.START_CHARS_HINT=e[Bi]);return n}(e)}const Vi=Ki({name:"EOF",pattern:wi.NA});function ji(e,t,n,r,i,s,a,o){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function Hi(e,t){return yi(e,t)}Ei([Vi]);const Wi={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${Oi(e)?`--\x3e ${Li(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>"Redundant input, expecting EOF but found: "+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",a="\nbut found: '"+xe(t).image+"'";if(r)return s+r+a;{const t=re(e,((e,t)=>e.concat(t)),[]),n=ae(t,(e=>`[${ae(e,(e=>Li(e))).join(", ")}]`));return s+`one of these possible Token sequences:\n${ae(n,((e,t)=>` ${t+1}. ${e}`)).join("\n")}`+a}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){const i="Expecting: ",s="\nbut found: '"+xe(t).image+"'";if(n)return i+n+s;return i+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${ae(e,(e=>`[${ae(e,(e=>Li(e))).join(",")}]`)).join(" ,")}>`+s}};Object.freeze(Wi);const zi={buildRuleNotFoundError:(e,t)=>"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},Yi={buildDuplicateFoundError(e,t){const n=e.name,r=xe(t),i=r.idx,s=_r(r),a=(o=r)instanceof Cr?o.terminalType.name:o instanceof Rr?o.nonTerminalName:"";var o;let l=`->${s}${i>0?i:""}<- ${a?`with argument: ->${a}<-`:""}\n appears more than once (${t.length} times) in the top level rule: ->${n}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,"\n"),l},buildNamespaceConflictError:e=>`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(e){const t=ae(e.prefixPath,(e=>Li(e))).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){const t=ae(e.prefixPath,(e=>Li(e))).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;let r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return r+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",r},buildEmptyRepetitionError(e){let t=_r(e.repetition);0!==e.repetition.idx&&(t+=e.repetition.idx);return`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:e=>"deprecated",buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){const t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${`${t} --\x3e ${ae(e.leftRecursionPath,(e=>e.name)).concat([t]).join(" --\x3e ")}`}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;t=e.topLevelRule instanceof Er?e.topLevelRule.name:e.topLevelRule;return`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class qi extends Lr{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){te(X(this.nameToTopRule),(e=>{this.currTopLevel=e,e.accept(this)}))}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:va.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Xi extends br{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=pe(this.path.ruleStack).reverse(),this.occurrenceStack=pe(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 r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){he(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Qi extends Xi{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 e=t.concat(n),r=new Ar({definition:e});this.possibleTokTypes=Mr(r),this.found=!0}}}class Ji extends br{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 Zi extends Ji{walkMany(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}}class es extends Ji{walkManySep(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}}class ts extends Ji{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}}class ns extends Ji{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}}function rs(e,t,n=[]){n=pe(n);let r=[],i=0;function s(s){const a=rs(s.concat(Re(e,i+1)),t,n);return r.concat(a)}for(;n.length<t&&i<e.length;){const t=e[i];if(t instanceof Ar)return s(t.definition);if(t instanceof Rr)return s(t.definition);if(t instanceof kr)r=s(t.definition);else{if(t instanceof $r){return s(t.definition.concat([new Sr({definition:t.definition})]))}if(t instanceof xr){return s([new Ar({definition:t.definition}),new Sr({definition:[new Cr({terminalType:t.separator})].concat(t.definition)})])}if(t instanceof Ir){const e=t.definition.concat([new Sr({definition:[new Cr({terminalType:t.separator})].concat(t.definition)})]);r=s(e)}else if(t instanceof Sr){const e=t.definition.concat([new Sr({definition:t.definition})]);r=s(e)}else{if(t instanceof Nr)return te(t.definition,(e=>{!1===he(e.definition)&&(r=s(e.definition))})),r;if(!(t instanceof Cr))throw Error("non exhaustive match");n.push(t.terminalType)}}i++}return r.push({partialPath:n,suffixDef:Re(e,i)}),r}function is(e,t,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const l=t.length,c=l-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!he(d);){const e=d.pop();if(e===a){o&&ue(d).idx<=c&&d.pop();continue}const r=e.def,h=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(he(r))continue;const m=r[0];if(m===i){const e={idx:h,def:Re(r),ruleStack:Ee(p),occurrenceStack:Ee(f)};d.push(e)}else if(m instanceof Cr)if(h<l-1){const e=h+1;if(n(t[e],m.terminalType)){const t={idx:e,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(t)}}else{if(h!==l-1)throw Error("non exhaustive match");u.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),o=!0}else if(m instanceof Rr){const e=pe(p);e.push(m.nonTerminalName);const t=pe(f);t.push(m.idx);const n={idx:h,def:m.definition.concat(s,Re(r)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(m instanceof kr){const e={idx:h,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a);const t={idx:h,def:m.definition.concat(Re(r)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof $r){const e=new Sr({definition:m.definition,idx:m.idx}),t={idx:h,def:m.definition.concat([e],Re(r)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof xr){const e=new Cr({terminalType:m.separator}),t=new Sr({definition:[e].concat(m.definition),idx:m.idx}),n={idx:h,def:m.definition.concat([t],Re(r)),ruleStack:p,occurrenceStack:f};d.push(n)}else if(m instanceof Ir){const e={idx:h,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a);const t=new Cr({terminalType:m.separator}),n=new Sr({definition:[t].concat(m.definition),idx:m.idx}),i={idx:h,def:m.definition.concat([n],Re(r)),ruleStack:p,occurrenceStack:f};d.push(i)}else if(m instanceof Sr){const e={idx:h,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a);const t=new Sr({definition:m.definition,idx:m.idx}),n={idx:h,def:m.definition.concat([t],Re(r)),ruleStack:p,occurrenceStack:f};d.push(n)}else if(m instanceof Nr)for(let t=m.definition.length-1;t>=0;t--){const e={idx:h,def:m.definition[t].definition.concat(Re(r)),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a)}else if(m instanceof Ar)d.push({idx:h,def:m.definition.concat(Re(r)),ruleStack:p,occurrenceStack:f});else{if(!(m instanceof Er))throw Error("non exhaustive match");d.push(ss(m,h,p,f))}}return u}function ss(e,t,n,r){const i=pe(n);i.push(e.name);const s=pe(r);return s.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:s}}var as,os;function ls(e){if(e instanceof kr||"Option"===e)return as.OPTION;if(e instanceof Sr||"Repetition"===e)return as.REPETITION;if(e instanceof $r||"RepetitionMandatory"===e)return as.REPETITION_MANDATORY;if(e instanceof xr||"RepetitionMandatoryWithSeparator"===e)return as.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof Ir||"RepetitionWithSeparator"===e)return as.REPETITION_WITH_SEPARATOR;if(e instanceof Nr||"Alternation"===e)return as.ALTERNATION;throw Error("non exhaustive match")}function cs(e){const{occurrence:t,rule:n,prodType:r,maxLookahead:i}=e,s=ls(r);return s===as.ALTERNATION?Ts(t,n,i):vs(t,n,s,i)}function us(e,t,n,r){const i=e.length,s=$e(e,(e=>$e(e,(e=>1===e.length))));if(t)return function(t){const r=ae(t,(e=>e.GATE));for(let s=0;s<i;s++){const t=e[s],i=t.length,a=r[s];if(void 0===a||!1!==a.call(this))e:for(let e=0;e<i;e++){const r=t[e],i=r.length;for(let e=0;e<i;e++){const t=this.LA(e+1);if(!1===n(t,r[e]))continue e}return s}}};if(s&&!r){const t=ae(e,(e=>U(e))),n=re(t,((e,t,n)=>(te(t,(t=>{le(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),te(t.categoryMatches,(t=>{le(e,t)||(e[t]=n)}))})),e)),{});return function(){const e=this.LA(1);return n[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){const r=e[t],i=r.length;e:for(let e=0;e<i;e++){const i=r[e],s=i.length;for(let e=0;e<s;e++){const t=this.LA(e+1);if(!1===n(t,i[e]))continue e}return t}}}}function ds(e,t,n){const r=$e(e,(e=>1===e.length)),i=e.length;if(r&&!n){const t=U(e);if(1===t.length&&he(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=re(t,((e,t,n)=>(e[t.tokenTypeIdx]=!0,te(t.categoryMatches,(t=>{e[t]=!0})),e)),[]);return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let n=0;n<i;n++){const r=e[n],i=r.length;for(let e=0;e<i;e++){const n=this.LA(e+1);if(!1===t(n,r[e]))continue e}return!0}return!1}}(os=as||(as={}))[os.OPTION=0]="OPTION",os[os.REPETITION=1]="REPETITION",os[os.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",os[os.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",os[os.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",os[os.ALTERNATION=5]="ALTERNATION";class hs extends br{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,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,as.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,as.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,as.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,as.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,as.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}}class ps extends Lr{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||void 0!==this.targetRef&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,as.OPTION)}visitRepetition(e){this.checkIsTarget(e,as.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,as.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,as.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,as.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,as.ALTERNATION)}}function fs(e){const t=new Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function ms(e){let t=[""];for(let n=0;n<e.length;n++){const r=e[n],i=[];for(let e=0;e<t.length;e++){const n=t[e];i.push(n+"_"+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){const t="_"+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function gs(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;const i=e[r];for(let e=0;e<t.length;e++){if(!0===i[t[e]])return!1}}return!0}function ys(e,t){const n=ae(e,(e=>rs([e],1))),r=fs(n.length),i=ae(n,(e=>{const t={};return te(e,(e=>{const n=ms(e.partialPath);te(n,(e=>{t[e]=!0}))})),t}));let s=n;for(let a=1;a<=t;a++){const e=s;s=fs(e.length);for(let n=0;n<e.length;n++){const o=e[n];for(let e=0;e<o.length;e++){const l=o[e].partialPath,c=o[e].suffixDef,u=ms(l);if(gs(i,u,n)||he(c)||l.length===t){const e=r[n];if(!1===Rs(e,l)){e.push(l);for(let e=0;e<u.length;e++){const t=u[e];i[n][t]=!0}}}else{const e=rs(c,a+1,l);s[n]=s[n].concat(e),te(e,(e=>{const t=ms(e.partialPath);te(t,(e=>{i[n][e]=!0}))}))}}}}return r}function Ts(e,t,n,r){const i=new ps(e,as.ALTERNATION,r);return t.accept(i),ys(i.result,n)}function vs(e,t,n,r){const i=new ps(e,n);t.accept(i);const s=i.result,a=new hs(t,e,n).startWalking();return ys([new Ar({definition:s}),new Ar({definition:a})],r)}function Rs(e,t){e:for(let n=0;n<e.length;n++){const r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){const n=t[e],i=r[e];if(!1===(n===i||void 0!==i.categoryMatchesMap[n.tokenTypeIdx]))continue e}return!0}}return!1}function Es(e){return $e(e,(e=>$e(e,(e=>$e(e,(e=>he(e.categoryMatches)))))))}function As(e,t,n,r){const i=Se(e,(e=>function(e,t){const n=new xs;e.accept(n);const r=n.allProductions,i=De(we(r,ks),(e=>e.length>1)),s=ae(X(i),(n=>{const r=xe(n),i=t.buildDuplicateFoundError(e,n),s=_r(r),a={message:i,type:va.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:s,occurrence:r.idx},o=$s(r);return o&&(a.parameter=o),a}));return s}(e,n))),s=function(e,t,n){const r=[],i=ae(t,(e=>e.name));return te(e,(e=>{const t=e.name;if(_e(i,t)){const i=n.buildNamespaceConflictError(e);r.push({message:i,type:va.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}})),r}(e,t,n),a=Se(e,(e=>function(e,t){const n=new Ns;e.accept(n);const r=Se(n.alternations,(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:va.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[]));return r}(e,n))),o=Se(e,(t=>function(e,t,n,r){const i=[],s=re(t,((t,n)=>n.name===e.name?t+1:t),0);if(s>1){const t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:va.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,r,n)));return i.concat(s,a,o)}function ks(e){return`${_r(e)}_#_${e.idx}_#_${$s(e)}`}function $s(e){return e instanceof Cr?e.terminalType.name:e instanceof Rr?e.nonTerminalName:""}class xs extends Lr{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 Ss(e,t,n,r=[]){const i=[],s=Is(t.definition);if(he(s))return[];{const t=e.name;_e(s,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:va.LEFT_RECURSION,ruleName:t});const a=Se(ve(s,r.concat([e])),(t=>{const i=pe(r);return i.push(t),Ss(e,t,n,i)}));return i.concat(a)}}function Is(e){let t=[];if(he(e))return t;const n=xe(e);if(n instanceof Rr)t.push(n.referencedRule);else if(n instanceof Ar||n instanceof kr||n instanceof $r||n instanceof xr||n instanceof Ir||n instanceof Sr)t=t.concat(Is(n.definition));else if(n instanceof Nr)t=U(ae(n.definition,(e=>Is(e.definition))));else if(!(n instanceof Cr))throw Error("non exhaustive match");const r=Or(n),i=e.length>1;if(r&&i){const n=Re(e);return t.concat(Is(n))}return t}class Ns extends Lr{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Cs(e,t,n){const r=new Ns;e.accept(r);let i=r.alternations;i=Ue(i,(e=>!0===e.ignoreAmbiguities));const s=Se(i,(r=>{const i=r.idx,s=r.maxLookahead||t,a=Ts(i,e,s,r),o=function(e,t,n,r){const i=[],s=re(e,((n,r,s)=>(!0===t.definition[s].ignoreAmbiguities||te(r,(r=>{const a=[s];te(e,((e,n)=>{s!==n&&Rs(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&a.push(n)})),a.length>1&&!Rs(i,r)&&(i.push(r),n.push({alts:a,path:r}))})),n)),[]),a=ae(s,(e=>{const i=ae(e.alts,(e=>e+1));return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:va.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}}));return a}(a,r,e,n),l=function(e,t,n,r){const i=re(e,((e,t,n)=>{const r=ae(t,(e=>({idx:n,path:e})));return e.concat(r)}),[]),s=ge(Se(i,(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];const s=e.idx,a=e.path,o=ie(i,(e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<s&&(n=e.path,r=a,n.length<r.length&&$e(n,((e,t)=>{const n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]})));var n,r}));return ae(o,(e=>{const i=[e.idx+1,s+1],a=0===t.idx?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:va.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:a,alternatives:i}}))})));return s}(a,r,e,n);return o.concat(l)}));return s}class ws extends Lr{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 Ls(e){const t=ce(e,{errMsgProvider:zi}),n={};return te(e.rules,(e=>{n[e.name]=e})),function(e,t){const n=new qi(e,t);return n.resolveRefs(),n.errors}(n,t.errMsgProvider)}const Os="MismatchedTokenException",_s="NoViableAltException",bs="EarlyExitException",Ps="NotAllInputParsedException",Ms=[Os,_s,bs,Ps];function Ds(e){return _e(Ms,e.name)}Object.freeze(Ms);class Us 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 Gs extends Us{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Os}}class Fs extends Us{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=_s}}class Bs extends Us{constructor(e,t){super(e,t),this.name=Ps}}class Ks extends Us{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=bs}}const Vs={},js="InRuleRecoveryException";class Hs extends Error{constructor(e){super(e),this.name=js}}function Ws(e,t,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let l=this.firstAfterRepMap[o];if(void 0===l){const e=this.getCurrRuleFullName();l=new s(this.getGAstProductions()[e],i).startWalking(),this.firstAfterRepMap[o]=l}let c=l.token,u=l.occurrence;const d=l.isEndOfRule;1===this.RULE_STACK.length&&d&&void 0===c&&(c=Vi,u=1),void 0!==c&&void 0!==u&&this.shouldInRepetitionRecoveryBeTried(c,u,a)&&this.tryInRepetitionRecovery(e,t,n,c)}const zs=1024,Ys=1280,qs=1536;function Xs(e,t,n){return n|t|e}class Qs{constructor(e){var t;this.maxLookahead=null!==(t=null==e?void 0:e.maxLookahead)&&void 0!==t?t:ya.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if(he(t)){const n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return Se(e,(e=>Ss(e,e,Yi)))}validateEmptyOrAlternatives(e){return Se(e,(e=>function(e,t){const n=new Ns;return e.accept(n),Se(n.alternations,(n=>Se(Ee(n.definition),((r,i)=>{const s=is([r],[],yi,1);return he(s)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:va.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]}))))}(e,Yi)))}validateAmbiguousAlternationAlternatives(e,t){return Se(e,(e=>Cs(e,t,Yi)))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,n){const r=[];return te(e,(e=>{const i=new ws;e.accept(i);const s=i.allProductions;te(s,(i=>{const s=ls(i),a=i.maxLookahead||t,o=vs(i.idx,e,s,a)[0];if(he(U(o))){const t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:va.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}}))})),r}(e,t,Yi)}buildLookaheadForAlternation(e){return function(e,t,n,r,i,s){const a=Ts(e,t,n);return s(a,r,Es(a)?Ti:yi,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,us)}buildLookaheadForOptional(e){return function(e,t,n,r,i,s){const a=vs(e,t,i,n),o=Es(a)?Ti:yi;return s(a[0],o,r)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,ls(e.prodType),ds)}}const Js=new class extends Lr{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)}};function Zs(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function ea(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function ta(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function na(e,t){const n=v(e),r=n.length;for(let i=0;i<r;i++){const r=e[n[i]],s=r.length;for(let e=0;e<s;e++){const n=r[e];void 0===n.tokenTypeIdx&&this[n.name](n.children,t)}}}function ra(e,t){const n=function(){};ta(n,e+"BaseSemantics");const r={visit:function(e,t){if(E(e)&&(e=e[0]),!ne(e))return this[e.name](e.children,t)},validateVisitor:function(){const e=function(e,t){const n=function(e,t){const n=ie(t,(t=>!1===G(e[t]))),r=ae(n,(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:ia.MISSING_METHOD,methodName:t})));return ge(r)}(e,t);return n}(this,t);if(!he(e)){const t=ae(e,(e=>e.msg));throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join("\n\n").replace(/\n/g,"\n\t")}`)}}};return(n.prototype=r).constructor=n,n._RULE_NAMES=t,n}var ia,sa;(sa=ia||(ia={}))[sa.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",sa[sa.MISSING_METHOD=1]="MISSING_METHOD";const aa={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(aa);const oa=!0,la=Math.pow(2,8)-1,ca=Ki({name:"RECORDING_PHASE_TOKEN",pattern:wi.NA});Ei([ca]);const ua=ji(ca,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(ua);const da={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}};function ha(e,t,n,r=!1){ma(n);const i=ue(this.recordingProdStack),s=G(t)?t:t.DEF,a=new e({definition:[],idx:n});return r&&(a.separator=t.SEP),le(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),aa}function pa(e,t){ma(t);const n=ue(this.recordingProdStack),r=!1===E(e),i=!1===r?e:e.DEF,s=new Nr({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});le(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD);const a=Fe(i,(e=>G(e.GATE)));return s.hasPredicates=a,n.definition.push(s),te(i,(e=>{const t=new Ar({definition:[]});s.definition.push(t),le(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:le(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()})),aa}function fa(e){return 0===e?"":`${e}`}function ma(e){if(e<0||e>la){const t=new Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than ${la+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}const ga=ji(Vi,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ga);const ya=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Wi,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ta=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var va,Ra,Ea;function Aa(e=void 0){return function(){return e}}(Ra=va||(va={}))[Ra.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",Ra[Ra.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",Ra[Ra.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",Ra[Ra.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",Ra[Ra.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",Ra[Ra.LEFT_RECURSION=5]="LEFT_RECURSION",Ra[Ra.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",Ra[Ra.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",Ra[Ra.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",Ra[Ra.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",Ra[Ra.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",Ra[Ra.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",Ra[Ra.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",Ra[Ra.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION";class ka{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\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",(()=>{yr(this)})),this.TRACE_INIT("Grammar Recording",(()=>{try{this.enableRecording(),te(this.definedRulesNames,(e=>{const t=this[e].originalGrammarAction;let n;this.TRACE_INIT(`${e} Rule`,(()=>{n=this.topLevelRuleRecord(e,t)})),this.gastProductionsCache[e]=n}))}finally{this.disableRecording()}}));let n=[];if(this.TRACE_INIT("Grammar Resolving",(()=>{n=Ls({rules:X(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)})),this.TRACE_INIT("Grammar Validations",(()=>{if(he(n)&&!1===this.skipValidations){const n=(e={rules:X(this.gastProductionsCache),tokenTypes:X(this.tokensMap),errMsgProvider:Yi,grammarName:t},As((e=ce(e,{errMsgProvider:Yi})).rules,e.tokenTypes,e.errMsgProvider,e.grammarName)),r=function(e){const t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return ae(t,(e=>Object.assign({type:va.CUSTOM_LOOKAHEAD_VALIDATION},e)))}({lookaheadStrategy:this.lookaheadStrategy,rules:X(this.gastProductionsCache),tokenTypes:X(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(n,r)}var e})),he(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",(()=>{const e=function(e){const t={};return te(e,(e=>{const n=new Ur(e).startWalking();me(t,n)})),t}(X(this.gastProductionsCache));this.resyncFollows=e})),this.TRACE_INIT("ComputeLookaheadFunctions",(()=>{var e,t;null===(t=(e=this.lookaheadStrategy).initialize)||void 0===t||t.call(e,{rules:X(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(X(this.gastProductionsCache))}))),!ka.DEFER_DEFINITION_ERRORS_HANDLING&&!he(this.definitionErrors))throw e=ae(this.definitionErrors,(e=>e.message)),new Error(`Parser Definition Errors detected:\n ${e.join("\n-------------------------------\n")}`)}))}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),le(t,"ignoredIssues"))throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\tPlease use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=le(t,"skipValidations")?t.skipValidations:ya.skipValidations}}ka.DEFER_DEFINITION_ERRORS_HANDLING=!1,Ea=ka,[class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=le(e,"recoveryEnabled")?e.recoveryEnabled:ya.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Ws)}getTokenToInsert(e){const t=ji(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){const i=this.findReSyncTokenType(),s=this.exportLexerState(),a=[];let o=!1;const l=this.LA(1);let c=this.LA(1);const u=()=>{const e=this.LA(0),t=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:l,previous:e,ruleName:this.getCurrRuleFullName()}),n=new Gs(t,l,this.LA(0));n.resyncedTokens=Ee(a),this.SAVE_ERROR(n)};for(;!o;){if(this.tokenMatcher(c,r))return void u();if(n.call(this))return u(),void e.apply(this,t);this.tokenMatcher(c,i)?o=!0:(c=this.SKIP_TOKEN(),this.addToResyncTokens(c,a))}this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,t,n){return!1!==n&&!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 e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new Hs("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(he(t))return!1;const n=this.LA(1);return void 0!==oe(t,(e=>this.tokenMatcher(n,e)))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey();return _e(this.getFollowSetFromFollowKey(t),e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),n=2;for(;;){const r=oe(e,(e=>Hi(t,e)));if(void 0!==r)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return Vs;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 ae(e,((n,r)=>0===r?Vs:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])}))}flattenFollowSet(){const e=ae(this.buildFullFollowKeyStack(),(e=>this.getFollowSetFromFollowKey(e)));return U(e)}getFollowSetFromFollowKey(e){if(e===Vs)return[Vi];const t=e.ruleName+e.idxInCallingRule+Dr+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,Vi)||t.push(e),t}reSyncTo(e){const t=[];let n=this.LA(1);for(;!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return Ee(t)}attemptInRepetitionRecovery(e,t,n,r,i,s,a){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:pe(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return ae(this.RULE_STACK,(e=>this.shortRuleNameToFullName(e)))}},class{initLooksAhead(e){this.dynamicTokensEnabled=le(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ya.dynamicTokensEnabled,this.maxLookahead=le(e,"maxLookahead")?e.maxLookahead:ya.maxLookahead,this.lookaheadStrategy=le(e,"lookaheadStrategy")?e.lookaheadStrategy:new Qs({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){te(e,(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,(()=>{const{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:a}=function(e){Js.reset(),e.accept(Js);const t=Js.dslMethods;return Js.reset(),t}(e);te(t,(t=>{const n=0===t.idx?"":t.idx;this.TRACE_INIT(`${_r(t)}${n}`,(()=>{const n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),r=Xs(this.fullRuleNameToShort[e.name],256,t.idx);this.setLaFuncCache(r,n)}))})),te(n,(t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,_r(t))})),te(r,(t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,_r(t))})),te(i,(t=>{this.computeLookaheadFunc(e,t.idx,zs,"RepetitionMandatory",t.maxLookahead,_r(t))})),te(s,(t=>{this.computeLookaheadFunc(e,t.idx,qs,"RepetitionMandatoryWithSeparator",t.maxLookahead,_r(t))})),te(a,(t=>{this.computeLookaheadFunc(e,t.idx,Ys,"RepetitionWithSeparator",t.maxLookahead,_r(t))}))}))}))}computeLookaheadFunc(e,t,n,r,i,s){this.TRACE_INIT(`${s}${0===t?"":t}`,(()=>{const s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),a=Xs(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(a,s)}))}getKeyForAutomaticLookahead(e,t){return Xs(this.getLastExplicitRuleShortName(),e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=le(e,"nodeLocationTracking")?e.nodeLocationTracking:ya.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ea,this.setNodeLocationFromNode=ea,this.cstPostRule=se,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=se,this.setNodeLocationFromNode=se,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Zs,this.setNodeLocationFromNode=Zs,this.cstPostRule=se,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=se,this.setNodeLocationFromNode=se,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);this.setNodeLocationFromToken=se,this.setNodeLocationFromNode=se,this.cstPostRule=se,this.setInitialNodeLocation=se}else this.cstInvocationStateUpdate=se,this.cstFinallyStateUpdate=se,this.cstPostTerminal=se,this.cstPostNonTerminal=se,this.cstPostRule=se}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==1?(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==1?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,s;i=t,s=e,void 0===(r=n).children[s]?r.children[s]=[i]:r.children[s].push(i),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];!function(e,t,n){void 0===e.children[t]?e.children[t]=[n]:e.children[t].push(n)}(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(ne(this.baseCstVisitorConstructor)){const e=ra(this.className,v(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ne(this.baseCstVisitorWithDefaultsConstructor)){const e=function(e,t,n){const r=function(){};ta(r,e+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return te(t,(e=>{i[e]=na})),(r.prototype=i).constructor=r,r}(this.className,v(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{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)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)):ga}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?ga: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{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ti,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},le(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if(E(e)){if(he(e))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if(E(e))this.tokensMap=re(e,((e,t)=>(e[t.name]=t,e)),{});else if(le(e,"modes")&&$e(U(X(e.modes)),xi)){const t=Be(U(X(e.modes)));this.tokensMap=re(t,((e,t)=>(e[t.name]=t,e)),{})}else{if(!B(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=pe(e)}this.tokensMap.EOF=Vi;const n=$e(le(e,"modes")?U(X(e.modes)):X(e),(e=>he(e.categoryMatches)));this.tokenMatcher=n?Ti:yi,Ei(X(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'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=le(n,"resyncEnabled")?n.resyncEnabled:Ta.resyncEnabled,i=le(n,"recoveryValueFunc")?n.recoveryValueFunc:Ta.recoveryValueFunc,s=this.ruleShortNameIdx<<12;let a;return this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s,a=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,n);const r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(a){return this.invokeRuleCatch(a,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,n)}catch(a){return this.invokeRuleCatch(a,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){const r=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Ds(e)){const t=e;if(i){const r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){const n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof e){r=e.DEF;const t=e.GATE;if(void 0!==t){const e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){const n=this.getKeyForAutomaticLookahead(zs,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,as.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,zs,e,ts)}atLeastOneSepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(qs,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(e,as.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,ns],t,qs,e,ns)}}manyInternal(e,t){const n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let s=!0;for(;!0===i.call(this)&&!0===s;)s=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Zi,s)}manySepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(Ys,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(n).call(this)){r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,es],t,Ys,e,es)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,qs,e,i)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const n=this.getKeyForAutomaticLookahead(256,t),r=E(e)?e:e.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(void 0!==i)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Bs(t,e))}}subruleInternal(e,t,n){let r;try{const i=void 0!==n?n.ARGS:void 0;return this.subruleIdx=t,r=e.apply(this,i),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:e.ruleName),r}catch(i){throw this.subruleInternalError(i,n,e.ruleName)}}subruleInternalError(e,t,n){throw Ds(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{const t=this.LA(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(i){r=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(void 0!==n&&void 0!==n.LABEL?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r;const i=this.LA(0);throw r=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Gs(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;{const i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(r){throw r.name===js?n:r}}}saveRecogState(){const e=this.errors,t=pe(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 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Vi)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},class{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=Ta){if(_e(this.definedRulesNames,e)){const t={message:Yi.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:va.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);const r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Ta){const r=function(e,t,n){const r=[];let i;return _e(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:va.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return e.apply(this,t),!0}catch(r){if(Ds(r))return!1;throw r}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return e=X(this.gastProductionsCache),ae(e,wr);var e}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=le(e,"errorMessageProvider")?e.errorMessageProvider:ya.errorMessageProvider}SAVE_ERROR(e){if(Ds(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:pe(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return pe(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){const r=this.getCurrRuleFullName(),i=vs(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],s=[];for(let o=1;o<=this.maxLookahead;o++)s.push(this.LA(o));const a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:s,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new Ks(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const n=this.getCurrRuleFullName(),r=Ts(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let o=1;o<=this.maxLookahead;o++)i.push(this.LA(o));const s=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Fs(a,this.LA(1),s))}},class{initContentAssist(){}computeContentAssist(e,t){const n=this.gastProductionsCache[e];if(ne(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return is([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=xe(e.ruleStack),n=this.getGAstProductions()[t];return new Qi(n,e).startWalking()}},class{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(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}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 ga}topLevelRuleRecord(e,t){try{const n=new Er({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(n){if(!0!==n.KNOWN_RECORDER_ERROR)try{n.message=n.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(r){throw n}throw n}}optionInternalRecord(e,t){return ha.call(this,kr,e,t)}atLeastOneInternalRecord(e,t){ha.call(this,$r,t,e)}atLeastOneSepFirstInternalRecord(e,t){ha.call(this,xr,t,e,oa)}manyInternalRecord(e,t){ha.call(this,Sr,t,e)}manySepFirstInternalRecord(e,t){ha.call(this,Ir,t,e,oa)}orInternalRecord(e,t){return pa.call(this,e,t)}subruleInternalRecord(e,t,n){if(ma(t),!e||!1===le(e,"ruleName")){const n=new Error(`<SUBRULE${fa(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}const r=ue(this.recordingProdStack),i=e.ruleName,s=new Rr({idx:t,nonTerminalName:i,label:null==n?void 0:n.LABEL,referencedRule:void 0});return r.definition.push(s),this.outputCst?da:aa}consumeInternalRecord(e,t,n){if(ma(t),!ki(e)){const n=new Error(`<CONSUME${fa(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}const r=ue(this.recordingProdStack),i=new Cr({idx:t,terminalType:e,label:null==n?void 0:n.LABEL});return r.definition.push(i),ua}},class{initPerformanceTracer(e){if(le(e,"traceInitPerf")){const t=e.traceInitPerf,n="number"==typeof t;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=ya.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=gr(t),s=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach((e=>{const t=e.prototype;Object.getOwnPropertyNames(t).forEach((n=>{if("constructor"===n)return;const r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(Ea.prototype,n,r):Ea.prototype[n]=e.prototype[n]}))}));class $a extends ka{constructor(e,t=ya){const n=pe(t);n.outputCst=!1,super(e,n)}}function xa(e,t,n){return`${e.name}_${t}_${n}`}class Sa{constructor(e){this.target=e}isEpsilon(){return!1}}class Ia extends Sa{constructor(e,t){super(e),this.tokenType=t}}class Na extends Sa{constructor(e){super(e)}isEpsilon(){return!0}}class Ca extends Sa{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}}function wa(e){const t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};!function(e,t){const n=t.length;for(let r=0;r<n;r++){const n=t[r],i=Fa(e,n,void 0,{type:2}),s=Fa(e,n,void 0,{type:7});i.stop=s,e.ruleToStartState.set(n,i),e.ruleToStopState.set(n,s)}}(t,e);const n=e.length;for(let r=0;r<n;r++){const n=e[r],i=Oa(t,n,n);void 0!==i&&Ua(t,n,i)}return t}function La(e,t,n){return n instanceof Cr?Da(e,t,n.terminalType,n):n instanceof Rr?function(e,t,n){const r=n.referencedRule,i=e.ruleToStartState.get(r),s=Fa(e,t,n,{type:1}),a=Fa(e,t,n,{type:1}),o=new Ca(i,r,a);return Ba(s,o),{left:s,right:a}}(e,t,n):n instanceof Nr?function(e,t,n){const r=Fa(e,t,n,{type:1});Pa(e,r);const i=ae(n.definition,(n=>La(e,t,n))),s=Ma(e,t,r,n,...i);return s}(e,t,n):n instanceof kr?function(e,t,n){const r=Fa(e,t,n,{type:1});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n));return function(e,t,n,r){const i=r.left,s=r.right;return Ga(i,s),e.decisionMap[xa(t,"Option",n.idx)]=i,r}(e,t,n,i)}(e,t,n):n instanceof Sr?function(e,t,n){const r=Fa(e,t,n,{type:5});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n));return ba(e,t,n,i)}(e,t,n):n instanceof Ir?function(e,t,n){const r=Fa(e,t,n,{type:5});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n)),s=Da(e,t,n.separator,n);return ba(e,t,n,i,s)}(e,t,n):n instanceof $r?function(e,t,n){const r=Fa(e,t,n,{type:4});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n));return _a(e,t,n,i)}(e,t,n):n instanceof xr?function(e,t,n){const r=Fa(e,t,n,{type:4});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n)),s=Da(e,t,n.separator,n);return _a(e,t,n,i,s)}(e,t,n):Oa(e,t,n)}function Oa(e,t,n){const r=ie(ae(n.definition,(n=>La(e,t,n))),(e=>void 0!==e));return 1===r.length?r[0]:0===r.length?void 0:function(e,t){const n=t.length;for(let s=0;s<n-1;s++){const n=t[s];let r;1===n.left.transitions.length&&(r=n.left.transitions[0]);const i=r instanceof Ca,a=r,o=t[s+1].left;1===n.left.type&&1===n.right.type&&void 0!==r&&(i&&a.followState===n.right||r.target===n.right)?(i?a.followState=o:r.target=o,Ka(e,n.right)):Ga(n.right,o)}const r=t[0],i=t[n-1];return{left:r.left,right:i.right}}(e,r)}function _a(e,t,n,r,i){const s=r.left,a=r.right,o=Fa(e,t,n,{type:11});Pa(e,o);const l=Fa(e,t,n,{type:12});return s.loopback=o,l.loopback=o,e.decisionMap[xa(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,Ga(a,o),void 0===i?(Ga(o,s),Ga(o,l)):(Ga(o,l),Ga(o,i.left),Ga(i.right,s)),{left:s,right:l}}function ba(e,t,n,r,i){const s=r.left,a=r.right,o=Fa(e,t,n,{type:10});Pa(e,o);const l=Fa(e,t,n,{type:12}),c=Fa(e,t,n,{type:9});return o.loopback=c,l.loopback=c,Ga(o,s),Ga(o,l),Ga(a,c),void 0!==i?(Ga(c,l),Ga(c,i.left),Ga(i.right,s)):Ga(c,o),e.decisionMap[xa(t,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:l}}function Pa(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function Ma(e,t,n,r,...i){const s=Fa(e,t,r,{type:8,start:n});n.end=s;for(const o of i)void 0!==o?(Ga(n,o.left),Ga(o.right,s)):Ga(n,s);const a={left:n,right:s};return e.decisionMap[xa(t,function(e){if(e instanceof Nr)return"Alternation";if(e instanceof kr)return"Option";if(e instanceof Sr)return"Repetition";if(e instanceof Ir)return"RepetitionWithSeparator";if(e instanceof $r)return"RepetitionMandatory";if(e instanceof xr)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}(r),r.idx)]=n,a}function Da(e,t,n,r){const i=Fa(e,t,r,{type:1}),s=Fa(e,t,r,{type:1});return Ba(i,new Ia(s,n)),{left:i,right:s}}function Ua(e,t,n){const r=e.ruleToStartState.get(t);Ga(r,n.left);const i=e.ruleToStopState.get(t);Ga(n.right,i);return{left:r,right:i}}function Ga(e,t){Ba(e,new Na(t))}function Fa(e,t,n,r){const i=Object.assign({atn:e,production:n,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},r);return e.states.push(i),i}function Ba(e,t){0===e.transitions.length&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function Ka(e,t){e.states.splice(e.states.indexOf(t),1)}const Va={};class ja{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Ha(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return ae(this.configs,(e=>e.alt))}get key(){let e="";for(const t in this.map)e+=t+":";return e}}function Ha(e,t=!0){return`${t?`a${e.alt}`:""}s${e.state.stateNumber}:${e.stack.map((e=>e.stateNumber.toString())).join("_")}`}function Wa(e,t){const n={};return r=>{const i=r.toString();let s=n[i];return void 0!==s||(s={atnStartState:e,decision:t,states:{}},n[i]=s),s}}class za{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+=!0===this.predicates[n]?"1":"0";return e}}const Ya=new za;class qa extends Qs{constructor(e){var t;super(),this.logging=null!==(t=null==e?void 0:e.logging)&&void 0!==t?t:e=>console.log(e)}initialize(e){this.atn=wa(e.rules),this.dfas=function(e){const t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=Wa(e.decisionStates[r],r);return n}(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:t,rule:n,hasPredicates:r,dynamicTokensEnabled:i}=e,s=this.dfas,a=this.logging,o=xa(n,"Alternation",t),l=this.atn.decisionMap[o].decision,c=ae(cs({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:n}),(e=>ae(e,(e=>e[0]))));if(Xa(c,!1)&&!i){const e=re(c,((e,t,n)=>(te(t,(t=>{t&&(e[t.tokenTypeIdx]=n,te(t.categoryMatches,(t=>{e[t]=n})))})),e)),{});return r?function(t){var n;const r=this.LA(1),i=e[r.tokenTypeIdx];if(void 0!==t&&void 0!==i){const e=null===(n=t[i])||void 0===n?void 0:n.GATE;if(void 0!==e&&!1===e.call(this))return}return i}:function(){const t=this.LA(1);return e[t.tokenTypeIdx]}}return r?function(e){const t=new za,n=void 0===e?0:e.length;for(let i=0;i<n;i++){const n=null==e?void 0:e[i].GATE;t.set(i,void 0===n||n.call(this))}const r=Qa.call(this,s,l,t,a);return"number"==typeof r?r:void 0}:function(){const e=Qa.call(this,s,l,Ya,a);return"number"==typeof e?e:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:t,rule:n,prodType:r,dynamicTokensEnabled:i}=e,s=this.dfas,a=this.logging,o=xa(n,r,t),l=this.atn.decisionMap[o].decision,c=ae(cs({maxLookahead:1,occurrence:t,prodType:r,rule:n}),(e=>ae(e,(e=>e[0]))));if(Xa(c)&&c[0][0]&&!i){const e=c[0],t=U(e);if(1===t.length&&he(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=re(t,((e,t)=>(void 0!==t&&(e[t.tokenTypeIdx]=!0,te(t.categoryMatches,(t=>{e[t]=!0}))),e)),{});return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){const e=Qa.call(this,s,l,Ya,a);return"object"!=typeof e&&0===e}}}function Xa(e,t=!0){const n=new Set;for(const r of e){const e=new Set;for(const i of r){if(void 0===i){if(t)break;return!1}const r=[i.tokenTypeIdx].concat(i.categoryMatches);for(const t of r)if(n.has(t)){if(!e.has(t))return!1}else n.add(t),e.add(t)}}return!0}function Qa(e,t,n,r){const i=e[t](n);let s=i.start;if(void 0===s){s=so(i,ro(function(e){const t=new ja,n=e.transitions.length;for(let r=0;r<n;r++){ao({state:e.transitions[r].target,alt:r,stack:[]},t)}return t}(i.atnStartState))),i.start=s}return Ja.apply(this,[i,s,n,r])}function Ja(e,t,n,r){let i=t,s=1;const a=[];let o=this.LA(s++);for(;;){let t=(l=o,i.edges[l.tokenTypeIdx]);if(void 0===t&&(t=Za.apply(this,[e,i,o,s,n,r])),t===Va)return to(a,i,o);if(!0===t.isAcceptState)return t.prediction;i=t,a.push(o),o=this.LA(s++)}var l}function Za(e,t,n,r,i,s){const a=function(e,t,n){const r=new ja,i=[];for(const a of e.elements){if(!1===n.is(a.alt))continue;if(7===a.state.type){i.push(a);continue}const e=a.state.transitions.length;for(let n=0;n<e;n++){const e=no(a.state.transitions[n],t);void 0!==e&&r.add({state:e,alt:a.alt,stack:a.stack})}}let s;0===i.length&&1===r.size&&(s=r);if(void 0===s){s=new ja;for(const e of r.elements)ao(e,s)}if(i.length>0&&!function(e){for(const t of e.elements)if(7===t.state.type)return!0;return!1}(s))for(const a of i)s.add(a);return s}(t.configs,n,i);if(0===a.size)return io(e,t,n,Va),Va;let o=ro(a);const l=function(e,t){let n;for(const r of e.elements)if(!0===t.is(r.alt))if(void 0===n)n=r.alt;else if(n!==r.alt)return;return n}(a,i);if(void 0!==l)o.isAcceptState=!0,o.prediction=l,o.configs.uniqueAlt=l;else if(function(e){if(function(e){for(const t of e.elements)if(7!==t.state.type)return!1;return!0}(e))return!0;const t=function(e){const t=new Map;for(const n of e){const e=Ha(n,!1);let r=t.get(e);void 0===r&&(r={},t.set(e,r)),r[n.alt]=!0}return t}(e.elements);return function(e){for(const t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}(t)&&!function(e){for(const t of Array.from(e.values()))if(1===Object.keys(t).length)return!0;return!1}(t)}(a)){const t=de(a.alts);o.isAcceptState=!0,o.prediction=t,o.configs.uniqueAlt=t,eo.apply(this,[e,r,a.alts,s])}return o=io(e,t,n,o),o}function eo(e,t,n,r){const i=[];for(let a=1;a<=t;a++)i.push(this.LA(a).tokenType);const s=e.atnStartState;r(function(e){const t=ae(e.prefixPath,(e=>Li(e))).join(", "),n=0===e.production.idx?"":e.production.idx;let r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${function(e){if(e instanceof Rr)return"SUBRULE";if(e instanceof kr)return"OPTION";if(e instanceof Nr)return"OR";if(e instanceof $r)return"AT_LEAST_ONE";if(e instanceof xr)return"AT_LEAST_ONE_SEP";if(e instanceof Ir)return"MANY_SEP";if(e instanceof Sr)return"MANY";if(e instanceof Cr)return"CONSUME";throw Error("non exhaustive match")}(e.production)}${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return r+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",r}({topLevelRule:s.rule,ambiguityIndices:n,production:s.production,prefixPath:i}))}function to(e,t,n){const r=Se(t.configs.elements,(e=>e.state.transitions));var i,s;return{actualToken:n,possibleTokenTypes:(i=r.filter((e=>e instanceof Ia)).map((e=>e.tokenType)),s=e=>e.tokenTypeIdx,i&&i.length?ee(i,Y(s)):[]),tokenPath:e}}function no(e,t){if(e instanceof Ia&&Hi(t,e.tokenType))return e.target}function ro(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function io(e,t,n,r){return r=so(e,r),t.edges[n.tokenTypeIdx]=r,r}function so(e,t){if(t===Va)return t;const n=t.configs.key,r=e.states[n];return void 0!==r?r:(t.configs.finalize(),e.states[n]=t,t)}function ao(e,t){const n=e.state;if(7===n.type){if(e.stack.length>0){const n=[...e.stack];ao({state:n.pop(),alt:e.alt,stack:n},t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);const r=n.transitions.length;for(let i=0;i<r;i++){const r=oo(e,n.transitions[i]);void 0!==r&&ao(r,t)}}function oo(e,t){if(t instanceof Na)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof Ca){const n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}class lo{constructor(){this.nodeStack=[]}get current(){var e;return null!==(e=this.nodeStack[this.nodeStack.length-1])&&void 0!==e?e:this.rootNode}buildRootNode(e){return this.rootNode=new fo(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new ho;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const n=new uo(e.startOffset,e.image.length,ot(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 i of e){const e=new uo(i.startOffset,i.image.length,ot(i),i.tokenType,!0);e.root=this.rootNode,t.push(e)}let n=this.current,r=!1;if(n.content.length>0)n.content.push(...t);else{for(;n.container;){const e=n.container.content.indexOf(n);if(e>0){n.container.content.splice(e,0,...t),r=!0;break}n=n.container}r||this.rootNode.content.unshift(...t)}}construct(e){const t=this.current;"string"==typeof e.$type&&(this.current.astNode=e),e.$cstNode=t;const n=this.nodeStack.pop();0===(null==n?void 0:n.content.length)&&this.removeNode(n)}}class co{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,t;const n="string"==typeof(null===(e=this._astNode)||void 0===e?void 0:e.$type)?this._astNode:null===(t=this.container)||void 0===t?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 uo extends co{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,r,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=r,this._length=t,this._range=n}}class ho extends co{constructor(){super(...arguments),this.content=new po(this)}get children(){return this.content}get offset(){var e,t;return null!==(t=null===(e=this.firstNonHiddenNode)||void 0===e?void 0:e.offset)&&void 0!==t?t:0}get length(){return this.end-this.offset}get end(){var e,t;return null!==(t=null===(e=this.lastNonHiddenNode)||void 0===e?void 0:e.end)&&void 0!==t?t:0}get range(){const e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(void 0===this._rangeCache){const{range:n}=e,{range:r}=t;this._rangeCache={start:n.start,end:r.end.line<n.start.line?n.start:r.end}}return this._rangeCache}return{start:K.create(0,0),end:K.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 po extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,po.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 fo extends ho{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=null!=e?e:""}}const mo=Symbol("Datatype");function go(e){return e.$type===mo}const yo=e=>e.endsWith("​")?e:e+"​";class To{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const t=this.lexer.definition,n="production"===e.LanguageMetaData.mode;this.wrapper=new $o(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 vo extends To{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new lo,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),r=this.wrapper.DEFINE_RULE(yo(e.name),this.startImplementation(n,t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}computeRuleType(e){if(!e.fragment){if(sr(e))return mo;{const t=or(e);return null!=t?t:e.name}}}parse(e,t={}){this.nodeBuilder.buildRootNode(e);const n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;const r=t.rule?this.allRules.get(t.rule):this.mainRule;if(!r)throw new Error(t.rule?`No rule found with name '${t.rule}'`:"No main rule available.");const i=r.call(this.wrapper,{});return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:i,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}startImplementation(e,t){return n=>{const r=!this.isRecording()&&void 0!==e;if(r){const t={$type:e};this.stack.push(t),e===mo&&(t.value="")}let i;try{i=t(n)}catch(s){i=void 0}return void 0===i&&r&&(i=this.construct()),i}}extractHiddenTokens(e){const t=this.lexerResult.hidden;if(!t.length)return[];const n=e.startOffset;for(let r=0;r<t.length;r++){if(t[r].startOffset>n)return t.splice(0,r)}return t.splice(0,t.length)}consume(e,t,n){const r=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(r)){const e=this.extractHiddenTokens(r);this.nodeBuilder.addHiddenNodes(e);const t=this.nodeBuilder.buildLeafNode(r,n),{assignment:i,isCrossRef:s}=this.getAssignment(n),a=this.current;if(i){const e=ln(n)?r.image:this.converter.convert(r.image,t);this.assign(i.operator,i.feature,e,t,s)}else if(go(a)){let e=r.image;ln(n)||(e=this.converter.convert(e,t).toString()),a.value+=e}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&"number"==typeof e.endOffset&&!isNaN(e.endOffset)}subrule(e,t,n,r,i){let s;this.isRecording()||n||(s=this.nodeBuilder.buildCompositeNode(r));const a=this.wrapper.wrapSubrule(e,t,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(a,r,s)}performSubruleAssignment(e,t,n){const{assignment:r,isCrossRef:i}=this.getAssignment(t);if(r)this.assign(r.operator,r.feature,e,n,i);else if(!r){const t=this.current;if(go(t))t.value+=e.toString();else if("object"==typeof e&&e){const n=this.assignWithoutOverride(e,t);this.stack.pop(),this.stack.push(n)}}}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 r={$type:e};this.stack.push(r),this.assign(t.operator,t.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return function(e){for(const[t,n]of Object.entries(e))t.startsWith("$")||(Array.isArray(n)?n.forEach(((n,r)=>{Ke(n)&&(n.$container=e,n.$containerProperty=t,n.$containerIndex=r)})):Ke(n)&&(n.$container=e,n.$containerProperty=t))}(e),this.nodeBuilder.construct(e),this.stack.pop(),go(e)?this.converter.convert(e.value,e.$cstNode):(function(e,t){const n=e.getTypeMetaData(t.$type),r=t;for(const i of n.properties)void 0!==i.defaultValue&&void 0===r[i.name]&&(r[i.name]=wn(i.defaultValue))}(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const t=An(e,Zt);this.assignmentMap.set(e,{assignment:t,isCrossRef:!!t&&nn(t.terminal)})}return this.assignmentMap.get(e)}assign(e,t,n,r,i){const s=this.current;let a;switch(a=i&&"string"==typeof n?this.linker.buildReference(s,t,r,n):n,e){case"=":s[t]=a;break;case"?=":s[t]=!0;break;case"+=":Array.isArray(s[t])||(s[t]=[]),s[t].push(a)}}assignWithoutOverride(e,t){for(const[r,i]of Object.entries(t)){const t=e[r];void 0===t?e[r]=i:Array.isArray(t)&&Array.isArray(i)&&(i.push(...t),e[r]=i)}const n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class Ro{buildMismatchTokenMessage(e){return Wi.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Wi.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Wi.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Wi.buildEarlyExitMessage(e)}}class Eo extends Ro{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 Ao extends To{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(yo(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,r,i){this.before(r),this.wrapper.wrapSubrule(e,t,i),this.after(r)}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 ko={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Eo};class $o extends $a{constructor(e,t){const n=t&&"maxLookahead"in t;super(e,Object.assign(Object.assign(Object.assign({},ko),{lookaheadStrategy:n?new Qs({maxLookahead:t.maxLookahead}):new qa({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 xo(e,t,n){return function(e,t){const n=Jn(t,!1),r=et(t.rules).filter(Dt).filter((e=>n.has(e)));for(const i of r){const t=Object.assign(Object.assign({},e),{consume:1,optional:1,subrule:1,many:1,or:1});e.parser.rule(i,So(t,i.definition))}}({parser:t,tokens:n,ruleNames:new Map},e),t}function So(e,t,n=!1){let r;if(ln(t))r=function(e,t){const n=e.consume++,r=e.tokens[t.value];if(!r)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(n,r,t)}(e,t);else if(qt(t))r=function(e,t){const n=lr(t);return()=>e.parser.action(n,t)}(e,t);else if(Zt(t))r=So(e,t.terminal);else if(nn(t))r=Co(e,t);else if(hn(t))r=function(e,t){const n=t.rule.ref;if(Dt(n)){const r=e.subrule++,i=n.fragment,s=t.arguments.length>0?function(e,t){const n=t.map((e=>Io(e.value)));return t=>{const r={};for(let i=0;i<n.length;i++){const s=e.parameters[i],a=n[i];r[s.name]=a(t)}return r}}(n,t.arguments):()=>({});return a=>e.parser.subrule(r,Lo(e,n),i,t,s(a))}if(Vt(n)){const r=e.consume++,i=Oo(e,n.name);return()=>e.parser.consume(r,i,t)}if(!n)throw new ht(t.$cstNode,`Undefined rule: ${t.rule.$refText}`);pt()}(e,t);else if(Qt(t))r=function(e,t){if(1===t.elements.length)return So(e,t.elements[0]);{const n=[];for(const i of t.elements){const t={ALT:So(e,i,!0)},r=No(i);r&&(t.GATE=Io(r)),n.push(t)}const r=e.or++;return t=>e.parser.alternatives(r,n.map((e=>{const n={ALT:()=>e.ALT(t)},r=e.GATE;return r&&(n.GATE=()=>r(t)),n})))}}(e,t);else if(yn(t))r=function(e,t){if(1===t.elements.length)return So(e,t.elements[0]);const n=[];for(const o of t.elements){const t={ALT:So(e,o,!0)},r=No(o);r&&(t.GATE=Io(r)),n.push(t)}const r=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join("-")}`,s=t=>e.parser.alternatives(r,n.map(((n,s)=>{const a={ALT:()=>!0},o=e.parser;a.ALT=()=>{if(n.ALT(t),!o.isRecording()){const e=i(r,o);o.unorderedGroups.get(e)||o.unorderedGroups.set(e,[]);const t=o.unorderedGroups.get(e);void 0===(null==t?void 0:t[s])&&(t[s]=!0)}};const l=n.GATE;return a.GATE=l?()=>l(t):()=>{const e=o.unorderedGroups.get(i(r,o));return!(null==e?void 0:e[s])},a}))),a=wo(e,No(t),s,"*");return t=>{a(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}(e,t);else if(an(t))r=function(e,t){const n=t.elements.map((t=>So(e,t)));return e=>n.forEach((t=>t(e)))}(e,t);else{if(i=t,!En.isInstance(i,rn))throw new ht(t.$cstNode,`Unexpected element type: ${t.$type}`);{const n=e.consume++;r=()=>e.parser.consume(n,Vi,t)}}var i;return wo(e,n?void 0:No(t),r,t.cardinality)}function Io(e){if(t=e,En.isInstance(t,$t)){const t=Io(e.left),n=Io(e.right);return e=>t(e)||n(e)}if(function(e){return En.isInstance(e,kt)}(e)){const t=Io(e.left),n=Io(e.right);return e=>t(e)&&n(e)}if(function(e){return En.isInstance(e,Ot)}(e)){const t=Io(e.value);return e=>!t(e)}if(function(e){return En.isInstance(e,Pt)}(e)){const t=e.parameter.ref.name;return e=>void 0!==e&&!0===e[t]}if(function(e){return En.isInstance(e,At)}(e)){const t=Boolean(e.true);return()=>t}var t;pt()}function No(e){if(an(e))return e.guardCondition}function Co(e,t,n=t.terminal){if(n){if(hn(n)&&Dt(n.rule.ref)){const r=n.rule.ref,i=e.subrule++;return n=>e.parser.subrule(i,Lo(e,r),!1,t,n)}if(hn(n)&&Vt(n.rule.ref)){const r=e.consume++,i=Oo(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}if(ln(n)){const r=e.consume++,i=Oo(e,n.value);return()=>e.parser.consume(r,i,t)}throw new Error("Could not build cross reference parser")}{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);const n=rr(t.type.ref),r=null==n?void 0:n.terminal;if(!r)throw new Error("Could not find name assignment for type: "+lr(t.type.ref));return Co(e,t,r)}}function wo(e,t,n,r){const i=t&&Io(t);if(!r){if(i){const t=e.or++;return r=>e.parser.alternatives(t,[{ALT:()=>n(r),GATE:()=>i(r)},{ALT:Aa(),GATE:()=>!i(r)}])}return n}if("*"===r){const t=e.many++;return r=>e.parser.many(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}if("+"===r){const t=e.many++;if(i){const r=e.or++;return s=>e.parser.alternatives(r,[{ALT:()=>e.parser.atLeastOne(t,{DEF:()=>n(s)}),GATE:()=>i(s)},{ALT:Aa(),GATE:()=>!i(s)}])}return r=>e.parser.atLeastOne(t,{DEF:()=>n(r)})}if("?"===r){const t=e.optional++;return r=>e.parser.optional(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}pt()}function Lo(e,t){const n=function(e,t){if(Dt(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!Dt(r);){if(an(r)||Qt(r)||yn(r)){i=r.elements.indexOf(n).toString()+":"+i}n=r,r=r.$container}return i=r.name+":"+i,e.ruleNames.set(t,i),i}}(e,t),r=e.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Oo(e,t){const n=e.tokens[t];if(!n)throw new Error(`Token "${t}" not found."`);return n}function _o(e){const t=function(e){const t=e.Grammar,n=e.parser.Lexer,r=new vo(e);return xo(t,r,n.definition)}(e);return t.finalize(),t}class bo{constructor(){this.diagnostics=[]}buildTokens(e,t){const n=et(Jn(e,!1)),r=this.buildTerminalTokens(n),i=this.buildKeywordTokens(n,r,t);return r.forEach((e=>{const t=e.PATTERN;"object"==typeof t&&t&&"test"in t&&qn(t)?i.unshift(e):i.push(e)})),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Vt).filter((e=>!e.fragment)).map((e=>this.buildTerminalToken(e))).toArray()}buildTerminalToken(e){const t=cr(e),n=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,r={name:e.name,PATTERN:n};return"function"==typeof n&&(r.LINE_BREAKS=!0),e.hidden&&(r.GROUP=qn(t)?wi.SKIPPED:"hidden"),r}requiresCustomPattern(e){return!(!e.flags.includes("u")&&!e.flags.includes("s"))||!(!e.source.includes("?<=")&&!e.source.includes("?<!"))}regexPatternFunction(e){const t=new RegExp(e,e.flags+"y");return(e,n)=>{t.lastIndex=n;return t.exec(e)}}buildKeywordTokens(e,t,n){return e.filter(Dt).flatMap((e=>Sn(e).filter(ln))).distinct((e=>e.value)).toArray().sort(((e,t)=>t.value.length-e.value.length)).map((e=>this.buildKeywordToken(e,t,Boolean(null==n?void 0:n.caseInsensitive))))}buildKeywordToken(e,t,n){const r=this.buildKeywordPattern(e,n),i={name:e.value,PATTERN:r,LONGER_ALT:this.findLongerAlt(e,t)};return"function"==typeof r&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(function(e){return Array.prototype.map.call(e,(e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:Xn(e))).join("")}(e.value)):e.value}findLongerAlt(e,t){return t.reduce(((t,n)=>{const r=null==n?void 0:n.PATTERN;return(null==r?void 0:r.source)&&Qn("^"+r.source+"$",e.value)&&t.push(n),t}),[])}}class Po{convert(e,t){let n=t.grammarSource;if(nn(n)&&(n=function(e){if(e.terminal)return e.terminal;if(e.type.ref){const t=rr(e.type.ref);return null==t?void 0:t.terminal}}(n)),hn(n)){const r=n.rule.ref;if(!r)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(r,e,t)}return e}runConverter(e,t,n){var r;switch(e.name.toUpperCase()){case"INT":return Mo.convertInt(t);case"STRING":return Mo.convertString(t);case"ID":return Mo.convertID(t)}switch(null===(r=function(e){var t,n,r;return Vt(e)?null!==(n=null===(t=e.type)||void 0===t?void 0:t.name)&&void 0!==n?n:"string":null!==(r=or(e))&&void 0!==r?r:e.name}(e))||void 0===r?void 0:r.toLowerCase()){case"number":return Mo.convertNumber(t);case"boolean":return Mo.convertBoolean(t);case"bigint":return Mo.convertBigint(t);case"date":return Mo.convertDate(t);default:return t}}}var Mo;!function(e){function t(e){switch(e){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";case"0":return"\0";default:return e}}e.convertString=function(e){let n="";for(let r=1;r<e.length-1;r++){const i=e.charAt(r);if("\\"===i){n+=t(e.charAt(++r))}else n+=i}return n},e.convertID=function(e){return"^"===e.charAt(0)?e.substring(1):e},e.convertInt=function(e){return parseInt(e)},e.convertBigint=function(e){return BigInt(e)},e.convertDate=function(e){return new Date(e)},e.convertNumber=function(e){return Number(e)},e.convertBoolean=function(e){return"true"===e.toLowerCase()}}(Mo||(Mo={}));var Do=V();let Uo=0;const Go=Symbol("OperationCancelled");function Fo(e){return e===Go}async function Bo(e){if(e===Do.CancellationToken.None)return;const t=performance.now();if(t-Uo>=10&&(Uo=t,await new Promise((e=>{"undefined"==typeof setImmediate?setTimeout(e,0):setImmediate(e)})),Uo=performance.now()),e.isCancellationRequested)throw Go}class Ko{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)}))}}class Vo{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,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(Vo.isIncremental(n)){const e=Xo(n.range),t=this.offsetAt(e.start),r=this.offsetAt(e.end);this._content=this._content.substring(0,t)+n.text+this._content.substring(r,this._content.length);const i=Math.max(e.start.line,0),s=Math.max(e.end.line,0);let a=this._lineOffsets;const o=Yo(n.text,!1,t);if(s-i===o.length)for(let n=0,c=o.length;n<c;n++)a[n+i+1]=o[n];else o.length<1e4?a.splice(i+1,s-i,...o):this._lineOffsets=a=a.slice(0,i+1).concat(o,a.slice(s+1));const l=n.text.length-(r-t);if(0!==l)for(let n=i+1+o.length,c=a.length;n<c;n++)a[n]=a[n]+l}else{if(!Vo.isFull(n))throw new Error("Unknown change event received");this._content=n.text,this._lineOffsets=void 0}this._version=t}getLineOffsets(){return void 0===this._lineOffsets&&(this._lineOffsets=Yo(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const t=this.getLineOffsets();let n=0,r=t.length;if(0===r)return{line:0,character:e};for(;n<r;){const i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}const i=n-1;return{line:i,character:(e=this.ensureBeforeEOL(e,t[i]))-t[i]}}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 r=e.line+1<t.length?t[e.line+1]:this._content.length,i=Math.min(n+e.character,r);return this.ensureBeforeEOL(i,n)}ensureBeforeEOL(e,t){for(;e>t&&qo(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const t=e;return null!=t&&"string"==typeof t.text&&void 0!==t.range&&(void 0===t.rangeLength||"number"==typeof t.rangeLength)}static isFull(e){const t=e;return null!=t&&"string"==typeof t.text&&void 0===t.range&&void 0===t.rangeLength}}var jo,Ho,Wo;function zo(e,t){if(e.length<=1)return e;const n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);zo(r,t),zo(i,t);let s=0,a=0,o=0;for(;s<r.length&&a<i.length;){const n=t(r[s],i[a]);e[o++]=n<=0?r[s++]:i[a++]}for(;s<r.length;)e[o++]=r[s++];for(;a<i.length;)e[o++]=i[a++];return e}function Yo(e,t,n=0){const r=t?[n]:[];for(let i=0;i<e.length;i++){const t=e.charCodeAt(i);qo(t)&&(13===t&&i+1<e.length&&10===e.charCodeAt(i+1)&&i++,r.push(n+i+1))}return r}function qo(e){return 13===e||10===e}function Xo(e){const t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function Qo(e){const t=Xo(e.range);return t!==e.range?{newText:e.newText,range:t}:e}(Ho=jo||(jo={})).create=function(e,t,n,r){return new Vo(e,t,n,r)},Ho.update=function(e,t,n){if(e instanceof Vo)return e.update(t,n),e;throw new Error("TextDocument.update: document must be created by TextDocument.create")},Ho.applyEdits=function(e,t){const n=e.getText(),r=zo(t.map(Qo),((e,t)=>{const n=e.range.start.line-t.range.start.line;return 0===n?e.range.start.character-t.range.start.character:n}));let i=0;const s=[];for(const a of r){const t=e.offsetAt(a.range.start);if(t<i)throw new Error("Overlapping edit");t>i&&s.push(n.substring(i,t)),a.newText.length&&s.push(a.newText),i=e.offsetAt(a.range.end)}return s.push(n.substr(i)),s.join("")},(()=>{var e={470:e=>{function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,r="",i=0,s=-1,a=0,o=0;o<=e.length;++o){if(o<e.length)n=e.charCodeAt(o);else{if(47===n)break;n=47}if(47===n){if(s===o-1||1===a);else if(s!==o-1&&2===a){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var l=r.lastIndexOf("/");if(l!==r.length-1){-1===l?(r="",i=0):i=(r=r.slice(0,l)).length-1-r.lastIndexOf("/"),s=o,a=0;continue}}else if(2===r.length||1===r.length){r="",i=0,s=o,a=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(s+1,o):r=e.slice(s+1,o),i=o-s-1;s=o,a=0}else 46===n&&-1!==a?++a:a=-1}return r}var r={resolve:function(){for(var e,r="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(r=a+"/"+r,i=47===a.charCodeAt(0))}return r=n(r,!i),i?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(t(e),0===e.length)return".";var r=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!r)).length||r||(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var i=arguments[n];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=r.resolve(e))===(n=r.resolve(n)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var s=e.length,a=s-i,o=1;o<n.length&&47===n.charCodeAt(o);++o);for(var l=n.length-o,c=a<l?a:l,u=-1,d=0;d<=c;++d){if(d===c){if(l>c){if(47===n.charCodeAt(o+d))return n.slice(o+d+1);if(0===d)return n.slice(o+d)}else a>c&&(47===e.charCodeAt(i+d)?u=d:0===d&&(u=0));break}var h=e.charCodeAt(i+d);if(h!==n.charCodeAt(o+d))break;47===h&&(u=d)}var p="";for(d=i+u+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+n.slice(o+u):(o+=u,47===n.charCodeAt(o)&&++o,n.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),r=47===n,i=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(n=e.charCodeAt(a))){if(!s){i=a;break}}else s=!1;return-1===i?r?"/":".":r&&1===i?"//":e.slice(0,i)},basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError('"ext" argument must be a string');t(e);var r,i=0,s=-1,a=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var o=n.length-1,l=-1;for(r=e.length-1;r>=0;--r){var c=e.charCodeAt(r);if(47===c){if(!a){i=r+1;break}}else-1===l&&(a=!1,l=r+1),o>=0&&(c===n.charCodeAt(o)?-1==--o&&(s=r):(o=-1,s=l))}return i===s?s=l:-1===s&&(s=e.length),e.slice(i,s)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!a){i=r+1;break}}else-1===s&&(a=!1,s=r+1);return-1===s?"":e.slice(i,s)},extname:function(e){t(e);for(var n=-1,r=0,i=-1,s=!0,a=0,o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(47!==l)-1===i&&(s=!1,i=o+1),46===l?-1===n?n=o:1!==a&&(a=1):-1!==n&&(a=-1);else if(!s){r=o+1;break}}return-1===n||-1===i||0===a||1===a&&n===i-1&&n===r+1?"":e.slice(n,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return n=(t=e).dir||t.root,r=t.base||(t.name||"")+(t.ext||""),n?n===t.root?n+r:n+"/"+r:r;var t,n,r},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var r,i=e.charCodeAt(0),s=47===i;s?(n.root="/",r=1):r=0;for(var a=-1,o=0,l=-1,c=!0,u=e.length-1,d=0;u>=r;--u)if(47!==(i=e.charCodeAt(u)))-1===l&&(c=!1,l=u+1),46===i?-1===a?a=u:1!==d&&(d=1):-1!==a&&(d=-1);else if(!c){o=u+1;break}return-1===a||-1===l||0===d||1===d&&a===l-1&&a===o+1?-1!==l&&(n.base=n.name=0===o&&s?e.slice(1,l):e.slice(o,l)):(0===o&&s?(n.name=e.slice(1,a),n.base=e.slice(1,l)):(n.name=e.slice(o,a),n.base=e.slice(o,l)),n.ext=e.slice(a,l)),o>0?n.dir=e.slice(0,o-1):s&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{let e;if(n.r(r),n.d(r,{URI:()=>u,Utils:()=>x}),"object"==typeof process)e="win32"===process.platform;else if("object"==typeof navigator){let t=navigator.userAgent;e=t.indexOf("Windows")>=0}const t=/^\w[\w\d+.-]*$/,i=/^\//,s=/^\/\//;function a(e,n){if(!e.scheme&&n)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!t.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!i.test(e.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(s.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const o="",l="/",c=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class u{constructor(e,t,n,r,i,s=!1){f(this,"scheme"),f(this,"authority"),f(this,"path"),f(this,"query"),f(this,"fragment"),"object"==typeof e?(this.scheme=e.scheme||o,this.authority=e.authority||o,this.path=e.path||o,this.query=e.query||o,this.fragment=e.fragment||o):(this.scheme=function(e,t){return e||t?e:"file"}(e,s),this.authority=t||o,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==l&&(t=l+t):t=l}return t}(this.scheme,n||o),this.query=r||o,this.fragment=i||o,a(this,s))}static isUri(e){return e instanceof u||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"string"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString}get fsPath(){return y(this)}with(e){if(!e)return this;let{scheme:t,authority:n,path:r,query:i,fragment:s}=e;return void 0===t?t=this.scheme:null===t&&(t=o),void 0===n?n=this.authority:null===n&&(n=o),void 0===r?r=this.path:null===r&&(r=o),void 0===i?i=this.query:null===i&&(i=o),void 0===s?s=this.fragment:null===s&&(s=o),t===this.scheme&&n===this.authority&&r===this.path&&i===this.query&&s===this.fragment?this:new h(t,n,r,i,s)}static parse(e,t=!1){const n=c.exec(e);return n?new h(n[2]||o,E(n[4]||o),E(n[5]||o),E(n[7]||o),E(n[9]||o),t):new h(o,o,o,o,o)}static file(t){let n=o;if(e&&(t=t.replace(/\\/g,l)),t[0]===l&&t[1]===l){const e=t.indexOf(l,2);-1===e?(n=t.substring(2),t=l):(n=t.substring(2,e),t=t.substring(e)||l)}return new h("file",n,t,o,o)}static from(e){const t=new h(e.scheme,e.authority,e.path,e.query,e.fragment);return a(t,!0),t}toString(e=!1){return T(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof u)return e;{const t=new h(e);return t._formatted=e.external,t._fsPath=e._sep===d?e.fsPath:null,t}}return e}}const d=e?1:void 0;class h extends u{constructor(){super(...arguments),f(this,"_formatted",null),f(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=y(this)),this._fsPath}toString(e=!1){return e?T(this,!0):(this._formatted||(this._formatted=T(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=d),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}const p={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 m(e,t,n){let r,i=-1;for(let s=0;s<e.length;s++){const a=e.charCodeAt(s);if(a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57||45===a||46===a||95===a||126===a||t&&47===a||n&&91===a||n&&93===a||n&&58===a)-1!==i&&(r+=encodeURIComponent(e.substring(i,s)),i=-1),void 0!==r&&(r+=e.charAt(s));else{void 0===r&&(r=e.substr(0,s));const t=p[a];void 0!==t?(-1!==i&&(r+=encodeURIComponent(e.substring(i,s)),i=-1),r+=t):-1===i&&(i=s)}}return-1!==i&&(r+=encodeURIComponent(e.substring(i))),void 0!==r?r:e}function g(e){let t;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);35===r||63===r?(void 0===t&&(t=e.substr(0,n)),t+=p[r]):void 0!==t&&(t+=e[n])}return void 0!==t?t:e}function y(t,n){let r;return r=t.authority&&t.path.length>1&&"file"===t.scheme?`//${t.authority}${t.path}`:47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?t.path[1].toLowerCase()+t.path.substr(2):t.path,e&&(r=r.replace(/\//g,"\\")),r}function T(e,t){const n=t?g:m;let r="",{scheme:i,authority:s,path:a,query:o,fragment:c}=e;if(i&&(r+=i,r+=":"),(s||"file"===i)&&(r+=l,r+=l),s){let e=s.indexOf("@");if(-1!==e){const t=s.substr(0,e);s=s.substr(e+1),e=t.lastIndexOf(":"),-1===e?r+=n(t,!1,!1):(r+=n(t.substr(0,e),!1,!1),r+=":",r+=n(t.substr(e+1),!1,!0)),r+="@"}s=s.toLowerCase(),e=s.lastIndexOf(":"),-1===e?r+=n(s,!1,!0):(r+=n(s.substr(0,e),!1,!0),r+=s.substr(e))}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2)){const e=a.charCodeAt(1);e>=65&&e<=90&&(a=`/${String.fromCharCode(e+32)}:${a.substr(3)}`)}else if(a.length>=2&&58===a.charCodeAt(1)){const e=a.charCodeAt(0);e>=65&&e<=90&&(a=`${String.fromCharCode(e+32)}:${a.substr(2)}`)}r+=n(a,!0,!1)}return o&&(r+="?",r+=n(o,!1,!1)),c&&(r+="#",r+=t?c:m(c,!1,!1)),r}function v(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+v(e.substr(3)):e}}const R=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function E(e){return e.match(R)?e.replace(R,(e=>v(e))):e}var A=n(470);const k=A.posix||A,$="/";var x,S;(S=x||(x={})).joinPath=function(e,...t){return e.with({path:k.join(e.path,...t)})},S.resolvePath=function(e,...t){let n=e.path,r=!1;n[0]!==$&&(n=$+n,r=!0);let i=k.resolve(n,...t);return r&&i[0]===$&&!e.authority&&(i=i.substring(1)),e.with({path:i})},S.dirname=function(e){if(0===e.path.length||e.path===$)return e;let t=k.dirname(e.path);return 1===t.length&&46===t.charCodeAt(0)&&(t=""),e.with({path:t})},S.basename=function(e){return k.basename(e.path)},S.extname=function(e){return k.extname(e.path)}})(),Wo=r})();const{URI:Jo,Utils:Zo}=Wo;var el,tl,nl,rl;(tl=el||(el={})).basename=Zo.basename,tl.dirname=Zo.dirname,tl.extname=Zo.extname,tl.joinPath=Zo.joinPath,tl.resolvePath=Zo.resolvePath,tl.equals=function(e,t){return(null==e?void 0:e.toString())===(null==t?void 0:t.toString())},tl.relative=function(e,t){const n="string"==typeof e?e:e.path,r="string"==typeof t?t:t.path,i=n.split("/").filter((e=>e.length>0)),s=r.split("/").filter((e=>e.length>0));let a=0;for(;a<i.length&&i[a]===s[a];a++);return"../".repeat(i.length-a)+s.slice(a).join("/")},tl.normalize=function(e){return Jo.parse(e.toString()).toString()},(rl=nl||(nl={}))[rl.Changed=0]="Changed",rl[rl.Parsed=1]="Parsed",rl[rl.IndexedContent=2]="IndexedContent",rl[rl.ComputedScopes=3]="ComputedScopes",rl[rl.Linked=4]="Linked",rl[rl.IndexedReferences=5]="IndexedReferences",rl[rl.Validated=6]="Validated";class il{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Do.CancellationToken.None){const n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,t)}fromTextDocument(e,t,n){return t=null!=t?t:Jo.parse(e.uri),Do.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromString(e,t,n){return Do.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("string"==typeof t){const r=this.parse(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}if("$model"in t){const n={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}{const r=this.parse(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}async createAsync(e,t,n){if("string"==typeof t){const r=await this.parseAsync(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}{const r=await this.parseAsync(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}createLangiumDocument(e,t,n,r){let i;if(n)i={parseResult:e,uri:t,state:nl.Parsed,references:[],textDocument:n};else{const n=this.createTextDocumentGetter(t,r);i={parseResult:e,uri:t,state:nl.Parsed,references:[],get textDocument(){return n()}}}return e.value.$document=i,i}async update(e,t){var n,r;const i=null===(n=e.parseResult.value.$cstNode)||void 0===n?void 0:n.root.fullText,s=null===(r=this.textDocuments)||void 0===r?void 0:r.get(e.uri.toString()),a=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{const t=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:t})}return i!==a&&(e.parseResult=await this.parseAsync(e.uri,a,t),e.parseResult.value.$document=e),e.state=nl.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 r;return()=>null!=r?r:r=jo.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,null!=t?t:"")}}class sl{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return et(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((e=>(this.addDocument(e),e)));{const n=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(n),n}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const t=e.toString(),n=this.documentMap.get(t);if(n){this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=nl.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0}return n}deleteDocument(e){const t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=nl.Changed,this.documentMap.delete(t)),n}}const al=Symbol("ref_resolving");class ol{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=Do.CancellationToken.None){for(const n of In(e.parseResult.value))await Bo(t),Cn(n).forEach((t=>this.doLink(t,e)))}doLink(e,t){var n;const r=e.reference;if(void 0===r._ref){r._ref=al;try{const t=this.getCandidate(e);if(je(t))r._ref=t;else if(r._nodeDescription=t,this.langiumDocuments().hasDocument(t.documentUri)){const n=this.loadAstNode(t);r._ref=null!=n?n:this.createLinkingError(e,t)}else r._ref=void 0}catch(i){console.error(`An error occurred while resolving reference to '${r.$refText}':`,i);const t=null!==(n=i.message)&&void 0!==n?n:String(i);r._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${r.$refText}': ${t}`})}t.references.push(r)}}unlink(e){for(const t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){const t=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return null!=t?t:this.createLinkingError(e)}buildReference(e,t,n,r){const i=this,s={$refNode:n,$refText:r,get ref(){var n,a;if(Ke(this._ref))return this._ref;if("object"==typeof(a=this._nodeDescription)&&null!==a&&"string"==typeof a.name&&"string"==typeof a.type&&"string"==typeof a.path){const n=i.loadAstNode(this._nodeDescription);this._ref=null!=n?n:i.createLinkingError({reference:s,container:e,property:t},this._nodeDescription)}else if(void 0===this._ref){this._ref=al;const r=$n(e).$document,a=i.getLinkedNode({reference:s,container:e,property:t});if(a.error&&r&&r.state<nl.ComputedScopes)return this._ref=void 0;this._ref=null!==(n=a.node)&&void 0!==n?n:a.error,this._nodeDescription=a.descr,null==r||r.references.push(this)}else if(this._ref===al)throw new Error(`Cyclic reference resolution detected: ${i.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`);return Ke(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return je(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){var t;try{const t=this.getCandidate(e);if(je(t))return{error:t};const n=this.loadAstNode(t);return n?{node:n,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(n){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,n);const r=null!==(t=n.message)&&void 0!==t?t:String(n);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${r}`})}}}loadAstNode(e){if(e.node)return e.node;const t=this.langiumDocuments().getDocument(e.documentUri);return t?this.astNodeLocator.getAstNode(t.parseResult.value,e.path):void 0}createLinkingError(e,t){const n=$n(e.container).$document;n&&n.state<nl.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);const r=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${r} named '${e.reference.$refText}'.`,targetDescription:t})}}class ll{getName(e){if(function(e){return"string"==typeof e.name}(e))return e.name}getNameNode(e){return er(e.$cstNode,"name")}}class cl{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const t=function(e){var t;const n=e.astNode;for(;n===(null===(t=e.container)||void 0===t?void 0:t.astNode);){const t=An(e.grammarSource,Zt);if(t)return t;e=e.container}}(e),n=e.astNode;if(t&&n){const r=n[t.feature];if(Ve(r))return r.ref;if(Array.isArray(r))for(const t of r)if(Ve(t)&&t.$refNode&&t.$refNode.offset<=e.offset&&t.$refNode.end>=e.end)return t.ref}if(n){const t=this.nameProvider.getNameNode(n);if(t&&(t===e||function(e,t){for(;e.container;)if((e=e.container)===t)return!0;return!1}(e,t)))return n}}}findDeclarationNode(e){const t=this.findDeclaration(e);if(null==t?void 0:t.$cstNode){const e=this.nameProvider.getNameNode(t);return null!=e?e:t.$cstNode}}findReferences(e,t){const n=[];if(t.includeDeclaration){const t=this.getReferenceToSelf(e);t&&n.push(t)}let r=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(r=r.filter((e=>el.equals(e.sourceUri,t.documentUri)))),n.push(...r),et(n)}getReferenceToSelf(e){const t=this.nameProvider.getNameNode(e);if(t){const n=kn(e),r=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:r,targetUri:n.uri,targetPath:r,segment:lt(t),local:!0}}}}class ul{constructor(e){if(this.map=new Map,e)for(const[t,n]of e)this.add(t,n)}get size(){return nt.sum(et(this.map.values()).map((e=>e.length)))}clear(){this.map.clear()}delete(e,t){if(void 0===t)return this.map.delete(e);{const n=this.map.get(e);if(n){const r=n.indexOf(t);if(r>=0)return 1===n.length?this.map.delete(e):n.splice(r,1),!0}return!1}}get(e){var t;return null!==(t=this.map.get(e))&&void 0!==t?t:[]}has(e,t){if(void 0===t)return this.map.has(e);{const n=this.map.get(e);return!!n&&n.indexOf(t)>=0}}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((t=>e(t,n,this)))))}[Symbol.iterator](){return this.entries().iterator()}entries(){return et(this.map.entries()).flatMap((([e,t])=>t.map((t=>[e,t]))))}keys(){return et(this.map.keys())}values(){return et(this.map.values()).flat()}entriesGroupedByKey(){return et(this.map.entries())}}class dl{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 void 0!==t&&(this.map.delete(e),this.inverse.delete(t),!0)}}class hl{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=Do.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=xn,r=Do.CancellationToken.None){const i=[];this.exportNode(e,i,t);for(const s of n(e))await Bo(r),this.exportNode(s,i,t);return i}exportNode(e,t,n){const r=this.nameProvider.getName(e);r&&t.push(this.descriptions.createDescription(e,r,n))}async computeLocalScopes(e,t=Do.CancellationToken.None){const n=e.parseResult.value,r=new ul;for(const i of Sn(n))await Bo(t),this.processNode(i,e,r);return r}processNode(e,t,n){const r=e.$container;if(r){const i=this.nameProvider.getName(e);i&&n.add(r,this.descriptions.createDescription(e,i,t))}}}class pl{constructor(e,t,n){var r;this.elements=e,this.outerScope=t,this.caseInsensitive=null!==(r=null==n?void 0:n.caseInsensitive)&&void 0!==r&&r}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const t=this.caseInsensitive?this.elements.find((t=>t.name.toLowerCase()===e.toLowerCase())):this.elements.find((t=>t.name===e));return t||(this.outerScope?this.outerScope.getElement(e):void 0)}}class fl{constructor(e,t,n){var r;this.elements=new Map,this.caseInsensitive=null!==(r=null==n?void 0:n.caseInsensitive)&&void 0!==r&&r;for(const i of e){const e=this.caseInsensitive?i.name.toLowerCase():i.name;this.elements.set(e,i)}this.outerScope=t}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(t);return n||(this.outerScope?this.outerScope.getElement(e):void 0)}getAllElements(){let e=et(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class ml{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 gl extends ml{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}}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class yl extends ml{constructor(e){super(),this.cache=new Map,this.converter=null!=e?e:e=>e}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 r=this.cacheForContext(e);if(r.has(t))return r.get(t);if(n){const e=n();return r.set(t,e),e}}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 Tl extends gl{constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,(()=>{this.clear()}))),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(((e,t)=>{t.length>0&&this.clear()})))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((()=>{this.clear()})))}}class vl{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 Tl(e.shared)}getScope(e){const t=[],n=this.reflection.getReferenceType(e),r=kn(e.container).precomputedScopes;if(r){let i=e.container;do{const e=r.get(i);e.length>0&&t.push(et(e).filter((e=>this.reflection.isSubtype(e.type,n)))),i=i.$container}while(i)}let i=this.getGlobalScope(n,e);for(let s=t.length-1;s>=0;s--)i=this.createScope(t[s],i);return i}createScope(e,t,n){return new pl(et(e),t,n)}createScopeForNodes(e,t,n){const r=et(e).map((e=>{const t=this.nameProvider.getName(e);if(t)return this.descriptions.createDescription(e,t)})).nonNullable();return new pl(r,t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,(()=>new fl(this.indexManager.allElements(e))))}}function Rl(e){return"object"==typeof e&&!!e&&("$ref"in e||"$error"in e)}class El{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=null!=t?t:{},r=null==t?void 0:t.replacer,i=(e,t)=>this.replacer(e,t,n),s=r?(e,t)=>r(e,t,i):i;try{return this.currentDocument=kn(e),JSON.stringify(e,s,null==t?void 0:t.space)}finally{this.currentDocument=void 0}}deserialize(e,t){const n=null!=t?t:{},r=JSON.parse(e);return this.linkNode(r,r,n),r}replacer(e,t,{refText:n,sourceText:r,textRegions:i,comments:s,uriConverter:a}){var o,l,c,u;if(!this.ignoreProperties.has(e)){if(Ve(t)){const e=t.ref,r=n?t.$refText:void 0;if(e){const n=kn(e);let i="";this.currentDocument&&this.currentDocument!==n&&(i=a?a(n.uri,t):n.uri.toString());return{$ref:`${i}#${this.astNodeLocator.getAstNodePath(e)}`,$refText:r}}return{$error:null!==(l=null===(o=t.error)||void 0===o?void 0:o.message)&&void 0!==l?l:"Could not resolve reference",$refText:r}}if(Ke(t)){let n;if(i&&(n=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},t)),e&&!t.$document||!(null==n?void 0:n.$textRegion)||(n.$textRegion.documentURI=null===(c=this.currentDocument)||void 0===c?void 0:c.uri.toString())),r&&!e&&(null!=n||(n=Object.assign({},t)),n.$sourceText=null===(u=t.$cstNode)||void 0===u?void 0:u.text),s){null!=n||(n=Object.assign({},t));const e=this.commentProvider.getComment(t);e&&(n.$comment=e.replace(/\r/g,""))}return null!=n?n:t}return t}}addAstNodeRegionWithAssignmentsTo(e){const t=e=>({offset:e.offset,end:e.end,length:e.length,range:e.range});if(e.$cstNode){const n=(e.$textRegion=t(e.$cstNode)).assignments={};return Object.keys(e).filter((e=>!e.startsWith("$"))).forEach((r=>{const i=function(e,t){return e&&t?tr(e,t,e.astNode,!0):[]}(e.$cstNode,r).map(t);0!==i.length&&(n[r]=i)})),e}}linkNode(e,t,n,r,i,s){for(const[o,l]of Object.entries(e))if(Array.isArray(l))for(let r=0;r<l.length;r++){const i=l[r];Rl(i)?l[r]=this.reviveReference(e,o,t,i,n):Ke(i)&&this.linkNode(i,t,n,e,o,r)}else Rl(l)?e[o]=this.reviveReference(e,o,t,l,n):Ke(l)&&this.linkNode(l,t,n,e,o);const a=e;a.$container=r,a.$containerProperty=i,a.$containerIndex=s}reviveReference(e,t,n,r,i){let s=r.$refText,a=r.$error;if(r.$ref){const e=this.getRefNode(n,r.$ref,i.uriConverter);if(Ke(e))return s||(s=this.nameProvider.getName(e)),{$refText:null!=s?s:"",ref:e};a=e}if(a){const n={$refText:null!=s?s:""};return n.error={container:e,property:t,message:a,reference:n},n}}getRefNode(e,t,n){try{const r=t.indexOf("#");if(0===r){const n=this.astNodeLocator.getAstNode(e,t.substring(1));return n||"Could not resolve path: "+t}if(r<0){const e=n?n(t):Jo.parse(t),r=this.langiumDocuments.getDocument(e);return r?r.parseResult.value:"Could not find document for URI: "+t}const i=n?n(t.substring(0,r)):Jo.parse(t.substring(0,r)),s=this.langiumDocuments.getDocument(i);if(!s)return"Could not find document for URI: "+t;if(r===t.length-1)return s.parseResult.value;const a=this.astNodeLocator.getAstNode(s.parseResult.value,t.substring(r+1));return a||"Could not resolve URI: "+t}catch(r){return String(r)}}}class Al{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.textDocuments=null==e?void 0: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),1===this.languageIdMap.size?this.singleton=e:this.singleton=void 0}getServices(e){var t,n;if(void 0!==this.singleton)return this.singleton;if(0===this.languageIdMap.size)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const r=null===(n=null===(t=this.textDocuments)||void 0===t?void 0:t.get(e))||void 0===n?void 0:n.languageId;if(void 0!==r){const e=this.languageIdMap.get(r);if(e)return e}const i=el.extname(e),s=this.fileExtensionMap.get(i);if(!s)throw r?new Error(`The service registry contains no services for the extension '${i}' for language '${r}'.`):new Error(`The service registry contains no services for the extension '${i}'.`);return s}hasServices(e){try{return this.getServices(e),!0}catch(t){return!1}}get all(){return Array.from(this.languageIdMap.values())}}function kl(e){return{code:e}}var $l,xl,Sl;($l||($l={})).all=["fast","slow","built-in"];class Il{constructor(e){this.entries=new ul,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,t=this,n="fast"){if("built-in"===n)throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[r,i]of Object.entries(e)){const e=i;if(Array.isArray(e))for(const i of e){const e={check:this.wrapValidationException(i,t),category:n};this.addEntry(r,e)}else if("function"==typeof e){const i={check:this.wrapValidationException(e,t),category:n};this.addEntry(r,i)}else pt()}}wrapValidationException(e,t){return async(n,r,i)=>{await this.handleException((()=>e.call(t,n,r,i)),"An error occurred during validation",r,n)}}async handleException(e,t,n,r){try{await e()}catch(i){if(Fo(i))throw i;console.error(`${t}:`,i),i instanceof Error&&i.stack&&console.error(i.stack);n("error",`${t}: ${i instanceof Error?i.message:String(i)}`,{node:r})}}addEntry(e,t){if("AstNode"!==e)for(const n of this.reflection.getAllSubTypes(e))this.entries.add(n,t);else this.entries.add("AstNode",t)}getChecks(e,t){let n=et(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(n=n.filter((e=>t.includes(e.category)))),n.map((e=>e.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(r,i,s,a)=>{await this.handleException((()=>e.call(n,r,i,s,a)),t,i,r)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}}class Nl{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=Do.CancellationToken.None){const r=e.parseResult,i=[];if(await Bo(n),!t.categories||t.categories.includes("built-in")){if(this.processLexingErrors(r,i,t),t.stopAfterLexingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===xl.LexingError})))return i;if(this.processParsingErrors(r,i,t),t.stopAfterParsingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===xl.ParsingError})))return i;if(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===xl.LinkingError})))return i}try{i.push(...await this.validateAst(r.value,t,n))}catch(s){if(Fo(s))throw s;console.error("An error occurred during validation:",s)}return await Bo(n),i}processLexingErrors(e,t,n){var r,i,s;const a=[...e.lexerErrors,...null!==(i=null===(r=e.lexerReport)||void 0===r?void 0:r.diagnostics)&&void 0!==i?i:[]];for(const o of a){const e=null!==(s=o.severity)&&void 0!==s?s:"error",n={severity:wl(e),range:{start:{line:o.line-1,character:o.column-1},end:{line:o.line-1,character:o.column+o.length-1}},message:o.message,data:Ll(e),source:this.getSource()};t.push(n)}}processParsingErrors(e,t,n){for(const r of e.parserErrors){let e;if(isNaN(r.token.startOffset)){if("previousToken"in r){const t=r.previousToken;if(isNaN(t.startOffset)){const t={line:0,character:0};e={start:t,end:t}}else{const n={line:t.endLine-1,character:t.endColumn};e={start:n,end:n}}}}else e=ot(r.token);if(e){const n={severity:wl("error"),range:e,message:r.message,data:kl(xl.ParsingError),source:this.getSource()};t.push(n)}}}processLinkingErrors(e,t,n){for(const r of e.references){const e=r.error;if(e){const n={node:e.container,property:e.property,index:e.index,data:{code:xl.LinkingError,containerType:e.container.$type,property:e.property,refText:e.reference.$refText}};t.push(this.toDiagnostic("error",e.message,n))}}}async validateAst(e,t,n=Do.CancellationToken.None){const r=[],i=(e,t,n)=>{r.push(this.toDiagnostic(e,t,n))};return await this.validateAstBefore(e,t,i,n),await this.validateAstNodes(e,t,i,n),await this.validateAstAfter(e,t,i,n),r}async validateAstBefore(e,t,n,r=Do.CancellationToken.None){var i;const s=this.validationRegistry.checksBefore;for(const a of s)await Bo(r),await a(e,n,null!==(i=t.categories)&&void 0!==i?i:[],r)}async validateAstNodes(e,t,n,r=Do.CancellationToken.None){await Promise.all(In(e).map((async e=>{await Bo(r);const i=this.validationRegistry.getChecks(e.$type,t.categories);for(const t of i)await t(e,n,r)})))}async validateAstAfter(e,t,n,r=Do.CancellationToken.None){var i;const s=this.validationRegistry.checksAfter;for(const a of s)await Bo(r),await a(e,n,null!==(i=t.categories)&&void 0!==i?i:[],r)}toDiagnostic(e,t,n){return{message:t,range:Cl(n),severity:wl(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 Cl(e){if(e.range)return e.range;let t;return"string"==typeof e.property?t=er(e.node.$cstNode,e.property,e.index):"string"==typeof e.keyword&&(t=nr(e.node.$cstNode,e.keyword,e.index)),null!=t||(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function wl(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}function Ll(e){switch(e){case"error":return kl(xl.LexingError);case"warning":return kl(xl.LexingWarning);case"info":return kl(xl.LexingInfo);case"hint":return kl(xl.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}(Sl=xl||(xl={})).LexingError="lexing-error",Sl.LexingWarning="lexing-warning",Sl.LexingInfo="lexing-info",Sl.LexingHint="lexing-hint",Sl.ParsingError="parsing-error",Sl.LinkingError="linking-error";class Ol{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n){const r=null!=n?n:kn(e);null!=t||(t=this.nameProvider.getName(e));const i=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${i} has no name.`);let s;const a=()=>{var t;return null!=s?s:s=lt(null!==(t=this.nameProvider.getNameNode(e))&&void 0!==t?t:e.$cstNode)};return{node:e,name:t,get nameSegment(){return a()},selectionSegment:lt(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}}class _l{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Do.CancellationToken.None){const n=[],r=e.parseResult.value;for(const i of In(r))await Bo(t),Cn(i).filter((e=>!je(e))).forEach((e=>{const t=this.createDescription(e);t&&n.push(t)}));return n}createDescription(e){const t=e.reference.$nodeDescription,n=e.reference.$refNode;if(!t||!n)return;const r=kn(e.container).uri;return{sourceUri:r,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:lt(n),local:el.equals(t.documentUri,r)}}}class bl{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 void 0!==t?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce(((e,t)=>{if(!e||0===t.length)return e;const n=t.indexOf(this.indexSeparator);if(n>0){const r=t.substring(0,n),i=parseInt(t.substring(n+1)),s=e[r];return null==s?void 0:s[i]}return e[t]}),e)}}var Pl,Ml=j();class Dl{constructor(e){this._ready=new Ko,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Ml.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var t,n;this.workspaceConfig=null!==(n=null===(t=e.capabilities.workspace)||void 0===t?void 0:t.configuration)&&void 0!==n&&n}async initialized(e){if(this.workspaceConfig){if(e.register){const t=this.serviceRegistry.all;e.register({section:t.map((e=>this.toSectionName(e.LanguageMetaData.languageId)))})}if(e.fetchConfiguration){const t=this.serviceRegistry.all.map((e=>({section:this.toSectionName(e.LanguageMetaData.languageId)}))),n=await e.fetchConfiguration(t);t.forEach(((e,t)=>{this.updateSectionConfiguration(e.section,n[t])}))}}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}}(Pl||(Pl={})).create=function(e){return{dispose:async()=>await e()}};class Ul{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new ul,this.documentPhaseListeners=new ul,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=nl.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=Do.CancellationToken.None){var r,i;for(const s of e){const e=s.uri.toString();if(s.state===nl.Validated){if("boolean"==typeof t.validation&&t.validation)s.state=nl.IndexedReferences,s.diagnostics=void 0,this.buildState.delete(e);else if("object"==typeof t.validation){const n=this.buildState.get(e),a=null===(r=null==n?void 0:n.result)||void 0===r?void 0:r.validationChecks;if(a){const r=(null!==(i=t.validation.categories)&&void 0!==i?i:$l.all).filter((e=>!a.includes(e)));r.length>0&&(this.buildState.set(e,{completed:!1,options:{validation:Object.assign(Object.assign({},t.validation),{categories:r})},result:n.result}),s.state=nl.IndexedReferences)}}}else this.buildState.delete(e)}this.currentState=nl.Changed,await this.emitUpdate(e.map((e=>e.uri)),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=Do.CancellationToken.None){this.currentState=nl.Changed;for(const s of t)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString()),this.indexManager.remove(s);for(const s of e){if(!this.langiumDocuments.invalidateDocument(s)){const e=this.langiumDocumentFactory.fromModel({$type:"INVALID"},s);e.state=nl.Changed,this.langiumDocuments.addDocument(e)}this.buildState.delete(s.toString())}const r=et(e).concat(t).map((e=>e.toString())).toSet();this.langiumDocuments.all.filter((e=>!r.has(e.uri.toString())&&this.shouldRelink(e,r))).forEach((e=>{this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e),e.state=Math.min(e.state,nl.ComputedScopes),e.diagnostics=void 0})),await this.emitUpdate(e,t),await Bo(n);const i=this.sortDocuments(this.langiumDocuments.all.filter((e=>{var t;return e.state<nl.Linked||!(null===(t=this.buildState.get(e.uri.toString()))||void 0===t?void 0:t.completed)})).toArray());await this.buildDocuments(i,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 Boolean(null===(t=this.textDocuments)||void 0===t?void 0:t.get(e.uri))}shouldRelink(e,t){return!!e.references.some((e=>void 0!==e.error))||this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),Pl.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,nl.Parsed,n,(e=>this.langiumDocumentFactory.update(e,n))),await this.runCancelable(e,nl.IndexedContent,n,(e=>this.indexManager.updateContent(e,n))),await this.runCancelable(e,nl.ComputedScopes,n,(async e=>{const t=this.serviceRegistry.getServices(e.uri).references.ScopeComputation;e.precomputedScopes=await t.computeLocalScopes(e,n)})),await this.runCancelable(e,nl.Linked,n,(e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,n))),await this.runCancelable(e,nl.IndexedReferences,n,(e=>this.indexManager.updateReferences(e,n)));const r=e.filter((e=>this.shouldValidate(e)));await this.runCancelable(r,nl.Validated,n,(e=>this.validate(e,n)));for(const i of e){const e=this.buildState.get(i.uri.toString());e&&(e.completed=!0)}}prepareBuild(e,t){for(const n of e){const e=n.uri.toString(),r=this.buildState.get(e);r&&!r.completed||this.buildState.set(e,{completed:!1,options:t,result:null==r?void 0:r.result})}}async runCancelable(e,t,n,r){const i=e.filter((e=>e.state<t));for(const a of i)await Bo(n),await r(a),a.state=t,await this.notifyDocumentPhase(a,t,n);const s=e.filter((e=>e.state===t));await this.notifyBuildPhase(s,t,n),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),Pl.create((()=>{this.buildPhaseListeners.delete(e,t)}))}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),Pl.create((()=>{this.documentPhaseListeners.delete(e,t)}))}waitUntil(e,t,n){let r;if(t&&"path"in t?r=t:n=t,null!=n||(n=Do.CancellationToken.None),r){const t=this.langiumDocuments.getDocument(r);if(t&&t.state>e)return Promise.resolve(r)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Go):new Promise(((t,i)=>{const s=this.onBuildPhase(e,(()=>{if(s.dispose(),a.dispose(),r){const e=this.langiumDocuments.getDocument(r);t(null==e?void 0:e.uri)}else t(void 0)})),a=n.onCancellationRequested((()=>{s.dispose(),a.dispose(),i(Go)}))}))}async notifyDocumentPhase(e,t,n){const r=this.documentPhaseListeners.get(t).slice();for(const s of r)try{await s(e,n)}catch(i){if(!Fo(i))throw i}}async notifyBuildPhase(e,t,n){if(0===e.length)return;const r=this.buildPhaseListeners.get(t).slice();for(const i of r)await Bo(n),await i(e,n)}shouldValidate(e){return Boolean(this.getBuildOptions(e).validation)}async validate(e,t){var n,r;const i=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,a="object"==typeof s?s:void 0,o=await i.validateDocument(e,a,t);e.diagnostics?e.diagnostics.push(...o):e.diagnostics=o;const l=this.buildState.get(e.uri.toString());if(l){null!==(n=l.result)&&void 0!==n||(l.result={});const e=null!==(r=null==a?void 0:a.categories)&&void 0!==r?r:$l.all;l.result.validationChecks?l.result.validationChecks.push(...e):l.result.validationChecks=[...e]}}getBuildOptions(e){var t,n;return null!==(n=null===(t=this.buildState.get(e.uri.toString()))||void 0===t?void 0:t.options)&&void 0!==n?n:{}}}class Gl{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new yl,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){const n=kn(e).uri,r=[];return this.referenceIndex.forEach((e=>{e.forEach((e=>{el.equals(e.targetUri,n)&&e.targetPath===t&&r.push(e)}))})),et(r)}allElements(e,t){let n=et(this.symbolIndex.keys());return t&&(n=n.filter((e=>!t||t.has(e)))),n.map((t=>this.getFileDescriptions(t,e))).flat()}getFileDescriptions(e,t){var n;if(!t)return null!==(n=this.symbolIndex.get(e))&&void 0!==n?n:[];return this.symbolByTypeIndex.get(e,t,(()=>{var n;return(null!==(n=this.symbolIndex.get(e))&&void 0!==n?n:[]).filter((e=>this.astReflection.isSubtype(e.type,t)))}))}remove(e){const t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t),this.referenceIndex.delete(t)}async updateContent(e,t=Do.CancellationToken.None){const n=this.serviceRegistry.getServices(e.uri),r=await n.references.ScopeComputation.computeExports(e,t),i=e.uri.toString();this.symbolIndex.set(i,r),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=Do.CancellationToken.None){const n=this.serviceRegistry.getServices(e.uri),r=await n.workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),r)}isAffected(e,t){const n=this.referenceIndex.get(e.uri.toString());return!!n&&n.some((e=>!e.local&&t.has(e.targetUri.toString())))}}class Fl{constructor(e){this.initialBuildOptions={},this._ready=new Ko,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=null!==(t=e.workspaceFolders)&&void 0!==t?t:void 0}initialized(e){return this.mutex.write((e=>{var t;return this.initializeWorkspace(null!==(t=this.folders)&&void 0!==t?t:[],e)}))}async initializeWorkspace(e,t=Do.CancellationToken.None){const n=await this.performStartup(e);await Bo(t),await this.documentBuilder.build(n,this.initialBuildOptions,t)}async performStartup(e){const t=this.serviceRegistry.all.flatMap((e=>e.LanguageMetaData.fileExtensions)),n=[],r=e=>{n.push(e),this.langiumDocuments.hasDocument(e.uri)||this.langiumDocuments.addDocument(e)};return await this.loadAdditionalDocuments(e,r),await Promise.all(e.map((e=>[e,this.getRootFolder(e)])).map((async e=>this.traverseFolder(...e,t,r)))),this._ready.resolve(),n}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Jo.parse(e.uri)}async traverseFolder(e,t,n,r){const i=await this.fileSystemProvider.readDirectory(t);await Promise.all(i.map((async t=>{if(this.includeEntry(e,t,n))if(t.isDirectory)await this.traverseFolder(e,t.uri,n,r);else if(t.isFile){const e=await this.langiumDocuments.getOrCreateDocument(t.uri);r(e)}})))}includeEntry(e,t,n){const r=el.basename(t.uri);if(r.startsWith("."))return!1;if(t.isDirectory)return"node_modules"!==r&&"out"!==r;if(t.isFile){const e=el.extname(t.uri);return n.includes(e)}return!1}}class Bl{buildUnexpectedCharactersMessage(e,t,n,r,i){return Si.buildUnexpectedCharactersMessage(e,t,n,r,i)}buildUnableToPopLexerModeMessage(e){return Si.buildUnableToPopLexerModeMessage(e)}}const Kl={mode:"full"};class Vl{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,r="production"===e.LanguageMetaData.mode;this.chevrotainLexer=new wi(n,{positionTracking:"full",skipValidations:r,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Kl){var n,r,i;const s=this.chevrotainLexer.tokenize(e);return{tokens:s.tokens,errors:s.errors,hidden:null!==(n=s.groups.hidden)&&void 0!==n?n:[],report:null===(i=(r=this.tokenBuilder).flushLexingReport)||void 0===i?void 0:i.call(r,e)}}toTokenTypeDictionary(e){if(Hl(e))return e;const t=jl(e)?Object.values(e.modes).flat():e,n={};return t.forEach((e=>n[e.name]=e)),n}}function jl(e){return e&&"modes"in e&&"defaultMode"in e}function Hl(e){return!function(e){return Array.isArray(e)&&(0===e.length||"name"in e[0])}(e)&&!jl(e)}function Wl(e,t,n){let r,i;"string"==typeof e?(i=t,r=n):(i=e.range.start,r=t),i||(i=K.create(0,0));const s=function(e){var t,n,r;const i=[];let s=e.position.line,a=e.position.character;for(let o=0;o<e.lines.length;o++){const l=0===o,c=o===e.lines.length-1;let u=e.lines[o],d=0;if(l&&e.options.start){const n=null===(t=e.options.start)||void 0===t?void 0:t.exec(u);n&&(d=n.index+n[0].length)}else{const t=null===(n=e.options.line)||void 0===n?void 0:n.exec(u);t&&(d=t.index+t[0].length)}if(c){const t=null===(r=e.options.end)||void 0===r?void 0:r.exec(u);t&&(u=u.substring(0,t.index))}u=u.substring(0,ec(u));if(Zl(u,d)>=u.length){if(i.length>0){const e=K.create(s,a);i.push({type:"break",content:"",range:H.create(e,e)})}}else{Yl.lastIndex=d;const e=Yl.exec(u);if(e){const t=e[0],n=e[1],r=K.create(s,a+d),o=K.create(s,a+d+t.length);i.push({type:"tag",content:n,range:H.create(r,o)}),d+=t.length,d=Zl(u,d)}if(d<u.length){const e=u.substring(d),t=Array.from(e.matchAll(ql));i.push(...Xl(t,e,s,a+d))}}s++,a=0}if(i.length>0&&"break"===i[i.length-1].type)return i.slice(0,-1);return i}({lines:zl(e),position:i,options:ac(r)});return function(e){var t,n,r,i;const s=K.create(e.position.line,e.position.character);if(0===e.tokens.length)return new lc([],H.create(s,s));const a=[];for(;e.index<e.tokens.length;){const t=tc(e,a[a.length-1]);t&&a.push(t)}const o=null!==(n=null===(t=a[0])||void 0===t?void 0:t.range.start)&&void 0!==n?n:s,l=null!==(i=null===(r=a[a.length-1])||void 0===r?void 0:r.range.end)&&void 0!==i?i:s;return new lc(a,H.create(o,l))}({index:0,tokens:s,position:i})}function zl(e){let t="";t="string"==typeof e?e:e.text;return t.split(jn)}const Yl=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,ql=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Xl(e,t,n,r){const i=[];if(0===e.length){const e=K.create(n,r),s=K.create(n,r+t.length);i.push({type:"text",content:t,range:H.create(e,s)})}else{let s=0;for(const o of e){const e=o.index,a=t.substring(s,e);a.length>0&&i.push({type:"text",content:t.substring(s,e),range:H.create(K.create(n,s+r),K.create(n,e+r))});let l=a.length+1;const c=o[1];if(i.push({type:"inline-tag",content:c,range:H.create(K.create(n,s+l+r),K.create(n,s+l+c.length+r))}),l+=c.length,4===o.length){l+=o[2].length;const e=o[3];i.push({type:"text",content:e,range:H.create(K.create(n,s+l+r),K.create(n,s+l+e.length+r))})}else i.push({type:"text",content:"",range:H.create(K.create(n,s+l+r),K.create(n,s+l+r))});s=e+o[0].length}const a=t.substring(s);a.length>0&&i.push({type:"text",content:a,range:H.create(K.create(n,s+r),K.create(n,s+r+a.length))})}return i}const Ql=/\S/,Jl=/\s*$/;function Zl(e,t){const n=e.substring(t).match(Ql);return n?t+n.index:e.length}function ec(e){const t=e.match(Jl);if(t&&"number"==typeof t.index)return t.index}function tc(e,t){const n=e.tokens[e.index];return"tag"===n.type?ic(e,!1):"text"===n.type||"inline-tag"===n.type?nc(e):(function(e,t){if(t){const n=new dc("",e.range);"inlines"in t?t.inlines.push(n):t.content.inlines.push(n)}}(n,t),void e.index++)}function nc(e){let t=e.tokens[e.index];const n=t;let r=t;const i=[];for(;t&&"break"!==t.type&&"tag"!==t.type;)i.push(rc(e)),r=t,t=e.tokens[e.index];return new uc(i,H.create(n.range.start,r.range.end))}function rc(e){return"inline-tag"===e.tokens[e.index].type?ic(e,!0):sc(e)}function ic(e,t){const n=e.tokens[e.index++],r=n.content.substring(1),i=e.tokens[e.index];if("text"===(null==i?void 0:i.type)){if(t){const i=sc(e);return new cc(r,new uc([i],i.range),t,H.create(n.range.start,i.range.end))}{const i=nc(e);return new cc(r,i,t,H.create(n.range.start,i.range.end))}}{const e=n.range;return new cc(r,new uc([],e),t,e)}}function sc(e){const t=e.tokens[e.index++];return new dc(t.content,t.range)}function ac(e){if(!e)return ac({start:"/**",end:"*/",line:"*"});const{start:t,end:n,line:r}=e;return{start:oc(t,!0),end:oc(n,!1),line:oc(r,!0)}}function oc(e,t){if("string"==typeof e||"object"==typeof e){const n="string"==typeof e?Xn(e):e.source;return t?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}return e}class lc{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(0===e.length)e=t.toString();else{const n=t.toString();e+=hc(e)+n}return e.trim()}toMarkdown(e){let t="";for(const n of this.elements)if(0===t.length)t=n.toMarkdown(e);else{const r=n.toMarkdown(e);t+=hc(t)+r}return t.trim()}}class cc{constructor(e,t,n,r){this.name=e,this.content=t,this.inline=n,this.range=r}toString(){let e=`@${this.name}`;const t=this.content.toString();return 1===this.content.inlines.length?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e}\n${t}`),this.inline?`{${e}}`:e}toMarkdown(e){var t,n;return null!==(n=null===(t=null==e?void 0:e.renderTag)||void 0===t?void 0:t.call(e,this))&&void 0!==n?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){const t=this.content.toMarkdown(e);if(this.inline){const n=function(e,t,n){var r,i;if("linkplain"===e||"linkcode"===e||"link"===e){const s=t.indexOf(" ");let a=t;if(s>0){const e=Zl(t,s);a=t.substring(e),t=t.substring(0,s)}("linkcode"===e||"link"===e&&"code"===n.link)&&(a=`\`${a}\``);const o=null!==(i=null===(r=n.renderLink)||void 0===r?void 0:r.call(n,t,a))&&void 0!==i?i:function(e,t){try{return Jo.parse(e,!0),`[${t}](${e})`}catch(r){return e}}(t,a);return o}return}(this.name,t,null!=e?e:{});if("string"==typeof n)return n}let n="";"italic"===(null==e?void 0:e.tag)||void 0===(null==e?void 0:e.tag)?n="*":"bold"===(null==e?void 0:e.tag)?n="**":"bold-italic"===(null==e?void 0:e.tag)&&(n="***");let r=`${n}@${this.name}${n}`;return 1===this.content.inlines.length?r=`${r} — ${t}`:this.content.inlines.length>1&&(r=`${r}\n${t}`),this.inline?`{${r}}`:r}}class uc{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],r=this.inlines[t+1];e+=n.toString(),r&&r.range.start.line>n.range.start.line&&(e+="\n")}return e}toMarkdown(e){let t="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];t+=r.toMarkdown(e),i&&i.range.start.line>r.range.start.line&&(t+="\n")}return t}}class dc{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function hc(e){return e.endsWith("\n")?"\n":"\n\n"}class pc{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const t=this.commentProvider.getComment(e);if(t&&function(e,t){const n=ac(t),r=zl(e);if(0===r.length)return!1;const i=r[0],s=r[r.length-1],a=n.start,o=n.end;return Boolean(null==a?void 0:a.exec(i))&&Boolean(null==o?void 0:o.exec(s))}(t)){return Wl(t).toMarkdown({renderLink:(t,n)=>this.documentationLinkRenderer(e,t,n),renderTag:t=>this.documentationTagRenderer(e,t)})}}documentationLinkRenderer(e,t,n){var r;const i=null!==(r=this.findNameInPrecomputedScopes(e,t))&&void 0!==r?r:this.findNameInGlobalScope(e,t);if(i&&i.nameSegment){const e=i.nameSegment.range.start.line+1,t=i.nameSegment.range.start.character+1;return`[${n}](${i.documentUri.with({fragment:`L${e},${t}`}).toString()})`}}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){const n=kn(e).precomputedScopes;if(!n)return;let r=e;do{const e=n.get(r).find((e=>e.name===t));if(e)return e;r=r.$container}while(r)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find((e=>e.name===t))}}class fc{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return function(e){return"string"==typeof e.$comment}(e)?e.$comment:null===(t=function(e,t){if(e){const n=function(e,t=!0){for(;e.container;){const n=e.container;let r=n.content.indexOf(e);for(;r>0;){r--;const e=n.content[r];if(t||!e.hidden)return e}e=n}}(e,!0);if(n&&dt(n,t))return n;if(Ye(e))for(let r=e.content.findIndex((e=>!e.hidden))-1;r>=0;r--){const n=e.content[r];if(dt(n,t))return n}}}(e.$cstNode,this.grammarConfig().multilineCommentRules))||void 0===t?void 0:t.text}}class mc{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}}class gc{constructor(){this.previousTokenSource=new Do.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=(Uo=performance.now(),new Do.CancellationTokenSource);return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n=Do.CancellationToken.None){const r=new Ko,i={action:t,deferred:r,cancellationToken:n};return e.push(i),this.performNextOperation(),r.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))return;e.push(...this.readQueue.splice(0,this.readQueue.length))}this.done=!1,await Promise.all(e.map((async({action:e,deferred:t,cancellationToken:n})=>{try{const r=await Promise.resolve().then((()=>e(n)));t.resolve(r)}catch(r){Fo(r)?t.resolve(void 0):t.reject(r)}}))),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class yc{constructor(e){this.grammarElementIdMap=new dl,this.tokenTypeIdMap=new dl,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((e=>Object.assign(Object.assign({},e),{message:e.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 r of In(e))t.set(r,{});if(e.$cstNode)for(const r of at(e.$cstNode))n.set(r,{});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,void 0!==e.$cstNode&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(const[r,i]of Object.entries(e))if(!r.startsWith("$"))if(Array.isArray(i)){const e=[];n[r]=e;for(const n of i)Ke(n)?e.push(this.dehydrateAstNode(n,t)):Ve(n)?e.push(this.dehydrateReference(n,t)):e.push(n)}else Ke(i)?n[r]=this.dehydrateAstNode(i,t):Ve(i)?n[r]=this.dehydrateReference(i,t):void 0!==i&&(n[r]=i);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 Ye(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),We(e)?n.content=e.content.map((e=>this.dehydrateCstNode(e,t))):ze(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 i of In(e))t.set(i,{});let r;if(e.$cstNode)for(const i of at(e.$cstNode)){let e;"fullText"in i?(e=new fo(i.fullText),r=e):"content"in i?e=new ho:"tokenType"in i&&(e=this.hydrateCstLeafNode(i)),e&&(n.set(i,e),e.root=r)}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[r,i]of Object.entries(e))if(!r.startsWith("$"))if(Array.isArray(i)){const e=[];n[r]=e;for(const s of i)Ke(s)?e.push(this.setParent(this.hydrateAstNode(s,t),n)):Ve(s)?e.push(this.hydrateReference(s,n,r,t)):e.push(s)}else Ke(i)?n[r]=this.setParent(this.hydrateAstNode(i,t),n):Ve(i)?n[r]=this.hydrateReference(i,n,r,t):void 0!==i&&(n[r]=i);return n}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,n,r){return this.linker.buildReference(t,n,r.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,n=0){const r=t.cstNodes.get(e);if("number"==typeof e.grammarSource&&(r.grammarSource=this.getGrammarElement(e.grammarSource)),r.astNode=t.astNodes.get(e.astNode),We(r))for(const i of e.content){const e=this.hydrateCstNode(i,t,n++);r.content.push(e)}return r}hydrateCstLeafNode(e){const t=this.getTokenType(e.tokenType),n=e.offset,r=e.length,i=e.startLine,s=e.startColumn,a=e.endLine,o=e.endColumn,l=e.hidden;return new uo(n,r,{start:{line:i,character:s},end:{line:a,character:o}},t,l)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return 0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap();return this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(const n of In(this.grammar))t=n,En.isInstance(t,vt)&&this.grammarElementIdMap.set(n,e++);var t}}function Tc(e){return{documentation:{CommentProvider:e=>new fc(e),DocumentationProvider:e=>new pc(e)},parser:{AsyncParser:e=>new mc(e),GrammarConfig:e=>function(e){const t=[],n=e.Grammar;for(const i of n.rules)Vt(i)&&(r=i).hidden&&!qn(cr(r))&&zn(cr(i))&&t.push(i.name);var r;return{multilineCommentRules:t,nameRegexp:ut}}(e),LangiumParser:e=>_o(e),CompletionParser:e=>function(e){const t=e.Grammar,n=e.parser.Lexer,r=new Ao(e);return xo(t,r,n.definition),r.finalize(),r}(e),ValueConverter:()=>new Po,TokenBuilder:()=>new bo,Lexer:e=>new Vl(e),ParserErrorMessageProvider:()=>new Eo,LexerErrorMessageProvider:()=>new Bl},workspace:{AstNodeLocator:()=>new bl,AstNodeDescriptionProvider:e=>new Ol(e),ReferenceDescriptionProvider:e=>new _l(e)},references:{Linker:e=>new ol(e),NameProvider:()=>new ll,ScopeProvider:e=>new vl(e),ScopeComputation:e=>new hl(e),References:e=>new cl(e)},serializer:{Hydrator:e=>new yc(e),JsonSerializer:e=>new El(e)},validation:{DocumentValidator:e=>new Nl(e),ValidationRegistry:e=>new Il(e)},shared:()=>e.shared}}function vc(e){return{ServiceRegistry:e=>new Al(e),workspace:{LangiumDocuments:e=>new sl(e),LangiumDocumentFactory:e=>new il(e),DocumentBuilder:e=>new Ul(e),IndexManager:e=>new Gl(e),WorkspaceManager:e=>new Fl(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new gc,ConfigurationProvider:e=>new Dl(e)}}}var Rc;function Ec(e,t,n,r,i,s,a,o,l){return kc([e,t,n,r,i,s,a,o,l].reduce(Sc,{}))}(Rc||(Rc={})).merge=(e,t)=>Sc(Sc({},e),t);const Ac=Symbol("isProxy");function kc(e,t){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===Ac||xc(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(xc(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(t,n)=>n in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return n}const $c=Symbol();function xc(e,t,n,r){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:e[t]});if(e[t]===$c)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return e[t]}if(t in n){const s=n[t];e[t]=$c;try{e[t]="function"==typeof s?s(r):kc(s,r)}catch(i){throw e[t]=i instanceof Error?i:void 0,i}return e[t]}}function Sc(e,t){if(t)for(const[n,r]of Object.entries(t))if(void 0!==r){const t=e[n];e[n]=null!==t&&null!==r&&"object"==typeof t&&"object"==typeof r?Sc(t,r):r}return e}class Ic{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const Nc={fileSystemProvider:()=>new Ic},Cc={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},wc={AstReflection:()=>new Rn};function Lc(e){var t;const n=function(){const e=Ec(vc(Nc),wc),t=Ec(Tc({shared:e}),Cc);return e.ServiceRegistry.register(t),t}(),r=n.serializer.JsonSerializer.deserialize(e);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Jo.parse(`memory://${null!==(t=r.name)&&void 0!==t?t:"grammar"}.langium`)),r}var Oc=Object.defineProperty,_c=(e,t)=>Oc(e,"name",{value:t,configurable:!0}),bc="Statement",Pc="Architecture";_c((function(e){return du.isInstance(e,Pc)}),"isArchitecture");var Mc="Axis",Dc="Branch";_c((function(e){return du.isInstance(e,Dc)}),"isBranch");var Uc="Checkout",Gc="CherryPicking",Fc="Commit";_c((function(e){return du.isInstance(e,Fc)}),"isCommit");var Bc="Common";_c((function(e){return du.isInstance(e,Bc)}),"isCommon");var Kc="Curve",Vc="Edge",jc="Entry",Hc="GitGraph";_c((function(e){return du.isInstance(e,Hc)}),"isGitGraph");var Wc="Group",zc="Info";_c((function(e){return du.isInstance(e,zc)}),"isInfo");var Yc="Junction",qc="Merge";_c((function(e){return du.isInstance(e,qc)}),"isMerge");var Xc="Option",Qc="Packet";_c((function(e){return du.isInstance(e,Qc)}),"isPacket");var Jc="PacketBlock";_c((function(e){return du.isInstance(e,Jc)}),"isPacketBlock");var Zc="Pie";_c((function(e){return du.isInstance(e,Zc)}),"isPie");var eu="PieSection";_c((function(e){return du.isInstance(e,eu)}),"isPieSection");var tu,nu,ru,iu,su,au,ou="Radar",lu="Service",cu="Direction",uu=(_c(e=class extends He{getAllTypes(){return[Pc,Mc,Dc,Uc,Gc,Fc,Bc,Kc,cu,Vc,jc,Hc,Wc,zc,Yc,qc,Xc,Qc,Jc,Zc,eu,ou,lu,bc]}computeIsSubtype(e,t){switch(e){case Dc:case Uc:case Gc:case Fc:case qc:return this.isSubtype(bc,t);case cu:return this.isSubtype(Hc,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;if("Entry:axis"===t)return Mc;throw new Error(`${t} is not a valid reference id.`)}getTypeMetaData(e){switch(e){case Pc:return{name:Pc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case Mc:return{name:Mc,properties:[{name:"label"},{name:"name"}]};case Dc:return{name:Dc,properties:[{name:"name"},{name:"order"}]};case Uc:return{name:Uc,properties:[{name:"branch"}]};case Gc:return{name:Gc,properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case Fc:return{name:Fc,properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case Bc:return{name:Bc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case Kc:return{name:Kc,properties:[{name:"entries",defaultValue:[]},{name:"label"},{name:"name"}]};case Vc:return{name:Vc,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 jc:return{name:jc,properties:[{name:"axis"},{name:"value"}]};case Hc:return{name:Hc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case Wc:return{name:Wc,properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case zc:return{name:zc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case Yc:return{name:Yc,properties:[{name:"id"},{name:"in"}]};case qc:return{name:qc,properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case Xc:return{name:Xc,properties:[{name:"name"},{name:"value",defaultValue:!1}]};case Qc:return{name:Qc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case Jc:return{name:Jc,properties:[{name:"end"},{name:"label"},{name:"start"}]};case Zc:return{name:Zc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case eu:return{name:eu,properties:[{name:"label"},{name:"value"}]};case ou:return{name:ou,properties:[{name:"accDescr"},{name:"accTitle"},{name:"axes",defaultValue:[]},{name:"curves",defaultValue:[]},{name:"options",defaultValue:[]},{name:"title"}]};case lu:return{name:lu,properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case cu:return{name:cu,properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};default:return{name:e,properties:[]}}}},"MermaidAstReflection"),e),du=new uu,hu=_c((()=>tu??(tu=Lc('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":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@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"InfoGrammar"),pu=_c((()=>nu??(nu=Lc('{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":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":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":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@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"PacketGrammar"),fu=_c((()=>ru??(ru=Lc('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"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@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":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@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"PieGrammar"),mu=_c((()=>iu??(iu=Lc('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"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@15"},"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@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"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@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":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},{"$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":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"ArchitectureGrammar"),gu=_c((()=>su??(su=Lc('{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"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@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"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@1"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"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@1"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"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@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"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":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}'))),"GitGraphGrammar"),yu=_c((()=>au??(au=Lc('{"$type":"Grammar","isDeclared":true,"name":"Radar","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@12"}}}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"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@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"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@22"},"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@21"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"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@21"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"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@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@12"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"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@19"},"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@18"},"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@18"},"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@18"},"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@20"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":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":"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":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9\\\\-_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}'))),"RadarGrammar"),Tu={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},vu={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Ru={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Eu={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Au={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ku={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},$u={AstReflection:_c((()=>new uu),"AstReflection")},xu={Grammar:_c((()=>hu()),"Grammar"),LanguageMetaData:_c((()=>Tu),"LanguageMetaData"),parser:{}},Su={Grammar:_c((()=>pu()),"Grammar"),LanguageMetaData:_c((()=>vu),"LanguageMetaData"),parser:{}},Iu={Grammar:_c((()=>fu()),"Grammar"),LanguageMetaData:_c((()=>Ru),"LanguageMetaData"),parser:{}},Nu={Grammar:_c((()=>mu()),"Grammar"),LanguageMetaData:_c((()=>Eu),"LanguageMetaData"),parser:{}},Cu={Grammar:_c((()=>gu()),"Grammar"),LanguageMetaData:_c((()=>Au),"LanguageMetaData"),parser:{}},wu={Grammar:_c((()=>yu()),"Grammar"),LanguageMetaData:_c((()=>ku),"LanguageMetaData"),parser:{}},Lu={ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/accTitle[\t ]*:([^\n\r]*)/,TITLE:/title([\t ][^\n\r]*|)/},Ou=(_c(t=class extends Po{runConverter(e,t,n){let r=this.runCommonConverter(e,t,n);return void 0===r&&(r=this.runCustomConverter(e,t,n)),void 0===r?super.runConverter(e,t,n):r}runCommonConverter(e,t,n){const r=Lu[e.name];if(void 0===r)return;const i=r.exec(t);return null!==i?void 0!==i[1]?i[1].trim().replace(/[\t ]{2,}/gm," "):void 0!==i[2]?i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,"\n"):void 0:void 0}},"AbstractMermaidValueConverter"),t),_u=(_c(n=class extends Ou{runCustomConverter(e,t,n){}},"CommonValueConverter"),n),bu=(_c(r=class extends bo{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,n){const r=super.buildKeywordTokens(e,t,n);return r.forEach((e=>{this.keywords.has(e.name)&&void 0!==e.PATTERN&&(e.PATTERN=new RegExp(e.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))})),r}},"AbstractMermaidTokenBuilder"),r);_c(class extends bu{},"CommonTokenBuilder");var Pu=(_c(i=class extends bu{constructor(){super(["gitGraph"])}},"GitGraphTokenBuilder"),i),Mu={parser:{TokenBuilder:_c((()=>new Pu),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function Du(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Cu,Mu);return t.ServiceRegistry.register(n),{shared:t,GitGraph:n}}_c(Du,"createGitGraphServices");var Uu=(_c(s=class extends bu{constructor(){super(["info","showInfo"])}},"InfoTokenBuilder"),s),Gu={parser:{TokenBuilder:_c((()=>new Uu),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function Fu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),xu,Gu);return t.ServiceRegistry.register(n),{shared:t,Info:n}}_c(Fu,"createInfoServices");var Bu=(_c(a=class extends bu{constructor(){super(["packet-beta"])}},"PacketTokenBuilder"),a),Ku={parser:{TokenBuilder:_c((()=>new Bu),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function Vu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Su,Ku);return t.ServiceRegistry.register(n),{shared:t,Packet:n}}_c(Vu,"createPacketServices");var ju=(_c(o=class extends bu{constructor(){super(["pie","showData"])}},"PieTokenBuilder"),o),Hu=(_c(l=class extends Ou{runCustomConverter(e,t,n){if("PIE_SECTION_LABEL"===e.name)return t.replace(/"/g,"").trim()}},"PieValueConverter"),l),Wu={parser:{TokenBuilder:_c((()=>new ju),"TokenBuilder"),ValueConverter:_c((()=>new Hu),"ValueConverter")}};function zu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Iu,Wu);return t.ServiceRegistry.register(n),{shared:t,Pie:n}}_c(zu,"createPieServices");var Yu=(_c(c=class extends bu{constructor(){super(["architecture"])}},"ArchitectureTokenBuilder"),c),qu=(_c(u=class extends Ou{runCustomConverter(e,t,n){return"ARCH_ICON"===e.name?t.replace(/[()]/g,"").trim():"ARCH_TEXT_ICON"===e.name?t.replace(/["()]/g,""):"ARCH_TITLE"===e.name?t.replace(/[[\]]/g,"").trim():void 0}},"ArchitectureValueConverter"),u),Xu={parser:{TokenBuilder:_c((()=>new Yu),"TokenBuilder"),ValueConverter:_c((()=>new qu),"ValueConverter")}};function Qu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Nu,Xu);return t.ServiceRegistry.register(n),{shared:t,Architecture:n}}_c(Qu,"createArchitectureServices");var Ju=(_c(d=class extends bu{constructor(){super(["radar-beta"])}},"RadarTokenBuilder"),d),Zu={parser:{TokenBuilder:_c((()=>new Ju),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function ed(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),wu,Zu);return t.ServiceRegistry.register(n),{shared:t,Radar:n}}_c(ed,"createRadarServices");var td={},nd={info:_c((async()=>{const{createInfoServices:e}=await W((async()=>{const{createInfoServices:e}=await Promise.resolve().then((()=>sd));return{createInfoServices:e}}),void 0,import.meta.url),t=e().Info.parser.LangiumParser;td.info=t}),"info"),packet:_c((async()=>{const{createPacketServices:e}=await W((async()=>{const{createPacketServices:e}=await Promise.resolve().then((()=>ad));return{createPacketServices:e}}),void 0,import.meta.url),t=e().Packet.parser.LangiumParser;td.packet=t}),"packet"),pie:_c((async()=>{const{createPieServices:e}=await W((async()=>{const{createPieServices:e}=await Promise.resolve().then((()=>od));return{createPieServices:e}}),void 0,import.meta.url),t=e().Pie.parser.LangiumParser;td.pie=t}),"pie"),architecture:_c((async()=>{const{createArchitectureServices:e}=await W((async()=>{const{createArchitectureServices:e}=await Promise.resolve().then((()=>ld));return{createArchitectureServices:e}}),void 0,import.meta.url),t=e().Architecture.parser.LangiumParser;td.architecture=t}),"architecture"),gitGraph:_c((async()=>{const{createGitGraphServices:e}=await W((async()=>{const{createGitGraphServices:e}=await Promise.resolve().then((()=>cd));return{createGitGraphServices:e}}),void 0,import.meta.url),t=e().GitGraph.parser.LangiumParser;td.gitGraph=t}),"gitGraph"),radar:_c((async()=>{const{createRadarServices:e}=await W((async()=>{const{createRadarServices:e}=await Promise.resolve().then((()=>ud));return{createRadarServices:e}}),void 0,import.meta.url),t=e().Radar.parser.LangiumParser;td.radar=t}),"radar")};async function rd(e,t){const n=nd[e];if(!n)throw new Error(`Unknown diagram type: ${e}`);td[e]||await n();const r=td[e].parse(t);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new id(r);return r.value}_c(rd,"parse");var id=(_c(h=class extends Error{constructor(e){super(`Parsing failed: ${e.lexerErrors.map((e=>e.message)).join("\n")} ${e.parserErrors.map((e=>e.message)).join("\n")}`),this.result=e}},"MermaidParseError"),h);const sd=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:Gu,createInfoServices:Fu},Symbol.toStringTag,{value:"Module"})),ad=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:Ku,createPacketServices:Vu},Symbol.toStringTag,{value:"Module"})),od=Object.freeze(Object.defineProperty({__proto__:null,PieModule:Wu,createPieServices:zu},Symbol.toStringTag,{value:"Module"})),ld=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:Xu,createArchitectureServices:Qu},Symbol.toStringTag,{value:"Module"})),cd=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:Mu,createGitGraphServices:Du},Symbol.toStringTag,{value:"Module"})),ud=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:Zu,createRadarServices:ed},Symbol.toStringTag,{value:"Module"}));export{rd as p};
1
+ var e,t,n,r,i,s,a,o,l,c,u,d,h,p=Object.defineProperty,f=(e,t,n)=>((e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);import{n9 as m,df as g,r as y,cL as T,P as v,d0 as R,aw as E,d5 as A,d6 as k,H as $,K as x,J as S,bU as I,na as N,d7 as C,cU as w,nb as L,az as O,cW as _,av as b,nc as P,d1 as M,nd as D,d9 as U,O as G,ay as F,bY as B,ne as K,nf as V,ng as j,nh as H,al as W}from"./index-DwBKcFXe.js";import{b as z,a as Y}from"./_baseEach-DP3fzUd9.js";import{g as q,v as X,h as Q,j as J,k as Z,a as ee,c as te,i as ne,r as re,f as ie,n as se}from"./_baseUniq-C1UQCeSS.js";import{m as ae,f as oe,h as le,d as ce,l as ue,c as de}from"./min-hX6ooyJu.js";import{a9 as he}from"./mermaid-u7JJGwGW.js";import{c as pe}from"./clone-Bcupu-7G.js";var fe=Object.prototype.hasOwnProperty,me=m((function(e,t){if(g(t)||y(t))T(t,v(t),e);else for(var n in t)fe.call(t,n)&&R(e,n,t[n])}));function ge(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var s=e[t];s&&(i[r++]=s)}return i}function ye(e,t,n,r){for(var i=-1,s=null==e?0:e.length;++i<s;){var a=e[i];t(r,a,n(a),e)}return r}function Te(e,t,n,r){return z(e,(function(e,i,s){t(r,e,n(e),s)})),r}var ve=$((function(e,t){return x(e)?function(e,t,n,r){var i=-1,s=q,a=!0,o=e.length,l=[],c=t.length;if(!o)return l;t.length>=200&&(s=k,a=!1,t=new A(t));e:for(;++i<o;){var u=e[i],d=u;if(u=0!==u?u:0,a&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else s(t,d,r)||l.push(u)}return l}(e,S(t,1,x,!0)):[]}));function Re(e,t,n){var r=null==e?0:e.length;return r?(t=void 0===t?1:I(t),N(e,t<0?0:t,r)):[]}function Ee(e,t,n){var r=null==e?0:e.length;return r?(t=void 0===t?1:I(t),N(e,0,(t=r-t)<0?0:t)):[]}function Ae(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ke(e,t){var n=!0;return z(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function $e(e,t,n){return(E(e)?Ae:ke)(e,Y(t))}function xe(e){return e&&e.length?e[0]:void 0}function Se(e,t){return S(ae(e,t))}var Ie,Ne,Ce=Object.prototype.hasOwnProperty,we=(Ie=function(e,t,n){Ce.call(e,n)?e[n].push(t):C(e,n,[t])},function(e,t){var n=E(e)?ye:Te,r=Ne?Ne():{};return n(e,Ie,Y(t),r)});function Le(e){return"string"==typeof e||!E(e)&&w(e)&&"[object String]"==L(e)}var Oe=Math.max;function _e(e,t,n,r){e=y(e)?e:X(e),n=n?I(n):0;var i=e.length;return n<0&&(n=Oe(i+n,0)),Le(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Q(e,t,n)>-1}function be(e,t,n){if(!(null==e?0:e.length))return-1;return Q(e,t,0)}var Pe=_&&_.isRegExp,Me=Pe?O(Pe):function(e){return w(e)&&"[object RegExp]"==L(e)};function De(e,t){if(null==e)return{};var n=b(J(e),(function(e){return[e]}));return t=Y(t),P(e,n,(function(e,n){return t(e,n[0])}))}function Ue(e,t){return(E(e)?M:Z)(e,function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}(Y(t)))}function Ge(e,t){var n;return z(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Fe(e,t,n){return(E(e)?D:Ge)(e,Y(t))}function Be(e){return e&&e.length?ee(e):[]}function Ke(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$type}function Ve(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$refText}function je(e){return"object"==typeof e&&null!==e&&Ke(e.container)&&Ve(e.reference)&&"string"==typeof e.message}class He{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return Ke(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 r=n[t];if(void 0!==r)return r;{const r=this.computeIsSubtype(e,t);return n[t]=r,r}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const t=this.getAllTypes(),n=[];for(const r of t)this.isSubtype(r,e)&&n.push(r);return this.allSubtypes[e]=n,n}}}function We(e){return"object"==typeof e&&null!==e&&Array.isArray(e.content)}function ze(e){return"object"==typeof e&&null!==e&&"object"==typeof e.tokenType}function Ye(e){return We(e)&&"string"==typeof e.fullText}class qe{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(){const e=this.iterator();return Boolean(e.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(),void 0!==n.value&&e.push(n.value)}while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){const n=this.map((n=>[e?e(n):n,t?t(n):n]));return new Map(n)}toString(){return this.join()}concat(e){return new qe((()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()})),(e=>{let t;if(!e.firstDone){do{if(t=this.nextFn(e.first),!t.done)return t}while(!t.done);e.firstDone=!0}do{if(t=e.iterator.next(),!t.done)return t}while(!t.done);return Ze}))}join(e=","){const t=this.iterator();let n,r="",i=!1;do{n=t.next(),n.done||(i&&(r+=e),r+=Xe(n.value)),i=!0}while(!n.done);return r}indexOf(e,t=0){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(r>=t&&i.value===e)return r;i=n.next(),r++}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,r=t.next();for(;!r.done;)e(r.value,n),r=t.next(),n++}map(e){return new qe(this.startFn,(t=>{const{done:n,value:r}=this.nextFn(t);return n?Ze:{done:!1,value:e(r)}}))}filter(e){return new qe(this.startFn,(t=>{let n;do{if(n=this.nextFn(t),!n.done&&e(n.value))return n}while(!n.done);return Ze}))}nonNullable(){return this.filter((e=>null!=e))}reduce(e,t){const n=this.iterator();let r=t,i=n.next();for(;!i.done;)r=void 0===r?i.value:e(r,i.value),i=n.next();return r}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){const r=e.next();if(r.done)return n;const i=this.recursiveReduce(e,t,n);return void 0===i?r.value:t(i,r.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,r=t.next();for(;!r.done;){if(e(r.value))return n;r=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 qe((()=>({this:this.startFn()})),(t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}const{done:n,value:r}=this.nextFn(t.this);if(!n){const n=e(r);if(!Qe(n))return{done:!1,value:n};t.iterator=n[Symbol.iterator]()}}while(t.iterator);return Ze}))}flat(e){if(void 0===e&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new qe((()=>({this:t.startFn()})),(e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}const{done:n,value:r}=t.nextFn(e.this);if(!n){if(!Qe(r))return{done:!1,value:r};e.iterator=r[Symbol.iterator]()}}while(e.iterator);return Ze}))}head(){const e=this.iterator().next();if(!e.done)return e.value}tail(e=1){return new qe((()=>{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 qe((()=>({size:0,state:this.startFn()})),(t=>(t.size++,t.size>e?Ze:this.nextFn(t.state))))}distinct(e){return new qe((()=>({set:new Set,internalState:this.startFn()})),(t=>{let n;do{if(n=this.nextFn(t.internalState),!n.done){const r=e?e(n.value):n.value;if(!t.set.has(r))return t.set.add(r),n}}while(!n.done);return Ze}))}exclude(e,t){const n=new Set;for(const r of e){const e=t?t(r):r;n.add(e)}return this.filter((e=>{const r=t?t(e):e;return!n.has(r)}))}}function Xe(e){return"string"==typeof e?e:void 0===e?"undefined":"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}function Qe(e){return!!e&&"function"==typeof e[Symbol.iterator]}const Je=new qe((()=>{}),(()=>Ze)),Ze=Object.freeze({done:!0,value:void 0});function et(...e){if(1===e.length){const t=e[0];if(t instanceof qe)return t;if(Qe(t))return new qe((()=>t[Symbol.iterator]()),(e=>e.next()));if("number"==typeof t.length)return new qe((()=>({index:0})),(e=>e.index<t.length?{done:!1,value:t[e.index++]}:Ze))}return e.length>1?new qe((()=>({collIndex:0,arrIndex:0})),(t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}if(t.array){if(t.arrIndex<t.array.length)return{done:!1,value:t.array[t.arrIndex++]};t.array=void 0,t.arrIndex=0}if(t.collIndex<e.length){const n=e[t.collIndex++];Qe(n)?t.iterator=n[Symbol.iterator]():n&&"number"==typeof n.length&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return Ze})):Je}class tt extends qe{constructor(e,t,n){super((()=>({iterators:(null==n?void 0:n.includeRoot)?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1})),(e=>{for(e.pruned&&(e.iterators.pop(),e.pruned=!1);e.iterators.length>0;){const n=e.iterators[e.iterators.length-1].next();if(!n.done)return e.iterators.push(t(n.value)[Symbol.iterator]()),n;e.iterators.pop()}return Ze}))}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var nt,rt,it,st;function at(e){return new tt(e,(e=>We(e)?e.content:[]),{includeRoot:!0})}function ot(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function lt(e){if(!e)return;const{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}function ct(e,t){const n=function(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return it.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return it.After;const n=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,r=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return n&&r?it.Inside:n?it.OverlapBack:r?it.OverlapFront:it.Outside}(e,t);return n>it.After}(rt=nt||(nt={})).sum=function(e){return e.reduce(((e,t)=>e+t),0)},rt.product=function(e){return e.reduce(((e,t)=>e*t),0)},rt.min=function(e){return e.reduce(((e,t)=>Math.min(e,t)))},rt.max=function(e){return e.reduce(((e,t)=>Math.max(e,t)))},(st=it||(it={}))[st.Before=0]="Before",st[st.After=1]="After",st[st.OverlapFront=2]="OverlapFront",st[st.OverlapBack=3]="OverlapBack",st[st.Inside=4]="Inside",st[st.Outside=5]="Outside";const ut=/^[\w\p{L}]$/u;function dt(e,t){return ze(e)&&t.includes(e.tokenType.name)}class ht extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function pt(e){throw new Error("Error! The input value was not handled.")}const ft="AbstractRule",mt="AbstractType",gt="Condition",yt="TypeDefinition",Tt="ValueLiteral",vt="AbstractElement";const Rt="ArrayLiteral",Et="ArrayType",At="BooleanLiteral";const kt="Conjunction";const $t="Disjunction";const xt="Grammar",St="GrammarImport",It="InferredType";function Nt(e){return En.isInstance(e,It)}const Ct="Interface";function wt(e){return En.isInstance(e,Ct)}const Lt="NamedArgument",Ot="Negation";const _t="NumberLiteral",bt="Parameter",Pt="ParameterReference";const Mt="ParserRule";function Dt(e){return En.isInstance(e,Mt)}const Ut="ReferenceType",Gt="ReturnType";const Ft="SimpleType";const Bt="StringLiteral",Kt="TerminalRule";function Vt(e){return En.isInstance(e,Kt)}const jt="Type";function Ht(e){return En.isInstance(e,jt)}const Wt="TypeAttribute",zt="UnionType",Yt="Action";function qt(e){return En.isInstance(e,Yt)}const Xt="Alternatives";function Qt(e){return En.isInstance(e,Xt)}const Jt="Assignment";function Zt(e){return En.isInstance(e,Jt)}const en="CharacterRange";const tn="CrossReference";function nn(e){return En.isInstance(e,tn)}const rn="EndOfFile";const sn="Group";function an(e){return En.isInstance(e,sn)}const on="Keyword";function ln(e){return En.isInstance(e,on)}const cn="NegatedToken";const un="RegexToken";const dn="RuleCall";function hn(e){return En.isInstance(e,dn)}const pn="TerminalAlternatives";const fn="TerminalGroup";const mn="TerminalRuleCall";const gn="UnorderedGroup";function yn(e){return En.isInstance(e,gn)}const Tn="UntilToken";const vn="Wildcard";class Rn extends He{getAllTypes(){return[vt,ft,mt,Yt,Xt,Rt,Et,Jt,At,en,gt,kt,tn,$t,rn,xt,St,sn,It,Ct,on,Lt,cn,Ot,_t,bt,Pt,Mt,Ut,un,Gt,dn,Ft,Bt,pn,fn,Kt,mn,jt,Wt,yt,zt,gn,Tn,Tt,vn]}computeIsSubtype(e,t){switch(e){case Yt:case Xt:case Jt:case en:case tn:case rn:case sn:case on:case cn:case un:case dn:case pn:case fn:case mn:case gn:case Tn:case vn:return this.isSubtype(vt,t);case Rt:case _t:case Bt:return this.isSubtype(Tt,t);case Et:case Ut:case Ft:case zt:return this.isSubtype(yt,t);case At:return this.isSubtype(gt,t)||this.isSubtype(Tt,t);case kt:case $t:case Ot:case Pt:return this.isSubtype(gt,t);case It:case Ct:case jt:return this.isSubtype(mt,t);case Mt:return this.isSubtype(ft,t)||this.isSubtype(mt,t);case Kt:return this.isSubtype(ft,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 mt;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return ft;case"Grammar:usedGrammars":return xt;case"NamedArgument:parameter":case"ParameterReference:parameter":return bt;case"TerminalRuleCall:rule":return Kt;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case vt:return{name:vt,properties:[{name:"cardinality"},{name:"lookahead"}]};case Rt:return{name:Rt,properties:[{name:"elements",defaultValue:[]}]};case Et:return{name:Et,properties:[{name:"elementType"}]};case At:return{name:At,properties:[{name:"true",defaultValue:!1}]};case kt:return{name:kt,properties:[{name:"left"},{name:"right"}]};case $t:return{name:$t,properties:[{name:"left"},{name:"right"}]};case xt:return{name:xt,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 St:return{name:St,properties:[{name:"path"}]};case It:return{name:It,properties:[{name:"name"}]};case Ct:return{name:Ct,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case Lt:return{name:Lt,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Ot:return{name:Ot,properties:[{name:"value"}]};case _t:return{name:_t,properties:[{name:"value"}]};case bt:return{name:bt,properties:[{name:"name"}]};case Pt:return{name:Pt,properties:[{name:"parameter"}]};case Mt:return{name:Mt,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 Ut:return{name:Ut,properties:[{name:"referenceType"}]};case Gt:return{name:Gt,properties:[{name:"name"}]};case Ft:return{name:Ft,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case Bt:return{name:Bt,properties:[{name:"value"}]};case Kt:return{name:Kt,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case jt:return{name:jt,properties:[{name:"name"},{name:"type"}]};case Wt:return{name:Wt,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case zt:return{name:zt,properties:[{name:"types",defaultValue:[]}]};case Yt:return{name:Yt,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Xt:return{name:Xt,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Jt:return{name:Jt,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case en:return{name:en,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case tn:return{name:tn,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case rn:return{name:rn,properties:[{name:"cardinality"},{name:"lookahead"}]};case sn:return{name:sn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case on:return{name:on,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case cn:return{name:cn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case un:return{name:un,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case dn:return{name:dn,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case pn:return{name:pn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case fn:return{name:fn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case mn:return{name:mn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case gn:return{name:gn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Tn:return{name:Tn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case vn:return{name:vn,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const En=new Rn;function An(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function kn(e){const t=$n(e).$document;if(!t)throw new Error("AST node has no document.");return t}function $n(e){for(;e.$container;)e=e.$container;return e}function xn(e,t){if(!e)throw new Error("Node must be an AstNode.");const n=null==t?void 0:t.range;return new qe((()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0})),(t=>{for(;t.keyIndex<t.keys.length;){const r=t.keys[t.keyIndex];if(!r.startsWith("$")){const i=e[r];if(Ke(i)){if(t.keyIndex++,Nn(i,n))return{done:!1,value:i}}else if(Array.isArray(i)){for(;t.arrayIndex<i.length;){const e=i[t.arrayIndex++];if(Ke(e)&&Nn(e,n))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return Ze}))}function Sn(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new tt(e,(e=>xn(e,t)))}function In(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new tt(e,(e=>xn(e,t)),{includeRoot:!0})}function Nn(e,t){var n;if(!t)return!0;const r=null===(n=e.$cstNode)||void 0===n?void 0:n.range;return!!r&&ct(r,t)}function Cn(e){return new qe((()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0})),(t=>{for(;t.keyIndex<t.keys.length;){const n=t.keys[t.keyIndex];if(!n.startsWith("$")){const r=e[n];if(Ve(r))return t.keyIndex++,{done:!1,value:{reference:r,container:e,property:n}};if(Array.isArray(r)){for(;t.arrayIndex<r.length;){const i=t.arrayIndex++,s=r[i];if(Ve(s))return{done:!1,value:{reference:s,container:e,property:n,index:i}}}t.arrayIndex=0}}t.keyIndex++}return Ze}))}function wn(e){return Array.isArray(e)?[...e.map(wn)]:e}function Ln(e){return e.charCodeAt(0)}function On(e,t){Array.isArray(e)?e.forEach((function(e){t.push(e)})):t.push(e)}function _n(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function bn(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function Pn(e){return"Character"===e.type}const Mn=[];for(let dd=Ln("0");dd<=Ln("9");dd++)Mn.push(dd);const Dn=[Ln("_")].concat(Mn);for(let dd=Ln("a");dd<=Ln("z");dd++)Dn.push(dd);for(let dd=Ln("A");dd<=Ln("Z");dd++)Dn.push(dd);const Un=[Ln(" "),Ln("\f"),Ln("\n"),Ln("\r"),Ln("\t"),Ln("\v"),Ln("\t"),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln(" "),Ln("\u2028"),Ln("\u2029"),Ln(" "),Ln(" "),Ln(" "),Ln("\ufeff")],Gn=/[0-9a-fA-F]/,Fn=/[0-9]/,Bn=/[1-9]/;class Kn{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":_n(n,"global");break;case"i":_n(n,"ignoreCase");break;case"m":_n(n,"multiLine");break;case"u":_n(n,"unicode");break;case"y":_n(n,"sticky")}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"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead"}bn(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return function(){throw Error("Internal Error - Should never get here!")}()}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 n=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:n,atMost:n};break;case",":let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;bn(t)}if(!0!==e||void 0!==t)return bn(t)?("?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t):void 0}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()}if(void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),bn(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[Ln("\n"),Ln("\r"),Ln("\u2028"),Ln("\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=Mn;break;case"D":e=Mn,t=!0;break;case"s":e=Un;break;case"S":e=Un,t=!0;break;case"w":e=Dn;break;case"W":e=Dn,t=!0}if(bn(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=Ln("\f");break;case"n":e=Ln("\n");break;case"r":e=Ln("\r");break;case"t":e=Ln("\t");break;case"v":e=Ln("\v")}if(bn(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:Ln("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:Ln(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:Ln(this.popChar())}}}characterClass(){const e=[];let t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const t=this.classAtom();if(t.type,Pn(t)&&this.isRangeDash()){this.consumeChar("-");const n=this.classAtom();if(n.type,Pn(n)){if(n.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:n.value})}else On(t.value,e),e.push(Ln("-")),On(n.value,e)}else On(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":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:Ln("\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;if(this.consumeChar("("),"?"===this.peekChar(0))this.consumeChar("?"),this.consumeChar(":"),e=!1;else this.groupIdx++;const t=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(!1===Bn.test(e))throw Error("Expecting a positive integer");for(;Fn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===Fn.test(e))throw Error("Expecting an integer");for(;Fn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case"\n":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:Ln(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 Fn.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":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 void 0!==this.quantifier(!0)}catch(t){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let n=0;n<e;n++){const e=this.popChar();if(!1===Gn.test(e))throw Error("Expecting a HexDecimal digits");t+=e}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(void 0!==e&&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 Vn{visitChildren(e){for(const t in e){const n=e[t];e.hasOwnProperty(t)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach((e=>{this.visit(e)}),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)}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 jn=/\r?\n/gm,Hn=new Kn;const Wn=new class extends Vn{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||"\n"!==t||(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const e=Xn(t);this.endRegexpStack.push(e),this.isStarting&&(this.startRegexp+=e)}}visitSet(e){if(!this.multiline){const t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=Boolean("\n".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){if("Group"===e.type){if(e.quantifier)return}super.visitChildren(e)}};function zn(e){try{return"string"==typeof e&&(e=new RegExp(e)),e=e.toString(),Wn.reset(e),Wn.visit(Hn.pattern(e)),Wn.multiline}catch(t){return!1}}const Yn="\f\n\r\t\v              \u2028\u2029   \ufeff".split("");function qn(e){const t="string"==typeof e?new RegExp(e):e;return Yn.some((e=>t.test(e)))}function Xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qn(e,t){const n=function(e){"string"==typeof e&&(e=new RegExp(e));const t=e,n=e.source;let r=0;function i(){let e,s="";function a(e){s+=n.substr(r,e),r+=e}function o(e){s+="(?:"+n.substr(r,e)+"|$)",r+=e}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":o(3);break;case"x":o(4);break;case"u":t.unicode?"{"===n[r+2]?o(n.indexOf("}",r)-r+1):o(6):o(2);break;case"p":case"P":t.unicode?o(n.indexOf("}",r)-r+1):o(2);break;case"k":o(n.indexOf(">",r)-r+1);break;default:o(2)}break;case"[":e=/\[(?:\\.|.)*?\]/g,e.lastIndex=r,e=e.exec(n)||[],o(e[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":e=/\{\d+,?\d*\}/g,e.lastIndex=r,e=e.exec(n),e?a(e[0].length):o(1);break;case"(":if("?"===n[r+1])switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":e=r,r+=3,i(),s+=n.substr(e,r-e);break;case"<":switch(n[r+3]){case"=":case"!":e=r,r+=4,i(),s+=n.substr(e,r-e);break;default:a(n.indexOf(">",r)-r+1),s+=i()+"|$)"}}else a(1),s+=i()+"|$)";break;case")":return++r,s;default:o(1)}return s}return new RegExp(i(),e.flags)}(e),r=t.match(n);return!!r&&r[0].length>0}function Jn(e,t){const n=new Set,r=function(e){return e.rules.find((e=>Dt(e)&&e.entry))}(e);if(!r)return new Set(e.rules);const i=[r].concat(function(e){return e.rules.filter((e=>Vt(e)&&e.hidden))}(e));for(const a of i)Zn(a,n,t);const s=new Set;for(const a of e.rules)(n.has(a.name)||Vt(a)&&a.hidden)&&s.add(a);return s}function Zn(e,t,n){t.add(e.name),Sn(e).forEach((e=>{if(hn(e)||n){const r=e.rule.ref;r&&!t.has(r.name)&&Zn(r,t,n)}}))}function er(e,t,n){if(!e||!t)return;const r=tr(e,t,e.astNode,!0);return 0!==r.length?r[n=void 0!==n?Math.max(0,Math.min(n,r.length-1)):0]:void 0}function tr(e,t,n,r){if(!r){const n=An(e.grammarSource,Zt);if(n&&n.feature===t)return[e]}return We(e)&&e.astNode===n?e.content.flatMap((e=>tr(e,t,n,!1))):[]}function nr(e,t,n){if(!e)return;const r=function(e,t,n){if(e.astNode!==n)return[];if(ln(e.grammarSource)&&e.grammarSource.value===t)return[e];const r=at(e).iterator();let i;const s=[];do{if(i=r.next(),!i.done){const e=i.value;e.astNode===n?ln(e.grammarSource)&&e.grammarSource.value===t&&s.push(e):r.prune()}}while(!i.done);return s}(e,t,null==e?void 0:e.astNode);return 0!==r.length?r[n=void 0!==n?Math.max(0,Math.min(n,r.length-1)):0]:void 0}function rr(e){let t=e;return Nt(t)&&(qt(t.$container)?t=t.$container.$container:Dt(t.$container)?t=t.$container:pt(t.$container)),ir(e,t,new Map)}function ir(e,t,n){var r,i;function s(t,r){let i;return An(t,Zt)||(i=ir(r,r,n)),n.set(e,i),i}if(n.has(e))return n.get(e);n.set(e,void 0);for(const a of Sn(t)){if(Zt(a)&&"name"===a.feature.toLowerCase())return n.set(e,a),a;if(hn(a)&&Dt(a.rule.ref))return s(a,a.rule.ref);if(i=a,En.isInstance(i,Ft)&&(null===(r=a.typeRef)||void 0===r?void 0:r.ref))return s(a,a.typeRef.ref)}}function sr(e){return ar(e,new Set)}function ar(e,t){if(t.has(e))return!0;t.add(e);for(const n of Sn(e))if(hn(n)){if(!n.rule.ref)return!1;if(Dt(n.rule.ref)&&!ar(n.rule.ref,t))return!1}else{if(Zt(n))return!1;if(qt(n))return!1}return Boolean(e.definition)}function or(e){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){const t=e.returnType.ref;if(t){if(Dt(t))return t.name;if(wt(t)||Ht(t))return t.name}}}function lr(e){var t,n;if(Dt(e))return sr(e)?e.name:null!==(t=or(e))&&void 0!==t?t:e.name;if(wt(e)||Ht(e)||(n=e,En.isInstance(n,Gt)))return e.name;if(qt(e)){const t=function(e){var t;if(e.inferredType)return e.inferredType.name;if(null===(t=e.type)||void 0===t?void 0:t.ref)return lr(e.type.ref);return}(e);if(t)return t}else if(Nt(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function cr(e){const t={s:!1,i:!1,u:!1},n=dr(e.definition,t),r=Object.entries(t).filter((([,e])=>e)).map((([e])=>e)).join("");return new RegExp(n,r)}const ur=/[\s\S]/.source;function dr(e,t){if(a=e,En.isInstance(a,pn))return pr((s=e).elements.map((e=>dr(e))).join("|"),{cardinality:s.cardinality,lookahead:s.lookahead});if(function(e){return En.isInstance(e,fn)}(e))return pr((i=e).elements.map((e=>dr(e))).join(""),{cardinality:i.cardinality,lookahead:i.lookahead});if(function(e){return En.isInstance(e,en)}(e))return function(e){if(e.right)return pr(`[${hr(e.left)}-${hr(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1});return pr(hr(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}(e);if(function(e){return En.isInstance(e,mn)}(e)){const t=e.rule.ref;if(!t)throw new Error("Missing rule reference.");return pr(dr(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead})}if(function(e){return En.isInstance(e,cn)}(e))return pr(`(?!${dr((r=e).terminal)})${ur}*?`,{cardinality:r.cardinality,lookahead:r.lookahead});if(function(e){return En.isInstance(e,Tn)}(e))return pr(`${ur}*?${dr((n=e).terminal)}`,{cardinality:n.cardinality,lookahead:n.lookahead});if(function(e){return En.isInstance(e,un)}(e)){const n=e.regex.lastIndexOf("/"),r=e.regex.substring(1,n),i=e.regex.substring(n+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),pr(r,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}if(function(e){return En.isInstance(e,vn)}(e))return pr(ur,{cardinality:e.cardinality,lookahead:e.lookahead});throw new Error(`Invalid terminal element: ${null==e?void 0:e.$type}`);var n,r,i,s,a}function hr(e){return Xn(e.value)}function pr(e,t){var n;return(!1!==t.wrap||t.lookahead)&&(e=`(${null!==(n=t.lookahead)&&void 0!==n?n:""}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function fr(e){console&&console.error&&console.error(`Error: ${e}`)}function mr(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function gr(e){const t=(new Date).getTime(),n=e();return{time:(new Date).getTime()-t,value:n}}function yr(e){function t(){}t.prototype=e;const n=new t;function r(){return typeof n.bar}return r(),r(),e}function Tr(e){return Le((t=e).LABEL)&&""!==t.LABEL?e.LABEL:e.name;var t}class vr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),te(this.definition,(t=>{t.accept(e)}))}}class Rr extends vr{constructor(e){super([]),this.idx=1,me(this,De(e,(e=>void 0!==e)))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Er extends vr{constructor(e){super(e.definition),this.orgText="",me(this,De(e,(e=>void 0!==e)))}}class Ar extends vr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,me(this,De(e,(e=>void 0!==e)))}}let kr=class extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}};class $r extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class xr extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class Sr extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class Ir extends vr{constructor(e){super(e.definition),this.idx=1,me(this,De(e,(e=>void 0!==e)))}}class Nr extends vr{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,me(this,De(e,(e=>void 0!==e)))}}class Cr{constructor(e){this.idx=1,me(this,De(e,(e=>void 0!==e)))}accept(e){e.visit(this)}}function wr(e){function t(e){return ae(e,wr)}if(e instanceof Rr){const t={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return Le(e.label)&&(t.label=e.label),t}if(e instanceof Ar)return{type:"Alternative",definition:t(e.definition)};if(e instanceof kr)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof $r)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof xr)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:wr(new Cr({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Ir)return{type:"RepetitionWithSeparator",idx:e.idx,separator:wr(new Cr({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Sr)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof Nr)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof Cr){const t={type:"Terminal",name:e.terminalType.name,label:Tr(e.terminalType),idx:e.idx};Le(e.label)&&(t.terminalLabel=e.label);const n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=Me(n)?n.source:n),t}if(e instanceof Er)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}class Lr{visit(e){const t=e;switch(t.constructor){case Rr:return this.visitNonTerminal(t);case Ar:return this.visitAlternative(t);case kr:return this.visitOption(t);case $r:return this.visitRepetitionMandatory(t);case xr:return this.visitRepetitionMandatoryWithSeparator(t);case Ir:return this.visitRepetitionWithSeparator(t);case Sr:return this.visitRepetition(t);case Nr:return this.visitAlternation(t);case Cr:return this.visitTerminal(t);case Er: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 Or(e,t=[]){return!!(e instanceof kr||e instanceof Sr||e instanceof Ir)||(e instanceof Nr?Fe(e.definition,(e=>Or(e,t))):!(e instanceof Rr&&_e(t,e))&&(e instanceof vr&&(e instanceof Rr&&t.push(e),$e(e.definition,(e=>Or(e,t))))))}function _r(e){if(e instanceof Rr)return"SUBRULE";if(e instanceof kr)return"OPTION";if(e instanceof Nr)return"OR";if(e instanceof $r)return"AT_LEAST_ONE";if(e instanceof xr)return"AT_LEAST_ONE_SEP";if(e instanceof Ir)return"MANY_SEP";if(e instanceof Sr)return"MANY";if(e instanceof Cr)return"CONSUME";throw Error("non exhaustive match")}class br{walk(e,t=[]){te(e.definition,((n,r)=>{const i=Re(e.definition,r+1);if(n instanceof Rr)this.walkProdRef(n,i,t);else if(n instanceof Cr)this.walkTerminal(n,i,t);else if(n instanceof Ar)this.walkFlat(n,i,t);else if(n instanceof kr)this.walkOption(n,i,t);else if(n instanceof $r)this.walkAtLeastOne(n,i,t);else if(n instanceof xr)this.walkAtLeastOneSep(n,i,t);else if(n instanceof Ir)this.walkManySep(n,i,t);else if(n instanceof Sr)this.walkMany(n,i,t);else{if(!(n instanceof Nr))throw Error("non exhaustive match");this.walkOr(n,i,t)}}))}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){const r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){const r=[new kr({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){const r=Pr(e,t,n);this.walk(e,r)}walkMany(e,t,n){const r=[new kr({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){const r=Pr(e,t,n);this.walk(e,r)}walkOr(e,t,n){const r=t.concat(n);te(e.definition,(e=>{const t=new Ar({definition:[e]});this.walk(t,r)}))}}function Pr(e,t,n){return[new kr({definition:[new Cr({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function Mr(e){if(e instanceof Rr)return Mr(e.referencedRule);if(e instanceof Cr)return[e.terminalType];if(function(e){return e instanceof Ar||e instanceof kr||e instanceof Sr||e instanceof $r||e instanceof xr||e instanceof Ir||e instanceof Cr||e instanceof Er}(e))return function(e){let t=[];const n=e.definition;let r,i=0,s=n.length>i,a=!0;for(;s&&a;)r=n[i],a=Or(r),t=t.concat(Mr(r)),i+=1,s=n.length>i;return Be(t)}(e);if(function(e){return e instanceof Nr}(e))return function(e){const t=ae(e.definition,(e=>Mr(e)));return Be(U(t))}(e);throw Error("non exhaustive match")}const Dr="_~IN~_";class Ur extends br{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 r=(i=e.referencedRule,s=e.idx,i.name+s+Dr+this.topProd.name);var i,s;const a=t.concat(n),o=Mr(new Ar({definition:a}));this.follows[r]=o}}let Gr={};const Fr=new Kn;function Br(e){const t=e.toString();if(Gr.hasOwnProperty(t))return Gr[t];{const e=Fr.pattern(t);return Gr[t]=e,e}}const Kr="Complement Sets are not supported for first char optimization",Vr='Unable to use "first char" lexer optimizations:\n';function jr(e,t=!1){try{const t=Br(e);return Hr(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Kr)t&&mr(`${Vr}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";t&&(n="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),fr(`${Vr}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Hr(e,t,n){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)Hr(e.value[i],t,n);break;case"Alternative":const r=e.value;for(let e=0;e<r.length;e++){const i=r[e];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=i;switch(s.type){case"Character":Wr(s.value,t,n);break;case"Set":if(!0===s.complement)throw Error(Kr);te(s.value,(e=>{if("number"==typeof e)Wr(e,t,n);else{const r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)Wr(e,t,n);else{for(let e=r.from;e<=r.to&&e<fi;e++)Wr(e,t,n);if(r.to>=fi){const e=r.from>=fi?r.from:fi,n=r.to,i=gi(e),s=gi(n);for(let r=i;r<=s;r++)t[r]=r}}}}));break;case"Group":Hr(s.value,t,n);break;default:throw Error("Non Exhaustive Match")}const a=void 0!==s.quantifier&&0===s.quantifier.atLeast;if("Group"===s.type&&!1===Yr(s)||"Group"!==s.type&&!1===a)break}break;default:throw Error("non exhaustive match!")}return X(t)}function Wr(e,t,n){const r=gi(e);t[r]=r,!0===n&&function(e,t){const n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){const e=gi(r.charCodeAt(0));t[e]=e}else{const e=n.toLowerCase();if(e!==n){const n=gi(e.charCodeAt(0));t[n]=n}}}(e,t)}function zr(e,t){return oe(e.value,(e=>{if("number"==typeof e)return _e(t,e);{const n=e;return void 0!==oe(t,(e=>n.from<=e&&e<=n.to))}}))}function Yr(e){const t=e.quantifier;return!(!t||0!==t.atLeast)||!!e.value&&(E(e.value)?$e(e.value,Yr):Yr(e.value))}class qr extends Vn{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}super.visitChildren(e)}}visitCharacter(e){_e(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===zr(e,this.targetCharCodes)&&(this.found=!0):void 0!==zr(e,this.targetCharCodes)&&(this.found=!0)}}function Xr(e,t){if(t instanceof RegExp){const n=Br(t),r=new qr(e);return r.visit(n),r.found}return void 0!==oe(t,(t=>_e(e,t.charCodeAt(0))))}const Qr="PATTERN",Jr="defaultMode",Zr="modes";let ei="boolean"==typeof new RegExp("(?:)").sticky;function ti(e,t){const n=(t=ce(t,{useSticky:ei,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer;let r;n("initCharCodeToOptimizedIndexMap",(()=>{!function(){if(he(mi)){mi=new Array(65536);for(let e=0;e<65536;e++)mi[e]=e>255?255+~~(e/255):e}}()})),n("Reject Lexer.NA",(()=>{r=Ue(e,(e=>e[Qr]===wi.NA))}));let i,s,a,o,l,c,u,d,h,p,f,m=!1;n("Transform Patterns",(()=>{m=!1,i=ae(r,(e=>{const n=e[Qr];if(Me(n)){const e=n.source;return 1!==e.length||"^"===e||"$"===e||"."===e||n.ignoreCase?2!==e.length||"\\"!==e[0]||_e(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?t.useSticky?ai(n):si(n):e[1]:e}if(G(n))return m=!0,{exec:n};if("object"==typeof n)return m=!0,n;if("string"==typeof n){if(1===n.length)return n;{const e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=new RegExp(e);return t.useSticky?ai(r):si(r)}}throw Error("non exhaustive match")}))})),n("misc mapping",(()=>{s=ae(r,(e=>e.tokenTypeIdx)),a=ae(r,(e=>{const t=e.GROUP;if(t!==wi.SKIPPED){if(Le(t))return t;if(ne(t))return!1;throw Error("non exhaustive match")}})),o=ae(r,(e=>{const t=e.LONGER_ALT;if(t){return E(t)?ae(t,(e=>be(r,e))):[be(r,t)]}})),l=ae(r,(e=>e.PUSH_MODE)),c=ae(r,(e=>le(e,"POP_MODE")))})),n("Line Terminator Handling",(()=>{const e=hi(t.lineTerminatorCharacters);u=ae(r,(e=>!1)),"onlyOffset"!==t.positionTracking&&(u=ae(r,(t=>le(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===di(t,e)&&Xr(e,t.PATTERN))))})),n("Misc Mapping #2",(()=>{d=ae(r,li),h=ae(i,ci),p=re(r,((e,t)=>{const n=t.GROUP;return Le(n)&&n!==wi.SKIPPED&&(e[n]=[]),e}),{}),f=ae(i,((e,t)=>({pattern:i[t],longerAlt:o[t],canLineTerminator:u[t],isCustom:d[t],short:h[t],group:a[t],push:l[t],pop:c[t],tokenTypeIdx:s[t],tokenType:r[t]})))}));let g=!0,y=[];return t.safeMode||n("First Char Optimization",(()=>{y=re(r,((e,n,r)=>{if("string"==typeof n.PATTERN){const t=gi(n.PATTERN.charCodeAt(0));pi(e,t,f[r])}else if(E(n.START_CHARS_HINT)){let t;te(n.START_CHARS_HINT,(n=>{const i=gi("string"==typeof n?n.charCodeAt(0):n);t!==i&&(t=i,pi(e,i,f[r]))}))}else if(Me(n.PATTERN))if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&fr(`${Vr}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const i=jr(n.PATTERN,t.ensureOptimizations);he(i)&&(g=!1),te(i,(t=>{pi(e,t,f[r])}))}else t.ensureOptimizations&&fr(`${Vr}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e}),[])})),{emptyGroups:p,patternIdxToConfig:f,charCodeToPatternIdxToConfig:y,hasCustom:m,canBeOptimized:g}}function ni(e,t){let n=[];const r=function(e){const t=ie(e,(e=>!le(e,Qr))),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:Ii.MISSING_PATTERN,tokenTypes:[e]}))),r=ve(e,t);return{errors:n,valid:r}}(e);n=n.concat(r.errors);const i=function(e){const t=ie(e,(e=>{const t=e[Qr];return!(Me(t)||G(t)||le(t,"exec")||Le(t))})),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Ii.INVALID_PATTERN,tokenTypes:[e]}))),r=ve(e,t);return{errors:n,valid:r}}(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[];const n=ie(e,(e=>Me(e[Qr])));return t=t.concat(function(e){class t extends Vn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}const n=ie(e,(e=>{const n=e.PATTERN;try{const e=Br(n),r=new t;return r.visit(e),r.found}catch(r){return ri.test(n.source)}})),r=ae(n,(e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:Ii.EOI_ANCHOR_FOUND,tokenTypes:[e]})));return r}(n)),t=t.concat(function(e){class t extends Vn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}const n=ie(e,(e=>{const n=e.PATTERN;try{const e=Br(n),r=new t;return r.visit(e),r.found}catch(r){return ii.test(n.source)}})),r=ae(n,(e=>({message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:Ii.SOI_ANCHOR_FOUND,tokenTypes:[e]})));return r}(n)),t=t.concat(function(e){const t=ie(e,(e=>{const t=e[Qr];return t instanceof RegExp&&(t.multiline||t.global)})),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Ii.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]})));return n}(n)),t=t.concat(function(e){const t=[];let n=ae(e,(n=>re(e,((e,r)=>(n.PATTERN.source!==r.PATTERN.source||_e(t,r)||r.PATTERN===wi.NA||(t.push(r),e.push(r)),e)),[])));n=ge(n);const r=ie(n,(e=>e.length>1)),i=ae(r,(e=>{const t=ae(e,(e=>e.name));return{message:`The same RegExp pattern ->${xe(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:Ii.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}}));return i}(n)),t=t.concat(function(e){const t=ie(e,(e=>e.PATTERN.test(""))),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:Ii.EMPTY_MATCH_PATTERN,tokenTypes:[e]})));return n}(n)),t}(s)),n=n.concat(function(e){const t=ie(e,(e=>{if(!le(e,"GROUP"))return!1;const t=e.GROUP;return t!==wi.SKIPPED&&t!==wi.NA&&!Le(t)})),n=ae(t,(e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Ii.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]})));return n}(s)),n=n.concat(function(e,t){const n=ie(e,(e=>void 0!==e.PUSH_MODE&&!_e(t,e.PUSH_MODE))),r=ae(n,(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:Ii.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]})));return r}(s,t)),n=n.concat(function(e){const t=[],n=re(e,((e,t,n)=>{const r=t.PATTERN;return r===wi.NA||(Le(r)?e.push({str:r,idx:n,tokenType:t}):Me(r)&&(i=r,void 0===oe([".","\\","[","]","|","^","$","(",")","?","*","+","{"],(e=>-1!==i.source.indexOf(e))))&&e.push({str:r.source,idx:n,tokenType:t})),e;var i}),[]);return te(e,((e,r)=>{te(n,(({str:n,idx:i,tokenType:s})=>{if(r<i&&function(e,t){if(Me(t)){const n=t.exec(e);return null!==n&&0===n.index}if(G(t))return t(e,0,[],{});if(le(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(n,e.PATTERN)){const n=`Token: ->${s.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:Ii.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}}))})),t}(s)),n}const ri=/[^\\][$]/;const ii=/[^\\[][\^]|^\^/;function si(e){const t=e.ignoreCase?"i":"";return new RegExp(`^(?:${e.source})`,t)}function ai(e){const t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function oi(e,t,n){const r=[];let i=!1;const s=Ue(ge(U(X(e.modes))),(e=>e[Qr]===wi.NA)),a=hi(n);return t&&te(s,(e=>{const t=di(e,a);if(!1!==t){const n=function(e,t){if(t.issue===Ii.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===Ii.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(e,t),i={message:n,type:t.issue,tokenType:e};r.push(i)}else le(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(i=!0):Xr(a,e.PATTERN)&&(i=!0)})),t&&!i&&r.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n\tfor details.",type:Ii.NO_LINE_BREAKS_FLAGS}),r}function li(e){const t=e.PATTERN;if(Me(t))return!1;if(G(t))return!0;if(le(t,"exec"))return!0;if(Le(t))return!1;throw Error("non exhaustive match")}function ci(e){return!(!Le(e)||1!==e.length)&&e.charCodeAt(0)}const ui={test:function(e){const t=e.length;for(let n=this.lastIndex;n<t;n++){const t=e.charCodeAt(n);if(10===t)return this.lastIndex=n+1,!0;if(13===t)return 10===e.charCodeAt(n+1)?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function di(e,t){if(le(e,"LINE_BREAKS"))return!1;if(Me(e.PATTERN)){try{Xr(t,e.PATTERN)}catch(n){return{issue:Ii.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}if(Le(e.PATTERN))return!1;if(li(e))return{issue:Ii.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function hi(e){return ae(e,(e=>Le(e)?e.charCodeAt(0):e))}function pi(e,t,n){void 0===e[t]?e[t]=[n]:e[t].push(n)}const fi=256;let mi=[];function gi(e){return e<fi?e:mi[e]}function yi(e,t){const n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function Ti(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let vi=1;const Ri={};function Ei(e){const t=function(e){let t=pe(e),n=e,r=!0;for(;r;){n=ge(U(ae(n,(e=>e.CATEGORIES))));const e=ve(n,t);t=t.concat(e),he(e)?r=!1:n=e}return t}(e);!function(e){te(e,(e=>{ki(e)||(Ri[vi]=e,e.tokenTypeIdx=vi++),$i(e)&&!E(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),$i(e)||(e.CATEGORIES=[]),le(e,"categoryMatches")||(e.categoryMatches=[]),function(e){return le(e,"categoryMatchesMap")}(e)||(e.categoryMatchesMap={})}))}(t),function(e){te(e,(e=>{Ai([],e)}))}(t),function(e){te(e,(e=>{e.categoryMatches=[],te(e.categoryMatchesMap,((t,n)=>{e.categoryMatches.push(Ri[n].tokenTypeIdx)}))}))}(t),te(t,(e=>{e.isParent=e.categoryMatches.length>0}))}function Ai(e,t){te(e,(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0})),te(t.CATEGORIES,(n=>{const r=e.concat(t);_e(r,n)||Ai(r,n)}))}function ki(e){return le(e,"tokenTypeIdx")}function $i(e){return le(e,"CATEGORIES")}function xi(e){return le(e,"tokenTypeIdx")}const Si={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`};var Ii,Ni;(Ni=Ii||(Ii={}))[Ni.MISSING_PATTERN=0]="MISSING_PATTERN",Ni[Ni.INVALID_PATTERN=1]="INVALID_PATTERN",Ni[Ni.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",Ni[Ni.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",Ni[Ni.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",Ni[Ni.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",Ni[Ni.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",Ni[Ni.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",Ni[Ni.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",Ni[Ni.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",Ni[Ni.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",Ni[Ni.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",Ni[Ni.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",Ni[Ni.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",Ni[Ni.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",Ni[Ni.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",Ni[Ni.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",Ni[Ni.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const Ci={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Si,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Ci);class wi{constructor(e,t=Ci){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=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=gr(t),s=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=me({},Ci,t);const n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof n&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",(()=>{let n,r=!0;this.TRACE_INIT("Lexer Config handling",(()=>{if(this.config.lineTerminatorsPattern===Ci.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ui;else if(this.config.lineTerminatorCharacters===Ci.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n\tFor 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),E(e)?n={modes:{defaultMode:pe(e)},defaultMode:Jr}:(r=!1,n=pe(e))})),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",(()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){const t=[];return le(e,Jr)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+Jr+"> property in its definition\n",type:Ii.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),le(e,Zr)||t.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:Ii.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),le(e,Zr)&&le(e,Jr)&&!le(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${Jr}: <${e.defaultMode}>which does not exist\n`,type:Ii.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),le(e,Zr)&&te(e.modes,((e,n)=>{te(e,((r,i)=>{if(ne(r))t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${n}> at index: <${i}>\n`,type:Ii.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(le(r,"LONGER_ALT")){const i=E(r.LONGER_ALT)?r.LONGER_ALT:[r.LONGER_ALT];te(i,(i=>{ne(i)||_e(e,i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${r.name}> outside of mode <${n}>\n`,type:Ii.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})}))}}))})),t}(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),this.TRACE_INIT("performWarningRuntimeChecks",(()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(oi(n,this.trackStartLines,this.config.lineTerminatorCharacters))}))),n.modes=n.modes?n.modes:{},te(n.modes,((e,t)=>{n.modes[t]=Ue(e,(e=>ne(e)))}));const i=v(n.modes);if(te(n.modes,((e,n)=>{this.TRACE_INIT(`Mode: <${n}> processing`,(()=>{if(this.modes.push(n),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",(()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(ni(e,i))})),he(this.lexerDefinitionErrors)){let r;Ei(e),this.TRACE_INIT("analyzeTokenTypes",(()=>{r=ti(e,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})})),this.patternIdxToConfig[n]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[n]=r.charCodeToPatternIdxToConfig,this.emptyGroups=me({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[n]=r.canBeOptimized}}))})),this.defaultMode=n.defaultMode,!he(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const e=ae(this.lexerDefinitionErrors,(e=>e.message)).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+e)}te(this.lexerDefinitionWarning,(e=>{mr(e.message)})),this.TRACE_INIT("Choosing sub-methods implementations",(()=>{if(ei?(this.chopInput=F,this.match=this.matchWithTest):(this.updateLastIndex=se,this.match=this.matchWithExec),r&&(this.handleModes=se),!1===this.trackStartLines&&(this.computeNewColumn=F),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=se),/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))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}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 e=re(this.canModeBeOptimized,((e,t,n)=>(!1===t&&e.push(n),e)),[]);if(t.ensureOptimizations&&!he(e))throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)})),this.TRACE_INIT("clearRegExpParserCache",(()=>{Gr={}})),this.TRACE_INIT("toFastProperties",(()=>{yr(this)}))}))}tokenize(e,t=this.defaultMode){if(!he(this.lexerDefinitionErrors)){const e=ae(this.lexerDefinitionErrors,(e=>e.message)).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,s,a,o,l,c,u,d,h,p,f,m,g;const y=e,T=y.length;let R=0,A=0;const k=this.hasCustom?0:Math.floor(e.length/10),$=new Array(k),x=[];let S=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0;const N=function(e){const t={},n=v(e);return te(n,(n=>{const r=e[n];if(!E(r))throw Error("non exhaustive match");t[n]=[]})),t}(this.emptyGroups),C=this.trackStartLines,w=this.config.lineTerminatorsPattern;let L=0,O=[],_=[];const b=[],P=[];let M;function D(){return O}function U(e){const t=gi(e),n=_[t];return void 0===n?P:n}Object.freeze(P);const G=e=>{if(1===b.length&&void 0===e.tokenType.PUSH_MODE){const t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);x.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{b.pop();const e=ue(b);O=this.patternIdxToConfig[e],_=this.charCodeToPatternIdxToConfig[e],L=O.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=_&&t?U:D}};function F(e){b.push(e),_=this.charCodeToPatternIdxToConfig[e],O=this.patternIdxToConfig[e],L=O.length,L=O.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=_&&t?U:D}let B;F.call(this,t);const K=this.config.recoveryEnabled;for(;R<T;){o=null;const t=y.charCodeAt(R),v=M(t),E=v.length;for(n=0;n<E;n++){B=v[n];const r=B.pattern;l=null;const u=B.short;if(!1!==u?t===u&&(o=r):!0===B.isCustom?(g=r.exec(y,R,$,N),null!==g?(o=g[0],void 0!==g.payload&&(l=g.payload)):o=null):(this.updateLastIndex(r,R),o=this.match(r,e,R)),null!==o){if(a=B.longerAlt,void 0!==a){const t=a.length;for(i=0;i<t;i++){const t=O[a[i]],n=t.pattern;if(c=null,!0===t.isCustom?(g=n.exec(y,R,$,N),null!==g?(s=g[0],void 0!==g.payload&&(c=g.payload)):s=null):(this.updateLastIndex(n,R),s=this.match(n,e,R)),s&&s.length>o.length){o=s,l=c,B=t;break}}}break}}if(null!==o){if(u=o.length,d=B.group,void 0!==d&&(h=B.tokenTypeIdx,p=this.createTokenInstance(o,R,h,B.tokenType,S,I,u),this.handlePayload(p,l),!1===d?A=this.addToken($,A,p):N[d].push(p)),e=this.chopInput(e,u),R+=u,I=this.computeNewColumn(I,u),!0===C&&!0===B.canLineTerminator){let e,t,n=0;w.lastIndex=0;do{e=w.test(o),!0===e&&(t=w.lastIndex-1,n++)}while(!0===e);0!==n&&(S+=n,I=u-t,this.updateTokenEndLineColumnLocation(p,d,t,n,S,I,u))}this.handleModes(B,G,F,p)}else{const t=R,n=S,i=I;let s=!1===K;for(;!1===s&&R<T;)for(e=this.chopInput(e,1),R++,r=0;r<L;r++){const t=O[r],n=t.pattern,i=t.short;if(!1!==i?y.charCodeAt(R)===i&&(s=!0):!0===t.isCustom?s=null!==n.exec(y,R,$,N):(this.updateLastIndex(n,R),s=null!==n.exec(e)),!0===s)break}if(f=R-t,I=this.computeNewColumn(I,f),m=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,t,f,n,i),x.push({offset:t,line:n,column:i,length:f,message:m}),!1===K)break}}return this.hasCustom||($.length=A),{tokens:$,groups:N,errors:x}}handleModes(e,t,n,r){if(!0===e.pop){const i=e.push;t(r),void 0!==i&&n.call(this,i)}else void 0!==e.push&&n.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,n,r,i,s,a){let o,l;void 0!==t&&(o=n===a-1,l=o?-1:0,1===r&&!0===o||(e.endLine=i+l,e.endColumn=s-1-l))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,s){return{image:e,startOffset:t,startLine:i,startColumn:s,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,s,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:i,endLine:i,startColumn:s,endColumn:s+a-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}matchWithTest(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchWithExec(e,t){const n=e.exec(t);return null!==n?n[0]:null}}function Li(e){return Oi(e)?e.LABEL:e.name}function Oi(e){return Le(e.LABEL)&&""!==e.LABEL}wi.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.",wi.NA=/NOT_APPLICABLE/;const _i="parent",bi="categories",Pi="label",Mi="group",Di="push_mode",Ui="pop_mode",Gi="longer_alt",Fi="line_breaks",Bi="start_chars_hint";function Ki(e){return function(e){const t=e.pattern,n={};n.name=e.name,ne(t)||(n.PATTERN=t);if(le(e,_i))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";le(e,bi)&&(n.CATEGORIES=e[bi]);Ei([n]),le(e,Pi)&&(n.LABEL=e[Pi]);le(e,Mi)&&(n.GROUP=e[Mi]);le(e,Ui)&&(n.POP_MODE=e[Ui]);le(e,Di)&&(n.PUSH_MODE=e[Di]);le(e,Gi)&&(n.LONGER_ALT=e[Gi]);le(e,Fi)&&(n.LINE_BREAKS=e[Fi]);le(e,Bi)&&(n.START_CHARS_HINT=e[Bi]);return n}(e)}const Vi=Ki({name:"EOF",pattern:wi.NA});function ji(e,t,n,r,i,s,a,o){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function Hi(e,t){return yi(e,t)}Ei([Vi]);const Wi={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${Oi(e)?`--\x3e ${Li(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>"Redundant input, expecting EOF but found: "+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",a="\nbut found: '"+xe(t).image+"'";if(r)return s+r+a;{const t=re(e,((e,t)=>e.concat(t)),[]),n=ae(t,(e=>`[${ae(e,(e=>Li(e))).join(", ")}]`));return s+`one of these possible Token sequences:\n${ae(n,((e,t)=>` ${t+1}. ${e}`)).join("\n")}`+a}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){const i="Expecting: ",s="\nbut found: '"+xe(t).image+"'";if(n)return i+n+s;return i+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${ae(e,(e=>`[${ae(e,(e=>Li(e))).join(",")}]`)).join(" ,")}>`+s}};Object.freeze(Wi);const zi={buildRuleNotFoundError:(e,t)=>"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},Yi={buildDuplicateFoundError(e,t){const n=e.name,r=xe(t),i=r.idx,s=_r(r),a=(o=r)instanceof Cr?o.terminalType.name:o instanceof Rr?o.nonTerminalName:"";var o;let l=`->${s}${i>0?i:""}<- ${a?`with argument: ->${a}<-`:""}\n appears more than once (${t.length} times) in the top level rule: ->${n}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,"\n"),l},buildNamespaceConflictError:e=>`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(e){const t=ae(e.prefixPath,(e=>Li(e))).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){const t=ae(e.prefixPath,(e=>Li(e))).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;let r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return r+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",r},buildEmptyRepetitionError(e){let t=_r(e.repetition);0!==e.repetition.idx&&(t+=e.repetition.idx);return`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:e=>"deprecated",buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){const t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${`${t} --\x3e ${ae(e.leftRecursionPath,(e=>e.name)).concat([t]).join(" --\x3e ")}`}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;t=e.topLevelRule instanceof Er?e.topLevelRule.name:e.topLevelRule;return`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class qi extends Lr{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){te(X(this.nameToTopRule),(e=>{this.currTopLevel=e,e.accept(this)}))}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:va.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Xi extends br{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=pe(this.path.ruleStack).reverse(),this.occurrenceStack=pe(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 r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){he(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Qi extends Xi{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 e=t.concat(n),r=new Ar({definition:e});this.possibleTokTypes=Mr(r),this.found=!0}}}class Ji extends br{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 Zi extends Ji{walkMany(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}}class es extends Ji{walkManySep(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}}class ts extends Ji{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}}class ns extends Ji{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){const e=xe(t.concat(n));this.result.isEndOfRule=void 0===e,e instanceof Cr&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}}function rs(e,t,n=[]){n=pe(n);let r=[],i=0;function s(s){const a=rs(s.concat(Re(e,i+1)),t,n);return r.concat(a)}for(;n.length<t&&i<e.length;){const t=e[i];if(t instanceof Ar)return s(t.definition);if(t instanceof Rr)return s(t.definition);if(t instanceof kr)r=s(t.definition);else{if(t instanceof $r){return s(t.definition.concat([new Sr({definition:t.definition})]))}if(t instanceof xr){return s([new Ar({definition:t.definition}),new Sr({definition:[new Cr({terminalType:t.separator})].concat(t.definition)})])}if(t instanceof Ir){const e=t.definition.concat([new Sr({definition:[new Cr({terminalType:t.separator})].concat(t.definition)})]);r=s(e)}else if(t instanceof Sr){const e=t.definition.concat([new Sr({definition:t.definition})]);r=s(e)}else{if(t instanceof Nr)return te(t.definition,(e=>{!1===he(e.definition)&&(r=s(e.definition))})),r;if(!(t instanceof Cr))throw Error("non exhaustive match");n.push(t.terminalType)}}i++}return r.push({partialPath:n,suffixDef:Re(e,i)}),r}function is(e,t,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const l=t.length,c=l-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!he(d);){const e=d.pop();if(e===a){o&&ue(d).idx<=c&&d.pop();continue}const r=e.def,h=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(he(r))continue;const m=r[0];if(m===i){const e={idx:h,def:Re(r),ruleStack:Ee(p),occurrenceStack:Ee(f)};d.push(e)}else if(m instanceof Cr)if(h<l-1){const e=h+1;if(n(t[e],m.terminalType)){const t={idx:e,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(t)}}else{if(h!==l-1)throw Error("non exhaustive match");u.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),o=!0}else if(m instanceof Rr){const e=pe(p);e.push(m.nonTerminalName);const t=pe(f);t.push(m.idx);const n={idx:h,def:m.definition.concat(s,Re(r)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(m instanceof kr){const e={idx:h,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a);const t={idx:h,def:m.definition.concat(Re(r)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof $r){const e=new Sr({definition:m.definition,idx:m.idx}),t={idx:h,def:m.definition.concat([e],Re(r)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof xr){const e=new Cr({terminalType:m.separator}),t=new Sr({definition:[e].concat(m.definition),idx:m.idx}),n={idx:h,def:m.definition.concat([t],Re(r)),ruleStack:p,occurrenceStack:f};d.push(n)}else if(m instanceof Ir){const e={idx:h,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a);const t=new Cr({terminalType:m.separator}),n=new Sr({definition:[t].concat(m.definition),idx:m.idx}),i={idx:h,def:m.definition.concat([n],Re(r)),ruleStack:p,occurrenceStack:f};d.push(i)}else if(m instanceof Sr){const e={idx:h,def:Re(r),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a);const t=new Sr({definition:m.definition,idx:m.idx}),n={idx:h,def:m.definition.concat([t],Re(r)),ruleStack:p,occurrenceStack:f};d.push(n)}else if(m instanceof Nr)for(let t=m.definition.length-1;t>=0;t--){const e={idx:h,def:m.definition[t].definition.concat(Re(r)),ruleStack:p,occurrenceStack:f};d.push(e),d.push(a)}else if(m instanceof Ar)d.push({idx:h,def:m.definition.concat(Re(r)),ruleStack:p,occurrenceStack:f});else{if(!(m instanceof Er))throw Error("non exhaustive match");d.push(ss(m,h,p,f))}}return u}function ss(e,t,n,r){const i=pe(n);i.push(e.name);const s=pe(r);return s.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:s}}var as,os;function ls(e){if(e instanceof kr||"Option"===e)return as.OPTION;if(e instanceof Sr||"Repetition"===e)return as.REPETITION;if(e instanceof $r||"RepetitionMandatory"===e)return as.REPETITION_MANDATORY;if(e instanceof xr||"RepetitionMandatoryWithSeparator"===e)return as.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof Ir||"RepetitionWithSeparator"===e)return as.REPETITION_WITH_SEPARATOR;if(e instanceof Nr||"Alternation"===e)return as.ALTERNATION;throw Error("non exhaustive match")}function cs(e){const{occurrence:t,rule:n,prodType:r,maxLookahead:i}=e,s=ls(r);return s===as.ALTERNATION?Ts(t,n,i):vs(t,n,s,i)}function us(e,t,n,r){const i=e.length,s=$e(e,(e=>$e(e,(e=>1===e.length))));if(t)return function(t){const r=ae(t,(e=>e.GATE));for(let s=0;s<i;s++){const t=e[s],i=t.length,a=r[s];if(void 0===a||!1!==a.call(this))e:for(let e=0;e<i;e++){const r=t[e],i=r.length;for(let e=0;e<i;e++){const t=this.LA(e+1);if(!1===n(t,r[e]))continue e}return s}}};if(s&&!r){const t=ae(e,(e=>U(e))),n=re(t,((e,t,n)=>(te(t,(t=>{le(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),te(t.categoryMatches,(t=>{le(e,t)||(e[t]=n)}))})),e)),{});return function(){const e=this.LA(1);return n[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){const r=e[t],i=r.length;e:for(let e=0;e<i;e++){const i=r[e],s=i.length;for(let e=0;e<s;e++){const t=this.LA(e+1);if(!1===n(t,i[e]))continue e}return t}}}}function ds(e,t,n){const r=$e(e,(e=>1===e.length)),i=e.length;if(r&&!n){const t=U(e);if(1===t.length&&he(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=re(t,((e,t,n)=>(e[t.tokenTypeIdx]=!0,te(t.categoryMatches,(t=>{e[t]=!0})),e)),[]);return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let n=0;n<i;n++){const r=e[n],i=r.length;for(let e=0;e<i;e++){const n=this.LA(e+1);if(!1===t(n,r[e]))continue e}return!0}return!1}}(os=as||(as={}))[os.OPTION=0]="OPTION",os[os.REPETITION=1]="REPETITION",os[os.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",os[os.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",os[os.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",os[os.ALTERNATION=5]="ALTERNATION";class hs extends br{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,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,as.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,as.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,as.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,as.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,as.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}}class ps extends Lr{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||void 0!==this.targetRef&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,as.OPTION)}visitRepetition(e){this.checkIsTarget(e,as.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,as.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,as.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,as.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,as.ALTERNATION)}}function fs(e){const t=new Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function ms(e){let t=[""];for(let n=0;n<e.length;n++){const r=e[n],i=[];for(let e=0;e<t.length;e++){const n=t[e];i.push(n+"_"+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){const t="_"+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function gs(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;const i=e[r];for(let e=0;e<t.length;e++){if(!0===i[t[e]])return!1}}return!0}function ys(e,t){const n=ae(e,(e=>rs([e],1))),r=fs(n.length),i=ae(n,(e=>{const t={};return te(e,(e=>{const n=ms(e.partialPath);te(n,(e=>{t[e]=!0}))})),t}));let s=n;for(let a=1;a<=t;a++){const e=s;s=fs(e.length);for(let n=0;n<e.length;n++){const o=e[n];for(let e=0;e<o.length;e++){const l=o[e].partialPath,c=o[e].suffixDef,u=ms(l);if(gs(i,u,n)||he(c)||l.length===t){const e=r[n];if(!1===Rs(e,l)){e.push(l);for(let e=0;e<u.length;e++){const t=u[e];i[n][t]=!0}}}else{const e=rs(c,a+1,l);s[n]=s[n].concat(e),te(e,(e=>{const t=ms(e.partialPath);te(t,(e=>{i[n][e]=!0}))}))}}}}return r}function Ts(e,t,n,r){const i=new ps(e,as.ALTERNATION,r);return t.accept(i),ys(i.result,n)}function vs(e,t,n,r){const i=new ps(e,n);t.accept(i);const s=i.result,a=new hs(t,e,n).startWalking();return ys([new Ar({definition:s}),new Ar({definition:a})],r)}function Rs(e,t){e:for(let n=0;n<e.length;n++){const r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){const n=t[e],i=r[e];if(!1===(n===i||void 0!==i.categoryMatchesMap[n.tokenTypeIdx]))continue e}return!0}}return!1}function Es(e){return $e(e,(e=>$e(e,(e=>$e(e,(e=>he(e.categoryMatches)))))))}function As(e,t,n,r){const i=Se(e,(e=>function(e,t){const n=new xs;e.accept(n);const r=n.allProductions,i=De(we(r,ks),(e=>e.length>1)),s=ae(X(i),(n=>{const r=xe(n),i=t.buildDuplicateFoundError(e,n),s=_r(r),a={message:i,type:va.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:s,occurrence:r.idx},o=$s(r);return o&&(a.parameter=o),a}));return s}(e,n))),s=function(e,t,n){const r=[],i=ae(t,(e=>e.name));return te(e,(e=>{const t=e.name;if(_e(i,t)){const i=n.buildNamespaceConflictError(e);r.push({message:i,type:va.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}})),r}(e,t,n),a=Se(e,(e=>function(e,t){const n=new Ns;e.accept(n);const r=Se(n.alternations,(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:va.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[]));return r}(e,n))),o=Se(e,(t=>function(e,t,n,r){const i=[],s=re(t,((t,n)=>n.name===e.name?t+1:t),0);if(s>1){const t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:va.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,r,n)));return i.concat(s,a,o)}function ks(e){return`${_r(e)}_#_${e.idx}_#_${$s(e)}`}function $s(e){return e instanceof Cr?e.terminalType.name:e instanceof Rr?e.nonTerminalName:""}class xs extends Lr{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 Ss(e,t,n,r=[]){const i=[],s=Is(t.definition);if(he(s))return[];{const t=e.name;_e(s,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:va.LEFT_RECURSION,ruleName:t});const a=Se(ve(s,r.concat([e])),(t=>{const i=pe(r);return i.push(t),Ss(e,t,n,i)}));return i.concat(a)}}function Is(e){let t=[];if(he(e))return t;const n=xe(e);if(n instanceof Rr)t.push(n.referencedRule);else if(n instanceof Ar||n instanceof kr||n instanceof $r||n instanceof xr||n instanceof Ir||n instanceof Sr)t=t.concat(Is(n.definition));else if(n instanceof Nr)t=U(ae(n.definition,(e=>Is(e.definition))));else if(!(n instanceof Cr))throw Error("non exhaustive match");const r=Or(n),i=e.length>1;if(r&&i){const n=Re(e);return t.concat(Is(n))}return t}class Ns extends Lr{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function Cs(e,t,n){const r=new Ns;e.accept(r);let i=r.alternations;i=Ue(i,(e=>!0===e.ignoreAmbiguities));const s=Se(i,(r=>{const i=r.idx,s=r.maxLookahead||t,a=Ts(i,e,s,r),o=function(e,t,n,r){const i=[],s=re(e,((n,r,s)=>(!0===t.definition[s].ignoreAmbiguities||te(r,(r=>{const a=[s];te(e,((e,n)=>{s!==n&&Rs(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&a.push(n)})),a.length>1&&!Rs(i,r)&&(i.push(r),n.push({alts:a,path:r}))})),n)),[]),a=ae(s,(e=>{const i=ae(e.alts,(e=>e+1));return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:va.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}}));return a}(a,r,e,n),l=function(e,t,n,r){const i=re(e,((e,t,n)=>{const r=ae(t,(e=>({idx:n,path:e})));return e.concat(r)}),[]),s=ge(Se(i,(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];const s=e.idx,a=e.path,o=ie(i,(e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<s&&(n=e.path,r=a,n.length<r.length&&$e(n,((e,t)=>{const n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]})));var n,r}));return ae(o,(e=>{const i=[e.idx+1,s+1],a=0===t.idx?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:va.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:a,alternatives:i}}))})));return s}(a,r,e,n);return o.concat(l)}));return s}class ws extends Lr{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 Ls(e){const t=ce(e,{errMsgProvider:zi}),n={};return te(e.rules,(e=>{n[e.name]=e})),function(e,t){const n=new qi(e,t);return n.resolveRefs(),n.errors}(n,t.errMsgProvider)}const Os="MismatchedTokenException",_s="NoViableAltException",bs="EarlyExitException",Ps="NotAllInputParsedException",Ms=[Os,_s,bs,Ps];function Ds(e){return _e(Ms,e.name)}Object.freeze(Ms);class Us 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 Gs extends Us{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Os}}class Fs extends Us{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=_s}}class Bs extends Us{constructor(e,t){super(e,t),this.name=Ps}}class Ks extends Us{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=bs}}const Vs={},js="InRuleRecoveryException";class Hs extends Error{constructor(e){super(e),this.name=js}}function Ws(e,t,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let l=this.firstAfterRepMap[o];if(void 0===l){const e=this.getCurrRuleFullName();l=new s(this.getGAstProductions()[e],i).startWalking(),this.firstAfterRepMap[o]=l}let c=l.token,u=l.occurrence;const d=l.isEndOfRule;1===this.RULE_STACK.length&&d&&void 0===c&&(c=Vi,u=1),void 0!==c&&void 0!==u&&this.shouldInRepetitionRecoveryBeTried(c,u,a)&&this.tryInRepetitionRecovery(e,t,n,c)}const zs=1024,Ys=1280,qs=1536;function Xs(e,t,n){return n|t|e}class Qs{constructor(e){var t;this.maxLookahead=null!==(t=null==e?void 0:e.maxLookahead)&&void 0!==t?t:ya.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if(he(t)){const n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return Se(e,(e=>Ss(e,e,Yi)))}validateEmptyOrAlternatives(e){return Se(e,(e=>function(e,t){const n=new Ns;return e.accept(n),Se(n.alternations,(n=>Se(Ee(n.definition),((r,i)=>{const s=is([r],[],yi,1);return he(s)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:va.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]}))))}(e,Yi)))}validateAmbiguousAlternationAlternatives(e,t){return Se(e,(e=>Cs(e,t,Yi)))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,n){const r=[];return te(e,(e=>{const i=new ws;e.accept(i);const s=i.allProductions;te(s,(i=>{const s=ls(i),a=i.maxLookahead||t,o=vs(i.idx,e,s,a)[0];if(he(U(o))){const t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:va.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}}))})),r}(e,t,Yi)}buildLookaheadForAlternation(e){return function(e,t,n,r,i,s){const a=Ts(e,t,n);return s(a,r,Es(a)?Ti:yi,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,us)}buildLookaheadForOptional(e){return function(e,t,n,r,i,s){const a=vs(e,t,i,n),o=Es(a)?Ti:yi;return s(a[0],o,r)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,ls(e.prodType),ds)}}const Js=new class extends Lr{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)}};function Zs(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function ea(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function ta(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function na(e,t){const n=v(e),r=n.length;for(let i=0;i<r;i++){const r=e[n[i]],s=r.length;for(let e=0;e<s;e++){const n=r[e];void 0===n.tokenTypeIdx&&this[n.name](n.children,t)}}}function ra(e,t){const n=function(){};ta(n,e+"BaseSemantics");const r={visit:function(e,t){if(E(e)&&(e=e[0]),!ne(e))return this[e.name](e.children,t)},validateVisitor:function(){const e=function(e,t){const n=function(e,t){const n=ie(t,(t=>!1===G(e[t]))),r=ae(n,(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:ia.MISSING_METHOD,methodName:t})));return ge(r)}(e,t);return n}(this,t);if(!he(e)){const t=ae(e,(e=>e.msg));throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join("\n\n").replace(/\n/g,"\n\t")}`)}}};return(n.prototype=r).constructor=n,n._RULE_NAMES=t,n}var ia,sa;(sa=ia||(ia={}))[sa.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",sa[sa.MISSING_METHOD=1]="MISSING_METHOD";const aa={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(aa);const oa=!0,la=Math.pow(2,8)-1,ca=Ki({name:"RECORDING_PHASE_TOKEN",pattern:wi.NA});Ei([ca]);const ua=ji(ca,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(ua);const da={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}};function ha(e,t,n,r=!1){ma(n);const i=ue(this.recordingProdStack),s=G(t)?t:t.DEF,a=new e({definition:[],idx:n});return r&&(a.separator=t.SEP),le(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),aa}function pa(e,t){ma(t);const n=ue(this.recordingProdStack),r=!1===E(e),i=!1===r?e:e.DEF,s=new Nr({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});le(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD);const a=Fe(i,(e=>G(e.GATE)));return s.hasPredicates=a,n.definition.push(s),te(i,(e=>{const t=new Ar({definition:[]});s.definition.push(t),le(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:le(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()})),aa}function fa(e){return 0===e?"":`${e}`}function ma(e){if(e<0||e>la){const t=new Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than ${la+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}const ga=ji(Vi,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ga);const ya=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Wi,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ta=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var va,Ra,Ea;function Aa(e=void 0){return function(){return e}}(Ra=va||(va={}))[Ra.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",Ra[Ra.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",Ra[Ra.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",Ra[Ra.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",Ra[Ra.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",Ra[Ra.LEFT_RECURSION=5]="LEFT_RECURSION",Ra[Ra.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",Ra[Ra.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",Ra[Ra.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",Ra[Ra.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",Ra[Ra.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",Ra[Ra.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",Ra[Ra.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",Ra[Ra.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION";class ka{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\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",(()=>{yr(this)})),this.TRACE_INIT("Grammar Recording",(()=>{try{this.enableRecording(),te(this.definedRulesNames,(e=>{const t=this[e].originalGrammarAction;let n;this.TRACE_INIT(`${e} Rule`,(()=>{n=this.topLevelRuleRecord(e,t)})),this.gastProductionsCache[e]=n}))}finally{this.disableRecording()}}));let n=[];if(this.TRACE_INIT("Grammar Resolving",(()=>{n=Ls({rules:X(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)})),this.TRACE_INIT("Grammar Validations",(()=>{if(he(n)&&!1===this.skipValidations){const n=(e={rules:X(this.gastProductionsCache),tokenTypes:X(this.tokensMap),errMsgProvider:Yi,grammarName:t},As((e=ce(e,{errMsgProvider:Yi})).rules,e.tokenTypes,e.errMsgProvider,e.grammarName)),r=function(e){const t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return ae(t,(e=>Object.assign({type:va.CUSTOM_LOOKAHEAD_VALIDATION},e)))}({lookaheadStrategy:this.lookaheadStrategy,rules:X(this.gastProductionsCache),tokenTypes:X(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(n,r)}var e})),he(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",(()=>{const e=function(e){const t={};return te(e,(e=>{const n=new Ur(e).startWalking();me(t,n)})),t}(X(this.gastProductionsCache));this.resyncFollows=e})),this.TRACE_INIT("ComputeLookaheadFunctions",(()=>{var e,t;null===(t=(e=this.lookaheadStrategy).initialize)||void 0===t||t.call(e,{rules:X(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(X(this.gastProductionsCache))}))),!ka.DEFER_DEFINITION_ERRORS_HANDLING&&!he(this.definitionErrors))throw e=ae(this.definitionErrors,(e=>e.message)),new Error(`Parser Definition Errors detected:\n ${e.join("\n-------------------------------\n")}`)}))}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),le(t,"ignoredIssues"))throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\tPlease use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=le(t,"skipValidations")?t.skipValidations:ya.skipValidations}}ka.DEFER_DEFINITION_ERRORS_HANDLING=!1,Ea=ka,[class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=le(e,"recoveryEnabled")?e.recoveryEnabled:ya.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Ws)}getTokenToInsert(e){const t=ji(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){const i=this.findReSyncTokenType(),s=this.exportLexerState(),a=[];let o=!1;const l=this.LA(1);let c=this.LA(1);const u=()=>{const e=this.LA(0),t=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:l,previous:e,ruleName:this.getCurrRuleFullName()}),n=new Gs(t,l,this.LA(0));n.resyncedTokens=Ee(a),this.SAVE_ERROR(n)};for(;!o;){if(this.tokenMatcher(c,r))return void u();if(n.call(this))return u(),void e.apply(this,t);this.tokenMatcher(c,i)?o=!0:(c=this.SKIP_TOKEN(),this.addToResyncTokens(c,a))}this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,t,n){return!1!==n&&!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 e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new Hs("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(he(t))return!1;const n=this.LA(1);return void 0!==oe(t,(e=>this.tokenMatcher(n,e)))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey();return _e(this.getFollowSetFromFollowKey(t),e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),n=2;for(;;){const r=oe(e,(e=>Hi(t,e)));if(void 0!==r)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return Vs;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 ae(e,((n,r)=>0===r?Vs:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])}))}flattenFollowSet(){const e=ae(this.buildFullFollowKeyStack(),(e=>this.getFollowSetFromFollowKey(e)));return U(e)}getFollowSetFromFollowKey(e){if(e===Vs)return[Vi];const t=e.ruleName+e.idxInCallingRule+Dr+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,Vi)||t.push(e),t}reSyncTo(e){const t=[];let n=this.LA(1);for(;!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return Ee(t)}attemptInRepetitionRecovery(e,t,n,r,i,s,a){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:pe(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return ae(this.RULE_STACK,(e=>this.shortRuleNameToFullName(e)))}},class{initLooksAhead(e){this.dynamicTokensEnabled=le(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ya.dynamicTokensEnabled,this.maxLookahead=le(e,"maxLookahead")?e.maxLookahead:ya.maxLookahead,this.lookaheadStrategy=le(e,"lookaheadStrategy")?e.lookaheadStrategy:new Qs({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){te(e,(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,(()=>{const{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:a}=function(e){Js.reset(),e.accept(Js);const t=Js.dslMethods;return Js.reset(),t}(e);te(t,(t=>{const n=0===t.idx?"":t.idx;this.TRACE_INIT(`${_r(t)}${n}`,(()=>{const n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),r=Xs(this.fullRuleNameToShort[e.name],256,t.idx);this.setLaFuncCache(r,n)}))})),te(n,(t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,_r(t))})),te(r,(t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,_r(t))})),te(i,(t=>{this.computeLookaheadFunc(e,t.idx,zs,"RepetitionMandatory",t.maxLookahead,_r(t))})),te(s,(t=>{this.computeLookaheadFunc(e,t.idx,qs,"RepetitionMandatoryWithSeparator",t.maxLookahead,_r(t))})),te(a,(t=>{this.computeLookaheadFunc(e,t.idx,Ys,"RepetitionWithSeparator",t.maxLookahead,_r(t))}))}))}))}computeLookaheadFunc(e,t,n,r,i,s){this.TRACE_INIT(`${s}${0===t?"":t}`,(()=>{const s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),a=Xs(this.fullRuleNameToShort[e.name],n,t);this.setLaFuncCache(a,s)}))}getKeyForAutomaticLookahead(e,t){return Xs(this.getLastExplicitRuleShortName(),e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=le(e,"nodeLocationTracking")?e.nodeLocationTracking:ya.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ea,this.setNodeLocationFromNode=ea,this.cstPostRule=se,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=se,this.setNodeLocationFromNode=se,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Zs,this.setNodeLocationFromNode=Zs,this.cstPostRule=se,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=se,this.setNodeLocationFromNode=se,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);this.setNodeLocationFromToken=se,this.setNodeLocationFromNode=se,this.cstPostRule=se,this.setInitialNodeLocation=se}else this.cstInvocationStateUpdate=se,this.cstFinallyStateUpdate=se,this.cstPostTerminal=se,this.cstPostNonTerminal=se,this.cstPostRule=se}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==1?(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==1?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,s;i=t,s=e,void 0===(r=n).children[s]?r.children[s]=[i]:r.children[s].push(i),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){const n=this.CST_STACK[this.CST_STACK.length-1];!function(e,t,n){void 0===e.children[t]?e.children[t]=[n]:e.children[t].push(n)}(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(ne(this.baseCstVisitorConstructor)){const e=ra(this.className,v(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ne(this.baseCstVisitorWithDefaultsConstructor)){const e=function(e,t,n){const r=function(){};ta(r,e+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return te(t,(e=>{i[e]=na})),(r.prototype=i).constructor=r,r}(this.className,v(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{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)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)):ga}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?ga: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{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Ti,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},le(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if(E(e)){if(he(e))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if(E(e))this.tokensMap=re(e,((e,t)=>(e[t.name]=t,e)),{});else if(le(e,"modes")&&$e(U(X(e.modes)),xi)){const t=Be(U(X(e.modes)));this.tokensMap=re(t,((e,t)=>(e[t.name]=t,e)),{})}else{if(!B(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=pe(e)}this.tokensMap.EOF=Vi;const n=$e(le(e,"modes")?U(X(e.modes)):X(e),(e=>he(e.categoryMatches)));this.tokenMatcher=n?Ti:yi,Ei(X(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'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=le(n,"resyncEnabled")?n.resyncEnabled:Ta.resyncEnabled,i=le(n,"recoveryValueFunc")?n.recoveryValueFunc:Ta.recoveryValueFunc,s=this.ruleShortNameIdx<<12;let a;return this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s,a=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,n);const r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(a){return this.invokeRuleCatch(a,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,n)}catch(a){return this.invokeRuleCatch(a,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){const r=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Ds(e)){const t=e;if(i){const r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){const n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof e){r=e.DEF;const t=e.GATE;if(void 0!==t){const e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){const n=this.getKeyForAutomaticLookahead(zs,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,as.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,zs,e,ts)}atLeastOneSepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(qs,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(e,as.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,ns],t,qs,e,ns)}}manyInternal(e,t){const n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.getLaFuncFromCache(n);if("function"!=typeof t){r=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let s=!0;for(;!0===i.call(this)&&!0===s;)s=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Zi,s)}manySepFirstInternal(e,t){const n=this.getKeyForAutomaticLookahead(Ys,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){const r=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(n).call(this)){r.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,es],t,Ys,e,es)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,qs,e,i)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const n=this.getKeyForAutomaticLookahead(256,t),r=E(e)?e:e.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(void 0!==i)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Bs(t,e))}}subruleInternal(e,t,n){let r;try{const i=void 0!==n?n.ARGS:void 0;return this.subruleIdx=t,r=e.apply(this,i),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:e.ruleName),r}catch(i){throw this.subruleInternalError(i,n,e.ruleName)}}subruleInternalError(e,t,n){throw Ds(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{const t=this.LA(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(i){r=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(void 0!==n&&void 0!==n.LABEL?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r;const i=this.LA(0);throw r=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Gs(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;{const i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(r){throw r.name===js?n:r}}}saveRecogState(){const e=this.errors,t=pe(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 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Vi)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},class{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=Ta){if(_e(this.definedRulesNames,e)){const t={message:Yi.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:va.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);const r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Ta){const r=function(e,t,n){const r=[];let i;return _e(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:va.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return e.apply(this,t),!0}catch(r){if(Ds(r))return!1;throw r}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return e=X(this.gastProductionsCache),ae(e,wr);var e}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=le(e,"errorMessageProvider")?e.errorMessageProvider:ya.errorMessageProvider}SAVE_ERROR(e){if(Ds(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:pe(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return pe(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){const r=this.getCurrRuleFullName(),i=vs(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],s=[];for(let o=1;o<=this.maxLookahead;o++)s.push(this.LA(o));const a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:s,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new Ks(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const n=this.getCurrRuleFullName(),r=Ts(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let o=1;o<=this.maxLookahead;o++)i.push(this.LA(o));const s=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Fs(a,this.LA(1),s))}},class{initContentAssist(){}computeContentAssist(e,t){const n=this.gastProductionsCache[e];if(ne(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return is([n],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=xe(e.ruleStack),n=this.getGAstProductions()[t];return new Qi(n,e).startWalking()}},class{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(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}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 ga}topLevelRuleRecord(e,t){try{const n=new Er({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(n){if(!0!==n.KNOWN_RECORDER_ERROR)try{n.message=n.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(r){throw n}throw n}}optionInternalRecord(e,t){return ha.call(this,kr,e,t)}atLeastOneInternalRecord(e,t){ha.call(this,$r,t,e)}atLeastOneSepFirstInternalRecord(e,t){ha.call(this,xr,t,e,oa)}manyInternalRecord(e,t){ha.call(this,Sr,t,e)}manySepFirstInternalRecord(e,t){ha.call(this,Ir,t,e,oa)}orInternalRecord(e,t){return pa.call(this,e,t)}subruleInternalRecord(e,t,n){if(ma(t),!e||!1===le(e,"ruleName")){const n=new Error(`<SUBRULE${fa(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}const r=ue(this.recordingProdStack),i=e.ruleName,s=new Rr({idx:t,nonTerminalName:i,label:null==n?void 0:n.LABEL,referencedRule:void 0});return r.definition.push(s),this.outputCst?da:aa}consumeInternalRecord(e,t,n){if(ma(t),!ki(e)){const n=new Error(`<CONSUME${fa(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}const r=ue(this.recordingProdStack),i=new Cr({idx:t,terminalType:e,label:null==n?void 0:n.LABEL});return r.definition.push(i),ua}},class{initPerformanceTracer(e){if(le(e,"traceInitPerf")){const t=e.traceInitPerf,n="number"==typeof t;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=ya.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);const{time:r,value:i}=gr(t),s=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach((e=>{const t=e.prototype;Object.getOwnPropertyNames(t).forEach((n=>{if("constructor"===n)return;const r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(Ea.prototype,n,r):Ea.prototype[n]=e.prototype[n]}))}));class $a extends ka{constructor(e,t=ya){const n=pe(t);n.outputCst=!1,super(e,n)}}function xa(e,t,n){return`${e.name}_${t}_${n}`}class Sa{constructor(e){this.target=e}isEpsilon(){return!1}}class Ia extends Sa{constructor(e,t){super(e),this.tokenType=t}}class Na extends Sa{constructor(e){super(e)}isEpsilon(){return!0}}class Ca extends Sa{constructor(e,t,n){super(e),this.rule=t,this.followState=n}isEpsilon(){return!0}}function wa(e){const t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};!function(e,t){const n=t.length;for(let r=0;r<n;r++){const n=t[r],i=Fa(e,n,void 0,{type:2}),s=Fa(e,n,void 0,{type:7});i.stop=s,e.ruleToStartState.set(n,i),e.ruleToStopState.set(n,s)}}(t,e);const n=e.length;for(let r=0;r<n;r++){const n=e[r],i=Oa(t,n,n);void 0!==i&&Ua(t,n,i)}return t}function La(e,t,n){return n instanceof Cr?Da(e,t,n.terminalType,n):n instanceof Rr?function(e,t,n){const r=n.referencedRule,i=e.ruleToStartState.get(r),s=Fa(e,t,n,{type:1}),a=Fa(e,t,n,{type:1}),o=new Ca(i,r,a);return Ba(s,o),{left:s,right:a}}(e,t,n):n instanceof Nr?function(e,t,n){const r=Fa(e,t,n,{type:1});Pa(e,r);const i=ae(n.definition,(n=>La(e,t,n))),s=Ma(e,t,r,n,...i);return s}(e,t,n):n instanceof kr?function(e,t,n){const r=Fa(e,t,n,{type:1});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n));return function(e,t,n,r){const i=r.left,s=r.right;return Ga(i,s),e.decisionMap[xa(t,"Option",n.idx)]=i,r}(e,t,n,i)}(e,t,n):n instanceof Sr?function(e,t,n){const r=Fa(e,t,n,{type:5});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n));return ba(e,t,n,i)}(e,t,n):n instanceof Ir?function(e,t,n){const r=Fa(e,t,n,{type:5});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n)),s=Da(e,t,n.separator,n);return ba(e,t,n,i,s)}(e,t,n):n instanceof $r?function(e,t,n){const r=Fa(e,t,n,{type:4});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n));return _a(e,t,n,i)}(e,t,n):n instanceof xr?function(e,t,n){const r=Fa(e,t,n,{type:4});Pa(e,r);const i=Ma(e,t,r,n,Oa(e,t,n)),s=Da(e,t,n.separator,n);return _a(e,t,n,i,s)}(e,t,n):Oa(e,t,n)}function Oa(e,t,n){const r=ie(ae(n.definition,(n=>La(e,t,n))),(e=>void 0!==e));return 1===r.length?r[0]:0===r.length?void 0:function(e,t){const n=t.length;for(let s=0;s<n-1;s++){const n=t[s];let r;1===n.left.transitions.length&&(r=n.left.transitions[0]);const i=r instanceof Ca,a=r,o=t[s+1].left;1===n.left.type&&1===n.right.type&&void 0!==r&&(i&&a.followState===n.right||r.target===n.right)?(i?a.followState=o:r.target=o,Ka(e,n.right)):Ga(n.right,o)}const r=t[0],i=t[n-1];return{left:r.left,right:i.right}}(e,r)}function _a(e,t,n,r,i){const s=r.left,a=r.right,o=Fa(e,t,n,{type:11});Pa(e,o);const l=Fa(e,t,n,{type:12});return s.loopback=o,l.loopback=o,e.decisionMap[xa(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,Ga(a,o),void 0===i?(Ga(o,s),Ga(o,l)):(Ga(o,l),Ga(o,i.left),Ga(i.right,s)),{left:s,right:l}}function ba(e,t,n,r,i){const s=r.left,a=r.right,o=Fa(e,t,n,{type:10});Pa(e,o);const l=Fa(e,t,n,{type:12}),c=Fa(e,t,n,{type:9});return o.loopback=c,l.loopback=c,Ga(o,s),Ga(o,l),Ga(a,c),void 0!==i?(Ga(c,l),Ga(c,i.left),Ga(i.right,s)):Ga(c,o),e.decisionMap[xa(t,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:l}}function Pa(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function Ma(e,t,n,r,...i){const s=Fa(e,t,r,{type:8,start:n});n.end=s;for(const o of i)void 0!==o?(Ga(n,o.left),Ga(o.right,s)):Ga(n,s);const a={left:n,right:s};return e.decisionMap[xa(t,function(e){if(e instanceof Nr)return"Alternation";if(e instanceof kr)return"Option";if(e instanceof Sr)return"Repetition";if(e instanceof Ir)return"RepetitionWithSeparator";if(e instanceof $r)return"RepetitionMandatory";if(e instanceof xr)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}(r),r.idx)]=n,a}function Da(e,t,n,r){const i=Fa(e,t,r,{type:1}),s=Fa(e,t,r,{type:1});return Ba(i,new Ia(s,n)),{left:i,right:s}}function Ua(e,t,n){const r=e.ruleToStartState.get(t);Ga(r,n.left);const i=e.ruleToStopState.get(t);Ga(n.right,i);return{left:r,right:i}}function Ga(e,t){Ba(e,new Na(t))}function Fa(e,t,n,r){const i=Object.assign({atn:e,production:n,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},r);return e.states.push(i),i}function Ba(e,t){0===e.transitions.length&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function Ka(e,t){e.states.splice(e.states.indexOf(t),1)}const Va={};class ja{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Ha(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return ae(this.configs,(e=>e.alt))}get key(){let e="";for(const t in this.map)e+=t+":";return e}}function Ha(e,t=!0){return`${t?`a${e.alt}`:""}s${e.state.stateNumber}:${e.stack.map((e=>e.stateNumber.toString())).join("_")}`}function Wa(e,t){const n={};return r=>{const i=r.toString();let s=n[i];return void 0!==s||(s={atnStartState:e,decision:t,states:{}},n[i]=s),s}}class za{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+=!0===this.predicates[n]?"1":"0";return e}}const Ya=new za;class qa extends Qs{constructor(e){var t;super(),this.logging=null!==(t=null==e?void 0:e.logging)&&void 0!==t?t:e=>console.log(e)}initialize(e){this.atn=wa(e.rules),this.dfas=function(e){const t=e.decisionStates.length,n=Array(t);for(let r=0;r<t;r++)n[r]=Wa(e.decisionStates[r],r);return n}(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:t,rule:n,hasPredicates:r,dynamicTokensEnabled:i}=e,s=this.dfas,a=this.logging,o=xa(n,"Alternation",t),l=this.atn.decisionMap[o].decision,c=ae(cs({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:n}),(e=>ae(e,(e=>e[0]))));if(Xa(c,!1)&&!i){const e=re(c,((e,t,n)=>(te(t,(t=>{t&&(e[t.tokenTypeIdx]=n,te(t.categoryMatches,(t=>{e[t]=n})))})),e)),{});return r?function(t){var n;const r=this.LA(1),i=e[r.tokenTypeIdx];if(void 0!==t&&void 0!==i){const e=null===(n=t[i])||void 0===n?void 0:n.GATE;if(void 0!==e&&!1===e.call(this))return}return i}:function(){const t=this.LA(1);return e[t.tokenTypeIdx]}}return r?function(e){const t=new za,n=void 0===e?0:e.length;for(let i=0;i<n;i++){const n=null==e?void 0:e[i].GATE;t.set(i,void 0===n||n.call(this))}const r=Qa.call(this,s,l,t,a);return"number"==typeof r?r:void 0}:function(){const e=Qa.call(this,s,l,Ya,a);return"number"==typeof e?e:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:t,rule:n,prodType:r,dynamicTokensEnabled:i}=e,s=this.dfas,a=this.logging,o=xa(n,r,t),l=this.atn.decisionMap[o].decision,c=ae(cs({maxLookahead:1,occurrence:t,prodType:r,rule:n}),(e=>ae(e,(e=>e[0]))));if(Xa(c)&&c[0][0]&&!i){const e=c[0],t=U(e);if(1===t.length&&he(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=re(t,((e,t)=>(void 0!==t&&(e[t.tokenTypeIdx]=!0,te(t.categoryMatches,(t=>{e[t]=!0}))),e)),{});return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){const e=Qa.call(this,s,l,Ya,a);return"object"!=typeof e&&0===e}}}function Xa(e,t=!0){const n=new Set;for(const r of e){const e=new Set;for(const i of r){if(void 0===i){if(t)break;return!1}const r=[i.tokenTypeIdx].concat(i.categoryMatches);for(const t of r)if(n.has(t)){if(!e.has(t))return!1}else n.add(t),e.add(t)}}return!0}function Qa(e,t,n,r){const i=e[t](n);let s=i.start;if(void 0===s){s=so(i,ro(function(e){const t=new ja,n=e.transitions.length;for(let r=0;r<n;r++){ao({state:e.transitions[r].target,alt:r,stack:[]},t)}return t}(i.atnStartState))),i.start=s}return Ja.apply(this,[i,s,n,r])}function Ja(e,t,n,r){let i=t,s=1;const a=[];let o=this.LA(s++);for(;;){let t=(l=o,i.edges[l.tokenTypeIdx]);if(void 0===t&&(t=Za.apply(this,[e,i,o,s,n,r])),t===Va)return to(a,i,o);if(!0===t.isAcceptState)return t.prediction;i=t,a.push(o),o=this.LA(s++)}var l}function Za(e,t,n,r,i,s){const a=function(e,t,n){const r=new ja,i=[];for(const a of e.elements){if(!1===n.is(a.alt))continue;if(7===a.state.type){i.push(a);continue}const e=a.state.transitions.length;for(let n=0;n<e;n++){const e=no(a.state.transitions[n],t);void 0!==e&&r.add({state:e,alt:a.alt,stack:a.stack})}}let s;0===i.length&&1===r.size&&(s=r);if(void 0===s){s=new ja;for(const e of r.elements)ao(e,s)}if(i.length>0&&!function(e){for(const t of e.elements)if(7===t.state.type)return!0;return!1}(s))for(const a of i)s.add(a);return s}(t.configs,n,i);if(0===a.size)return io(e,t,n,Va),Va;let o=ro(a);const l=function(e,t){let n;for(const r of e.elements)if(!0===t.is(r.alt))if(void 0===n)n=r.alt;else if(n!==r.alt)return;return n}(a,i);if(void 0!==l)o.isAcceptState=!0,o.prediction=l,o.configs.uniqueAlt=l;else if(function(e){if(function(e){for(const t of e.elements)if(7!==t.state.type)return!1;return!0}(e))return!0;const t=function(e){const t=new Map;for(const n of e){const e=Ha(n,!1);let r=t.get(e);void 0===r&&(r={},t.set(e,r)),r[n.alt]=!0}return t}(e.elements);return function(e){for(const t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}(t)&&!function(e){for(const t of Array.from(e.values()))if(1===Object.keys(t).length)return!0;return!1}(t)}(a)){const t=de(a.alts);o.isAcceptState=!0,o.prediction=t,o.configs.uniqueAlt=t,eo.apply(this,[e,r,a.alts,s])}return o=io(e,t,n,o),o}function eo(e,t,n,r){const i=[];for(let a=1;a<=t;a++)i.push(this.LA(a).tokenType);const s=e.atnStartState;r(function(e){const t=ae(e.prefixPath,(e=>Li(e))).join(", "),n=0===e.production.idx?"":e.production.idx;let r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${function(e){if(e instanceof Rr)return"SUBRULE";if(e instanceof kr)return"OPTION";if(e instanceof Nr)return"OR";if(e instanceof $r)return"AT_LEAST_ONE";if(e instanceof xr)return"AT_LEAST_ONE_SEP";if(e instanceof Ir)return"MANY_SEP";if(e instanceof Sr)return"MANY";if(e instanceof Cr)return"CONSUME";throw Error("non exhaustive match")}(e.production)}${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return r+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",r}({topLevelRule:s.rule,ambiguityIndices:n,production:s.production,prefixPath:i}))}function to(e,t,n){const r=Se(t.configs.elements,(e=>e.state.transitions));var i,s;return{actualToken:n,possibleTokenTypes:(i=r.filter((e=>e instanceof Ia)).map((e=>e.tokenType)),s=e=>e.tokenTypeIdx,i&&i.length?ee(i,Y(s)):[]),tokenPath:e}}function no(e,t){if(e instanceof Ia&&Hi(t,e.tokenType))return e.target}function ro(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function io(e,t,n,r){return r=so(e,r),t.edges[n.tokenTypeIdx]=r,r}function so(e,t){if(t===Va)return t;const n=t.configs.key,r=e.states[n];return void 0!==r?r:(t.configs.finalize(),e.states[n]=t,t)}function ao(e,t){const n=e.state;if(7===n.type){if(e.stack.length>0){const n=[...e.stack];ao({state:n.pop(),alt:e.alt,stack:n},t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);const r=n.transitions.length;for(let i=0;i<r;i++){const r=oo(e,n.transitions[i]);void 0!==r&&ao(r,t)}}function oo(e,t){if(t instanceof Na)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof Ca){const n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}class lo{constructor(){this.nodeStack=[]}get current(){var e;return null!==(e=this.nodeStack[this.nodeStack.length-1])&&void 0!==e?e:this.rootNode}buildRootNode(e){return this.rootNode=new fo(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new ho;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const n=new uo(e.startOffset,e.image.length,ot(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 i of e){const e=new uo(i.startOffset,i.image.length,ot(i),i.tokenType,!0);e.root=this.rootNode,t.push(e)}let n=this.current,r=!1;if(n.content.length>0)n.content.push(...t);else{for(;n.container;){const e=n.container.content.indexOf(n);if(e>0){n.container.content.splice(e,0,...t),r=!0;break}n=n.container}r||this.rootNode.content.unshift(...t)}}construct(e){const t=this.current;"string"==typeof e.$type&&(this.current.astNode=e),e.$cstNode=t;const n=this.nodeStack.pop();0===(null==n?void 0:n.content.length)&&this.removeNode(n)}}class co{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,t;const n="string"==typeof(null===(e=this._astNode)||void 0===e?void 0:e.$type)?this._astNode:null===(t=this.container)||void 0===t?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 uo extends co{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,r,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=r,this._length=t,this._range=n}}class ho extends co{constructor(){super(...arguments),this.content=new po(this)}get children(){return this.content}get offset(){var e,t;return null!==(t=null===(e=this.firstNonHiddenNode)||void 0===e?void 0:e.offset)&&void 0!==t?t:0}get length(){return this.end-this.offset}get end(){var e,t;return null!==(t=null===(e=this.lastNonHiddenNode)||void 0===e?void 0:e.end)&&void 0!==t?t:0}get range(){const e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(void 0===this._rangeCache){const{range:n}=e,{range:r}=t;this._rangeCache={start:n.start,end:r.end.line<n.start.line?n.start:r.end}}return this._rangeCache}return{start:K.create(0,0),end:K.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 po extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,po.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 fo extends ho{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=null!=e?e:""}}const mo=Symbol("Datatype");function go(e){return e.$type===mo}const yo=e=>e.endsWith("​")?e:e+"​";class To{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const t=this.lexer.definition,n="production"===e.LanguageMetaData.mode;this.wrapper=new $o(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 vo extends To{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new lo,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),r=this.wrapper.DEFINE_RULE(yo(e.name),this.startImplementation(n,t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}computeRuleType(e){if(!e.fragment){if(sr(e))return mo;{const t=or(e);return null!=t?t:e.name}}}parse(e,t={}){this.nodeBuilder.buildRootNode(e);const n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;const r=t.rule?this.allRules.get(t.rule):this.mainRule;if(!r)throw new Error(t.rule?`No rule found with name '${t.rule}'`:"No main rule available.");const i=r.call(this.wrapper,{});return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:i,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}startImplementation(e,t){return n=>{const r=!this.isRecording()&&void 0!==e;if(r){const t={$type:e};this.stack.push(t),e===mo&&(t.value="")}let i;try{i=t(n)}catch(s){i=void 0}return void 0===i&&r&&(i=this.construct()),i}}extractHiddenTokens(e){const t=this.lexerResult.hidden;if(!t.length)return[];const n=e.startOffset;for(let r=0;r<t.length;r++){if(t[r].startOffset>n)return t.splice(0,r)}return t.splice(0,t.length)}consume(e,t,n){const r=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(r)){const e=this.extractHiddenTokens(r);this.nodeBuilder.addHiddenNodes(e);const t=this.nodeBuilder.buildLeafNode(r,n),{assignment:i,isCrossRef:s}=this.getAssignment(n),a=this.current;if(i){const e=ln(n)?r.image:this.converter.convert(r.image,t);this.assign(i.operator,i.feature,e,t,s)}else if(go(a)){let e=r.image;ln(n)||(e=this.converter.convert(e,t).toString()),a.value+=e}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&"number"==typeof e.endOffset&&!isNaN(e.endOffset)}subrule(e,t,n,r,i){let s;this.isRecording()||n||(s=this.nodeBuilder.buildCompositeNode(r));const a=this.wrapper.wrapSubrule(e,t,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(a,r,s)}performSubruleAssignment(e,t,n){const{assignment:r,isCrossRef:i}=this.getAssignment(t);if(r)this.assign(r.operator,r.feature,e,n,i);else if(!r){const t=this.current;if(go(t))t.value+=e.toString();else if("object"==typeof e&&e){const n=this.assignWithoutOverride(e,t);this.stack.pop(),this.stack.push(n)}}}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 r={$type:e};this.stack.push(r),this.assign(t.operator,t.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return function(e){for(const[t,n]of Object.entries(e))t.startsWith("$")||(Array.isArray(n)?n.forEach(((n,r)=>{Ke(n)&&(n.$container=e,n.$containerProperty=t,n.$containerIndex=r)})):Ke(n)&&(n.$container=e,n.$containerProperty=t))}(e),this.nodeBuilder.construct(e),this.stack.pop(),go(e)?this.converter.convert(e.value,e.$cstNode):(function(e,t){const n=e.getTypeMetaData(t.$type),r=t;for(const i of n.properties)void 0!==i.defaultValue&&void 0===r[i.name]&&(r[i.name]=wn(i.defaultValue))}(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const t=An(e,Zt);this.assignmentMap.set(e,{assignment:t,isCrossRef:!!t&&nn(t.terminal)})}return this.assignmentMap.get(e)}assign(e,t,n,r,i){const s=this.current;let a;switch(a=i&&"string"==typeof n?this.linker.buildReference(s,t,r,n):n,e){case"=":s[t]=a;break;case"?=":s[t]=!0;break;case"+=":Array.isArray(s[t])||(s[t]=[]),s[t].push(a)}}assignWithoutOverride(e,t){for(const[r,i]of Object.entries(t)){const t=e[r];void 0===t?e[r]=i:Array.isArray(t)&&Array.isArray(i)&&(i.push(...t),e[r]=i)}const n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class Ro{buildMismatchTokenMessage(e){return Wi.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Wi.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Wi.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Wi.buildEarlyExitMessage(e)}}class Eo extends Ro{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 Ao extends To{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(yo(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,r,i){this.before(r),this.wrapper.wrapSubrule(e,t,i),this.after(r)}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 ko={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Eo};class $o extends $a{constructor(e,t){const n=t&&"maxLookahead"in t;super(e,Object.assign(Object.assign(Object.assign({},ko),{lookaheadStrategy:n?new Qs({maxLookahead:t.maxLookahead}):new qa({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 xo(e,t,n){return function(e,t){const n=Jn(t,!1),r=et(t.rules).filter(Dt).filter((e=>n.has(e)));for(const i of r){const t=Object.assign(Object.assign({},e),{consume:1,optional:1,subrule:1,many:1,or:1});e.parser.rule(i,So(t,i.definition))}}({parser:t,tokens:n,ruleNames:new Map},e),t}function So(e,t,n=!1){let r;if(ln(t))r=function(e,t){const n=e.consume++,r=e.tokens[t.value];if(!r)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(n,r,t)}(e,t);else if(qt(t))r=function(e,t){const n=lr(t);return()=>e.parser.action(n,t)}(e,t);else if(Zt(t))r=So(e,t.terminal);else if(nn(t))r=Co(e,t);else if(hn(t))r=function(e,t){const n=t.rule.ref;if(Dt(n)){const r=e.subrule++,i=n.fragment,s=t.arguments.length>0?function(e,t){const n=t.map((e=>Io(e.value)));return t=>{const r={};for(let i=0;i<n.length;i++){const s=e.parameters[i],a=n[i];r[s.name]=a(t)}return r}}(n,t.arguments):()=>({});return a=>e.parser.subrule(r,Lo(e,n),i,t,s(a))}if(Vt(n)){const r=e.consume++,i=Oo(e,n.name);return()=>e.parser.consume(r,i,t)}if(!n)throw new ht(t.$cstNode,`Undefined rule: ${t.rule.$refText}`);pt()}(e,t);else if(Qt(t))r=function(e,t){if(1===t.elements.length)return So(e,t.elements[0]);{const n=[];for(const i of t.elements){const t={ALT:So(e,i,!0)},r=No(i);r&&(t.GATE=Io(r)),n.push(t)}const r=e.or++;return t=>e.parser.alternatives(r,n.map((e=>{const n={ALT:()=>e.ALT(t)},r=e.GATE;return r&&(n.GATE=()=>r(t)),n})))}}(e,t);else if(yn(t))r=function(e,t){if(1===t.elements.length)return So(e,t.elements[0]);const n=[];for(const o of t.elements){const t={ALT:So(e,o,!0)},r=No(o);r&&(t.GATE=Io(r)),n.push(t)}const r=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join("-")}`,s=t=>e.parser.alternatives(r,n.map(((n,s)=>{const a={ALT:()=>!0},o=e.parser;a.ALT=()=>{if(n.ALT(t),!o.isRecording()){const e=i(r,o);o.unorderedGroups.get(e)||o.unorderedGroups.set(e,[]);const t=o.unorderedGroups.get(e);void 0===(null==t?void 0:t[s])&&(t[s]=!0)}};const l=n.GATE;return a.GATE=l?()=>l(t):()=>{const e=o.unorderedGroups.get(i(r,o));return!(null==e?void 0:e[s])},a}))),a=wo(e,No(t),s,"*");return t=>{a(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}(e,t);else if(an(t))r=function(e,t){const n=t.elements.map((t=>So(e,t)));return e=>n.forEach((t=>t(e)))}(e,t);else{if(i=t,!En.isInstance(i,rn))throw new ht(t.$cstNode,`Unexpected element type: ${t.$type}`);{const n=e.consume++;r=()=>e.parser.consume(n,Vi,t)}}var i;return wo(e,n?void 0:No(t),r,t.cardinality)}function Io(e){if(t=e,En.isInstance(t,$t)){const t=Io(e.left),n=Io(e.right);return e=>t(e)||n(e)}if(function(e){return En.isInstance(e,kt)}(e)){const t=Io(e.left),n=Io(e.right);return e=>t(e)&&n(e)}if(function(e){return En.isInstance(e,Ot)}(e)){const t=Io(e.value);return e=>!t(e)}if(function(e){return En.isInstance(e,Pt)}(e)){const t=e.parameter.ref.name;return e=>void 0!==e&&!0===e[t]}if(function(e){return En.isInstance(e,At)}(e)){const t=Boolean(e.true);return()=>t}var t;pt()}function No(e){if(an(e))return e.guardCondition}function Co(e,t,n=t.terminal){if(n){if(hn(n)&&Dt(n.rule.ref)){const r=n.rule.ref,i=e.subrule++;return n=>e.parser.subrule(i,Lo(e,r),!1,t,n)}if(hn(n)&&Vt(n.rule.ref)){const r=e.consume++,i=Oo(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}if(ln(n)){const r=e.consume++,i=Oo(e,n.value);return()=>e.parser.consume(r,i,t)}throw new Error("Could not build cross reference parser")}{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);const n=rr(t.type.ref),r=null==n?void 0:n.terminal;if(!r)throw new Error("Could not find name assignment for type: "+lr(t.type.ref));return Co(e,t,r)}}function wo(e,t,n,r){const i=t&&Io(t);if(!r){if(i){const t=e.or++;return r=>e.parser.alternatives(t,[{ALT:()=>n(r),GATE:()=>i(r)},{ALT:Aa(),GATE:()=>!i(r)}])}return n}if("*"===r){const t=e.many++;return r=>e.parser.many(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}if("+"===r){const t=e.many++;if(i){const r=e.or++;return s=>e.parser.alternatives(r,[{ALT:()=>e.parser.atLeastOne(t,{DEF:()=>n(s)}),GATE:()=>i(s)},{ALT:Aa(),GATE:()=>!i(s)}])}return r=>e.parser.atLeastOne(t,{DEF:()=>n(r)})}if("?"===r){const t=e.optional++;return r=>e.parser.optional(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}pt()}function Lo(e,t){const n=function(e,t){if(Dt(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!Dt(r);){if(an(r)||Qt(r)||yn(r)){i=r.elements.indexOf(n).toString()+":"+i}n=r,r=r.$container}return i=r.name+":"+i,e.ruleNames.set(t,i),i}}(e,t),r=e.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Oo(e,t){const n=e.tokens[t];if(!n)throw new Error(`Token "${t}" not found."`);return n}function _o(e){const t=function(e){const t=e.Grammar,n=e.parser.Lexer,r=new vo(e);return xo(t,r,n.definition)}(e);return t.finalize(),t}class bo{constructor(){this.diagnostics=[]}buildTokens(e,t){const n=et(Jn(e,!1)),r=this.buildTerminalTokens(n),i=this.buildKeywordTokens(n,r,t);return r.forEach((e=>{const t=e.PATTERN;"object"==typeof t&&t&&"test"in t&&qn(t)?i.unshift(e):i.push(e)})),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Vt).filter((e=>!e.fragment)).map((e=>this.buildTerminalToken(e))).toArray()}buildTerminalToken(e){const t=cr(e),n=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,r={name:e.name,PATTERN:n};return"function"==typeof n&&(r.LINE_BREAKS=!0),e.hidden&&(r.GROUP=qn(t)?wi.SKIPPED:"hidden"),r}requiresCustomPattern(e){return!(!e.flags.includes("u")&&!e.flags.includes("s"))||!(!e.source.includes("?<=")&&!e.source.includes("?<!"))}regexPatternFunction(e){const t=new RegExp(e,e.flags+"y");return(e,n)=>{t.lastIndex=n;return t.exec(e)}}buildKeywordTokens(e,t,n){return e.filter(Dt).flatMap((e=>Sn(e).filter(ln))).distinct((e=>e.value)).toArray().sort(((e,t)=>t.value.length-e.value.length)).map((e=>this.buildKeywordToken(e,t,Boolean(null==n?void 0:n.caseInsensitive))))}buildKeywordToken(e,t,n){const r=this.buildKeywordPattern(e,n),i={name:e.value,PATTERN:r,LONGER_ALT:this.findLongerAlt(e,t)};return"function"==typeof r&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(function(e){return Array.prototype.map.call(e,(e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:Xn(e))).join("")}(e.value)):e.value}findLongerAlt(e,t){return t.reduce(((t,n)=>{const r=null==n?void 0:n.PATTERN;return(null==r?void 0:r.source)&&Qn("^"+r.source+"$",e.value)&&t.push(n),t}),[])}}class Po{convert(e,t){let n=t.grammarSource;if(nn(n)&&(n=function(e){if(e.terminal)return e.terminal;if(e.type.ref){const t=rr(e.type.ref);return null==t?void 0:t.terminal}}(n)),hn(n)){const r=n.rule.ref;if(!r)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(r,e,t)}return e}runConverter(e,t,n){var r;switch(e.name.toUpperCase()){case"INT":return Mo.convertInt(t);case"STRING":return Mo.convertString(t);case"ID":return Mo.convertID(t)}switch(null===(r=function(e){var t,n,r;return Vt(e)?null!==(n=null===(t=e.type)||void 0===t?void 0:t.name)&&void 0!==n?n:"string":null!==(r=or(e))&&void 0!==r?r:e.name}(e))||void 0===r?void 0:r.toLowerCase()){case"number":return Mo.convertNumber(t);case"boolean":return Mo.convertBoolean(t);case"bigint":return Mo.convertBigint(t);case"date":return Mo.convertDate(t);default:return t}}}var Mo;!function(e){function t(e){switch(e){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";case"0":return"\0";default:return e}}e.convertString=function(e){let n="";for(let r=1;r<e.length-1;r++){const i=e.charAt(r);if("\\"===i){n+=t(e.charAt(++r))}else n+=i}return n},e.convertID=function(e){return"^"===e.charAt(0)?e.substring(1):e},e.convertInt=function(e){return parseInt(e)},e.convertBigint=function(e){return BigInt(e)},e.convertDate=function(e){return new Date(e)},e.convertNumber=function(e){return Number(e)},e.convertBoolean=function(e){return"true"===e.toLowerCase()}}(Mo||(Mo={}));var Do=V();let Uo=0;const Go=Symbol("OperationCancelled");function Fo(e){return e===Go}async function Bo(e){if(e===Do.CancellationToken.None)return;const t=performance.now();if(t-Uo>=10&&(Uo=t,await new Promise((e=>{"undefined"==typeof setImmediate?setTimeout(e,0):setImmediate(e)})),Uo=performance.now()),e.isCancellationRequested)throw Go}class Ko{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)}))}}class Vo{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,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(Vo.isIncremental(n)){const e=Xo(n.range),t=this.offsetAt(e.start),r=this.offsetAt(e.end);this._content=this._content.substring(0,t)+n.text+this._content.substring(r,this._content.length);const i=Math.max(e.start.line,0),s=Math.max(e.end.line,0);let a=this._lineOffsets;const o=Yo(n.text,!1,t);if(s-i===o.length)for(let n=0,c=o.length;n<c;n++)a[n+i+1]=o[n];else o.length<1e4?a.splice(i+1,s-i,...o):this._lineOffsets=a=a.slice(0,i+1).concat(o,a.slice(s+1));const l=n.text.length-(r-t);if(0!==l)for(let n=i+1+o.length,c=a.length;n<c;n++)a[n]=a[n]+l}else{if(!Vo.isFull(n))throw new Error("Unknown change event received");this._content=n.text,this._lineOffsets=void 0}this._version=t}getLineOffsets(){return void 0===this._lineOffsets&&(this._lineOffsets=Yo(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const t=this.getLineOffsets();let n=0,r=t.length;if(0===r)return{line:0,character:e};for(;n<r;){const i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}const i=n-1;return{line:i,character:(e=this.ensureBeforeEOL(e,t[i]))-t[i]}}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 r=e.line+1<t.length?t[e.line+1]:this._content.length,i=Math.min(n+e.character,r);return this.ensureBeforeEOL(i,n)}ensureBeforeEOL(e,t){for(;e>t&&qo(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const t=e;return null!=t&&"string"==typeof t.text&&void 0!==t.range&&(void 0===t.rangeLength||"number"==typeof t.rangeLength)}static isFull(e){const t=e;return null!=t&&"string"==typeof t.text&&void 0===t.range&&void 0===t.rangeLength}}var jo,Ho,Wo;function zo(e,t){if(e.length<=1)return e;const n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);zo(r,t),zo(i,t);let s=0,a=0,o=0;for(;s<r.length&&a<i.length;){const n=t(r[s],i[a]);e[o++]=n<=0?r[s++]:i[a++]}for(;s<r.length;)e[o++]=r[s++];for(;a<i.length;)e[o++]=i[a++];return e}function Yo(e,t,n=0){const r=t?[n]:[];for(let i=0;i<e.length;i++){const t=e.charCodeAt(i);qo(t)&&(13===t&&i+1<e.length&&10===e.charCodeAt(i+1)&&i++,r.push(n+i+1))}return r}function qo(e){return 13===e||10===e}function Xo(e){const t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function Qo(e){const t=Xo(e.range);return t!==e.range?{newText:e.newText,range:t}:e}(Ho=jo||(jo={})).create=function(e,t,n,r){return new Vo(e,t,n,r)},Ho.update=function(e,t,n){if(e instanceof Vo)return e.update(t,n),e;throw new Error("TextDocument.update: document must be created by TextDocument.create")},Ho.applyEdits=function(e,t){const n=e.getText(),r=zo(t.map(Qo),((e,t)=>{const n=e.range.start.line-t.range.start.line;return 0===n?e.range.start.character-t.range.start.character:n}));let i=0;const s=[];for(const a of r){const t=e.offsetAt(a.range.start);if(t<i)throw new Error("Overlapping edit");t>i&&s.push(n.substring(i,t)),a.newText.length&&s.push(a.newText),i=e.offsetAt(a.range.end)}return s.push(n.substr(i)),s.join("")},(()=>{var e={470:e=>{function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,r="",i=0,s=-1,a=0,o=0;o<=e.length;++o){if(o<e.length)n=e.charCodeAt(o);else{if(47===n)break;n=47}if(47===n){if(s===o-1||1===a);else if(s!==o-1&&2===a){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var l=r.lastIndexOf("/");if(l!==r.length-1){-1===l?(r="",i=0):i=(r=r.slice(0,l)).length-1-r.lastIndexOf("/"),s=o,a=0;continue}}else if(2===r.length||1===r.length){r="",i=0,s=o,a=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(s+1,o):r=e.slice(s+1,o),i=o-s-1;s=o,a=0}else 46===n&&-1!==a?++a:a=-1}return r}var r={resolve:function(){for(var e,r="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(r=a+"/"+r,i=47===a.charCodeAt(0))}return r=n(r,!i),i?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(t(e),0===e.length)return".";var r=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!r)).length||r||(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var i=arguments[n];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=r.resolve(e))===(n=r.resolve(n)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var s=e.length,a=s-i,o=1;o<n.length&&47===n.charCodeAt(o);++o);for(var l=n.length-o,c=a<l?a:l,u=-1,d=0;d<=c;++d){if(d===c){if(l>c){if(47===n.charCodeAt(o+d))return n.slice(o+d+1);if(0===d)return n.slice(o+d)}else a>c&&(47===e.charCodeAt(i+d)?u=d:0===d&&(u=0));break}var h=e.charCodeAt(i+d);if(h!==n.charCodeAt(o+d))break;47===h&&(u=d)}var p="";for(d=i+u+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+n.slice(o+u):(o+=u,47===n.charCodeAt(o)&&++o,n.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),r=47===n,i=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(n=e.charCodeAt(a))){if(!s){i=a;break}}else s=!1;return-1===i?r?"/":".":r&&1===i?"//":e.slice(0,i)},basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError('"ext" argument must be a string');t(e);var r,i=0,s=-1,a=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var o=n.length-1,l=-1;for(r=e.length-1;r>=0;--r){var c=e.charCodeAt(r);if(47===c){if(!a){i=r+1;break}}else-1===l&&(a=!1,l=r+1),o>=0&&(c===n.charCodeAt(o)?-1==--o&&(s=r):(o=-1,s=l))}return i===s?s=l:-1===s&&(s=e.length),e.slice(i,s)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!a){i=r+1;break}}else-1===s&&(a=!1,s=r+1);return-1===s?"":e.slice(i,s)},extname:function(e){t(e);for(var n=-1,r=0,i=-1,s=!0,a=0,o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(47!==l)-1===i&&(s=!1,i=o+1),46===l?-1===n?n=o:1!==a&&(a=1):-1!==n&&(a=-1);else if(!s){r=o+1;break}}return-1===n||-1===i||0===a||1===a&&n===i-1&&n===r+1?"":e.slice(n,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return n=(t=e).dir||t.root,r=t.base||(t.name||"")+(t.ext||""),n?n===t.root?n+r:n+"/"+r:r;var t,n,r},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var r,i=e.charCodeAt(0),s=47===i;s?(n.root="/",r=1):r=0;for(var a=-1,o=0,l=-1,c=!0,u=e.length-1,d=0;u>=r;--u)if(47!==(i=e.charCodeAt(u)))-1===l&&(c=!1,l=u+1),46===i?-1===a?a=u:1!==d&&(d=1):-1!==a&&(d=-1);else if(!c){o=u+1;break}return-1===a||-1===l||0===d||1===d&&a===l-1&&a===o+1?-1!==l&&(n.base=n.name=0===o&&s?e.slice(1,l):e.slice(o,l)):(0===o&&s?(n.name=e.slice(1,a),n.base=e.slice(1,l)):(n.name=e.slice(o,a),n.base=e.slice(o,l)),n.ext=e.slice(a,l)),o>0?n.dir=e.slice(0,o-1):s&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{let e;if(n.r(r),n.d(r,{URI:()=>u,Utils:()=>x}),"object"==typeof process)e="win32"===process.platform;else if("object"==typeof navigator){let t=navigator.userAgent;e=t.indexOf("Windows")>=0}const t=/^\w[\w\d+.-]*$/,i=/^\//,s=/^\/\//;function a(e,n){if(!e.scheme&&n)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!t.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!i.test(e.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(s.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const o="",l="/",c=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class u{constructor(e,t,n,r,i,s=!1){f(this,"scheme"),f(this,"authority"),f(this,"path"),f(this,"query"),f(this,"fragment"),"object"==typeof e?(this.scheme=e.scheme||o,this.authority=e.authority||o,this.path=e.path||o,this.query=e.query||o,this.fragment=e.fragment||o):(this.scheme=function(e,t){return e||t?e:"file"}(e,s),this.authority=t||o,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==l&&(t=l+t):t=l}return t}(this.scheme,n||o),this.query=r||o,this.fragment=i||o,a(this,s))}static isUri(e){return e instanceof u||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"string"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString}get fsPath(){return y(this)}with(e){if(!e)return this;let{scheme:t,authority:n,path:r,query:i,fragment:s}=e;return void 0===t?t=this.scheme:null===t&&(t=o),void 0===n?n=this.authority:null===n&&(n=o),void 0===r?r=this.path:null===r&&(r=o),void 0===i?i=this.query:null===i&&(i=o),void 0===s?s=this.fragment:null===s&&(s=o),t===this.scheme&&n===this.authority&&r===this.path&&i===this.query&&s===this.fragment?this:new h(t,n,r,i,s)}static parse(e,t=!1){const n=c.exec(e);return n?new h(n[2]||o,E(n[4]||o),E(n[5]||o),E(n[7]||o),E(n[9]||o),t):new h(o,o,o,o,o)}static file(t){let n=o;if(e&&(t=t.replace(/\\/g,l)),t[0]===l&&t[1]===l){const e=t.indexOf(l,2);-1===e?(n=t.substring(2),t=l):(n=t.substring(2,e),t=t.substring(e)||l)}return new h("file",n,t,o,o)}static from(e){const t=new h(e.scheme,e.authority,e.path,e.query,e.fragment);return a(t,!0),t}toString(e=!1){return T(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof u)return e;{const t=new h(e);return t._formatted=e.external,t._fsPath=e._sep===d?e.fsPath:null,t}}return e}}const d=e?1:void 0;class h extends u{constructor(){super(...arguments),f(this,"_formatted",null),f(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=y(this)),this._fsPath}toString(e=!1){return e?T(this,!0):(this._formatted||(this._formatted=T(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=d),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}const p={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 m(e,t,n){let r,i=-1;for(let s=0;s<e.length;s++){const a=e.charCodeAt(s);if(a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57||45===a||46===a||95===a||126===a||t&&47===a||n&&91===a||n&&93===a||n&&58===a)-1!==i&&(r+=encodeURIComponent(e.substring(i,s)),i=-1),void 0!==r&&(r+=e.charAt(s));else{void 0===r&&(r=e.substr(0,s));const t=p[a];void 0!==t?(-1!==i&&(r+=encodeURIComponent(e.substring(i,s)),i=-1),r+=t):-1===i&&(i=s)}}return-1!==i&&(r+=encodeURIComponent(e.substring(i))),void 0!==r?r:e}function g(e){let t;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);35===r||63===r?(void 0===t&&(t=e.substr(0,n)),t+=p[r]):void 0!==t&&(t+=e[n])}return void 0!==t?t:e}function y(t,n){let r;return r=t.authority&&t.path.length>1&&"file"===t.scheme?`//${t.authority}${t.path}`:47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?t.path[1].toLowerCase()+t.path.substr(2):t.path,e&&(r=r.replace(/\//g,"\\")),r}function T(e,t){const n=t?g:m;let r="",{scheme:i,authority:s,path:a,query:o,fragment:c}=e;if(i&&(r+=i,r+=":"),(s||"file"===i)&&(r+=l,r+=l),s){let e=s.indexOf("@");if(-1!==e){const t=s.substr(0,e);s=s.substr(e+1),e=t.lastIndexOf(":"),-1===e?r+=n(t,!1,!1):(r+=n(t.substr(0,e),!1,!1),r+=":",r+=n(t.substr(e+1),!1,!0)),r+="@"}s=s.toLowerCase(),e=s.lastIndexOf(":"),-1===e?r+=n(s,!1,!0):(r+=n(s.substr(0,e),!1,!0),r+=s.substr(e))}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2)){const e=a.charCodeAt(1);e>=65&&e<=90&&(a=`/${String.fromCharCode(e+32)}:${a.substr(3)}`)}else if(a.length>=2&&58===a.charCodeAt(1)){const e=a.charCodeAt(0);e>=65&&e<=90&&(a=`${String.fromCharCode(e+32)}:${a.substr(2)}`)}r+=n(a,!0,!1)}return o&&(r+="?",r+=n(o,!1,!1)),c&&(r+="#",r+=t?c:m(c,!1,!1)),r}function v(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+v(e.substr(3)):e}}const R=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function E(e){return e.match(R)?e.replace(R,(e=>v(e))):e}var A=n(470);const k=A.posix||A,$="/";var x,S;(S=x||(x={})).joinPath=function(e,...t){return e.with({path:k.join(e.path,...t)})},S.resolvePath=function(e,...t){let n=e.path,r=!1;n[0]!==$&&(n=$+n,r=!0);let i=k.resolve(n,...t);return r&&i[0]===$&&!e.authority&&(i=i.substring(1)),e.with({path:i})},S.dirname=function(e){if(0===e.path.length||e.path===$)return e;let t=k.dirname(e.path);return 1===t.length&&46===t.charCodeAt(0)&&(t=""),e.with({path:t})},S.basename=function(e){return k.basename(e.path)},S.extname=function(e){return k.extname(e.path)}})(),Wo=r})();const{URI:Jo,Utils:Zo}=Wo;var el,tl,nl,rl;(tl=el||(el={})).basename=Zo.basename,tl.dirname=Zo.dirname,tl.extname=Zo.extname,tl.joinPath=Zo.joinPath,tl.resolvePath=Zo.resolvePath,tl.equals=function(e,t){return(null==e?void 0:e.toString())===(null==t?void 0:t.toString())},tl.relative=function(e,t){const n="string"==typeof e?e:e.path,r="string"==typeof t?t:t.path,i=n.split("/").filter((e=>e.length>0)),s=r.split("/").filter((e=>e.length>0));let a=0;for(;a<i.length&&i[a]===s[a];a++);return"../".repeat(i.length-a)+s.slice(a).join("/")},tl.normalize=function(e){return Jo.parse(e.toString()).toString()},(rl=nl||(nl={}))[rl.Changed=0]="Changed",rl[rl.Parsed=1]="Parsed",rl[rl.IndexedContent=2]="IndexedContent",rl[rl.ComputedScopes=3]="ComputedScopes",rl[rl.Linked=4]="Linked",rl[rl.IndexedReferences=5]="IndexedReferences",rl[rl.Validated=6]="Validated";class il{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Do.CancellationToken.None){const n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,t)}fromTextDocument(e,t,n){return t=null!=t?t:Jo.parse(e.uri),Do.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromString(e,t,n){return Do.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("string"==typeof t){const r=this.parse(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}if("$model"in t){const n={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}{const r=this.parse(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}async createAsync(e,t,n){if("string"==typeof t){const r=await this.parseAsync(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}{const r=await this.parseAsync(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}createLangiumDocument(e,t,n,r){let i;if(n)i={parseResult:e,uri:t,state:nl.Parsed,references:[],textDocument:n};else{const n=this.createTextDocumentGetter(t,r);i={parseResult:e,uri:t,state:nl.Parsed,references:[],get textDocument(){return n()}}}return e.value.$document=i,i}async update(e,t){var n,r;const i=null===(n=e.parseResult.value.$cstNode)||void 0===n?void 0:n.root.fullText,s=null===(r=this.textDocuments)||void 0===r?void 0:r.get(e.uri.toString()),a=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{const t=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:t})}return i!==a&&(e.parseResult=await this.parseAsync(e.uri,a,t),e.parseResult.value.$document=e),e.state=nl.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 r;return()=>null!=r?r:r=jo.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,null!=t?t:"")}}class sl{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return et(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((e=>(this.addDocument(e),e)));{const n=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(n),n}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const t=e.toString(),n=this.documentMap.get(t);if(n){this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=nl.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0}return n}deleteDocument(e){const t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=nl.Changed,this.documentMap.delete(t)),n}}const al=Symbol("ref_resolving");class ol{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=Do.CancellationToken.None){for(const n of In(e.parseResult.value))await Bo(t),Cn(n).forEach((t=>this.doLink(t,e)))}doLink(e,t){var n;const r=e.reference;if(void 0===r._ref){r._ref=al;try{const t=this.getCandidate(e);if(je(t))r._ref=t;else if(r._nodeDescription=t,this.langiumDocuments().hasDocument(t.documentUri)){const n=this.loadAstNode(t);r._ref=null!=n?n:this.createLinkingError(e,t)}else r._ref=void 0}catch(i){console.error(`An error occurred while resolving reference to '${r.$refText}':`,i);const t=null!==(n=i.message)&&void 0!==n?n:String(i);r._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${r.$refText}': ${t}`})}t.references.push(r)}}unlink(e){for(const t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){const t=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return null!=t?t:this.createLinkingError(e)}buildReference(e,t,n,r){const i=this,s={$refNode:n,$refText:r,get ref(){var n,a;if(Ke(this._ref))return this._ref;if("object"==typeof(a=this._nodeDescription)&&null!==a&&"string"==typeof a.name&&"string"==typeof a.type&&"string"==typeof a.path){const n=i.loadAstNode(this._nodeDescription);this._ref=null!=n?n:i.createLinkingError({reference:s,container:e,property:t},this._nodeDescription)}else if(void 0===this._ref){this._ref=al;const r=$n(e).$document,a=i.getLinkedNode({reference:s,container:e,property:t});if(a.error&&r&&r.state<nl.ComputedScopes)return this._ref=void 0;this._ref=null!==(n=a.node)&&void 0!==n?n:a.error,this._nodeDescription=a.descr,null==r||r.references.push(this)}else if(this._ref===al)throw new Error(`Cyclic reference resolution detected: ${i.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`);return Ke(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return je(this._ref)?this._ref:void 0}};return s}getLinkedNode(e){var t;try{const t=this.getCandidate(e);if(je(t))return{error:t};const n=this.loadAstNode(t);return n?{node:n,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(n){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,n);const r=null!==(t=n.message)&&void 0!==t?t:String(n);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${r}`})}}}loadAstNode(e){if(e.node)return e.node;const t=this.langiumDocuments().getDocument(e.documentUri);return t?this.astNodeLocator.getAstNode(t.parseResult.value,e.path):void 0}createLinkingError(e,t){const n=$n(e.container).$document;n&&n.state<nl.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);const r=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${r} named '${e.reference.$refText}'.`,targetDescription:t})}}class ll{getName(e){if(function(e){return"string"==typeof e.name}(e))return e.name}getNameNode(e){return er(e.$cstNode,"name")}}class cl{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const t=function(e){var t;const n=e.astNode;for(;n===(null===(t=e.container)||void 0===t?void 0:t.astNode);){const t=An(e.grammarSource,Zt);if(t)return t;e=e.container}}(e),n=e.astNode;if(t&&n){const r=n[t.feature];if(Ve(r))return r.ref;if(Array.isArray(r))for(const t of r)if(Ve(t)&&t.$refNode&&t.$refNode.offset<=e.offset&&t.$refNode.end>=e.end)return t.ref}if(n){const t=this.nameProvider.getNameNode(n);if(t&&(t===e||function(e,t){for(;e.container;)if((e=e.container)===t)return!0;return!1}(e,t)))return n}}}findDeclarationNode(e){const t=this.findDeclaration(e);if(null==t?void 0:t.$cstNode){const e=this.nameProvider.getNameNode(t);return null!=e?e:t.$cstNode}}findReferences(e,t){const n=[];if(t.includeDeclaration){const t=this.getReferenceToSelf(e);t&&n.push(t)}let r=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(r=r.filter((e=>el.equals(e.sourceUri,t.documentUri)))),n.push(...r),et(n)}getReferenceToSelf(e){const t=this.nameProvider.getNameNode(e);if(t){const n=kn(e),r=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:r,targetUri:n.uri,targetPath:r,segment:lt(t),local:!0}}}}class ul{constructor(e){if(this.map=new Map,e)for(const[t,n]of e)this.add(t,n)}get size(){return nt.sum(et(this.map.values()).map((e=>e.length)))}clear(){this.map.clear()}delete(e,t){if(void 0===t)return this.map.delete(e);{const n=this.map.get(e);if(n){const r=n.indexOf(t);if(r>=0)return 1===n.length?this.map.delete(e):n.splice(r,1),!0}return!1}}get(e){var t;return null!==(t=this.map.get(e))&&void 0!==t?t:[]}has(e,t){if(void 0===t)return this.map.has(e);{const n=this.map.get(e);return!!n&&n.indexOf(t)>=0}}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((t=>e(t,n,this)))))}[Symbol.iterator](){return this.entries().iterator()}entries(){return et(this.map.entries()).flatMap((([e,t])=>t.map((t=>[e,t]))))}keys(){return et(this.map.keys())}values(){return et(this.map.values()).flat()}entriesGroupedByKey(){return et(this.map.entries())}}class dl{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 void 0!==t&&(this.map.delete(e),this.inverse.delete(t),!0)}}class hl{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=Do.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=xn,r=Do.CancellationToken.None){const i=[];this.exportNode(e,i,t);for(const s of n(e))await Bo(r),this.exportNode(s,i,t);return i}exportNode(e,t,n){const r=this.nameProvider.getName(e);r&&t.push(this.descriptions.createDescription(e,r,n))}async computeLocalScopes(e,t=Do.CancellationToken.None){const n=e.parseResult.value,r=new ul;for(const i of Sn(n))await Bo(t),this.processNode(i,e,r);return r}processNode(e,t,n){const r=e.$container;if(r){const i=this.nameProvider.getName(e);i&&n.add(r,this.descriptions.createDescription(e,i,t))}}}class pl{constructor(e,t,n){var r;this.elements=e,this.outerScope=t,this.caseInsensitive=null!==(r=null==n?void 0:n.caseInsensitive)&&void 0!==r&&r}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const t=this.caseInsensitive?this.elements.find((t=>t.name.toLowerCase()===e.toLowerCase())):this.elements.find((t=>t.name===e));return t||(this.outerScope?this.outerScope.getElement(e):void 0)}}class fl{constructor(e,t,n){var r;this.elements=new Map,this.caseInsensitive=null!==(r=null==n?void 0:n.caseInsensitive)&&void 0!==r&&r;for(const i of e){const e=this.caseInsensitive?i.name.toLowerCase():i.name;this.elements.set(e,i)}this.outerScope=t}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(t);return n||(this.outerScope?this.outerScope.getElement(e):void 0)}getAllElements(){let e=et(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class ml{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 gl extends ml{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}}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class yl extends ml{constructor(e){super(),this.cache=new Map,this.converter=null!=e?e:e=>e}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 r=this.cacheForContext(e);if(r.has(t))return r.get(t);if(n){const e=n();return r.set(t,e),e}}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 Tl extends gl{constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,(()=>{this.clear()}))),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(((e,t)=>{t.length>0&&this.clear()})))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((()=>{this.clear()})))}}class vl{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 Tl(e.shared)}getScope(e){const t=[],n=this.reflection.getReferenceType(e),r=kn(e.container).precomputedScopes;if(r){let i=e.container;do{const e=r.get(i);e.length>0&&t.push(et(e).filter((e=>this.reflection.isSubtype(e.type,n)))),i=i.$container}while(i)}let i=this.getGlobalScope(n,e);for(let s=t.length-1;s>=0;s--)i=this.createScope(t[s],i);return i}createScope(e,t,n){return new pl(et(e),t,n)}createScopeForNodes(e,t,n){const r=et(e).map((e=>{const t=this.nameProvider.getName(e);if(t)return this.descriptions.createDescription(e,t)})).nonNullable();return new pl(r,t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,(()=>new fl(this.indexManager.allElements(e))))}}function Rl(e){return"object"==typeof e&&!!e&&("$ref"in e||"$error"in e)}class El{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=null!=t?t:{},r=null==t?void 0:t.replacer,i=(e,t)=>this.replacer(e,t,n),s=r?(e,t)=>r(e,t,i):i;try{return this.currentDocument=kn(e),JSON.stringify(e,s,null==t?void 0:t.space)}finally{this.currentDocument=void 0}}deserialize(e,t){const n=null!=t?t:{},r=JSON.parse(e);return this.linkNode(r,r,n),r}replacer(e,t,{refText:n,sourceText:r,textRegions:i,comments:s,uriConverter:a}){var o,l,c,u;if(!this.ignoreProperties.has(e)){if(Ve(t)){const e=t.ref,r=n?t.$refText:void 0;if(e){const n=kn(e);let i="";this.currentDocument&&this.currentDocument!==n&&(i=a?a(n.uri,t):n.uri.toString());return{$ref:`${i}#${this.astNodeLocator.getAstNodePath(e)}`,$refText:r}}return{$error:null!==(l=null===(o=t.error)||void 0===o?void 0:o.message)&&void 0!==l?l:"Could not resolve reference",$refText:r}}if(Ke(t)){let n;if(i&&(n=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},t)),e&&!t.$document||!(null==n?void 0:n.$textRegion)||(n.$textRegion.documentURI=null===(c=this.currentDocument)||void 0===c?void 0:c.uri.toString())),r&&!e&&(null!=n||(n=Object.assign({},t)),n.$sourceText=null===(u=t.$cstNode)||void 0===u?void 0:u.text),s){null!=n||(n=Object.assign({},t));const e=this.commentProvider.getComment(t);e&&(n.$comment=e.replace(/\r/g,""))}return null!=n?n:t}return t}}addAstNodeRegionWithAssignmentsTo(e){const t=e=>({offset:e.offset,end:e.end,length:e.length,range:e.range});if(e.$cstNode){const n=(e.$textRegion=t(e.$cstNode)).assignments={};return Object.keys(e).filter((e=>!e.startsWith("$"))).forEach((r=>{const i=function(e,t){return e&&t?tr(e,t,e.astNode,!0):[]}(e.$cstNode,r).map(t);0!==i.length&&(n[r]=i)})),e}}linkNode(e,t,n,r,i,s){for(const[o,l]of Object.entries(e))if(Array.isArray(l))for(let r=0;r<l.length;r++){const i=l[r];Rl(i)?l[r]=this.reviveReference(e,o,t,i,n):Ke(i)&&this.linkNode(i,t,n,e,o,r)}else Rl(l)?e[o]=this.reviveReference(e,o,t,l,n):Ke(l)&&this.linkNode(l,t,n,e,o);const a=e;a.$container=r,a.$containerProperty=i,a.$containerIndex=s}reviveReference(e,t,n,r,i){let s=r.$refText,a=r.$error;if(r.$ref){const e=this.getRefNode(n,r.$ref,i.uriConverter);if(Ke(e))return s||(s=this.nameProvider.getName(e)),{$refText:null!=s?s:"",ref:e};a=e}if(a){const n={$refText:null!=s?s:""};return n.error={container:e,property:t,message:a,reference:n},n}}getRefNode(e,t,n){try{const r=t.indexOf("#");if(0===r){const n=this.astNodeLocator.getAstNode(e,t.substring(1));return n||"Could not resolve path: "+t}if(r<0){const e=n?n(t):Jo.parse(t),r=this.langiumDocuments.getDocument(e);return r?r.parseResult.value:"Could not find document for URI: "+t}const i=n?n(t.substring(0,r)):Jo.parse(t.substring(0,r)),s=this.langiumDocuments.getDocument(i);if(!s)return"Could not find document for URI: "+t;if(r===t.length-1)return s.parseResult.value;const a=this.astNodeLocator.getAstNode(s.parseResult.value,t.substring(r+1));return a||"Could not resolve URI: "+t}catch(r){return String(r)}}}class Al{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.textDocuments=null==e?void 0: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),1===this.languageIdMap.size?this.singleton=e:this.singleton=void 0}getServices(e){var t,n;if(void 0!==this.singleton)return this.singleton;if(0===this.languageIdMap.size)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const r=null===(n=null===(t=this.textDocuments)||void 0===t?void 0:t.get(e))||void 0===n?void 0:n.languageId;if(void 0!==r){const e=this.languageIdMap.get(r);if(e)return e}const i=el.extname(e),s=this.fileExtensionMap.get(i);if(!s)throw r?new Error(`The service registry contains no services for the extension '${i}' for language '${r}'.`):new Error(`The service registry contains no services for the extension '${i}'.`);return s}hasServices(e){try{return this.getServices(e),!0}catch(t){return!1}}get all(){return Array.from(this.languageIdMap.values())}}function kl(e){return{code:e}}var $l,xl,Sl;($l||($l={})).all=["fast","slow","built-in"];class Il{constructor(e){this.entries=new ul,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,t=this,n="fast"){if("built-in"===n)throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[r,i]of Object.entries(e)){const e=i;if(Array.isArray(e))for(const i of e){const e={check:this.wrapValidationException(i,t),category:n};this.addEntry(r,e)}else if("function"==typeof e){const i={check:this.wrapValidationException(e,t),category:n};this.addEntry(r,i)}else pt()}}wrapValidationException(e,t){return async(n,r,i)=>{await this.handleException((()=>e.call(t,n,r,i)),"An error occurred during validation",r,n)}}async handleException(e,t,n,r){try{await e()}catch(i){if(Fo(i))throw i;console.error(`${t}:`,i),i instanceof Error&&i.stack&&console.error(i.stack);n("error",`${t}: ${i instanceof Error?i.message:String(i)}`,{node:r})}}addEntry(e,t){if("AstNode"!==e)for(const n of this.reflection.getAllSubTypes(e))this.entries.add(n,t);else this.entries.add("AstNode",t)}getChecks(e,t){let n=et(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(n=n.filter((e=>t.includes(e.category)))),n.map((e=>e.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(r,i,s,a)=>{await this.handleException((()=>e.call(n,r,i,s,a)),t,i,r)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}}class Nl{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=Do.CancellationToken.None){const r=e.parseResult,i=[];if(await Bo(n),!t.categories||t.categories.includes("built-in")){if(this.processLexingErrors(r,i,t),t.stopAfterLexingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===xl.LexingError})))return i;if(this.processParsingErrors(r,i,t),t.stopAfterParsingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===xl.ParsingError})))return i;if(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.code)===xl.LinkingError})))return i}try{i.push(...await this.validateAst(r.value,t,n))}catch(s){if(Fo(s))throw s;console.error("An error occurred during validation:",s)}return await Bo(n),i}processLexingErrors(e,t,n){var r,i,s;const a=[...e.lexerErrors,...null!==(i=null===(r=e.lexerReport)||void 0===r?void 0:r.diagnostics)&&void 0!==i?i:[]];for(const o of a){const e=null!==(s=o.severity)&&void 0!==s?s:"error",n={severity:wl(e),range:{start:{line:o.line-1,character:o.column-1},end:{line:o.line-1,character:o.column+o.length-1}},message:o.message,data:Ll(e),source:this.getSource()};t.push(n)}}processParsingErrors(e,t,n){for(const r of e.parserErrors){let e;if(isNaN(r.token.startOffset)){if("previousToken"in r){const t=r.previousToken;if(isNaN(t.startOffset)){const t={line:0,character:0};e={start:t,end:t}}else{const n={line:t.endLine-1,character:t.endColumn};e={start:n,end:n}}}}else e=ot(r.token);if(e){const n={severity:wl("error"),range:e,message:r.message,data:kl(xl.ParsingError),source:this.getSource()};t.push(n)}}}processLinkingErrors(e,t,n){for(const r of e.references){const e=r.error;if(e){const n={node:e.container,property:e.property,index:e.index,data:{code:xl.LinkingError,containerType:e.container.$type,property:e.property,refText:e.reference.$refText}};t.push(this.toDiagnostic("error",e.message,n))}}}async validateAst(e,t,n=Do.CancellationToken.None){const r=[],i=(e,t,n)=>{r.push(this.toDiagnostic(e,t,n))};return await this.validateAstBefore(e,t,i,n),await this.validateAstNodes(e,t,i,n),await this.validateAstAfter(e,t,i,n),r}async validateAstBefore(e,t,n,r=Do.CancellationToken.None){var i;const s=this.validationRegistry.checksBefore;for(const a of s)await Bo(r),await a(e,n,null!==(i=t.categories)&&void 0!==i?i:[],r)}async validateAstNodes(e,t,n,r=Do.CancellationToken.None){await Promise.all(In(e).map((async e=>{await Bo(r);const i=this.validationRegistry.getChecks(e.$type,t.categories);for(const t of i)await t(e,n,r)})))}async validateAstAfter(e,t,n,r=Do.CancellationToken.None){var i;const s=this.validationRegistry.checksAfter;for(const a of s)await Bo(r),await a(e,n,null!==(i=t.categories)&&void 0!==i?i:[],r)}toDiagnostic(e,t,n){return{message:t,range:Cl(n),severity:wl(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 Cl(e){if(e.range)return e.range;let t;return"string"==typeof e.property?t=er(e.node.$cstNode,e.property,e.index):"string"==typeof e.keyword&&(t=nr(e.node.$cstNode,e.keyword,e.index)),null!=t||(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function wl(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}function Ll(e){switch(e){case"error":return kl(xl.LexingError);case"warning":return kl(xl.LexingWarning);case"info":return kl(xl.LexingInfo);case"hint":return kl(xl.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}(Sl=xl||(xl={})).LexingError="lexing-error",Sl.LexingWarning="lexing-warning",Sl.LexingInfo="lexing-info",Sl.LexingHint="lexing-hint",Sl.ParsingError="parsing-error",Sl.LinkingError="linking-error";class Ol{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n){const r=null!=n?n:kn(e);null!=t||(t=this.nameProvider.getName(e));const i=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${i} has no name.`);let s;const a=()=>{var t;return null!=s?s:s=lt(null!==(t=this.nameProvider.getNameNode(e))&&void 0!==t?t:e.$cstNode)};return{node:e,name:t,get nameSegment(){return a()},selectionSegment:lt(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}}class _l{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Do.CancellationToken.None){const n=[],r=e.parseResult.value;for(const i of In(r))await Bo(t),Cn(i).filter((e=>!je(e))).forEach((e=>{const t=this.createDescription(e);t&&n.push(t)}));return n}createDescription(e){const t=e.reference.$nodeDescription,n=e.reference.$refNode;if(!t||!n)return;const r=kn(e.container).uri;return{sourceUri:r,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:lt(n),local:el.equals(t.documentUri,r)}}}class bl{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 void 0!==t?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce(((e,t)=>{if(!e||0===t.length)return e;const n=t.indexOf(this.indexSeparator);if(n>0){const r=t.substring(0,n),i=parseInt(t.substring(n+1)),s=e[r];return null==s?void 0:s[i]}return e[t]}),e)}}var Pl,Ml=j();class Dl{constructor(e){this._ready=new Ko,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Ml.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var t,n;this.workspaceConfig=null!==(n=null===(t=e.capabilities.workspace)||void 0===t?void 0:t.configuration)&&void 0!==n&&n}async initialized(e){if(this.workspaceConfig){if(e.register){const t=this.serviceRegistry.all;e.register({section:t.map((e=>this.toSectionName(e.LanguageMetaData.languageId)))})}if(e.fetchConfiguration){const t=this.serviceRegistry.all.map((e=>({section:this.toSectionName(e.LanguageMetaData.languageId)}))),n=await e.fetchConfiguration(t);t.forEach(((e,t)=>{this.updateSectionConfiguration(e.section,n[t])}))}}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}}(Pl||(Pl={})).create=function(e){return{dispose:async()=>await e()}};class Ul{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new ul,this.documentPhaseListeners=new ul,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=nl.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=Do.CancellationToken.None){var r,i;for(const s of e){const e=s.uri.toString();if(s.state===nl.Validated){if("boolean"==typeof t.validation&&t.validation)s.state=nl.IndexedReferences,s.diagnostics=void 0,this.buildState.delete(e);else if("object"==typeof t.validation){const n=this.buildState.get(e),a=null===(r=null==n?void 0:n.result)||void 0===r?void 0:r.validationChecks;if(a){const r=(null!==(i=t.validation.categories)&&void 0!==i?i:$l.all).filter((e=>!a.includes(e)));r.length>0&&(this.buildState.set(e,{completed:!1,options:{validation:Object.assign(Object.assign({},t.validation),{categories:r})},result:n.result}),s.state=nl.IndexedReferences)}}}else this.buildState.delete(e)}this.currentState=nl.Changed,await this.emitUpdate(e.map((e=>e.uri)),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=Do.CancellationToken.None){this.currentState=nl.Changed;for(const s of t)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString()),this.indexManager.remove(s);for(const s of e){if(!this.langiumDocuments.invalidateDocument(s)){const e=this.langiumDocumentFactory.fromModel({$type:"INVALID"},s);e.state=nl.Changed,this.langiumDocuments.addDocument(e)}this.buildState.delete(s.toString())}const r=et(e).concat(t).map((e=>e.toString())).toSet();this.langiumDocuments.all.filter((e=>!r.has(e.uri.toString())&&this.shouldRelink(e,r))).forEach((e=>{this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e),e.state=Math.min(e.state,nl.ComputedScopes),e.diagnostics=void 0})),await this.emitUpdate(e,t),await Bo(n);const i=this.sortDocuments(this.langiumDocuments.all.filter((e=>{var t;return e.state<nl.Linked||!(null===(t=this.buildState.get(e.uri.toString()))||void 0===t?void 0:t.completed)})).toArray());await this.buildDocuments(i,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 Boolean(null===(t=this.textDocuments)||void 0===t?void 0:t.get(e.uri))}shouldRelink(e,t){return!!e.references.some((e=>void 0!==e.error))||this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),Pl.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,nl.Parsed,n,(e=>this.langiumDocumentFactory.update(e,n))),await this.runCancelable(e,nl.IndexedContent,n,(e=>this.indexManager.updateContent(e,n))),await this.runCancelable(e,nl.ComputedScopes,n,(async e=>{const t=this.serviceRegistry.getServices(e.uri).references.ScopeComputation;e.precomputedScopes=await t.computeLocalScopes(e,n)})),await this.runCancelable(e,nl.Linked,n,(e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,n))),await this.runCancelable(e,nl.IndexedReferences,n,(e=>this.indexManager.updateReferences(e,n)));const r=e.filter((e=>this.shouldValidate(e)));await this.runCancelable(r,nl.Validated,n,(e=>this.validate(e,n)));for(const i of e){const e=this.buildState.get(i.uri.toString());e&&(e.completed=!0)}}prepareBuild(e,t){for(const n of e){const e=n.uri.toString(),r=this.buildState.get(e);r&&!r.completed||this.buildState.set(e,{completed:!1,options:t,result:null==r?void 0:r.result})}}async runCancelable(e,t,n,r){const i=e.filter((e=>e.state<t));for(const a of i)await Bo(n),await r(a),a.state=t,await this.notifyDocumentPhase(a,t,n);const s=e.filter((e=>e.state===t));await this.notifyBuildPhase(s,t,n),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),Pl.create((()=>{this.buildPhaseListeners.delete(e,t)}))}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),Pl.create((()=>{this.documentPhaseListeners.delete(e,t)}))}waitUntil(e,t,n){let r;if(t&&"path"in t?r=t:n=t,null!=n||(n=Do.CancellationToken.None),r){const t=this.langiumDocuments.getDocument(r);if(t&&t.state>e)return Promise.resolve(r)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Go):new Promise(((t,i)=>{const s=this.onBuildPhase(e,(()=>{if(s.dispose(),a.dispose(),r){const e=this.langiumDocuments.getDocument(r);t(null==e?void 0:e.uri)}else t(void 0)})),a=n.onCancellationRequested((()=>{s.dispose(),a.dispose(),i(Go)}))}))}async notifyDocumentPhase(e,t,n){const r=this.documentPhaseListeners.get(t).slice();for(const s of r)try{await s(e,n)}catch(i){if(!Fo(i))throw i}}async notifyBuildPhase(e,t,n){if(0===e.length)return;const r=this.buildPhaseListeners.get(t).slice();for(const i of r)await Bo(n),await i(e,n)}shouldValidate(e){return Boolean(this.getBuildOptions(e).validation)}async validate(e,t){var n,r;const i=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,a="object"==typeof s?s:void 0,o=await i.validateDocument(e,a,t);e.diagnostics?e.diagnostics.push(...o):e.diagnostics=o;const l=this.buildState.get(e.uri.toString());if(l){null!==(n=l.result)&&void 0!==n||(l.result={});const e=null!==(r=null==a?void 0:a.categories)&&void 0!==r?r:$l.all;l.result.validationChecks?l.result.validationChecks.push(...e):l.result.validationChecks=[...e]}}getBuildOptions(e){var t,n;return null!==(n=null===(t=this.buildState.get(e.uri.toString()))||void 0===t?void 0:t.options)&&void 0!==n?n:{}}}class Gl{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new yl,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){const n=kn(e).uri,r=[];return this.referenceIndex.forEach((e=>{e.forEach((e=>{el.equals(e.targetUri,n)&&e.targetPath===t&&r.push(e)}))})),et(r)}allElements(e,t){let n=et(this.symbolIndex.keys());return t&&(n=n.filter((e=>!t||t.has(e)))),n.map((t=>this.getFileDescriptions(t,e))).flat()}getFileDescriptions(e,t){var n;if(!t)return null!==(n=this.symbolIndex.get(e))&&void 0!==n?n:[];return this.symbolByTypeIndex.get(e,t,(()=>{var n;return(null!==(n=this.symbolIndex.get(e))&&void 0!==n?n:[]).filter((e=>this.astReflection.isSubtype(e.type,t)))}))}remove(e){const t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t),this.referenceIndex.delete(t)}async updateContent(e,t=Do.CancellationToken.None){const n=this.serviceRegistry.getServices(e.uri),r=await n.references.ScopeComputation.computeExports(e,t),i=e.uri.toString();this.symbolIndex.set(i,r),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=Do.CancellationToken.None){const n=this.serviceRegistry.getServices(e.uri),r=await n.workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),r)}isAffected(e,t){const n=this.referenceIndex.get(e.uri.toString());return!!n&&n.some((e=>!e.local&&t.has(e.targetUri.toString())))}}class Fl{constructor(e){this.initialBuildOptions={},this._ready=new Ko,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=null!==(t=e.workspaceFolders)&&void 0!==t?t:void 0}initialized(e){return this.mutex.write((e=>{var t;return this.initializeWorkspace(null!==(t=this.folders)&&void 0!==t?t:[],e)}))}async initializeWorkspace(e,t=Do.CancellationToken.None){const n=await this.performStartup(e);await Bo(t),await this.documentBuilder.build(n,this.initialBuildOptions,t)}async performStartup(e){const t=this.serviceRegistry.all.flatMap((e=>e.LanguageMetaData.fileExtensions)),n=[],r=e=>{n.push(e),this.langiumDocuments.hasDocument(e.uri)||this.langiumDocuments.addDocument(e)};return await this.loadAdditionalDocuments(e,r),await Promise.all(e.map((e=>[e,this.getRootFolder(e)])).map((async e=>this.traverseFolder(...e,t,r)))),this._ready.resolve(),n}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Jo.parse(e.uri)}async traverseFolder(e,t,n,r){const i=await this.fileSystemProvider.readDirectory(t);await Promise.all(i.map((async t=>{if(this.includeEntry(e,t,n))if(t.isDirectory)await this.traverseFolder(e,t.uri,n,r);else if(t.isFile){const e=await this.langiumDocuments.getOrCreateDocument(t.uri);r(e)}})))}includeEntry(e,t,n){const r=el.basename(t.uri);if(r.startsWith("."))return!1;if(t.isDirectory)return"node_modules"!==r&&"out"!==r;if(t.isFile){const e=el.extname(t.uri);return n.includes(e)}return!1}}class Bl{buildUnexpectedCharactersMessage(e,t,n,r,i){return Si.buildUnexpectedCharactersMessage(e,t,n,r,i)}buildUnableToPopLexerModeMessage(e){return Si.buildUnableToPopLexerModeMessage(e)}}const Kl={mode:"full"};class Vl{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,r="production"===e.LanguageMetaData.mode;this.chevrotainLexer=new wi(n,{positionTracking:"full",skipValidations:r,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Kl){var n,r,i;const s=this.chevrotainLexer.tokenize(e);return{tokens:s.tokens,errors:s.errors,hidden:null!==(n=s.groups.hidden)&&void 0!==n?n:[],report:null===(i=(r=this.tokenBuilder).flushLexingReport)||void 0===i?void 0:i.call(r,e)}}toTokenTypeDictionary(e){if(Hl(e))return e;const t=jl(e)?Object.values(e.modes).flat():e,n={};return t.forEach((e=>n[e.name]=e)),n}}function jl(e){return e&&"modes"in e&&"defaultMode"in e}function Hl(e){return!function(e){return Array.isArray(e)&&(0===e.length||"name"in e[0])}(e)&&!jl(e)}function Wl(e,t,n){let r,i;"string"==typeof e?(i=t,r=n):(i=e.range.start,r=t),i||(i=K.create(0,0));const s=function(e){var t,n,r;const i=[];let s=e.position.line,a=e.position.character;for(let o=0;o<e.lines.length;o++){const l=0===o,c=o===e.lines.length-1;let u=e.lines[o],d=0;if(l&&e.options.start){const n=null===(t=e.options.start)||void 0===t?void 0:t.exec(u);n&&(d=n.index+n[0].length)}else{const t=null===(n=e.options.line)||void 0===n?void 0:n.exec(u);t&&(d=t.index+t[0].length)}if(c){const t=null===(r=e.options.end)||void 0===r?void 0:r.exec(u);t&&(u=u.substring(0,t.index))}u=u.substring(0,ec(u));if(Zl(u,d)>=u.length){if(i.length>0){const e=K.create(s,a);i.push({type:"break",content:"",range:H.create(e,e)})}}else{Yl.lastIndex=d;const e=Yl.exec(u);if(e){const t=e[0],n=e[1],r=K.create(s,a+d),o=K.create(s,a+d+t.length);i.push({type:"tag",content:n,range:H.create(r,o)}),d+=t.length,d=Zl(u,d)}if(d<u.length){const e=u.substring(d),t=Array.from(e.matchAll(ql));i.push(...Xl(t,e,s,a+d))}}s++,a=0}if(i.length>0&&"break"===i[i.length-1].type)return i.slice(0,-1);return i}({lines:zl(e),position:i,options:ac(r)});return function(e){var t,n,r,i;const s=K.create(e.position.line,e.position.character);if(0===e.tokens.length)return new lc([],H.create(s,s));const a=[];for(;e.index<e.tokens.length;){const t=tc(e,a[a.length-1]);t&&a.push(t)}const o=null!==(n=null===(t=a[0])||void 0===t?void 0:t.range.start)&&void 0!==n?n:s,l=null!==(i=null===(r=a[a.length-1])||void 0===r?void 0:r.range.end)&&void 0!==i?i:s;return new lc(a,H.create(o,l))}({index:0,tokens:s,position:i})}function zl(e){let t="";t="string"==typeof e?e:e.text;return t.split(jn)}const Yl=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,ql=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Xl(e,t,n,r){const i=[];if(0===e.length){const e=K.create(n,r),s=K.create(n,r+t.length);i.push({type:"text",content:t,range:H.create(e,s)})}else{let s=0;for(const o of e){const e=o.index,a=t.substring(s,e);a.length>0&&i.push({type:"text",content:t.substring(s,e),range:H.create(K.create(n,s+r),K.create(n,e+r))});let l=a.length+1;const c=o[1];if(i.push({type:"inline-tag",content:c,range:H.create(K.create(n,s+l+r),K.create(n,s+l+c.length+r))}),l+=c.length,4===o.length){l+=o[2].length;const e=o[3];i.push({type:"text",content:e,range:H.create(K.create(n,s+l+r),K.create(n,s+l+e.length+r))})}else i.push({type:"text",content:"",range:H.create(K.create(n,s+l+r),K.create(n,s+l+r))});s=e+o[0].length}const a=t.substring(s);a.length>0&&i.push({type:"text",content:a,range:H.create(K.create(n,s+r),K.create(n,s+r+a.length))})}return i}const Ql=/\S/,Jl=/\s*$/;function Zl(e,t){const n=e.substring(t).match(Ql);return n?t+n.index:e.length}function ec(e){const t=e.match(Jl);if(t&&"number"==typeof t.index)return t.index}function tc(e,t){const n=e.tokens[e.index];return"tag"===n.type?ic(e,!1):"text"===n.type||"inline-tag"===n.type?nc(e):(function(e,t){if(t){const n=new dc("",e.range);"inlines"in t?t.inlines.push(n):t.content.inlines.push(n)}}(n,t),void e.index++)}function nc(e){let t=e.tokens[e.index];const n=t;let r=t;const i=[];for(;t&&"break"!==t.type&&"tag"!==t.type;)i.push(rc(e)),r=t,t=e.tokens[e.index];return new uc(i,H.create(n.range.start,r.range.end))}function rc(e){return"inline-tag"===e.tokens[e.index].type?ic(e,!0):sc(e)}function ic(e,t){const n=e.tokens[e.index++],r=n.content.substring(1),i=e.tokens[e.index];if("text"===(null==i?void 0:i.type)){if(t){const i=sc(e);return new cc(r,new uc([i],i.range),t,H.create(n.range.start,i.range.end))}{const i=nc(e);return new cc(r,i,t,H.create(n.range.start,i.range.end))}}{const e=n.range;return new cc(r,new uc([],e),t,e)}}function sc(e){const t=e.tokens[e.index++];return new dc(t.content,t.range)}function ac(e){if(!e)return ac({start:"/**",end:"*/",line:"*"});const{start:t,end:n,line:r}=e;return{start:oc(t,!0),end:oc(n,!1),line:oc(r,!0)}}function oc(e,t){if("string"==typeof e||"object"==typeof e){const n="string"==typeof e?Xn(e):e.source;return t?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}return e}class lc{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(0===e.length)e=t.toString();else{const n=t.toString();e+=hc(e)+n}return e.trim()}toMarkdown(e){let t="";for(const n of this.elements)if(0===t.length)t=n.toMarkdown(e);else{const r=n.toMarkdown(e);t+=hc(t)+r}return t.trim()}}class cc{constructor(e,t,n,r){this.name=e,this.content=t,this.inline=n,this.range=r}toString(){let e=`@${this.name}`;const t=this.content.toString();return 1===this.content.inlines.length?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e}\n${t}`),this.inline?`{${e}}`:e}toMarkdown(e){var t,n;return null!==(n=null===(t=null==e?void 0:e.renderTag)||void 0===t?void 0:t.call(e,this))&&void 0!==n?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){const t=this.content.toMarkdown(e);if(this.inline){const n=function(e,t,n){var r,i;if("linkplain"===e||"linkcode"===e||"link"===e){const s=t.indexOf(" ");let a=t;if(s>0){const e=Zl(t,s);a=t.substring(e),t=t.substring(0,s)}("linkcode"===e||"link"===e&&"code"===n.link)&&(a=`\`${a}\``);const o=null!==(i=null===(r=n.renderLink)||void 0===r?void 0:r.call(n,t,a))&&void 0!==i?i:function(e,t){try{return Jo.parse(e,!0),`[${t}](${e})`}catch(r){return e}}(t,a);return o}return}(this.name,t,null!=e?e:{});if("string"==typeof n)return n}let n="";"italic"===(null==e?void 0:e.tag)||void 0===(null==e?void 0:e.tag)?n="*":"bold"===(null==e?void 0:e.tag)?n="**":"bold-italic"===(null==e?void 0:e.tag)&&(n="***");let r=`${n}@${this.name}${n}`;return 1===this.content.inlines.length?r=`${r} — ${t}`:this.content.inlines.length>1&&(r=`${r}\n${t}`),this.inline?`{${r}}`:r}}class uc{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],r=this.inlines[t+1];e+=n.toString(),r&&r.range.start.line>n.range.start.line&&(e+="\n")}return e}toMarkdown(e){let t="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];t+=r.toMarkdown(e),i&&i.range.start.line>r.range.start.line&&(t+="\n")}return t}}class dc{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function hc(e){return e.endsWith("\n")?"\n":"\n\n"}class pc{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const t=this.commentProvider.getComment(e);if(t&&function(e,t){const n=ac(t),r=zl(e);if(0===r.length)return!1;const i=r[0],s=r[r.length-1],a=n.start,o=n.end;return Boolean(null==a?void 0:a.exec(i))&&Boolean(null==o?void 0:o.exec(s))}(t)){return Wl(t).toMarkdown({renderLink:(t,n)=>this.documentationLinkRenderer(e,t,n),renderTag:t=>this.documentationTagRenderer(e,t)})}}documentationLinkRenderer(e,t,n){var r;const i=null!==(r=this.findNameInPrecomputedScopes(e,t))&&void 0!==r?r:this.findNameInGlobalScope(e,t);if(i&&i.nameSegment){const e=i.nameSegment.range.start.line+1,t=i.nameSegment.range.start.character+1;return`[${n}](${i.documentUri.with({fragment:`L${e},${t}`}).toString()})`}}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){const n=kn(e).precomputedScopes;if(!n)return;let r=e;do{const e=n.get(r).find((e=>e.name===t));if(e)return e;r=r.$container}while(r)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find((e=>e.name===t))}}class fc{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var t;return function(e){return"string"==typeof e.$comment}(e)?e.$comment:null===(t=function(e,t){if(e){const n=function(e,t=!0){for(;e.container;){const n=e.container;let r=n.content.indexOf(e);for(;r>0;){r--;const e=n.content[r];if(t||!e.hidden)return e}e=n}}(e,!0);if(n&&dt(n,t))return n;if(Ye(e))for(let r=e.content.findIndex((e=>!e.hidden))-1;r>=0;r--){const n=e.content[r];if(dt(n,t))return n}}}(e.$cstNode,this.grammarConfig().multilineCommentRules))||void 0===t?void 0:t.text}}class mc{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}}class gc{constructor(){this.previousTokenSource=new Do.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=(Uo=performance.now(),new Do.CancellationTokenSource);return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n=Do.CancellationToken.None){const r=new Ko,i={action:t,deferred:r,cancellationToken:n};return e.push(i),this.performNextOperation(),r.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))return;e.push(...this.readQueue.splice(0,this.readQueue.length))}this.done=!1,await Promise.all(e.map((async({action:e,deferred:t,cancellationToken:n})=>{try{const r=await Promise.resolve().then((()=>e(n)));t.resolve(r)}catch(r){Fo(r)?t.resolve(void 0):t.reject(r)}}))),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class yc{constructor(e){this.grammarElementIdMap=new dl,this.tokenTypeIdMap=new dl,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((e=>Object.assign(Object.assign({},e),{message:e.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 r of In(e))t.set(r,{});if(e.$cstNode)for(const r of at(e.$cstNode))n.set(r,{});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,void 0!==e.$cstNode&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(const[r,i]of Object.entries(e))if(!r.startsWith("$"))if(Array.isArray(i)){const e=[];n[r]=e;for(const n of i)Ke(n)?e.push(this.dehydrateAstNode(n,t)):Ve(n)?e.push(this.dehydrateReference(n,t)):e.push(n)}else Ke(i)?n[r]=this.dehydrateAstNode(i,t):Ve(i)?n[r]=this.dehydrateReference(i,t):void 0!==i&&(n[r]=i);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 Ye(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),We(e)?n.content=e.content.map((e=>this.dehydrateCstNode(e,t))):ze(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 i of In(e))t.set(i,{});let r;if(e.$cstNode)for(const i of at(e.$cstNode)){let e;"fullText"in i?(e=new fo(i.fullText),r=e):"content"in i?e=new ho:"tokenType"in i&&(e=this.hydrateCstLeafNode(i)),e&&(n.set(i,e),e.root=r)}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[r,i]of Object.entries(e))if(!r.startsWith("$"))if(Array.isArray(i)){const e=[];n[r]=e;for(const s of i)Ke(s)?e.push(this.setParent(this.hydrateAstNode(s,t),n)):Ve(s)?e.push(this.hydrateReference(s,n,r,t)):e.push(s)}else Ke(i)?n[r]=this.setParent(this.hydrateAstNode(i,t),n):Ve(i)?n[r]=this.hydrateReference(i,n,r,t):void 0!==i&&(n[r]=i);return n}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,n,r){return this.linker.buildReference(t,n,r.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,n=0){const r=t.cstNodes.get(e);if("number"==typeof e.grammarSource&&(r.grammarSource=this.getGrammarElement(e.grammarSource)),r.astNode=t.astNodes.get(e.astNode),We(r))for(const i of e.content){const e=this.hydrateCstNode(i,t,n++);r.content.push(e)}return r}hydrateCstLeafNode(e){const t=this.getTokenType(e.tokenType),n=e.offset,r=e.length,i=e.startLine,s=e.startColumn,a=e.endLine,o=e.endColumn,l=e.hidden;return new uo(n,r,{start:{line:i,character:s},end:{line:a,character:o}},t,l)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return 0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){0===this.grammarElementIdMap.size&&this.createGrammarElementIdMap();return this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(const n of In(this.grammar))t=n,En.isInstance(t,vt)&&this.grammarElementIdMap.set(n,e++);var t}}function Tc(e){return{documentation:{CommentProvider:e=>new fc(e),DocumentationProvider:e=>new pc(e)},parser:{AsyncParser:e=>new mc(e),GrammarConfig:e=>function(e){const t=[],n=e.Grammar;for(const i of n.rules)Vt(i)&&(r=i).hidden&&!qn(cr(r))&&zn(cr(i))&&t.push(i.name);var r;return{multilineCommentRules:t,nameRegexp:ut}}(e),LangiumParser:e=>_o(e),CompletionParser:e=>function(e){const t=e.Grammar,n=e.parser.Lexer,r=new Ao(e);return xo(t,r,n.definition),r.finalize(),r}(e),ValueConverter:()=>new Po,TokenBuilder:()=>new bo,Lexer:e=>new Vl(e),ParserErrorMessageProvider:()=>new Eo,LexerErrorMessageProvider:()=>new Bl},workspace:{AstNodeLocator:()=>new bl,AstNodeDescriptionProvider:e=>new Ol(e),ReferenceDescriptionProvider:e=>new _l(e)},references:{Linker:e=>new ol(e),NameProvider:()=>new ll,ScopeProvider:e=>new vl(e),ScopeComputation:e=>new hl(e),References:e=>new cl(e)},serializer:{Hydrator:e=>new yc(e),JsonSerializer:e=>new El(e)},validation:{DocumentValidator:e=>new Nl(e),ValidationRegistry:e=>new Il(e)},shared:()=>e.shared}}function vc(e){return{ServiceRegistry:e=>new Al(e),workspace:{LangiumDocuments:e=>new sl(e),LangiumDocumentFactory:e=>new il(e),DocumentBuilder:e=>new Ul(e),IndexManager:e=>new Gl(e),WorkspaceManager:e=>new Fl(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new gc,ConfigurationProvider:e=>new Dl(e)}}}var Rc;function Ec(e,t,n,r,i,s,a,o,l){return kc([e,t,n,r,i,s,a,o,l].reduce(Sc,{}))}(Rc||(Rc={})).merge=(e,t)=>Sc(Sc({},e),t);const Ac=Symbol("isProxy");function kc(e,t){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===Ac||xc(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(xc(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(t,n)=>n in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return n}const $c=Symbol();function xc(e,t,n,r){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:e[t]});if(e[t]===$c)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return e[t]}if(t in n){const s=n[t];e[t]=$c;try{e[t]="function"==typeof s?s(r):kc(s,r)}catch(i){throw e[t]=i instanceof Error?i:void 0,i}return e[t]}}function Sc(e,t){if(t)for(const[n,r]of Object.entries(t))if(void 0!==r){const t=e[n];e[n]=null!==t&&null!==r&&"object"==typeof t&&"object"==typeof r?Sc(t,r):r}return e}class Ic{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const Nc={fileSystemProvider:()=>new Ic},Cc={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},wc={AstReflection:()=>new Rn};function Lc(e){var t;const n=function(){const e=Ec(vc(Nc),wc),t=Ec(Tc({shared:e}),Cc);return e.ServiceRegistry.register(t),t}(),r=n.serializer.JsonSerializer.deserialize(e);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Jo.parse(`memory://${null!==(t=r.name)&&void 0!==t?t:"grammar"}.langium`)),r}var Oc=Object.defineProperty,_c=(e,t)=>Oc(e,"name",{value:t,configurable:!0}),bc="Statement",Pc="Architecture";_c((function(e){return du.isInstance(e,Pc)}),"isArchitecture");var Mc="Axis",Dc="Branch";_c((function(e){return du.isInstance(e,Dc)}),"isBranch");var Uc="Checkout",Gc="CherryPicking",Fc="Commit";_c((function(e){return du.isInstance(e,Fc)}),"isCommit");var Bc="Common";_c((function(e){return du.isInstance(e,Bc)}),"isCommon");var Kc="Curve",Vc="Edge",jc="Entry",Hc="GitGraph";_c((function(e){return du.isInstance(e,Hc)}),"isGitGraph");var Wc="Group",zc="Info";_c((function(e){return du.isInstance(e,zc)}),"isInfo");var Yc="Junction",qc="Merge";_c((function(e){return du.isInstance(e,qc)}),"isMerge");var Xc="Option",Qc="Packet";_c((function(e){return du.isInstance(e,Qc)}),"isPacket");var Jc="PacketBlock";_c((function(e){return du.isInstance(e,Jc)}),"isPacketBlock");var Zc="Pie";_c((function(e){return du.isInstance(e,Zc)}),"isPie");var eu="PieSection";_c((function(e){return du.isInstance(e,eu)}),"isPieSection");var tu,nu,ru,iu,su,au,ou="Radar",lu="Service",cu="Direction",uu=(_c(e=class extends He{getAllTypes(){return[Pc,Mc,Dc,Uc,Gc,Fc,Bc,Kc,cu,Vc,jc,Hc,Wc,zc,Yc,qc,Xc,Qc,Jc,Zc,eu,ou,lu,bc]}computeIsSubtype(e,t){switch(e){case Dc:case Uc:case Gc:case Fc:case qc:return this.isSubtype(bc,t);case cu:return this.isSubtype(Hc,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;if("Entry:axis"===t)return Mc;throw new Error(`${t} is not a valid reference id.`)}getTypeMetaData(e){switch(e){case Pc:return{name:Pc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case Mc:return{name:Mc,properties:[{name:"label"},{name:"name"}]};case Dc:return{name:Dc,properties:[{name:"name"},{name:"order"}]};case Uc:return{name:Uc,properties:[{name:"branch"}]};case Gc:return{name:Gc,properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case Fc:return{name:Fc,properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case Bc:return{name:Bc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case Kc:return{name:Kc,properties:[{name:"entries",defaultValue:[]},{name:"label"},{name:"name"}]};case Vc:return{name:Vc,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 jc:return{name:jc,properties:[{name:"axis"},{name:"value"}]};case Hc:return{name:Hc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case Wc:return{name:Wc,properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case zc:return{name:zc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case Yc:return{name:Yc,properties:[{name:"id"},{name:"in"}]};case qc:return{name:qc,properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case Xc:return{name:Xc,properties:[{name:"name"},{name:"value",defaultValue:!1}]};case Qc:return{name:Qc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case Jc:return{name:Jc,properties:[{name:"end"},{name:"label"},{name:"start"}]};case Zc:return{name:Zc,properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case eu:return{name:eu,properties:[{name:"label"},{name:"value"}]};case ou:return{name:ou,properties:[{name:"accDescr"},{name:"accTitle"},{name:"axes",defaultValue:[]},{name:"curves",defaultValue:[]},{name:"options",defaultValue:[]},{name:"title"}]};case lu:return{name:lu,properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case cu:return{name:cu,properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};default:return{name:e,properties:[]}}}},"MermaidAstReflection"),e),du=new uu,hu=_c((()=>tu??(tu=Lc('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":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@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"InfoGrammar"),pu=_c((()=>nu??(nu=Lc('{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":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":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":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@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"PacketGrammar"),fu=_c((()=>ru??(ru=Lc('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"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@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":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@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"PieGrammar"),mu=_c((()=>iu??(iu=Lc('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"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@15"},"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@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"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@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":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},{"$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":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}'))),"ArchitectureGrammar"),gu=_c((()=>su??(su=Lc('{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"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@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"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@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"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@1"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"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@1"},"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@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"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@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"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":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}'))),"GitGraphGrammar"),yu=_c((()=>au??(au=Lc('{"$type":"Grammar","isDeclared":true,"name":"Radar","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@12"}}}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"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","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":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"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@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"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@22"},"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@21"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"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@21"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"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@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@12"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"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@19"},"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@18"},"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@18"},"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@18"},"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@20"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":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":"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":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9\\\\-_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}'))),"RadarGrammar"),Tu={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},vu={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Ru={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Eu={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Au={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ku={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},$u={AstReflection:_c((()=>new uu),"AstReflection")},xu={Grammar:_c((()=>hu()),"Grammar"),LanguageMetaData:_c((()=>Tu),"LanguageMetaData"),parser:{}},Su={Grammar:_c((()=>pu()),"Grammar"),LanguageMetaData:_c((()=>vu),"LanguageMetaData"),parser:{}},Iu={Grammar:_c((()=>fu()),"Grammar"),LanguageMetaData:_c((()=>Ru),"LanguageMetaData"),parser:{}},Nu={Grammar:_c((()=>mu()),"Grammar"),LanguageMetaData:_c((()=>Eu),"LanguageMetaData"),parser:{}},Cu={Grammar:_c((()=>gu()),"Grammar"),LanguageMetaData:_c((()=>Au),"LanguageMetaData"),parser:{}},wu={Grammar:_c((()=>yu()),"Grammar"),LanguageMetaData:_c((()=>ku),"LanguageMetaData"),parser:{}},Lu={ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/accTitle[\t ]*:([^\n\r]*)/,TITLE:/title([\t ][^\n\r]*|)/},Ou=(_c(t=class extends Po{runConverter(e,t,n){let r=this.runCommonConverter(e,t,n);return void 0===r&&(r=this.runCustomConverter(e,t,n)),void 0===r?super.runConverter(e,t,n):r}runCommonConverter(e,t,n){const r=Lu[e.name];if(void 0===r)return;const i=r.exec(t);return null!==i?void 0!==i[1]?i[1].trim().replace(/[\t ]{2,}/gm," "):void 0!==i[2]?i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,"\n"):void 0:void 0}},"AbstractMermaidValueConverter"),t),_u=(_c(n=class extends Ou{runCustomConverter(e,t,n){}},"CommonValueConverter"),n),bu=(_c(r=class extends bo{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,n){const r=super.buildKeywordTokens(e,t,n);return r.forEach((e=>{this.keywords.has(e.name)&&void 0!==e.PATTERN&&(e.PATTERN=new RegExp(e.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))})),r}},"AbstractMermaidTokenBuilder"),r);_c(class extends bu{},"CommonTokenBuilder");var Pu=(_c(i=class extends bu{constructor(){super(["gitGraph"])}},"GitGraphTokenBuilder"),i),Mu={parser:{TokenBuilder:_c((()=>new Pu),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function Du(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Cu,Mu);return t.ServiceRegistry.register(n),{shared:t,GitGraph:n}}_c(Du,"createGitGraphServices");var Uu=(_c(s=class extends bu{constructor(){super(["info","showInfo"])}},"InfoTokenBuilder"),s),Gu={parser:{TokenBuilder:_c((()=>new Uu),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function Fu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),xu,Gu);return t.ServiceRegistry.register(n),{shared:t,Info:n}}_c(Fu,"createInfoServices");var Bu=(_c(a=class extends bu{constructor(){super(["packet-beta"])}},"PacketTokenBuilder"),a),Ku={parser:{TokenBuilder:_c((()=>new Bu),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function Vu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Su,Ku);return t.ServiceRegistry.register(n),{shared:t,Packet:n}}_c(Vu,"createPacketServices");var ju=(_c(o=class extends bu{constructor(){super(["pie","showData"])}},"PieTokenBuilder"),o),Hu=(_c(l=class extends Ou{runCustomConverter(e,t,n){if("PIE_SECTION_LABEL"===e.name)return t.replace(/"/g,"").trim()}},"PieValueConverter"),l),Wu={parser:{TokenBuilder:_c((()=>new ju),"TokenBuilder"),ValueConverter:_c((()=>new Hu),"ValueConverter")}};function zu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Iu,Wu);return t.ServiceRegistry.register(n),{shared:t,Pie:n}}_c(zu,"createPieServices");var Yu=(_c(c=class extends bu{constructor(){super(["architecture"])}},"ArchitectureTokenBuilder"),c),qu=(_c(u=class extends Ou{runCustomConverter(e,t,n){return"ARCH_ICON"===e.name?t.replace(/[()]/g,"").trim():"ARCH_TEXT_ICON"===e.name?t.replace(/["()]/g,""):"ARCH_TITLE"===e.name?t.replace(/[[\]]/g,"").trim():void 0}},"ArchitectureValueConverter"),u),Xu={parser:{TokenBuilder:_c((()=>new Yu),"TokenBuilder"),ValueConverter:_c((()=>new qu),"ValueConverter")}};function Qu(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),Nu,Xu);return t.ServiceRegistry.register(n),{shared:t,Architecture:n}}_c(Qu,"createArchitectureServices");var Ju=(_c(d=class extends bu{constructor(){super(["radar-beta"])}},"RadarTokenBuilder"),d),Zu={parser:{TokenBuilder:_c((()=>new Ju),"TokenBuilder"),ValueConverter:_c((()=>new _u),"ValueConverter")}};function ed(e=Nc){const t=Ec(vc(e),$u),n=Ec(Tc({shared:t}),wu,Zu);return t.ServiceRegistry.register(n),{shared:t,Radar:n}}_c(ed,"createRadarServices");var td={},nd={info:_c((async()=>{const{createInfoServices:e}=await W((async()=>{const{createInfoServices:e}=await Promise.resolve().then((()=>sd));return{createInfoServices:e}}),void 0,import.meta.url),t=e().Info.parser.LangiumParser;td.info=t}),"info"),packet:_c((async()=>{const{createPacketServices:e}=await W((async()=>{const{createPacketServices:e}=await Promise.resolve().then((()=>ad));return{createPacketServices:e}}),void 0,import.meta.url),t=e().Packet.parser.LangiumParser;td.packet=t}),"packet"),pie:_c((async()=>{const{createPieServices:e}=await W((async()=>{const{createPieServices:e}=await Promise.resolve().then((()=>od));return{createPieServices:e}}),void 0,import.meta.url),t=e().Pie.parser.LangiumParser;td.pie=t}),"pie"),architecture:_c((async()=>{const{createArchitectureServices:e}=await W((async()=>{const{createArchitectureServices:e}=await Promise.resolve().then((()=>ld));return{createArchitectureServices:e}}),void 0,import.meta.url),t=e().Architecture.parser.LangiumParser;td.architecture=t}),"architecture"),gitGraph:_c((async()=>{const{createGitGraphServices:e}=await W((async()=>{const{createGitGraphServices:e}=await Promise.resolve().then((()=>cd));return{createGitGraphServices:e}}),void 0,import.meta.url),t=e().GitGraph.parser.LangiumParser;td.gitGraph=t}),"gitGraph"),radar:_c((async()=>{const{createRadarServices:e}=await W((async()=>{const{createRadarServices:e}=await Promise.resolve().then((()=>ud));return{createRadarServices:e}}),void 0,import.meta.url),t=e().Radar.parser.LangiumParser;td.radar=t}),"radar")};async function rd(e,t){const n=nd[e];if(!n)throw new Error(`Unknown diagram type: ${e}`);td[e]||await n();const r=td[e].parse(t);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new id(r);return r.value}_c(rd,"parse");var id=(_c(h=class extends Error{constructor(e){super(`Parsing failed: ${e.lexerErrors.map((e=>e.message)).join("\n")} ${e.parserErrors.map((e=>e.message)).join("\n")}`),this.result=e}},"MermaidParseError"),h);const sd=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:Gu,createInfoServices:Fu},Symbol.toStringTag,{value:"Module"})),ad=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:Ku,createPacketServices:Vu},Symbol.toStringTag,{value:"Module"})),od=Object.freeze(Object.defineProperty({__proto__:null,PieModule:Wu,createPieServices:zu},Symbol.toStringTag,{value:"Module"})),ld=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:Xu,createArchitectureServices:Qu},Symbol.toStringTag,{value:"Module"})),cd=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:Mu,createGitGraphServices:Du},Symbol.toStringTag,{value:"Module"})),ud=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:Zu,createRadarServices:ed},Symbol.toStringTag,{value:"Module"}));export{rd as p};