@spteck/react-controls-v2 2.2.5 → 2.2.7
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.
- package/README.md +41 -0
- package/dist/{_arrayEach-D4zuu96h.cjs → _arrayEach-CAQQp4Pa.cjs} +2 -2
- package/dist/{_arrayEach-CqFZfCII.js → _arrayEach-Cwv-C9Og.js} +2 -2
- package/dist/{arc-aQvhbW8i.js → arc-Bw6DhSi8.js} +2 -2
- package/dist/{arc-DVsLnFmY.cjs → arc-okIdGGQf.cjs} +2 -2
- package/dist/architecture-7HQA4BMR-BehZQXGM.js +6 -0
- package/dist/{architecture-7HQA4BMR-XjppxKRg.cjs → architecture-7HQA4BMR-VRHl0WAG.cjs} +2 -2
- package/dist/{architectureDiagram-VXUJARFQ-DIlvBP7n.cjs → architectureDiagram-VXUJARFQ-BmUckqP4.cjs} +2 -2
- package/dist/{architectureDiagram-VXUJARFQ-D6Nz1iJf.js → architectureDiagram-VXUJARFQ-jeJiEwo0.js} +4 -4
- package/dist/{blockDiagram-VD42YOAC-COTmdEYf.js → blockDiagram-VD42YOAC-CQMLVG9p.js} +5 -5
- package/dist/{blockDiagram-VD42YOAC-eoa5Tjmi.cjs → blockDiagram-VD42YOAC-Cf1w6RSy.cjs} +2 -2
- package/dist/{c4Diagram-YG6GDRKO-DZUAZkaf.js → c4Diagram-YG6GDRKO-DQ1DM-hS.js} +3 -3
- package/dist/{c4Diagram-YG6GDRKO-D_8NNIZj.cjs → c4Diagram-YG6GDRKO-F89ysfvk.cjs} +2 -2
- package/dist/channel-CKuBsdyV.cjs +2 -0
- package/dist/{channel-CStgee6z.js → channel-CSrapMLf.js} +2 -2
- package/dist/{chunk-4BX2VUAB-BMIPlysy.js → chunk-4BX2VUAB-BCOKb8lN.js} +2 -2
- package/dist/{chunk-4BX2VUAB-TOFCWNSm.cjs → chunk-4BX2VUAB-DguP-lnc.cjs} +2 -2
- package/dist/{chunk-55IACEB6-CVM8RfF8.js → chunk-55IACEB6-B96t1BIq.js} +2 -2
- package/dist/{chunk-55IACEB6-Du1XS8Uq.cjs → chunk-55IACEB6-CC07tSHB.cjs} +2 -2
- package/dist/{chunk-B4BG7PRW-DEwHKt7v.cjs → chunk-B4BG7PRW-Csa3ViKx.cjs} +2 -2
- package/dist/{chunk-B4BG7PRW-CrL0RwBf.js → chunk-B4BG7PRW-aK7oMSOd.js} +5 -5
- package/dist/{chunk-DI55MBZ5-Dcfk7rkk.js → chunk-DI55MBZ5-B02Dm5ea.js} +4 -4
- package/dist/{chunk-DI55MBZ5-BWCTxXqE.cjs → chunk-DI55MBZ5-Dq5Sl8zR.cjs} +2 -2
- package/dist/{chunk-FMBD7UC4-DMErx-lW.cjs → chunk-FMBD7UC4-BjhMSXjI.cjs} +2 -2
- package/dist/{chunk-FMBD7UC4-B5kmDdIm.js → chunk-FMBD7UC4-YCBHVAL4.js} +2 -2
- package/dist/{chunk-QN33PNHL-DbaaoJ4j.js → chunk-QN33PNHL-B_p3A_22.js} +2 -2
- package/dist/{chunk-QN33PNHL-CkT5TAcW.cjs → chunk-QN33PNHL-DCv_ieMX.cjs} +2 -2
- package/dist/{chunk-QZHKN3VN-CMS4Eu2L.cjs → chunk-QZHKN3VN-BFRx9G0z.cjs} +2 -2
- package/dist/{chunk-QZHKN3VN-BsktB_nO.js → chunk-QZHKN3VN-DRLEsMJj.js} +2 -2
- package/dist/{chunk-TZMSLE5B-lGq5Y0nP.cjs → chunk-TZMSLE5B-DZUorszs.cjs} +2 -2
- package/dist/{chunk-TZMSLE5B-CbhkmL3S.js → chunk-TZMSLE5B-DmeaE6Eh.js} +2 -2
- package/dist/{classDiagram-2ON5EDUG-ChI1HQhB.cjs → classDiagram-2ON5EDUG-BmFRijDQ.cjs} +2 -2
- package/dist/{classDiagram-2ON5EDUG-CtIswLAU.js → classDiagram-2ON5EDUG-DW2aCkne.js} +3 -3
- package/dist/{classDiagram-v2-WZHVMYZB-ChI1HQhB.cjs → classDiagram-v2-WZHVMYZB-BmFRijDQ.cjs} +2 -2
- package/dist/{classDiagram-v2-WZHVMYZB-CtIswLAU.js → classDiagram-v2-WZHVMYZB-DW2aCkne.js} +3 -3
- package/dist/components/worldMap/data.d.ts +2 -2
- package/dist/{cose-bilkent-S5V4N54A-CC01Tkem.cjs → cose-bilkent-S5V4N54A-CDJnP_Yk.cjs} +2 -2
- package/dist/{cose-bilkent-S5V4N54A-DzADNsjH.js → cose-bilkent-S5V4N54A-CnTvq6wx.js} +2 -2
- package/dist/{dagre-6UL2VRFP-CDYaaqiU.cjs → dagre-6UL2VRFP-BTjEhGrQ.cjs} +2 -2
- package/dist/{dagre-6UL2VRFP-ybWMcc5w.js → dagre-6UL2VRFP-D4KyzrI8.js} +2 -2
- package/dist/{diagram-PSM6KHXK-CbgHTYSR.js → diagram-PSM6KHXK-CIMfiYz7.js} +5 -5
- package/dist/{diagram-PSM6KHXK-DqhM0iw7.cjs → diagram-PSM6KHXK-H6bEKZLm.cjs} +2 -2
- package/dist/{diagram-QEK2KX5R-CNed7b76.js → diagram-QEK2KX5R-BzuMWDt6.js} +4 -4
- package/dist/{diagram-QEK2KX5R-UQaqb5nU.cjs → diagram-QEK2KX5R-DsFIAL3v.cjs} +2 -2
- package/dist/{diagram-S2PKOQOG-OdSmYpDj.cjs → diagram-S2PKOQOG-CTLNC-Iz.cjs} +2 -2
- package/dist/{diagram-S2PKOQOG-BYSFHhaj.js → diagram-S2PKOQOG-CYvdKVYZ.js} +4 -4
- package/dist/{erDiagram-Q2GNP2WA-D6Xk9c-u.cjs → erDiagram-Q2GNP2WA-B8Cby2EW.cjs} +2 -2
- package/dist/{erDiagram-Q2GNP2WA-l9zKKI29.js → erDiagram-Q2GNP2WA-BcW11SJy.js} +5 -5
- package/dist/{flowDiagram-NV44I4VS-B-5P4uRf.cjs → flowDiagram-NV44I4VS-D447_R3t.cjs} +2 -2
- package/dist/{flowDiagram-NV44I4VS-qlSwOj8Q.js → flowDiagram-NV44I4VS-DEAvKwa7.js} +6 -6
- package/dist/{ganttDiagram-JELNMOA3-BvXDYjE1.cjs → ganttDiagram-JELNMOA3-BHGSOmkk.cjs} +2 -2
- package/dist/{ganttDiagram-JELNMOA3-i4-qMitb.js → ganttDiagram-JELNMOA3-nAqZzkfj.js} +3 -3
- package/dist/gitGraph-G5XIXVHT-BPiaST9T.js +6 -0
- package/dist/{gitGraph-G5XIXVHT-BdOKVbYt.cjs → gitGraph-G5XIXVHT-D0HIYGjj.cjs} +2 -2
- package/dist/{gitGraphDiagram-V2S2FVAM-BFlWQFzy.js → gitGraphDiagram-V2S2FVAM-Bz64qMJx.js} +5 -5
- package/dist/{gitGraphDiagram-V2S2FVAM-DStoHbQA.cjs → gitGraphDiagram-V2S2FVAM-BzDdhr7h.cjs} +2 -2
- package/dist/{index-H1wV1Hpq.js → index-C-Hyw7_i.js} +39 -32
- package/dist/{index-D7xz2-Uy.cjs → index-D5nkqpSD.cjs} +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/info-VBDWY6EO-BLmqoE1d.js +6 -0
- package/dist/{info-VBDWY6EO-D_RrmivC.cjs → info-VBDWY6EO-D5dR6PPz.cjs} +2 -2
- package/dist/{infoDiagram-HS3SLOUP-BnevWU-I.cjs → infoDiagram-HS3SLOUP-Bs3peWgl.cjs} +2 -2
- package/dist/{infoDiagram-HS3SLOUP-BZK0euSr.js → infoDiagram-HS3SLOUP-DDgg8QyI.js} +3 -3
- package/dist/{journeyDiagram-XKPGCS4Q-itaMgi9U.js → journeyDiagram-XKPGCS4Q-COvGJw7y.js} +5 -5
- package/dist/{journeyDiagram-XKPGCS4Q-BODApzJb.cjs → journeyDiagram-XKPGCS4Q-DQFssTKA.cjs} +2 -2
- package/dist/{kanban-definition-3W4ZIXB7-DX8gChMt.js → kanban-definition-3W4ZIXB7-Bm4Nfy8N.js} +3 -3
- package/dist/{kanban-definition-3W4ZIXB7-BY1oKhQF.cjs → kanban-definition-3W4ZIXB7-CQiLQ-MZ.cjs} +2 -2
- package/dist/{linear-cXEFiojf.cjs → linear-CRUR7yE8.cjs} +2 -2
- package/dist/{linear-Pcf3i3zp.js → linear-QB06oWOn.js} +2 -2
- package/dist/{maplibre-gl-BdoOI0bI.cjs → maplibre-gl-BkWxiGfO.cjs} +2 -2
- package/dist/{maplibre-gl-KdF6druQ.js → maplibre-gl-CouexcMM.js} +2 -2
- package/dist/{mermaid-parser.core-Dr6wdKdo.cjs → mermaid-parser.core-BDJaQNLh.cjs} +2 -2
- package/dist/{mermaid-parser.core-B7B_q9yz.js → mermaid-parser.core-DjEhyqCt.js} +2413 -2473
- package/dist/{mindmap-definition-VGOIOE7T-BWtHcwxS.cjs → mindmap-definition-VGOIOE7T-C7Scfjt5.cjs} +2 -2
- package/dist/{mindmap-definition-VGOIOE7T-DB1ivc4U.js → mindmap-definition-VGOIOE7T-Cq5vQrhh.js} +4 -4
- package/dist/{packet-DYOGHKS2-Bc88puEA.cjs → packet-DYOGHKS2-CR7ugQ48.cjs} +2 -2
- package/dist/packet-DYOGHKS2-DYJFb4dv.js +6 -0
- package/dist/{pie-VRWISCQL-BDZOt1dn.cjs → pie-VRWISCQL-BXJW8jKm.cjs} +2 -2
- package/dist/pie-VRWISCQL-Dx65A3Fo.js +6 -0
- package/dist/{pieDiagram-ADFJNKIX-rHRiRGIK.js → pieDiagram-ADFJNKIX-5iZzSJ8R.js} +5 -5
- package/dist/{pieDiagram-ADFJNKIX-BExkCjtp.cjs → pieDiagram-ADFJNKIX-D9M6lhX5.cjs} +2 -2
- package/dist/{quadrantDiagram-AYHSOK5B-Dn_KGYm_.cjs → quadrantDiagram-AYHSOK5B-DDWEpiLt.cjs} +2 -2
- package/dist/{quadrantDiagram-AYHSOK5B-CkVTfka1.js → quadrantDiagram-AYHSOK5B-DG8iuyyj.js} +3 -3
- package/dist/radar-ZZBFDIW7-BAmnMK3b.js +6 -0
- package/dist/{radar-ZZBFDIW7-CN4CW1Sn.cjs → radar-ZZBFDIW7-DvMtYd_q.cjs} +2 -2
- package/dist/{requirementDiagram-UZGBJVZJ-DjP_ZBLH.js → requirementDiagram-UZGBJVZJ-CE1BWtzG.js} +4 -4
- package/dist/{requirementDiagram-UZGBJVZJ-Cnr0krQo.cjs → requirementDiagram-UZGBJVZJ-D8SeZ83D.cjs} +2 -2
- package/dist/{sankeyDiagram-TZEHDZUN-hSdLQwtC.cjs → sankeyDiagram-TZEHDZUN-DM5sLVVS.cjs} +2 -2
- package/dist/{sankeyDiagram-TZEHDZUN-anjZuu_D.js → sankeyDiagram-TZEHDZUN-DtBDd9Wm.js} +2 -2
- package/dist/{sequenceDiagram-WL72ISMW-DmCBPiOU.cjs → sequenceDiagram-WL72ISMW-BpCabHUR.cjs} +2 -2
- package/dist/{sequenceDiagram-WL72ISMW-CVybpZao.js → sequenceDiagram-WL72ISMW-BuykUiJg.js} +4 -4
- package/dist/{stateDiagram-FKZM4ZOC-CkrSnJVo.js → stateDiagram-FKZM4ZOC-D7OtXC8o.js} +3 -3
- package/dist/{stateDiagram-FKZM4ZOC-Dkv9EsDA.cjs → stateDiagram-FKZM4ZOC-cgi0ko-6.cjs} +2 -2
- package/dist/{stateDiagram-v2-4FDKWEC3-ClwE0oA4.cjs → stateDiagram-v2-4FDKWEC3-BGbtkwft.cjs} +2 -2
- package/dist/{stateDiagram-v2-4FDKWEC3-Cqvjxhmg.js → stateDiagram-v2-4FDKWEC3-ljhXua2L.js} +3 -3
- package/dist/{timeline-definition-IT6M3QCI-BVqV4KxZ.js → timeline-definition-IT6M3QCI-BSCNhkIf.js} +3 -3
- package/dist/{timeline-definition-IT6M3QCI-C-NbrBWK.cjs → timeline-definition-IT6M3QCI-DONwhI2c.cjs} +2 -2
- package/dist/{treemap-GDKQZRPO-DPSTeBWV.cjs → treemap-GDKQZRPO-C_BDlIt0.cjs} +2 -2
- package/dist/treemap-GDKQZRPO-DMDbGTv6.js +6 -0
- package/dist/{xychartDiagram-PRI3JC2R-ByRfiz5K.js → xychartDiagram-PRI3JC2R-CK1p_aA_.js} +3 -3
- package/dist/{xychartDiagram-PRI3JC2R-ClwDpfOS.cjs → xychartDiagram-PRI3JC2R-s6lxWNao.cjs} +2 -2
- package/package.json +1 -1
- package/dist/architecture-7HQA4BMR-B7-h10Im.js +0 -6
- package/dist/channel-B1SMUhi0.cjs +0 -2
- package/dist/gitGraph-G5XIXVHT-o_QJiZO1.js +0 -6
- package/dist/info-VBDWY6EO-C4My0e3p.js +0 -6
- package/dist/packet-DYOGHKS2-C_QHQq0u.js +0 -6
- package/dist/pie-VRWISCQL-DHWh56U-.js +0 -6
- package/dist/radar-ZZBFDIW7-HmbC_3ms.js +0 -6
- package/dist/treemap-GDKQZRPO-CGArjxOL.js +0 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t,r,n,i,s,o,a,c,l,u,d,h,p,f,m,g=Object.defineProperty,y=(e,t,r)=>((e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const T=require("lodash-es"),v=require("./index-D7xz2-Uy.cjs"),R=require("./_arrayEach-D4zuu96h.cjs");function E(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$type}function S(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$refText&&"ref"in e}function k(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$refText&&"items"in e}function C(e){return"object"==typeof e&&null!==e&&"object"==typeof e.info&&"string"==typeof e.message}class A{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){var t;const r=this.types[e.container.$type];if(!r)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const n=null==(t=r.properties[e.property])?void 0:t.referenceType;if(!n)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return n}getTypeMetaData(e){const t=this.types[e];return t||{name:e,properties:{},superTypes:[]}}isInstance(e,t){return E(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const n=r[t];if(void 0!==n)return n;{const n=this.types[e],i=!!n&&n.superTypes.some(e=>this.isSubtype(e,t));return r[t]=i,i}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const t=this.getAllTypes(),r=[];for(const n of t)this.isSubtype(n,e)&&r.push(n);return this.allSubtypes[e]=r,r}}}function b(e){return"object"==typeof e&&null!==e&&Array.isArray(e.content)}function $(e){return"object"==typeof e&&null!==e&&"object"==typeof e.tokenType}function x(e){return b(e)&&"string"==typeof e.fullText}class w{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,r=e.next();for(;!r.done;)t++,r=e.next();return t}toArray(){const e=[],t=this.iterator();let r;do{r=t.next(),void 0!==r.value&&e.push(r.value)}while(!r.done);return e}toSet(){return new Set(this)}toMap(e,t){const r=this.map(r=>[e?e(r):r,t?t(r):r]);return new Map(r)}toString(){return this.join()}concat(e){return new w(()=>({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 P})}join(e=","){const t=this.iterator();let r,n="",i=!1;do{r=t.next(),r.done||(i&&(n+=e),n+=N(r.value)),i=!0}while(!r.done);return n}indexOf(e,t=0){const r=this.iterator();let n=0,i=r.next();for(;!i.done;){if(n>=t&&i.value===e)return n;i=r.next(),n++}return-1}every(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(!e(r.value))return!1;r=t.next()}return!0}some(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return!0;r=t.next()}return!1}forEach(e){const t=this.iterator();let r=0,n=t.next();for(;!n.done;)e(n.value,r),n=t.next(),r++}map(e){return new w(this.startFn,t=>{const{done:r,value:n}=this.nextFn(t);return r?P:{done:!1,value:e(n)}})}filter(e){return new w(this.startFn,t=>{let r;do{if(r=this.nextFn(t),!r.done&&e(r.value))return r}while(!r.done);return P})}nonNullable(){return this.filter(e=>null!=e)}reduce(e,t){const r=this.iterator();let n=t,i=r.next();for(;!i.done;)n=void 0===n?i.value:e(n,i.value),i=r.next();return n}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,r){const n=e.next();if(n.done)return r;const i=this.recursiveReduce(e,t,r);return void 0===i?n.value:t(i,n.value)}find(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return r.value;r=t.next()}}findIndex(e){const t=this.iterator();let r=0,n=t.next();for(;!n.done;){if(e(n.value))return r;n=t.next(),r++}return-1}includes(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(r.value===e)return!0;r=t.next()}return!1}flatMap(e){return new w(()=>({this:this.startFn()}),t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}const{done:r,value:n}=this.nextFn(t.this);if(!r){const r=e(n);if(!I(r))return{done:!1,value:r};t.iterator=r[Symbol.iterator]()}}while(t.iterator);return P})}flat(e){if(void 0===e&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new w(()=>({this:t.startFn()}),e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}const{done:r,value:n}=t.nextFn(e.this);if(!r){if(!I(n))return{done:!1,value:n};e.iterator=n[Symbol.iterator]()}}while(e.iterator);return P})}head(){const e=this.iterator().next();if(!e.done)return e.value}tail(e=1){return new w(()=>{const t=this.startFn();for(let r=0;r<e;r++){if(this.nextFn(t).done)return t}return t},this.nextFn)}limit(e){return new w(()=>({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?P:this.nextFn(t.state)))}distinct(e){return new w(()=>({set:new Set,internalState:this.startFn()}),t=>{let r;do{if(r=this.nextFn(t.internalState),!r.done){const n=e?e(r.value):r.value;if(!t.set.has(n))return t.set.add(n),r}}while(!r.done);return P})}exclude(e,t){const r=new Set;for(const n of e){const e=t?t(n):n;r.add(e)}return this.filter(e=>{const n=t?t(e):e;return!r.has(n)})}}function N(e){return"string"==typeof e?e:void 0===e?"undefined":"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}function I(e){return!!e&&"function"==typeof e[Symbol.iterator]}const _=new w(()=>{},()=>P),P=Object.freeze({done:!0,value:void 0});function L(...e){if(1===e.length){const t=e[0];if(t instanceof w)return t;if(I(t))return new w(()=>t[Symbol.iterator](),e=>e.next());if("number"==typeof t.length)return new w(()=>({index:0}),e=>e.index<t.length?{done:!1,value:t[e.index++]}:P)}return e.length>1?new w(()=>({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 r=e[t.collIndex++];I(r)?t.iterator=r[Symbol.iterator]():r&&"number"==typeof r.length&&(t.array=r)}}while(t.iterator||t.array||t.collIndex<e.length);return P}):_}class O extends w{constructor(e,t,r){super(()=>({iterators:(null==r?void 0:r.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 r=e.iterators[e.iterators.length-1].next();if(!r.done)return e.iterators.push(t(r.value)[Symbol.iterator]()),r;e.iterators.pop()}return P})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var D,M;function F(e,t={}){for(const[r,n]of Object.entries(e))r.startsWith("$")||(Array.isArray(n)?n.forEach((n,i)=>{E(n)&&(n.$container=e,n.$containerProperty=r,n.$containerIndex=i,t.deep&&F(n,t))}):E(n)&&(n.$container=e,n.$containerProperty=r,t.deep&&F(n,t)))}function q(e,t){let r=e;for(;r;){if(t(r))return r;r=r.$container}}function j(e){const t=U(e).$document;if(!t)throw new Error("AST node has no document.");return t}function U(e){for(;e.$container;)e=e.$container;return e}function G(e){return S(e)?e.ref?[e.ref]:[]:k(e)?e.items.map(e=>e.ref):[]}function z(e,t){if(!e)throw new Error("Node must be an AstNode.");const r=null==t?void 0:t.range;return new w(()=>({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 i=e[n];if(E(i)){if(t.keyIndex++,W(i,r))return{done:!1,value:i}}else if(Array.isArray(i)){for(;t.arrayIndex<i.length;){const e=i[t.arrayIndex++];if(E(e)&&W(e,r))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return P})}function B(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new O(e,e=>z(e,t))}function K(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new O(e,e=>z(e,t),{includeRoot:!0})}function W(e,t){var r;if(!t)return!0;const n=null==(r=e.$cstNode)?void 0:r.range;return!!n&&function(e,t){const r=function(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return Ln.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return Ln.After;const r=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,n=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return r&&n?Ln.Inside:r?Ln.OverlapBack:n?Ln.OverlapFront:Ln.Outside}(e,t);return r>Ln.After}(n,t)}function V(e){return new w(()=>({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 n=e[r];if(S(n)||k(n))return t.keyIndex++,{done:!1,value:{reference:n,container:e,property:r}};if(Array.isArray(n)){for(;t.arrayIndex<n.length;){const i=t.arrayIndex++,s=n[i];if(S(s)||k(n))return{done:!1,value:{reference:s,container:e,property:r,index:i}}}t.arrayIndex=0}}t.keyIndex++}return P})}function H(e){return Array.isArray(e)?[...e.map(H)]:e}(M=D||(D={})).sum=function(e){return e.reduce((e,t)=>e+t,0)},M.product=function(e){return e.reduce((e,t)=>e*t,0)},M.min=function(e){return e.reduce((e,t)=>Math.min(e,t))},M.max=function(e){return e.reduce((e,t)=>Math.max(e,t))};const Y="AbstractElement",X="cardinality";function J(e){return Nn.isInstance(e,Y)}const Z="AbstractParserRule";function Q(e){return Nn.isInstance(e,Z)}const ee="AbstractRule",te="AbstractType",re="Action",ne="cardinality",ie="feature",se="inferredType",oe="operator",ae="type";function ce(e){return Nn.isInstance(e,re)}const le="Alternatives",ue="cardinality",de="elements";function he(e){return Nn.isInstance(e,le)}const pe="ArrayLiteral",fe="elements",me="ArrayType",ge="elementType",ye="Assignment",Te="cardinality",ve="feature",Re="operator",Ee="predicate",Se="terminal";function ke(e){return Nn.isInstance(e,ye)}const Ce="BooleanLiteral",Ae="true";const be="CharacterRange",$e="cardinality",xe="left",we="lookahead",Ne="parenthesized",Ie="right";const _e="Condition",Pe="Conjunction",Le="left",Oe="right";const De="CrossReference",Me="cardinality",Fe="deprecatedSyntax",qe="isMulti",je="terminal",Ue="type";function Ge(e){return Nn.isInstance(e,De)}const ze="Disjunction",Be="left",Ke="right";const We="EndOfFile",Ve="cardinality";const He="Grammar",Ye="imports",Xe="interfaces",Je="isDeclared",Ze="name",Qe="rules",et="types",tt="GrammarImport",rt="path",nt="Group",it="cardinality",st="elements",ot="guardCondition",at="predicate";function ct(e){return Nn.isInstance(e,nt)}const lt="InferredType",ut="name";function dt(e){return Nn.isInstance(e,lt)}const ht="InfixRule",pt="call",ft="dataType",mt="inferredType",gt="name",yt="operators",Tt="parameters",vt="returnType";function Rt(e){return Nn.isInstance(e,ht)}const Et="InfixRuleOperatorList",St="associativity",kt="operators",Ct="InfixRuleOperators",At="precedences",bt="Interface",$t="attributes",xt="name",wt="superTypes";const Nt="Keyword",It="cardinality",_t="predicate",Pt="value";function Lt(e){return Nn.isInstance(e,Nt)}const Ot="NamedArgument",Dt="calledByName",Mt="parameter",Ft="value",qt="NegatedToken",jt="cardinality",Ut="lookahead",Gt="parenthesized",zt="terminal";const Bt="Negation",Kt="value";const Wt="NumberLiteral",Vt="value",Ht="Parameter",Yt="name",Xt="ParameterReference",Jt="parameter";const Zt="ParserRule",Qt="dataType",er="definition",tr="entry",rr="fragment",nr="inferredType",ir="name",sr="parameters",or="returnType";function ar(e){return Nn.isInstance(e,Zt)}const cr="ReferenceType",lr="isMulti",ur="referenceType",dr="RegexToken",hr="cardinality",pr="lookahead",fr="parenthesized",mr="regex";const gr="ReturnType",yr="name";const Tr="RuleCall",vr="arguments",Rr="cardinality",Er="predicate",Sr="rule";function kr(e){return Nn.isInstance(e,Tr)}const Cr="SimpleType",Ar="primitiveType",br="stringType",$r="typeRef";function xr(e){return Nn.isInstance(e,Cr)}const wr="StringLiteral",Nr="value",Ir="TerminalAlternatives",_r="cardinality",Pr="elements",Lr="lookahead",Or="parenthesized";const Dr="TerminalElement",Mr="cardinality",Fr="lookahead",qr="parenthesized",jr="TerminalGroup",Ur="cardinality",Gr="elements",zr="lookahead",Br="parenthesized";const Kr="TerminalRule",Wr="definition",Vr="fragment",Hr="hidden",Yr="name",Xr="type";function Jr(e){return Nn.isInstance(e,Kr)}const Zr="TerminalRuleCall",Qr="cardinality",en="lookahead",tn="parenthesized",rn="rule";const nn="Type",sn="name",on="type";const an="TypeAttribute",cn="defaultValue",ln="isOptional",un="name",dn="type",hn="TypeDefinition",pn="UnionType",fn="types",mn="UnorderedGroup",gn="cardinality",yn="elements";function Tn(e){return Nn.isInstance(e,mn)}const vn="UntilToken",Rn="cardinality",En="lookahead",Sn="parenthesized",kn="terminal";const Cn="ValueLiteral",An="Wildcard",bn="cardinality",$n="lookahead",xn="parenthesized";class wn extends A{constructor(){super(...arguments),this.types={AbstractElement:{name:Y,properties:{cardinality:{name:X}},superTypes:[]},AbstractParserRule:{name:Z,properties:{},superTypes:[ee,te]},AbstractRule:{name:ee,properties:{},superTypes:[]},AbstractType:{name:te,properties:{},superTypes:[]},Action:{name:re,properties:{cardinality:{name:ne},feature:{name:ie},inferredType:{name:se},operator:{name:oe},type:{name:ae,referenceType:te}},superTypes:[Y]},Alternatives:{name:le,properties:{cardinality:{name:ue},elements:{name:de,defaultValue:[]}},superTypes:[Y]},ArrayLiteral:{name:pe,properties:{elements:{name:fe,defaultValue:[]}},superTypes:[Cn]},ArrayType:{name:me,properties:{elementType:{name:ge}},superTypes:[hn]},Assignment:{name:ye,properties:{cardinality:{name:Te},feature:{name:ve},operator:{name:Re},predicate:{name:Ee},terminal:{name:Se}},superTypes:[Y]},BooleanLiteral:{name:Ce,properties:{true:{name:Ae,defaultValue:!1}},superTypes:[_e,Cn]},CharacterRange:{name:be,properties:{cardinality:{name:$e},left:{name:xe},lookahead:{name:we},parenthesized:{name:Ne,defaultValue:!1},right:{name:Ie}},superTypes:[Dr]},Condition:{name:_e,properties:{},superTypes:[]},Conjunction:{name:Pe,properties:{left:{name:Le},right:{name:Oe}},superTypes:[_e]},CrossReference:{name:De,properties:{cardinality:{name:Me},deprecatedSyntax:{name:Fe,defaultValue:!1},isMulti:{name:qe,defaultValue:!1},terminal:{name:je},type:{name:Ue,referenceType:te}},superTypes:[Y]},Disjunction:{name:ze,properties:{left:{name:Be},right:{name:Ke}},superTypes:[_e]},EndOfFile:{name:We,properties:{cardinality:{name:Ve}},superTypes:[Y]},Grammar:{name:He,properties:{imports:{name:Ye,defaultValue:[]},interfaces:{name:Xe,defaultValue:[]},isDeclared:{name:Je,defaultValue:!1},name:{name:Ze},rules:{name:Qe,defaultValue:[]},types:{name:et,defaultValue:[]}},superTypes:[]},GrammarImport:{name:tt,properties:{path:{name:rt}},superTypes:[]},Group:{name:nt,properties:{cardinality:{name:it},elements:{name:st,defaultValue:[]},guardCondition:{name:ot},predicate:{name:at}},superTypes:[Y]},InferredType:{name:lt,properties:{name:{name:ut}},superTypes:[te]},InfixRule:{name:ht,properties:{call:{name:pt},dataType:{name:ft},inferredType:{name:mt},name:{name:gt},operators:{name:yt},parameters:{name:Tt,defaultValue:[]},returnType:{name:vt,referenceType:te}},superTypes:[Z]},InfixRuleOperatorList:{name:Et,properties:{associativity:{name:St},operators:{name:kt,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:Ct,properties:{precedences:{name:At,defaultValue:[]}},superTypes:[]},Interface:{name:bt,properties:{attributes:{name:$t,defaultValue:[]},name:{name:xt},superTypes:{name:wt,defaultValue:[],referenceType:te}},superTypes:[te]},Keyword:{name:Nt,properties:{cardinality:{name:It},predicate:{name:_t},value:{name:Pt}},superTypes:[Y]},NamedArgument:{name:Ot,properties:{calledByName:{name:Dt,defaultValue:!1},parameter:{name:Mt,referenceType:Ht},value:{name:Ft}},superTypes:[]},NegatedToken:{name:qt,properties:{cardinality:{name:jt},lookahead:{name:Ut},parenthesized:{name:Gt,defaultValue:!1},terminal:{name:zt}},superTypes:[Dr]},Negation:{name:Bt,properties:{value:{name:Kt}},superTypes:[_e]},NumberLiteral:{name:Wt,properties:{value:{name:Vt}},superTypes:[Cn]},Parameter:{name:Ht,properties:{name:{name:Yt}},superTypes:[]},ParameterReference:{name:Xt,properties:{parameter:{name:Jt,referenceType:Ht}},superTypes:[_e]},ParserRule:{name:Zt,properties:{dataType:{name:Qt},definition:{name:er},entry:{name:tr,defaultValue:!1},fragment:{name:rr,defaultValue:!1},inferredType:{name:nr},name:{name:ir},parameters:{name:sr,defaultValue:[]},returnType:{name:or,referenceType:te}},superTypes:[Z]},ReferenceType:{name:cr,properties:{isMulti:{name:lr,defaultValue:!1},referenceType:{name:ur}},superTypes:[hn]},RegexToken:{name:dr,properties:{cardinality:{name:hr},lookahead:{name:pr},parenthesized:{name:fr,defaultValue:!1},regex:{name:mr}},superTypes:[Dr]},ReturnType:{name:gr,properties:{name:{name:yr}},superTypes:[]},RuleCall:{name:Tr,properties:{arguments:{name:vr,defaultValue:[]},cardinality:{name:Rr},predicate:{name:Er},rule:{name:Sr,referenceType:ee}},superTypes:[Y]},SimpleType:{name:Cr,properties:{primitiveType:{name:Ar},stringType:{name:br},typeRef:{name:$r,referenceType:te}},superTypes:[hn]},StringLiteral:{name:wr,properties:{value:{name:Nr}},superTypes:[Cn]},TerminalAlternatives:{name:Ir,properties:{cardinality:{name:_r},elements:{name:Pr,defaultValue:[]},lookahead:{name:Lr},parenthesized:{name:Or,defaultValue:!1}},superTypes:[Dr]},TerminalElement:{name:Dr,properties:{cardinality:{name:Mr},lookahead:{name:Fr},parenthesized:{name:qr,defaultValue:!1}},superTypes:[Y]},TerminalGroup:{name:jr,properties:{cardinality:{name:Ur},elements:{name:Gr,defaultValue:[]},lookahead:{name:zr},parenthesized:{name:Br,defaultValue:!1}},superTypes:[Dr]},TerminalRule:{name:Kr,properties:{definition:{name:Wr},fragment:{name:Vr,defaultValue:!1},hidden:{name:Hr,defaultValue:!1},name:{name:Yr},type:{name:Xr}},superTypes:[ee]},TerminalRuleCall:{name:Zr,properties:{cardinality:{name:Qr},lookahead:{name:en},parenthesized:{name:tn,defaultValue:!1},rule:{name:rn,referenceType:Kr}},superTypes:[Dr]},Type:{name:nn,properties:{name:{name:sn},type:{name:on}},superTypes:[te]},TypeAttribute:{name:an,properties:{defaultValue:{name:cn},isOptional:{name:ln,defaultValue:!1},name:{name:un},type:{name:dn}},superTypes:[]},TypeDefinition:{name:hn,properties:{},superTypes:[]},UnionType:{name:pn,properties:{types:{name:fn,defaultValue:[]}},superTypes:[hn]},UnorderedGroup:{name:mn,properties:{cardinality:{name:gn},elements:{name:yn,defaultValue:[]}},superTypes:[Y]},UntilToken:{name:vn,properties:{cardinality:{name:Rn},lookahead:{name:En},parenthesized:{name:Sn,defaultValue:!1},terminal:{name:kn}},superTypes:[Dr]},ValueLiteral:{name:Cn,properties:{},superTypes:[]},Wildcard:{name:An,properties:{cardinality:{name:bn},lookahead:{name:$n},parenthesized:{name:xn,defaultValue:!1}},superTypes:[Dr]}}}}const Nn=new wn;function In(e){return new O(e,e=>b(e)?e.content:[],{includeRoot:!0})}function _n(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function Pn(e){if(!e)return;const{offset:t,end:r,range:n}=e;return{range:n,offset:t,end:r,length:r-t}}var Ln,On;(On=Ln||(Ln={}))[On.Before=0]="Before",On[On.After=1]="After",On[On.OverlapFront=2]="OverlapFront",On[On.OverlapBack=3]="OverlapBack",On[On.Inside=4]="Inside",On[On.Outside=5]="Outside";const Dn=/^[\w\p{L}]$/u;function Mn(e,t){return $(e)&&t.includes(e.tokenType.name)}class Fn extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function qn(e,t="Error: Got unexpected value."){throw new Error(t)}function jn(e){return e.charCodeAt(0)}function Un(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function Gn(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function zn(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function Bn(e){return"Character"===e.type}const Kn=[];for(let xS=jn("0");xS<=jn("9");xS++)Kn.push(xS);const Wn=[jn("_")].concat(Kn);for(let xS=jn("a");xS<=jn("z");xS++)Wn.push(xS);for(let xS=jn("A");xS<=jn("Z");xS++)Wn.push(xS);const Vn=[jn(" "),jn("\f"),jn("\n"),jn("\r"),jn("\t"),jn("\v"),jn("\t"),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn("\u2028"),jn("\u2029"),jn(" "),jn(" "),jn(" "),jn("\ufeff")],Hn=/[0-9a-fA-F]/,Yn=/[0-9]/,Xn=/[1-9]/;class Jn{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 r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Gn(r,"global");break;case"i":Gn(r,"ignoreCase");break;case"m":Gn(r,"multiLine");break;case"u":Gn(r,"unicode");break;case"y":Gn(r,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,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";break;case"<":switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}}zn(t);const r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return function(){throw Error("Internal Error - Should never get here!")}()}quantifier(e=!1){let t;const r=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 r=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:r,atMost:r};break;case",":let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:r,atMost:e}):t={atLeast:r,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;zn(t)}if(!0!==e||void 0!==t)return zn(t)?("?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),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()),zn(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[jn("\n"),jn("\r"),jn("\u2028"),jn("\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=Kn;break;case"D":e=Kn,t=!0;break;case"s":e=Vn;break;case"S":e=Vn,t=!0;break;case"w":e=Wn;break;case"W":e=Wn,t=!0}if(zn(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=jn("\f");break;case"n":e=jn("\n");break;case"r":e=jn("\r");break;case"t":e=jn("\t");break;case"v":e=jn("\v")}if(zn(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:jn("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:jn(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:jn(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,Bn(t)&&this.isRangeDash()){this.consumeChar("-");const r=this.classAtom();if(r.type,Bn(r)){if(r.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:r.value})}else Un(t.value,e),e.push(jn("-")),Un(r.value,e)}else Un(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:jn("\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 r={type:"Group",capturing:e,value:t};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(!1===Xn.test(e))throw Error("Expecting a positive integer");for(;Yn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===Yn.test(e))throw Error("Expecting an integer");for(;Yn.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:jn(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 Yn.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)||"<"===this.peekChar(2)&&("="===this.peekChar(3)||"!"===this.peekChar(3)));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 r=0;r<e;r++){const e=this.popChar();if(!1===Hn.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 Zn{visitChildren(e){for(const t in e){const r=e[t];e.hasOwnProperty(t)&&(void 0!==r.type?this.visit(r):Array.isArray(r)&&r.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"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const Qn=/\r?\n/gm,ei=new Jn;const ti=new class extends Zn{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=si(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),r=new RegExp(t);this.multiline=Boolean("\n".match(r))}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 ri(e){try{return"string"==typeof e&&(e=new RegExp(e)),e=e.toString(),ti.reset(e),ti.visit(ei.pattern(e)),ti.multiline}catch{return!1}}const ni="\f\n\r\t\v \u2028\u2029 \ufeff".split("");function ii(e){const t="string"==typeof e?new RegExp(e):e;return ni.some(e=>t.test(e))}function si(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oi(e,t){const r=function(e){"string"==typeof e&&(e=new RegExp(e));const t=e,r=e.source;let n=0;function i(){let e,s="";function o(e){s+=r.substr(n,e),n+=e}function a(e){s+="(?:"+r.substr(n,e)+"|$)",n+=e}for(;n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":a(3);break;case"x":a(4);break;case"u":t.unicode?"{"===r[n+2]?a(r.indexOf("}",n)-n+1):a(6):a(2);break;case"p":case"P":t.unicode?a(r.indexOf("}",n)-n+1):a(2);break;case"k":a(r.indexOf(">",n)-n+1);break;default:a(2)}break;case"[":e=/\[(?:\\.|.)*?\]/g,e.lastIndex=n,e=e.exec(r)||[],a(e[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":e=/\{\d+,?\d*\}/g,e.lastIndex=n,e=e.exec(r),e?o(e[0].length):a(1);break;case"(":if("?"===r[n+1])switch(r[n+2]){case":":s+="(?:",n+=3,s+=i()+"|$)";break;case"=":s+="(?=",n+=3,s+=i()+")";break;case"!":e=n,n+=3,i(),s+=r.substr(e,n-e);break;case"<":switch(r[n+3]){case"=":case"!":e=n,n+=4,i(),s+=r.substr(e,n-e);break;default:o(r.indexOf(">",n)-n+1),s+=i()+"|$)"}}else o(1),s+=i()+"|$)";break;case")":return++n,s;default:a(1)}return s}return new RegExp(i(),e.flags)}(e),n=t.match(r);return!!n&&n[0].length>0}function ai(e,t){const r=new Set,n=function(e){return e.rules.find(e=>ar(e)&&e.entry)}(e);if(!n)return new Set(e.rules);const i=[n].concat(function(e){return e.rules.filter(e=>Jr(e)&&e.hidden)}(e));for(const o of i)ci(o,r,t);const s=new Set;for(const o of e.rules)(r.has(o.name)||Jr(o)&&o.hidden)&&s.add(o);return s}function ci(e,t,r){t.add(e.name),B(e).forEach(e=>{if(kr(e)||r){const n=e.rule.ref;n&&!t.has(n.name)&&ci(n,t,r)}})}function li(e){return e.hidden&&!ii(vi(e))}function ui(e,t,r){if(!e||!t)return;const n=di(e,t,e.astNode,!0);return 0!==n.length?n[r=void 0!==r?Math.max(0,Math.min(r,n.length-1)):0]:void 0}function di(e,t,r,n){if(!n){const r=q(e.grammarSource,ke);if(r&&r.feature===t)return[e]}return b(e)&&e.astNode===r?e.content.flatMap(e=>di(e,t,r,!1)):[]}function hi(e,t,r){if(!e)return;const n=function(e,t,r){if(e.astNode!==r)return[];if(Lt(e.grammarSource)&&e.grammarSource.value===t)return[e];const n=In(e).iterator();let i;const s=[];do{if(i=n.next(),!i.done){const e=i.value;e.astNode===r?Lt(e.grammarSource)&&e.grammarSource.value===t&&s.push(e):n.prune()}}while(!i.done);return s}(e,t,null==e?void 0:e.astNode);return 0!==n.length?n[r=void 0!==r?Math.max(0,Math.min(r,n.length-1)):0]:void 0}function pi(e){let t=e;return dt(t)&&(ce(t.$container)?t=t.$container.$container:Q(t.$container)?t=t.$container:qn(t.$container)),fi(e,t,new Map)}function fi(e,t,r){var n;function i(t,n){let i;return q(t,ke)||(i=fi(n,n,r)),r.set(e,i),i}if(r.has(e))return r.get(e);r.set(e,void 0);for(const s of B(t)){if(ke(s)&&"name"===s.feature.toLowerCase())return r.set(e,s),s;if(kr(s)&&ar(s.rule.ref))return i(s,s.rule.ref);if(xr(s)&&(null==(n=s.typeRef)?void 0:n.ref))return i(s,s.typeRef.ref)}}function mi(e){return gi(e,new Set)}function gi(e,t){if(t.has(e))return!0;t.add(e);for(const r of B(e))if(kr(r)){if(!r.rule.ref)return!1;if(ar(r.rule.ref)&&!gi(r.rule.ref,t))return!1;if(Rt(r.rule.ref))return!1}else{if(ke(r))return!1;if(ce(r))return!1}return Boolean(e.definition)}function yi(e){if(!Jr(e)){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){const t=e.returnType.ref;if(t)return t.name}}}function Ti(e){if(Q(e))return ar(e)&&mi(e)?e.name:yi(e)??e.name;if(t=e,Nn.isInstance(t,bt)||function(e){return Nn.isInstance(e,nn)}(e)||function(e){return Nn.isInstance(e,gr)}(e))return e.name;if(ce(e)){const t=function(e){var t;if(e.inferredType)return e.inferredType.name;if(null==(t=e.type)?void 0:t.ref)return Ti(e.type.ref);return}(e);if(t)return t}else if(dt(e))return e.name;var t;throw new Error("Cannot get name of Unknown Type")}function vi(e){const t={s:!1,i:!1,u:!1},r=Ei(e.definition,t),n=Object.entries(t).filter(([,e])=>e).map(([e])=>e).join("");return new RegExp(r,n)}const Ri=/[\s\S]/.source;function Ei(e,t){var r,n,i,s,o,a;if(a=e,Nn.isInstance(a,Ir))return ki((o=e).elements.map(e=>Ei(e)).join("|"),{cardinality:o.cardinality,lookahead:o.lookahead,parenthesized:o.parenthesized,wrap:!1});if(function(e){return Nn.isInstance(e,jr)}(e))return ki((s=e).elements.map(e=>Ei(e)).join(""),{cardinality:s.cardinality,lookahead:s.lookahead,parenthesized:s.parenthesized,wrap:!1});if(function(e){return Nn.isInstance(e,be)}(e))return function(e){if(e.right)return ki(`[${Si(e.left)}-${Si(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1});return ki(Si(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}(e);if(function(e){return Nn.isInstance(e,Zr)}(e)){const t=e.rule.ref;if(!t)throw new Error("Missing rule reference.");return ki(Ei(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}if(function(e){return Nn.isInstance(e,qt)}(e))return ki(`(?!${Ei((i=e).terminal)})${Ri}*?`,{cardinality:i.cardinality,lookahead:i.lookahead,parenthesized:i.parenthesized});if(function(e){return Nn.isInstance(e,vn)}(e))return ki(`${Ri}*?${Ei((n=e).terminal)}`,{cardinality:n.cardinality,lookahead:n.lookahead,parenthesized:n.parenthesized});if(function(e){return Nn.isInstance(e,dr)}(e)){const r=e.regex.lastIndexOf("/"),n=e.regex.substring(1,r),i=e.regex.substring(r+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),ki(n,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}if(function(e){return Nn.isInstance(e,An)}(e))return ki(Ri,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized});throw new Error(`Invalid terminal element: ${null==e?void 0:e.$type}, ${null==(r=null==e?void 0:e.$cstNode)?void 0:r.text}`)}function Si(e){return si(e.value)}function ki(e,t){if(t.parenthesized||t.lookahead||!1!==t.wrap){e=`(${t.lookahead??(t.parenthesized?"":"?:")}${e})`}return t.cardinality?`${e}${t.cardinality}`:e}function Ci(e){console&&console.error&&console.error(`Error: ${e}`)}function Ai(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function bi(e){const t=(new Date).getTime(),r=e();return{time:(new Date).getTime()-t,value:r}}function $i(e){function t(){}t.prototype=e;const r=new t;function n(){return typeof r.bar}return n(),n(),e}function xi(e){return t=e,T.isString(t.LABEL)&&""!==t.LABEL?e.LABEL:e.name;var t}class wi{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),T.forEach(this.definition,t=>{t.accept(e)})}}class Ni extends wi{constructor(e){super([]),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Ii extends wi{constructor(e){super(e.definition),this.orgText="",T.assign(this,T.pickBy(e,e=>void 0!==e))}}class _i extends wi{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}let Pi=class extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}};class Li extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Oi extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Di extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Mi extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Fi extends wi{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,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class qi{constructor(e){this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}accept(e){e.visit(this)}}function ji(e){function t(e){return T.map(e,ji)}if(e instanceof Ni){const t={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return T.isString(e.label)&&(t.label=e.label),t}if(e instanceof _i)return{type:"Alternative",definition:t(e.definition)};if(e instanceof Pi)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof Li)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof Oi)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:ji(new qi({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Mi)return{type:"RepetitionWithSeparator",idx:e.idx,separator:ji(new qi({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Di)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof Fi)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof qi){const t={type:"Terminal",name:e.terminalType.name,label:xi(e.terminalType),idx:e.idx};T.isString(e.label)&&(t.terminalLabel=e.label);const r=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=T.isRegExp(r)?r.source:r),t}if(e instanceof Ii)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}class Ui{visit(e){const t=e;switch(t.constructor){case Ni:return this.visitNonTerminal(t);case _i:return this.visitAlternative(t);case Pi:return this.visitOption(t);case Li:return this.visitRepetitionMandatory(t);case Oi:return this.visitRepetitionMandatoryWithSeparator(t);case Mi:return this.visitRepetitionWithSeparator(t);case Di:return this.visitRepetition(t);case Fi:return this.visitAlternation(t);case qi:return this.visitTerminal(t);case Ii: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 Gi(e,t=[]){return!!(e instanceof Pi||e instanceof Di||e instanceof Mi)||(e instanceof Fi?T.some(e.definition,e=>Gi(e,t)):!(e instanceof Ni&&T.includes(t,e))&&(e instanceof wi&&(e instanceof Ni&&t.push(e),T.every(e.definition,e=>Gi(e,t)))))}function zi(e){if(e instanceof Ni)return"SUBRULE";if(e instanceof Pi)return"OPTION";if(e instanceof Fi)return"OR";if(e instanceof Li)return"AT_LEAST_ONE";if(e instanceof Oi)return"AT_LEAST_ONE_SEP";if(e instanceof Mi)return"MANY_SEP";if(e instanceof Di)return"MANY";if(e instanceof qi)return"CONSUME";throw Error("non exhaustive match")}class Bi{walk(e,t=[]){T.forEach(e.definition,(r,n)=>{const i=T.drop(e.definition,n+1);if(r instanceof Ni)this.walkProdRef(r,i,t);else if(r instanceof qi)this.walkTerminal(r,i,t);else if(r instanceof _i)this.walkFlat(r,i,t);else if(r instanceof Pi)this.walkOption(r,i,t);else if(r instanceof Li)this.walkAtLeastOne(r,i,t);else if(r instanceof Oi)this.walkAtLeastOneSep(r,i,t);else if(r instanceof Mi)this.walkManySep(r,i,t);else if(r instanceof Di)this.walkMany(r,i,t);else{if(!(r instanceof Fi))throw Error("non exhaustive match");this.walkOr(r,i,t)}})}walkTerminal(e,t,r){}walkProdRef(e,t,r){}walkFlat(e,t,r){const n=t.concat(r);this.walk(e,n)}walkOption(e,t,r){const n=t.concat(r);this.walk(e,n)}walkAtLeastOne(e,t,r){const n=[new Pi({definition:e.definition})].concat(t,r);this.walk(e,n)}walkAtLeastOneSep(e,t,r){const n=Ki(e,t,r);this.walk(e,n)}walkMany(e,t,r){const n=[new Pi({definition:e.definition})].concat(t,r);this.walk(e,n)}walkManySep(e,t,r){const n=Ki(e,t,r);this.walk(e,n)}walkOr(e,t,r){const n=t.concat(r);T.forEach(e.definition,e=>{const t=new _i({definition:[e]});this.walk(t,n)})}}function Ki(e,t,r){return[new Pi({definition:[new qi({terminalType:e.separator})].concat(e.definition)})].concat(t,r)}function Wi(e){if(e instanceof Ni)return Wi(e.referencedRule);if(e instanceof qi)return[e.terminalType];if(function(e){return e instanceof _i||e instanceof Pi||e instanceof Di||e instanceof Li||e instanceof Oi||e instanceof Mi||e instanceof qi||e instanceof Ii}(e))return function(e){let t=[];const r=e.definition;let n,i=0,s=r.length>i,o=!0;for(;s&&o;)n=r[i],o=Gi(n),t=t.concat(Wi(n)),i+=1,s=r.length>i;return T.uniq(t)}(e);if(function(e){return e instanceof Fi}(e))return function(e){const t=T.map(e.definition,e=>Wi(e));return T.uniq(T.flatten(t))}(e);throw Error("non exhaustive match")}const Vi="_~IN~_";class Hi extends Bi{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,r){}walkProdRef(e,t,r){const n=(i=e.referencedRule,s=e.idx,i.name+s+Vi+this.topProd.name);var i,s;const o=t.concat(r),a=Wi(new _i({definition:o}));this.follows[n]=a}}let Yi={};const Xi=new Jn;function Ji(e){const t=e.toString();if(Yi.hasOwnProperty(t))return Yi[t];{const e=Xi.pattern(t);return Yi[t]=e,e}}const Zi="Complement Sets are not supported for first char optimization",Qi='Unable to use "first char" lexer optimizations:\n';function es(e,t=!1){try{const t=Ji(e);return ts(t.value,{},t.flags.ignoreCase)}catch(r){if(r.message===Zi)t&&Ai(`${Qi}\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 r="";t&&(r="\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."),Ci(`${Qi}\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`+r)}}return[]}function ts(e,t,r){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)ts(e.value[i],t,r);break;case"Alternative":const n=e.value;for(let e=0;e<n.length;e++){const i=n[e];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=i;switch(s.type){case"Character":rs(s.value,t,r);break;case"Set":if(!0===s.complement)throw Error(Zi);T.forEach(s.value,e=>{if("number"==typeof e)rs(e,t,r);else{const n=e;if(!0===r)for(let e=n.from;e<=n.to;e++)rs(e,t,r);else{for(let e=n.from;e<=n.to&&e<Cs;e++)rs(e,t,r);if(n.to>=Cs){const e=n.from>=Cs?n.from:Cs,r=n.to,i=bs(e),s=bs(r);for(let n=i;n<=s;n++)t[n]=n}}}});break;case"Group":ts(s.value,t,r);break;default:throw Error("Non Exhaustive Match")}const o=void 0!==s.quantifier&&0===s.quantifier.atLeast;if("Group"===s.type&&!1===is(s)||"Group"!==s.type&&!1===o)break}break;default:throw Error("non exhaustive match!")}return T.values(t)}function rs(e,t,r){const n=bs(e);t[n]=n,!0===r&&function(e,t){const r=String.fromCharCode(e),n=r.toUpperCase();if(n!==r){const e=bs(n.charCodeAt(0));t[e]=e}else{const e=r.toLowerCase();if(e!==r){const r=bs(e.charCodeAt(0));t[r]=r}}}(e,t)}function ns(e,t){return T.find(e.value,e=>{if("number"==typeof e)return T.includes(t,e);{const r=e;return void 0!==T.find(t,e=>r.from<=e&&e<=r.to)}})}function is(e){const t=e.quantifier;return!(!t||0!==t.atLeast)||!!e.value&&(T.isArray(e.value)?T.every(e.value,is):is(e.value))}class ss extends Zn{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);case"Lookbehind":return void this.visitLookbehind(e);case"NegativeLookbehind":return void this.visitNegativeLookbehind(e)}super.visitChildren(e)}}visitCharacter(e){T.includes(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===ns(e,this.targetCharCodes)&&(this.found=!0):void 0!==ns(e,this.targetCharCodes)&&(this.found=!0)}}function os(e,t){if(t instanceof RegExp){const r=Ji(t),n=new ss(e);return n.visit(r),n.found}return void 0!==T.find(t,t=>T.includes(e,t.charCodeAt(0)))}const as="PATTERN",cs="defaultMode",ls="modes";let us="boolean"==typeof new RegExp("(?:)").sticky;function ds(e,t){const r=(t=T.defaults(t,{useSticky:us,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer;let n;r("initCharCodeToOptimizedIndexMap",()=>{!function(){if(T.isEmpty(As)){As=new Array(65536);for(let e=0;e<65536;e++)As[e]=e>255?255+~~(e/255):e}}()}),r("Reject Lexer.NA",()=>{n=T.reject(e,e=>e[as]===js.NA)});let i,s,o,a,c,l,u,d,h,p,f,m=!1;r("Transform Patterns",()=>{m=!1,i=T.map(n,e=>{const r=e[as];if(T.isRegExp(r)){const e=r.source;return 1!==e.length||"^"===e||"$"===e||"."===e||r.ignoreCase?2!==e.length||"\\"!==e[0]||T.includes(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?t.useSticky?gs(r):ms(r):e[1]:e}if(T.isFunction(r))return m=!0,{exec:r};if("object"==typeof r)return m=!0,r;if("string"==typeof r){if(1===r.length)return r;{const e=r.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=new RegExp(e);return t.useSticky?gs(n):ms(n)}}throw Error("non exhaustive match")})}),r("misc mapping",()=>{s=T.map(n,e=>e.tokenTypeIdx),o=T.map(n,e=>{const t=e.GROUP;if(t!==js.SKIPPED){if(T.isString(t))return t;if(T.isUndefined(t))return!1;throw Error("non exhaustive match")}}),a=T.map(n,e=>{const t=e.LONGER_ALT;if(t){return T.isArray(t)?T.map(t,e=>T.indexOf(n,e)):[T.indexOf(n,t)]}}),c=T.map(n,e=>e.PUSH_MODE),l=T.map(n,e=>T.has(e,"POP_MODE"))}),r("Line Terminator Handling",()=>{const e=Ss(t.lineTerminatorCharacters);u=T.map(n,e=>!1),"onlyOffset"!==t.positionTracking&&(u=T.map(n,t=>T.has(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===Es(t,e)&&os(e,t.PATTERN)))}),r("Misc Mapping #2",()=>{d=T.map(n,Ts),h=T.map(i,vs),p=T.reduce(n,(e,t)=>{const r=t.GROUP;return T.isString(r)&&r!==js.SKIPPED&&(e[r]=[]),e},{}),f=T.map(i,(e,t)=>({pattern:i[t],longerAlt:a[t],canLineTerminator:u[t],isCustom:d[t],short:h[t],group:o[t],push:c[t],pop:l[t],tokenTypeIdx:s[t],tokenType:n[t]}))});let g=!0,y=[];return t.safeMode||r("First Char Optimization",()=>{y=T.reduce(n,(e,r,n)=>{if("string"==typeof r.PATTERN){const t=bs(r.PATTERN.charCodeAt(0));ks(e,t,f[n])}else if(T.isArray(r.START_CHARS_HINT)){let t;T.forEach(r.START_CHARS_HINT,r=>{const i=bs("string"==typeof r?r.charCodeAt(0):r);t!==i&&(t=i,ks(e,i,f[n]))})}else if(T.isRegExp(r.PATTERN))if(r.PATTERN.unicode)g=!1,t.ensureOptimizations&&Ci(`${Qi}\tUnable to analyze < ${r.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=es(r.PATTERN,t.ensureOptimizations);T.isEmpty(i)&&(g=!1),T.forEach(i,t=>{ks(e,t,f[n])})}else t.ensureOptimizations&&Ci(`${Qi}\tTokenType: <${r.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 hs(e,t){let r=[];const n=function(e){const t=T.filter(e,e=>!T.has(e,as)),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:Ms.MISSING_PATTERN,tokenTypes:[e]})),n=T.difference(e,t);return{errors:r,valid:n}}(e);r=r.concat(n.errors);const i=function(e){const t=T.filter(e,e=>{const t=e[as];return!(T.isRegExp(t)||T.isFunction(t)||T.has(t,"exec")||T.isString(t))}),r=T.map(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:Ms.INVALID_PATTERN,tokenTypes:[e]})),n=T.difference(e,t);return{errors:r,valid:n}}(n.valid),s=i.valid;return r=r.concat(i.errors),r=r.concat(function(e){let t=[];const r=T.filter(e,e=>T.isRegExp(e[as]));return t=t.concat(function(e){class t extends Zn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}const r=T.filter(e,e=>{const r=e.PATTERN;try{const e=Ji(r),n=new t;return n.visit(e),n.found}catch(n){return ps.test(r.source)}}),n=T.map(r,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:Ms.EOI_ANCHOR_FOUND,tokenTypes:[e]}));return n}(r)),t=t.concat(function(e){class t extends Zn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}const r=T.filter(e,e=>{const r=e.PATTERN;try{const e=Ji(r),n=new t;return n.visit(e),n.found}catch(n){return fs.test(r.source)}}),n=T.map(r,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:Ms.SOI_ANCHOR_FOUND,tokenTypes:[e]}));return n}(r)),t=t.concat(function(e){const t=T.filter(e,e=>{const t=e[as];return t instanceof RegExp&&(t.multiline||t.global)}),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Ms.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}));return r}(r)),t=t.concat(function(e){const t=[];let r=T.map(e,r=>T.reduce(e,(e,n)=>(r.PATTERN.source!==n.PATTERN.source||T.includes(t,n)||n.PATTERN===js.NA||(t.push(n),e.push(n)),e),[]));r=T.compact(r);const n=T.filter(r,e=>e.length>1),i=T.map(n,e=>{const t=T.map(e,e=>e.name);return{message:`The same RegExp pattern ->${T.first(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:Ms.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}});return i}(r)),t=t.concat(function(e){const t=T.filter(e,e=>e.PATTERN.test("")),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:Ms.EMPTY_MATCH_PATTERN,tokenTypes:[e]}));return r}(r)),t}(s)),r=r.concat(function(e){const t=T.filter(e,e=>{if(!T.has(e,"GROUP"))return!1;const t=e.GROUP;return t!==js.SKIPPED&&t!==js.NA&&!T.isString(t)}),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Ms.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}));return r}(s)),r=r.concat(function(e,t){const r=T.filter(e,e=>void 0!==e.PUSH_MODE&&!T.includes(t,e.PUSH_MODE)),n=T.map(r,e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:Ms.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}));return n}(s,t)),r=r.concat(function(e){const t=[],r=T.reduce(e,(e,t,r)=>{const n=t.PATTERN;return n===js.NA||(T.isString(n)?e.push({str:n,idx:r,tokenType:t}):T.isRegExp(n)&&function(e){const t=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return void 0===T.find(t,t=>-1!==e.source.indexOf(t))}(n)&&e.push({str:n.source,idx:r,tokenType:t})),e},[]);return T.forEach(e,(e,n)=>{T.forEach(r,({str:r,idx:i,tokenType:s})=>{if(n<i&&function(e,t){if(T.isRegExp(t)){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source))return!1;const r=t.exec(e);return null!==r&&0===r.index}if(T.isFunction(t))return t(e,0,[],{});if(T.has(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(r,e.PATTERN)){const r=`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:r,type:Ms.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}})}),t}(s)),r}const ps=/[^\\][$]/;const fs=/[^\\[][\^]|^\^/;function ms(e){const t=e.ignoreCase?"i":"";return new RegExp(`^(?:${e.source})`,t)}function gs(e){const t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function ys(e,t,r){const n=[];let i=!1;const s=T.compact(T.flatten(T.values(e.modes))),o=T.reject(s,e=>e[as]===js.NA),a=Ss(r);return t&&T.forEach(o,e=>{const t=Es(e,a);if(!1!==t){const r=function(e,t){if(t.issue===Ms.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===Ms.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:r,type:t.issue,tokenType:e};n.push(i)}else T.has(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(i=!0):os(a,e.PATTERN)&&(i=!0)}),t&&!i&&n.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:Ms.NO_LINE_BREAKS_FLAGS}),n}function Ts(e){const t=e.PATTERN;if(T.isRegExp(t))return!1;if(T.isFunction(t))return!0;if(T.has(t,"exec"))return!0;if(T.isString(t))return!1;throw Error("non exhaustive match")}function vs(e){return!(!T.isString(e)||1!==e.length)&&e.charCodeAt(0)}const Rs={test:function(e){const t=e.length;for(let r=this.lastIndex;r<t;r++){const t=e.charCodeAt(r);if(10===t)return this.lastIndex=r+1,!0;if(13===t)return 10===e.charCodeAt(r+1)?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},lastIndex:0};function Es(e,t){if(T.has(e,"LINE_BREAKS"))return!1;if(T.isRegExp(e.PATTERN)){try{os(t,e.PATTERN)}catch(r){return{issue:Ms.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}if(T.isString(e.PATTERN))return!1;if(Ts(e))return{issue:Ms.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function Ss(e){return T.map(e,e=>T.isString(e)?e.charCodeAt(0):e)}function ks(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}const Cs=256;let As=[];function bs(e){return e<Cs?e:As[e]}function $s(e,t){const r=e.tokenTypeIdx;return r===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[r]}function xs(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let ws=1;const Ns={};function Is(e){const t=function(e){let t=T.clone(e),r=e,n=!0;for(;n;){r=T.compact(T.flatten(T.map(r,e=>e.CATEGORIES)));const e=T.difference(r,t);t=t.concat(e),T.isEmpty(e)?n=!1:r=e}return t}(e);!function(e){T.forEach(e,e=>{var t;Ps(e)||(Ns[ws]=e,e.tokenTypeIdx=ws++),Ls(e)&&!T.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Ls(e)||(e.CATEGORIES=[]),t=e,T.has(t,"categoryMatches")||(e.categoryMatches=[]),function(e){return T.has(e,"categoryMatchesMap")}(e)||(e.categoryMatchesMap={})})}(t),function(e){T.forEach(e,e=>{_s([],e)})}(t),function(e){T.forEach(e,e=>{e.categoryMatches=[],T.forEach(e.categoryMatchesMap,(t,r)=>{e.categoryMatches.push(Ns[r].tokenTypeIdx)})})}(t),T.forEach(t,e=>{e.isParent=e.categoryMatches.length>0})}function _s(e,t){T.forEach(e,e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),T.forEach(t.CATEGORIES,r=>{const n=e.concat(t);T.includes(n,r)||_s(n,r)})}function Ps(e){return T.has(e,"tokenTypeIdx")}function Ls(e){return T.has(e,"CATEGORIES")}function Os(e){return T.has(e,"tokenTypeIdx")}const Ds={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,r,n,i,s)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${r} characters.`};var Ms,Fs;(Fs=Ms||(Ms={}))[Fs.MISSING_PATTERN=0]="MISSING_PATTERN",Fs[Fs.INVALID_PATTERN=1]="INVALID_PATTERN",Fs[Fs.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",Fs[Fs.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",Fs[Fs.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",Fs[Fs.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",Fs[Fs.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",Fs[Fs.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",Fs[Fs.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",Fs[Fs.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",Fs[Fs.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",Fs[Fs.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",Fs[Fs.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",Fs[Fs.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",Fs[Fs.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",Fs[Fs.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",Fs[Fs.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",Fs[Fs.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const qs={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Ds,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(qs);class js{constructor(e,t=qs){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 r=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--\x3e <${e}>`);const{time:n,value:i}=bi(t),s=n>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${r}<-- <${e}> time: ${n}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=T.assign({},qs,t);const r=this.config.traceInitPerf;!0===r?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof r&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let r,n=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===qs.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Rs;else if(this.config.lineTerminatorCharacters===qs.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),T.isArray(e)?r={modes:{defaultMode:T.clone(e)},defaultMode:cs}:(n=!1,r=T.clone(e))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){const t=[];return T.has(e,cs)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+cs+"> property in its definition\n",type:Ms.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),T.has(e,ls)||t.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:Ms.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),T.has(e,ls)&&T.has(e,cs)&&!T.has(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${cs}: <${e.defaultMode}>which does not exist\n`,type:Ms.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),T.has(e,ls)&&T.forEach(e.modes,(e,r)=>{T.forEach(e,(n,i)=>{if(T.isUndefined(n))t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${r}> at index: <${i}>\n`,type:Ms.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(T.has(n,"LONGER_ALT")){const i=T.isArray(n.LONGER_ALT)?n.LONGER_ALT:[n.LONGER_ALT];T.forEach(i,i=>{T.isUndefined(i)||T.includes(e,i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${n.name}> outside of mode <${r}>\n`,type:Ms.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),t}(r,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(ys(r,this.trackStartLines,this.config.lineTerminatorCharacters))})),r.modes=r.modes?r.modes:{},T.forEach(r.modes,(e,t)=>{r.modes[t]=T.reject(e,e=>T.isUndefined(e))});const i=T.keys(r.modes);if(T.forEach(r.modes,(e,r)=>{this.TRACE_INIT(`Mode: <${r}> processing`,()=>{if(this.modes.push(r),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(hs(e,i))}),T.isEmpty(this.lexerDefinitionErrors)){let n;Is(e),this.TRACE_INIT("analyzeTokenTypes",()=>{n=ds(e,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[r]=n.patternIdxToConfig,this.charCodeToPatternIdxToConfig[r]=n.charCodeToPatternIdxToConfig,this.emptyGroups=T.assign({},this.emptyGroups,n.emptyGroups),this.hasCustom=n.hasCustom||this.hasCustom,this.canModeBeOptimized[r]=n.canBeOptimized}})}),this.defaultMode=r.defaultMode,!T.isEmpty(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const e=T.map(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+e)}T.forEach(this.lexerDefinitionWarning,e=>{Ai(e.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(us?(this.chopInput=T.identity,this.match=this.matchWithTest):(this.updateLastIndex=T.noop,this.match=this.matchWithExec),n&&(this.handleModes=T.noop),!1===this.trackStartLines&&(this.computeNewColumn=T.identity),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=T.noop),/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=T.reduce(this.canModeBeOptimized,(e,t,r)=>(!1===t&&e.push(r),e),[]);if(t.ensureOptimizations&&!T.isEmpty(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",()=>{Yi={}}),this.TRACE_INIT("toFastProperties",()=>{$i(this)})})}tokenize(e,t=this.defaultMode){if(!T.isEmpty(this.lexerDefinitionErrors)){const e=T.map(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 r,n,i,s,o,a,c,l,u,d,h,p,f,m,g;const y=e,v=y.length;let R=0,E=0;const S=this.hasCustom?0:Math.floor(e.length/10),k=new Array(S),C=[];let A=this.trackStartLines?1:void 0,b=this.trackStartLines?1:void 0;const $=function(e){const t={},r=T.keys(e);return T.forEach(r,r=>{const n=e[r];if(!T.isArray(n))throw Error("non exhaustive match");t[r]=[]}),t}(this.emptyGroups),x=this.trackStartLines,w=this.config.lineTerminatorsPattern;let N=0,I=[],_=[];const P=[],L=[];let O;function D(){return I}function M(e){const t=bs(e),r=_[t];return void 0===r?L:r}Object.freeze(L);const F=e=>{if(1===P.length&&void 0===e.tokenType.PUSH_MODE){const t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);C.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{P.pop();const e=T.last(P);I=this.patternIdxToConfig[e],_=this.charCodeToPatternIdxToConfig[e],N=I.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=_&&t?M:D}};function q(e){P.push(e),_=this.charCodeToPatternIdxToConfig[e],I=this.patternIdxToConfig[e],N=I.length,N=I.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=_&&t?M:D}let j;q.call(this,t);const U=this.config.recoveryEnabled;for(;R<v;){a=null;const t=y.charCodeAt(R),S=O(t),_=S.length;for(r=0;r<_;r++){j=S[r];const n=j.pattern;c=null;const u=j.short;if(!1!==u?t===u&&(a=n):!0===j.isCustom?(g=n.exec(y,R,k,$),null!==g?(a=g[0],void 0!==g.payload&&(c=g.payload)):a=null):(this.updateLastIndex(n,R),a=this.match(n,e,R)),null!==a){if(o=j.longerAlt,void 0!==o){const t=o.length;for(i=0;i<t;i++){const t=I[o[i]],r=t.pattern;if(l=null,!0===t.isCustom?(g=r.exec(y,R,k,$),null!==g?(s=g[0],void 0!==g.payload&&(l=g.payload)):s=null):(this.updateLastIndex(r,R),s=this.match(r,e,R)),s&&s.length>a.length){a=s,c=l,j=t;break}}}break}}if(null!==a){if(u=a.length,d=j.group,void 0!==d&&(h=j.tokenTypeIdx,p=this.createTokenInstance(a,R,h,j.tokenType,A,b,u),this.handlePayload(p,c),!1===d?E=this.addToken(k,E,p):$[d].push(p)),e=this.chopInput(e,u),R+=u,b=this.computeNewColumn(b,u),!0===x&&!0===j.canLineTerminator){let e,t,r=0;w.lastIndex=0;do{e=w.test(a),!0===e&&(t=w.lastIndex-1,r++)}while(!0===e);0!==r&&(A+=r,b=u-t,this.updateTokenEndLineColumnLocation(p,d,t,r,A,b,u))}this.handleModes(j,F,q,p)}else{const t=R,r=A,i=b;let s=!1===U;for(;!1===s&&R<v;)for(e=this.chopInput(e,1),R++,n=0;n<N;n++){const t=I[n],r=t.pattern,i=t.short;if(!1!==i?y.charCodeAt(R)===i&&(s=!0):!0===t.isCustom?s=null!==r.exec(y,R,k,$):(this.updateLastIndex(r,R),s=null!==r.exec(e)),!0===s)break}if(f=R-t,b=this.computeNewColumn(b,f),m=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,t,f,r,i,T.last(P)),C.push({offset:t,line:r,column:i,length:f,message:m}),!1===U)break}}return this.hasCustom||(k.length=E),{tokens:k,groups:$,errors:C}}handleModes(e,t,r,n){if(!0===e.pop){const i=e.push;t(n),void 0!==i&&r.call(this,i)}else void 0!==e.push&&r.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,r,n,i,s,o){let a,c;void 0!==t&&(a=r===o-1,c=a?-1:0,1===n&&!0===a||(e.endLine=i+c,e.endColumn=s-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,r,n){return{image:e,startOffset:t,tokenTypeIdx:r,tokenType:n}}createStartOnlyToken(e,t,r,n,i,s){return{image:e,startOffset:t,startLine:i,startColumn:s,tokenTypeIdx:r,tokenType:n}}createFullToken(e,t,r,n,i,s,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:s,endColumn:s+o-1,tokenTypeIdx:r,tokenType:n}}addTokenUsingPush(e,t,r){return e.push(r),t}addTokenUsingMemberAccess(e,t,r){return e[t]=r,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}matchWithTest(e,t,r){return!0===e.test(t)?t.substring(r,e.lastIndex):null}matchWithExec(e,t){const r=e.exec(t);return null!==r?r[0]:null}}function Us(e){return Gs(e)?e.LABEL:e.name}function Gs(e){return T.isString(e.LABEL)&&""!==e.LABEL}js.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",js.NA=/NOT_APPLICABLE/;const zs="parent",Bs="categories",Ks="label",Ws="group",Vs="push_mode",Hs="pop_mode",Ys="longer_alt",Xs="line_breaks",Js="start_chars_hint";function Zs(e){return function(e){const t=e.pattern,r={};r.name=e.name,T.isUndefined(t)||(r.PATTERN=t);if(T.has(e,zs))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";T.has(e,Bs)&&(r.CATEGORIES=e[Bs]);Is([r]),T.has(e,Ks)&&(r.LABEL=e[Ks]);T.has(e,Ws)&&(r.GROUP=e[Ws]);T.has(e,Hs)&&(r.POP_MODE=e[Hs]);T.has(e,Vs)&&(r.PUSH_MODE=e[Vs]);T.has(e,Ys)&&(r.LONGER_ALT=e[Ys]);T.has(e,Xs)&&(r.LINE_BREAKS=e[Xs]);T.has(e,Js)&&(r.START_CHARS_HINT=e[Js]);return r}(e)}const Qs=Zs({name:"EOF",pattern:js.NA});function eo(e,t,r,n,i,s,o,a){return{image:t,startOffset:r,endOffset:n,startLine:i,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function to(e,t){return $s(e,t)}Is([Qs]);const ro={buildMismatchTokenMessage:({expected:e,actual:t,previous:r,ruleName:n})=>`Expecting ${Gs(e)?`--\x3e ${Us(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:r,customUserDescription:n,ruleName:i}){const s="Expecting: ",o="\nbut found: '"+T.first(t).image+"'";if(n)return s+n+o;{const t=T.reduce(e,(e,t)=>e.concat(t),[]),r=T.map(t,e=>`[${T.map(e,e=>Us(e)).join(", ")}]`);return s+`one of these possible Token sequences:\n${T.map(r,(e,t)=>` ${t+1}. ${e}`).join("\n")}`+o}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:r,ruleName:n}){const i="Expecting: ",s="\nbut found: '"+T.first(t).image+"'";if(r)return i+r+s;return i+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${T.map(e,e=>`[${T.map(e,e=>Us(e)).join(",")}]`).join(" ,")}>`+s}};Object.freeze(ro);const no={buildRuleNotFoundError:(e,t)=>"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},io={buildDuplicateFoundError(e,t){const r=e.name,n=T.first(t),i=n.idx,s=zi(n),o=(a=n)instanceof qi?a.terminalType.name:a instanceof Ni?a.nonTerminalName:"";var a;let c=`->${s}${i>0?i:""}<- ${o?`with argument: ->${o}<-`:""}\n appears more than once (${t.length} times) in the top level rule: ->${r}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,"\n"),c},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=T.map(e.prefixPath,e=>Us(e)).join(", "),r=0===e.alternation.idx?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix\nin <OR${r}> 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=T.map(e.prefixPath,e=>Us(e)).join(", "),r=0===e.alternation.idx?"":e.alternation.idx;let n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${r}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return n+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",n},buildEmptyRepetitionError(e){let t=zi(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 ${T.map(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 Ii?e.topLevelRule.name:e.topLevelRule;return`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class so extends Ui{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){T.forEach(T.values(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:Na.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class oo extends Bi{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=T.clone(this.path.ruleStack).reverse(),this.occurrenceStack=T.clone(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,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const n=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){T.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class ao extends oo{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,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const e=t.concat(r),n=new _i({definition:e});this.possibleTokTypes=Wi(n),this.found=!0}}}class co extends Bi{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 lo extends co{walkMany(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,r)}}class uo extends co{walkManySep(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,r)}}class ho extends co{walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,r)}}class po extends co{walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,r)}}function fo(e,t,r=[]){r=T.clone(r);let n=[],i=0;function s(s){const o=fo(s.concat(T.drop(e,i+1)),t,r);return n.concat(o)}for(;r.length<t&&i<e.length;){const t=e[i];if(t instanceof _i)return s(t.definition);if(t instanceof Ni)return s(t.definition);if(t instanceof Pi)n=s(t.definition);else{if(t instanceof Li){return s(t.definition.concat([new Di({definition:t.definition})]))}if(t instanceof Oi){return s([new _i({definition:t.definition}),new Di({definition:[new qi({terminalType:t.separator})].concat(t.definition)})])}if(t instanceof Mi){const e=t.definition.concat([new Di({definition:[new qi({terminalType:t.separator})].concat(t.definition)})]);n=s(e)}else if(t instanceof Di){const e=t.definition.concat([new Di({definition:t.definition})]);n=s(e)}else{if(t instanceof Fi)return T.forEach(t.definition,e=>{!1===T.isEmpty(e.definition)&&(n=s(e.definition))}),n;if(!(t instanceof qi))throw Error("non exhaustive match");r.push(t.terminalType)}}i++}return n.push({partialPath:r,suffixDef:T.drop(e,i)}),n}function mo(e,t,r,n){const i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const c=t.length,l=c-n-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!T.isEmpty(d);){const e=d.pop();if(e===o){a&&T.last(d).idx<=l&&d.pop();continue}const n=e.def,h=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(T.isEmpty(n))continue;const m=n[0];if(m===i){const e={idx:h,def:T.drop(n),ruleStack:T.dropRight(p),occurrenceStack:T.dropRight(f)};d.push(e)}else if(m instanceof qi)if(h<c-1){const e=h+1;if(r(t[e],m.terminalType)){const t={idx:e,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(t)}}else{if(h!==c-1)throw Error("non exhaustive match");u.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),a=!0}else if(m instanceof Ni){const e=T.clone(p);e.push(m.nonTerminalName);const t=T.clone(f);t.push(m.idx);const r={idx:h,def:m.definition.concat(s,T.drop(n)),ruleStack:e,occurrenceStack:t};d.push(r)}else if(m instanceof Pi){const e={idx:h,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o);const t={idx:h,def:m.definition.concat(T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof Li){const e=new Di({definition:m.definition,idx:m.idx}),t={idx:h,def:m.definition.concat([e],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof Oi){const e=new qi({terminalType:m.separator}),t=new Di({definition:[e].concat(m.definition),idx:m.idx}),r={idx:h,def:m.definition.concat([t],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(r)}else if(m instanceof Mi){const e={idx:h,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o);const t=new qi({terminalType:m.separator}),r=new Di({definition:[t].concat(m.definition),idx:m.idx}),i={idx:h,def:m.definition.concat([r],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(i)}else if(m instanceof Di){const e={idx:h,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o);const t=new Di({definition:m.definition,idx:m.idx}),r={idx:h,def:m.definition.concat([t],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(r)}else if(m instanceof Fi)for(let t=m.definition.length-1;t>=0;t--){const e={idx:h,def:m.definition[t].definition.concat(T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o)}else if(m instanceof _i)d.push({idx:h,def:m.definition.concat(T.drop(n)),ruleStack:p,occurrenceStack:f});else{if(!(m instanceof Ii))throw Error("non exhaustive match");d.push(go(m,h,p,f))}}return u}function go(e,t,r,n){const i=T.clone(r);i.push(e.name);const s=T.clone(n);return s.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:s}}var yo,To;function vo(e){if(e instanceof Pi||"Option"===e)return yo.OPTION;if(e instanceof Di||"Repetition"===e)return yo.REPETITION;if(e instanceof Li||"RepetitionMandatory"===e)return yo.REPETITION_MANDATORY;if(e instanceof Oi||"RepetitionMandatoryWithSeparator"===e)return yo.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof Mi||"RepetitionWithSeparator"===e)return yo.REPETITION_WITH_SEPARATOR;if(e instanceof Fi||"Alternation"===e)return yo.ALTERNATION;throw Error("non exhaustive match")}function Ro(e){const{occurrence:t,rule:r,prodType:n,maxLookahead:i}=e,s=vo(n);return s===yo.ALTERNATION?wo(t,r,i):No(t,r,s,i)}function Eo(e,t,r,n){const i=e.length,s=T.every(e,e=>T.every(e,e=>1===e.length));if(t)return function(t){const n=T.map(t,e=>e.GATE);for(let s=0;s<i;s++){const t=e[s],i=t.length,o=n[s];if(void 0===o||!1!==o.call(this))e:for(let e=0;e<i;e++){const n=t[e],i=n.length;for(let e=0;e<i;e++){const t=this.LA(e+1);if(!1===r(t,n[e]))continue e}return s}}};if(s&&!n){const t=T.map(e,e=>T.flatten(e)),r=T.reduce(t,(e,t,r)=>(T.forEach(t,t=>{T.has(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=r),T.forEach(t.categoryMatches,t=>{T.has(e,t)||(e[t]=r)})}),e),{});return function(){const e=this.LA(1);return r[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){const n=e[t],i=n.length;e:for(let e=0;e<i;e++){const i=n[e],s=i.length;for(let e=0;e<s;e++){const t=this.LA(e+1);if(!1===r(t,i[e]))continue e}return t}}}}function So(e,t,r){const n=T.every(e,e=>1===e.length),i=e.length;if(n&&!r){const t=T.flatten(e);if(1===t.length&&T.isEmpty(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=T.reduce(t,(e,t,r)=>(e[t.tokenTypeIdx]=!0,T.forEach(t.categoryMatches,t=>{e[t]=!0}),e),[]);return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let r=0;r<i;r++){const n=e[r],i=n.length;for(let e=0;e<i;e++){const r=this.LA(e+1);if(!1===t(r,n[e]))continue e}return!0}return!1}}(To=yo||(yo={}))[To.OPTION=0]="OPTION",To[To.REPETITION=1]="REPETITION",To[To.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",To[To.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",To[To.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",To[To.ALTERNATION=5]="ALTERNATION";class ko extends Bi{constructor(e,t,r){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,r,n){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=r.concat(n),!0)}walkOption(e,t,r){this.checkIsTarget(e,yo.OPTION,t,r)||super.walkOption(e,t,r)}walkAtLeastOne(e,t,r){this.checkIsTarget(e,yo.REPETITION_MANDATORY,t,r)||super.walkOption(e,t,r)}walkAtLeastOneSep(e,t,r){this.checkIsTarget(e,yo.REPETITION_MANDATORY_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}walkMany(e,t,r){this.checkIsTarget(e,yo.REPETITION,t,r)||super.walkOption(e,t,r)}walkManySep(e,t,r){this.checkIsTarget(e,yo.REPETITION_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}}class Co extends Ui{constructor(e,t,r){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=r,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,yo.OPTION)}visitRepetition(e){this.checkIsTarget(e,yo.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,yo.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,yo.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,yo.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,yo.ALTERNATION)}}function Ao(e){const t=new Array(e);for(let r=0;r<e;r++)t[r]=[];return t}function bo(e){let t=[""];for(let r=0;r<e.length;r++){const n=e[r],i=[];for(let e=0;e<t.length;e++){const r=t[e];i.push(r+"_"+n.tokenTypeIdx);for(let e=0;e<n.categoryMatches.length;e++){const t="_"+n.categoryMatches[e];i.push(r+t)}}t=i}return t}function $o(e,t,r){for(let n=0;n<e.length;n++){if(n===r)continue;const i=e[n];for(let e=0;e<t.length;e++){if(!0===i[t[e]])return!1}}return!0}function xo(e,t){const r=T.map(e,e=>fo([e],1)),n=Ao(r.length),i=T.map(r,e=>{const t={};return T.forEach(e,e=>{const r=bo(e.partialPath);T.forEach(r,e=>{t[e]=!0})}),t});let s=r;for(let o=1;o<=t;o++){const e=s;s=Ao(e.length);for(let r=0;r<e.length;r++){const a=e[r];for(let e=0;e<a.length;e++){const c=a[e].partialPath,l=a[e].suffixDef,u=bo(c);if($o(i,u,r)||T.isEmpty(l)||c.length===t){const e=n[r];if(!1===Io(e,c)){e.push(c);for(let e=0;e<u.length;e++){const t=u[e];i[r][t]=!0}}}else{const e=fo(l,o+1,c);s[r]=s[r].concat(e),T.forEach(e,e=>{const t=bo(e.partialPath);T.forEach(t,e=>{i[r][e]=!0})})}}}}return n}function wo(e,t,r,n){const i=new Co(e,yo.ALTERNATION,n);return t.accept(i),xo(i.result,r)}function No(e,t,r,n){const i=new Co(e,r);t.accept(i);const s=i.result,o=new ko(t,e,r).startWalking();return xo([new _i({definition:s}),new _i({definition:o})],n)}function Io(e,t){e:for(let r=0;r<e.length;r++){const n=e[r];if(n.length===t.length){for(let e=0;e<n.length;e++){const r=t[e],i=n[e];if(!1===(r===i||void 0!==i.categoryMatchesMap[r.tokenTypeIdx]))continue e}return!0}}return!1}function _o(e){return T.every(e,e=>T.every(e,e=>T.every(e,e=>T.isEmpty(e.categoryMatches))))}function Po(e,t,r,n){const i=T.flatMap(e,e=>function(e,t){const r=new Do;e.accept(r);const n=r.allProductions,i=T.groupBy(n,Lo),s=T.pickBy(i,e=>e.length>1),o=T.map(T.values(s),r=>{const n=T.first(r),i=t.buildDuplicateFoundError(e,r),s=zi(n),o={message:i,type:Na.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:s,occurrence:n.idx},a=Oo(n);return a&&(o.parameter=a),o});return o}(e,r)),s=function(e,t,r){const n=[],i=T.map(t,e=>e.name);return T.forEach(e,e=>{const t=e.name;if(T.includes(i,t)){const i=r.buildNamespaceConflictError(e);n.push({message:i,type:Na.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),n}(e,t,r),o=T.flatMap(e,e=>function(e,t){const r=new qo;e.accept(r);const n=r.alternations,i=T.flatMap(n,r=>r.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:r}),type:Na.TOO_MANY_ALTS,ruleName:e.name,occurrence:r.idx}]:[]);return i}(e,r)),a=T.flatMap(e,t=>function(e,t,r,n){const i=[],s=T.reduce(t,(t,r)=>r.name===e.name?t+1:t,0);if(s>1){const t=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:r});i.push({message:t,type:Na.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,n,r));return i.concat(s,o,a)}function Lo(e){return`${zi(e)}_#_${e.idx}_#_${Oo(e)}`}function Oo(e){return e instanceof qi?e.terminalType.name:e instanceof Ni?e.nonTerminalName:""}class Do extends Ui{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 Mo(e,t,r,n=[]){const i=[],s=Fo(t.definition);if(T.isEmpty(s))return[];{const t=e.name;T.includes(s,e)&&i.push({message:r.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Na.LEFT_RECURSION,ruleName:t});const o=T.difference(s,n.concat([e])),a=T.flatMap(o,t=>{const i=T.clone(n);return i.push(t),Mo(e,t,r,i)});return i.concat(a)}}function Fo(e){let t=[];if(T.isEmpty(e))return t;const r=T.first(e);if(r instanceof Ni)t.push(r.referencedRule);else if(r instanceof _i||r instanceof Pi||r instanceof Li||r instanceof Oi||r instanceof Mi||r instanceof Di)t=t.concat(Fo(r.definition));else if(r instanceof Fi)t=T.flatten(T.map(r.definition,e=>Fo(e.definition)));else if(!(r instanceof qi))throw Error("non exhaustive match");const n=Gi(r),i=e.length>1;if(n&&i){const r=T.drop(e);return t.concat(Fo(r))}return t}class qo extends Ui{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function jo(e,t,r){const n=new qo;e.accept(n);let i=n.alternations;i=T.reject(i,e=>!0===e.ignoreAmbiguities);const s=T.flatMap(i,n=>{const i=n.idx,s=n.maxLookahead||t,o=wo(i,e,s,n),a=function(e,t,r,n){const i=[],s=T.reduce(e,(r,n,s)=>(!0===t.definition[s].ignoreAmbiguities||T.forEach(n,n=>{const o=[s];T.forEach(e,(e,r)=>{s!==r&&Io(e,n)&&!0!==t.definition[r].ignoreAmbiguities&&o.push(r)}),o.length>1&&!Io(i,n)&&(i.push(n),r.push({alts:o,path:n}))}),r),[]),o=T.map(s,e=>{const i=T.map(e.alts,e=>e+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Na.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:t.idx,alternatives:e.alts}});return o}(o,n,e,r),c=function(e,t,r,n){const i=T.reduce(e,(e,t,r)=>{const n=T.map(t,e=>({idx:r,path:e}));return e.concat(n)},[]),s=T.compact(T.flatMap(i,e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];const s=e.idx,o=e.path,a=T.filter(i,e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<s&&(r=e.path,n=o,r.length<n.length&&T.every(r,(e,t)=>{const r=n[t];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]}));var r,n});return T.map(a,e=>{const i=[e.idx+1,s+1],o=0===t.idx?"":t.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Na.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:o,alternatives:i}})}));return s}(o,n,e,r);return a.concat(c)});return s}class Uo extends Ui{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 Go(e){const t=T.defaults(e,{errMsgProvider:no}),r={};return T.forEach(e.rules,e=>{r[e.name]=e}),function(e,t){const r=new so(e,t);return r.resolveRefs(),r.errors}(r,t.errMsgProvider)}const zo="MismatchedTokenException",Bo="NoViableAltException",Ko="EarlyExitException",Wo="NotAllInputParsedException",Vo=[zo,Bo,Ko,Wo];function Ho(e){return T.includes(Vo,e.name)}Object.freeze(Vo);class Yo 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 Xo extends Yo{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=zo}}class Jo extends Yo{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=Bo}}class Zo extends Yo{constructor(e,t){super(e,t),this.name=Wo}}class Qo extends Yo{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=Ko}}const ea={},ta="InRuleRecoveryException";class ra extends Error{constructor(e){super(e),this.name=ta}}function na(e,t,r,n,i,s,o){const a=this.getKeyForAutomaticLookahead(n,i);let c=this.firstAfterRepMap[a];if(void 0===c){const e=this.getCurrRuleFullName();c=new s(this.getGAstProductions()[e],i).startWalking(),this.firstAfterRepMap[a]=c}let l=c.token,u=c.occurrence;const d=c.isEndOfRule;1===this.RULE_STACK.length&&d&&void 0===l&&(l=Qs,u=1),void 0!==l&&void 0!==u&&this.shouldInRepetitionRecoveryBeTried(l,u,o)&&this.tryInRepetitionRecovery(e,t,r,l)}const ia=1024,sa=1280,oa=1536;function aa(e,t,r){return r|t|e}class ca{constructor(e){var t;this.maxLookahead=null!==(t=null==e?void 0:e.maxLookahead)&&void 0!==t?t:xa.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if(T.isEmpty(t)){const r=this.validateEmptyOrAlternatives(e.rules),n=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...r,...n,...i]}return t}validateNoLeftRecursion(e){return T.flatMap(e,e=>Mo(e,e,io))}validateEmptyOrAlternatives(e){return T.flatMap(e,e=>function(e,t){const r=new qo;e.accept(r);const n=r.alternations;return T.flatMap(n,r=>{const n=T.dropRight(r.definition);return T.flatMap(n,(n,i)=>{const s=mo([n],[],$s,1);return T.isEmpty(s)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:r,emptyChoiceIdx:i}),type:Na.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:r.idx,alternative:i+1}]:[]})})}(e,io))}validateAmbiguousAlternationAlternatives(e,t){return T.flatMap(e,e=>jo(e,t,io))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,r){const n=[];return T.forEach(e,e=>{const i=new Uo;e.accept(i);const s=i.allProductions;T.forEach(s,i=>{const s=vo(i),o=i.maxLookahead||t,a=No(i.idx,e,s,o)[0];if(T.isEmpty(T.flatten(a))){const t=r.buildEmptyRepetitionError({topLevelRule:e,repetition:i});n.push({message:t,type:Na.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),n}(e,t,io)}buildLookaheadForAlternation(e){return function(e,t,r,n,i,s){const o=wo(e,t,r);return s(o,n,_o(o)?xs:$s,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Eo)}buildLookaheadForOptional(e){return function(e,t,r,n,i,s){const o=No(e,t,i,r),a=_o(o)?xs:$s;return s(o[0],a,n)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,vo(e.prodType),So)}}const la=new class extends Ui{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 ua(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function da(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 ha(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function pa(e,t){const r=T.keys(e),n=r.length;for(let i=0;i<n;i++){const n=e[r[i]],s=n.length;for(let e=0;e<s;e++){const r=n[e];void 0===r.tokenTypeIdx&&this[r.name](r.children,t)}}}function fa(e,t){const r=function(){};ha(r,e+"BaseSemantics");const n={visit:function(e,t){if(T.isArray(e)&&(e=e[0]),!T.isUndefined(e))return this[e.name](e.children,t)},validateVisitor:function(){const e=function(e,t){const r=function(e,t){const r=T.filter(t,t=>!1===T.isFunction(e[t])),n=T.map(r,t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:ma.MISSING_METHOD,methodName:t}));return T.compact(n)}(e,t);return r}(this,t);if(!T.isEmpty(e)){const t=T.map(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(r.prototype=n).constructor=r,r._RULE_NAMES=t,r}var ma,ga;(ga=ma||(ma={}))[ga.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",ga[ga.MISSING_METHOD=1]="MISSING_METHOD";const ya={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ya);const Ta=!0,va=Math.pow(2,8)-1,Ra=Zs({name:"RECORDING_PHASE_TOKEN",pattern:js.NA});Is([Ra]);const Ea=eo(Ra,"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(Ea);const Sa={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 ka(e,t,r,n=!1){ba(r);const i=T.last(this.recordingProdStack),s=T.isFunction(t)?t:t.DEF,o=new e({definition:[],idx:r});return n&&(o.separator=t.SEP),T.has(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),ya}function Ca(e,t){ba(t);const r=T.last(this.recordingProdStack),n=!1===T.isArray(e),i=!1===n?e:e.DEF,s=new Fi({definition:[],idx:t,ignoreAmbiguities:n&&!0===e.IGNORE_AMBIGUITIES});T.has(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD);const o=T.some(i,e=>T.isFunction(e.GATE));return s.hasPredicates=o,r.definition.push(s),T.forEach(i,e=>{const t=new _i({definition:[]});s.definition.push(t),T.has(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:T.has(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),ya}function Aa(e){return 0===e?"":`${e}`}function ba(e){if(e<0||e>va){const t=new Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than ${va+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}const $a=eo(Qs,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze($a);const xa=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ro,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),wa=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Na,Ia,_a;function Pa(e=void 0){return function(){return e}}(Ia=Na||(Na={}))[Ia.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",Ia[Ia.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",Ia[Ia.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",Ia[Ia.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",Ia[Ia.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",Ia[Ia.LEFT_RECURSION=5]="LEFT_RECURSION",Ia[Ia.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",Ia[Ia.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",Ia[Ia.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",Ia[Ia.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",Ia[Ia.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",Ia[Ia.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",Ia[Ia.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",Ia[Ia.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION";class La{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",()=>{$i(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),T.forEach(this.definedRulesNames,e=>{const t=this[e].originalGrammarAction;let r;this.TRACE_INIT(`${e} Rule`,()=>{r=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=r})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=Go({rules:T.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(T.isEmpty(r)&&!1===this.skipValidations){const r=(e={rules:T.values(this.gastProductionsCache),tokenTypes:T.values(this.tokensMap),errMsgProvider:io,grammarName:t},Po((e=T.defaults(e,{errMsgProvider:io})).rules,e.tokenTypes,e.errMsgProvider,e.grammarName)),n=function(e){const t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return T.map(t,e=>Object.assign({type:Na.CUSTOM_LOOKAHEAD_VALIDATION},e))}({lookaheadStrategy:this.lookaheadStrategy,rules:T.values(this.gastProductionsCache),tokenTypes:T.values(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(r,n)}var e}),T.isEmpty(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const e=function(e){const t={};return T.forEach(e,e=>{const r=new Hi(e).startWalking();T.assign(t,r)}),t}(T.values(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:T.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(T.values(this.gastProductionsCache))})),!La.DEFER_DEFINITION_ERRORS_HANDLING&&!T.isEmpty(this.definitionErrors))throw e=T.map(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 r=this;if(r.initErrorHandler(t),r.initLexerAdapter(),r.initLooksAhead(t),r.initRecognizerEngine(e,t),r.initRecoverable(t),r.initTreeBuilder(t),r.initContentAssist(),r.initGastRecorder(t),r.initPerformanceTracer(t),T.has(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=T.has(t,"skipValidations")?t.skipValidations:xa.skipValidations}}La.DEFER_DEFINITION_ERRORS_HANDLING=!1,_a=La,[class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=T.has(e,"recoveryEnabled")?e.recoveryEnabled:xa.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=na)}getTokenToInsert(e){const t=eo(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,r,n){const i=this.findReSyncTokenType(),s=this.exportLexerState(),o=[];let a=!1;const c=this.LA(1);let l=this.LA(1);const u=()=>{const e=this.LA(0),t=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),r=new Xo(t,c,this.LA(0));r.resyncedTokens=T.dropRight(o),this.SAVE_ERROR(r)};for(;!a;){if(this.tokenMatcher(l,n))return void u();if(r.call(this))return u(),void e.apply(this,t);this.tokenMatcher(l,i)?a=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o))}this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,t,r){return!1!==r&&!this.tokenMatcher(this.LA(1),e)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t))}getFollowsForInRuleRecovery(e,t){const r=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(r)}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 ra("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(T.isEmpty(t))return!1;const r=this.LA(1);return void 0!==T.find(t,e=>this.tokenMatcher(r,e))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(t);return T.includes(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),r=2;for(;;){const n=T.find(e,e=>to(t,e));if(void 0!==n)return n;t=this.LA(r),r++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return ea;const e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return T.map(e,(r,n)=>0===n?ea:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:t[n],inRule:this.shortRuleNameToFullName(e[n-1])})}flattenFollowSet(){const e=T.map(this.buildFullFollowKeyStack(),e=>this.getFollowSetFromFollowKey(e));return T.flatten(e)}getFollowSetFromFollowKey(e){if(e===ea)return[Qs];const t=e.ruleName+e.idxInCallingRule+Vi+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,Qs)||t.push(e),t}reSyncTo(e){const t=[];let r=this.LA(1);for(;!1===this.tokenMatcher(r,e);)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return T.dropRight(t)}attemptInRepetitionRecovery(e,t,r,n,i,s,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:T.clone(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return T.map(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}},class{initLooksAhead(e){this.dynamicTokensEnabled=T.has(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:xa.dynamicTokensEnabled,this.maxLookahead=T.has(e,"maxLookahead")?e.maxLookahead:xa.maxLookahead,this.lookaheadStrategy=T.has(e,"lookaheadStrategy")?e.lookaheadStrategy:new ca({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){T.forEach(e,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{const{alternation:t,repetition:r,option:n,repetitionMandatory:i,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:o}=function(e){la.reset(),e.accept(la);const t=la.dslMethods;return la.reset(),t}(e);T.forEach(t,t=>{const r=0===t.idx?"":t.idx;this.TRACE_INIT(`${zi(t)}${r}`,()=>{const r=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),n=aa(this.fullRuleNameToShort[e.name],256,t.idx);this.setLaFuncCache(n,r)})}),T.forEach(r,t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,zi(t))}),T.forEach(n,t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,zi(t))}),T.forEach(i,t=>{this.computeLookaheadFunc(e,t.idx,ia,"RepetitionMandatory",t.maxLookahead,zi(t))}),T.forEach(s,t=>{this.computeLookaheadFunc(e,t.idx,oa,"RepetitionMandatoryWithSeparator",t.maxLookahead,zi(t))}),T.forEach(o,t=>{this.computeLookaheadFunc(e,t.idx,sa,"RepetitionWithSeparator",t.maxLookahead,zi(t))})})})}computeLookaheadFunc(e,t,r,n,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:n}),o=aa(this.fullRuleNameToShort[e.name],r,t);this.setLaFuncCache(o,s)})}getKeyForAutomaticLookahead(e,t){return aa(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=T.has(e,"nodeLocationTracking")?e.nodeLocationTracking:xa.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=da,this.setNodeLocationFromNode=da,this.cstPostRule=T.noop,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=T.noop,this.setNodeLocationFromNode=T.noop,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ua,this.setNodeLocationFromNode=ua,this.cstPostRule=T.noop,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=T.noop,this.setNodeLocationFromNode=T.noop,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=T.noop,this.setNodeLocationFromNode=T.noop,this.cstPostRule=T.noop,this.setInitialNodeLocation=T.noop}else this.cstInvocationStateUpdate=T.noop,this.cstFinallyStateUpdate=T.noop,this.cstPostTerminal=T.noop,this.cstPostNonTerminal=T.noop,this.cstPostRule=T.noop}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),r=e.location;r.startOffset<=t.startOffset==1?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),r=e.location;r.startOffset<=t.startOffset==1?r.endOffset=t.endOffset:r.startOffset=NaN}cstPostTerminal(e,t){const r=this.CST_STACK[this.CST_STACK.length-1];var n,i,s;i=t,s=e,void 0===(n=r).children[s]?n.children[s]=[i]:n.children[s].push(i),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){const r=this.CST_STACK[this.CST_STACK.length-1];!function(e,t,r){void 0===e.children[t]?e.children[t]=[r]:e.children[t].push(r)}(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(T.isUndefined(this.baseCstVisitorConstructor)){const e=fa(this.className,T.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(T.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){const e=function(e,t,r){const n=function(){};ha(n,e+"BaseSemanticsWithDefaults");const i=Object.create(r.prototype);return T.forEach(t,e=>{i[e]=pa}),(n.prototype=i).constructor=n,n}(this.className,T.keys(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)):$a}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?$a: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=xs,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},T.has(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(T.isArray(e)){if(T.isEmpty(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(T.isArray(e))this.tokensMap=T.reduce(e,(e,t)=>(e[t.name]=t,e),{});else if(T.has(e,"modes")&&T.every(T.flatten(T.values(e.modes)),Os)){const t=T.flatten(T.values(e.modes)),r=T.uniq(t);this.tokensMap=T.reduce(r,(e,t)=>(e[t.name]=t,e),{})}else{if(!T.isObject(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=T.clone(e)}this.tokensMap.EOF=Qs;const r=T.has(e,"modes")?T.flatten(T.values(e.modes)):T.values(e),n=T.every(r,e=>T.isEmpty(e.categoryMatches));this.tokenMatcher=n?xs:$s,Is(T.values(this.tokensMap))}defineRule(e,t,r){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 n=T.has(r,"resyncEnabled")?r.resyncEnabled:wa.resyncEnabled,i=T.has(r,"recoveryValueFunc")?r.recoveryValueFunc:wa.recoveryValueFunc,s=this.ruleShortNameIdx<<12;let o;return this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s,o=!0===this.outputCst?function(...r){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,r);const n=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(n),n}catch(o){return this.invokeRuleCatch(o,n,i)}finally{this.ruleFinallyStateUpdate()}}:function(...r){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,r)}catch(o){return this.invokeRuleCatch(o,n,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,r){const n=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Ho(e)){const t=e;if(i){const n=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(n)){if(t.resyncedTokens=this.reSyncTo(n),this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return r(e)}if(this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(n)return this.moveToTerminatedState(),r(e);throw t}throw e}optionInternal(e,t){const r=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,r)}optionInternalLogic(e,t,r){let n,i=this.getLaFuncFromCache(r);if("function"!=typeof e){n=e.DEF;const t=e.GATE;if(void 0!==t){const e=i;i=()=>t.call(this)&&e.call(this)}}else n=e;if(!0===i.call(this))return n.call(this)}atLeastOneInternal(e,t){const r=this.getKeyForAutomaticLookahead(ia,e);return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let n,i=this.getLaFuncFromCache(r);if("function"!=typeof t){n=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else n=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,yo.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(n);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(n)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,ia,e,ho)}atLeastOneSepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(oa,e);this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){const n=t.DEF,i=t.SEP;if(!0!==this.getLaFuncFromCache(r).call(this))throw this.raiseEarlyExitException(e,yo.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{n.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,n,po],t,oa,e,po)}}manyInternal(e,t){const r=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let n,i=this.getLaFuncFromCache(r);if("function"!=typeof t){n=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else n=t;let s=!0;for(;!0===i.call(this)&&!0===s;)s=this.doSingleRepetition(n);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,lo,s)}manySepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(sa,e);this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){const n=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(r).call(this)){n.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,n,uo],t,sa,e,uo)}}repetitionSepSecondInternal(e,t,r,n,i){for(;r();)this.CONSUME(t),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,n,i],r,oa,e,i)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const r=this.getKeyForAutomaticLookahead(256,t),n=T.isArray(e)?e:e.DEF,i=this.getLaFuncFromCache(r).call(this,n);if(void 0!==i)return n[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 Zo(t,e))}}subruleInternal(e,t,r){let n;try{const i=void 0!==r?r.ARGS:void 0;return this.subruleIdx=t,n=e.apply(this,i),this.cstPostNonTerminal(n,void 0!==r&&void 0!==r.LABEL?r.LABEL:e.ruleName),n}catch(i){throw this.subruleInternalError(i,r,e.ruleName)}}subruleInternalError(e,t,r){throw Ho(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,t,r){let n;try{const t=this.LA(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),n=t):this.consumeInternalError(e,t,r)}catch(i){n=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(void 0!==r&&void 0!==r.LABEL?r.LABEL:e.name,n),n}consumeInternalError(e,t,r){let n;const i=this.LA(0);throw n=void 0!==r&&r.ERR_MSG?r.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Xo(n,t,i))}consumeInternalRecovery(e,t,r){if(!this.recoveryEnabled||"MismatchedTokenException"!==r.name||this.isBackTracking())throw r;{const i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(n){throw n.name===ta?r:n}}}saveRecogState(){const e=this.errors,t=T.clone(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,r){this.RULE_OCCURRENCE_STACK.push(r),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),Qs)}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,r){return this.consumeInternal(t,e,r)}subrule(e,t,r){return this.subruleInternal(t,e,r)}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,r=wa){if(T.includes(this.definedRulesNames,e)){const t={message:io.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Na.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);const n=this.defineRule(e,t,r);return this[e]=n,n}OVERRIDE_RULE(e,t,r=wa){const n=function(e,t,r){const n=[];let i;return T.includes(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Na.INVALID_RULE_OVERRIDE,ruleName:e})),n}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(n);const i=this.defineRule(e,t,r);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,t),!0}catch(n){if(Ho(n))return!1;throw n}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return e=T.values(this.gastProductionsCache),T.map(e,ji);var e}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=T.has(e,"errorMessageProvider")?e.errorMessageProvider:xa.errorMessageProvider}SAVE_ERROR(e){if(Ho(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:T.clone(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return T.clone(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,r){const n=this.getCurrRuleFullName(),i=No(e,this.getGAstProductions()[n],t,this.maxLookahead)[0],s=[];for(let a=1;a<=this.maxLookahead;a++)s.push(this.LA(a));const o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:s,previous:this.LA(0),customUserDescription:r,ruleName:n});throw this.SAVE_ERROR(new Qo(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const r=this.getCurrRuleFullName(),n=wo(e,this.getGAstProductions()[r],this.maxLookahead),i=[];for(let a=1;a<=this.maxLookahead;a++)i.push(this.LA(a));const s=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:n,actual:i,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Jo(o,this.LA(1),s))}},class{initContentAssist(){}computeContentAssist(e,t){const r=this.gastProductionsCache[e];if(T.isUndefined(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return mo([r],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=T.first(e.ruleStack),r=this.getGAstProductions()[t];return new ao(r,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,r){return this.consumeInternalRecord(t,e,r)},this[`SUBRULE${t}`]=function(t,r){return this.subruleInternalRecord(t,e,r)},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,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},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 r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return $a}topLevelRuleRecord(e,t){try{const r=new Ii({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(!0!==r.KNOWN_RECORDER_ERROR)try{r.message=r.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(n){throw r}throw r}}optionInternalRecord(e,t){return ka.call(this,Pi,e,t)}atLeastOneInternalRecord(e,t){ka.call(this,Li,t,e)}atLeastOneSepFirstInternalRecord(e,t){ka.call(this,Oi,t,e,Ta)}manyInternalRecord(e,t){ka.call(this,Di,t,e)}manySepFirstInternalRecord(e,t){ka.call(this,Mi,t,e,Ta)}orInternalRecord(e,t){return Ca.call(this,e,t)}subruleInternalRecord(e,t,r){if(ba(t),!e||!1===T.has(e,"ruleName")){const r=new Error(`<SUBRULE${Aa(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw r.KNOWN_RECORDER_ERROR=!0,r}const n=T.last(this.recordingProdStack),i=e.ruleName,s=new Ni({idx:t,nonTerminalName:i,label:null==r?void 0:r.LABEL,referencedRule:void 0});return n.definition.push(s),this.outputCst?Sa:ya}consumeInternalRecord(e,t,r){if(ba(t),!Ps(e)){const r=new Error(`<CONSUME${Aa(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw r.KNOWN_RECORDER_ERROR=!0,r}const n=T.last(this.recordingProdStack),i=new qi({idx:t,terminalType:e,label:null==r?void 0:r.LABEL});return n.definition.push(i),Ea}},class{initPerformanceTracer(e){if(T.has(e,"traceInitPerf")){const t=e.traceInitPerf,r="number"==typeof t;this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=xa.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--\x3e <${e}>`);const{time:n,value:i}=bi(t),s=n>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${r}<-- <${e}> time: ${n}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{const t=e.prototype;Object.getOwnPropertyNames(t).forEach(r=>{if("constructor"===r)return;const n=Object.getOwnPropertyDescriptor(t,r);n&&(n.get||n.set)?Object.defineProperty(_a.prototype,r,n):_a.prototype[r]=e.prototype[r]})});class Oa extends La{constructor(e,t=xa){const r=T.clone(t);r.outputCst=!1,super(e,r)}}function Da(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Ma(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new v.MapCache;++t<r;)this.add(e[t])}function Fa(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function qa(e,t){return e.has(t)}Ma.prototype.add=Ma.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ma.prototype.has=function(e){return this.__data__.has(e)};function ja(e,t,r,n,i,s){var o=1&r,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(e),u=s.get(t);if(l&&u)return l==t&&u==e;var d=-1,h=!0,p=2&r?new Ma:void 0;for(s.set(e,t),s.set(t,e);++d<a;){var f=e[d],m=t[d];if(n)var g=o?n(m,f,d,t,e,s):n(f,m,d,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!Fa(t,function(e,t){if(!qa(p,t)&&(f===e||i(f,e,r,n,s)))return p.push(t)})){h=!1;break}}else if(f!==m&&!i(f,m,r,n,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Ua(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function Ga(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var za=v.Symbol?v.Symbol.prototype:void 0,Ba=za?za.valueOf:void 0;var Ka=Object.prototype.hasOwnProperty;var Wa="[object Arguments]",Va="[object Array]",Ha="[object Object]",Ya=Object.prototype.hasOwnProperty;function Xa(e,t,r,n,i,s){var o=v.isArray(e),a=v.isArray(t),c=o?Va:v.getTag(e),l=a?Va:v.getTag(t),u=(c=c==Wa?Ha:c)==Ha,d=(l=l==Wa?Ha:l)==Ha,h=c==l;if(h&&v.isBuffer(e)){if(!v.isBuffer(t))return!1;o=!0,u=!1}if(h&&!u)return s||(s=new v.Stack),o||v.isTypedArray(e)?ja(e,t,r,n,i,s):function(e,t,r,n,i,s,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new v.Uint8Array(e),new v.Uint8Array(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return v.eq(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Ua;case"[object Set]":var c=1&n;if(a||(a=Ga),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;n|=2,o.set(e,t);var u=ja(a(e),a(t),n,i,s,o);return o.delete(e),u;case"[object Symbol]":if(Ba)return Ba.call(e)==Ba.call(t)}return!1}(e,t,c,r,n,i,s);if(!(1&r)){var p=u&&Ya.call(e,"__wrapped__"),f=d&&Ya.call(t,"__wrapped__");if(p||f){var m=p?e.value():e,g=f?t.value():t;return s||(s=new v.Stack),i(m,g,r,n,s)}}return!!h&&(s||(s=new v.Stack),function(e,t,r,n,i,s){var o=1&r,a=R.getAllKeys(e),c=a.length;if(c!=R.getAllKeys(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:Ka.call(t,u)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var p=!0;s.set(e,t),s.set(t,e);for(var f=o;++l<c;){var m=e[u=a[l]],g=t[u];if(n)var y=o?n(g,m,u,t,e,s):n(m,g,u,e,t,s);if(!(void 0===y?m===g||i(m,g,r,n,s):y)){p=!1;break}f||(f="constructor"==u)}if(p&&!f){var T=e.constructor,v=t.constructor;T==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof T&&T instanceof T&&"function"==typeof v&&v instanceof v||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,r,n,i,s))}function Ja(e,t,r,n,i){return e===t||(null==e||null==t||!v.isObjectLike(e)&&!v.isObjectLike(t)?e!=e&&t!=t:Xa(e,t,r,n,Ja,i))}function Za(e){return e==e&&!v.isObject(e)}function Qa(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}function ec(e){var t=function(e){for(var t=R.keys(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Za(i)]}return t}(e);return 1==t.length&&t[0][2]?Qa(t[0][0],t[0][1]):function(r){return r===e||function(e,t,r,n){var i=r.length,s=i;if(null==e)return!s;for(e=Object(e);i--;){var o=r[i];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++i<s;){var a=(o=r[i])[0],c=e[a],l=o[1];if(o[2]){if(void 0===c&&!(a in e))return!1}else if(!Ja(l,c,3,n,new v.Stack))return!1}return!0}(r,0,t)}}function tc(e){return"symbol"==typeof e||v.isObjectLike(e)&&"[object Symbol]"==v.baseGetTag(e)}var rc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nc=/^\w*$/;function ic(e,t){if(v.isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!tc(e))||(nc.test(e)||!rc.test(e)||null!=t&&e in Object(t))}var sc,oc,ac,cc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lc=/\\(\\)?/g,uc=(sc=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(cc,function(e,r,n,i){t.push(n?i.replace(lc,"$1"):r||e)}),t},oc=v.memoize(sc,function(e){return 500===ac.size&&ac.clear(),e}),ac=oc.cache,oc),dc=v.Symbol?v.Symbol.prototype:void 0,hc=dc?dc.toString:void 0;function pc(e){if("string"==typeof e)return e;if(v.isArray(e))return Da(e,pc)+"";if(tc(e))return hc?hc.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function fc(e,t){return v.isArray(e)?e:ic(e,t)?[e]:uc(function(e){return null==e?"":pc(e)}(e))}function mc(e){if("string"==typeof e||tc(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function gc(e,t){for(var r=0,n=(t=fc(t,e)).length;null!=e&&r<n;)e=e[mc(t[r++])];return r&&r==n?e:void 0}function yc(e,t){return null!=e&&t in Object(e)}function Tc(e,t){return null!=e&&function(e,t,r){for(var n=-1,i=(t=fc(t,e)).length,s=!1;++n<i;){var o=mc(t[n]);if(!(s=null!=e&&r(e,o)))break;e=e[o]}return s||++n!=i?s:!!(i=null==e?0:e.length)&&v.isLength(i)&&v.isIndex(o,i)&&(v.isArray(e)||v.isArguments(e))}(e,t,yc)}function vc(e,t){return ic(e)&&Za(t)?Qa(mc(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:gc(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?Tc(r,e):Ja(t,n,3)}}function Rc(e){return ic(e)?(t=mc(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return gc(t,e)}}(e);var t}function Ec(e){return"function"==typeof e?e:null==e?v.identity:"object"==typeof e?v.isArray(e)?vc(e[0],e[1]):ec(e):Rc(e)}var Sc,kc=(Sc=function(e,t){return e&&v.baseFor(e,t,R.keys)},function(e,t){if(null==e)return e;if(!v.isArrayLike(e))return Sc(e,t);for(var r=e.length,n=-1,i=Object(e);++n<r&&!1!==t(i[n],n,i););return e});function Cc(e,t){var r=-1,n=v.isArrayLike(e)?Array(e.length):[];return kc(e,function(e,i,s){n[++r]=t(e,i,s)}),n}function Ac(e,t){return(v.isArray(e)?Da:Cc)(e,Ec(t))}function bc(e,t){var r=[];return kc(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function $c(e,t,r){return`${e.name}_${t}_${r}`}class xc{constructor(e){this.target=e}isEpsilon(){return!1}}class wc extends xc{constructor(e,t){super(e),this.tokenType=t}}class Nc extends xc{constructor(e){super(e)}isEpsilon(){return!0}}class Ic extends xc{constructor(e,t,r){super(e),this.rule=t,this.followState=r}isEpsilon(){return!0}}function _c(e){const t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};!function(e,t){const r=t.length;for(let n=0;n<r;n++){const r=t[n],i=Gc(e,r,void 0,{type:2}),s=Gc(e,r,void 0,{type:7});i.stop=s,e.ruleToStartState.set(r,i),e.ruleToStopState.set(r,s)}}(t,e);const r=e.length;for(let n=0;n<r;n++){const r=e[n],i=Lc(t,r,r);void 0!==i&&jc(t,r,i)}return t}function Pc(e,t,r){return r instanceof qi?qc(e,t,r.terminalType,r):r instanceof Ni?function(e,t,r){const n=r.referencedRule,i=e.ruleToStartState.get(n),s=Gc(e,t,r,{type:1}),o=Gc(e,t,r,{type:1}),a=new Ic(i,n,o);return zc(s,a),{left:s,right:o}}(e,t,r):r instanceof Fi?function(e,t,r){const n=Gc(e,t,r,{type:1});Mc(e,n);const i=Ac(r.definition,r=>Pc(e,t,r)),s=Fc(e,t,n,r,...i);return s}(e,t,r):r instanceof Pi?function(e,t,r){const n=Gc(e,t,r,{type:1});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r));return function(e,t,r,n){const i=n.left,s=n.right;return Uc(i,s),e.decisionMap[$c(t,"Option",r.idx)]=i,n}(e,t,r,i)}(e,t,r):r instanceof Di?function(e,t,r){const n=Gc(e,t,r,{type:5});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r));return Dc(e,t,r,i)}(e,t,r):r instanceof Mi?function(e,t,r){const n=Gc(e,t,r,{type:5});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r)),s=qc(e,t,r.separator,r);return Dc(e,t,r,i,s)}(e,t,r):r instanceof Li?function(e,t,r){const n=Gc(e,t,r,{type:4});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r));return Oc(e,t,r,i)}(e,t,r):r instanceof Oi?function(e,t,r){const n=Gc(e,t,r,{type:4});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r)),s=qc(e,t,r.separator,r);return Oc(e,t,r,i,s)}(e,t,r):Lc(e,t,r)}function Lc(e,t,r){const n=(i=Ac(r.definition,r=>Pc(e,t,r)),s=e=>void 0!==e,(v.isArray(i)?R.arrayFilter:bc)(i,Ec(s)));var i,s;return 1===n.length?n[0]:0===n.length?void 0:function(e,t){const r=t.length;for(let s=0;s<r-1;s++){const r=t[s];let n;1===r.left.transitions.length&&(n=r.left.transitions[0]);const i=n instanceof Ic,o=n,a=t[s+1].left;1===r.left.type&&1===r.right.type&&void 0!==n&&(i&&o.followState===r.right||n.target===r.right)?(i?o.followState=a:n.target=a,Bc(e,r.right)):Uc(r.right,a)}const n=t[0],i=t[r-1];return{left:n.left,right:i.right}}(e,n)}function Oc(e,t,r,n,i){const s=n.left,o=n.right,a=Gc(e,t,r,{type:11});Mc(e,a);const c=Gc(e,t,r,{type:12});return s.loopback=a,c.loopback=a,e.decisionMap[$c(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=a,Uc(o,a),void 0===i?(Uc(a,s),Uc(a,c)):(Uc(a,c),Uc(a,i.left),Uc(i.right,s)),{left:s,right:c}}function Dc(e,t,r,n,i){const s=n.left,o=n.right,a=Gc(e,t,r,{type:10});Mc(e,a);const c=Gc(e,t,r,{type:12}),l=Gc(e,t,r,{type:9});return a.loopback=l,c.loopback=l,Uc(a,s),Uc(a,c),Uc(o,l),void 0!==i?(Uc(l,c),Uc(l,i.left),Uc(i.right,s)):Uc(l,a),e.decisionMap[$c(t,i?"RepetitionWithSeparator":"Repetition",r.idx)]=a,{left:a,right:c}}function Mc(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function Fc(e,t,r,n,...i){const s=Gc(e,t,n,{type:8,start:r});r.end=s;for(const a of i)void 0!==a?(Uc(r,a.left),Uc(a.right,s)):Uc(r,s);const o={left:r,right:s};return e.decisionMap[$c(t,function(e){if(e instanceof Fi)return"Alternation";if(e instanceof Pi)return"Option";if(e instanceof Di)return"Repetition";if(e instanceof Mi)return"RepetitionWithSeparator";if(e instanceof Li)return"RepetitionMandatory";if(e instanceof Oi)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}(n),n.idx)]=r,o}function qc(e,t,r,n){const i=Gc(e,t,n,{type:1}),s=Gc(e,t,n,{type:1});return zc(i,new wc(s,r)),{left:i,right:s}}function jc(e,t,r){const n=e.ruleToStartState.get(t);Uc(n,r.left);const i=e.ruleToStopState.get(t);Uc(r.right,i);return{left:n,right:i}}function Uc(e,t){zc(e,new Nc(t))}function Gc(e,t,r,n){const i=Object.assign({atn:e,production:r,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},n);return e.states.push(i),i}function zc(e,t){0===e.transitions.length&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function Bc(e,t){e.states.splice(e.states.indexOf(t),1)}const Kc={};class Wc{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Vc(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return Ac(this.configs,e=>e.alt)}get key(){let e="";for(const t in this.map)e+=t+":";return e}}function Vc(e,t=!0){return`${t?`a${e.alt}`:""}s${e.state.stateNumber}:${e.stack.map(e=>e.stateNumber.toString()).join("_")}`}function Hc(e,t){return e<t}function Yc(e){return e&&e.length?function(e,t,r){for(var n=-1,i=e.length;++n<i;){var s=e[n],o=t(s);if(null!=o&&(void 0===a?o==o&&!tc(o):r(o,a)))var a=o,c=s}return c}(e,v.identity,Hc):void 0}var Xc=v.Symbol?v.Symbol.isConcatSpreadable:void 0;function Jc(e){return v.isArray(e)||v.isArguments(e)||!!(Xc&&e&&e[Xc])}function Zc(e,t,r,n,i){var s=-1,o=e.length;for(r||(r=Jc),i||(i=[]);++s<o;){var a=e[s];r(a)?R.arrayPush(i,a):i[i.length]=a}return i}function Qc(e){return e!=e}function el(e,t){return!!(null==e?0:e.length)&&function(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):function(e,t,r){for(var n=e.length,i=r+-1;++i<n;)if(t(e[i],i,e))return i;return-1}(e,Qc,r)}(e,t,0)>-1}var tl=v.Set&&1/Ga(new v.Set([,-0]))[1]==1/0?function(e){return new v.Set(e)}:function(){};function rl(e,t){return e&&e.length?function(e,t,r){var n=-1,i=el,s=e.length,o=!0,a=[],c=a;if(s>=200){var l=t?null:tl(e);if(l)return Ga(l);o=!1,i=qa,c=new Ma}else c=t?[]:a;e:for(;++n<s;){var u=e[n],d=t?t(u):u;if(u=0!==u?u:0,o&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),a.push(u)}else i(c,d,r)||(c!==a&&c.push(d),a.push(u))}return a}(e,Ec(t)):[]}function nl(e,t){var r;return(v.isArray(e)?R.arrayEach:kc)(e,"function"==typeof(r=t)?r:v.identity)}function il(e,t,r,n){var i=-1,s=null==e?0:e.length;for(n&&s&&(r=e[++i]);++i<s;)r=t(r,e[i],i,e);return r}function sl(e,t,r,n,i){return i(e,function(e,i,s){r=n?(n=!1,e):t(r,e,i,s)}),r}function ol(e,t,r){var n=v.isArray(e)?il:sl,i=arguments.length<3;return n(e,Ec(t),r,i,kc)}function al(e,t){const r={};return n=>{const i=n.toString();let s=r[i];return void 0!==s||(s={atnStartState:e,decision:t,states:{}},r[i]=s),s}}class cl{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 r=0;r<t;r++)e+=!0===this.predicates[r]?"1":"0";return e}}const ll=new cl;class ul extends ca{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=_c(e.rules),this.dfas=function(e){const t=e.decisionStates.length,r=Array(t);for(let n=0;n<t;n++)r[n]=al(e.decisionStates[n],n);return r}(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:t,rule:r,hasPredicates:n,dynamicTokensEnabled:i}=e,s=this.dfas,o=this.logging,a=$c(r,"Alternation",t),c=this.atn.decisionMap[a].decision,l=Ac(Ro({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:r}),e=>Ac(e,e=>e[0]));if(dl(l,!1)&&!i){const e=ol(l,(e,t,r)=>(nl(t,t=>{t&&(e[t.tokenTypeIdx]=r,nl(t.categoryMatches,t=>{e[t]=r}))}),e),{});return n?function(t){var r;const n=this.LA(1),i=e[n.tokenTypeIdx];if(void 0!==t&&void 0!==i){const e=null===(r=t[i])||void 0===r?void 0:r.GATE;if(void 0!==e&&!1===e.call(this))return}return i}:function(){const t=this.LA(1);return e[t.tokenTypeIdx]}}return n?function(e){const t=new cl,r=void 0===e?0:e.length;for(let i=0;i<r;i++){const r=null==e?void 0:e[i].GATE;t.set(i,void 0===r||r.call(this))}const n=hl.call(this,s,c,t,o);return"number"==typeof n?n:void 0}:function(){const e=hl.call(this,s,c,ll,o);return"number"==typeof e?e:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:t,rule:r,prodType:n,dynamicTokensEnabled:i}=e,s=this.dfas,o=this.logging,a=$c(r,n,t),c=this.atn.decisionMap[a].decision,l=Ac(Ro({maxLookahead:1,occurrence:t,prodType:n,rule:r}),e=>Ac(e,e=>e[0]));if(dl(l)&&l[0][0]&&!i){const e=l[0],t=null!=(u=e)&&u.length?Zc(u):[];if(1===t.length&&v.isEmpty(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=ol(t,(e,t)=>(void 0!==t&&(e[t.tokenTypeIdx]=!0,nl(t.categoryMatches,t=>{e[t]=!0})),e),{});return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}var u;return function(){const e=hl.call(this,s,c,ll,o);return"object"!=typeof e&&0===e}}}function dl(e,t=!0){const r=new Set;for(const n of e){const e=new Set;for(const i of n){if(void 0===i){if(t)break;return!1}const n=[i.tokenTypeIdx].concat(i.categoryMatches);for(const t of n)if(r.has(t)){if(!e.has(t))return!1}else r.add(t),e.add(t)}}return!0}function hl(e,t,r,n){const i=e[t](r);let s=i.start;if(void 0===s){s=El(i,vl(function(e){const t=new Wc,r=e.transitions.length;for(let n=0;n<r;n++){Sl({state:e.transitions[n].target,alt:n,stack:[]},t)}return t}(i.atnStartState))),i.start=s}return pl.apply(this,[i,s,r,n])}function pl(e,t,r,n){let i=t,s=1;const o=[];let a=this.LA(s++);for(;;){let t=yl(i,a);if(void 0===t&&(t=fl.apply(this,[e,i,a,s,r,n])),t===Kc)return gl(o,i,a);if(!0===t.isAcceptState)return t.prediction;i=t,o.push(a),a=this.LA(s++)}}function fl(e,t,r,n,i,s){const o=function(e,t,r){const n=new Wc,i=[];for(const o of e.elements){if(!1===r.is(o.alt))continue;if(7===o.state.type){i.push(o);continue}const e=o.state.transitions.length;for(let r=0;r<e;r++){const e=Tl(o.state.transitions[r],t);void 0!==e&&n.add({state:e,alt:o.alt,stack:o.stack})}}let s;0===i.length&&1===n.size&&(s=n);if(void 0===s){s=new Wc;for(const e of n.elements)Sl(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 o of i)s.add(o);return s}(t.configs,r,i);if(0===o.size)return Rl(e,t,r,Kc),Kc;let a=vl(o);const c=function(e,t){let r;for(const n of e.elements)if(!0===t.is(n.alt))if(void 0===r)r=n.alt;else if(r!==n.alt)return;return r}(o,i);if(void 0!==c)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;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 r of e){const e=Vc(r,!1);let n=t.get(e);void 0===n&&(n={},t.set(e,n)),n[r.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)}(o)){const t=Yc(o.alts);a.isAcceptState=!0,a.prediction=t,a.configs.uniqueAlt=t,ml.apply(this,[e,n,o.alts,s])}return a=Rl(e,t,r,a),a}function ml(e,t,r,n){const i=[];for(let o=1;o<=t;o++)i.push(this.LA(o).tokenType);const s=e.atnStartState;n(function(e){const t=Ac(e.prefixPath,e=>Us(e)).join(", "),r=0===e.production.idx?"":e.production.idx;let n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${function(e){if(e instanceof Ni)return"SUBRULE";if(e instanceof Pi)return"OPTION";if(e instanceof Fi)return"OR";if(e instanceof Li)return"AT_LEAST_ONE";if(e instanceof Oi)return"AT_LEAST_ONE_SEP";if(e instanceof Mi)return"MANY_SEP";if(e instanceof Di)return"MANY";if(e instanceof qi)return"CONSUME";throw Error("non exhaustive match")}(e.production)}${r}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return n+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",n}({topLevelRule:s.rule,ambiguityIndices:r,production:s.production,prefixPath:i}))}function gl(e,t,r){return{actualToken:r,possibleTokenTypes:rl(Zc(Ac(t.configs.elements,e=>e.state.transitions)).filter(e=>e instanceof wc).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:e}}function yl(e,t){return e.edges[t.tokenTypeIdx]}function Tl(e,t){if(e instanceof wc&&to(t,e.tokenType))return e.target}function vl(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function Rl(e,t,r,n){return n=El(e,n),t.edges[r.tokenTypeIdx]=n,n}function El(e,t){if(t===Kc)return t;const r=t.configs.key,n=e.states[r];return void 0!==n?n:(t.configs.finalize(),e.states[r]=t,t)}function Sl(e,t){const r=e.state;if(7===r.type){if(e.stack.length>0){const r=[...e.stack];Sl({state:r.pop(),alt:e.alt,stack:r},t)}else t.add(e);return}r.epsilonOnlyTransitions||t.add(e);const n=r.transitions.length;for(let i=0;i<n;i++){const n=kl(e,r.transitions[i]);void 0!==n&&Sl(n,t)}}function kl(e,t){if(t instanceof Nc)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof Ic){const r=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:r}}}var Cl,Al,bl,$l,xl,wl,Nl,Il,_l,Pl,Ll,Ol,Dl,Ml,Fl,ql,jl,Ul,Gl,zl,Bl,Kl,Wl,Vl,Hl,Yl,Xl,Jl,Zl,Ql,eu,tu,ru,nu,iu,su,ou,au,cu,lu,uu,du,hu,pu,fu,mu,gu,yu,Tu,vu,Ru,Eu,Su,ku,Cu,Au,bu,$u,xu,wu,Nu,Iu,_u,Pu,Lu,Ou,Du,Mu,Fu,qu,ju,Uu,Gu,zu,Bu,Ku,Wu,Vu,Hu,Yu,Xu,Ju,Zu,Qu,ed,td,rd,nd,id,sd,od,ad,cd,ld,ud,dd,hd,pd,fd,md,gd,yd,Td,vd,Rd,Ed,Sd,kd,Cd,Ad,bd,$d,xd,wd,Nd,Id,_d,Pd,Ld,Od,Dd,Md,Fd,qd,jd,Ud,Gd,zd,Bd,Kd,Wd,Vd;(Cl||(Cl={})).is=function(e){return"string"==typeof e},(Al||(Al={})).is=function(e){return"string"==typeof e},($l=bl||(bl={})).MIN_VALUE=-2147483648,$l.MAX_VALUE=2147483647,$l.is=function(e){return"number"==typeof e&&$l.MIN_VALUE<=e&&e<=$l.MAX_VALUE},(wl=xl||(xl={})).MIN_VALUE=0,wl.MAX_VALUE=2147483647,wl.is=function(e){return"number"==typeof e&&wl.MIN_VALUE<=e&&e<=wl.MAX_VALUE},(Il=Nl||(Nl={})).create=function(e,t){return e===Number.MAX_VALUE&&(e=xl.MAX_VALUE),t===Number.MAX_VALUE&&(t=xl.MAX_VALUE),{line:e,character:t}},Il.is=function(e){let t=e;return Zd.objectLiteral(t)&&Zd.uinteger(t.line)&&Zd.uinteger(t.character)},(Pl=_l||(_l={})).create=function(e,t,r,n){if(Zd.uinteger(e)&&Zd.uinteger(t)&&Zd.uinteger(r)&&Zd.uinteger(n))return{start:Nl.create(e,t),end:Nl.create(r,n)};if(Nl.is(e)&&Nl.is(t))return{start:e,end:t};throw new Error(`Range#create called with invalid arguments[${e}, ${t}, ${r}, ${n}]`)},Pl.is=function(e){let t=e;return Zd.objectLiteral(t)&&Nl.is(t.start)&&Nl.is(t.end)},(Ol=Ll||(Ll={})).create=function(e,t){return{uri:e,range:t}},Ol.is=function(e){let t=e;return Zd.objectLiteral(t)&&_l.is(t.range)&&(Zd.string(t.uri)||Zd.undefined(t.uri))},(Ml=Dl||(Dl={})).create=function(e,t,r,n){return{targetUri:e,targetRange:t,targetSelectionRange:r,originSelectionRange:n}},Ml.is=function(e){let t=e;return Zd.objectLiteral(t)&&_l.is(t.targetRange)&&Zd.string(t.targetUri)&&_l.is(t.targetSelectionRange)&&(_l.is(t.originSelectionRange)||Zd.undefined(t.originSelectionRange))},(ql=Fl||(Fl={})).create=function(e,t,r,n){return{red:e,green:t,blue:r,alpha:n}},ql.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.numberRange(t.red,0,1)&&Zd.numberRange(t.green,0,1)&&Zd.numberRange(t.blue,0,1)&&Zd.numberRange(t.alpha,0,1)},(Ul=jl||(jl={})).create=function(e,t){return{range:e,color:t}},Ul.is=function(e){const t=e;return Zd.objectLiteral(t)&&_l.is(t.range)&&Fl.is(t.color)},(zl=Gl||(Gl={})).create=function(e,t,r){return{label:e,textEdit:t,additionalTextEdits:r}},zl.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.label)&&(Zd.undefined(t.textEdit)||su.is(t))&&(Zd.undefined(t.additionalTextEdits)||Zd.typedArray(t.additionalTextEdits,su.is))},(Kl=Bl||(Bl={})).Comment="comment",Kl.Imports="imports",Kl.Region="region",(Vl=Wl||(Wl={})).create=function(e,t,r,n,i,s){const o={startLine:e,endLine:t};return Zd.defined(r)&&(o.startCharacter=r),Zd.defined(n)&&(o.endCharacter=n),Zd.defined(i)&&(o.kind=i),Zd.defined(s)&&(o.collapsedText=s),o},Vl.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.uinteger(t.startLine)&&Zd.uinteger(t.startLine)&&(Zd.undefined(t.startCharacter)||Zd.uinteger(t.startCharacter))&&(Zd.undefined(t.endCharacter)||Zd.uinteger(t.endCharacter))&&(Zd.undefined(t.kind)||Zd.string(t.kind))},(Yl=Hl||(Hl={})).create=function(e,t){return{location:e,message:t}},Yl.is=function(e){let t=e;return Zd.defined(t)&&Ll.is(t.location)&&Zd.string(t.message)},(Jl=Xl||(Xl={})).Error=1,Jl.Warning=2,Jl.Information=3,Jl.Hint=4,(Ql=Zl||(Zl={})).Unnecessary=1,Ql.Deprecated=2,(eu||(eu={})).is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.href)},(ru=tu||(tu={})).create=function(e,t,r,n,i,s){let o={range:e,message:t};return Zd.defined(r)&&(o.severity=r),Zd.defined(n)&&(o.code=n),Zd.defined(i)&&(o.source=i),Zd.defined(s)&&(o.relatedInformation=s),o},ru.is=function(e){var t;let r=e;return Zd.defined(r)&&_l.is(r.range)&&Zd.string(r.message)&&(Zd.number(r.severity)||Zd.undefined(r.severity))&&(Zd.integer(r.code)||Zd.string(r.code)||Zd.undefined(r.code))&&(Zd.undefined(r.codeDescription)||Zd.string(null===(t=r.codeDescription)||void 0===t?void 0:t.href))&&(Zd.string(r.source)||Zd.undefined(r.source))&&(Zd.undefined(r.relatedInformation)||Zd.typedArray(r.relatedInformation,Hl.is))},(iu=nu||(nu={})).create=function(e,t,...r){let n={title:e,command:t};return Zd.defined(r)&&r.length>0&&(n.arguments=r),n},iu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.title)&&Zd.string(t.command)},(ou=su||(su={})).replace=function(e,t){return{range:e,newText:t}},ou.insert=function(e,t){return{range:{start:e,end:e},newText:t}},ou.del=function(e){return{range:e,newText:""}},ou.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.newText)&&_l.is(t.range)},(cu=au||(au={})).create=function(e,t,r){const n={label:e};return void 0!==t&&(n.needsConfirmation=t),void 0!==r&&(n.description=r),n},cu.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.label)&&(Zd.boolean(t.needsConfirmation)||void 0===t.needsConfirmation)&&(Zd.string(t.description)||void 0===t.description)},(lu||(lu={})).is=function(e){const t=e;return Zd.string(t)},(du=uu||(uu={})).replace=function(e,t,r){return{range:e,newText:t,annotationId:r}},du.insert=function(e,t,r){return{range:{start:e,end:e},newText:t,annotationId:r}},du.del=function(e,t){return{range:e,newText:"",annotationId:t}},du.is=function(e){const t=e;return su.is(t)&&(au.is(t.annotationId)||lu.is(t.annotationId))},(pu=hu||(hu={})).create=function(e,t){return{textDocument:e,edits:t}},pu.is=function(e){let t=e;return Zd.defined(t)&&Au.is(t.textDocument)&&Array.isArray(t.edits)},(mu=fu||(fu={})).create=function(e,t,r){let n={kind:"create",uri:e};return void 0===t||void 0===t.overwrite&&void 0===t.ignoreIfExists||(n.options=t),void 0!==r&&(n.annotationId=r),n},mu.is=function(e){let t=e;return t&&"create"===t.kind&&Zd.string(t.uri)&&(void 0===t.options||(void 0===t.options.overwrite||Zd.boolean(t.options.overwrite))&&(void 0===t.options.ignoreIfExists||Zd.boolean(t.options.ignoreIfExists)))&&(void 0===t.annotationId||lu.is(t.annotationId))},(yu=gu||(gu={})).create=function(e,t,r,n){let i={kind:"rename",oldUri:e,newUri:t};return void 0===r||void 0===r.overwrite&&void 0===r.ignoreIfExists||(i.options=r),void 0!==n&&(i.annotationId=n),i},yu.is=function(e){let t=e;return t&&"rename"===t.kind&&Zd.string(t.oldUri)&&Zd.string(t.newUri)&&(void 0===t.options||(void 0===t.options.overwrite||Zd.boolean(t.options.overwrite))&&(void 0===t.options.ignoreIfExists||Zd.boolean(t.options.ignoreIfExists)))&&(void 0===t.annotationId||lu.is(t.annotationId))},(vu=Tu||(Tu={})).create=function(e,t,r){let n={kind:"delete",uri:e};return void 0===t||void 0===t.recursive&&void 0===t.ignoreIfNotExists||(n.options=t),void 0!==r&&(n.annotationId=r),n},vu.is=function(e){let t=e;return t&&"delete"===t.kind&&Zd.string(t.uri)&&(void 0===t.options||(void 0===t.options.recursive||Zd.boolean(t.options.recursive))&&(void 0===t.options.ignoreIfNotExists||Zd.boolean(t.options.ignoreIfNotExists)))&&(void 0===t.annotationId||lu.is(t.annotationId))},(Ru||(Ru={})).is=function(e){let t=e;return t&&(void 0!==t.changes||void 0!==t.documentChanges)&&(void 0===t.documentChanges||t.documentChanges.every(e=>Zd.string(e.kind)?fu.is(e)||gu.is(e)||Tu.is(e):hu.is(e)))};class Hd{constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,i;if(void 0===r?n=su.insert(e,t):lu.is(r)?(i=r,n=uu.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=uu.insert(e,t,i)),this.edits.push(n),void 0!==i)return i}replace(e,t,r){let n,i;if(void 0===r?n=su.replace(e,t):lu.is(r)?(i=r,n=uu.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=uu.replace(e,t,i)),this.edits.push(n),void 0!==i)return i}delete(e,t){let r,n;if(void 0===t?r=su.del(e):lu.is(t)?(n=t,r=uu.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=uu.del(e,n)),this.edits.push(r),void 0!==n)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(void 0===e)throw new Error("Text edit change is not configured to manage change annotations.")}}class Yd{constructor(e){this._annotations=void 0===e?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(lu.is(e)?r=e:(r=this.nextId(),t=e),void 0!==this._annotations[r])throw new Error(`Id ${r} is already in use.`);if(void 0===t)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}}(Su=Eu||(Eu={})).create=function(e){return{uri:e}},Su.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)},(Cu=ku||(ku={})).create=function(e,t){return{uri:e,version:t}},Cu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)&&Zd.integer(t.version)},(bu=Au||(Au={})).create=function(e,t){return{uri:e,version:t}},bu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)&&(null===t.version||Zd.integer(t.version))},(xu=$u||($u={})).create=function(e,t,r,n){return{uri:e,languageId:t,version:r,text:n}},xu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)&&Zd.string(t.languageId)&&Zd.integer(t.version)&&Zd.string(t.text)},(Nu=wu||(wu={})).PlainText="plaintext",Nu.Markdown="markdown",Nu.is=function(e){const t=e;return t===Nu.PlainText||t===Nu.Markdown},(Iu||(Iu={})).is=function(e){const t=e;return Zd.objectLiteral(e)&&wu.is(t.kind)&&Zd.string(t.value)},(Pu=_u||(_u={})).Text=1,Pu.Method=2,Pu.Function=3,Pu.Constructor=4,Pu.Field=5,Pu.Variable=6,Pu.Class=7,Pu.Interface=8,Pu.Module=9,Pu.Property=10,Pu.Unit=11,Pu.Value=12,Pu.Enum=13,Pu.Keyword=14,Pu.Snippet=15,Pu.Color=16,Pu.File=17,Pu.Reference=18,Pu.Folder=19,Pu.EnumMember=20,Pu.Constant=21,Pu.Struct=22,Pu.Event=23,Pu.Operator=24,Pu.TypeParameter=25,(Ou=Lu||(Lu={})).PlainText=1,Ou.Snippet=2,(Du||(Du={})).Deprecated=1,(Fu=Mu||(Mu={})).create=function(e,t,r){return{newText:e,insert:t,replace:r}},Fu.is=function(e){const t=e;return t&&Zd.string(t.newText)&&_l.is(t.insert)&&_l.is(t.replace)},(ju=qu||(qu={})).asIs=1,ju.adjustIndentation=2,(Uu||(Uu={})).is=function(e){const t=e;return t&&(Zd.string(t.detail)||void 0===t.detail)&&(Zd.string(t.description)||void 0===t.description)},(Gu||(Gu={})).create=function(e){return{label:e}},(zu||(zu={})).create=function(e,t){return{items:e||[],isIncomplete:!!t}},(Ku=Bu||(Bu={})).fromPlainText=function(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},Ku.is=function(e){const t=e;return Zd.string(t)||Zd.objectLiteral(t)&&Zd.string(t.language)&&Zd.string(t.value)},(Wu||(Wu={})).is=function(e){let t=e;return!!t&&Zd.objectLiteral(t)&&(Iu.is(t.contents)||Bu.is(t.contents)||Zd.typedArray(t.contents,Bu.is))&&(void 0===e.range||_l.is(e.range))},(Vu||(Vu={})).create=function(e,t){return t?{label:e,documentation:t}:{label:e}},(Hu||(Hu={})).create=function(e,t,...r){let n={label:e};return Zd.defined(t)&&(n.documentation=t),Zd.defined(r)?n.parameters=r:n.parameters=[],n},(Xu=Yu||(Yu={})).Text=1,Xu.Read=2,Xu.Write=3,(Ju||(Ju={})).create=function(e,t){let r={range:e};return Zd.number(t)&&(r.kind=t),r},(Qu=Zu||(Zu={})).File=1,Qu.Module=2,Qu.Namespace=3,Qu.Package=4,Qu.Class=5,Qu.Method=6,Qu.Property=7,Qu.Field=8,Qu.Constructor=9,Qu.Enum=10,Qu.Interface=11,Qu.Function=12,Qu.Variable=13,Qu.Constant=14,Qu.String=15,Qu.Number=16,Qu.Boolean=17,Qu.Array=18,Qu.Object=19,Qu.Key=20,Qu.Null=21,Qu.EnumMember=22,Qu.Struct=23,Qu.Event=24,Qu.Operator=25,Qu.TypeParameter=26,(ed||(ed={})).Deprecated=1,(td||(td={})).create=function(e,t,r,n,i){let s={name:e,kind:t,location:{uri:n,range:r}};return i&&(s.containerName=i),s},(rd||(rd={})).create=function(e,t,r,n){return void 0!==n?{name:e,kind:t,location:{uri:r,range:n}}:{name:e,kind:t,location:{uri:r}}},(id=nd||(nd={})).create=function(e,t,r,n,i,s){let o={name:e,detail:t,kind:r,range:n,selectionRange:i};return void 0!==s&&(o.children=s),o},id.is=function(e){let t=e;return t&&Zd.string(t.name)&&Zd.number(t.kind)&&_l.is(t.range)&&_l.is(t.selectionRange)&&(void 0===t.detail||Zd.string(t.detail))&&(void 0===t.deprecated||Zd.boolean(t.deprecated))&&(void 0===t.children||Array.isArray(t.children))&&(void 0===t.tags||Array.isArray(t.tags))},(od=sd||(sd={})).Empty="",od.QuickFix="quickfix",od.Refactor="refactor",od.RefactorExtract="refactor.extract",od.RefactorInline="refactor.inline",od.RefactorRewrite="refactor.rewrite",od.Source="source",od.SourceOrganizeImports="source.organizeImports",od.SourceFixAll="source.fixAll",(cd=ad||(ad={})).Invoked=1,cd.Automatic=2,(ud=ld||(ld={})).create=function(e,t,r){let n={diagnostics:e};return null!=t&&(n.only=t),null!=r&&(n.triggerKind=r),n},ud.is=function(e){let t=e;return Zd.defined(t)&&Zd.typedArray(t.diagnostics,tu.is)&&(void 0===t.only||Zd.typedArray(t.only,Zd.string))&&(void 0===t.triggerKind||t.triggerKind===ad.Invoked||t.triggerKind===ad.Automatic)},(hd=dd||(dd={})).create=function(e,t,r){let n={title:e},i=!0;return"string"==typeof t?(i=!1,n.kind=t):nu.is(t)?n.command=t:n.edit=t,i&&void 0!==r&&(n.kind=r),n},hd.is=function(e){let t=e;return t&&Zd.string(t.title)&&(void 0===t.diagnostics||Zd.typedArray(t.diagnostics,tu.is))&&(void 0===t.kind||Zd.string(t.kind))&&(void 0!==t.edit||void 0!==t.command)&&(void 0===t.command||nu.is(t.command))&&(void 0===t.isPreferred||Zd.boolean(t.isPreferred))&&(void 0===t.edit||Ru.is(t.edit))},(fd=pd||(pd={})).create=function(e,t){let r={range:e};return Zd.defined(t)&&(r.data=t),r},fd.is=function(e){let t=e;return Zd.defined(t)&&_l.is(t.range)&&(Zd.undefined(t.command)||nu.is(t.command))},(gd=md||(md={})).create=function(e,t){return{tabSize:e,insertSpaces:t}},gd.is=function(e){let t=e;return Zd.defined(t)&&Zd.uinteger(t.tabSize)&&Zd.boolean(t.insertSpaces)},(Td=yd||(yd={})).create=function(e,t,r){return{range:e,target:t,data:r}},Td.is=function(e){let t=e;return Zd.defined(t)&&_l.is(t.range)&&(Zd.undefined(t.target)||Zd.string(t.target))},(Rd=vd||(vd={})).create=function(e,t){return{range:e,parent:t}},Rd.is=function(e){let t=e;return Zd.objectLiteral(t)&&_l.is(t.range)&&(void 0===t.parent||Rd.is(t.parent))},(Sd=Ed||(Ed={})).namespace="namespace",Sd.type="type",Sd.class="class",Sd.enum="enum",Sd.interface="interface",Sd.struct="struct",Sd.typeParameter="typeParameter",Sd.parameter="parameter",Sd.variable="variable",Sd.property="property",Sd.enumMember="enumMember",Sd.event="event",Sd.function="function",Sd.method="method",Sd.macro="macro",Sd.keyword="keyword",Sd.modifier="modifier",Sd.comment="comment",Sd.string="string",Sd.number="number",Sd.regexp="regexp",Sd.operator="operator",Sd.decorator="decorator",(Cd=kd||(kd={})).declaration="declaration",Cd.definition="definition",Cd.readonly="readonly",Cd.static="static",Cd.deprecated="deprecated",Cd.abstract="abstract",Cd.async="async",Cd.modification="modification",Cd.documentation="documentation",Cd.defaultLibrary="defaultLibrary",(Ad||(Ad={})).is=function(e){const t=e;return Zd.objectLiteral(t)&&(void 0===t.resultId||"string"==typeof t.resultId)&&Array.isArray(t.data)&&(0===t.data.length||"number"==typeof t.data[0])},($d=bd||(bd={})).create=function(e,t){return{range:e,text:t}},$d.is=function(e){const t=e;return null!=t&&_l.is(t.range)&&Zd.string(t.text)},(wd=xd||(xd={})).create=function(e,t,r){return{range:e,variableName:t,caseSensitiveLookup:r}},wd.is=function(e){const t=e;return null!=t&&_l.is(t.range)&&Zd.boolean(t.caseSensitiveLookup)&&(Zd.string(t.variableName)||void 0===t.variableName)},(Id=Nd||(Nd={})).create=function(e,t){return{range:e,expression:t}},Id.is=function(e){const t=e;return null!=t&&_l.is(t.range)&&(Zd.string(t.expression)||void 0===t.expression)},(Pd=_d||(_d={})).create=function(e,t){return{frameId:e,stoppedLocation:t}},Pd.is=function(e){const t=e;return Zd.defined(t)&&_l.is(e.stoppedLocation)},(Od=Ld||(Ld={})).Type=1,Od.Parameter=2,Od.is=function(e){return 1===e||2===e},(Md=Dd||(Dd={})).create=function(e){return{value:e}},Md.is=function(e){const t=e;return Zd.objectLiteral(t)&&(void 0===t.tooltip||Zd.string(t.tooltip)||Iu.is(t.tooltip))&&(void 0===t.location||Ll.is(t.location))&&(void 0===t.command||nu.is(t.command))},(qd=Fd||(Fd={})).create=function(e,t,r){const n={position:e,label:t};return void 0!==r&&(n.kind=r),n},qd.is=function(e){const t=e;return Zd.objectLiteral(t)&&Nl.is(t.position)&&(Zd.string(t.label)||Zd.typedArray(t.label,Dd.is))&&(void 0===t.kind||Ld.is(t.kind))&&void 0===t.textEdits||Zd.typedArray(t.textEdits,su.is)&&(void 0===t.tooltip||Zd.string(t.tooltip)||Iu.is(t.tooltip))&&(void 0===t.paddingLeft||Zd.boolean(t.paddingLeft))&&(void 0===t.paddingRight||Zd.boolean(t.paddingRight))},(jd||(jd={})).createSnippet=function(e){return{kind:"snippet",value:e}},(Ud||(Ud={})).create=function(e,t,r,n){return{insertText:e,filterText:t,range:r,command:n}},(Gd||(Gd={})).create=function(e){return{items:e}},(Bd=zd||(zd={})).Invoked=0,Bd.Automatic=1,(Kd||(Kd={})).create=function(e,t){return{range:e,text:t}},(Wd||(Wd={})).create=function(e,t){return{triggerKind:e,selectedCompletionInfo:t}},(Vd||(Vd={})).is=function(e){const t=e;return Zd.objectLiteral(t)&&Al.is(t.uri)&&Zd.string(t.name)};var Xd;!function(e){function t(e,r){if(e.length<=1)return e;const n=e.length/2|0,i=e.slice(0,n),s=e.slice(n);t(i,r),t(s,r);let o=0,a=0,c=0;for(;o<i.length&&a<s.length;){let t=r(i[o],s[a]);e[c++]=t<=0?i[o++]:s[a++]}for(;o<i.length;)e[c++]=i[o++];for(;a<s.length;)e[c++]=s[a++];return e}e.create=function(e,t,r,n){return new Jd(e,t,r,n)},e.is=function(e){let t=e;return!!(Zd.defined(t)&&Zd.string(t.uri)&&(Zd.undefined(t.languageId)||Zd.string(t.languageId))&&Zd.uinteger(t.lineCount)&&Zd.func(t.getText)&&Zd.func(t.positionAt)&&Zd.func(t.offsetAt))},e.applyEdits=function(e,r){let n=e.getText(),i=t(r,(e,t)=>{let r=e.range.start.line-t.range.start.line;return 0===r?e.range.start.character-t.range.start.character:r}),s=n.length;for(let t=i.length-1;t>=0;t--){let r=i[t],o=e.offsetAt(r.range.start),a=e.offsetAt(r.range.end);if(!(a<=s))throw new Error("Overlapping edit");n=n.substring(0,o)+r.newText+n.substring(a,n.length),s=o}return n}}(Xd||(Xd={}));let Jd=class{constructor(e,t,r,n){this._uri=e,this._languageId=t,this._version=r,this._content=n,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(t,r)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(void 0===this._lineOffsets){let e=[],t=this._content,r=!0;for(let n=0;n<t.length;n++){r&&(e.push(n),r=!1);let i=t.charAt(n);r="\r"===i||"\n"===i,"\r"===i&&n+1<t.length&&"\n"===t.charAt(n+1)&&n++}r&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,n=t.length;if(0===n)return Nl.create(0,e);for(;r<n;){let i=Math.floor((r+n)/2);t[i]>e?n=i:r=i+1}let i=r-1;return Nl.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],n=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,n),r)}get lineCount(){return this.getLineOffsets().length}};var Zd;!function(e){const t=Object.prototype.toString;e.defined=function(e){return void 0!==e},e.undefined=function(e){return void 0===e},e.boolean=function(e){return!0===e||!1===e},e.string=function(e){return"[object String]"===t.call(e)},e.number=function(e){return"[object Number]"===t.call(e)},e.numberRange=function(e,r,n){return"[object Number]"===t.call(e)&&r<=e&&e<=n},e.integer=function(e){return"[object Number]"===t.call(e)&&-2147483648<=e&&e<=2147483647},e.uinteger=function(e){return"[object Number]"===t.call(e)&&0<=e&&e<=2147483647},e.func=function(e){return"[object Function]"===t.call(e)},e.objectLiteral=function(e){return null!==e&&"object"==typeof e},e.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)}}(Zd||(Zd={}));const Qd=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return uu},get ChangeAnnotation(){return au},get ChangeAnnotationIdentifier(){return lu},get CodeAction(){return dd},get CodeActionContext(){return ld},get CodeActionKind(){return sd},get CodeActionTriggerKind(){return ad},get CodeDescription(){return eu},get CodeLens(){return pd},get Color(){return Fl},get ColorInformation(){return jl},get ColorPresentation(){return Gl},get Command(){return nu},get CompletionItem(){return Gu},get CompletionItemKind(){return _u},get CompletionItemLabelDetails(){return Uu},get CompletionItemTag(){return Du},get CompletionList(){return zu},get CreateFile(){return fu},get DeleteFile(){return Tu},get Diagnostic(){return tu},get DiagnosticRelatedInformation(){return Hl},get DiagnosticSeverity(){return Xl},get DiagnosticTag(){return Zl},get DocumentHighlight(){return Ju},get DocumentHighlightKind(){return Yu},get DocumentLink(){return yd},get DocumentSymbol(){return nd},get DocumentUri(){return Cl},EOL:["\n","\r\n","\r"],get FoldingRange(){return Wl},get FoldingRangeKind(){return Bl},get FormattingOptions(){return md},get Hover(){return Wu},get InlayHint(){return Fd},get InlayHintKind(){return Ld},get InlayHintLabelPart(){return Dd},get InlineCompletionContext(){return Wd},get InlineCompletionItem(){return Ud},get InlineCompletionList(){return Gd},get InlineCompletionTriggerKind(){return zd},get InlineValueContext(){return _d},get InlineValueEvaluatableExpression(){return Nd},get InlineValueText(){return bd},get InlineValueVariableLookup(){return xd},get InsertReplaceEdit(){return Mu},get InsertTextFormat(){return Lu},get InsertTextMode(){return qu},get Location(){return Ll},get LocationLink(){return Dl},get MarkedString(){return Bu},get MarkupContent(){return Iu},get MarkupKind(){return wu},get OptionalVersionedTextDocumentIdentifier(){return Au},get ParameterInformation(){return Vu},get Position(){return Nl},get Range(){return _l},get RenameFile(){return gu},get SelectedCompletionInfo(){return Kd},get SelectionRange(){return vd},get SemanticTokenModifiers(){return kd},get SemanticTokenTypes(){return Ed},get SemanticTokens(){return Ad},get SignatureInformation(){return Hu},get StringValue(){return jd},get SymbolInformation(){return td},get SymbolKind(){return Zu},get SymbolTag(){return ed},get TextDocument(){return Xd},get TextDocumentEdit(){return hu},get TextDocumentIdentifier(){return Eu},get TextDocumentItem(){return $u},get TextEdit(){return su},get URI(){return Al},get VersionedTextDocumentIdentifier(){return ku},WorkspaceChange:class{constructor(e){this._textEditChanges=Object.create(null),void 0!==e?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Yd(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(e=>{if(hu.is(e)){const t=new Hd(e.edits,this._changeAnnotations);this._textEditChanges[e.textDocument.uri]=t}})):e.changes&&Object.keys(e.changes).forEach(t=>{const r=new Hd(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(0===this._changeAnnotations.size?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Au.is(e)){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");const t={uri:e.uri,version:e.version};let r=this._textEditChanges[t.uri];if(!r){const e=[],n={textDocument:t,edits:e};this._workspaceEdit.documentChanges.push(n),r=new Hd(e,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}{if(this.initChanges(),void 0===this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new Hd(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._changeAnnotations=new Yd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let n,i,s;if(au.is(t)||lu.is(t)?n=t:r=t,void 0===n?i=fu.create(e,r):(s=lu.is(n)?n:this._changeAnnotations.manage(n),i=fu.create(e,r,s)),this._workspaceEdit.documentChanges.push(i),void 0!==s)return s}renameFile(e,t,r,n){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let i,s,o;if(au.is(r)||lu.is(r)?i=r:n=r,void 0===i?s=gu.create(e,t,n):(o=lu.is(i)?i:this._changeAnnotations.manage(i),s=gu.create(e,t,n,o)),this._workspaceEdit.documentChanges.push(s),void 0!==o)return o}deleteFile(e,t,r){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let n,i,s;if(au.is(t)||lu.is(t)?n=t:r=t,void 0===n?i=Tu.create(e,r):(s=lu.is(n)?n:this._changeAnnotations.manage(n),i=Tu.create(e,r,s)),this._workspaceEdit.documentChanges.push(i),void 0!==s)return s}},get WorkspaceEdit(){return Ru},get WorkspaceFolder(){return Vd},get WorkspaceSymbol(){return rd},get integer(){return bl},get uinteger(){return xl}},Symbol.toStringTag,{value:"Module"}));class eh{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new sh(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new nh;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const r=new rh(e.startOffset,e.image.length,_n(e),e.tokenType,!t);return r.grammarSource=t,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const t=e.container;if(t){const r=t.content.indexOf(e);r>=0&&t.content.splice(r,1)}}addHiddenNodes(e){const t=[];for(const i of e){const e=new rh(i.startOffset,i.image.length,_n(i),i.tokenType,!0);e.root=this.rootNode,t.push(e)}let r=this.current,n=!1;if(r.content.length>0)r.content.push(...t);else{for(;r.container;){const e=r.container.content.indexOf(r);if(e>0){r.container.content.splice(e,0,...t),n=!0;break}r=r.container}n||this.rootNode.content.unshift(...t)}}construct(e){const t=this.current;"string"!=typeof e.$type||e.$infixName||(this.current.astNode=e),e.$cstNode=t;const r=this.nodeStack.pop();0===(null==r?void 0:r.content.length)&&this.removeNode(r)}}class th{get hidden(){return!1}get astNode(){var e,t;const r="string"==typeof(null==(e=this._astNode)?void 0:e.$type)?this._astNode:null==(t=this.container)?void 0:t.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get text(){return this.root.fullText.substring(this.offset,this.end)}}class rh extends th{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,r,n,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=n,this._length=t,this._range=r}}class nh extends th{constructor(){super(...arguments),this.content=new ih(this)}get offset(){var e;return(null==(e=this.firstNonHiddenNode)?void 0:e.offset)??0}get length(){return this.end-this.offset}get end(){var e;return(null==(e=this.lastNonHiddenNode)?void 0:e.end)??0}get range(){const e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(void 0===this._rangeCache){const{range:r}=e,{range:n}=t;this._rangeCache={start:r.start,end:n.end.line<r.start.line?r.start:n.end}}return this._rangeCache}return{start:Nl.create(0,0),end:Nl.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 ih extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,ih.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...r){return this.addParents(r),super.splice(e,t,...r)}addParents(e){for(const t of e)t.container=this.parent}}class sh extends nh{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const oh=Symbol("Datatype");function ah(e){return e.$type===oh}const ch=e=>e.endsWith("")?e:e+"";class lh{constructor(e){var t;this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const r=this.lexer.definition,n="production"===e.LanguageMetaData.mode;(null==(t=e.shared.profilers.LangiumProfiler)?void 0:t.isActive("parsing"))?this.wrapper=new gh(r,{...e.parser.ParserConfig,skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider},e.shared.profilers.LangiumProfiler.createTask("parsing",e.LanguageMetaData.languageId)):this.wrapper=new mh(r,{...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 uh extends lh{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new eh,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){const r=this.computeRuleType(e);let n;Rt(e)&&(n=e.name,this.registerPrecedenceMap(e));const i=this.wrapper.DEFINE_RULE(ch(e.name),this.startImplementation(r,n,t).bind(this));return this.allRules.set(e.name,i),ar(e)&&e.entry&&(this.mainRule=i),i}registerPrecedenceMap(e){const t=e.name,r=new Map;for(let n=0;n<e.operators.precedences.length;n++){const t=e.operators.precedences[n];for(const e of t.operators)r.set(e.value,{precedence:n,rightAssoc:"right"===t.associativity})}this.operatorPrecedence.set(t,r)}computeRuleType(e){return Rt(e)?Ti(e):e.fragment?void 0:mi(e)?oh:Ti(e)}parse(e,t={}){this.nodeBuilder.buildRootNode(e);const r=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=r.tokens;const n=t.rule?this.allRules.get(t.rule):this.mainRule;if(!n)throw new Error(t.rule?`No rule found with name '${t.rule}'`:"No main rule available.");const i=this.doParse(n);return this.nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,F(i,{deep:!0}),{value:i,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}doParse(e){let t=this.wrapper.rule(e);if(this.stack.length>0&&(t=this.construct()),void 0===t)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return t}startImplementation(e,t,r){return n=>{const i=!this.isRecording()&&void 0!==e;if(i){const r={$type:e};this.stack.push(r),e===oh?r.value="":void 0!==t&&(r.$infixName=t)}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){const t=this.lexerResult.hidden;if(!t.length)return[];const r=e.startOffset;for(let n=0;n<t.length;n++){if(t[n].startOffset>r)return t.splice(0,n)}return t.splice(0,t.length)}consume(e,t,r){const n=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(n)){const e=this.extractHiddenTokens(n);this.nodeBuilder.addHiddenNodes(e);const t=this.nodeBuilder.buildLeafNode(n,r),{assignment:i,crossRef:s}=this.getAssignment(r),o=this.current;if(i){const e=Lt(r)?n.image:this.converter.convert(n.image,t);this.assign(i.operator,i.feature,e,t,s)}else if(ah(o)){let e=n.image;Lt(r)||(e=this.converter.convert(e,t).toString()),o.value+=e}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&"number"==typeof e.endOffset&&!isNaN(e.endOffset)}subrule(e,t,r,n,i){let s,o;this.isRecording()||r||(s=this.nodeBuilder.buildCompositeNode(n));try{o=this.wrapper.wrapSubrule(e,t,i)}finally{this.isRecording()||(void 0!==o||r||(o=this.construct()),void 0!==o&&s&&s.length>0&&this.performSubruleAssignment(o,n,s))}}performSubruleAssignment(e,t,r){const{assignment:n,crossRef:i}=this.getAssignment(t);if(n)this.assign(n.operator,n.feature,e,r,i);else if(!n){const t=this.current;if(ah(t))t.value+=e.toString();else if("object"==typeof e&&e){const r=this.assignWithoutOverride(e,t);this.stack.pop(),this.stack.push(r)}}}action(e,t){if(!this.isRecording()){let r=this.current;if(t.feature&&t.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode);this.nodeBuilder.buildCompositeNode(t).content.push(r.$cstNode);const n={$type:e};this.stack.push(n),this.assign(t.operator,t.feature,r,r.$cstNode)}else r.$type=e}}construct(){if(this.isRecording())return;const e=this.stack.pop();return this.nodeBuilder.construct(e),"$infixName"in e?this.constructInfix(e,this.operatorPrecedence.get(e.$infixName)):ah(e)?this.converter.convert(e.value,e.$cstNode):(function(e,t){const r=e.getTypeMetaData(t.$type),n=t;for(const i of Object.values(r.properties))void 0!==i.defaultValue&&void 0===n[i.name]&&(n[i.name]=H(i.defaultValue))}(this.astReflection,e),e)}constructInfix(e,t){const r=e.parts;if(!Array.isArray(r)||0===r.length)return;const n=e.operators;if(!Array.isArray(n)||r.length<2)return r[0];let i=0,s=-1;for(let f=0;f<n.length;f++){const e=n[f],r=t.get(e)??{precedence:1/0,rightAssoc:!1};r.precedence>s?(s=r.precedence,i=f):r.precedence===s&&(r.rightAssoc||(i=f))}const o=n.slice(0,i),a=n.slice(i+1),c=r.slice(0,i+1),l=r.slice(i+1),u={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:c,operators:o},d={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:l,operators:a},h=this.constructInfix(u,t),p=this.constructInfix(d,t);return{$type:e.$type,$cstNode:e.$cstNode,left:h,operator:n[i],right:p}}getAssignment(e){if(!this.assignmentMap.has(e)){const t=q(e,ke);this.assignmentMap.set(e,{assignment:t,crossRef:t&&Ge(t.terminal)?t.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(e)}assign(e,t,r,n,i){const s=this.current;let o;switch(o="single"===i&&"string"==typeof r?this.linker.buildReference(s,t,n,r):"multi"===i&&"string"==typeof r?this.linker.buildMultiReference(s,t,n,r):r,e){case"=":s[t]=o;break;case"?=":s[t]=!0;break;case"+=":Array.isArray(s[t])||(s[t]=[]),s[t].push(o)}}assignWithoutOverride(e,t){for(const[n,i]of Object.entries(t)){const t=e[n];void 0===t?e[n]=i:Array.isArray(t)&&Array.isArray(i)&&(i.push(...t),e[n]=i)}const r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class dh{buildMismatchTokenMessage(e){return ro.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return ro.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return ro.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return ro.buildEarlyExitMessage(e)}}class hh extends dh{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 ph extends lh{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 r=this.wrapper.DEFINE_RULE(ch(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{const r=this.keepStackSize();try{e(t)}finally{this.resetStackSize(r)}}}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,r){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,r,n,i){this.before(n),this.wrapper.wrapSubrule(e,t,i),this.after(n)}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 fh={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new hh};class mh extends Oa{constructor(e,t){super(e,{...fh,lookaheadStrategy:t&&"maxLookahead"in t?new ca({maxLookahead:t.maxLookahead}):new ul({logging:t.skipValidations?()=>{}:void 0}),...t})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t,r){return this.RULE(e,t,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t,void 0)}wrapSubrule(e,t,r){return this.subrule(e,t,{ARGS:[r]})}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)}rule(e){return e.call(this,{})}}class gh extends mh{constructor(e,t,r){super(e,t),this.task=r}rule(e){this.task.start(),this.task.startSubTask(this.ruleName(e));try{return super.rule(e)}finally{this.task.stopSubTask(this.ruleName(e)),this.task.stop()}}ruleName(e){return e.ruleName}subrule(e,t,r){this.task.startSubTask(this.ruleName(t));try{return super.subrule(e,t,r)}finally{this.task.stopSubTask(this.ruleName(t))}}}function yh(e,t,r){return function(e,t){const r=ai(t,!1),n=L(t.rules).filter(ar).filter(e=>r.has(e));for(const s of n){const t={...e,consume:1,optional:1,subrule:1,many:1,or:1};e.parser.rule(s,vh(t,s.definition))}const i=L(t.rules).filter(Rt).filter(e=>r.has(e));for(const s of i)e.parser.rule(s,Th(e,s))}({parser:t,tokens:r,ruleNames:new Map},e),t}function Th(e,t){const r=t.call.rule.ref;if(!r)throw new Error("Could not resolve reference to infix operator rule: "+t.call.rule.$refText);if(Jr(r))throw new Error("Cannot use terminal rule in infix expression");const n=t.operators.precedences.flatMap(e=>e.operators),i={$type:"Group",elements:[]},s={$container:i,$type:"Assignment",feature:"parts",operator:"+=",terminal:t.call},o={$container:i,$type:"Group",elements:[],cardinality:"*"};i.elements.push(s,o);const a={$container:o,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:n}},c={...s,$container:o};o.elements.push(a,c);const l=n.map(t=>e.tokens[t.value]).map((t,r)=>({ALT:()=>e.parser.consume(r,t,a)}));let u;return t=>{u??(u=Ch(e,r)),e.parser.subrule(0,u,!1,s,t),e.parser.many(0,{DEF:()=>{e.parser.alternatives(0,l),e.parser.subrule(1,u,!1,c,t)}})}}function vh(e,t,r=!1){let n;if(Lt(t))n=function(e,t){const r=e.consume++,n=e.tokens[t.value];if(!n)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(r,n,t)}(e,t);else if(ce(t))n=function(e,t){const r=Ti(t);return()=>e.parser.action(r,t)}(e,t);else if(ke(t))n=vh(e,t.terminal);else if(Ge(t))n=Sh(e,t);else if(kr(t))n=function(e,t){const r=t.rule.ref;if(Q(r)){const n=e.subrule++,i=ar(r)&&r.fragment,s=t.arguments.length>0?function(e,t){if(t.some(e=>e.calledByName)){const e=t.map(e=>{var t,r;return{parameterName:null==(r=null==(t=e.parameter)?void 0:t.ref)?void 0:r.name,predicate:Rh(e.value)}});return t=>{const r={};for(const{parameterName:n,predicate:i}of e)n&&(r[n]=i(t));return r}}{const r=t.map(e=>Rh(e.value));return t=>{const n={};for(let i=0;i<r.length;i++)if(i<e.parameters.length){const s=e.parameters[i].name,o=r[i];n[s]=o(t)}return n}}}(r,t.arguments):()=>({});let o;return a=>{o??(o=Ch(e,r)),e.parser.subrule(n,o,i,t,s(a))}}if(Jr(r)){const n=e.consume++,i=Ah(e,r.name);return()=>e.parser.consume(n,i,t)}if(!r)throw new Fn(t.$cstNode,`Undefined rule: ${t.rule.$refText}`);qn()}(e,t);else if(he(t))n=function(e,t){if(1===t.elements.length)return vh(e,t.elements[0]);{const r=[];for(const i of t.elements){const t={ALT:vh(e,i,!0)},n=Eh(i);n&&(t.GATE=Rh(n)),r.push(t)}const n=e.or++;return t=>e.parser.alternatives(n,r.map(e=>{const r={ALT:()=>e.ALT(t)},n=e.GATE;return n&&(r.GATE=()=>n(t)),r}))}}(e,t);else if(Tn(t))n=function(e,t){if(1===t.elements.length)return vh(e,t.elements[0]);const r=[];for(const a of t.elements){const t={ALT:vh(e,a,!0)},n=Eh(a);n&&(t.GATE=Rh(n)),r.push(t)}const n=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join("-")}`,s=t=>e.parser.alternatives(n,r.map((r,s)=>{const o={ALT:()=>!0},a=e.parser;o.ALT=()=>{if(r.ALT(t),!a.isRecording()){const e=i(n,a);a.unorderedGroups.get(e)||a.unorderedGroups.set(e,[]);const t=a.unorderedGroups.get(e);void 0===(null==t?void 0:t[s])&&(t[s]=!0)}};const c=r.GATE;return o.GATE=c?()=>c(t):()=>{const e=a.unorderedGroups.get(i(n,a));return!(null==e?void 0:e[s])},o})),o=kh(e,Eh(t),s,"*");return t=>{o(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(n,e.parser))}}(e,t);else if(ct(t))n=function(e,t){const r=t.elements.map(t=>vh(e,t));return e=>r.forEach(t=>t(e))}(e,t);else{if(i=t,!Nn.isInstance(i,We))throw new Fn(t.$cstNode,`Unexpected element type: ${t.$type}`);{const r=e.consume++;n=()=>e.parser.consume(r,Qs,t)}}var i;return kh(e,r?void 0:Eh(t),n,t.cardinality)}function Rh(e){if(t=e,Nn.isInstance(t,ze)){const t=Rh(e.left),r=Rh(e.right);return e=>t(e)||r(e)}if(function(e){return Nn.isInstance(e,Pe)}(e)){const t=Rh(e.left),r=Rh(e.right);return e=>t(e)&&r(e)}if(function(e){return Nn.isInstance(e,Bt)}(e)){const t=Rh(e.value);return e=>!t(e)}if(function(e){return Nn.isInstance(e,Xt)}(e)){const t=e.parameter.ref.name;return e=>void 0!==e&&!0===e[t]}if(function(e){return Nn.isInstance(e,Ce)}(e)){const t=Boolean(e.true);return()=>t}var t;qn()}function Eh(e){if(ct(e))return e.guardCondition}function Sh(e,t,r=t.terminal){if(r){if(kr(r)&&ar(r.rule.ref)){const n=r.rule.ref,i=e.subrule++;let s;return r=>{s??(s=Ch(e,n)),e.parser.subrule(i,s,!1,t,r)}}if(kr(r)&&Jr(r.rule.ref)){const n=e.consume++,i=Ah(e,r.rule.ref.name);return()=>e.parser.consume(n,i,t)}if(Lt(r)){const n=e.consume++,i=Ah(e,r.value);return()=>e.parser.consume(n,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 r=pi(t.type.ref),n=null==r?void 0:r.terminal;if(!n)throw new Error("Could not find name assignment for type: "+Ti(t.type.ref));return Sh(e,t,n)}}function kh(e,t,r,n){const i=t&&Rh(t);if(!n){if(i){const t=e.or++;return n=>e.parser.alternatives(t,[{ALT:()=>r(n),GATE:()=>i(n)},{ALT:Pa(),GATE:()=>!i(n)}])}return r}if("*"===n){const t=e.many++;return n=>e.parser.many(t,{DEF:()=>r(n),GATE:i?()=>i(n):void 0})}if("+"===n){const t=e.many++;if(i){const n=e.or++;return s=>e.parser.alternatives(n,[{ALT:()=>e.parser.atLeastOne(t,{DEF:()=>r(s)}),GATE:()=>i(s)},{ALT:Pa(),GATE:()=>!i(s)}])}return n=>e.parser.atLeastOne(t,{DEF:()=>r(n)})}if("?"===n){const t=e.optional++;return n=>e.parser.optional(t,{DEF:()=>r(n),GATE:i?()=>i(n):void 0})}qn()}function Ch(e,t){const r=function(e,t){if(Q(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let r=t,n=r.$container,i=t.$type;for(;!ar(n);){if(ct(n)||he(n)||Tn(n)){i=n.elements.indexOf(r).toString()+":"+i}r=n,n=n.$container}return i=n.name+":"+i,e.ruleNames.set(t,i),i}}(e,t),n=e.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function Ah(e,t){const r=e.tokens[t];if(!r)throw new Error(`Token "${t}" not found."`);return r}function bh(e){const t=function(e){const t=e.Grammar,r=e.parser.Lexer,n=new uh(e);return yh(t,n,r.definition)}(e);return t.finalize(),t}class $h{constructor(){this.diagnostics=[]}buildTokens(e,t){const r=L(ai(e,!1)),n=this.buildTerminalTokens(r),i=this.buildKeywordTokens(r,n,t);return i.push(...n),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Jr).filter(e=>!e.fragment).map(e=>this.buildTerminalToken(e)).toArray()}buildTerminalToken(e){const t=vi(e),r=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,n={name:e.name,PATTERN:r};return"function"==typeof r&&(n.LINE_BREAKS=!0),e.hidden&&(n.GROUP=ii(t)?js.SKIPPED:"hidden"),n}requiresCustomPattern(e){return!(!e.flags.includes("u")&&!e.flags.includes("s"))}regexPatternFunction(e){const t=new RegExp(e,e.flags+"y");return(e,r)=>{t.lastIndex=r;return t.exec(e)}}buildKeywordTokens(e,t,r){return e.filter(Q).flatMap(e=>B(e).filter(Lt)).distinct(e=>e.value).toArray().sort((e,t)=>t.value.length-e.value.length).map(e=>this.buildKeywordToken(e,t,Boolean(null==r?void 0:r.caseInsensitive)))}buildKeywordToken(e,t,r){const n=this.buildKeywordPattern(e,r),i={name:e.value,PATTERN:n,LONGER_ALT:this.findLongerAlt(e,t)};return"function"==typeof n&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(si(e.value),"i"):e.value}findLongerAlt(e,t){return t.reduce((t,r)=>{const n=null==r?void 0:r.PATTERN;return(null==n?void 0:n.source)&&oi("^"+n.source+"$",e.value)&&t.push(r),t},[])}}class xh{convert(e,t){let r=t.grammarSource;if(Ge(r)&&(r=function(e){if(e.terminal)return e.terminal;if(e.type.ref){const t=pi(e.type.ref);return null==t?void 0:t.terminal}}(r)),kr(r)){const n=r.rule.ref;if(!n)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(n,e,t)}return e}runConverter(e,t,r){var n;switch(e.name.toUpperCase()){case"INT":return wh.convertInt(t);case"STRING":return wh.convertString(t);case"ID":return wh.convertID(t)}switch(null==(n=function(e){var t;return Jr(e)?(null==(t=e.type)?void 0:t.name)??"string":yi(e)??e.name}(e))?void 0:n.toLowerCase()){case"number":return wh.convertNumber(t);case"boolean":return wh.convertBoolean(t);case"bigint":return wh.convertBigint(t);case"date":return wh.convertDate(t);default:return t}}}var wh;!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 r="";for(let n=1;n<e.length-1;n++){const i=e.charAt(n);if("\\"===i){r+=t(e.charAt(++n))}else r+=i}return r},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()}}(wh||(wh={}));var Nh={},Ih={};let _h;function Ph(){if(void 0===_h)throw new Error("No runtime abstraction layer installed");return _h}Object.defineProperty(Ih,"__esModule",{value:!0}),(Ph||(Ph={})).install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");_h=e},Ih.default=Ph;var Lh={};function Oh(e){return"string"==typeof e||e instanceof String}function Dh(e){return Array.isArray(e)}Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.stringArray=Lh.array=Lh.func=Lh.error=Lh.number=Lh.string=Lh.boolean=void 0,Lh.boolean=function(e){return!0===e||!1===e},Lh.string=Oh,Lh.number=function(e){return"number"==typeof e||e instanceof Number},Lh.error=function(e){return e instanceof Error},Lh.func=function(e){return"function"==typeof e},Lh.array=Dh,Lh.stringArray=function(e){return Dh(e)&&e.every(e=>Oh(e))};var Mh={};Object.defineProperty(Mh,"__esModule",{value:!0});var Fh=Mh.Emitter=Mh.Event=void 0;const qh=Ih;var jh,Uh;!function(e){const t={dispose(){}};e.None=function(){return t}}(jh||(Mh.Event=jh={}));class Gh{add(e,t=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let r=!1;for(let n=0,i=this._callbacks.length;n<i;n++)if(this._callbacks[n]===e){if(this._contexts[n]===t)return this._callbacks.splice(n,1),void this._contexts.splice(n,1);r=!0}if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const t=[],r=this._callbacks.slice(0),n=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{t.push(r[s].apply(n[s],e))}catch(i){(0,qh.default)().console.error(i)}return t}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class zh{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,r)=>{this._callbacks||(this._callbacks=new Gh),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const n={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),n.dispose=zh._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(n),n}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}Fh=Mh.Emitter=zh,zh._noop=function(){},Object.defineProperty(Nh,"__esModule",{value:!0});var Bh=Nh.CancellationTokenSource=Uh=Nh.CancellationToken=void 0;const Kh=Ih,Wh=Lh,Vh=Mh;var Hh,Yh;(Yh=Hh||(Uh=Nh.CancellationToken=Hh={})).None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vh.Event.None}),Yh.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Vh.Event.None}),Yh.is=function(e){const t=e;return t&&(t===Yh.None||t===Yh.Cancelled||Wh.boolean(t.isCancellationRequested)&&!!t.onCancellationRequested)};const Xh=Object.freeze(function(e,t){const r=(0,Kh.default)().timer.setTimeout(e.bind(t),0);return{dispose(){r.dispose()}}});class Jh{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Xh:(this._emitter||(this._emitter=new Vh.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}Bh=Nh.CancellationTokenSource=class{get token(){return this._token||(this._token=new Jh),this._token}cancel(){this._token?this._token.cancel():this._token=Hh.Cancelled}dispose(){this._token?this._token instanceof Jh&&this._token.dispose():this._token=Hh.None}};let Zh=0;const Qh=Symbol("OperationCancelled");function ep(e){return e===Qh}async function tp(e){if(e===Uh.None)return;const t=performance.now();if(t-Zh>=10&&(Zh=t,await new Promise(e=>{"undefined"==typeof setImmediate?setTimeout(e,0):setImmediate(e)}),Zh=performance.now()),e.isCancellationRequested)throw Qh}class rp{constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)})}}class np{constructor(e,t,r,n){this._uri=e,this._languageId=t,this._version=r,this._content=n,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),r=this.offsetAt(e.end);return this._content.substring(t,r)}return this._content}update(e,t){for(const r of e)if(np.isIncremental(r)){const e=up(r.range),t=this.offsetAt(e.start),n=this.offsetAt(e.end);this._content=this._content.substring(0,t)+r.text+this._content.substring(n,this._content.length);const i=Math.max(e.start.line,0),s=Math.max(e.end.line,0);let o=this._lineOffsets;const a=cp(r.text,!1,t);if(s-i===a.length)for(let r=0,l=a.length;r<l;r++)o[r+i+1]=a[r];else a.length<1e4?o.splice(i+1,s-i,...a):this._lineOffsets=o=o.slice(0,i+1).concat(a,o.slice(s+1));const c=r.text.length-(n-t);if(0!==c)for(let r=i+1+a.length,l=o.length;r<l;r++)o[r]=o[r]+c}else{if(!np.isFull(r))throw new Error("Unknown change event received");this._content=r.text,this._lineOffsets=void 0}this._version=t}getLineOffsets(){return void 0===this._lineOffsets&&(this._lineOffsets=cp(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const t=this.getLineOffsets();let r=0,n=t.length;if(0===n)return{line:0,character:e};for(;r<n;){const i=Math.floor((r+n)/2);t[i]>e?n=i:r=i+1}const i=r-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 r=t[e.line];if(e.character<=0)return r;const n=e.line+1<t.length?t[e.line+1]:this._content.length,i=Math.min(r+e.character,n);return this.ensureBeforeEOL(i,r)}ensureBeforeEOL(e,t){for(;e>t&&lp(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 ip,sp,op;function ap(e,t){if(e.length<=1)return e;const r=e.length/2|0,n=e.slice(0,r),i=e.slice(r);ap(n,t),ap(i,t);let s=0,o=0,a=0;for(;s<n.length&&o<i.length;){const r=t(n[s],i[o]);e[a++]=r<=0?n[s++]:i[o++]}for(;s<n.length;)e[a++]=n[s++];for(;o<i.length;)e[a++]=i[o++];return e}function cp(e,t,r=0){const n=t?[r]:[];for(let i=0;i<e.length;i++){const t=e.charCodeAt(i);lp(t)&&(13===t&&i+1<e.length&&10===e.charCodeAt(i+1)&&i++,n.push(r+i+1))}return n}function lp(e){return 13===e||10===e}function up(e){const t=e.start,r=e.end;return t.line>r.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}function dp(e){const t=up(e.range);return t!==e.range?{newText:e.newText,range:t}:e}(sp=ip||(ip={})).create=function(e,t,r,n){return new np(e,t,r,n)},sp.update=function(e,t,r){if(e instanceof np)return e.update(t,r),e;throw new Error("TextDocument.update: document must be created by TextDocument.create")},sp.applyEdits=function(e,t){const r=e.getText(),n=ap(t.map(dp),(e,t)=>{const r=e.range.start.line-t.range.start.line;return 0===r?e.range.start.character-t.range.start.character:r});let i=0;const s=[];for(const o of n){const t=e.offsetAt(o.range.start);if(t<i)throw new Error("Overlapping edit");t>i&&s.push(r.substring(i,t)),o.newText.length&&s.push(o.newText),i=e.offsetAt(o.range.end)}return s.push(r.substr(i)),s.join("")},(()=>{var e={975:e=>{function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",i=0,s=-1,o=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(s===a-1||1===o);else if(s!==a-1&&2===o){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var c=n.lastIndexOf("/");if(c!==n.length-1){-1===c?(n="",i=0):i=(n=n.slice(0,c)).length-1-n.lastIndexOf("/"),s=a,o=0;continue}}else if(2===n.length||1===n.length){n="",i=0,s=a,o=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),i=a-s-1;s=a,o=0}else 46===r&&-1!==o?++o:o=-1}return n}var n={resolve:function(){for(var e,n="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var o;s>=0?o=arguments[s]:(void 0===e&&(e=process.cwd()),o=e),t(o),0!==o.length&&(n=o+"/"+n,i=47===o.charCodeAt(0))}return n=r(n,!i),i?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&i&&(e+="/"),n?"/"+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,r=0;r<arguments.length;++r){var i=arguments[r];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var s=e.length,o=s-i,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var c=r.length-a,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(47===r.charCodeAt(a+d))return r.slice(a+d+1);if(0===d)return r.slice(a+d)}else o>l&&(47===e.charCodeAt(i+d)?u=d:0===d&&(u=0));break}var h=e.charCodeAt(i+d);if(h!==r.charCodeAt(a+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+r.slice(a+u):(a+=u,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,i=-1,s=!0,o=e.length-1;o>=1;--o)if(47===(r=e.charCodeAt(o))){if(!s){i=o;break}}else s=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,i=0,s=-1,o=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,c=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!o){i=n+1;break}}else-1===c&&(o=!1,c=n+1),a>=0&&(l===r.charCodeAt(a)?-1==--a&&(s=n):(a=-1,s=c))}return i===s?s=c:-1===s&&(s=e.length),e.slice(i,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!o){i=n+1;break}}else-1===s&&(o=!1,s=n+1);return-1===s?"":e.slice(i,s)},extname:function(e){t(e);for(var r=-1,n=0,i=-1,s=!0,o=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===i&&(s=!1,i=a+1),46===c?-1===r?r=a:1!==o&&(o=1):-1!==r&&(o=-1);else if(!s){n=a+1;break}}return-1===r||-1===i||0===o||1===o&&r===i-1&&r===n+1?"":e.slice(r,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 r=(t=e).dir||t.root,n=t.base||(t.name||"")+(t.ext||""),r?r===t.root?r+n:r+"/"+n:n;var t,r,n},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,i=e.charCodeAt(0),s=47===i;s?(r.root="/",n=1):n=0;for(var o=-1,a=0,c=-1,l=!0,u=e.length-1,d=0;u>=n;--u)if(47!==(i=e.charCodeAt(u)))-1===c&&(l=!1,c=u+1),46===i?-1===o?o=u:1!==d&&(d=1):-1!==o&&(d=-1);else if(!l){a=u+1;break}return-1===o||-1===c||0===d||1===d&&o===c-1&&o===a+1?-1!==c&&(r.base=r.name=0===a&&s?e.slice(1,c):e.slice(a,c)):(0===a&&s?(r.name=e.slice(1,o),r.base=e.slice(1,c)):(r.name=e.slice(a,o),r.base=e.slice(a,c)),r.ext=e.slice(o,c)),a>0?r.dir=e.slice(0,a-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};let i;if(r.r(n),r.d(n,{URI:()=>h,Utils:()=>$}),"object"==typeof process)i="win32"===process.platform;else if("object"==typeof navigator){let e=navigator.userAgent;i=e.indexOf("Windows")>=0}const s=/^\w[\w\d+.-]*$/,o=/^\//,a=/^\/\//;function c(e,t){if(!e.scheme&&t)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!s.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!o.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(a.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 l="",u="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class h{constructor(e,t,r,n,i,s=!1){y(this,"scheme"),y(this,"authority"),y(this,"path"),y(this,"query"),y(this,"fragment"),"object"==typeof e?(this.scheme=e.scheme||l,this.authority=e.authority||l,this.path=e.path||l,this.query=e.query||l,this.fragment=e.fragment||l):(this.scheme=function(e,t){return e||t?e:"file"}(e,s),this.authority=t||l,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==u&&(t=u+t):t=u}return t}(this.scheme,r||l),this.query=n||l,this.fragment=i||l,c(this,s))}static isUri(e){return e instanceof h||!!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 v(this)}with(e){if(!e)return this;let{scheme:t,authority:r,path:n,query:i,fragment:s}=e;return void 0===t?t=this.scheme:null===t&&(t=l),void 0===r?r=this.authority:null===r&&(r=l),void 0===n?n=this.path:null===n&&(n=l),void 0===i?i=this.query:null===i&&(i=l),void 0===s?s=this.fragment:null===s&&(s=l),t===this.scheme&&r===this.authority&&n===this.path&&i===this.query&&s===this.fragment?this:new f(t,r,n,i,s)}static parse(e,t=!1){const r=d.exec(e);return r?new f(r[2]||l,k(r[4]||l),k(r[5]||l),k(r[7]||l),k(r[9]||l),t):new f(l,l,l,l,l)}static file(e){let t=l;if(i&&(e=e.replace(/\\/g,u)),e[0]===u&&e[1]===u){const r=e.indexOf(u,2);-1===r?(t=e.substring(2),e=u):(t=e.substring(2,r),e=e.substring(r)||u)}return new f("file",t,e,l,l)}static from(e){const t=new f(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return R(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof h)return e;{const t=new f(e);return t._formatted=e.external,t._fsPath=e._sep===p?e.fsPath:null,t}}return e}}const p=i?1:void 0;class f extends h{constructor(){super(...arguments),y(this,"_formatted",null),y(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString(e=!1){return e?R(this,!0):(this._formatted||(this._formatted=R(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=p),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 m={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 g(e,t,r){let n,i=-1;for(let s=0;s<e.length;s++){const o=e.charCodeAt(s);if(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||45===o||46===o||95===o||126===o||t&&47===o||r&&91===o||r&&93===o||r&&58===o)-1!==i&&(n+=encodeURIComponent(e.substring(i,s)),i=-1),void 0!==n&&(n+=e.charAt(s));else{void 0===n&&(n=e.substr(0,s));const t=m[o];void 0!==t?(-1!==i&&(n+=encodeURIComponent(e.substring(i,s)),i=-1),n+=t):-1===i&&(i=s)}}return-1!==i&&(n+=encodeURIComponent(e.substring(i))),void 0!==n?n:e}function T(e){let t;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);35===n||63===n?(void 0===t&&(t=e.substr(0,r)),t+=m[n]):void 0!==t&&(t+=e[r])}return void 0!==t?t:e}function v(e,t){let r;return r=e.authority&&e.path.length>1&&"file"===e.scheme?`//${e.authority}${e.path}`:47===e.path.charCodeAt(0)&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&58===e.path.charCodeAt(2)?e.path[1].toLowerCase()+e.path.substr(2):e.path,i&&(r=r.replace(/\//g,"\\")),r}function R(e,t){const r=t?T:g;let n="",{scheme:i,authority:s,path:o,query:a,fragment:c}=e;if(i&&(n+=i,n+=":"),(s||"file"===i)&&(n+=u,n+=u),s){let e=s.indexOf("@");if(-1!==e){const t=s.substr(0,e);s=s.substr(e+1),e=t.lastIndexOf(":"),-1===e?n+=r(t,!1,!1):(n+=r(t.substr(0,e),!1,!1),n+=":",n+=r(t.substr(e+1),!1,!0)),n+="@"}s=s.toLowerCase(),e=s.lastIndexOf(":"),-1===e?n+=r(s,!1,!0):(n+=r(s.substr(0,e),!1,!0),n+=s.substr(e))}if(o){if(o.length>=3&&47===o.charCodeAt(0)&&58===o.charCodeAt(2)){const e=o.charCodeAt(1);e>=65&&e<=90&&(o=`/${String.fromCharCode(e+32)}:${o.substr(3)}`)}else if(o.length>=2&&58===o.charCodeAt(1)){const e=o.charCodeAt(0);e>=65&&e<=90&&(o=`${String.fromCharCode(e+32)}:${o.substr(2)}`)}n+=r(o,!0,!1)}return a&&(n+="?",n+=r(a,!1,!1)),c&&(n+="#",n+=t?c:g(c,!1,!1)),n}function E(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+E(e.substr(3)):e}}const S=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function k(e){return e.match(S)?e.replace(S,e=>E(e)):e}var C=r(975);const A=C.posix||C,b="/";var $,x;(x=$||($={})).joinPath=function(e,...t){return e.with({path:A.join(e.path,...t)})},x.resolvePath=function(e,...t){let r=e.path,n=!1;r[0]!==b&&(r=b+r,n=!0);let i=A.resolve(r,...t);return n&&i[0]===b&&!e.authority&&(i=i.substring(1)),e.with({path:i})},x.dirname=function(e){if(0===e.path.length||e.path===b)return e;let t=A.dirname(e.path);return 1===t.length&&46===t.charCodeAt(0)&&(t=""),e.with({path:t})},x.basename=function(e){return A.basename(e.path)},x.extname=function(e){return A.extname(e.path)},op=n})();const{URI:hp,Utils:pp}=op;var fp,mp,gp;!function(e){e.basename=pp.basename,e.dirname=pp.dirname,e.extname=pp.extname,e.joinPath=pp.joinPath,e.resolvePath=pp.resolvePath;const t="object"==typeof process&&"win32"===(null==process?void 0:process.platform);e.equals=function(e,t){return(null==e?void 0:e.toString())===(null==t?void 0:t.toString())},e.relative=function(e,r){const n="string"==typeof e?hp.parse(e).path:e.path,i="string"==typeof r?hp.parse(r).path:r.path,s=n.split("/").filter(e=>e.length>0),o=i.split("/").filter(e=>e.length>0);if(t){const e=/^[A-Z]:$/;if(s[0]&&e.test(s[0])&&(s[0]=s[0].toLowerCase()),o[0]&&e.test(o[0])&&(o[0]=o[0].toLowerCase()),s[0]!==o[0])return i.substring(1)}let a=0;for(;a<s.length&&s[a]===o[a];a++);return"../".repeat(s.length-a)+o.slice(a).join("/")},e.normalize=function(e){return hp.parse(e.toString()).toString()},e.contains=function(e,t){let r="string"==typeof e?e:e.path,n="string"==typeof t?t:t.path;return"/"===n.charAt(n.length-1)&&(n=n.slice(0,-1)),"/"===r.charAt(r.length-1)&&(r=r.slice(0,-1)),n===r||!(n.length<r.length)&&("/"===n.charAt(r.length)&&n.startsWith(r))}}(fp||(fp={}));class yp{constructor(){this.root={name:"",children:new Map}}normalizeUri(e){return fp.normalize(e)}clear(){this.root.children.clear()}insert(e,t){this.getNode(this.normalizeUri(e),!0).element=t}delete(e){const t=this.getNode(this.normalizeUri(e),!1);(null==t?void 0:t.parent)&&t.parent.children.delete(t.name)}has(e){var t;return void 0!==(null==(t=this.getNode(this.normalizeUri(e),!1))?void 0:t.element)}hasNode(e){return void 0!==this.getNode(this.normalizeUri(e),!1)}find(e){var t;return null==(t=this.getNode(this.normalizeUri(e),!1))?void 0:t.element}findNode(e){const t=this.normalizeUri(e),r=this.getNode(t,!1);if(r)return{name:r.name,uri:fp.joinPath(hp.parse(t),r.name).toString(),element:r.element}}findChildren(e){const t=this.normalizeUri(e),r=this.getNode(t,!1);return r?Array.from(r.children.values()).map(e=>({name:e.name,uri:fp.joinPath(hp.parse(t),e.name).toString(),element:e.element})):[]}all(){return this.collectValues(this.root)}findAll(e){const t=this.getNode(fp.normalize(e),!1);return t?this.collectValues(t):[]}getNode(e,t){const r=e.split("/");"/"===e.charAt(e.length-1)&&r.pop();let n=this.root;for(const i of r){let e=n.children.get(i);if(!e){if(!t)return;e={name:i,children:new Map,parent:n},n.children.set(i,e)}n=e}return n}collectValues(e){const t=[];e.element&&t.push(e.element);for(const r of e.children.values())t.push(...this.collectValues(r));return t}}(gp=mp||(mp={}))[gp.Changed=0]="Changed",gp[gp.Parsed=1]="Parsed",gp[gp.IndexedContent=2]="IndexedContent",gp[gp.ComputedScopes=3]="ComputedScopes",gp[gp.Linked=4]="Linked",gp[gp.IndexedReferences=5]="IndexedReferences",gp[gp.Validated=6]="Validated";class Tp{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Uh.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,t)}fromTextDocument(e,t,r){return t=t??hp.parse(e.uri),Uh.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromString(e,t,r){return Uh.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,r){if("string"==typeof t){const n=this.parse(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}if("$model"in t){const r={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(r,e)}{const n=this.parse(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}async createAsync(e,t,r){if("string"==typeof t){const n=await this.parseAsync(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}{const n=await this.parseAsync(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}createLangiumDocument(e,t,r,n){let i;if(r)i={parseResult:e,uri:t,state:mp.Parsed,references:[],textDocument:r};else{const r=this.createTextDocumentGetter(t,n);i={parseResult:e,uri:t,state:mp.Parsed,references:[],get textDocument(){return r()}}}return e.value.$document=i,i}async update(e,t){var r,n;const i=null==(r=e.parseResult.value.$cstNode)?void 0:r.root.fullText,s=null==(n=this.textDocuments)?void 0:n.get(e.uri.toString()),o=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{const t=this.createTextDocumentGetter(e.uri,o);Object.defineProperty(e,"textDocument",{get:t})}return i!==o&&(e.parseResult=await this.parseAsync(e.uri,o,t),e.parseResult.value.$document=e),e.state=mp.Parsed,e}parse(e,t,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,r)}parseAsync(e,t,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,r)}createTextDocumentGetter(e,t){const r=this.serviceRegistry;let n;return()=>n??(n=ip.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,t??""))}}class vp{constructor(e){this.documentTrie=new yp,this.services=e,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.documentBuilder=()=>e.workspace.DocumentBuilder}get all(){return L(this.documentTrie.all())}addDocument(e){const t=e.uri.toString();if(this.documentTrie.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentTrie.insert(t,e)}getDocument(e){const t=e.toString();return this.documentTrie.find(t)}getDocuments(e){const t=e.toString();return this.documentTrie.findAll(t)}async getOrCreateDocument(e,t){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(r),r)}createDocument(e,t,r){if(r)return this.langiumDocumentFactory.fromString(t,e,r).then(e=>(this.addDocument(e),e));{const r=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(r),r}}hasDocument(e){return this.documentTrie.has(e.toString())}invalidateDocument(e){const t=e.toString(),r=this.documentTrie.find(t);return r&&this.documentBuilder().resetToState(r,mp.Changed),r}deleteDocument(e){const t=e.toString(),r=this.documentTrie.find(t);return r&&(r.state=mp.Changed,this.documentTrie.delete(t)),r}deleteDocuments(e){const t=e.toString(),r=this.documentTrie.findAll(t);for(const n of r)n.state=mp.Changed;return this.documentTrie.delete(t),r}}const Rp=Symbol("RefResolving");class Ep{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async link(e,t=Uh.None){var r;if(null==(r=this.profiler)?void 0:r.isActive("linking")){const r=this.profiler.createTask("linking",this.languageId);r.start();try{for(const n of K(e.parseResult.value))await tp(t),V(n).forEach(t=>{const i=`${n.$type}:${t.property}`;r.startSubTask(i);try{this.doLink(t,e)}finally{r.stopSubTask(i)}})}finally{r.stop()}}else for(const n of K(e.parseResult.value))await tp(t),V(n).forEach(t=>this.doLink(t,e))}doLink(e,t){const r=e.reference;if("_ref"in r&&void 0===r._ref){r._ref=Rp;try{const t=this.getCandidate(e);if(C(t))r._ref=t;else{r._nodeDescription=t;const n=this.loadAstNode(t);r._ref=n??this.createLinkingError(e,t)}}catch(n){console.error(`An error occurred while resolving reference to '${r.$refText}':`,n);const t=n.message??String(n);r._ref={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${t}`}}t.references.push(r)}else if("_items"in r&&void 0===r._items){r._items=Rp;try{const t=this.getCandidates(e),n=[];if(C(t))r._linkingError=t;else for(const e of t){const t=this.loadAstNode(e);t&&n.push({ref:t,$nodeDescription:e})}r._items=n}catch(n){r._linkingError={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${n}`},r._items=[]}t.references.push(r)}}unlink(e){for(const t of e.references)"_ref"in t?(t._ref=void 0,delete t._nodeDescription):"_items"in t&&(t._items=void 0,delete t._linkingError);e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}getCandidates(e){const t=this.scopeProvider.getScope(e).getElements(e.reference.$refText).distinct(e=>`${e.documentUri}#${e.path}`).toArray();return t.length>0?t:this.createLinkingError(e)}buildReference(e,t,r,n){const i=this,s={$refNode:r,$refText:n,_ref:void 0,get ref(){if(E(this._ref))return this._ref;if("object"==typeof(r=this._nodeDescription)&&null!==r&&"string"==typeof r.name&&"string"==typeof r.type&&"string"==typeof r.path){const r=i.loadAstNode(this._nodeDescription);this._ref=r??i.createLinkingError({reference:s,container:e,property:t},this._nodeDescription)}else if(void 0===this._ref){this._ref=Rp;const r=U(e).$document,n=i.getLinkedNode({reference:s,container:e,property:t});if(n.error&&r&&r.state<mp.ComputedScopes)return this._ref=void 0;this._ref=n.node??n.error,this._nodeDescription=n.descr,null==r||r.references.push(this)}else this._ref===Rp&&i.throwCyclicReferenceError(e,t,n);var r;return E(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return C(this._ref)?this._ref:void 0}};return s}buildMultiReference(e,t,r,n){const i=this,s={$refNode:r,$refText:n,_items:void 0,get items(){if(Array.isArray(this._items))return this._items;if(void 0===this._items){this._items=Rp;const r=U(e).$document,n=i.getCandidates({reference:s,container:e,property:t}),o=[];if(C(n))this._linkingError=n;else for(const e of n){const t=i.loadAstNode(e);t&&o.push({ref:t,$nodeDescription:e})}this._items=o,null==r||r.references.push(this)}else this._items===Rp&&i.throwCyclicReferenceError(e,t,n);return Array.isArray(this._items)?this._items:[]},get error(){if(this._linkingError)return this._linkingError;return this.items.length>0?void 0:this._linkingError=i.createLinkingError({reference:s,container:e,property:t})}};return s}throwCyclicReferenceError(e,t,r){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`)}getLinkedNode(e){try{const t=this.getCandidate(e);if(C(t))return{error:t};const r=this.loadAstNode(t);return r?{node:r,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,t);const r=t.message??String(t);return{error:{info: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 r=U(e.container).$document;r&&r.state<mp.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);return{info:e,message:`Could not resolve reference to ${this.reflection.getReferenceType(e)} named '${e.reference.$refText}'.`,targetDescription:t}}}class Sp{getName(e){if(function(e){return"string"==typeof e.name}(e))return e.name}getNameNode(e){return ui(e.$cstNode,"name")}}class kp{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator,this.documents=e.shared.workspace.LangiumDocuments,this.hasMultiReference=K(e.Grammar).some(e=>Ge(e)&&e.isMulti)}findDeclarations(e){if(e){const t=function(e){var t;const r=e.astNode;for(;r===(null==(t=e.container)?void 0:t.astNode);){const t=q(e.grammarSource,ke);if(t)return t;e=e.container}}(e),r=e.astNode;if(t&&r){const n=r[t.feature];if(S(n)||k(n))return G(n);if(Array.isArray(n))for(const t of n)if((S(t)||k(t))&&t.$refNode&&t.$refNode.offset<=e.offset&&t.$refNode.end>=e.end)return G(t)}if(r){const t=this.nameProvider.getNameNode(r);if(t&&(t===e||function(e,t){for(;e.container;)if((e=e.container)===t)return!0;return!1}(e,t)))return this.getSelfNodes(r)}}return[]}getSelfNodes(e){if(this.hasMultiReference){const t=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)),r=this.getNodeFromReferenceDescription(t.head());if(r)for(const n of V(r))if(k(n.reference)&&n.reference.items.some(t=>t.ref===e))return n.reference.items.map(e=>e.ref);return[e]}return[e]}getNodeFromReferenceDescription(e){if(!e)return;const t=this.documents.getDocument(e.sourceUri);return t?this.nodeLocator.getAstNode(t.parseResult.value,e.sourcePath):void 0}findDeclarationNodes(e){const t=this.findDeclarations(e),r=[];for(const n of t){const e=this.nameProvider.getNameNode(n)??n.$cstNode;e&&r.push(e)}return r}findReferences(e,t){const r=[];t.includeDeclaration&&r.push(...this.getSelfReferences(e));let n=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(n=n.filter(e=>fp.equals(e.sourceUri,t.documentUri))),r.push(...n),L(r)}getSelfReferences(e){const t=this.getSelfNodes(e),r=[];for(const n of t){const e=this.nameProvider.getNameNode(n);if(e){const t=j(n),i=this.nodeLocator.getAstNodePath(n);r.push({sourceUri:t.uri,sourcePath:i,targetUri:t.uri,targetPath:i,segment:Pn(e),local:!0})}}return r}}class Cp{constructor(e){if(this.map=new Map,e)for(const[t,r]of e)this.add(t,r)}get size(){return D.sum(L(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(void 0===t)return this.map.delete(e);{const r=this.map.get(e);if(r){const n=r.indexOf(t);if(n>=0)return 1===r.length?this.map.delete(e):r.splice(n,1),!0}return!1}}get(e){return this.map.get(e)??[]}getStream(e){const t=this.map.get(e);return t?L(t):_}has(e,t){if(void 0===t)return this.map.has(e);{const r=this.map.get(e);return!!r&&r.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,r)=>t.forEach(t=>e(t,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return L(this.map.entries()).flatMap(([e,t])=>t.map(t=>[e,t]))}keys(){return L(this.map.keys())}values(){return L(this.map.values()).flat()}entriesGroupedByKey(){return L(this.map.entries())}}class Ap{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[t,r]of e)this.set(t,r)}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 bp{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(e,t=Uh.None){return this.collectExportedSymbolsForNode(e.parseResult.value,e,void 0,t)}async collectExportedSymbolsForNode(e,t,r=z,n=Uh.None){const i=[];this.addExportedSymbol(e,i,t);for(const s of r(e))await tp(n),this.addExportedSymbol(s,i,t);return i}addExportedSymbol(e,t,r){const n=this.nameProvider.getName(e);n&&t.push(this.descriptions.createDescription(e,n,r))}async collectLocalSymbols(e,t=Uh.None){const r=e.parseResult.value,n=new Cp;for(const i of B(r))await tp(t),this.addLocalSymbol(i,e,n);return n}addLocalSymbol(e,t,r){const n=e.$container;if(n){const i=this.nameProvider.getName(e);i&&r.add(n,this.descriptions.createDescription(e,i,t))}}}class $p{constructor(e,t,r){this.elements=e,this.outerScope=t,this.caseInsensitive=(null==r?void 0:r.caseInsensitive)??!1,this.concatOuterScope=(null==r?void 0:r.concatOuterScope)??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.find(e=>e.name.toLowerCase()===t):this.elements.find(t=>t.name===e);return r||(this.outerScope?this.outerScope.getElement(e):void 0)}getElements(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.filter(e=>e.name.toLowerCase()===t):this.elements.filter(t=>t.name===e);return(this.concatOuterScope||r.isEmpty())&&this.outerScope?r.concat(this.outerScope.getElements(e)):r}}class xp{constructor(e,t,r){this.elements=new Cp,this.caseInsensitive=(null==r?void 0:r.caseInsensitive)??!1,this.concatOuterScope=(null==r?void 0:r.concatOuterScope)??!0;for(const n of e){const e=this.caseInsensitive?n.name.toLowerCase():n.name;this.elements.add(e,n)}this.outerScope=t}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t)[0];return r||(this.outerScope?this.outerScope.getElement(e):void 0)}getElements(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);return(this.concatOuterScope||0===r.length)&&this.outerScope?L(r).concat(this.outerScope.getElements(e)):L(r)}getAllElements(){let e=L(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class wp{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 Np extends wp{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 r=t();return this.cache.set(e,r),r}}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class Ip extends wp{constructor(e){super(),this.cache=new Map,this.converter=e??(e=>e)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,r){this.throwIfDisposed(),this.cacheForContext(e).set(t,r)}get(e,t,r){this.throwIfDisposed();const n=this.cacheForContext(e);if(n.has(t))return n.get(t);if(r){const e=r();return n.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 r=this.cache.get(t);return r||(r=new Map,this.cache.set(t,r)),r}}class _p extends Np{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 Pp{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 _p(e.shared)}getScope(e){const t=[],r=this.reflection.getReferenceType(e),n=j(e.container).localSymbols;if(n){let i=e.container;do{n.has(i)&&t.push(n.getStream(i).filter(e=>this.reflection.isSubtype(e.type,r))),i=i.$container}while(i)}let i=this.getGlobalScope(r,e);for(let s=t.length-1;s>=0;s--)i=this.createScope(t[s],i);return i}createScope(e,t,r){return new $p(L(e),t,r)}createScopeForNodes(e,t,r){const n=L(e).map(e=>{const t=this.nameProvider.getName(e);if(t)return this.descriptions.createDescription(e,t)}).nonNullable();return new $p(n,t,r)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new xp(this.indexManager.allElements(e)))}}function Lp(e){return"object"==typeof e&&!!e&&("$ref"in e||"$error"in e)}class Op{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 r=t??{},n=null==t?void 0:t.replacer,i=(e,t)=>this.replacer(e,t,r),s=n?(e,t)=>n(e,t,i):i;try{return this.currentDocument=j(e),JSON.stringify(e,s,null==t?void 0:t.space)}finally{this.currentDocument=void 0}}deserialize(e,t){const r=t??{},n=JSON.parse(e);return this.linkNode(n,n,r),n}replacer(e,t,{refText:r,sourceText:n,textRegions:i,comments:s,uriConverter:o}){var a,c,l;if(!this.ignoreProperties.has(e)){if(S(t)){const e=t.ref,n=r?t.$refText:void 0;if(e){const t=j(e);let r="";this.currentDocument&&this.currentDocument!==t&&(r=o?o(t.uri,e):t.uri.toString());return{$ref:`${r}#${this.astNodeLocator.getAstNodePath(e)}`,$refText:n}}return{$error:(null==(a=t.error)?void 0:a.message)??"Could not resolve reference",$refText:n}}if(k(t)){const e=r?t.$refText:void 0,n=[];for(const r of t.items){const e=r.ref,t=j(r.ref);let i="";this.currentDocument&&this.currentDocument!==t&&(i=o?o(t.uri,e):t.uri.toString());const s=this.astNodeLocator.getAstNodePath(e);n.push(`${i}#${s}`)}return{$refs:n,$refText:e}}if(E(t)){let r;if(i&&(r=this.addAstNodeRegionWithAssignmentsTo({...t}),e&&!t.$document||!(null==r?void 0:r.$textRegion)||(r.$textRegion.documentURI=null==(c=this.currentDocument)?void 0:c.uri.toString())),n&&!e&&(r??(r={...t}),r.$sourceText=null==(l=t.$cstNode)?void 0:l.text),s){r??(r={...t});const e=this.commentProvider.getComment(t);e&&(r.$comment=e.replace(/\r/g,""))}return r??t}return t}}addAstNodeRegionWithAssignmentsTo(e){const t=e=>({offset:e.offset,end:e.end,length:e.length,range:e.range});if(e.$cstNode){const r=(e.$textRegion=t(e.$cstNode)).assignments={};return Object.keys(e).filter(e=>!e.startsWith("$")).forEach(n=>{const i=function(e,t){return e&&t?di(e,t,e.astNode,!0):[]}(e.$cstNode,n).map(t);0!==i.length&&(r[n]=i)}),e}}linkNode(e,t,r,n,i,s){for(const[a,c]of Object.entries(e))if(Array.isArray(c))for(let n=0;n<c.length;n++){const i=c[n];Lp(i)?c[n]=this.reviveReference(e,a,t,i,r):E(i)&&this.linkNode(i,t,r,e,a,n)}else Lp(c)?e[a]=this.reviveReference(e,a,t,c,r):E(c)&&this.linkNode(c,t,r,e,a);const o=e;o.$container=n,o.$containerProperty=i,o.$containerIndex=s}reviveReference(e,t,r,n,i){let s,o=n.$refText,a=n.$error;if(n.$ref){const e=this.getRefNode(r,n.$ref,i.uriConverter);if(E(e))return o||(o=this.nameProvider.getName(e)),{$refText:o??"",ref:e};a=e}else if(n.$refs){const e=[];for(const t of n.$refs){const n=this.getRefNode(r,t,i.uriConverter);E(n)&&e.push({ref:n})}if(0!==e.length)return{$refText:o??"",items:e};s={$refText:o??"",items:e},a??(a="Could not resolve multi-reference")}return a?(s??(s={$refText:o??"",ref:void 0}),s.error={info:{container:e,property:t,reference:s},message:a},s):void 0}getRefNode(e,t,r){try{const n=t.indexOf("#");if(0===n){const r=this.astNodeLocator.getAstNode(e,t.substring(1));return r||"Could not resolve path: "+t}if(n<0){const e=r?r(t):hp.parse(t),n=this.langiumDocuments.getDocument(e);return n?n.parseResult.value:"Could not find document for URI: "+t}const i=r?r(t.substring(0,n)):hp.parse(t.substring(0,n)),s=this.langiumDocuments.getDocument(i);if(!s)return"Could not find document for URI: "+t;if(n===t.length-1)return s.parseResult.value;const o=this.astNodeLocator.getAstNode(s.parseResult.value,t.substring(n+1));return o||"Could not resolve URI: "+t}catch(n){return String(n)}}}class Dp{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=null==e?void 0:e.workspace.TextDocuments}register(e){const t=e.LanguageMetaData;for(const r of t.fileExtensions)this.fileExtensionMap.has(r)&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileExtensionMap.set(r,e);if(t.fileNames)for(const r of t.fileNames)this.fileNameMap.has(r)&&console.warn(`The file name ${r} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileNameMap.set(r,e);this.languageIdMap.set(t.languageId,e)}getServices(e){var t,r;if(0===this.languageIdMap.size)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const n=null==(r=null==(t=this.textDocuments)?void 0:t.get(e))?void 0:r.languageId;if(void 0!==n){const e=this.languageIdMap.get(n);if(e)return e}const i=fp.extname(e),s=fp.basename(e),o=this.fileNameMap.get(s)??this.fileExtensionMap.get(i);if(!o)throw n?new Error(`The service registry contains no services for the extension '${i}' for language '${n}'.`):new Error(`The service registry contains no services for the extension '${i}'.`);return o}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function Mp(e){return{code:e}}var Fp,qp;(qp=Fp||(Fp={})).defaults=["fast","slow","built-in"],qp.all=qp.defaults;class jp{constructor(e){this.entries=new Cp,this.knownCategories=new Set(Fp.defaults),this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,t=this,r="fast"){if("built-in"===r)throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");this.knownCategories.add(r);for(const[n,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:r};this.addEntry(n,e)}else if("function"==typeof e){const i={check:this.wrapValidationException(e,t),category:r};this.addEntry(n,i)}else qn()}}wrapValidationException(e,t){return async(r,n,i)=>{await this.handleException(()=>e.call(t,r,n,i),"An error occurred during validation",n,r)}}async handleException(e,t,r,n){try{await e()}catch(i){if(ep(i))throw i;console.error(`${t}:`,i),i instanceof Error&&i.stack&&console.error(i.stack);r("error",`${t}: ${i instanceof Error?i.message:String(i)}`,{node:n})}}addEntry(e,t){if("AstNode"!==e)for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,t);else this.entries.add("AstNode",t)}getChecks(e,t){let r=L(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(r=r.filter(e=>t.includes(e.category))),r.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,r){return async(n,i,s,o)=>{await this.handleException(()=>e.call(r,n,i,s,o),t,i,n)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(e){return this.knownCategories}}const Up=Object.freeze({validateNode:!0,validateChildren:!0});class Gp{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async validateDocument(e,t={},r=Uh.None){const n=e.parseResult,i=[];if(await tp(r),!t.categories||t.categories.includes("built-in")){if(this.processLexingErrors(n,i,t),t.stopAfterLexingErrors&&i.some(e=>{var t;return(null==(t=e.data)?void 0:t.code)===Wp.LexingError}))return i;if(this.processParsingErrors(n,i,t),t.stopAfterParsingErrors&&i.some(e=>{var t;return(null==(t=e.data)?void 0:t.code)===Wp.ParsingError}))return i;if(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some(e=>{var t;return(null==(t=e.data)?void 0:t.code)===Wp.LinkingError}))return i}try{i.push(...await this.validateAst(n.value,t,r))}catch(s){if(ep(s))throw s;console.error("An error occurred during validation:",s)}return await tp(r),i}processLexingErrors(e,t,r){var n;const i=[...e.lexerErrors,...(null==(n=e.lexerReport)?void 0:n.diagnostics)??[]];for(const s of i){const e=s.severity??"error",r={severity:Bp(e),range:{start:{line:s.line-1,character:s.column-1},end:{line:s.line-1,character:s.column+s.length-1}},message:s.message,data:Kp(e),source:this.getSource()};t.push(r)}}processParsingErrors(e,t,r){for(const n of e.parserErrors){let e;if(isNaN(n.token.startOffset)){if("previousToken"in n){const t=n.previousToken;if(isNaN(t.startOffset)){const t={line:0,character:0};e={start:t,end:t}}else{const r={line:t.endLine-1,character:t.endColumn};e={start:r,end:r}}}}else e=_n(n.token);if(e){const r={severity:Bp("error"),range:e,message:n.message,data:Mp(Wp.ParsingError),source:this.getSource()};t.push(r)}}}processLinkingErrors(e,t,r){var n;for(const i of e.references){const e=i.error;if(e){const r={node:e.info.container,range:null==(n=i.$refNode)?void 0:n.range,property:e.info.property,index:e.info.index,data:{code:Wp.LinkingError,containerType:e.info.container.$type,property:e.info.property,refText:e.info.reference.$refText}};t.push(this.toDiagnostic("error",e.message,r))}}}async validateAst(e,t,r=Uh.None){const n=[],i=(e,t,r)=>{n.push(this.toDiagnostic(e,t,r))};return await this.validateAstBefore(e,t,i,r),await this.validateAstNodes(e,t,i,r),await this.validateAstAfter(e,t,i,r),n}async validateAstBefore(e,t,r,n=Uh.None){const i=this.validationRegistry.checksBefore;for(const s of i)await tp(n),await s(e,r,t.categories??[],n)}async validateAstNodes(e,t,r,n=Uh.None){var i;if(null==(i=this.profiler)?void 0:i.isActive("validating")){const i=this.profiler.createTask("validating",this.languageId);i.start();try{const s=K(e).iterator();for(const e of s){i.startSubTask(e.$type);const o=this.validateSingleNodeOptions(e,t);if(o.validateNode)try{const i=this.validationRegistry.getChecks(e.$type,t.categories);for(const t of i)await t(e,r,n)}finally{i.stopSubTask(e.$type)}o.validateChildren||s.prune()}}finally{i.stop()}}else{const i=K(e).iterator();for(const e of i){await tp(n);const s=this.validateSingleNodeOptions(e,t);if(s.validateNode){const i=this.validationRegistry.getChecks(e.$type,t.categories);for(const t of i)await t(e,r,n)}s.validateChildren||i.prune()}}}validateSingleNodeOptions(e,t){return Up}async validateAstAfter(e,t,r,n=Uh.None){const i=this.validationRegistry.checksAfter;for(const s of i)await tp(n),await s(e,r,t.categories??[],n)}toDiagnostic(e,t,r){return{message:t,range:zp(r),severity:Bp(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function zp(e){if(e.range)return e.range;let t;return"string"==typeof e.property?t=ui(e.node.$cstNode,e.property,e.index):"string"==typeof e.keyword&&(t=hi(e.node.$cstNode,e.keyword,e.index)),t??(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Bp(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 Kp(e){switch(e){case"error":return Mp(Wp.LexingError);case"warning":return Mp(Wp.LexingWarning);case"info":return Mp(Wp.LexingInfo);case"hint":return Mp(Wp.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}var Wp,Vp;(Vp=Wp||(Wp={})).LexingError="lexing-error",Vp.LexingWarning="lexing-warning",Vp.LexingInfo="lexing-info",Vp.LexingHint="lexing-hint",Vp.ParsingError="parsing-error",Vp.LinkingError="linking-error";class Hp{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,r){const n=r??j(e);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 o=()=>s??(s=Pn(this.nameProvider.getNameNode(e)??e.$cstNode));return{node:e,name:t,get nameSegment(){return o()},selectionSegment:Pn(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}}class Yp{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Uh.None){const r=[],n=e.parseResult.value;for(const i of K(n))await tp(t),V(i).forEach(e=>{e.reference.error||r.push(...this.createInfoDescriptions(e))});return r}createInfoDescriptions(e){const t=e.reference;if(t.error||!t.$refNode)return[];let r=[];S(t)&&t.$nodeDescription?r=[t.$nodeDescription]:k(t)&&(r=t.items.map(e=>e.$nodeDescription).filter(e=>void 0!==e));const n=j(e.container).uri,i=this.nodeLocator.getAstNodePath(e.container),s=[],o=Pn(t.$refNode);for(const a of r)s.push({sourceUri:n,sourcePath:i,targetUri:a.documentUri,targetPath:a.path,segment:o,local:fp.equals(a.documentUri,n)});return s}}class Xp{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const t=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return t+this.segmentSeparator+r}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 r=t.indexOf(this.indexSeparator);if(r>0){const n=t.substring(0,r),i=parseInt(t.substring(r+1)),s=e[n];return null==s?void 0:s[i]}return e[t]},e)}}class Jp{constructor(e){this._ready=new rp,this.onConfigurationSectionUpdateEmitter=new Fh,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var t;this.workspaceConfig=(null==(t=e.capabilities.workspace)?void 0:t.configuration)??!1}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)})),r=await e.fetchConfiguration(t);t.forEach((e,t)=>{this.updateSectionConfiguration(e.section,r[t])})}}this._ready.resolve()}updateConfiguration(e){"object"==typeof e.settings&&null!==e.settings&&Object.entries(e.settings).forEach(([e,t])=>{this.updateSectionConfiguration(e,t),this.onConfigurationSectionUpdateEmitter.fire({section:e,configuration:t})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;const r=this.toSectionName(e);if(this.settings[r])return this.settings[r][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var Zp,Qp={},ef={},tf={},rf={},nf={};function sf(){if(Zp)return nf;Zp=1,Object.defineProperty(nf,"__esModule",{value:!0}),nf.Message=nf.NotificationType9=nf.NotificationType8=nf.NotificationType7=nf.NotificationType6=nf.NotificationType5=nf.NotificationType4=nf.NotificationType3=nf.NotificationType2=nf.NotificationType1=nf.NotificationType0=nf.NotificationType=nf.RequestType9=nf.RequestType8=nf.RequestType7=nf.RequestType6=nf.RequestType5=nf.RequestType4=nf.RequestType3=nf.RequestType2=nf.RequestType1=nf.RequestType=nf.RequestType0=nf.AbstractMessageSignature=nf.ParameterStructures=nf.ResponseError=nf.ErrorCodes=void 0;const e=Lh;var t,r,n,i;(r=t||(nf.ErrorCodes=t={})).ParseError=-32700,r.InvalidRequest=-32600,r.MethodNotFound=-32601,r.InvalidParams=-32602,r.InternalError=-32603,r.jsonrpcReservedErrorRangeStart=-32099,r.serverErrorStart=-32099,r.MessageWriteError=-32099,r.MessageReadError=-32098,r.PendingResponseRejected=-32097,r.ConnectionInactive=-32096,r.ServerNotInitialized=-32002,r.UnknownErrorCode=-32001,r.jsonrpcReservedErrorRangeEnd=-32e3,r.serverErrorEnd=-32e3;class s extends Error{constructor(r,n,i){super(n),this.code=e.number(r)?r:t.UnknownErrorCode,this.data=i,Object.setPrototypeOf(this,s.prototype)}toJson(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),e}}nf.ResponseError=s;class o{constructor(e){this.kind=e}static is(e){return e===o.auto||e===o.byName||e===o.byPosition}toString(){return this.kind}}nf.ParameterStructures=o,o.auto=new o("auto"),o.byPosition=new o("byPosition"),o.byName=new o("byName");class a{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return o.auto}}nf.AbstractMessageSignature=a;nf.RequestType0=class extends a{constructor(e){super(e,0)}};nf.RequestType=class extends a{constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};nf.RequestType1=class extends a{constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};nf.RequestType2=class extends a{constructor(e){super(e,2)}};nf.RequestType3=class extends a{constructor(e){super(e,3)}};nf.RequestType4=class extends a{constructor(e){super(e,4)}};nf.RequestType5=class extends a{constructor(e){super(e,5)}};nf.RequestType6=class extends a{constructor(e){super(e,6)}};nf.RequestType7=class extends a{constructor(e){super(e,7)}};nf.RequestType8=class extends a{constructor(e){super(e,8)}};nf.RequestType9=class extends a{constructor(e){super(e,9)}};nf.NotificationType=class extends a{constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};nf.NotificationType0=class extends a{constructor(e){super(e,0)}};nf.NotificationType1=class extends a{constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};nf.NotificationType2=class extends a{constructor(e){super(e,2)}};nf.NotificationType3=class extends a{constructor(e){super(e,3)}};nf.NotificationType4=class extends a{constructor(e){super(e,4)}};nf.NotificationType5=class extends a{constructor(e){super(e,5)}};nf.NotificationType6=class extends a{constructor(e){super(e,6)}};nf.NotificationType7=class extends a{constructor(e){super(e,7)}};nf.NotificationType8=class extends a{constructor(e){super(e,8)}};return nf.NotificationType9=class extends a{constructor(e){super(e,9)}},(i=n||(nf.Message=n={})).isRequest=function(t){const r=t;return r&&e.string(r.method)&&(e.string(r.id)||e.number(r.id))},i.isNotification=function(t){const r=t;return r&&e.string(r.method)&&void 0===t.id},i.isResponse=function(t){const r=t;return r&&(void 0!==r.result||!!r.error)&&(e.string(r.id)||e.number(r.id)||null===r.id)},nf}var of,af={};function cf(){if(of)return af;var e,t,r;of=1,Object.defineProperty(af,"__esModule",{value:!0}),af.LRUCache=af.LinkedMap=af.Touch=void 0,(r=t||(af.Touch=t={})).None=0,r.First=1,r.AsOld=r.First,r.Last=2,r.AsNew=r.Last;class n{constructor(){this[e]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return null==(e=this._head)?void 0:e.value}get last(){var e;return null==(e=this._tail)?void 0:e.value}has(e){return this._map.has(e)}get(e,r=t.None){const n=this._map.get(e);if(n)return r!==t.None&&this.touch(n,r),n.value}set(e,r,n=t.None){let i=this._map.get(e);if(i)i.value=r,n!==t.None&&this.touch(i,n);else{switch(i={key:e,value:r,next:void 0,previous:void 0},n){case t.None:this.addItemLast(i);break;case t.First:this.addItemFirst(i);break;case t.Last:default:this.addItemLast(i)}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const r=this._state;let n=this._head;for(;n;){if(t?e.bind(t)(n.value,n.key,this):e(n.value,n.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");n=n.next}}keys(){const e=this._state;let t=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return r}values(){const e=this._state;let t=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return r}entries(){const e=this._state;let t=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return r}[(e=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();let t=this._head,r=this.size;for(;t&&r>e;)this._map.delete(t.key),t=t.next,r--;this._head=t,this._size=r,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,r=e.previous;if(!t||!r)throw new Error("Invalid list");t.previous=r,r.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(r===t.First||r===t.Last)if(r===t.First){if(e===this._head)return;const t=e.next,r=e.previous;e===this._tail?(r.next=void 0,this._tail=r):(t.previous=r,r.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(r===t.Last){if(e===this._tail)return;const t=e.next,r=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=r,r.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach((t,r)=>{e.push([r,t])}),e}fromJSON(e){this.clear();for(const[t,r]of e)this.set(t,r)}}af.LinkedMap=n;return af.LRUCache=class extends n{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,r=t.AsNew){return super.get(e,r)}peek(e){return super.get(e,t.None)}set(e,r){return super.set(e,r,t.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}},af}var lf,uf={};var df,hf={};var pf,ff,mf={},gf={};function yf(){if(pf)return gf;pf=1,Object.defineProperty(gf,"__esModule",{value:!0}),gf.Semaphore=void 0;const e=Ih;return gf.Semaphore=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,r)=>{this._waiting.push({thunk:e,resolve:t,reject:r}),this.runNext()})}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,e.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const t=e.thunk();t instanceof Promise?t.then(t=>{this._active--,e.resolve(t),this.runNext()},t=>{this._active--,e.reject(t),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}},gf}var Tf,vf={};var Rf,Ef={};var Sf,kf,Cf={};function Af(){return Sf||(Sf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;const t=Ih,r=Lh,n=sf(),i=cf(),s=Mh,o=Nh;var a,c,l,u,d,h,p,f,m,g,y,T,v,R,E,S,k,C,A,b,$,x,w,N,I,_,P;(a||(a={})).type=new n.NotificationType("$/cancelRequest"),(c||(e.ProgressToken=c={})).is=function(e){return"string"==typeof e||"number"==typeof e},(l||(l={})).type=new n.NotificationType("$/progress");e.ProgressType=class{constructor(){}},(u||(u={})).is=function(e){return r.func(e)},e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),(h=d||(e.Trace=d={}))[h.Off=0]="Off",h[h.Messages=1]="Messages",h[h.Compact=2]="Compact",h[h.Verbose=3]="Verbose",(f=p||(e.TraceValues=p={})).Off="off",f.Messages="messages",f.Compact="compact",f.Verbose="verbose",function(e){e.fromString=function(t){if(!r.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":default:return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}}(d||(e.Trace=d={})),(g=m||(e.TraceFormat=m={})).Text="text",g.JSON="json",function(e){e.fromString=function(t){return r.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(m||(e.TraceFormat=m={})),(y||(e.SetTraceNotification=y={})).type=new n.NotificationType("$/setTrace"),(T||(e.LogTraceNotification=T={})).type=new n.NotificationType("$/logTrace"),(R=v||(e.ConnectionErrors=v={}))[R.Closed=1]="Closed",R[R.Disposed=2]="Disposed",R[R.AlreadyListening=3]="AlreadyListening";class L extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,L.prototype)}}e.ConnectionError=L,(E||(e.ConnectionStrategy=E={})).is=function(e){const t=e;return t&&r.func(t.cancelUndispatched)},(S||(e.IdCancellationReceiverStrategy=S={})).is=function(e){const t=e;return t&&(void 0===t.kind||"id"===t.kind)&&r.func(t.createCancellationTokenSource)&&(void 0===t.dispose||r.func(t.dispose))},(k||(e.RequestCancellationReceiverStrategy=k={})).is=function(e){const t=e;return t&&"request"===t.kind&&r.func(t.createCancellationTokenSource)&&(void 0===t.dispose||r.func(t.dispose))},(A=C||(e.CancellationReceiverStrategy=C={})).Message=Object.freeze({createCancellationTokenSource:e=>new o.CancellationTokenSource}),A.is=function(e){return S.is(e)||k.is(e)},($=b||(e.CancellationSenderStrategy=b={})).Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(a.type,{id:t}),cleanup(e){}}),$.is=function(e){const t=e;return t&&r.func(t.sendCancellation)&&r.func(t.cleanup)},(w=x||(e.CancellationStrategy=x={})).Message=Object.freeze({receiver:C.Message,sender:b.Message}),w.is=function(e){const t=e;return t&&C.is(t.receiver)&&b.is(t.sender)},(N||(e.MessageStrategy=N={})).is=function(e){const t=e;return t&&r.func(t.handleMessage)},(I||(e.ConnectionOptions=I={})).is=function(e){const t=e;return t&&(x.is(t.cancellationStrategy)||E.is(t.connectionStrategy)||N.is(t.messageStrategy))},(P=_||(_={}))[P.New=1]="New",P[P.Listening=2]="Listening",P[P.Closed=3]="Closed",P[P.Disposed=4]="Disposed",e.createMessageConnection=function(h,p,f,g){const R=void 0!==f?f:e.NullLogger;let E=0,k=0,C=0;const A="2.0";let b;const $=new Map;let w;const I=new Map,P=new Map;let O,D,M=new i.LinkedMap,F=new Map,q=new Set,j=new Map,U=d.Off,G=m.Text,z=_.New;const B=new s.Emitter,K=new s.Emitter,W=new s.Emitter,V=new s.Emitter,H=new s.Emitter,Y=g&&g.cancellationStrategy?g.cancellationStrategy:x.Message;function X(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function J(e,t){var r;n.Message.isRequest(t)?e.set(X(t.id),t):n.Message.isResponse(t)?e.set(null===(r=t.id)?"res-unknown-"+(++C).toString():"res-"+r.toString(),t):e.set("not-"+(++k).toString(),t)}function Z(e){}function Q(){return z===_.Listening}function ee(){return z===_.Closed}function te(){return z===_.Disposed}function re(){z!==_.New&&z!==_.Listening||(z=_.Closed,K.fire(void 0))}function ne(){O||0===M.size||(O=(0,t.default)().timer.setImmediate(()=>{O=void 0,function(){if(0===M.size)return;const e=M.shift();try{const t=null==g?void 0:g.messageStrategy;N.is(t)?t.handleMessage(e,ie):ie(e)}finally{ne()}}()}))}function ie(e){n.Message.isRequest(e)?function(e){if(te())return;function t(t,r,i){const s={jsonrpc:A,id:e.id};t instanceof n.ResponseError?s.error=t.toJson():s.result=void 0===t?null:t,ae(s,r,i),p.write(s).catch(()=>R.error("Sending response failed."))}function i(t,r,n){const i={jsonrpc:A,id:e.id,error:t.toJson()};ae(i,r,n),p.write(i).catch(()=>R.error("Sending response failed."))}function s(t,r,n){void 0===t&&(t=null);const i={jsonrpc:A,id:e.id,result:t};ae(i,r,n),p.write(i).catch(()=>R.error("Sending response failed."))}!function(e){if(U===d.Off||!D)return;if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||!e.params||(t=`Params: ${oe(e.params)}\n\n`),D.log(`Received request '${e.method} - (${e.id})'.`,t)}else le("receive-request",e)}(e);const o=$.get(e.method);let a,c;o&&(a=o.type,c=o.handler);const l=Date.now();if(c||b){const o=e.id??String(Date.now()),d=S.is(Y.receiver)?Y.receiver.createCancellationTokenSource(o):Y.receiver.createCancellationTokenSource(e);null!==e.id&&q.has(e.id)&&d.cancel(),null!==e.id&&j.set(o,d);try{let u;if(c)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void i(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but received none.`),e.method,l);u=c(d.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===n.ParameterStructures.byName)return void i(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);u=c(...e.params,d.token)}else{if(void 0!==a&&a.parameterStructures===n.ParameterStructures.byPosition)return void i(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);u=c(e.params,d.token)}else b&&(u=b(e.method,e.params,d.token));const h=u;u?h.then?h.then(r=>{j.delete(o),t(r,e.method,l)},t=>{j.delete(o),t instanceof n.ResponseError?i(t,e.method,l):t&&r.string(t.message)?i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}):(j.delete(o),t(u,e.method,l)):(j.delete(o),s(u,e.method,l))}catch(u){j.delete(o),u instanceof n.ResponseError?t(u,e.method,l):u&&r.string(u.message)?i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${u.message}`),e.method,l):i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else i(new n.ResponseError(n.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}(e):n.Message.isNotification(e)?function(e){if(te())return;let t,r;if(e.method===a.type.method){const t=e.params.id;return q.delete(t),void ce(e)}{const n=I.get(e.method);n&&(r=n.handler,t=n.type)}if(r||w)try{if(ce(e),r)if(void 0===e.params)void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==n.ParameterStructures.byName&&R.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),r();else if(Array.isArray(e.params)){const i=e.params;e.method===l.type.method&&2===i.length&&c.is(i[0])?r({token:i[0],value:i[1]}):(void 0!==t&&(t.parameterStructures===n.ParameterStructures.byName&&R.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&R.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${i.length} arguments`)),r(...i))}else void 0!==t&&t.parameterStructures===n.ParameterStructures.byPosition&&R.error(`Notification ${e.method} defines parameters by position but received parameters by name`),r(e.params);else w&&w(e.method,e.params)}catch(i){i.message?R.error(`Notification handler '${e.method}' failed with message: ${i.message}`):R.error(`Notification handler '${e.method}' failed unexpectedly.`)}else W.fire(e)}(e):n.Message.isResponse(e)?function(e){if(te())return;if(null===e.id)e.error?R.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):R.error("Received response message without id. No further error information provided.");else{const r=e.id,i=F.get(r);if(function(e,t){if(U===d.Off||!D)return;if(G===m.Text){let r;if(U!==d.Verbose&&U!==d.Compact||(e.error&&e.error.data?r=`Error data: ${oe(e.error.data)}\n\n`:e.result?r=`Result: ${oe(e.result)}\n\n`:void 0===e.error&&(r="No result returned.\n\n")),t){const n=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";D.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${n}`,r)}else D.log(`Received response ${e.id} without active response promise.`,r)}else le("receive-response",e)}(e,i),void 0!==i){F.delete(r);try{if(e.error){const t=e.error;i.reject(new n.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");i.resolve(e.result)}}catch(t){t.message?R.error(`Response handler '${i.method}' failed with message: ${t.message}`):R.error(`Response handler '${i.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void R.error("Received empty message.");R.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(r.string(t.id)||r.number(t.id)){const e=t.id,r=F.get(e);r&&r.reject(new Error("The received response has neither a result nor an error property."))}}(e)}h.onClose(re),h.onError(function(e){B.fire([e,void 0,void 0])}),p.onClose(re),p.onError(function(e){B.fire(e)});const se=e=>{try{if(n.Message.isNotification(e)&&e.method===a.type.method){const t=e.params.id,r=X(t),i=M.get(r);if(n.Message.isRequest(i)){const n=null==g?void 0:g.connectionStrategy,s=n&&n.cancelUndispatched?n.cancelUndispatched(i,Z):void 0;if(s&&(void 0!==s.error||void 0!==s.result))return M.delete(r),j.delete(t),s.id=i.id,ae(s,e.method,Date.now()),void p.write(s).catch(()=>R.error("Sending response for canceled message failed."))}const s=j.get(t);if(void 0!==s)return s.cancel(),void ce(e);q.add(t)}J(M,e)}finally{ne()}};function oe(e){if(null!=e)switch(U){case d.Verbose:return JSON.stringify(e,null,4);case d.Compact:return JSON.stringify(e);default:return}}function ae(e,t,r){if(U!==d.Off&&D)if(G===m.Text){let n;U!==d.Verbose&&U!==d.Compact||(e.error&&e.error.data?n=`Error data: ${oe(e.error.data)}\n\n`:e.result?n=`Result: ${oe(e.result)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),D.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-r}ms`,n)}else le("send-response",e)}function ce(e){if(U!==d.Off&&D&&e.method!==T.type.method)if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||(t=e.params?`Params: ${oe(e.params)}\n\n`:"No parameters provided.\n\n"),D.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!D||U===d.Off)return;const r={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};D.log(r)}function ue(){if(ee())throw new L(v.Closed,"Connection is closed.");if(te())throw new L(v.Disposed,"Connection is disposed.")}function de(e){return void 0===e?null:e}function he(e){return null===e?void 0:e}function pe(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function fe(e,t){switch(e){case n.ParameterStructures.auto:return pe(t)?he(t):[de(t)];case n.ParameterStructures.byName:if(!pe(t))throw new Error("Received parameters by name but param is not an object literal.");return he(t);case n.ParameterStructures.byPosition:return[de(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function me(e,t){let r;const n=e.numberOfParams;switch(n){case 0:r=void 0;break;case 1:r=fe(e.parameterStructures,t[0]);break;default:r=[];for(let e=0;e<t.length&&e<n;e++)r.push(de(t[e]));if(t.length<n)for(let e=t.length;e<n;e++)r.push(null)}return r}const ge={sendNotification:(e,...t)=>{let i,s;if(ue(),r.string(e)){i=e;const r=t[0];let o=0,a=n.ParameterStructures.auto;n.ParameterStructures.is(r)&&(o=1,a=r);let c=t.length;const l=c-o;switch(l){case 0:s=void 0;break;case 1:s=fe(a,t[o]);break;default:if(a===n.ParameterStructures.byName)throw new Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);s=t.slice(o,c).map(e=>de(e))}}else{const r=t;i=e.method,s=me(e,r)}const o={jsonrpc:A,method:i,params:s};return function(e){if(U!==d.Off&&D)if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||(t=e.params?`Params: ${oe(e.params)}\n\n`:"No parameters provided.\n\n"),D.log(`Sending notification '${e.method}'.`,t)}else le("send-notification",e)}(o),p.write(o).catch(e=>{throw R.error("Sending notification failed."),e})},onNotification:(e,t)=>{let n;return ue(),r.func(e)?w=e:t&&(r.string(e)?(n=e,I.set(e,{type:void 0,handler:t})):(n=e.method,I.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==n?I.delete(n):w=void 0}}},onProgress:(e,t,r)=>{if(P.has(t))throw new Error(`Progress handler for token ${t} already registered`);return P.set(t,r),{dispose:()=>{P.delete(t)}}},sendProgress:(e,t,r)=>ge.sendNotification(l.type,{token:t,value:r}),onUnhandledProgress:V.event,sendRequest:(e,...t)=>{let i,s,a;if(ue(),function(){if(!Q())throw new Error("Call listen() first.")}(),r.string(e)){i=e;const r=t[0],c=t[t.length-1];let l=0,u=n.ParameterStructures.auto;n.ParameterStructures.is(r)&&(l=1,u=r);let d=t.length;o.CancellationToken.is(c)&&(d-=1,a=c);const h=d-l;switch(h){case 0:s=void 0;break;case 1:s=fe(u,t[l]);break;default:if(u===n.ParameterStructures.byName)throw new Error(`Received ${h} parameters for 'by Name' request parameter structure.`);s=t.slice(l,d).map(e=>de(e))}}else{const r=t;i=e.method,s=me(e,r);const n=e.numberOfParams;a=o.CancellationToken.is(r[n])?r[n]:void 0}const c=E++;let l;a&&(l=a.onCancellationRequested(()=>{const e=Y.sender.sendCancellation(ge,c);return void 0===e?(R.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch(()=>{R.log(`Sending cancellation messages for id ${c} failed`)})}));const u={jsonrpc:A,id:c,method:i,params:s};return function(e){if(U!==d.Off&&D)if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||!e.params||(t=`Params: ${oe(e.params)}\n\n`),D.log(`Sending request '${e.method} - (${e.id})'.`,t)}else le("send-request",e)}(u),"function"==typeof Y.sender.enableCancellation&&Y.sender.enableCancellation(u),new Promise(async(e,t)=>{const r={method:i,timerStart:Date.now(),resolve:t=>{e(t),Y.sender.cleanup(c),null==l||l.dispose()},reject:e=>{t(e),Y.sender.cleanup(c),null==l||l.dispose()}};try{await p.write(u),F.set(c,r)}catch(s){throw R.error("Sending request failed."),r.reject(new n.ResponseError(n.ErrorCodes.MessageWriteError,s.message?s.message:"Unknown reason")),s}})},onRequest:(e,t)=>{ue();let n=null;return u.is(e)?(n=void 0,b=e):r.string(e)?(n=null,void 0!==t&&(n=e,$.set(e,{handler:t,type:void 0}))):void 0!==t&&(n=e.method,$.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==n&&(void 0!==n?$.delete(n):b=void 0)}}},hasPendingResponse:()=>F.size>0,trace:async(e,t,n)=>{let i=!1,s=m.Text;void 0!==n&&(r.boolean(n)?i=n:(i=n.sendNotification||!1,s=n.traceFormat||m.Text)),U=e,G=s,D=U===d.Off?void 0:t,!i||ee()||te()||await ge.sendNotification(y.type,{value:d.toString(e)})},onError:B.event,onClose:K.event,onUnhandledNotification:W.event,onDispose:H.event,end:()=>{p.end()},dispose:()=>{if(te())return;z=_.Disposed,H.fire(void 0);const e=new n.ResponseError(n.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const t of F.values())t.reject(e);F=new Map,j=new Map,q=new Set,M=new i.LinkedMap,r.func(p.dispose)&&p.dispose(),r.func(h.dispose)&&h.dispose()},listen:()=>{ue(),function(){if(Q())throw new L(v.AlreadyListening,"Connection is already listening")}(),z=_.Listening,h.listen(se)},inspect:()=>{(0,t.default)().console.log("inspect")}};return ge.onNotification(T.type,e=>{if(U===d.Off||!D)return;const t=U===d.Verbose||U===d.Compact;D.log(e.message,t?e.verbose:void 0)}),ge.onNotification(l.type,e=>{const t=P.get(e.token);t?t(e.value):V.fire(e)}),ge}}(Cf)),Cf}function bf(){return kf||(kf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;const t=sf();Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});const r=cf();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return r.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return r.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return r.Touch}});const n=(lf||(lf=1,Object.defineProperty(uf,"__esModule",{value:!0}),uf.Disposable=void 0,(i||(uf.Disposable=i={})).create=function(e){return{dispose:e}}),uf);var i;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return n.Disposable}});const s=Mh;Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return s.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return s.Emitter}});const o=Nh;Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return o.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return o.CancellationToken}});const a=function(){if(df)return hf;df=1,Object.defineProperty(hf,"__esModule",{value:!0}),hf.SharedArrayReceiverStrategy=hf.SharedArraySenderStrategy=void 0;const e=Nh;var t,r;(r=t||(t={})).Continue=0,r.Cancelled=1,hf.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(null===e.id)return;const r=new SharedArrayBuffer(4);new Int32Array(r,0,1)[0]=t.Continue,this.buffers.set(e.id,r),e.$cancellationData=r}async sendCancellation(e,r){const n=this.buffers.get(r);if(void 0===n)return;const i=new Int32Array(n,0,1);Atomics.store(i,0,t.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};class n{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===t.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class i{constructor(e){this.token=new n(e)}cancel(){}dispose(){}}return hf.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(t){const r=t.$cancellationData;return void 0===r?new e.CancellationTokenSource:new i(r)}},hf}();Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return a.SharedArraySenderStrategy}}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return a.SharedArrayReceiverStrategy}});const c=function(){if(ff)return mf;ff=1,Object.defineProperty(mf,"__esModule",{value:!0}),mf.ReadableStreamMessageReader=mf.AbstractMessageReader=mf.MessageReader=void 0;const e=Ih,t=Lh,r=Mh,n=yf();var i,s;(i||(mf.MessageReader=i={})).is=function(e){let r=e;return r&&t.func(r.listen)&&t.func(r.dispose)&&t.func(r.onError)&&t.func(r.onClose)&&t.func(r.onPartialMessage)};class o{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter,this.partialMessageEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${t.string(e.message)?e.message:"unknown"}`)}}return mf.AbstractMessageReader=o,(s||(s={})).fromOptions=function(t){let r,n;const i=new Map;let s;const o=new Map;if(void 0===t||"string"==typeof t)r=t??"utf-8";else{if(r=t.charset??"utf-8",void 0!==t.contentDecoder&&(n=t.contentDecoder,i.set(n.name,n)),void 0!==t.contentDecoders)for(const e of t.contentDecoders)i.set(e.name,e);if(void 0!==t.contentTypeDecoder&&(s=t.contentTypeDecoder,o.set(s.name,s)),void 0!==t.contentTypeDecoders)for(const e of t.contentTypeDecoders)o.set(e.name,e)}return void 0===s&&(s=(0,e.default)().applicationJson.decoder,o.set(s.name,s)),{charset:r,contentDecoder:n,contentDecoders:i,contentTypeDecoder:s,contentTypeDecoders:o}},mf.ReadableStreamMessageReader=class extends o{constructor(t,r){super(),this.readable=t,this.options=s.fromOptions(r),this.buffer=(0,e.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new n.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const t=this.readable.onData(e=>{this.onData(e)});return this.readable.onError(e=>this.fireError(e)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(-1===this.nextMessageLength){const e=this.buffer.tryReadHeaders(!0);if(!e)return;const t=e.get("content-length");if(!t)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));const r=parseInt(t);if(isNaN(r))return void this.fireError(new Error(`Content-Length value must be a number. Got ${t}`));this.nextMessageLength=r}const e=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===e)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const t=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(e):e,r=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(r)}).catch(e=>{this.fireError(e)})}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,e.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}},mf}();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return c.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return c.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return c.ReadableStreamMessageReader}});const l=function(){if(Tf)return vf;Tf=1,Object.defineProperty(vf,"__esModule",{value:!0}),vf.WriteableStreamMessageWriter=vf.AbstractMessageWriter=vf.MessageWriter=void 0;const e=Ih,t=Lh,r=yf(),n=Mh;var i,s;(i||(vf.MessageWriter=i={})).is=function(e){let r=e;return r&&t.func(r.dispose)&&t.func(r.onClose)&&t.func(r.onError)&&t.func(r.write)};class o{constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,r){this.errorEmitter.fire([this.asError(e),t,r])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${t.string(e.message)?e.message:"unknown"}`)}}return vf.AbstractMessageWriter=o,(s||(s={})).fromOptions=function(t){return void 0===t||"string"==typeof t?{charset:t??"utf-8",contentTypeEncoder:(0,e.default)().applicationJson.encoder}:{charset:t.charset??"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,e.default)().applicationJson.encoder}},vf.WriteableStreamMessageWriter=class extends o{constructor(e,t){super(),this.writable=e,this.options=s.fromOptions(t),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(e=>this.fireError(e)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(e=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(e):e).then(t=>{const r=[];return r.push("Content-Length: ",t.byteLength.toString(),"\r\n"),r.push("\r\n"),this.doWrite(e,r,t)},e=>{throw this.fireError(e),e}))}async doWrite(e,t,r){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(r)}catch(n){return this.handleError(n,e),Promise.reject(n)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}},vf}();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return l.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return l.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return l.WriteableStreamMessageWriter}});const u=(Rf||(Rf=1,Object.defineProperty(Ef,"__esModule",{value:!0}),Ef.AbstractMessageBuffer=void 0,Ef.AbstractMessageBuffer=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const t="string"==typeof e?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(0===this._chunks.length)return;let t=0,r=0,n=0,i=0;e:for(;r<this._chunks.length;){const e=this._chunks[r];for(n=0;n<e.length;){switch(e[n]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,n++;break e;default:t=0}break;default:t=0}n++}i+=e.byteLength,r++}if(4!==t)return;const s=this._read(i+n),o=new Map,a=this.toString(s,"ascii").split("\r\n");if(a.length<2)return o;for(let c=0;c<a.length-2;c++){const t=a[c],r=t.indexOf(":");if(-1===r)throw new Error(`Message header must separate key and value using ':'\n${t}`);const n=t.substr(0,r),i=t.substr(r+1).trim();o.set(e?n.toLowerCase():n,i)}return o}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(0===e)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){const t=this._chunks[0],r=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,r}const t=this.allocNative(e);let r=0;for(;e>0;){const n=this._chunks[0];if(n.byteLength>e){const i=n.slice(0,e);t.set(i,r),r+=e,this._chunks[0]=n.slice(e),this._totalLength-=e,e-=e}else t.set(n,r),r+=n.byteLength,this._chunks.shift(),this._totalLength-=n.byteLength,e-=n.byteLength}return t}}),Ef);Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u.AbstractMessageBuffer}});const d=Af();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return d.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return d.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return d.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return d.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return d.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return d.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return d.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return d.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return d.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return d.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return d.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return d.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return d.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return d.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return d.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return d.CancellationStrategy}}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:function(){return d.MessageStrategy}});const h=Ih;e.RAL=h.default}(rf)),rf}Object.defineProperty(tf,"__esModule",{value:!0});const $f=bf();class xf extends $f.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return xf.emptyBuffer}fromString(e,t){return(new TextEncoder).encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}xf.emptyBuffer=new Uint8Array(0);class wf{constructor(e){this.socket=e,this._onData=new $f.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then(e=>{this._onData.fire(new Uint8Array(e))},()=>{(0,$f.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),$f.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),$f.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),$f.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}}class Nf{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),$f.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),$f.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),$f.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const If=new TextEncoder,_f=Object.freeze({messageBuffer:Object.freeze({create:e=>new xf(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(If.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new wf(e),asWritableStream:e=>new Nf(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...r){const n=setTimeout(e,t,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(e,...t){const r=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(r)}},setInterval(e,t,...r){const n=setInterval(e,t,...r);return{dispose:()=>clearInterval(n)}}})});function Pf(){return _f}(Pf||(Pf={})).install=function(){$f.RAL.install(_f)},tf.default=Pf,function(e){var t=v.commonjsGlobal&&v.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=v.commonjsGlobal&&v.commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0;tf.default.install();const n=bf();r(bf(),e);class i extends n.AbstractMessageReader{constructor(e){super(),this._onData=new n.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",e=>this.fireError(e)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}e.BrowserMessageReader=i;class s extends n.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",e=>this.fireError(e))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.BrowserMessageWriter=s,e.createMessageConnection=function(e,t,r,i){return void 0===r&&(r=n.NullLogger),n.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,n.createMessageConnection)(e,t,r,i)}}(ef);var Lf=ef,Of={};const Df=v.getAugmentedNamespace(Qd);var Mf={};Object.defineProperty(Mf,"__esModule",{value:!0}),Mf.ProtocolNotificationType=Mf.ProtocolNotificationType0=Mf.ProtocolRequestType=Mf.ProtocolRequestType0=Mf.RegistrationType=Mf.MessageDirection=void 0;const Ff=ef;var qf,jf;(jf=qf||(Mf.MessageDirection=qf={})).clientToServer="clientToServer",jf.serverToClient="serverToClient",jf.both="both";Mf.RegistrationType=class{constructor(e){this.method=e}};Mf.ProtocolRequestType0=class extends Ff.RequestType0{constructor(e){super(e)}};Mf.ProtocolRequestType=class extends Ff.RequestType{constructor(e){super(e,Ff.ParameterStructures.byName)}};Mf.ProtocolNotificationType0=class extends Ff.NotificationType0{constructor(e){super(e)}};Mf.ProtocolNotificationType=class extends Ff.NotificationType{constructor(e){super(e,Ff.ParameterStructures.byName)}};var Uf={},Gf={};function zf(e){return"string"==typeof e||e instanceof String}function Bf(e){return Array.isArray(e)}Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.objectLiteral=Gf.typedArray=Gf.stringArray=Gf.array=Gf.func=Gf.error=Gf.number=Gf.string=Gf.boolean=void 0,Gf.boolean=function(e){return!0===e||!1===e},Gf.string=zf,Gf.number=function(e){return"number"==typeof e||e instanceof Number},Gf.error=function(e){return e instanceof Error},Gf.func=function(e){return"function"==typeof e},Gf.array=Bf,Gf.stringArray=function(e){return Bf(e)&&e.every(e=>zf(e))},Gf.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)},Gf.objectLiteral=function(e){return null!==e&&"object"==typeof e};var Kf={};Object.defineProperty(Kf,"__esModule",{value:!0}),Kf.ImplementationRequest=void 0;const Wf=Mf;var Vf,Hf;(Hf=Vf||(Kf.ImplementationRequest=Vf={})).method="textDocument/implementation",Hf.messageDirection=Wf.MessageDirection.clientToServer,Hf.type=new Wf.ProtocolRequestType(Hf.method);var Yf={};Object.defineProperty(Yf,"__esModule",{value:!0}),Yf.TypeDefinitionRequest=void 0;const Xf=Mf;var Jf,Zf;(Zf=Jf||(Yf.TypeDefinitionRequest=Jf={})).method="textDocument/typeDefinition",Zf.messageDirection=Xf.MessageDirection.clientToServer,Zf.type=new Xf.ProtocolRequestType(Zf.method);var Qf={};Object.defineProperty(Qf,"__esModule",{value:!0}),Qf.DidChangeWorkspaceFoldersNotification=Qf.WorkspaceFoldersRequest=void 0;const em=Mf;var tm,rm,nm,im;(rm=tm||(Qf.WorkspaceFoldersRequest=tm={})).method="workspace/workspaceFolders",rm.messageDirection=em.MessageDirection.serverToClient,rm.type=new em.ProtocolRequestType0(rm.method),(im=nm||(Qf.DidChangeWorkspaceFoldersNotification=nm={})).method="workspace/didChangeWorkspaceFolders",im.messageDirection=em.MessageDirection.clientToServer,im.type=new em.ProtocolNotificationType(im.method);var sm={};Object.defineProperty(sm,"__esModule",{value:!0}),sm.ConfigurationRequest=void 0;const om=Mf;var am,cm;(cm=am||(sm.ConfigurationRequest=am={})).method="workspace/configuration",cm.messageDirection=om.MessageDirection.serverToClient,cm.type=new om.ProtocolRequestType(cm.method);var lm={};Object.defineProperty(lm,"__esModule",{value:!0}),lm.ColorPresentationRequest=lm.DocumentColorRequest=void 0;const um=Mf;var dm,hm,pm,fm;(hm=dm||(lm.DocumentColorRequest=dm={})).method="textDocument/documentColor",hm.messageDirection=um.MessageDirection.clientToServer,hm.type=new um.ProtocolRequestType(hm.method),(fm=pm||(lm.ColorPresentationRequest=pm={})).method="textDocument/colorPresentation",fm.messageDirection=um.MessageDirection.clientToServer,fm.type=new um.ProtocolRequestType(fm.method);var mm={};Object.defineProperty(mm,"__esModule",{value:!0}),mm.FoldingRangeRefreshRequest=mm.FoldingRangeRequest=void 0;const gm=Mf;var ym,Tm,vm,Rm;(Tm=ym||(mm.FoldingRangeRequest=ym={})).method="textDocument/foldingRange",Tm.messageDirection=gm.MessageDirection.clientToServer,Tm.type=new gm.ProtocolRequestType(Tm.method),(Rm=vm||(mm.FoldingRangeRefreshRequest=vm={})).method="workspace/foldingRange/refresh",Rm.messageDirection=gm.MessageDirection.serverToClient,Rm.type=new gm.ProtocolRequestType0(Rm.method);var Em={};Object.defineProperty(Em,"__esModule",{value:!0}),Em.DeclarationRequest=void 0;const Sm=Mf;var km,Cm;(Cm=km||(Em.DeclarationRequest=km={})).method="textDocument/declaration",Cm.messageDirection=Sm.MessageDirection.clientToServer,Cm.type=new Sm.ProtocolRequestType(Cm.method);var Am={};Object.defineProperty(Am,"__esModule",{value:!0}),Am.SelectionRangeRequest=void 0;const bm=Mf;var $m,xm;(xm=$m||(Am.SelectionRangeRequest=$m={})).method="textDocument/selectionRange",xm.messageDirection=bm.MessageDirection.clientToServer,xm.type=new bm.ProtocolRequestType(xm.method);var wm={};Object.defineProperty(wm,"__esModule",{value:!0}),wm.WorkDoneProgressCancelNotification=wm.WorkDoneProgressCreateRequest=wm.WorkDoneProgress=void 0;const Nm=ef,Im=Mf;var _m,Pm,Lm,Om,Dm,Mm;(Pm=_m||(wm.WorkDoneProgress=_m={})).type=new Nm.ProgressType,Pm.is=function(e){return e===Pm.type},(Om=Lm||(wm.WorkDoneProgressCreateRequest=Lm={})).method="window/workDoneProgress/create",Om.messageDirection=Im.MessageDirection.serverToClient,Om.type=new Im.ProtocolRequestType(Om.method),(Mm=Dm||(wm.WorkDoneProgressCancelNotification=Dm={})).method="window/workDoneProgress/cancel",Mm.messageDirection=Im.MessageDirection.clientToServer,Mm.type=new Im.ProtocolNotificationType(Mm.method);var Fm={};Object.defineProperty(Fm,"__esModule",{value:!0}),Fm.CallHierarchyOutgoingCallsRequest=Fm.CallHierarchyIncomingCallsRequest=Fm.CallHierarchyPrepareRequest=void 0;const qm=Mf;var jm,Um,Gm,zm,Bm,Km;(Um=jm||(Fm.CallHierarchyPrepareRequest=jm={})).method="textDocument/prepareCallHierarchy",Um.messageDirection=qm.MessageDirection.clientToServer,Um.type=new qm.ProtocolRequestType(Um.method),(zm=Gm||(Fm.CallHierarchyIncomingCallsRequest=Gm={})).method="callHierarchy/incomingCalls",zm.messageDirection=qm.MessageDirection.clientToServer,zm.type=new qm.ProtocolRequestType(zm.method),(Km=Bm||(Fm.CallHierarchyOutgoingCallsRequest=Bm={})).method="callHierarchy/outgoingCalls",Km.messageDirection=qm.MessageDirection.clientToServer,Km.type=new qm.ProtocolRequestType(Km.method);var Wm={};Object.defineProperty(Wm,"__esModule",{value:!0}),Wm.SemanticTokensRefreshRequest=Wm.SemanticTokensRangeRequest=Wm.SemanticTokensDeltaRequest=Wm.SemanticTokensRequest=Wm.SemanticTokensRegistrationType=Wm.TokenFormat=void 0;const Vm=Mf;var Hm,Ym,Xm,Jm,Zm,Qm,eg,tg,rg,ng,ig;(Hm||(Wm.TokenFormat=Hm={})).Relative="relative",(Xm=Ym||(Wm.SemanticTokensRegistrationType=Ym={})).method="textDocument/semanticTokens",Xm.type=new Vm.RegistrationType(Xm.method),(Zm=Jm||(Wm.SemanticTokensRequest=Jm={})).method="textDocument/semanticTokens/full",Zm.messageDirection=Vm.MessageDirection.clientToServer,Zm.type=new Vm.ProtocolRequestType(Zm.method),Zm.registrationMethod=Ym.method,(eg=Qm||(Wm.SemanticTokensDeltaRequest=Qm={})).method="textDocument/semanticTokens/full/delta",eg.messageDirection=Vm.MessageDirection.clientToServer,eg.type=new Vm.ProtocolRequestType(eg.method),eg.registrationMethod=Ym.method,(rg=tg||(Wm.SemanticTokensRangeRequest=tg={})).method="textDocument/semanticTokens/range",rg.messageDirection=Vm.MessageDirection.clientToServer,rg.type=new Vm.ProtocolRequestType(rg.method),rg.registrationMethod=Ym.method,(ig=ng||(Wm.SemanticTokensRefreshRequest=ng={})).method="workspace/semanticTokens/refresh",ig.messageDirection=Vm.MessageDirection.serverToClient,ig.type=new Vm.ProtocolRequestType0(ig.method);var sg={};Object.defineProperty(sg,"__esModule",{value:!0}),sg.ShowDocumentRequest=void 0;const og=Mf;var ag,cg;(cg=ag||(sg.ShowDocumentRequest=ag={})).method="window/showDocument",cg.messageDirection=og.MessageDirection.serverToClient,cg.type=new og.ProtocolRequestType(cg.method);var lg={};Object.defineProperty(lg,"__esModule",{value:!0}),lg.LinkedEditingRangeRequest=void 0;const ug=Mf;var dg,hg;(hg=dg||(lg.LinkedEditingRangeRequest=dg={})).method="textDocument/linkedEditingRange",hg.messageDirection=ug.MessageDirection.clientToServer,hg.type=new ug.ProtocolRequestType(hg.method);var pg={};Object.defineProperty(pg,"__esModule",{value:!0}),pg.WillDeleteFilesRequest=pg.DidDeleteFilesNotification=pg.DidRenameFilesNotification=pg.WillRenameFilesRequest=pg.DidCreateFilesNotification=pg.WillCreateFilesRequest=pg.FileOperationPatternKind=void 0;const fg=Mf;var mg,gg,yg,Tg,vg,Rg,Eg,Sg,kg,Cg,Ag,bg,$g,xg;(gg=mg||(pg.FileOperationPatternKind=mg={})).file="file",gg.folder="folder",(Tg=yg||(pg.WillCreateFilesRequest=yg={})).method="workspace/willCreateFiles",Tg.messageDirection=fg.MessageDirection.clientToServer,Tg.type=new fg.ProtocolRequestType(Tg.method),(Rg=vg||(pg.DidCreateFilesNotification=vg={})).method="workspace/didCreateFiles",Rg.messageDirection=fg.MessageDirection.clientToServer,Rg.type=new fg.ProtocolNotificationType(Rg.method),(Sg=Eg||(pg.WillRenameFilesRequest=Eg={})).method="workspace/willRenameFiles",Sg.messageDirection=fg.MessageDirection.clientToServer,Sg.type=new fg.ProtocolRequestType(Sg.method),(Cg=kg||(pg.DidRenameFilesNotification=kg={})).method="workspace/didRenameFiles",Cg.messageDirection=fg.MessageDirection.clientToServer,Cg.type=new fg.ProtocolNotificationType(Cg.method),(bg=Ag||(pg.DidDeleteFilesNotification=Ag={})).method="workspace/didDeleteFiles",bg.messageDirection=fg.MessageDirection.clientToServer,bg.type=new fg.ProtocolNotificationType(bg.method),(xg=$g||(pg.WillDeleteFilesRequest=$g={})).method="workspace/willDeleteFiles",xg.messageDirection=fg.MessageDirection.clientToServer,xg.type=new fg.ProtocolRequestType(xg.method);var wg={};Object.defineProperty(wg,"__esModule",{value:!0}),wg.MonikerRequest=wg.MonikerKind=wg.UniquenessLevel=void 0;const Ng=Mf;var Ig,_g,Pg,Lg,Og,Dg;(_g=Ig||(wg.UniquenessLevel=Ig={})).document="document",_g.project="project",_g.group="group",_g.scheme="scheme",_g.global="global",(Lg=Pg||(wg.MonikerKind=Pg={})).$import="import",Lg.$export="export",Lg.local="local",(Dg=Og||(wg.MonikerRequest=Og={})).method="textDocument/moniker",Dg.messageDirection=Ng.MessageDirection.clientToServer,Dg.type=new Ng.ProtocolRequestType(Dg.method);var Mg={};Object.defineProperty(Mg,"__esModule",{value:!0}),Mg.TypeHierarchySubtypesRequest=Mg.TypeHierarchySupertypesRequest=Mg.TypeHierarchyPrepareRequest=void 0;const Fg=Mf;var qg,jg,Ug,Gg,zg,Bg;(jg=qg||(Mg.TypeHierarchyPrepareRequest=qg={})).method="textDocument/prepareTypeHierarchy",jg.messageDirection=Fg.MessageDirection.clientToServer,jg.type=new Fg.ProtocolRequestType(jg.method),(Gg=Ug||(Mg.TypeHierarchySupertypesRequest=Ug={})).method="typeHierarchy/supertypes",Gg.messageDirection=Fg.MessageDirection.clientToServer,Gg.type=new Fg.ProtocolRequestType(Gg.method),(Bg=zg||(Mg.TypeHierarchySubtypesRequest=zg={})).method="typeHierarchy/subtypes",Bg.messageDirection=Fg.MessageDirection.clientToServer,Bg.type=new Fg.ProtocolRequestType(Bg.method);var Kg={};Object.defineProperty(Kg,"__esModule",{value:!0}),Kg.InlineValueRefreshRequest=Kg.InlineValueRequest=void 0;const Wg=Mf;var Vg,Hg,Yg,Xg;(Hg=Vg||(Kg.InlineValueRequest=Vg={})).method="textDocument/inlineValue",Hg.messageDirection=Wg.MessageDirection.clientToServer,Hg.type=new Wg.ProtocolRequestType(Hg.method),(Xg=Yg||(Kg.InlineValueRefreshRequest=Yg={})).method="workspace/inlineValue/refresh",Xg.messageDirection=Wg.MessageDirection.serverToClient,Xg.type=new Wg.ProtocolRequestType0(Xg.method);var Jg={};Object.defineProperty(Jg,"__esModule",{value:!0}),Jg.InlayHintRefreshRequest=Jg.InlayHintResolveRequest=Jg.InlayHintRequest=void 0;const Zg=Mf;var Qg,ey,ty,ry,ny,iy;(ey=Qg||(Jg.InlayHintRequest=Qg={})).method="textDocument/inlayHint",ey.messageDirection=Zg.MessageDirection.clientToServer,ey.type=new Zg.ProtocolRequestType(ey.method),(ry=ty||(Jg.InlayHintResolveRequest=ty={})).method="inlayHint/resolve",ry.messageDirection=Zg.MessageDirection.clientToServer,ry.type=new Zg.ProtocolRequestType(ry.method),(iy=ny||(Jg.InlayHintRefreshRequest=ny={})).method="workspace/inlayHint/refresh",iy.messageDirection=Zg.MessageDirection.serverToClient,iy.type=new Zg.ProtocolRequestType0(iy.method);var sy={};Object.defineProperty(sy,"__esModule",{value:!0}),sy.DiagnosticRefreshRequest=sy.WorkspaceDiagnosticRequest=sy.DocumentDiagnosticRequest=sy.DocumentDiagnosticReportKind=sy.DiagnosticServerCancellationData=void 0;const oy=ef,ay=Gf,cy=Mf;var ly,uy,dy,hy,py,fy,my,gy,yy;(ly||(sy.DiagnosticServerCancellationData=ly={})).is=function(e){const t=e;return t&&ay.boolean(t.retriggerRequest)},(dy=uy||(sy.DocumentDiagnosticReportKind=uy={})).Full="full",dy.Unchanged="unchanged",(py=hy||(sy.DocumentDiagnosticRequest=hy={})).method="textDocument/diagnostic",py.messageDirection=cy.MessageDirection.clientToServer,py.type=new cy.ProtocolRequestType(py.method),py.partialResult=new oy.ProgressType,(my=fy||(sy.WorkspaceDiagnosticRequest=fy={})).method="workspace/diagnostic",my.messageDirection=cy.MessageDirection.clientToServer,my.type=new cy.ProtocolRequestType(my.method),my.partialResult=new oy.ProgressType,(yy=gy||(sy.DiagnosticRefreshRequest=gy={})).method="workspace/diagnostic/refresh",yy.messageDirection=cy.MessageDirection.serverToClient,yy.type=new cy.ProtocolRequestType0(yy.method);var Ty={};Object.defineProperty(Ty,"__esModule",{value:!0}),Ty.DidCloseNotebookDocumentNotification=Ty.DidSaveNotebookDocumentNotification=Ty.DidChangeNotebookDocumentNotification=Ty.NotebookCellArrayChange=Ty.DidOpenNotebookDocumentNotification=Ty.NotebookDocumentSyncRegistrationType=Ty.NotebookDocument=Ty.NotebookCell=Ty.ExecutionSummary=Ty.NotebookCellKind=void 0;const vy=Df,Ry=Gf,Ey=Mf;var Sy,ky,Cy,Ay,by,$y,xy,wy,Ny,Iy,_y,Py,Ly,Oy,Dy,My,Fy,qy,jy;(ky=Sy||(Ty.NotebookCellKind=Sy={})).Markup=1,ky.Code=2,ky.is=function(e){return 1===e||2===e},(Ay=Cy||(Ty.ExecutionSummary=Cy={})).create=function(e,t){const r={executionOrder:e};return!0!==t&&!1!==t||(r.success=t),r},Ay.is=function(e){const t=e;return Ry.objectLiteral(t)&&vy.uinteger.is(t.executionOrder)&&(void 0===t.success||Ry.boolean(t.success))},Ay.equals=function(e,t){return e===t||null!=e&&null!=t&&e.executionOrder===t.executionOrder&&e.success===t.success},function(e){function t(e,r){if(e===r)return!0;if(null==e||null==r)return!1;if(typeof e!=typeof r)return!1;if("object"!=typeof e)return!1;const n=Array.isArray(e),i=Array.isArray(r);if(n!==i)return!1;if(n&&i){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!t(e[n],r[n]))return!1}if(Ry.objectLiteral(e)&&Ry.objectLiteral(r)){const n=Object.keys(e),i=Object.keys(r);if(n.length!==i.length)return!1;if(n.sort(),i.sort(),!t(n,i))return!1;for(let s=0;s<n.length;s++){const i=n[s];if(!t(e[i],r[i]))return!1}}return!0}e.create=function(e,t){return{kind:e,document:t}},e.is=function(e){const t=e;return Ry.objectLiteral(t)&&Sy.is(t.kind)&&vy.DocumentUri.is(t.document)&&(void 0===t.metadata||Ry.objectLiteral(t.metadata))},e.diff=function(e,r){const n=new Set;return e.document!==r.document&&n.add("document"),e.kind!==r.kind&&n.add("kind"),e.executionSummary!==r.executionSummary&&n.add("executionSummary"),void 0===e.metadata&&void 0===r.metadata||t(e.metadata,r.metadata)||n.add("metadata"),void 0===e.executionSummary&&void 0===r.executionSummary||Cy.equals(e.executionSummary,r.executionSummary)||n.add("executionSummary"),n}}(by||(Ty.NotebookCell=by={})),(xy=$y||(Ty.NotebookDocument=$y={})).create=function(e,t,r,n){return{uri:e,notebookType:t,version:r,cells:n}},xy.is=function(e){const t=e;return Ry.objectLiteral(t)&&Ry.string(t.uri)&&vy.integer.is(t.version)&&Ry.typedArray(t.cells,by.is)},(Ny=wy||(Ty.NotebookDocumentSyncRegistrationType=wy={})).method="notebookDocument/sync",Ny.messageDirection=Ey.MessageDirection.clientToServer,Ny.type=new Ey.RegistrationType(Ny.method),(_y=Iy||(Ty.DidOpenNotebookDocumentNotification=Iy={})).method="notebookDocument/didOpen",_y.messageDirection=Ey.MessageDirection.clientToServer,_y.type=new Ey.ProtocolNotificationType(_y.method),_y.registrationMethod=wy.method,(Ly=Py||(Ty.NotebookCellArrayChange=Py={})).is=function(e){const t=e;return Ry.objectLiteral(t)&&vy.uinteger.is(t.start)&&vy.uinteger.is(t.deleteCount)&&(void 0===t.cells||Ry.typedArray(t.cells,by.is))},Ly.create=function(e,t,r){const n={start:e,deleteCount:t};return void 0!==r&&(n.cells=r),n},(Dy=Oy||(Ty.DidChangeNotebookDocumentNotification=Oy={})).method="notebookDocument/didChange",Dy.messageDirection=Ey.MessageDirection.clientToServer,Dy.type=new Ey.ProtocolNotificationType(Dy.method),Dy.registrationMethod=wy.method,(Fy=My||(Ty.DidSaveNotebookDocumentNotification=My={})).method="notebookDocument/didSave",Fy.messageDirection=Ey.MessageDirection.clientToServer,Fy.type=new Ey.ProtocolNotificationType(Fy.method),Fy.registrationMethod=wy.method,(jy=qy||(Ty.DidCloseNotebookDocumentNotification=qy={})).method="notebookDocument/didClose",jy.messageDirection=Ey.MessageDirection.clientToServer,jy.type=new Ey.ProtocolNotificationType(jy.method),jy.registrationMethod=wy.method;var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0}),Uy.InlineCompletionRequest=void 0;const Gy=Mf;var zy,By;(By=zy||(Uy.InlineCompletionRequest=zy={})).method="textDocument/inlineCompletion",By.messageDirection=Gy.MessageDirection.clientToServer,By.type=new Gy.ProtocolRequestType(By.method),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceSymbolRequest=e.CodeActionResolveRequest=e.CodeActionRequest=e.DocumentSymbolRequest=e.DocumentHighlightRequest=e.ReferencesRequest=e.DefinitionRequest=e.SignatureHelpRequest=e.SignatureHelpTriggerKind=e.HoverRequest=e.CompletionResolveRequest=e.CompletionRequest=e.CompletionTriggerKind=e.PublishDiagnosticsNotification=e.WatchKind=e.RelativePattern=e.FileChangeType=e.DidChangeWatchedFilesNotification=e.WillSaveTextDocumentWaitUntilRequest=e.WillSaveTextDocumentNotification=e.TextDocumentSaveReason=e.DidSaveTextDocumentNotification=e.DidCloseTextDocumentNotification=e.DidChangeTextDocumentNotification=e.TextDocumentContentChangeEvent=e.DidOpenTextDocumentNotification=e.TextDocumentSyncKind=e.TelemetryEventNotification=e.LogMessageNotification=e.ShowMessageRequest=e.ShowMessageNotification=e.MessageType=e.DidChangeConfigurationNotification=e.ExitNotification=e.ShutdownRequest=e.InitializedNotification=e.InitializeErrorCodes=e.InitializeRequest=e.WorkDoneProgressOptions=e.TextDocumentRegistrationOptions=e.StaticRegistrationOptions=e.PositionEncodingKind=e.FailureHandlingKind=e.ResourceOperationKind=e.UnregistrationRequest=e.RegistrationRequest=e.DocumentSelector=e.NotebookCellTextDocumentFilter=e.NotebookDocumentFilter=e.TextDocumentFilter=void 0,e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.WillRenameFilesRequest=e.DidRenameFilesNotification=e.WillCreateFilesRequest=e.DidCreateFilesNotification=e.FileOperationPatternKind=e.LinkedEditingRangeRequest=e.ShowDocumentRequest=e.SemanticTokensRegistrationType=e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.TokenFormat=e.CallHierarchyPrepareRequest=e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=e.SelectionRangeRequest=e.DeclarationRequest=e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=e.ColorPresentationRequest=e.DocumentColorRequest=e.ConfigurationRequest=e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=e.TypeDefinitionRequest=e.ImplementationRequest=e.ApplyWorkspaceEditRequest=e.ExecuteCommandRequest=e.PrepareRenameRequest=e.RenameRequest=e.PrepareSupportDefaultBehavior=e.DocumentOnTypeFormattingRequest=e.DocumentRangesFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.InlineCompletionRequest=e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=e.InlineValueRefreshRequest=e.InlineValueRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=void 0;const t=Mf,r=Df,n=Gf,i=Kf;Object.defineProperty(e,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=Yf;Object.defineProperty(e,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=Qf;Object.defineProperty(e,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),Object.defineProperty(e,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=sm;Object.defineProperty(e,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=lm;Object.defineProperty(e,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(e,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const l=mm;Object.defineProperty(e,"FoldingRangeRequest",{enumerable:!0,get:function(){return l.FoldingRangeRequest}}),Object.defineProperty(e,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return l.FoldingRangeRefreshRequest}});const u=Em;Object.defineProperty(e,"DeclarationRequest",{enumerable:!0,get:function(){return u.DeclarationRequest}});const d=Am;Object.defineProperty(e,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const h=wm;Object.defineProperty(e,"WorkDoneProgress",{enumerable:!0,get:function(){return h.WorkDoneProgress}}),Object.defineProperty(e,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return h.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return h.WorkDoneProgressCancelNotification}});const p=Fm;Object.defineProperty(e,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return p.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return p.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return p.CallHierarchyPrepareRequest}});const f=Wm;Object.defineProperty(e,"TokenFormat",{enumerable:!0,get:function(){return f.TokenFormat}}),Object.defineProperty(e,"SemanticTokensRequest",{enumerable:!0,get:function(){return f.SemanticTokensRequest}}),Object.defineProperty(e,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return f.SemanticTokensDeltaRequest}}),Object.defineProperty(e,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return f.SemanticTokensRangeRequest}}),Object.defineProperty(e,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return f.SemanticTokensRefreshRequest}}),Object.defineProperty(e,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return f.SemanticTokensRegistrationType}});const m=sg;Object.defineProperty(e,"ShowDocumentRequest",{enumerable:!0,get:function(){return m.ShowDocumentRequest}});const g=lg;Object.defineProperty(e,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return g.LinkedEditingRangeRequest}});const y=pg;Object.defineProperty(e,"FileOperationPatternKind",{enumerable:!0,get:function(){return y.FileOperationPatternKind}}),Object.defineProperty(e,"DidCreateFilesNotification",{enumerable:!0,get:function(){return y.DidCreateFilesNotification}}),Object.defineProperty(e,"WillCreateFilesRequest",{enumerable:!0,get:function(){return y.WillCreateFilesRequest}}),Object.defineProperty(e,"DidRenameFilesNotification",{enumerable:!0,get:function(){return y.DidRenameFilesNotification}}),Object.defineProperty(e,"WillRenameFilesRequest",{enumerable:!0,get:function(){return y.WillRenameFilesRequest}}),Object.defineProperty(e,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return y.DidDeleteFilesNotification}}),Object.defineProperty(e,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return y.WillDeleteFilesRequest}});const T=wg;Object.defineProperty(e,"UniquenessLevel",{enumerable:!0,get:function(){return T.UniquenessLevel}}),Object.defineProperty(e,"MonikerKind",{enumerable:!0,get:function(){return T.MonikerKind}}),Object.defineProperty(e,"MonikerRequest",{enumerable:!0,get:function(){return T.MonikerRequest}});const v=Mg;Object.defineProperty(e,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return v.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return v.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return v.TypeHierarchySupertypesRequest}});const R=Kg;Object.defineProperty(e,"InlineValueRequest",{enumerable:!0,get:function(){return R.InlineValueRequest}}),Object.defineProperty(e,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return R.InlineValueRefreshRequest}});const E=Jg;Object.defineProperty(e,"InlayHintRequest",{enumerable:!0,get:function(){return E.InlayHintRequest}}),Object.defineProperty(e,"InlayHintResolveRequest",{enumerable:!0,get:function(){return E.InlayHintResolveRequest}}),Object.defineProperty(e,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return E.InlayHintRefreshRequest}});const S=sy;Object.defineProperty(e,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return S.DiagnosticServerCancellationData}}),Object.defineProperty(e,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return S.DocumentDiagnosticReportKind}}),Object.defineProperty(e,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return S.DocumentDiagnosticRequest}}),Object.defineProperty(e,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return S.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return S.DiagnosticRefreshRequest}});const k=Ty;Object.defineProperty(e,"NotebookCellKind",{enumerable:!0,get:function(){return k.NotebookCellKind}}),Object.defineProperty(e,"ExecutionSummary",{enumerable:!0,get:function(){return k.ExecutionSummary}}),Object.defineProperty(e,"NotebookCell",{enumerable:!0,get:function(){return k.NotebookCell}}),Object.defineProperty(e,"NotebookDocument",{enumerable:!0,get:function(){return k.NotebookDocument}}),Object.defineProperty(e,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return k.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,"NotebookCellArrayChange",{enumerable:!0,get:function(){return k.NotebookCellArrayChange}}),Object.defineProperty(e,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidCloseNotebookDocumentNotification}});const C=Uy;var A,b,$,x,w,N,I,_,P,L,O,D,M,F,q,j,U,G,z,B,K,W,V,H,Y,X,J,Z,Q,ee,te,re,ne,ie,se,oe,ae,ce,le,ue,de,he,pe,fe,me,ge,ye,Te,ve,Re,Ee,Se,ke,Ce,Ae,be,$e,xe,we,Ne,Ie,_e,Pe,Le,Oe,De,Me,Fe,qe,je,Ue,Ge,ze,Be,Ke,We,Ve,He,Ye,Xe,Je,Ze,Qe,et,tt,rt,nt,it,st,ot,at,ct,lt,ut,dt,ht,pt,ft,mt,gt,yt,Tt,vt,Rt,Et,St,kt,Ct,At,bt,$t,xt,wt,Nt,It,_t,Pt,Lt,Ot,Dt,Mt;Object.defineProperty(e,"InlineCompletionRequest",{enumerable:!0,get:function(){return C.InlineCompletionRequest}}),(A||(e.TextDocumentFilter=A={})).is=function(e){const t=e;return n.string(t)||n.string(t.language)||n.string(t.scheme)||n.string(t.pattern)},(b||(e.NotebookDocumentFilter=b={})).is=function(e){const t=e;return n.objectLiteral(t)&&(n.string(t.notebookType)||n.string(t.scheme)||n.string(t.pattern))},($||(e.NotebookCellTextDocumentFilter=$={})).is=function(e){const t=e;return n.objectLiteral(t)&&(n.string(t.notebook)||b.is(t.notebook))&&(void 0===t.language||n.string(t.language))},(x||(e.DocumentSelector=x={})).is=function(e){if(!Array.isArray(e))return!1;for(let t of e)if(!n.string(t)&&!A.is(t)&&!$.is(t))return!1;return!0},(N=w||(e.RegistrationRequest=w={})).method="client/registerCapability",N.messageDirection=t.MessageDirection.serverToClient,N.type=new t.ProtocolRequestType(N.method),(_=I||(e.UnregistrationRequest=I={})).method="client/unregisterCapability",_.messageDirection=t.MessageDirection.serverToClient,_.type=new t.ProtocolRequestType(_.method),(L=P||(e.ResourceOperationKind=P={})).Create="create",L.Rename="rename",L.Delete="delete",(D=O||(e.FailureHandlingKind=O={})).Abort="abort",D.Transactional="transactional",D.TextOnlyTransactional="textOnlyTransactional",D.Undo="undo",(F=M||(e.PositionEncodingKind=M={})).UTF8="utf-8",F.UTF16="utf-16",F.UTF32="utf-32",(q||(e.StaticRegistrationOptions=q={})).hasId=function(e){const t=e;return t&&n.string(t.id)&&t.id.length>0},(j||(e.TextDocumentRegistrationOptions=j={})).is=function(e){const t=e;return t&&(null===t.documentSelector||x.is(t.documentSelector))},(G=U||(e.WorkDoneProgressOptions=U={})).is=function(e){const t=e;return n.objectLiteral(t)&&(void 0===t.workDoneProgress||n.boolean(t.workDoneProgress))},G.hasWorkDoneProgress=function(e){const t=e;return t&&n.boolean(t.workDoneProgress)},(B=z||(e.InitializeRequest=z={})).method="initialize",B.messageDirection=t.MessageDirection.clientToServer,B.type=new t.ProtocolRequestType(B.method),(K||(e.InitializeErrorCodes=K={})).unknownProtocolVersion=1,(V=W||(e.InitializedNotification=W={})).method="initialized",V.messageDirection=t.MessageDirection.clientToServer,V.type=new t.ProtocolNotificationType(V.method),(Y=H||(e.ShutdownRequest=H={})).method="shutdown",Y.messageDirection=t.MessageDirection.clientToServer,Y.type=new t.ProtocolRequestType0(Y.method),(J=X||(e.ExitNotification=X={})).method="exit",J.messageDirection=t.MessageDirection.clientToServer,J.type=new t.ProtocolNotificationType0(J.method),(Q=Z||(e.DidChangeConfigurationNotification=Z={})).method="workspace/didChangeConfiguration",Q.messageDirection=t.MessageDirection.clientToServer,Q.type=new t.ProtocolNotificationType(Q.method),(te=ee||(e.MessageType=ee={})).Error=1,te.Warning=2,te.Info=3,te.Log=4,te.Debug=5,(ne=re||(e.ShowMessageNotification=re={})).method="window/showMessage",ne.messageDirection=t.MessageDirection.serverToClient,ne.type=new t.ProtocolNotificationType(ne.method),(se=ie||(e.ShowMessageRequest=ie={})).method="window/showMessageRequest",se.messageDirection=t.MessageDirection.serverToClient,se.type=new t.ProtocolRequestType(se.method),(ae=oe||(e.LogMessageNotification=oe={})).method="window/logMessage",ae.messageDirection=t.MessageDirection.serverToClient,ae.type=new t.ProtocolNotificationType(ae.method),(le=ce||(e.TelemetryEventNotification=ce={})).method="telemetry/event",le.messageDirection=t.MessageDirection.serverToClient,le.type=new t.ProtocolNotificationType(le.method),(de=ue||(e.TextDocumentSyncKind=ue={})).None=0,de.Full=1,de.Incremental=2,(pe=he||(e.DidOpenTextDocumentNotification=he={})).method="textDocument/didOpen",pe.messageDirection=t.MessageDirection.clientToServer,pe.type=new t.ProtocolNotificationType(pe.method),(me=fe||(e.TextDocumentContentChangeEvent=fe={})).isIncremental=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0!==t.range&&(void 0===t.rangeLength||"number"==typeof t.rangeLength)},me.isFull=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0===t.range&&void 0===t.rangeLength},(ye=ge||(e.DidChangeTextDocumentNotification=ge={})).method="textDocument/didChange",ye.messageDirection=t.MessageDirection.clientToServer,ye.type=new t.ProtocolNotificationType(ye.method),(ve=Te||(e.DidCloseTextDocumentNotification=Te={})).method="textDocument/didClose",ve.messageDirection=t.MessageDirection.clientToServer,ve.type=new t.ProtocolNotificationType(ve.method),(Ee=Re||(e.DidSaveTextDocumentNotification=Re={})).method="textDocument/didSave",Ee.messageDirection=t.MessageDirection.clientToServer,Ee.type=new t.ProtocolNotificationType(Ee.method),(ke=Se||(e.TextDocumentSaveReason=Se={})).Manual=1,ke.AfterDelay=2,ke.FocusOut=3,(Ae=Ce||(e.WillSaveTextDocumentNotification=Ce={})).method="textDocument/willSave",Ae.messageDirection=t.MessageDirection.clientToServer,Ae.type=new t.ProtocolNotificationType(Ae.method),($e=be||(e.WillSaveTextDocumentWaitUntilRequest=be={})).method="textDocument/willSaveWaitUntil",$e.messageDirection=t.MessageDirection.clientToServer,$e.type=new t.ProtocolRequestType($e.method),(we=xe||(e.DidChangeWatchedFilesNotification=xe={})).method="workspace/didChangeWatchedFiles",we.messageDirection=t.MessageDirection.clientToServer,we.type=new t.ProtocolNotificationType(we.method),(Ie=Ne||(e.FileChangeType=Ne={})).Created=1,Ie.Changed=2,Ie.Deleted=3,(_e||(e.RelativePattern=_e={})).is=function(e){const t=e;return n.objectLiteral(t)&&(r.URI.is(t.baseUri)||r.WorkspaceFolder.is(t.baseUri))&&n.string(t.pattern)},(Le=Pe||(e.WatchKind=Pe={})).Create=1,Le.Change=2,Le.Delete=4,(De=Oe||(e.PublishDiagnosticsNotification=Oe={})).method="textDocument/publishDiagnostics",De.messageDirection=t.MessageDirection.serverToClient,De.type=new t.ProtocolNotificationType(De.method),(Fe=Me||(e.CompletionTriggerKind=Me={})).Invoked=1,Fe.TriggerCharacter=2,Fe.TriggerForIncompleteCompletions=3,(je=qe||(e.CompletionRequest=qe={})).method="textDocument/completion",je.messageDirection=t.MessageDirection.clientToServer,je.type=new t.ProtocolRequestType(je.method),(Ge=Ue||(e.CompletionResolveRequest=Ue={})).method="completionItem/resolve",Ge.messageDirection=t.MessageDirection.clientToServer,Ge.type=new t.ProtocolRequestType(Ge.method),(Be=ze||(e.HoverRequest=ze={})).method="textDocument/hover",Be.messageDirection=t.MessageDirection.clientToServer,Be.type=new t.ProtocolRequestType(Be.method),(We=Ke||(e.SignatureHelpTriggerKind=Ke={})).Invoked=1,We.TriggerCharacter=2,We.ContentChange=3,(He=Ve||(e.SignatureHelpRequest=Ve={})).method="textDocument/signatureHelp",He.messageDirection=t.MessageDirection.clientToServer,He.type=new t.ProtocolRequestType(He.method),(Xe=Ye||(e.DefinitionRequest=Ye={})).method="textDocument/definition",Xe.messageDirection=t.MessageDirection.clientToServer,Xe.type=new t.ProtocolRequestType(Xe.method),(Ze=Je||(e.ReferencesRequest=Je={})).method="textDocument/references",Ze.messageDirection=t.MessageDirection.clientToServer,Ze.type=new t.ProtocolRequestType(Ze.method),(et=Qe||(e.DocumentHighlightRequest=Qe={})).method="textDocument/documentHighlight",et.messageDirection=t.MessageDirection.clientToServer,et.type=new t.ProtocolRequestType(et.method),(rt=tt||(e.DocumentSymbolRequest=tt={})).method="textDocument/documentSymbol",rt.messageDirection=t.MessageDirection.clientToServer,rt.type=new t.ProtocolRequestType(rt.method),(it=nt||(e.CodeActionRequest=nt={})).method="textDocument/codeAction",it.messageDirection=t.MessageDirection.clientToServer,it.type=new t.ProtocolRequestType(it.method),(ot=st||(e.CodeActionResolveRequest=st={})).method="codeAction/resolve",ot.messageDirection=t.MessageDirection.clientToServer,ot.type=new t.ProtocolRequestType(ot.method),(ct=at||(e.WorkspaceSymbolRequest=at={})).method="workspace/symbol",ct.messageDirection=t.MessageDirection.clientToServer,ct.type=new t.ProtocolRequestType(ct.method),(ut=lt||(e.WorkspaceSymbolResolveRequest=lt={})).method="workspaceSymbol/resolve",ut.messageDirection=t.MessageDirection.clientToServer,ut.type=new t.ProtocolRequestType(ut.method),(ht=dt||(e.CodeLensRequest=dt={})).method="textDocument/codeLens",ht.messageDirection=t.MessageDirection.clientToServer,ht.type=new t.ProtocolRequestType(ht.method),(ft=pt||(e.CodeLensResolveRequest=pt={})).method="codeLens/resolve",ft.messageDirection=t.MessageDirection.clientToServer,ft.type=new t.ProtocolRequestType(ft.method),(gt=mt||(e.CodeLensRefreshRequest=mt={})).method="workspace/codeLens/refresh",gt.messageDirection=t.MessageDirection.serverToClient,gt.type=new t.ProtocolRequestType0(gt.method),(Tt=yt||(e.DocumentLinkRequest=yt={})).method="textDocument/documentLink",Tt.messageDirection=t.MessageDirection.clientToServer,Tt.type=new t.ProtocolRequestType(Tt.method),(Rt=vt||(e.DocumentLinkResolveRequest=vt={})).method="documentLink/resolve",Rt.messageDirection=t.MessageDirection.clientToServer,Rt.type=new t.ProtocolRequestType(Rt.method),(St=Et||(e.DocumentFormattingRequest=Et={})).method="textDocument/formatting",St.messageDirection=t.MessageDirection.clientToServer,St.type=new t.ProtocolRequestType(St.method),(Ct=kt||(e.DocumentRangeFormattingRequest=kt={})).method="textDocument/rangeFormatting",Ct.messageDirection=t.MessageDirection.clientToServer,Ct.type=new t.ProtocolRequestType(Ct.method),(bt=At||(e.DocumentRangesFormattingRequest=At={})).method="textDocument/rangesFormatting",bt.messageDirection=t.MessageDirection.clientToServer,bt.type=new t.ProtocolRequestType(bt.method),(xt=$t||(e.DocumentOnTypeFormattingRequest=$t={})).method="textDocument/onTypeFormatting",xt.messageDirection=t.MessageDirection.clientToServer,xt.type=new t.ProtocolRequestType(xt.method),(wt||(e.PrepareSupportDefaultBehavior=wt={})).Identifier=1,(It=Nt||(e.RenameRequest=Nt={})).method="textDocument/rename",It.messageDirection=t.MessageDirection.clientToServer,It.type=new t.ProtocolRequestType(It.method),(Pt=_t||(e.PrepareRenameRequest=_t={})).method="textDocument/prepareRename",Pt.messageDirection=t.MessageDirection.clientToServer,Pt.type=new t.ProtocolRequestType(Pt.method),(Ot=Lt||(e.ExecuteCommandRequest=Lt={})).method="workspace/executeCommand",Ot.messageDirection=t.MessageDirection.clientToServer,Ot.type=new t.ProtocolRequestType(Ot.method),(Mt=Dt||(e.ApplyWorkspaceEditRequest=Dt={})).method="workspace/applyEdit",Mt.messageDirection=t.MessageDirection.serverToClient,Mt.type=new t.ProtocolRequestType("workspace/applyEdit")}(Uf);var Ky={};Object.defineProperty(Ky,"__esModule",{value:!0}),Ky.createProtocolConnection=void 0;const Wy=ef;var Vy;Ky.createProtocolConnection=function(e,t,r,n){return Wy.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Wy.createMessageConnection)(e,t,r,n)},function(e){var t=v.commonjsGlobal&&v.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=v.commonjsGlobal&&v.commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,r(ef,e),r(Df,e),r(Mf,e),r(Uf,e);var n,i,s=Ky;Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:function(){return s.createProtocolConnection}}),(i=n||(e.LSPErrorCodes=n={})).lspReservedErrorRangeStart=-32899,i.RequestFailed=-32803,i.ServerCancelled=-32802,i.ContentModified=-32801,i.RequestCancelled=-32800,i.lspReservedErrorRangeEnd=-32800}(Of),function(e){var t=v.commonjsGlobal&&v.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=v.commonjsGlobal&&v.commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;const n=Lf;r(Lf,e),r(Of,e),e.createProtocolConnection=function(e,t,r,i){return(0,n.createMessageConnection)(e,t,r,i)}}(Qp),(Vy||(Vy={})).create=function(e){return{dispose:async()=>await e()}};class Hy{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Cp,this.documentPhaseListeners=new Cp,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=mp.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.fileSystemProvider=e.workspace.FileSystemProvider,this.workspaceManager=()=>e.workspace.WorkspaceManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},r=Uh.None){var n;for(const i of e){const e=i.uri.toString();if(i.state===mp.Validated){if("boolean"==typeof t.validation&&t.validation)this.resetToState(i,mp.IndexedReferences);else if("object"==typeof t.validation){const r=this.findMissingValidationCategories(i,t);r.length>0&&(this.buildState.set(e,{completed:!1,options:{validation:{categories:r}},result:null==(n=this.buildState.get(e))?void 0:n.result}),i.state=mp.IndexedReferences)}}else this.buildState.delete(e)}this.currentState=mp.Changed,await this.emitUpdate(e.map(e=>e.uri),[]),await this.buildDocuments(e,t,r)}async update(e,t,r=Uh.None){this.currentState=mp.Changed;const n=[];for(const a of t){const e=this.langiumDocuments.deleteDocuments(a);for(const t of e)n.push(t.uri),this.cleanUpDeleted(t)}const i=(await Promise.all(e.map(e=>this.findChangedUris(e)))).flat();for(const a of i){let e=this.langiumDocuments.getDocument(a);void 0===e&&(e=this.langiumDocumentFactory.fromModel({$type:"INVALID"},a),e.state=mp.Changed,this.langiumDocuments.addDocument(e)),this.resetToState(e,mp.Changed)}const s=L(i).concat(n).map(e=>e.toString()).toSet();this.langiumDocuments.all.filter(e=>!s.has(e.uri.toString())&&this.shouldRelink(e,s)).forEach(e=>this.resetToState(e,mp.ComputedScopes)),await this.emitUpdate(i,n),await tp(r);const o=this.sortDocuments(this.langiumDocuments.all.filter(e=>{var t;return e.state<mp.Validated||!(null==(t=this.buildState.get(e.uri.toString()))?void 0:t.completed)||this.resultsAreIncomplete(e,this.updateBuildOptions)}).toArray());await this.buildDocuments(o,this.updateBuildOptions,r)}resultsAreIncomplete(e,t){return this.findMissingValidationCategories(e,t).length>=1}findMissingValidationCategories(e,t){var r,n;const i=this.buildState.get(e.uri.toString()),s=this.serviceRegistry.getServices(e.uri).validation.ValidationRegistry.getAllValidationCategories(e),o=(null==(r=null==i?void 0:i.result)?void 0:r.validationChecks)?new Set(null==(n=null==i?void 0:i.result)?void 0:n.validationChecks):(null==i?void 0:i.completed)?s:new Set;return L(void 0===t||!0===t.validation?s:"object"==typeof t.validation?t.validation.categories??s:[]).filter(e=>!o.has(e)).toArray()}async findChangedUris(e){var t;if(this.langiumDocuments.getDocument(e)??(null==(t=this.textDocuments)?void 0:t.get(e)))return[e];try{const t=await this.fileSystemProvider.stat(e);if(t.isDirectory){return await this.workspaceManager().searchFolder(e)}if(this.workspaceManager().shouldIncludeEntry(t))return[e]}catch{}return[]}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(r=>r(e,t)))}sortDocuments(e){let t=0,r=e.length-1;for(;t<r;){for(;t<e.length&&this.hasTextDocument(e[t]);)t++;for(;r>=0&&!this.hasTextDocument(e[r]);)r--;t<r&&([e[t],e[r]]=[e[r],e[t]])}return e}hasTextDocument(e){var t;return Boolean(null==(t=this.textDocuments)?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),Vy.create(()=>{const t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}resetToState(e,t){switch(t){case mp.Changed:case mp.Parsed:this.indexManager.removeContent(e.uri);case mp.IndexedContent:e.localSymbols=void 0;case mp.ComputedScopes:this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e);case mp.Linked:this.indexManager.removeReferences(e.uri);case mp.IndexedReferences:e.diagnostics=void 0,this.buildState.delete(e.uri.toString());case mp.Validated:}e.state>t&&(e.state=t)}cleanUpDeleted(e){this.buildState.delete(e.uri.toString()),this.indexManager.remove(e.uri),e.state=mp.Changed}async buildDocuments(e,t,r){this.prepareBuild(e,t),await this.runCancelable(e,mp.Parsed,r,e=>this.langiumDocumentFactory.update(e,r)),await this.runCancelable(e,mp.IndexedContent,r,e=>this.indexManager.updateContent(e,r)),await this.runCancelable(e,mp.ComputedScopes,r,async e=>{const t=this.serviceRegistry.getServices(e.uri).references.ScopeComputation;e.localSymbols=await t.collectLocalSymbols(e,r)});const n=e.filter(e=>this.shouldLink(e));await this.runCancelable(n,mp.Linked,r,e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,r)),await this.runCancelable(n,mp.IndexedReferences,r,e=>this.indexManager.updateReferences(e,r));const i=e.filter(e=>!!this.shouldValidate(e)||(this.markAsCompleted(e),!1));await this.runCancelable(i,mp.Validated,r,async e=>{await this.validate(e,r),this.markAsCompleted(e)})}markAsCompleted(e){const t=this.buildState.get(e.uri.toString());t&&(t.completed=!0)}prepareBuild(e,t){for(const r of e){const e=r.uri.toString(),n=this.buildState.get(e);n&&!n.completed||this.buildState.set(e,{completed:!1,options:t,result:null==n?void 0:n.result})}}async runCancelable(e,t,r,n){for(const s of e)s.state<t&&(await tp(r),await n(s),s.state=t,await this.notifyDocumentPhase(s,t,r));const i=e.filter(e=>e.state===t);await this.notifyBuildPhase(i,t,r),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),Vy.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),Vy.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,r){let n;return t&&"path"in t?n=t:r=t,r??(r=Uh.None),n?this.awaitDocumentState(e,n,r):this.awaitBuilderState(e,r)}awaitDocumentState(e,t,r){const n=this.langiumDocuments.getDocument(t);return n?n.state>=e?Promise.resolve(t):r.isCancellationRequested?Promise.reject(Qh):this.currentState>=e&&e>n.state?Promise.reject(new Qp.ResponseError(Qp.LSPErrorCodes.RequestFailed,`Document state of ${t.toString()} is ${mp[n.state]}, requiring ${mp[e]}, but workspace state is already ${mp[this.currentState]}. Returning undefined.`)):new Promise((n,i)=>{const s=this.onDocumentPhase(e,e=>{fp.equals(e.uri,t)&&(s.dispose(),o.dispose(),n(e.uri))}),o=r.onCancellationRequested(()=>{s.dispose(),o.dispose(),i(Qh)})}):Promise.reject(new Qp.ResponseError(Qp.LSPErrorCodes.ServerCancelled,`No document found for URI: ${t.toString()}`))}awaitBuilderState(e,t){return this.currentState>=e?Promise.resolve():t.isCancellationRequested?Promise.reject(Qh):new Promise((r,n)=>{const i=this.onBuildPhase(e,()=>{i.dispose(),s.dispose(),r()}),s=t.onCancellationRequested(()=>{i.dispose(),s.dispose(),n(Qh)})})}async notifyDocumentPhase(e,t,r){const n=this.documentPhaseListeners.get(t).slice();for(const s of n)try{await tp(r),await s(e,r)}catch(i){if(!ep(i))throw i}}async notifyBuildPhase(e,t,r){if(0===e.length)return;const n=this.buildPhaseListeners.get(t).slice();for(const i of n)await tp(r),await i(e,r)}shouldLink(e){return this.getBuildOptions(e).eagerLinking??!0}shouldValidate(e){return Boolean(this.getBuildOptions(e).validation)}async validate(e,t){const r=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,n=this.getBuildOptions(e),i="object"==typeof n.validation?{...n.validation}:{};i.categories=this.findMissingValidationCategories(e,n);const s=await r.validateDocument(e,i,t);e.diagnostics?e.diagnostics.push(...s):e.diagnostics=s;const o=this.buildState.get(e.uri.toString());o&&(o.result??(o.result={}),o.result.validationChecks?o.result.validationChecks=L(o.result.validationChecks).concat(i.categories).distinct().toArray():o.result.validationChecks=[...i.categories])}getBuildOptions(e){var t;return(null==(t=this.buildState.get(e.uri.toString()))?void 0:t.options)??{}}}class Yy{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Ip,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){const r=j(e).uri,n=[];return this.referenceIndex.forEach(e=>{e.forEach(e=>{fp.equals(e.targetUri,r)&&e.targetPath===t&&n.push(e)})}),L(n)}allElements(e,t){let r=L(this.symbolIndex.keys());return t&&(r=r.filter(e=>!t||t.has(e))),r.map(t=>this.getFileDescriptions(t,e)).flat()}getFileDescriptions(e,t){if(!t)return this.symbolIndex.get(e)??[];return this.symbolByTypeIndex.get(e,t,()=>(this.symbolIndex.get(e)??[]).filter(e=>this.astReflection.isSubtype(e.type,t)))}remove(e){this.removeContent(e),this.removeReferences(e)}removeContent(e){const t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t)}removeReferences(e){const t=e.toString();this.referenceIndex.delete(t)}async updateContent(e,t=Uh.None){const r=this.serviceRegistry.getServices(e.uri),n=await r.references.ScopeComputation.collectExportedSymbols(e,t),i=e.uri.toString();this.symbolIndex.set(i,n),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=Uh.None){const r=this.serviceRegistry.getServices(e.uri),n=await r.workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),n)}isAffected(e,t){const r=this.referenceIndex.get(e.uri.toString());return!!r&&r.some(e=>!e.local&&t.has(e.targetUri.toString()))}}class Xy{constructor(e){this.initialBuildOptions={},this._ready=new rp,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){this.folders=e.workspaceFolders??void 0}initialized(e){return this.mutex.write(e=>this.initializeWorkspace(this.folders??[],e))}async initializeWorkspace(e,t=Uh.None){const r=await this.performStartup(e);await tp(t),await this.documentBuilder.build(r,this.initialBuildOptions,t)}async performStartup(e){const t=[],r=e=>{t.push(e),this.langiumDocuments.hasDocument(e.uri)||this.langiumDocuments.addDocument(e)};await this.loadAdditionalDocuments(e,r);const n=[];await Promise.all(e.map(e=>this.getRootFolder(e)).map(async e=>this.traverseFolder(e,n)));const i=L(n).distinct(e=>e.toString()).filter(e=>!this.langiumDocuments.hasDocument(e));return await this.loadWorkspaceDocuments(i,r),this._ready.resolve(),t}async loadWorkspaceDocuments(e,t){await Promise.all(e.map(async e=>{const r=await this.langiumDocuments.getOrCreateDocument(e);t(r)}))}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return hp.parse(e.uri)}async traverseFolder(e,t){try{const r=await this.fileSystemProvider.readDirectory(e);await Promise.all(r.map(async e=>{this.shouldIncludeEntry(e)&&(e.isDirectory?await this.traverseFolder(e.uri,t):e.isFile&&t.push(e.uri))}))}catch(r){console.error("Failure to read directory content of "+e.toString(!0),r)}}async searchFolder(e){const t=[];return await this.traverseFolder(e,t),t}shouldIncludeEntry(e){const t=fp.basename(e.uri);return!t.startsWith(".")&&(e.isDirectory?"node_modules"!==t&&"out"!==t:!!e.isFile&&this.serviceRegistry.hasServices(e.uri))}}class Jy{buildUnexpectedCharactersMessage(e,t,r,n,i){return Ds.buildUnexpectedCharactersMessage(e,t,r,n,i)}buildUnableToPopLexerModeMessage(e){return Ds.buildUnableToPopLexerModeMessage(e)}}const Zy={mode:"full"};class Qy{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 r=tT(t)?Object.values(t):t,n="production"===e.LanguageMetaData.mode;this.chevrotainLexer=new js(r,{positionTracking:"full",skipValidations:n,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Zy){var r,n;const i=this.chevrotainLexer.tokenize(e);return{tokens:i.tokens,errors:i.errors,hidden:i.groups.hidden??[],report:null==(n=(r=this.tokenBuilder).flushLexingReport)?void 0:n.call(r,e)}}toTokenTypeDictionary(e){if(tT(e))return e;const t=eT(e)?Object.values(e.modes).flat():e,r={};return t.forEach(e=>r[e.name]=e),r}}function eT(e){return e&&"modes"in e&&"defaultMode"in e}function tT(e){return!function(e){return Array.isArray(e)&&(0===e.length||"name"in e[0])}(e)&&!eT(e)}function rT(e,t,r){let n,i;"string"==typeof e?(i=t,n=r):(i=e.range.start,n=t),i||(i=Nl.create(0,0));const s=function(e){var t,r,n;const i=[];let s=e.position.line,o=e.position.character;for(let a=0;a<e.lines.length;a++){const c=0===a,l=a===e.lines.length-1;let u=e.lines[a],d=0;if(c&&e.options.start){const r=null==(t=e.options.start)?void 0:t.exec(u);r&&(d=r.index+r[0].length)}else{const t=null==(r=e.options.line)?void 0:r.exec(u);t&&(d=t.index+t[0].length)}if(l){const t=null==(n=e.options.end)?void 0:n.exec(u);t&&(u=u.substring(0,t.index))}u=u.substring(0,uT(u));if(lT(u,d)>=u.length){if(i.length>0){const e=Nl.create(s,o);i.push({type:"break",content:"",range:_l.create(e,e)})}}else{iT.lastIndex=d;const e=iT.exec(u);if(e){const t=e[0],r=e[1],n=Nl.create(s,o+d),a=Nl.create(s,o+d+t.length);i.push({type:"tag",content:r,range:_l.create(n,a)}),d+=t.length,d=lT(u,d)}if(d<u.length){const e=u.substring(d),t=Array.from(e.matchAll(sT));i.push(...oT(t,e,s,o+d))}}s++,o=0}if(i.length>0&&"break"===i[i.length-1].type)return i.slice(0,-1);return i}({lines:nT(e),position:i,options:gT(n)});return function(e){var t,r;const n=Nl.create(e.position.line,e.position.character);if(0===e.tokens.length)return new TT([],_l.create(n,n));const i=[];for(;e.index<e.tokens.length;){const t=dT(e,i[i.length-1]);t&&i.push(t)}const s=(null==(t=i[0])?void 0:t.range.start)??n,o=(null==(r=i[i.length-1])?void 0:r.range.end)??n;return new TT(i,_l.create(s,o))}({index:0,tokens:s,position:i})}function nT(e){let t="";t="string"==typeof e?e:e.text;return t.split(Qn)}const iT=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,sT=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function oT(e,t,r,n){const i=[];if(0===e.length){const e=Nl.create(r,n),s=Nl.create(r,n+t.length);i.push({type:"text",content:t,range:_l.create(e,s)})}else{let s=0;for(const a of e){const e=a.index,o=t.substring(s,e);o.length>0&&i.push({type:"text",content:t.substring(s,e),range:_l.create(Nl.create(r,s+n),Nl.create(r,e+n))});let c=o.length+1;const l=a[1];if(i.push({type:"inline-tag",content:l,range:_l.create(Nl.create(r,s+c+n),Nl.create(r,s+c+l.length+n))}),c+=l.length,4===a.length){c+=a[2].length;const e=a[3];i.push({type:"text",content:e,range:_l.create(Nl.create(r,s+c+n),Nl.create(r,s+c+e.length+n))})}else i.push({type:"text",content:"",range:_l.create(Nl.create(r,s+c+n),Nl.create(r,s+c+n))});s=e+a[0].length}const o=t.substring(s);o.length>0&&i.push({type:"text",content:o,range:_l.create(Nl.create(r,s+n),Nl.create(r,s+n+o.length))})}return i}const aT=/\S/,cT=/\s*$/;function lT(e,t){const r=e.substring(t).match(aT);return r?t+r.index:e.length}function uT(e){const t=e.match(cT);if(t&&"number"==typeof t.index)return t.index}function dT(e,t){const r=e.tokens[e.index];return"tag"===r.type?fT(e,!1):"text"===r.type||"inline-tag"===r.type?hT(e):(function(e,t){if(t){const r=new ET("",e.range);"inlines"in t?t.inlines.push(r):t.content.inlines.push(r)}}(r,t),void e.index++)}function hT(e){let t=e.tokens[e.index];const r=t;let n=t;const i=[];for(;t&&"break"!==t.type&&"tag"!==t.type;)i.push(pT(e)),n=t,t=e.tokens[e.index];return new RT(i,_l.create(r.range.start,n.range.end))}function pT(e){return"inline-tag"===e.tokens[e.index].type?fT(e,!0):mT(e)}function fT(e,t){const r=e.tokens[e.index++],n=r.content.substring(1),i=e.tokens[e.index];if("text"===(null==i?void 0:i.type)){if(t){const i=mT(e);return new vT(n,new RT([i],i.range),t,_l.create(r.range.start,i.range.end))}{const i=hT(e);return new vT(n,i,t,_l.create(r.range.start,i.range.end))}}{const e=r.range;return new vT(n,new RT([],e),t,e)}}function mT(e){const t=e.tokens[e.index++];return new ET(t.content,t.range)}function gT(e){if(!e)return gT({start:"/**",end:"*/",line:"*"});const{start:t,end:r,line:n}=e;return{start:yT(t,!0),end:yT(r,!1),line:yT(n,!0)}}function yT(e,t){if("string"==typeof e||"object"==typeof e){const r="string"==typeof e?si(e):e.source;return t?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}return e}class TT{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 r=t.toString();e+=ST(e)+r}return e.trim()}toMarkdown(e){let t="";for(const r of this.elements)if(0===t.length)t=r.toMarkdown(e);else{const n=r.toMarkdown(e);t+=ST(t)+n}return t.trim()}}class vT{constructor(e,t,r,n){this.name=e,this.content=t,this.inline=r,this.range=n}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;return(null==(t=null==e?void 0:e.renderTag)?void 0:t.call(e,this))??this.toMarkdownDefault(e)}toMarkdownDefault(e){const t=this.content.toMarkdown(e);if(this.inline){const r=function(e,t,r){var n;if("linkplain"===e||"linkcode"===e||"link"===e){const i=t.indexOf(" ");let s=t;if(i>0){const e=lT(t,i);s=t.substring(e),t=t.substring(0,i)}("linkcode"===e||"link"===e&&"code"===r.link)&&(s=`\`${s}\``);const o=(null==(n=r.renderLink)?void 0:n.call(r,t,s))??function(e,t){try{return hp.parse(e,!0),`[${t}](${e})`}catch{return e}}(t,s);return o}return}(this.name,t,e??{});if("string"==typeof r)return r}let r="";"italic"===(null==e?void 0:e.tag)||void 0===(null==e?void 0:e.tag)?r="*":"bold"===(null==e?void 0:e.tag)?r="**":"bold-italic"===(null==e?void 0:e.tag)&&(r="***");let n=`${r}@${this.name}${r}`;return 1===this.content.inlines.length?n=`${n} — ${t}`:this.content.inlines.length>1&&(n=`${n}\n${t}`),this.inline?`{${n}}`:n}}class RT{constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;t<this.inlines.length;t++){const r=this.inlines[t],n=this.inlines[t+1];e+=r.toString(),n&&n.range.start.line>r.range.start.line&&(e+="\n")}return e}toMarkdown(e){let t="";for(let r=0;r<this.inlines.length;r++){const n=this.inlines[r],i=this.inlines[r+1];t+=n.toMarkdown(e),i&&i.range.start.line>n.range.start.line&&(t+="\n")}return t}}class ET{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function ST(e){return e.endsWith("\n")?"\n":"\n\n"}class kT{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 r=gT(t),n=nT(e);if(0===n.length)return!1;const i=n[0],s=n[n.length-1],o=r.start,a=r.end;return Boolean(null==o?void 0:o.exec(i))&&Boolean(null==a?void 0:a.exec(s))}(t)){return rT(t).toMarkdown({renderLink:(t,r)=>this.documentationLinkRenderer(e,t,r),renderTag:t=>this.documentationTagRenderer(e,t)})}}documentationLinkRenderer(e,t,r){const n=this.findNameInLocalSymbols(e,t)??this.findNameInGlobalScope(e,t);if(n&&n.nameSegment){const e=n.nameSegment.range.start.line+1,t=n.nameSegment.range.start.character+1;return`[${r}](${n.documentUri.with({fragment:`L${e},${t}`}).toString()})`}}documentationTagRenderer(e,t){}findNameInLocalSymbols(e,t){const r=j(e).localSymbols;if(!r)return;let n=e;do{const e=r.getStream(n).find(e=>e.name===t);if(e)return e;n=n.$container}while(n)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(e=>e.name===t)}}class CT{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 r=function(e,t=!0){for(;e.container;){const r=e.container;let n=r.content.indexOf(e);for(;n>0;){n--;const e=r.content[n];if(t||!e.hidden)return e}e=r}}(e,!0);if(r&&Mn(r,t))return r;if(x(e))for(let n=e.content.findIndex(e=>!e.hidden)-1;n>=0;n--){const r=e.content[n];if(Mn(r,t))return r}}}(e.$cstNode,this.grammarConfig().multilineCommentRules))?void 0:t.text}}class AT{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}}class bT{constructor(){this.previousTokenSource=new Bh,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=(Zh=performance.now(),new Bh);return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r=Uh.None){const n=new rp,i={action:t,deferred:n,cancellationToken:r};return e.push(i),this.performNextOperation(),n.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:r})=>{try{const n=await Promise.resolve().then(()=>e(r));t.resolve(n)}catch(n){ep(n)?t.resolve(void 0):t.reject(n)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class $T{constructor(e){this.grammarElementIdMap=new Ap,this.tokenTypeIdMap=new Ap,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=>({...e,message:e.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const t=new Map,r=new Map;for(const n of K(e))t.set(n,{});if(e.$cstNode)for(const n of In(e.$cstNode))r.set(n,{});return{astNodes:t,cstNodes:r}}dehydrateAstNode(e,t){const r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,void 0!==e.$cstNode&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(const[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){const e=[];r[n]=e;for(const r of i)E(r)?e.push(this.dehydrateAstNode(r,t)):S(r)?e.push(this.dehydrateReference(r,t)):e.push(r)}else E(i)?r[n]=this.dehydrateAstNode(i,t):S(i)?r[n]=this.dehydrateReference(i,t):void 0!==i&&(r[n]=i);return r}dehydrateReference(e,t){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=t.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,t){const r=t.cstNodes.get(e);return x(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=t.astNodes.get(e.astNode),b(e)?r.content=e.content.map(e=>this.dehydrateCstNode(e,t)):$(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const t=e.value,r=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,r)}}createHydrationContext(e){const t=new Map,r=new Map;for(const i of K(e))t.set(i,{});let n;if(e.$cstNode)for(const i of In(e.$cstNode)){let e;"fullText"in i?(e=new sh(i.fullText),n=e):"content"in i?e=new nh:"tokenType"in i&&(e=this.hydrateCstLeafNode(i)),e&&(r.set(i,e),e.root=n)}return{astNodes:t,cstNodes:r}}hydrateAstNode(e,t){const r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=t.cstNodes.get(e.$cstNode));for(const[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){const e=[];r[n]=e;for(const s of i)E(s)?e.push(this.setParent(this.hydrateAstNode(s,t),r)):S(s)?e.push(this.hydrateReference(s,r,n,t)):e.push(s)}else E(i)?r[n]=this.setParent(this.hydrateAstNode(i,t),r):S(i)?r[n]=this.hydrateReference(i,r,n,t):void 0!==i&&(r[n]=i);return r}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,r,n){return this.linker.buildReference(t,r,n.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,r=0){const n=t.cstNodes.get(e);if("number"==typeof e.grammarSource&&(n.grammarSource=this.getGrammarElement(e.grammarSource)),n.astNode=t.astNodes.get(e.astNode),b(n))for(const i of e.content){const e=this.hydrateCstNode(i,t,r++);n.content.push(e)}return n}hydrateCstLeafNode(e){const t=this.getTokenType(e.tokenType),r=e.offset,n=e.length,i=e.startLine,s=e.startColumn,o=e.endLine,a=e.endColumn,c=e.hidden;return new rh(r,n,{start:{line:i,character:s},end:{line:o,character:a}},t,c)}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 t of K(this.grammar))J(t)&&this.grammarElementIdMap.set(t,e++)}}function xT(e){return{documentation:{CommentProvider:e=>new CT(e),DocumentationProvider:e=>new kT(e)},parser:{AsyncParser:e=>new AT(e),GrammarConfig:e=>function(e){const t=[],r=e.Grammar;for(const n of r.rules)Jr(n)&&li(n)&&ri(vi(n))&&t.push(n.name);return{multilineCommentRules:t,nameRegexp:Dn}}(e),LangiumParser:e=>bh(e),CompletionParser:e=>function(e){const t=e.Grammar,r=e.parser.Lexer,n=new ph(e);return yh(t,n,r.definition),n.finalize(),n}(e),ValueConverter:()=>new xh,TokenBuilder:()=>new $h,Lexer:e=>new Qy(e),ParserErrorMessageProvider:()=>new hh,LexerErrorMessageProvider:()=>new Jy},workspace:{AstNodeLocator:()=>new Xp,AstNodeDescriptionProvider:e=>new Hp(e),ReferenceDescriptionProvider:e=>new Yp(e)},references:{Linker:e=>new Ep(e),NameProvider:()=>new Sp,ScopeProvider:e=>new Pp(e),ScopeComputation:e=>new bp(e),References:e=>new kp(e)},serializer:{Hydrator:e=>new $T(e),JsonSerializer:e=>new Op(e)},validation:{DocumentValidator:e=>new Gp(e),ValidationRegistry:e=>new jp(e)},shared:()=>e.shared}}function wT(e){return{ServiceRegistry:e=>new Dp(e),workspace:{LangiumDocuments:e=>new vp(e),LangiumDocumentFactory:e=>new Tp(e),DocumentBuilder:e=>new Hy(e),IndexManager:e=>new Yy(e),WorkspaceManager:e=>new Xy(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new bT,ConfigurationProvider:e=>new Jp(e)},profilers:{}}}var NT;function IT(e,t,r,n,i,s,o,a,c){return PT([e,t,r,n,i,s,o,a,c].reduce(DT,{}))}(NT||(NT={})).merge=(e,t)=>DT(DT({},e),t);const _T=Symbol("isProxy");function PT(e,t){const r=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(n,i)=>i===_T||OT(n,i,e,t||r),getOwnPropertyDescriptor:(n,i)=>(OT(n,i,e,t||r),Object.getOwnPropertyDescriptor(n,i)),has:(t,r)=>r in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return r}const LT=Symbol();function OT(e,t,r,n){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]===LT)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 r){const s=r[t];e[t]=LT;try{e[t]="function"==typeof s?s(n):PT(s,n)}catch(i){throw e[t]=i instanceof Error?i:void 0,i}return e[t]}}function DT(e,t){if(t)for(const[r,n]of Object.entries(t))if(null!=n)if("object"==typeof n){const t=e[r];e[r]=DT("object"==typeof t&&null!==t?t:{},n)}else e[r]=n;return e}class MT{stat(e){throw new Error("No file system is available.")}statSync(e){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}}const FT={fileSystemProvider:()=>new MT},qT={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},jT={AstReflection:()=>new wn};function UT(e){const t=function(){const e=IT(wT(FT),jT),t=IT(xT({shared:e}),qT);return e.ServiceRegistry.register(t),t}(),r=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(r,hp.parse(`memory:/${r.name??"grammar"}.langium`)),r}var GT,zT,BT,KT,WT,VT,HT,YT=Object.defineProperty,XT=(e,t)=>YT(e,"name",{value:t,configurable:!0});(GT||(GT={})).Terminals={ARROW_DIRECTION:/L|R|T|B/,ARROW_GROUP:/\{group\}/,ARROW_INTO:/<|>/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ARCH_ICON:/\([\w-:]+\)/,ARCH_TITLE:/\[[\w ]+\]/},(zT||(zT={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,REFERENCE:/\w([-\./\w]*[-\w])?/},(BT||(BT={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(KT||(KT={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(WT||(WT={})).Terminals={NUMBER_PIE:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(VT||(VT={})).Terminals={GRATICULE:/circle|polygon/,BOOLEAN:/true|false/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NUMBER:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(HT||(HT={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,TREEMAP_KEYWORD:/treemap-beta|treemap/,CLASS_DEF:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,STYLE_SEPARATOR:/:::/,SEPARATOR:/:/,COMMA:/,/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,ID2:/[a-zA-Z_][a-zA-Z0-9_]*/,NUMBER2:/[0-9_\.\,]+/,STRING2:/"[^"]*"|'[^']*'/},GT.Terminals,zT.Terminals,BT.Terminals,KT.Terminals,WT.Terminals,VT.Terminals,HT.Terminals;var JT="Architecture",ZT="accDescr",QT="accTitle",ev="edges",tv="groups",rv="junctions",nv="services",iv="title";XT(function(e){return CE.isInstance(e,JT)},"isArchitecture");var sv="Axis",ov="label",av="name",cv="Branch",lv="name",uv="order";XT(function(e){return CE.isInstance(e,cv)},"isBranch");var dv="Checkout",hv="branch",pv="CherryPicking",fv="id",mv="parent",gv="tags",yv="ClassDefStatement",Tv="className",vv="styleText",Rv="Commit",Ev="id",Sv="message",kv="tags",Cv="type";XT(function(e){return CE.isInstance(e,Rv)},"isCommit");var Av="Curve",bv="entries",$v="label",xv="name",wv="Direction",Nv="accDescr",Iv="accTitle",_v="dir",Pv="statements",Lv="title",Ov="Edge",Dv="lhsDir",Mv="lhsGroup",Fv="lhsId",qv="lhsInto",jv="rhsDir",Uv="rhsGroup",Gv="rhsId",zv="rhsInto",Bv="title",Kv="Entry",Wv="axis",Vv="value",Hv="GitGraph",Yv="accDescr",Xv="accTitle",Jv="statements",Zv="title";XT(function(e){return CE.isInstance(e,Hv)},"isGitGraph");var Qv="Group",eR="icon",tR="id",rR="in",nR="title",iR="Info",sR="accDescr",oR="accTitle",aR="title";XT(function(e){return CE.isInstance(e,iR)},"isInfo");var cR="Item",lR="classSelector",uR="name",dR="Junction",hR="id",pR="in",fR="Leaf",mR="classSelector",gR="name",yR="value",TR="Merge",vR="branch",RR="id",ER="tags",SR="type";XT(function(e){return CE.isInstance(e,TR)},"isMerge");var kR="Option",CR="name",AR="value",bR="Packet",$R="accDescr",xR="accTitle",wR="blocks",NR="title";XT(function(e){return CE.isInstance(e,bR)},"isPacket");var IR="PacketBlock",_R="bits",PR="end",LR="label",OR="start";XT(function(e){return CE.isInstance(e,IR)},"isPacketBlock");var DR="Pie",MR="accDescr",FR="accTitle",qR="sections",jR="showData",UR="title";XT(function(e){return CE.isInstance(e,DR)},"isPie");var GR="PieSection",zR="label",BR="value";XT(function(e){return CE.isInstance(e,GR)},"isPieSection");var KR="Radar",WR="accDescr",VR="accTitle",HR="axes",YR="curves",XR="options",JR="title",ZR="Section",QR="classSelector",eE="name",tE="Service",rE="icon",nE="iconText",iE="id",sE="in",oE="title",aE="Statement",cE="Treemap",lE="accDescr",uE="accTitle",dE="title",hE="TreemapRows";XT(function(e){return CE.isInstance(e,cE)},"isTreemap");var pE,fE,mE,gE,yE,TE,vE,RE="TreemapRow",EE="indent",SE="item",kE=(XT(e=class extends A{constructor(){super(...arguments),this.types={Architecture:{name:JT,properties:{accDescr:{name:ZT},accTitle:{name:QT},edges:{name:ev,defaultValue:[]},groups:{name:tv,defaultValue:[]},junctions:{name:rv,defaultValue:[]},services:{name:nv,defaultValue:[]},title:{name:iv}},superTypes:[]},Axis:{name:sv,properties:{label:{name:ov},name:{name:av}},superTypes:[]},Branch:{name:cv,properties:{name:{name:lv},order:{name:uv}},superTypes:[aE]},Checkout:{name:dv,properties:{branch:{name:hv}},superTypes:[aE]},CherryPicking:{name:pv,properties:{id:{name:fv},parent:{name:mv},tags:{name:gv,defaultValue:[]}},superTypes:[aE]},ClassDefStatement:{name:yv,properties:{className:{name:Tv},styleText:{name:vv}},superTypes:[]},Commit:{name:Rv,properties:{id:{name:Ev},message:{name:Sv},tags:{name:kv,defaultValue:[]},type:{name:Cv}},superTypes:[aE]},Curve:{name:Av,properties:{entries:{name:bv,defaultValue:[]},label:{name:$v},name:{name:xv}},superTypes:[]},Direction:{name:wv,properties:{accDescr:{name:Nv},accTitle:{name:Iv},dir:{name:_v},statements:{name:Pv,defaultValue:[]},title:{name:Lv}},superTypes:[Hv]},Edge:{name:Ov,properties:{lhsDir:{name:Dv},lhsGroup:{name:Mv,defaultValue:!1},lhsId:{name:Fv},lhsInto:{name:qv,defaultValue:!1},rhsDir:{name:jv},rhsGroup:{name:Uv,defaultValue:!1},rhsId:{name:Gv},rhsInto:{name:zv,defaultValue:!1},title:{name:Bv}},superTypes:[]},Entry:{name:Kv,properties:{axis:{name:Wv,referenceType:sv},value:{name:Vv}},superTypes:[]},GitGraph:{name:Hv,properties:{accDescr:{name:Yv},accTitle:{name:Xv},statements:{name:Jv,defaultValue:[]},title:{name:Zv}},superTypes:[]},Group:{name:Qv,properties:{icon:{name:eR},id:{name:tR},in:{name:rR},title:{name:nR}},superTypes:[]},Info:{name:iR,properties:{accDescr:{name:sR},accTitle:{name:oR},title:{name:aR}},superTypes:[]},Item:{name:cR,properties:{classSelector:{name:lR},name:{name:uR}},superTypes:[]},Junction:{name:dR,properties:{id:{name:hR},in:{name:pR}},superTypes:[]},Leaf:{name:fR,properties:{classSelector:{name:mR},name:{name:gR},value:{name:yR}},superTypes:[cR]},Merge:{name:TR,properties:{branch:{name:vR},id:{name:RR},tags:{name:ER,defaultValue:[]},type:{name:SR}},superTypes:[aE]},Option:{name:kR,properties:{name:{name:CR},value:{name:AR,defaultValue:!1}},superTypes:[]},Packet:{name:bR,properties:{accDescr:{name:$R},accTitle:{name:xR},blocks:{name:wR,defaultValue:[]},title:{name:NR}},superTypes:[]},PacketBlock:{name:IR,properties:{bits:{name:_R},end:{name:PR},label:{name:LR},start:{name:OR}},superTypes:[]},Pie:{name:DR,properties:{accDescr:{name:MR},accTitle:{name:FR},sections:{name:qR,defaultValue:[]},showData:{name:jR,defaultValue:!1},title:{name:UR}},superTypes:[]},PieSection:{name:GR,properties:{label:{name:zR},value:{name:BR}},superTypes:[]},Radar:{name:KR,properties:{accDescr:{name:WR},accTitle:{name:VR},axes:{name:HR,defaultValue:[]},curves:{name:YR,defaultValue:[]},options:{name:XR,defaultValue:[]},title:{name:JR}},superTypes:[]},Section:{name:ZR,properties:{classSelector:{name:QR},name:{name:eE}},superTypes:[cR]},Service:{name:tE,properties:{icon:{name:rE},iconText:{name:nE},id:{name:iE},in:{name:sE},title:{name:oE}},superTypes:[]},Statement:{name:aE,properties:{},superTypes:[]},Treemap:{name:cE,properties:{accDescr:{name:lE},accTitle:{name:uE},title:{name:dE},TreemapRows:{name:hE,defaultValue:[]}},superTypes:[]},TreemapRow:{name:RE,properties:{indent:{name:EE},item:{name:SE}},superTypes:[]}}}},"MermaidAstReflection"),e),CE=new kE,AE=XT(()=>pE??(pE=UT('{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$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":[]}}]},"entry":false,"parameters":[]},{"$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":[]}}]},"entry":false,"parameters":[]},{"$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":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"ArchitectureGrammarGrammar"),bE=XT(()=>fE??(fE=UT('{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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"}]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"GitGraphGrammarGrammar"),$E=XT(()=>mE??(mE=UT('{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"InfoGrammarGrammar"),xE=XT(()=>gE??(gE=UT('{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PacketGrammarGrammar"),wE=XT(()=>yE??(yE=UT('{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PieGrammarGrammar"),NE=XT(()=>TE??(TE=UT('{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}')),"RadarGrammarGrammar"),IE=XT(()=>vE??(vE=UT('{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}')),"TreemapGrammarGrammar"),_E={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},PE={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},LE={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},OE={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},DE={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ME={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},FE={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},qE={AstReflection:XT(()=>new kE,"AstReflection")},jE={Grammar:XT(()=>AE(),"Grammar"),LanguageMetaData:XT(()=>_E,"LanguageMetaData"),parser:{}},UE={Grammar:XT(()=>bE(),"Grammar"),LanguageMetaData:XT(()=>PE,"LanguageMetaData"),parser:{}},GE={Grammar:XT(()=>$E(),"Grammar"),LanguageMetaData:XT(()=>LE,"LanguageMetaData"),parser:{}},zE={Grammar:XT(()=>xE(),"Grammar"),LanguageMetaData:XT(()=>OE,"LanguageMetaData"),parser:{}},BE={Grammar:XT(()=>wE(),"Grammar"),LanguageMetaData:XT(()=>DE,"LanguageMetaData"),parser:{}},KE={Grammar:XT(()=>NE(),"Grammar"),LanguageMetaData:XT(()=>ME,"LanguageMetaData"),parser:{}},WE={Grammar:XT(()=>IE(),"Grammar"),LanguageMetaData:XT(()=>FE,"LanguageMetaData"),parser:{}},VE={ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/accTitle[\t ]*:([^\n\r]*)/,TITLE:/title([\t ][^\n\r]*|)/},HE=(XT(t=class extends xh{runConverter(e,t,r){let n=this.runCommonConverter(e,t,r);return void 0===n&&(n=this.runCustomConverter(e,t,r)),void 0===n?super.runConverter(e,t,r):n}runCommonConverter(e,t,r){const n=VE[e.name];if(void 0===n)return;const i=n.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),YE=(XT(r=class extends HE{runCustomConverter(e,t,r){}},"CommonValueConverter"),r),XE=(XT(n=class extends $h{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,r){const n=super.buildKeywordTokens(e,t,r);return n.forEach(e=>{this.keywords.has(e.name)&&void 0!==e.PATTERN&&(e.PATTERN=new RegExp(e.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}},"AbstractMermaidTokenBuilder"),n);XT(class extends XE{},"CommonTokenBuilder");var JE=(XT(i=class extends XE{constructor(){super(["gitGraph"])}},"GitGraphTokenBuilder"),i),ZE={parser:{TokenBuilder:XT(()=>new JE,"TokenBuilder"),ValueConverter:XT(()=>new YE,"ValueConverter")}};function QE(e=FT){const t=IT(wT(e),qE),r=IT(xT({shared:t}),UE,ZE);return t.ServiceRegistry.register(r),{shared:t,GitGraph:r}}XT(QE,"createGitGraphServices");var eS=(XT(s=class extends XE{constructor(){super(["info","showInfo"])}},"InfoTokenBuilder"),s),tS={parser:{TokenBuilder:XT(()=>new eS,"TokenBuilder"),ValueConverter:XT(()=>new YE,"ValueConverter")}};function rS(e=FT){const t=IT(wT(e),qE),r=IT(xT({shared:t}),GE,tS);return t.ServiceRegistry.register(r),{shared:t,Info:r}}XT(rS,"createInfoServices");var nS=(XT(o=class extends XE{constructor(){super(["packet"])}},"PacketTokenBuilder"),o),iS={parser:{TokenBuilder:XT(()=>new nS,"TokenBuilder"),ValueConverter:XT(()=>new YE,"ValueConverter")}};function sS(e=FT){const t=IT(wT(e),qE),r=IT(xT({shared:t}),zE,iS);return t.ServiceRegistry.register(r),{shared:t,Packet:r}}XT(sS,"createPacketServices");var oS=(XT(a=class extends XE{constructor(){super(["pie","showData"])}},"PieTokenBuilder"),a),aS=(XT(c=class extends HE{runCustomConverter(e,t,r){if("PIE_SECTION_LABEL"===e.name)return t.replace(/"/g,"").trim()}},"PieValueConverter"),c),cS={parser:{TokenBuilder:XT(()=>new oS,"TokenBuilder"),ValueConverter:XT(()=>new aS,"ValueConverter")}};function lS(e=FT){const t=IT(wT(e),qE),r=IT(xT({shared:t}),BE,cS);return t.ServiceRegistry.register(r),{shared:t,Pie:r}}XT(lS,"createPieServices");var uS=(XT(l=class extends XE{constructor(){super(["architecture"])}},"ArchitectureTokenBuilder"),l),dS=(XT(u=class extends HE{runCustomConverter(e,t,r){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),hS={parser:{TokenBuilder:XT(()=>new uS,"TokenBuilder"),ValueConverter:XT(()=>new dS,"ValueConverter")}};function pS(e=FT){const t=IT(wT(e),qE),r=IT(xT({shared:t}),jE,hS);return t.ServiceRegistry.register(r),{shared:t,Architecture:r}}XT(pS,"createArchitectureServices");var fS=(XT(d=class extends XE{constructor(){super(["radar-beta"])}},"RadarTokenBuilder"),d),mS={parser:{TokenBuilder:XT(()=>new fS,"TokenBuilder"),ValueConverter:XT(()=>new YE,"ValueConverter")}};function gS(e=FT){const t=IT(wT(e),qE),r=IT(xT({shared:t}),KE,mS);return t.ServiceRegistry.register(r),{shared:t,Radar:r}}XT(gS,"createRadarServices");var yS=(XT(h=class extends XE{constructor(){super(["treemap"])}},"TreemapTokenBuilder"),h),TS=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,vS=(XT(p=class extends HE{runCustomConverter(e,t,r){if("NUMBER2"===e.name)return parseFloat(t.replace(/,/g,""));if("SEPARATOR"===e.name)return t.substring(1,t.length-1);if("STRING2"===e.name)return t.substring(1,t.length-1);if("INDENTATION"===e.name)return t.length;if("ClassDef"===e.name){if("string"!=typeof t)return t;const e=TS.exec(t);if(e)return{$type:"ClassDefStatement",className:e[1],styleText:e[2]||void 0}}}},"TreemapValueConverter"),p);function RS(e){const t=e.validation.TreemapValidator,r=e.validation.ValidationRegistry;if(r){const e={Treemap:t.checkSingleRoot.bind(t)};r.register(e,t)}}XT(RS,"registerValidationChecks");var ES=(XT(f=class{checkSingleRoot(e,t){let r;for(const n of e.TreemapRows)n.item&&(void 0===r&&void 0===n.indent?r=0:(void 0===n.indent||void 0!==r&&r>=parseInt(n.indent,10))&&t("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}))}},"TreemapValidator"),f),SS={parser:{TokenBuilder:XT(()=>new yS,"TokenBuilder"),ValueConverter:XT(()=>new vS,"ValueConverter")},validation:{TreemapValidator:XT(()=>new ES,"TreemapValidator")}};function kS(e=FT){const t=IT(wT(e),qE),r=IT(xT({shared:t}),WE,SS);return t.ServiceRegistry.register(r),RS(r),{shared:t,Treemap:r}}XT(kS,"createTreemapServices");var CS={},AS={info:XT(async()=>{const{createInfoServices:e}=await Promise.resolve().then(()=>require("./info-VBDWY6EO-D_RrmivC.cjs")),t=e().Info.parser.LangiumParser;CS.info=t},"info"),packet:XT(async()=>{const{createPacketServices:e}=await Promise.resolve().then(()=>require("./packet-DYOGHKS2-Bc88puEA.cjs")),t=e().Packet.parser.LangiumParser;CS.packet=t},"packet"),pie:XT(async()=>{const{createPieServices:e}=await Promise.resolve().then(()=>require("./pie-VRWISCQL-BDZOt1dn.cjs")),t=e().Pie.parser.LangiumParser;CS.pie=t},"pie"),architecture:XT(async()=>{const{createArchitectureServices:e}=await Promise.resolve().then(()=>require("./architecture-7HQA4BMR-XjppxKRg.cjs")),t=e().Architecture.parser.LangiumParser;CS.architecture=t},"architecture"),gitGraph:XT(async()=>{const{createGitGraphServices:e}=await Promise.resolve().then(()=>require("./gitGraph-G5XIXVHT-BdOKVbYt.cjs")),t=e().GitGraph.parser.LangiumParser;CS.gitGraph=t},"gitGraph"),radar:XT(async()=>{const{createRadarServices:e}=await Promise.resolve().then(()=>require("./radar-ZZBFDIW7-CN4CW1Sn.cjs")),t=e().Radar.parser.LangiumParser;CS.radar=t},"radar"),treemap:XT(async()=>{const{createTreemapServices:e}=await Promise.resolve().then(()=>require("./treemap-GDKQZRPO-DPSTeBWV.cjs")),t=e().Treemap.parser.LangiumParser;CS.treemap=t},"treemap")};async function bS(e,t){const r=AS[e];if(!r)throw new Error(`Unknown diagram type: ${e}`);CS[e]||await r();const n=CS[e].parse(t);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new $S(n);return n.value}XT(bS,"parse");var $S=(m=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}},XT(m,"MermaidParseError"),m);exports.ArchitectureModule=hS,exports.GitGraphModule=ZE,exports.InfoModule=tS,exports.PacketModule=iS,exports.PieModule=cS,exports.RadarModule=mS,exports.TreemapModule=SS,exports.createArchitectureServices=pS,exports.createGitGraphServices=QE,exports.createInfoServices=rS,exports.createPacketServices=sS,exports.createPieServices=lS,exports.createRadarServices=gS,exports.createTreemapServices=kS,exports.parse=bS;
|
|
2
|
-
//# sourceMappingURL=mermaid-parser.core-
|
|
1
|
+
"use strict";var e,t,r,n,i,s,o,a,c,l,u,d,h,p,f,m,g=Object.defineProperty,y=(e,t,r)=>((e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const T=require("lodash-es"),v=require("./index-D5nkqpSD.cjs"),R=require("./_arrayEach-CAQQp4Pa.cjs");function E(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$type}function S(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$refText&&"ref"in e}function k(e){return"object"==typeof e&&null!==e&&"string"==typeof e.$refText&&"items"in e}function C(e){return"object"==typeof e&&null!==e&&"object"==typeof e.info&&"string"==typeof e.message}class A{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){var t;const r=this.types[e.container.$type];if(!r)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const n=null==(t=r.properties[e.property])?void 0:t.referenceType;if(!n)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return n}getTypeMetaData(e){const t=this.types[e];return t||{name:e,properties:{},superTypes:[]}}isInstance(e,t){return E(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const n=r[t];if(void 0!==n)return n;{const n=this.types[e],i=!!n&&n.superTypes.some(e=>this.isSubtype(e,t));return r[t]=i,i}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const t=this.getAllTypes(),r=[];for(const n of t)this.isSubtype(n,e)&&r.push(n);return this.allSubtypes[e]=r,r}}}function b(e){return"object"==typeof e&&null!==e&&Array.isArray(e.content)}function $(e){return"object"==typeof e&&null!==e&&"object"==typeof e.tokenType}function x(e){return b(e)&&"string"==typeof e.fullText}class w{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,r=e.next();for(;!r.done;)t++,r=e.next();return t}toArray(){const e=[],t=this.iterator();let r;do{r=t.next(),void 0!==r.value&&e.push(r.value)}while(!r.done);return e}toSet(){return new Set(this)}toMap(e,t){const r=this.map(r=>[e?e(r):r,t?t(r):r]);return new Map(r)}toString(){return this.join()}concat(e){return new w(()=>({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 P})}join(e=","){const t=this.iterator();let r,n="",i=!1;do{r=t.next(),r.done||(i&&(n+=e),n+=N(r.value)),i=!0}while(!r.done);return n}indexOf(e,t=0){const r=this.iterator();let n=0,i=r.next();for(;!i.done;){if(n>=t&&i.value===e)return n;i=r.next(),n++}return-1}every(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(!e(r.value))return!1;r=t.next()}return!0}some(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return!0;r=t.next()}return!1}forEach(e){const t=this.iterator();let r=0,n=t.next();for(;!n.done;)e(n.value,r),n=t.next(),r++}map(e){return new w(this.startFn,t=>{const{done:r,value:n}=this.nextFn(t);return r?P:{done:!1,value:e(n)}})}filter(e){return new w(this.startFn,t=>{let r;do{if(r=this.nextFn(t),!r.done&&e(r.value))return r}while(!r.done);return P})}nonNullable(){return this.filter(e=>null!=e)}reduce(e,t){const r=this.iterator();let n=t,i=r.next();for(;!i.done;)n=void 0===n?i.value:e(n,i.value),i=r.next();return n}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,r){const n=e.next();if(n.done)return r;const i=this.recursiveReduce(e,t,r);return void 0===i?n.value:t(i,n.value)}find(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return r.value;r=t.next()}}findIndex(e){const t=this.iterator();let r=0,n=t.next();for(;!n.done;){if(e(n.value))return r;n=t.next(),r++}return-1}includes(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(r.value===e)return!0;r=t.next()}return!1}flatMap(e){return new w(()=>({this:this.startFn()}),t=>{do{if(t.iterator){const e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}const{done:r,value:n}=this.nextFn(t.this);if(!r){const r=e(n);if(!I(r))return{done:!1,value:r};t.iterator=r[Symbol.iterator]()}}while(t.iterator);return P})}flat(e){if(void 0===e&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new w(()=>({this:t.startFn()}),e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}const{done:r,value:n}=t.nextFn(e.this);if(!r){if(!I(n))return{done:!1,value:n};e.iterator=n[Symbol.iterator]()}}while(e.iterator);return P})}head(){const e=this.iterator().next();if(!e.done)return e.value}tail(e=1){return new w(()=>{const t=this.startFn();for(let r=0;r<e;r++){if(this.nextFn(t).done)return t}return t},this.nextFn)}limit(e){return new w(()=>({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?P:this.nextFn(t.state)))}distinct(e){return new w(()=>({set:new Set,internalState:this.startFn()}),t=>{let r;do{if(r=this.nextFn(t.internalState),!r.done){const n=e?e(r.value):r.value;if(!t.set.has(n))return t.set.add(n),r}}while(!r.done);return P})}exclude(e,t){const r=new Set;for(const n of e){const e=t?t(n):n;r.add(e)}return this.filter(e=>{const n=t?t(e):e;return!r.has(n)})}}function N(e){return"string"==typeof e?e:void 0===e?"undefined":"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}function I(e){return!!e&&"function"==typeof e[Symbol.iterator]}const _=new w(()=>{},()=>P),P=Object.freeze({done:!0,value:void 0});function L(...e){if(1===e.length){const t=e[0];if(t instanceof w)return t;if(I(t))return new w(()=>t[Symbol.iterator](),e=>e.next());if("number"==typeof t.length)return new w(()=>({index:0}),e=>e.index<t.length?{done:!1,value:t[e.index++]}:P)}return e.length>1?new w(()=>({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 r=e[t.collIndex++];I(r)?t.iterator=r[Symbol.iterator]():r&&"number"==typeof r.length&&(t.array=r)}}while(t.iterator||t.array||t.collIndex<e.length);return P}):_}class O extends w{constructor(e,t,r){super(()=>({iterators:(null==r?void 0:r.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 r=e.iterators[e.iterators.length-1].next();if(!r.done)return e.iterators.push(t(r.value)[Symbol.iterator]()),r;e.iterators.pop()}return P})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var D,M;function F(e,t={}){for(const[r,n]of Object.entries(e))r.startsWith("$")||(Array.isArray(n)?n.forEach((n,i)=>{E(n)&&(n.$container=e,n.$containerProperty=r,n.$containerIndex=i,t.deep&&F(n,t))}):E(n)&&(n.$container=e,n.$containerProperty=r,t.deep&&F(n,t)))}function q(e,t){let r=e;for(;r;){if(t(r))return r;r=r.$container}}function j(e){const t=U(e).$document;if(!t)throw new Error("AST node has no document.");return t}function U(e){for(;e.$container;)e=e.$container;return e}function G(e){return S(e)?e.ref?[e.ref]:[]:k(e)?e.items.map(e=>e.ref):[]}function z(e,t){if(!e)throw new Error("Node must be an AstNode.");const r=null==t?void 0:t.range;return new w(()=>({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 i=e[n];if(E(i)){if(t.keyIndex++,W(i,r))return{done:!1,value:i}}else if(Array.isArray(i)){for(;t.arrayIndex<i.length;){const e=i[t.arrayIndex++];if(E(e)&&W(e,r))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return P})}function B(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new O(e,e=>z(e,t))}function K(e,t){if(!e)throw new Error("Root node must be an AstNode.");return new O(e,e=>z(e,t),{includeRoot:!0})}function W(e,t){var r;if(!t)return!0;const n=null==(r=e.$cstNode)?void 0:r.range;return!!n&&function(e,t){const r=function(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return Ln.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return Ln.After;const r=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,n=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return r&&n?Ln.Inside:r?Ln.OverlapBack:n?Ln.OverlapFront:Ln.Outside}(e,t);return r>Ln.After}(n,t)}function V(e){return new w(()=>({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 n=e[r];if(S(n)||k(n))return t.keyIndex++,{done:!1,value:{reference:n,container:e,property:r}};if(Array.isArray(n)){for(;t.arrayIndex<n.length;){const i=t.arrayIndex++,s=n[i];if(S(s)||k(n))return{done:!1,value:{reference:s,container:e,property:r,index:i}}}t.arrayIndex=0}}t.keyIndex++}return P})}function H(e){return Array.isArray(e)?[...e.map(H)]:e}(M=D||(D={})).sum=function(e){return e.reduce((e,t)=>e+t,0)},M.product=function(e){return e.reduce((e,t)=>e*t,0)},M.min=function(e){return e.reduce((e,t)=>Math.min(e,t))},M.max=function(e){return e.reduce((e,t)=>Math.max(e,t))};const Y="AbstractElement",X="cardinality";function J(e){return Nn.isInstance(e,Y)}const Z="AbstractParserRule";function Q(e){return Nn.isInstance(e,Z)}const ee="AbstractRule",te="AbstractType",re="Action",ne="cardinality",ie="feature",se="inferredType",oe="operator",ae="type";function ce(e){return Nn.isInstance(e,re)}const le="Alternatives",ue="cardinality",de="elements";function he(e){return Nn.isInstance(e,le)}const pe="ArrayLiteral",fe="elements",me="ArrayType",ge="elementType",ye="Assignment",Te="cardinality",ve="feature",Re="operator",Ee="predicate",Se="terminal";function ke(e){return Nn.isInstance(e,ye)}const Ce="BooleanLiteral",Ae="true";const be="CharacterRange",$e="cardinality",xe="left",we="lookahead",Ne="parenthesized",Ie="right";const _e="Condition",Pe="Conjunction",Le="left",Oe="right";const De="CrossReference",Me="cardinality",Fe="deprecatedSyntax",qe="isMulti",je="terminal",Ue="type";function Ge(e){return Nn.isInstance(e,De)}const ze="Disjunction",Be="left",Ke="right";const We="EndOfFile",Ve="cardinality";const He="Grammar",Ye="imports",Xe="interfaces",Je="isDeclared",Ze="name",Qe="rules",et="types",tt="GrammarImport",rt="path",nt="Group",it="cardinality",st="elements",ot="guardCondition",at="predicate";function ct(e){return Nn.isInstance(e,nt)}const lt="InferredType",ut="name";function dt(e){return Nn.isInstance(e,lt)}const ht="InfixRule",pt="call",ft="dataType",mt="inferredType",gt="name",yt="operators",Tt="parameters",vt="returnType";function Rt(e){return Nn.isInstance(e,ht)}const Et="InfixRuleOperatorList",St="associativity",kt="operators",Ct="InfixRuleOperators",At="precedences",bt="Interface",$t="attributes",xt="name",wt="superTypes";const Nt="Keyword",It="cardinality",_t="predicate",Pt="value";function Lt(e){return Nn.isInstance(e,Nt)}const Ot="NamedArgument",Dt="calledByName",Mt="parameter",Ft="value",qt="NegatedToken",jt="cardinality",Ut="lookahead",Gt="parenthesized",zt="terminal";const Bt="Negation",Kt="value";const Wt="NumberLiteral",Vt="value",Ht="Parameter",Yt="name",Xt="ParameterReference",Jt="parameter";const Zt="ParserRule",Qt="dataType",er="definition",tr="entry",rr="fragment",nr="inferredType",ir="name",sr="parameters",or="returnType";function ar(e){return Nn.isInstance(e,Zt)}const cr="ReferenceType",lr="isMulti",ur="referenceType",dr="RegexToken",hr="cardinality",pr="lookahead",fr="parenthesized",mr="regex";const gr="ReturnType",yr="name";const Tr="RuleCall",vr="arguments",Rr="cardinality",Er="predicate",Sr="rule";function kr(e){return Nn.isInstance(e,Tr)}const Cr="SimpleType",Ar="primitiveType",br="stringType",$r="typeRef";function xr(e){return Nn.isInstance(e,Cr)}const wr="StringLiteral",Nr="value",Ir="TerminalAlternatives",_r="cardinality",Pr="elements",Lr="lookahead",Or="parenthesized";const Dr="TerminalElement",Mr="cardinality",Fr="lookahead",qr="parenthesized",jr="TerminalGroup",Ur="cardinality",Gr="elements",zr="lookahead",Br="parenthesized";const Kr="TerminalRule",Wr="definition",Vr="fragment",Hr="hidden",Yr="name",Xr="type";function Jr(e){return Nn.isInstance(e,Kr)}const Zr="TerminalRuleCall",Qr="cardinality",en="lookahead",tn="parenthesized",rn="rule";const nn="Type",sn="name",on="type";const an="TypeAttribute",cn="defaultValue",ln="isOptional",un="name",dn="type",hn="TypeDefinition",pn="UnionType",fn="types",mn="UnorderedGroup",gn="cardinality",yn="elements";function Tn(e){return Nn.isInstance(e,mn)}const vn="UntilToken",Rn="cardinality",En="lookahead",Sn="parenthesized",kn="terminal";const Cn="ValueLiteral",An="Wildcard",bn="cardinality",$n="lookahead",xn="parenthesized";class wn extends A{constructor(){super(...arguments),this.types={AbstractElement:{name:Y,properties:{cardinality:{name:X}},superTypes:[]},AbstractParserRule:{name:Z,properties:{},superTypes:[ee,te]},AbstractRule:{name:ee,properties:{},superTypes:[]},AbstractType:{name:te,properties:{},superTypes:[]},Action:{name:re,properties:{cardinality:{name:ne},feature:{name:ie},inferredType:{name:se},operator:{name:oe},type:{name:ae,referenceType:te}},superTypes:[Y]},Alternatives:{name:le,properties:{cardinality:{name:ue},elements:{name:de,defaultValue:[]}},superTypes:[Y]},ArrayLiteral:{name:pe,properties:{elements:{name:fe,defaultValue:[]}},superTypes:[Cn]},ArrayType:{name:me,properties:{elementType:{name:ge}},superTypes:[hn]},Assignment:{name:ye,properties:{cardinality:{name:Te},feature:{name:ve},operator:{name:Re},predicate:{name:Ee},terminal:{name:Se}},superTypes:[Y]},BooleanLiteral:{name:Ce,properties:{true:{name:Ae,defaultValue:!1}},superTypes:[_e,Cn]},CharacterRange:{name:be,properties:{cardinality:{name:$e},left:{name:xe},lookahead:{name:we},parenthesized:{name:Ne,defaultValue:!1},right:{name:Ie}},superTypes:[Dr]},Condition:{name:_e,properties:{},superTypes:[]},Conjunction:{name:Pe,properties:{left:{name:Le},right:{name:Oe}},superTypes:[_e]},CrossReference:{name:De,properties:{cardinality:{name:Me},deprecatedSyntax:{name:Fe,defaultValue:!1},isMulti:{name:qe,defaultValue:!1},terminal:{name:je},type:{name:Ue,referenceType:te}},superTypes:[Y]},Disjunction:{name:ze,properties:{left:{name:Be},right:{name:Ke}},superTypes:[_e]},EndOfFile:{name:We,properties:{cardinality:{name:Ve}},superTypes:[Y]},Grammar:{name:He,properties:{imports:{name:Ye,defaultValue:[]},interfaces:{name:Xe,defaultValue:[]},isDeclared:{name:Je,defaultValue:!1},name:{name:Ze},rules:{name:Qe,defaultValue:[]},types:{name:et,defaultValue:[]}},superTypes:[]},GrammarImport:{name:tt,properties:{path:{name:rt}},superTypes:[]},Group:{name:nt,properties:{cardinality:{name:it},elements:{name:st,defaultValue:[]},guardCondition:{name:ot},predicate:{name:at}},superTypes:[Y]},InferredType:{name:lt,properties:{name:{name:ut}},superTypes:[te]},InfixRule:{name:ht,properties:{call:{name:pt},dataType:{name:ft},inferredType:{name:mt},name:{name:gt},operators:{name:yt},parameters:{name:Tt,defaultValue:[]},returnType:{name:vt,referenceType:te}},superTypes:[Z]},InfixRuleOperatorList:{name:Et,properties:{associativity:{name:St},operators:{name:kt,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:Ct,properties:{precedences:{name:At,defaultValue:[]}},superTypes:[]},Interface:{name:bt,properties:{attributes:{name:$t,defaultValue:[]},name:{name:xt},superTypes:{name:wt,defaultValue:[],referenceType:te}},superTypes:[te]},Keyword:{name:Nt,properties:{cardinality:{name:It},predicate:{name:_t},value:{name:Pt}},superTypes:[Y]},NamedArgument:{name:Ot,properties:{calledByName:{name:Dt,defaultValue:!1},parameter:{name:Mt,referenceType:Ht},value:{name:Ft}},superTypes:[]},NegatedToken:{name:qt,properties:{cardinality:{name:jt},lookahead:{name:Ut},parenthesized:{name:Gt,defaultValue:!1},terminal:{name:zt}},superTypes:[Dr]},Negation:{name:Bt,properties:{value:{name:Kt}},superTypes:[_e]},NumberLiteral:{name:Wt,properties:{value:{name:Vt}},superTypes:[Cn]},Parameter:{name:Ht,properties:{name:{name:Yt}},superTypes:[]},ParameterReference:{name:Xt,properties:{parameter:{name:Jt,referenceType:Ht}},superTypes:[_e]},ParserRule:{name:Zt,properties:{dataType:{name:Qt},definition:{name:er},entry:{name:tr,defaultValue:!1},fragment:{name:rr,defaultValue:!1},inferredType:{name:nr},name:{name:ir},parameters:{name:sr,defaultValue:[]},returnType:{name:or,referenceType:te}},superTypes:[Z]},ReferenceType:{name:cr,properties:{isMulti:{name:lr,defaultValue:!1},referenceType:{name:ur}},superTypes:[hn]},RegexToken:{name:dr,properties:{cardinality:{name:hr},lookahead:{name:pr},parenthesized:{name:fr,defaultValue:!1},regex:{name:mr}},superTypes:[Dr]},ReturnType:{name:gr,properties:{name:{name:yr}},superTypes:[]},RuleCall:{name:Tr,properties:{arguments:{name:vr,defaultValue:[]},cardinality:{name:Rr},predicate:{name:Er},rule:{name:Sr,referenceType:ee}},superTypes:[Y]},SimpleType:{name:Cr,properties:{primitiveType:{name:Ar},stringType:{name:br},typeRef:{name:$r,referenceType:te}},superTypes:[hn]},StringLiteral:{name:wr,properties:{value:{name:Nr}},superTypes:[Cn]},TerminalAlternatives:{name:Ir,properties:{cardinality:{name:_r},elements:{name:Pr,defaultValue:[]},lookahead:{name:Lr},parenthesized:{name:Or,defaultValue:!1}},superTypes:[Dr]},TerminalElement:{name:Dr,properties:{cardinality:{name:Mr},lookahead:{name:Fr},parenthesized:{name:qr,defaultValue:!1}},superTypes:[Y]},TerminalGroup:{name:jr,properties:{cardinality:{name:Ur},elements:{name:Gr,defaultValue:[]},lookahead:{name:zr},parenthesized:{name:Br,defaultValue:!1}},superTypes:[Dr]},TerminalRule:{name:Kr,properties:{definition:{name:Wr},fragment:{name:Vr,defaultValue:!1},hidden:{name:Hr,defaultValue:!1},name:{name:Yr},type:{name:Xr}},superTypes:[ee]},TerminalRuleCall:{name:Zr,properties:{cardinality:{name:Qr},lookahead:{name:en},parenthesized:{name:tn,defaultValue:!1},rule:{name:rn,referenceType:Kr}},superTypes:[Dr]},Type:{name:nn,properties:{name:{name:sn},type:{name:on}},superTypes:[te]},TypeAttribute:{name:an,properties:{defaultValue:{name:cn},isOptional:{name:ln,defaultValue:!1},name:{name:un},type:{name:dn}},superTypes:[]},TypeDefinition:{name:hn,properties:{},superTypes:[]},UnionType:{name:pn,properties:{types:{name:fn,defaultValue:[]}},superTypes:[hn]},UnorderedGroup:{name:mn,properties:{cardinality:{name:gn},elements:{name:yn,defaultValue:[]}},superTypes:[Y]},UntilToken:{name:vn,properties:{cardinality:{name:Rn},lookahead:{name:En},parenthesized:{name:Sn,defaultValue:!1},terminal:{name:kn}},superTypes:[Dr]},ValueLiteral:{name:Cn,properties:{},superTypes:[]},Wildcard:{name:An,properties:{cardinality:{name:bn},lookahead:{name:$n},parenthesized:{name:xn,defaultValue:!1}},superTypes:[Dr]}}}}const Nn=new wn;function In(e){return new O(e,e=>b(e)?e.content:[],{includeRoot:!0})}function _n(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function Pn(e){if(!e)return;const{offset:t,end:r,range:n}=e;return{range:n,offset:t,end:r,length:r-t}}var Ln,On;(On=Ln||(Ln={}))[On.Before=0]="Before",On[On.After=1]="After",On[On.OverlapFront=2]="OverlapFront",On[On.OverlapBack=3]="OverlapBack",On[On.Inside=4]="Inside",On[On.Outside=5]="Outside";const Dn=/^[\w\p{L}]$/u;function Mn(e,t){return $(e)&&t.includes(e.tokenType.name)}class Fn extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function qn(e,t="Error: Got unexpected value."){throw new Error(t)}function jn(e){return e.charCodeAt(0)}function Un(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function Gn(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function zn(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function Bn(e){return"Character"===e.type}const Kn=[];for(let WS=jn("0");WS<=jn("9");WS++)Kn.push(WS);const Wn=[jn("_")].concat(Kn);for(let WS=jn("a");WS<=jn("z");WS++)Wn.push(WS);for(let WS=jn("A");WS<=jn("Z");WS++)Wn.push(WS);const Vn=[jn(" "),jn("\f"),jn("\n"),jn("\r"),jn("\t"),jn("\v"),jn("\t"),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn(" "),jn("\u2028"),jn("\u2029"),jn(" "),jn(" "),jn(" "),jn("\ufeff")],Hn=/[0-9a-fA-F]/,Yn=/[0-9]/,Xn=/[1-9]/;class Jn{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 r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Gn(r,"global");break;case"i":Gn(r,"ignoreCase");break;case"m":Gn(r,"multiLine");break;case"u":Gn(r,"unicode");break;case"y":Gn(r,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,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";break;case"<":switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}}zn(t);const r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return function(){throw Error("Internal Error - Should never get here!")}()}quantifier(e=!1){let t;const r=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 r=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:r,atMost:r};break;case",":let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:r,atMost:e}):t={atLeast:r,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;zn(t)}if(!0!==e||void 0!==t)return zn(t)?("?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),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()),zn(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[jn("\n"),jn("\r"),jn("\u2028"),jn("\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=Kn;break;case"D":e=Kn,t=!0;break;case"s":e=Vn;break;case"S":e=Vn,t=!0;break;case"w":e=Wn;break;case"W":e=Wn,t=!0}if(zn(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=jn("\f");break;case"n":e=jn("\n");break;case"r":e=jn("\r");break;case"t":e=jn("\t");break;case"v":e=jn("\v")}if(zn(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:jn("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:jn(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:jn(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,Bn(t)&&this.isRangeDash()){this.consumeChar("-");const r=this.classAtom();if(r.type,Bn(r)){if(r.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:r.value})}else Un(t.value,e),e.push(jn("-")),Un(r.value,e)}else Un(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:jn("\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 r={type:"Group",capturing:e,value:t};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(!1===Xn.test(e))throw Error("Expecting a positive integer");for(;Yn.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===Yn.test(e))throw Error("Expecting an integer");for(;Yn.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:jn(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 Yn.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)||"<"===this.peekChar(2)&&("="===this.peekChar(3)||"!"===this.peekChar(3)));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 r=0;r<e;r++){const e=this.popChar();if(!1===Hn.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 Zn{visitChildren(e){for(const t in e){const r=e[t];e.hasOwnProperty(t)&&(void 0!==r.type?this.visit(r):Array.isArray(r)&&r.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"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const Qn=/\r?\n/gm,ei=new Jn;const ti=new class extends Zn{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=si(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),r=new RegExp(t);this.multiline=Boolean("\n".match(r))}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 ri(e){try{return"string"==typeof e&&(e=new RegExp(e)),e=e.toString(),ti.reset(e),ti.visit(ei.pattern(e)),ti.multiline}catch{return!1}}const ni="\f\n\r\t\v \u2028\u2029 \ufeff".split("");function ii(e){const t="string"==typeof e?new RegExp(e):e;return ni.some(e=>t.test(e))}function si(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oi(e,t){const r=function(e){"string"==typeof e&&(e=new RegExp(e));const t=e,r=e.source;let n=0;function i(){let e,s="";function o(e){s+=r.substr(n,e),n+=e}function a(e){s+="(?:"+r.substr(n,e)+"|$)",n+=e}for(;n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":a(3);break;case"x":a(4);break;case"u":t.unicode?"{"===r[n+2]?a(r.indexOf("}",n)-n+1):a(6):a(2);break;case"p":case"P":t.unicode?a(r.indexOf("}",n)-n+1):a(2);break;case"k":a(r.indexOf(">",n)-n+1);break;default:a(2)}break;case"[":e=/\[(?:\\.|.)*?\]/g,e.lastIndex=n,e=e.exec(r)||[],a(e[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":e=/\{\d+,?\d*\}/g,e.lastIndex=n,e=e.exec(r),e?o(e[0].length):a(1);break;case"(":if("?"===r[n+1])switch(r[n+2]){case":":s+="(?:",n+=3,s+=i()+"|$)";break;case"=":s+="(?=",n+=3,s+=i()+")";break;case"!":e=n,n+=3,i(),s+=r.substr(e,n-e);break;case"<":switch(r[n+3]){case"=":case"!":e=n,n+=4,i(),s+=r.substr(e,n-e);break;default:o(r.indexOf(">",n)-n+1),s+=i()+"|$)"}}else o(1),s+=i()+"|$)";break;case")":return++n,s;default:a(1)}return s}return new RegExp(i(),e.flags)}(e),n=t.match(r);return!!n&&n[0].length>0}function ai(e,t){const r=new Set,n=function(e){return e.rules.find(e=>ar(e)&&e.entry)}(e);if(!n)return new Set(e.rules);const i=[n].concat(function(e){return e.rules.filter(e=>Jr(e)&&e.hidden)}(e));for(const o of i)ci(o,r,t);const s=new Set;for(const o of e.rules)(r.has(o.name)||Jr(o)&&o.hidden)&&s.add(o);return s}function ci(e,t,r){t.add(e.name),B(e).forEach(e=>{if(kr(e)||r){const n=e.rule.ref;n&&!t.has(n.name)&&ci(n,t,r)}})}function li(e){return e.hidden&&!ii(vi(e))}function ui(e,t,r){if(!e||!t)return;const n=di(e,t,e.astNode,!0);return 0!==n.length?n[r=void 0!==r?Math.max(0,Math.min(r,n.length-1)):0]:void 0}function di(e,t,r,n){if(!n){const r=q(e.grammarSource,ke);if(r&&r.feature===t)return[e]}return b(e)&&e.astNode===r?e.content.flatMap(e=>di(e,t,r,!1)):[]}function hi(e,t,r){if(!e)return;const n=function(e,t,r){if(e.astNode!==r)return[];if(Lt(e.grammarSource)&&e.grammarSource.value===t)return[e];const n=In(e).iterator();let i;const s=[];do{if(i=n.next(),!i.done){const e=i.value;e.astNode===r?Lt(e.grammarSource)&&e.grammarSource.value===t&&s.push(e):n.prune()}}while(!i.done);return s}(e,t,null==e?void 0:e.astNode);return 0!==n.length?n[r=void 0!==r?Math.max(0,Math.min(r,n.length-1)):0]:void 0}function pi(e){let t=e;return dt(t)&&(ce(t.$container)?t=t.$container.$container:Q(t.$container)?t=t.$container:qn(t.$container)),fi(e,t,new Map)}function fi(e,t,r){var n;function i(t,n){let i;return q(t,ke)||(i=fi(n,n,r)),r.set(e,i),i}if(r.has(e))return r.get(e);r.set(e,void 0);for(const s of B(t)){if(ke(s)&&"name"===s.feature.toLowerCase())return r.set(e,s),s;if(kr(s)&&ar(s.rule.ref))return i(s,s.rule.ref);if(xr(s)&&(null==(n=s.typeRef)?void 0:n.ref))return i(s,s.typeRef.ref)}}function mi(e){return gi(e,new Set)}function gi(e,t){if(t.has(e))return!0;t.add(e);for(const r of B(e))if(kr(r)){if(!r.rule.ref)return!1;if(ar(r.rule.ref)&&!gi(r.rule.ref,t))return!1;if(Rt(r.rule.ref))return!1}else{if(ke(r))return!1;if(ce(r))return!1}return Boolean(e.definition)}function yi(e){if(!Jr(e)){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){const t=e.returnType.ref;if(t)return t.name}}}function Ti(e){if(Q(e))return ar(e)&&mi(e)?e.name:yi(e)??e.name;if(t=e,Nn.isInstance(t,bt)||function(e){return Nn.isInstance(e,nn)}(e)||function(e){return Nn.isInstance(e,gr)}(e))return e.name;if(ce(e)){const t=function(e){var t;if(e.inferredType)return e.inferredType.name;if(null==(t=e.type)?void 0:t.ref)return Ti(e.type.ref);return}(e);if(t)return t}else if(dt(e))return e.name;var t;throw new Error("Cannot get name of Unknown Type")}function vi(e){const t={s:!1,i:!1,u:!1},r=Ei(e.definition,t),n=Object.entries(t).filter(([,e])=>e).map(([e])=>e).join("");return new RegExp(r,n)}const Ri=/[\s\S]/.source;function Ei(e,t){var r,n,i,s,o,a;if(a=e,Nn.isInstance(a,Ir))return ki((o=e).elements.map(e=>Ei(e)).join("|"),{cardinality:o.cardinality,lookahead:o.lookahead,parenthesized:o.parenthesized,wrap:!1});if(function(e){return Nn.isInstance(e,jr)}(e))return ki((s=e).elements.map(e=>Ei(e)).join(""),{cardinality:s.cardinality,lookahead:s.lookahead,parenthesized:s.parenthesized,wrap:!1});if(function(e){return Nn.isInstance(e,be)}(e))return function(e){if(e.right)return ki(`[${Si(e.left)}-${Si(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1});return ki(Si(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}(e);if(function(e){return Nn.isInstance(e,Zr)}(e)){const t=e.rule.ref;if(!t)throw new Error("Missing rule reference.");return ki(Ei(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}if(function(e){return Nn.isInstance(e,qt)}(e))return ki(`(?!${Ei((i=e).terminal)})${Ri}*?`,{cardinality:i.cardinality,lookahead:i.lookahead,parenthesized:i.parenthesized});if(function(e){return Nn.isInstance(e,vn)}(e))return ki(`${Ri}*?${Ei((n=e).terminal)}`,{cardinality:n.cardinality,lookahead:n.lookahead,parenthesized:n.parenthesized});if(function(e){return Nn.isInstance(e,dr)}(e)){const r=e.regex.lastIndexOf("/"),n=e.regex.substring(1,r),i=e.regex.substring(r+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),ki(n,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}if(function(e){return Nn.isInstance(e,An)}(e))return ki(Ri,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized});throw new Error(`Invalid terminal element: ${null==e?void 0:e.$type}, ${null==(r=null==e?void 0:e.$cstNode)?void 0:r.text}`)}function Si(e){return si(e.value)}function ki(e,t){if(t.parenthesized||t.lookahead||!1!==t.wrap){e=`(${t.lookahead??(t.parenthesized?"":"?:")}${e})`}return t.cardinality?`${e}${t.cardinality}`:e}function Ci(e){console&&console.error&&console.error(`Error: ${e}`)}function Ai(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function bi(e){const t=(new Date).getTime(),r=e();return{time:(new Date).getTime()-t,value:r}}function $i(e){function t(){}t.prototype=e;const r=new t;function n(){return typeof r.bar}return n(),n(),e}function xi(e){return t=e,T.isString(t.LABEL)&&""!==t.LABEL?e.LABEL:e.name;var t}class wi{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),T.forEach(this.definition,t=>{t.accept(e)})}}class Ni extends wi{constructor(e){super([]),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Ii extends wi{constructor(e){super(e.definition),this.orgText="",T.assign(this,T.pickBy(e,e=>void 0!==e))}}class _i extends wi{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}let Pi=class extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}};class Li extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Oi extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Di extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Mi extends wi{constructor(e){super(e.definition),this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class Fi extends wi{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,T.assign(this,T.pickBy(e,e=>void 0!==e))}}class qi{constructor(e){this.idx=1,T.assign(this,T.pickBy(e,e=>void 0!==e))}accept(e){e.visit(this)}}function ji(e){function t(e){return T.map(e,ji)}if(e instanceof Ni){const t={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return T.isString(e.label)&&(t.label=e.label),t}if(e instanceof _i)return{type:"Alternative",definition:t(e.definition)};if(e instanceof Pi)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof Li)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof Oi)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:ji(new qi({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Mi)return{type:"RepetitionWithSeparator",idx:e.idx,separator:ji(new qi({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof Di)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof Fi)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof qi){const t={type:"Terminal",name:e.terminalType.name,label:xi(e.terminalType),idx:e.idx};T.isString(e.label)&&(t.terminalLabel=e.label);const r=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=T.isRegExp(r)?r.source:r),t}if(e instanceof Ii)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}class Ui{visit(e){const t=e;switch(t.constructor){case Ni:return this.visitNonTerminal(t);case _i:return this.visitAlternative(t);case Pi:return this.visitOption(t);case Li:return this.visitRepetitionMandatory(t);case Oi:return this.visitRepetitionMandatoryWithSeparator(t);case Mi:return this.visitRepetitionWithSeparator(t);case Di:return this.visitRepetition(t);case Fi:return this.visitAlternation(t);case qi:return this.visitTerminal(t);case Ii: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 Gi(e,t=[]){return!!(e instanceof Pi||e instanceof Di||e instanceof Mi)||(e instanceof Fi?T.some(e.definition,e=>Gi(e,t)):!(e instanceof Ni&&T.includes(t,e))&&(e instanceof wi&&(e instanceof Ni&&t.push(e),T.every(e.definition,e=>Gi(e,t)))))}function zi(e){if(e instanceof Ni)return"SUBRULE";if(e instanceof Pi)return"OPTION";if(e instanceof Fi)return"OR";if(e instanceof Li)return"AT_LEAST_ONE";if(e instanceof Oi)return"AT_LEAST_ONE_SEP";if(e instanceof Mi)return"MANY_SEP";if(e instanceof Di)return"MANY";if(e instanceof qi)return"CONSUME";throw Error("non exhaustive match")}class Bi{walk(e,t=[]){T.forEach(e.definition,(r,n)=>{const i=T.drop(e.definition,n+1);if(r instanceof Ni)this.walkProdRef(r,i,t);else if(r instanceof qi)this.walkTerminal(r,i,t);else if(r instanceof _i)this.walkFlat(r,i,t);else if(r instanceof Pi)this.walkOption(r,i,t);else if(r instanceof Li)this.walkAtLeastOne(r,i,t);else if(r instanceof Oi)this.walkAtLeastOneSep(r,i,t);else if(r instanceof Mi)this.walkManySep(r,i,t);else if(r instanceof Di)this.walkMany(r,i,t);else{if(!(r instanceof Fi))throw Error("non exhaustive match");this.walkOr(r,i,t)}})}walkTerminal(e,t,r){}walkProdRef(e,t,r){}walkFlat(e,t,r){const n=t.concat(r);this.walk(e,n)}walkOption(e,t,r){const n=t.concat(r);this.walk(e,n)}walkAtLeastOne(e,t,r){const n=[new Pi({definition:e.definition})].concat(t,r);this.walk(e,n)}walkAtLeastOneSep(e,t,r){const n=Ki(e,t,r);this.walk(e,n)}walkMany(e,t,r){const n=[new Pi({definition:e.definition})].concat(t,r);this.walk(e,n)}walkManySep(e,t,r){const n=Ki(e,t,r);this.walk(e,n)}walkOr(e,t,r){const n=t.concat(r);T.forEach(e.definition,e=>{const t=new _i({definition:[e]});this.walk(t,n)})}}function Ki(e,t,r){return[new Pi({definition:[new qi({terminalType:e.separator})].concat(e.definition)})].concat(t,r)}function Wi(e){if(e instanceof Ni)return Wi(e.referencedRule);if(e instanceof qi)return[e.terminalType];if(function(e){return e instanceof _i||e instanceof Pi||e instanceof Di||e instanceof Li||e instanceof Oi||e instanceof Mi||e instanceof qi||e instanceof Ii}(e))return function(e){let t=[];const r=e.definition;let n,i=0,s=r.length>i,o=!0;for(;s&&o;)n=r[i],o=Gi(n),t=t.concat(Wi(n)),i+=1,s=r.length>i;return T.uniq(t)}(e);if(function(e){return e instanceof Fi}(e))return function(e){const t=T.map(e.definition,e=>Wi(e));return T.uniq(T.flatten(t))}(e);throw Error("non exhaustive match")}const Vi="_~IN~_";class Hi extends Bi{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,r){}walkProdRef(e,t,r){const n=(i=e.referencedRule,s=e.idx,i.name+s+Vi+this.topProd.name);var i,s;const o=t.concat(r),a=Wi(new _i({definition:o}));this.follows[n]=a}}let Yi={};const Xi=new Jn;function Ji(e){const t=e.toString();if(Yi.hasOwnProperty(t))return Yi[t];{const e=Xi.pattern(t);return Yi[t]=e,e}}const Zi="Complement Sets are not supported for first char optimization",Qi='Unable to use "first char" lexer optimizations:\n';function es(e,t=!1){try{const t=Ji(e);return ts(t.value,{},t.flags.ignoreCase)}catch(r){if(r.message===Zi)t&&Ai(`${Qi}\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 r="";t&&(r="\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."),Ci(`${Qi}\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`+r)}}return[]}function ts(e,t,r){switch(e.type){case"Disjunction":for(let i=0;i<e.value.length;i++)ts(e.value[i],t,r);break;case"Alternative":const n=e.value;for(let e=0;e<n.length;e++){const i=n[e];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=i;switch(s.type){case"Character":rs(s.value,t,r);break;case"Set":if(!0===s.complement)throw Error(Zi);T.forEach(s.value,e=>{if("number"==typeof e)rs(e,t,r);else{const n=e;if(!0===r)for(let e=n.from;e<=n.to;e++)rs(e,t,r);else{for(let e=n.from;e<=n.to&&e<Cs;e++)rs(e,t,r);if(n.to>=Cs){const e=n.from>=Cs?n.from:Cs,r=n.to,i=bs(e),s=bs(r);for(let n=i;n<=s;n++)t[n]=n}}}});break;case"Group":ts(s.value,t,r);break;default:throw Error("Non Exhaustive Match")}const o=void 0!==s.quantifier&&0===s.quantifier.atLeast;if("Group"===s.type&&!1===is(s)||"Group"!==s.type&&!1===o)break}break;default:throw Error("non exhaustive match!")}return T.values(t)}function rs(e,t,r){const n=bs(e);t[n]=n,!0===r&&function(e,t){const r=String.fromCharCode(e),n=r.toUpperCase();if(n!==r){const e=bs(n.charCodeAt(0));t[e]=e}else{const e=r.toLowerCase();if(e!==r){const r=bs(e.charCodeAt(0));t[r]=r}}}(e,t)}function ns(e,t){return T.find(e.value,e=>{if("number"==typeof e)return T.includes(t,e);{const r=e;return void 0!==T.find(t,e=>r.from<=e&&e<=r.to)}})}function is(e){const t=e.quantifier;return!(!t||0!==t.atLeast)||!!e.value&&(T.isArray(e.value)?T.every(e.value,is):is(e.value))}class ss extends Zn{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);case"Lookbehind":return void this.visitLookbehind(e);case"NegativeLookbehind":return void this.visitNegativeLookbehind(e)}super.visitChildren(e)}}visitCharacter(e){T.includes(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===ns(e,this.targetCharCodes)&&(this.found=!0):void 0!==ns(e,this.targetCharCodes)&&(this.found=!0)}}function os(e,t){if(t instanceof RegExp){const r=Ji(t),n=new ss(e);return n.visit(r),n.found}return void 0!==T.find(t,t=>T.includes(e,t.charCodeAt(0)))}const as="PATTERN",cs="defaultMode",ls="modes";let us="boolean"==typeof new RegExp("(?:)").sticky;function ds(e,t){const r=(t=T.defaults(t,{useSticky:us,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer;let n;r("initCharCodeToOptimizedIndexMap",()=>{!function(){if(T.isEmpty(As)){As=new Array(65536);for(let e=0;e<65536;e++)As[e]=e>255?255+~~(e/255):e}}()}),r("Reject Lexer.NA",()=>{n=T.reject(e,e=>e[as]===js.NA)});let i,s,o,a,c,l,u,d,h,p,f,m=!1;r("Transform Patterns",()=>{m=!1,i=T.map(n,e=>{const r=e[as];if(T.isRegExp(r)){const e=r.source;return 1!==e.length||"^"===e||"$"===e||"."===e||r.ignoreCase?2!==e.length||"\\"!==e[0]||T.includes(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?t.useSticky?gs(r):ms(r):e[1]:e}if(T.isFunction(r))return m=!0,{exec:r};if("object"==typeof r)return m=!0,r;if("string"==typeof r){if(1===r.length)return r;{const e=r.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=new RegExp(e);return t.useSticky?gs(n):ms(n)}}throw Error("non exhaustive match")})}),r("misc mapping",()=>{s=T.map(n,e=>e.tokenTypeIdx),o=T.map(n,e=>{const t=e.GROUP;if(t!==js.SKIPPED){if(T.isString(t))return t;if(T.isUndefined(t))return!1;throw Error("non exhaustive match")}}),a=T.map(n,e=>{const t=e.LONGER_ALT;if(t){return T.isArray(t)?T.map(t,e=>T.indexOf(n,e)):[T.indexOf(n,t)]}}),c=T.map(n,e=>e.PUSH_MODE),l=T.map(n,e=>T.has(e,"POP_MODE"))}),r("Line Terminator Handling",()=>{const e=Ss(t.lineTerminatorCharacters);u=T.map(n,e=>!1),"onlyOffset"!==t.positionTracking&&(u=T.map(n,t=>T.has(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===Es(t,e)&&os(e,t.PATTERN)))}),r("Misc Mapping #2",()=>{d=T.map(n,Ts),h=T.map(i,vs),p=T.reduce(n,(e,t)=>{const r=t.GROUP;return T.isString(r)&&r!==js.SKIPPED&&(e[r]=[]),e},{}),f=T.map(i,(e,t)=>({pattern:i[t],longerAlt:a[t],canLineTerminator:u[t],isCustom:d[t],short:h[t],group:o[t],push:c[t],pop:l[t],tokenTypeIdx:s[t],tokenType:n[t]}))});let g=!0,y=[];return t.safeMode||r("First Char Optimization",()=>{y=T.reduce(n,(e,r,n)=>{if("string"==typeof r.PATTERN){const t=bs(r.PATTERN.charCodeAt(0));ks(e,t,f[n])}else if(T.isArray(r.START_CHARS_HINT)){let t;T.forEach(r.START_CHARS_HINT,r=>{const i=bs("string"==typeof r?r.charCodeAt(0):r);t!==i&&(t=i,ks(e,i,f[n]))})}else if(T.isRegExp(r.PATTERN))if(r.PATTERN.unicode)g=!1,t.ensureOptimizations&&Ci(`${Qi}\tUnable to analyze < ${r.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=es(r.PATTERN,t.ensureOptimizations);T.isEmpty(i)&&(g=!1),T.forEach(i,t=>{ks(e,t,f[n])})}else t.ensureOptimizations&&Ci(`${Qi}\tTokenType: <${r.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 hs(e,t){let r=[];const n=function(e){const t=T.filter(e,e=>!T.has(e,as)),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:Ms.MISSING_PATTERN,tokenTypes:[e]})),n=T.difference(e,t);return{errors:r,valid:n}}(e);r=r.concat(n.errors);const i=function(e){const t=T.filter(e,e=>{const t=e[as];return!(T.isRegExp(t)||T.isFunction(t)||T.has(t,"exec")||T.isString(t))}),r=T.map(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:Ms.INVALID_PATTERN,tokenTypes:[e]})),n=T.difference(e,t);return{errors:r,valid:n}}(n.valid),s=i.valid;return r=r.concat(i.errors),r=r.concat(function(e){let t=[];const r=T.filter(e,e=>T.isRegExp(e[as]));return t=t.concat(function(e){class t extends Zn{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}const r=T.filter(e,e=>{const r=e.PATTERN;try{const e=Ji(r),n=new t;return n.visit(e),n.found}catch(n){return ps.test(r.source)}}),n=T.map(r,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:Ms.EOI_ANCHOR_FOUND,tokenTypes:[e]}));return n}(r)),t=t.concat(function(e){class t extends Zn{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}const r=T.filter(e,e=>{const r=e.PATTERN;try{const e=Ji(r),n=new t;return n.visit(e),n.found}catch(n){return fs.test(r.source)}}),n=T.map(r,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:Ms.SOI_ANCHOR_FOUND,tokenTypes:[e]}));return n}(r)),t=t.concat(function(e){const t=T.filter(e,e=>{const t=e[as];return t instanceof RegExp&&(t.multiline||t.global)}),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Ms.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}));return r}(r)),t=t.concat(function(e){const t=[];let r=T.map(e,r=>T.reduce(e,(e,n)=>(r.PATTERN.source!==n.PATTERN.source||T.includes(t,n)||n.PATTERN===js.NA||(t.push(n),e.push(n)),e),[]));r=T.compact(r);const n=T.filter(r,e=>e.length>1),i=T.map(n,e=>{const t=T.map(e,e=>e.name);return{message:`The same RegExp pattern ->${T.first(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:Ms.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}});return i}(r)),t=t.concat(function(e){const t=T.filter(e,e=>e.PATTERN.test("")),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:Ms.EMPTY_MATCH_PATTERN,tokenTypes:[e]}));return r}(r)),t}(s)),r=r.concat(function(e){const t=T.filter(e,e=>{if(!T.has(e,"GROUP"))return!1;const t=e.GROUP;return t!==js.SKIPPED&&t!==js.NA&&!T.isString(t)}),r=T.map(t,e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Ms.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}));return r}(s)),r=r.concat(function(e,t){const r=T.filter(e,e=>void 0!==e.PUSH_MODE&&!T.includes(t,e.PUSH_MODE)),n=T.map(r,e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:Ms.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}));return n}(s,t)),r=r.concat(function(e){const t=[],r=T.reduce(e,(e,t,r)=>{const n=t.PATTERN;return n===js.NA||(T.isString(n)?e.push({str:n,idx:r,tokenType:t}):T.isRegExp(n)&&function(e){const t=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return void 0===T.find(t,t=>-1!==e.source.indexOf(t))}(n)&&e.push({str:n.source,idx:r,tokenType:t})),e},[]);return T.forEach(e,(e,n)=>{T.forEach(r,({str:r,idx:i,tokenType:s})=>{if(n<i&&function(e,t){if(T.isRegExp(t)){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source))return!1;const r=t.exec(e);return null!==r&&0===r.index}if(T.isFunction(t))return t(e,0,[],{});if(T.has(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(r,e.PATTERN)){const r=`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:r,type:Ms.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}})}),t}(s)),r}const ps=/[^\\][$]/;const fs=/[^\\[][\^]|^\^/;function ms(e){const t=e.ignoreCase?"i":"";return new RegExp(`^(?:${e.source})`,t)}function gs(e){const t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}function ys(e,t,r){const n=[];let i=!1;const s=T.compact(T.flatten(T.values(e.modes))),o=T.reject(s,e=>e[as]===js.NA),a=Ss(r);return t&&T.forEach(o,e=>{const t=Es(e,a);if(!1!==t){const r=function(e,t){if(t.issue===Ms.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===Ms.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:r,type:t.issue,tokenType:e};n.push(i)}else T.has(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(i=!0):os(a,e.PATTERN)&&(i=!0)}),t&&!i&&n.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:Ms.NO_LINE_BREAKS_FLAGS}),n}function Ts(e){const t=e.PATTERN;if(T.isRegExp(t))return!1;if(T.isFunction(t))return!0;if(T.has(t,"exec"))return!0;if(T.isString(t))return!1;throw Error("non exhaustive match")}function vs(e){return!(!T.isString(e)||1!==e.length)&&e.charCodeAt(0)}const Rs={test:function(e){const t=e.length;for(let r=this.lastIndex;r<t;r++){const t=e.charCodeAt(r);if(10===t)return this.lastIndex=r+1,!0;if(13===t)return 10===e.charCodeAt(r+1)?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},lastIndex:0};function Es(e,t){if(T.has(e,"LINE_BREAKS"))return!1;if(T.isRegExp(e.PATTERN)){try{os(t,e.PATTERN)}catch(r){return{issue:Ms.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}if(T.isString(e.PATTERN))return!1;if(Ts(e))return{issue:Ms.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function Ss(e){return T.map(e,e=>T.isString(e)?e.charCodeAt(0):e)}function ks(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}const Cs=256;let As=[];function bs(e){return e<Cs?e:As[e]}function $s(e,t){const r=e.tokenTypeIdx;return r===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[r]}function xs(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let ws=1;const Ns={};function Is(e){const t=function(e){let t=T.clone(e),r=e,n=!0;for(;n;){r=T.compact(T.flatten(T.map(r,e=>e.CATEGORIES)));const e=T.difference(r,t);t=t.concat(e),T.isEmpty(e)?n=!1:r=e}return t}(e);!function(e){T.forEach(e,e=>{var t;Ps(e)||(Ns[ws]=e,e.tokenTypeIdx=ws++),Ls(e)&&!T.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Ls(e)||(e.CATEGORIES=[]),t=e,T.has(t,"categoryMatches")||(e.categoryMatches=[]),function(e){return T.has(e,"categoryMatchesMap")}(e)||(e.categoryMatchesMap={})})}(t),function(e){T.forEach(e,e=>{_s([],e)})}(t),function(e){T.forEach(e,e=>{e.categoryMatches=[],T.forEach(e.categoryMatchesMap,(t,r)=>{e.categoryMatches.push(Ns[r].tokenTypeIdx)})})}(t),T.forEach(t,e=>{e.isParent=e.categoryMatches.length>0})}function _s(e,t){T.forEach(e,e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),T.forEach(t.CATEGORIES,r=>{const n=e.concat(t);T.includes(n,r)||_s(n,r)})}function Ps(e){return T.has(e,"tokenTypeIdx")}function Ls(e){return T.has(e,"CATEGORIES")}function Os(e){return T.has(e,"tokenTypeIdx")}const Ds={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,r,n,i,s)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${r} characters.`};var Ms,Fs;(Fs=Ms||(Ms={}))[Fs.MISSING_PATTERN=0]="MISSING_PATTERN",Fs[Fs.INVALID_PATTERN=1]="INVALID_PATTERN",Fs[Fs.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",Fs[Fs.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",Fs[Fs.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",Fs[Fs.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",Fs[Fs.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",Fs[Fs.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",Fs[Fs.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",Fs[Fs.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",Fs[Fs.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",Fs[Fs.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",Fs[Fs.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",Fs[Fs.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",Fs[Fs.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",Fs[Fs.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",Fs[Fs.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",Fs[Fs.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const qs={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Ds,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(qs);class js{constructor(e,t=qs){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 r=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--\x3e <${e}>`);const{time:n,value:i}=bi(t),s=n>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${r}<-- <${e}> time: ${n}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=T.assign({},qs,t);const r=this.config.traceInitPerf;!0===r?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof r&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let r,n=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===qs.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Rs;else if(this.config.lineTerminatorCharacters===qs.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),T.isArray(e)?r={modes:{defaultMode:T.clone(e)},defaultMode:cs}:(n=!1,r=T.clone(e))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){const t=[];return T.has(e,cs)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+cs+"> property in its definition\n",type:Ms.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),T.has(e,ls)||t.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:Ms.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),T.has(e,ls)&&T.has(e,cs)&&!T.has(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${cs}: <${e.defaultMode}>which does not exist\n`,type:Ms.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),T.has(e,ls)&&T.forEach(e.modes,(e,r)=>{T.forEach(e,(n,i)=>{if(T.isUndefined(n))t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${r}> at index: <${i}>\n`,type:Ms.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(T.has(n,"LONGER_ALT")){const i=T.isArray(n.LONGER_ALT)?n.LONGER_ALT:[n.LONGER_ALT];T.forEach(i,i=>{T.isUndefined(i)||T.includes(e,i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${n.name}> outside of mode <${r}>\n`,type:Ms.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),t}(r,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(ys(r,this.trackStartLines,this.config.lineTerminatorCharacters))})),r.modes=r.modes?r.modes:{},T.forEach(r.modes,(e,t)=>{r.modes[t]=T.reject(e,e=>T.isUndefined(e))});const i=T.keys(r.modes);if(T.forEach(r.modes,(e,r)=>{this.TRACE_INIT(`Mode: <${r}> processing`,()=>{if(this.modes.push(r),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(hs(e,i))}),T.isEmpty(this.lexerDefinitionErrors)){let n;Is(e),this.TRACE_INIT("analyzeTokenTypes",()=>{n=ds(e,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[r]=n.patternIdxToConfig,this.charCodeToPatternIdxToConfig[r]=n.charCodeToPatternIdxToConfig,this.emptyGroups=T.assign({},this.emptyGroups,n.emptyGroups),this.hasCustom=n.hasCustom||this.hasCustom,this.canModeBeOptimized[r]=n.canBeOptimized}})}),this.defaultMode=r.defaultMode,!T.isEmpty(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const e=T.map(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+e)}T.forEach(this.lexerDefinitionWarning,e=>{Ai(e.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(us?(this.chopInput=T.identity,this.match=this.matchWithTest):(this.updateLastIndex=T.noop,this.match=this.matchWithExec),n&&(this.handleModes=T.noop),!1===this.trackStartLines&&(this.computeNewColumn=T.identity),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=T.noop),/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=T.reduce(this.canModeBeOptimized,(e,t,r)=>(!1===t&&e.push(r),e),[]);if(t.ensureOptimizations&&!T.isEmpty(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",()=>{Yi={}}),this.TRACE_INIT("toFastProperties",()=>{$i(this)})})}tokenize(e,t=this.defaultMode){if(!T.isEmpty(this.lexerDefinitionErrors)){const e=T.map(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 r,n,i,s,o,a,c,l,u,d,h,p,f,m,g;const y=e,v=y.length;let R=0,E=0;const S=this.hasCustom?0:Math.floor(e.length/10),k=new Array(S),C=[];let A=this.trackStartLines?1:void 0,b=this.trackStartLines?1:void 0;const $=function(e){const t={},r=T.keys(e);return T.forEach(r,r=>{const n=e[r];if(!T.isArray(n))throw Error("non exhaustive match");t[r]=[]}),t}(this.emptyGroups),x=this.trackStartLines,w=this.config.lineTerminatorsPattern;let N=0,I=[],_=[];const P=[],L=[];let O;function D(){return I}function M(e){const t=bs(e),r=_[t];return void 0===r?L:r}Object.freeze(L);const F=e=>{if(1===P.length&&void 0===e.tokenType.PUSH_MODE){const t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);C.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{P.pop();const e=T.last(P);I=this.patternIdxToConfig[e],_=this.charCodeToPatternIdxToConfig[e],N=I.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=_&&t?M:D}};function q(e){P.push(e),_=this.charCodeToPatternIdxToConfig[e],I=this.patternIdxToConfig[e],N=I.length,N=I.length;const t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=_&&t?M:D}let j;q.call(this,t);const U=this.config.recoveryEnabled;for(;R<v;){a=null;const t=y.charCodeAt(R),S=O(t),_=S.length;for(r=0;r<_;r++){j=S[r];const n=j.pattern;c=null;const u=j.short;if(!1!==u?t===u&&(a=n):!0===j.isCustom?(g=n.exec(y,R,k,$),null!==g?(a=g[0],void 0!==g.payload&&(c=g.payload)):a=null):(this.updateLastIndex(n,R),a=this.match(n,e,R)),null!==a){if(o=j.longerAlt,void 0!==o){const t=o.length;for(i=0;i<t;i++){const t=I[o[i]],r=t.pattern;if(l=null,!0===t.isCustom?(g=r.exec(y,R,k,$),null!==g?(s=g[0],void 0!==g.payload&&(l=g.payload)):s=null):(this.updateLastIndex(r,R),s=this.match(r,e,R)),s&&s.length>a.length){a=s,c=l,j=t;break}}}break}}if(null!==a){if(u=a.length,d=j.group,void 0!==d&&(h=j.tokenTypeIdx,p=this.createTokenInstance(a,R,h,j.tokenType,A,b,u),this.handlePayload(p,c),!1===d?E=this.addToken(k,E,p):$[d].push(p)),e=this.chopInput(e,u),R+=u,b=this.computeNewColumn(b,u),!0===x&&!0===j.canLineTerminator){let e,t,r=0;w.lastIndex=0;do{e=w.test(a),!0===e&&(t=w.lastIndex-1,r++)}while(!0===e);0!==r&&(A+=r,b=u-t,this.updateTokenEndLineColumnLocation(p,d,t,r,A,b,u))}this.handleModes(j,F,q,p)}else{const t=R,r=A,i=b;let s=!1===U;for(;!1===s&&R<v;)for(e=this.chopInput(e,1),R++,n=0;n<N;n++){const t=I[n],r=t.pattern,i=t.short;if(!1!==i?y.charCodeAt(R)===i&&(s=!0):!0===t.isCustom?s=null!==r.exec(y,R,k,$):(this.updateLastIndex(r,R),s=null!==r.exec(e)),!0===s)break}if(f=R-t,b=this.computeNewColumn(b,f),m=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,t,f,r,i,T.last(P)),C.push({offset:t,line:r,column:i,length:f,message:m}),!1===U)break}}return this.hasCustom||(k.length=E),{tokens:k,groups:$,errors:C}}handleModes(e,t,r,n){if(!0===e.pop){const i=e.push;t(n),void 0!==i&&r.call(this,i)}else void 0!==e.push&&r.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,r,n,i,s,o){let a,c;void 0!==t&&(a=r===o-1,c=a?-1:0,1===n&&!0===a||(e.endLine=i+c,e.endColumn=s-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,r,n){return{image:e,startOffset:t,tokenTypeIdx:r,tokenType:n}}createStartOnlyToken(e,t,r,n,i,s){return{image:e,startOffset:t,startLine:i,startColumn:s,tokenTypeIdx:r,tokenType:n}}createFullToken(e,t,r,n,i,s,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:s,endColumn:s+o-1,tokenTypeIdx:r,tokenType:n}}addTokenUsingPush(e,t,r){return e.push(r),t}addTokenUsingMemberAccess(e,t,r){return e[t]=r,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}matchWithTest(e,t,r){return!0===e.test(t)?t.substring(r,e.lastIndex):null}matchWithExec(e,t){const r=e.exec(t);return null!==r?r[0]:null}}function Us(e){return Gs(e)?e.LABEL:e.name}function Gs(e){return T.isString(e.LABEL)&&""!==e.LABEL}js.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",js.NA=/NOT_APPLICABLE/;const zs="parent",Bs="categories",Ks="label",Ws="group",Vs="push_mode",Hs="pop_mode",Ys="longer_alt",Xs="line_breaks",Js="start_chars_hint";function Zs(e){return function(e){const t=e.pattern,r={};r.name=e.name,T.isUndefined(t)||(r.PATTERN=t);if(T.has(e,zs))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";T.has(e,Bs)&&(r.CATEGORIES=e[Bs]);Is([r]),T.has(e,Ks)&&(r.LABEL=e[Ks]);T.has(e,Ws)&&(r.GROUP=e[Ws]);T.has(e,Hs)&&(r.POP_MODE=e[Hs]);T.has(e,Vs)&&(r.PUSH_MODE=e[Vs]);T.has(e,Ys)&&(r.LONGER_ALT=e[Ys]);T.has(e,Xs)&&(r.LINE_BREAKS=e[Xs]);T.has(e,Js)&&(r.START_CHARS_HINT=e[Js]);return r}(e)}const Qs=Zs({name:"EOF",pattern:js.NA});function eo(e,t,r,n,i,s,o,a){return{image:t,startOffset:r,endOffset:n,startLine:i,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function to(e,t){return $s(e,t)}Is([Qs]);const ro={buildMismatchTokenMessage:({expected:e,actual:t,previous:r,ruleName:n})=>`Expecting ${Gs(e)?`--\x3e ${Us(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:r,customUserDescription:n,ruleName:i}){const s="Expecting: ",o="\nbut found: '"+T.first(t).image+"'";if(n)return s+n+o;{const t=T.reduce(e,(e,t)=>e.concat(t),[]),r=T.map(t,e=>`[${T.map(e,e=>Us(e)).join(", ")}]`);return s+`one of these possible Token sequences:\n${T.map(r,(e,t)=>` ${t+1}. ${e}`).join("\n")}`+o}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:r,ruleName:n}){const i="Expecting: ",s="\nbut found: '"+T.first(t).image+"'";if(r)return i+r+s;return i+`expecting at least one iteration which starts with one of these possible Token sequences::\n <${T.map(e,e=>`[${T.map(e,e=>Us(e)).join(",")}]`).join(" ,")}>`+s}};Object.freeze(ro);const no={buildRuleNotFoundError:(e,t)=>"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},io={buildDuplicateFoundError(e,t){const r=e.name,n=T.first(t),i=n.idx,s=zi(n),o=(a=n)instanceof qi?a.terminalType.name:a instanceof Ni?a.nonTerminalName:"";var a;let c=`->${s}${i>0?i:""}<- ${o?`with argument: ->${o}<-`:""}\n appears more than once (${t.length} times) in the top level rule: ->${r}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,"\n"),c},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=T.map(e.prefixPath,e=>Us(e)).join(", "),r=0===e.alternation.idx?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix\nin <OR${r}> 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=T.map(e.prefixPath,e=>Us(e)).join(", "),r=0===e.alternation.idx?"":e.alternation.idx;let n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${r}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return n+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",n},buildEmptyRepetitionError(e){let t=zi(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 ${T.map(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 Ii?e.topLevelRule.name:e.topLevelRule;return`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class so extends Ui{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){T.forEach(T.values(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:Na.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class oo extends Bi{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=T.clone(this.path.ruleStack).reverse(),this.occurrenceStack=T.clone(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,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const n=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){T.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class ao extends oo{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,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const e=t.concat(r),n=new _i({definition:e});this.possibleTokTypes=Wi(n),this.found=!0}}}class co extends Bi{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 lo extends co{walkMany(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,r)}}class uo extends co{walkManySep(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,r)}}class ho extends co{walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,r)}}class po extends co{walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){const e=T.first(t.concat(r));this.result.isEndOfRule=void 0===e,e instanceof qi&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,r)}}function fo(e,t,r=[]){r=T.clone(r);let n=[],i=0;function s(s){const o=fo(s.concat(T.drop(e,i+1)),t,r);return n.concat(o)}for(;r.length<t&&i<e.length;){const t=e[i];if(t instanceof _i)return s(t.definition);if(t instanceof Ni)return s(t.definition);if(t instanceof Pi)n=s(t.definition);else{if(t instanceof Li){return s(t.definition.concat([new Di({definition:t.definition})]))}if(t instanceof Oi){return s([new _i({definition:t.definition}),new Di({definition:[new qi({terminalType:t.separator})].concat(t.definition)})])}if(t instanceof Mi){const e=t.definition.concat([new Di({definition:[new qi({terminalType:t.separator})].concat(t.definition)})]);n=s(e)}else if(t instanceof Di){const e=t.definition.concat([new Di({definition:t.definition})]);n=s(e)}else{if(t instanceof Fi)return T.forEach(t.definition,e=>{!1===T.isEmpty(e.definition)&&(n=s(e.definition))}),n;if(!(t instanceof qi))throw Error("non exhaustive match");r.push(t.terminalType)}}i++}return n.push({partialPath:r,suffixDef:T.drop(e,i)}),n}function mo(e,t,r,n){const i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const c=t.length,l=c-n-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!T.isEmpty(d);){const e=d.pop();if(e===o){a&&T.last(d).idx<=l&&d.pop();continue}const n=e.def,h=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(T.isEmpty(n))continue;const m=n[0];if(m===i){const e={idx:h,def:T.drop(n),ruleStack:T.dropRight(p),occurrenceStack:T.dropRight(f)};d.push(e)}else if(m instanceof qi)if(h<c-1){const e=h+1;if(r(t[e],m.terminalType)){const t={idx:e,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(t)}}else{if(h!==c-1)throw Error("non exhaustive match");u.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),a=!0}else if(m instanceof Ni){const e=T.clone(p);e.push(m.nonTerminalName);const t=T.clone(f);t.push(m.idx);const r={idx:h,def:m.definition.concat(s,T.drop(n)),ruleStack:e,occurrenceStack:t};d.push(r)}else if(m instanceof Pi){const e={idx:h,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o);const t={idx:h,def:m.definition.concat(T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof Li){const e=new Di({definition:m.definition,idx:m.idx}),t={idx:h,def:m.definition.concat([e],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof Oi){const e=new qi({terminalType:m.separator}),t=new Di({definition:[e].concat(m.definition),idx:m.idx}),r={idx:h,def:m.definition.concat([t],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(r)}else if(m instanceof Mi){const e={idx:h,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o);const t=new qi({terminalType:m.separator}),r=new Di({definition:[t].concat(m.definition),idx:m.idx}),i={idx:h,def:m.definition.concat([r],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(i)}else if(m instanceof Di){const e={idx:h,def:T.drop(n),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o);const t=new Di({definition:m.definition,idx:m.idx}),r={idx:h,def:m.definition.concat([t],T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(r)}else if(m instanceof Fi)for(let t=m.definition.length-1;t>=0;t--){const e={idx:h,def:m.definition[t].definition.concat(T.drop(n)),ruleStack:p,occurrenceStack:f};d.push(e),d.push(o)}else if(m instanceof _i)d.push({idx:h,def:m.definition.concat(T.drop(n)),ruleStack:p,occurrenceStack:f});else{if(!(m instanceof Ii))throw Error("non exhaustive match");d.push(go(m,h,p,f))}}return u}function go(e,t,r,n){const i=T.clone(r);i.push(e.name);const s=T.clone(n);return s.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:s}}var yo,To;function vo(e){if(e instanceof Pi||"Option"===e)return yo.OPTION;if(e instanceof Di||"Repetition"===e)return yo.REPETITION;if(e instanceof Li||"RepetitionMandatory"===e)return yo.REPETITION_MANDATORY;if(e instanceof Oi||"RepetitionMandatoryWithSeparator"===e)return yo.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof Mi||"RepetitionWithSeparator"===e)return yo.REPETITION_WITH_SEPARATOR;if(e instanceof Fi||"Alternation"===e)return yo.ALTERNATION;throw Error("non exhaustive match")}function Ro(e){const{occurrence:t,rule:r,prodType:n,maxLookahead:i}=e,s=vo(n);return s===yo.ALTERNATION?wo(t,r,i):No(t,r,s,i)}function Eo(e,t,r,n){const i=e.length,s=T.every(e,e=>T.every(e,e=>1===e.length));if(t)return function(t){const n=T.map(t,e=>e.GATE);for(let s=0;s<i;s++){const t=e[s],i=t.length,o=n[s];if(void 0===o||!1!==o.call(this))e:for(let e=0;e<i;e++){const n=t[e],i=n.length;for(let e=0;e<i;e++){const t=this.LA(e+1);if(!1===r(t,n[e]))continue e}return s}}};if(s&&!n){const t=T.map(e,e=>T.flatten(e)),r=T.reduce(t,(e,t,r)=>(T.forEach(t,t=>{T.has(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=r),T.forEach(t.categoryMatches,t=>{T.has(e,t)||(e[t]=r)})}),e),{});return function(){const e=this.LA(1);return r[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){const n=e[t],i=n.length;e:for(let e=0;e<i;e++){const i=n[e],s=i.length;for(let e=0;e<s;e++){const t=this.LA(e+1);if(!1===r(t,i[e]))continue e}return t}}}}function So(e,t,r){const n=T.every(e,e=>1===e.length),i=e.length;if(n&&!r){const t=T.flatten(e);if(1===t.length&&T.isEmpty(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=T.reduce(t,(e,t,r)=>(e[t.tokenTypeIdx]=!0,T.forEach(t.categoryMatches,t=>{e[t]=!0}),e),[]);return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let r=0;r<i;r++){const n=e[r],i=n.length;for(let e=0;e<i;e++){const r=this.LA(e+1);if(!1===t(r,n[e]))continue e}return!0}return!1}}(To=yo||(yo={}))[To.OPTION=0]="OPTION",To[To.REPETITION=1]="REPETITION",To[To.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",To[To.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",To[To.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",To[To.ALTERNATION=5]="ALTERNATION";class ko extends Bi{constructor(e,t,r){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,r,n){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=r.concat(n),!0)}walkOption(e,t,r){this.checkIsTarget(e,yo.OPTION,t,r)||super.walkOption(e,t,r)}walkAtLeastOne(e,t,r){this.checkIsTarget(e,yo.REPETITION_MANDATORY,t,r)||super.walkOption(e,t,r)}walkAtLeastOneSep(e,t,r){this.checkIsTarget(e,yo.REPETITION_MANDATORY_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}walkMany(e,t,r){this.checkIsTarget(e,yo.REPETITION,t,r)||super.walkOption(e,t,r)}walkManySep(e,t,r){this.checkIsTarget(e,yo.REPETITION_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}}class Co extends Ui{constructor(e,t,r){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=r,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,yo.OPTION)}visitRepetition(e){this.checkIsTarget(e,yo.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,yo.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,yo.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,yo.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,yo.ALTERNATION)}}function Ao(e){const t=new Array(e);for(let r=0;r<e;r++)t[r]=[];return t}function bo(e){let t=[""];for(let r=0;r<e.length;r++){const n=e[r],i=[];for(let e=0;e<t.length;e++){const r=t[e];i.push(r+"_"+n.tokenTypeIdx);for(let e=0;e<n.categoryMatches.length;e++){const t="_"+n.categoryMatches[e];i.push(r+t)}}t=i}return t}function $o(e,t,r){for(let n=0;n<e.length;n++){if(n===r)continue;const i=e[n];for(let e=0;e<t.length;e++){if(!0===i[t[e]])return!1}}return!0}function xo(e,t){const r=T.map(e,e=>fo([e],1)),n=Ao(r.length),i=T.map(r,e=>{const t={};return T.forEach(e,e=>{const r=bo(e.partialPath);T.forEach(r,e=>{t[e]=!0})}),t});let s=r;for(let o=1;o<=t;o++){const e=s;s=Ao(e.length);for(let r=0;r<e.length;r++){const a=e[r];for(let e=0;e<a.length;e++){const c=a[e].partialPath,l=a[e].suffixDef,u=bo(c);if($o(i,u,r)||T.isEmpty(l)||c.length===t){const e=n[r];if(!1===Io(e,c)){e.push(c);for(let e=0;e<u.length;e++){const t=u[e];i[r][t]=!0}}}else{const e=fo(l,o+1,c);s[r]=s[r].concat(e),T.forEach(e,e=>{const t=bo(e.partialPath);T.forEach(t,e=>{i[r][e]=!0})})}}}}return n}function wo(e,t,r,n){const i=new Co(e,yo.ALTERNATION,n);return t.accept(i),xo(i.result,r)}function No(e,t,r,n){const i=new Co(e,r);t.accept(i);const s=i.result,o=new ko(t,e,r).startWalking();return xo([new _i({definition:s}),new _i({definition:o})],n)}function Io(e,t){e:for(let r=0;r<e.length;r++){const n=e[r];if(n.length===t.length){for(let e=0;e<n.length;e++){const r=t[e],i=n[e];if(!1===(r===i||void 0!==i.categoryMatchesMap[r.tokenTypeIdx]))continue e}return!0}}return!1}function _o(e){return T.every(e,e=>T.every(e,e=>T.every(e,e=>T.isEmpty(e.categoryMatches))))}function Po(e,t,r,n){const i=T.flatMap(e,e=>function(e,t){const r=new Do;e.accept(r);const n=r.allProductions,i=T.groupBy(n,Lo),s=T.pickBy(i,e=>e.length>1),o=T.map(T.values(s),r=>{const n=T.first(r),i=t.buildDuplicateFoundError(e,r),s=zi(n),o={message:i,type:Na.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:s,occurrence:n.idx},a=Oo(n);return a&&(o.parameter=a),o});return o}(e,r)),s=function(e,t,r){const n=[],i=T.map(t,e=>e.name);return T.forEach(e,e=>{const t=e.name;if(T.includes(i,t)){const i=r.buildNamespaceConflictError(e);n.push({message:i,type:Na.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),n}(e,t,r),o=T.flatMap(e,e=>function(e,t){const r=new qo;e.accept(r);const n=r.alternations,i=T.flatMap(n,r=>r.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:r}),type:Na.TOO_MANY_ALTS,ruleName:e.name,occurrence:r.idx}]:[]);return i}(e,r)),a=T.flatMap(e,t=>function(e,t,r,n){const i=[],s=T.reduce(t,(t,r)=>r.name===e.name?t+1:t,0);if(s>1){const t=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:r});i.push({message:t,type:Na.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,n,r));return i.concat(s,o,a)}function Lo(e){return`${zi(e)}_#_${e.idx}_#_${Oo(e)}`}function Oo(e){return e instanceof qi?e.terminalType.name:e instanceof Ni?e.nonTerminalName:""}class Do extends Ui{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 Mo(e,t,r,n=[]){const i=[],s=Fo(t.definition);if(T.isEmpty(s))return[];{const t=e.name;T.includes(s,e)&&i.push({message:r.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Na.LEFT_RECURSION,ruleName:t});const o=T.difference(s,n.concat([e])),a=T.flatMap(o,t=>{const i=T.clone(n);return i.push(t),Mo(e,t,r,i)});return i.concat(a)}}function Fo(e){let t=[];if(T.isEmpty(e))return t;const r=T.first(e);if(r instanceof Ni)t.push(r.referencedRule);else if(r instanceof _i||r instanceof Pi||r instanceof Li||r instanceof Oi||r instanceof Mi||r instanceof Di)t=t.concat(Fo(r.definition));else if(r instanceof Fi)t=T.flatten(T.map(r.definition,e=>Fo(e.definition)));else if(!(r instanceof qi))throw Error("non exhaustive match");const n=Gi(r),i=e.length>1;if(n&&i){const r=T.drop(e);return t.concat(Fo(r))}return t}class qo extends Ui{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function jo(e,t,r){const n=new qo;e.accept(n);let i=n.alternations;i=T.reject(i,e=>!0===e.ignoreAmbiguities);const s=T.flatMap(i,n=>{const i=n.idx,s=n.maxLookahead||t,o=wo(i,e,s,n),a=function(e,t,r,n){const i=[],s=T.reduce(e,(r,n,s)=>(!0===t.definition[s].ignoreAmbiguities||T.forEach(n,n=>{const o=[s];T.forEach(e,(e,r)=>{s!==r&&Io(e,n)&&!0!==t.definition[r].ignoreAmbiguities&&o.push(r)}),o.length>1&&!Io(i,n)&&(i.push(n),r.push({alts:o,path:n}))}),r),[]),o=T.map(s,e=>{const i=T.map(e.alts,e=>e+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Na.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:t.idx,alternatives:e.alts}});return o}(o,n,e,r),c=function(e,t,r,n){const i=T.reduce(e,(e,t,r)=>{const n=T.map(t,e=>({idx:r,path:e}));return e.concat(n)},[]),s=T.compact(T.flatMap(i,e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];const s=e.idx,o=e.path,a=T.filter(i,e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<s&&(r=e.path,n=o,r.length<n.length&&T.every(r,(e,t)=>{const r=n[t];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]}));var r,n});return T.map(a,e=>{const i=[e.idx+1,s+1],o=0===t.idx?"":t.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Na.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:o,alternatives:i}})}));return s}(o,n,e,r);return a.concat(c)});return s}class Uo extends Ui{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 Go(e){const t=T.defaults(e,{errMsgProvider:no}),r={};return T.forEach(e.rules,e=>{r[e.name]=e}),function(e,t){const r=new so(e,t);return r.resolveRefs(),r.errors}(r,t.errMsgProvider)}const zo="MismatchedTokenException",Bo="NoViableAltException",Ko="EarlyExitException",Wo="NotAllInputParsedException",Vo=[zo,Bo,Ko,Wo];function Ho(e){return T.includes(Vo,e.name)}Object.freeze(Vo);class Yo 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 Xo extends Yo{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=zo}}class Jo extends Yo{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=Bo}}class Zo extends Yo{constructor(e,t){super(e,t),this.name=Wo}}class Qo extends Yo{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=Ko}}const ea={},ta="InRuleRecoveryException";class ra extends Error{constructor(e){super(e),this.name=ta}}function na(e,t,r,n,i,s,o){const a=this.getKeyForAutomaticLookahead(n,i);let c=this.firstAfterRepMap[a];if(void 0===c){const e=this.getCurrRuleFullName();c=new s(this.getGAstProductions()[e],i).startWalking(),this.firstAfterRepMap[a]=c}let l=c.token,u=c.occurrence;const d=c.isEndOfRule;1===this.RULE_STACK.length&&d&&void 0===l&&(l=Qs,u=1),void 0!==l&&void 0!==u&&this.shouldInRepetitionRecoveryBeTried(l,u,o)&&this.tryInRepetitionRecovery(e,t,r,l)}const ia=1024,sa=1280,oa=1536;function aa(e,t,r){return r|t|e}class ca{constructor(e){var t;this.maxLookahead=null!==(t=null==e?void 0:e.maxLookahead)&&void 0!==t?t:xa.maxLookahead}validate(e){const t=this.validateNoLeftRecursion(e.rules);if(T.isEmpty(t)){const r=this.validateEmptyOrAlternatives(e.rules),n=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...r,...n,...i]}return t}validateNoLeftRecursion(e){return T.flatMap(e,e=>Mo(e,e,io))}validateEmptyOrAlternatives(e){return T.flatMap(e,e=>function(e,t){const r=new qo;e.accept(r);const n=r.alternations;return T.flatMap(n,r=>{const n=T.dropRight(r.definition);return T.flatMap(n,(n,i)=>{const s=mo([n],[],$s,1);return T.isEmpty(s)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:r,emptyChoiceIdx:i}),type:Na.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:r.idx,alternative:i+1}]:[]})})}(e,io))}validateAmbiguousAlternationAlternatives(e,t){return T.flatMap(e,e=>jo(e,t,io))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,r){const n=[];return T.forEach(e,e=>{const i=new Uo;e.accept(i);const s=i.allProductions;T.forEach(s,i=>{const s=vo(i),o=i.maxLookahead||t,a=No(i.idx,e,s,o)[0];if(T.isEmpty(T.flatten(a))){const t=r.buildEmptyRepetitionError({topLevelRule:e,repetition:i});n.push({message:t,type:Na.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),n}(e,t,io)}buildLookaheadForAlternation(e){return function(e,t,r,n,i,s){const o=wo(e,t,r);return s(o,n,_o(o)?xs:$s,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Eo)}buildLookaheadForOptional(e){return function(e,t,r,n,i,s){const o=No(e,t,i,r),a=_o(o)?xs:$s;return s(o[0],a,n)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,vo(e.prodType),So)}}const la=new class extends Ui{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 ua(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function da(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 ha(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function pa(e,t){const r=T.keys(e),n=r.length;for(let i=0;i<n;i++){const n=e[r[i]],s=n.length;for(let e=0;e<s;e++){const r=n[e];void 0===r.tokenTypeIdx&&this[r.name](r.children,t)}}}function fa(e,t){const r=function(){};ha(r,e+"BaseSemantics");const n={visit:function(e,t){if(T.isArray(e)&&(e=e[0]),!T.isUndefined(e))return this[e.name](e.children,t)},validateVisitor:function(){const e=function(e,t){const r=function(e,t){const r=T.filter(t,t=>!1===T.isFunction(e[t])),n=T.map(r,t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:ma.MISSING_METHOD,methodName:t}));return T.compact(n)}(e,t);return r}(this,t);if(!T.isEmpty(e)){const t=T.map(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(r.prototype=n).constructor=r,r._RULE_NAMES=t,r}var ma,ga;(ga=ma||(ma={}))[ga.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",ga[ga.MISSING_METHOD=1]="MISSING_METHOD";const ya={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ya);const Ta=!0,va=Math.pow(2,8)-1,Ra=Zs({name:"RECORDING_PHASE_TOKEN",pattern:js.NA});Is([Ra]);const Ea=eo(Ra,"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(Ea);const Sa={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 ka(e,t,r,n=!1){ba(r);const i=T.last(this.recordingProdStack),s=T.isFunction(t)?t:t.DEF,o=new e({definition:[],idx:r});return n&&(o.separator=t.SEP),T.has(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),ya}function Ca(e,t){ba(t);const r=T.last(this.recordingProdStack),n=!1===T.isArray(e),i=!1===n?e:e.DEF,s=new Fi({definition:[],idx:t,ignoreAmbiguities:n&&!0===e.IGNORE_AMBIGUITIES});T.has(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD);const o=T.some(i,e=>T.isFunction(e.GATE));return s.hasPredicates=o,r.definition.push(s),T.forEach(i,e=>{const t=new _i({definition:[]});s.definition.push(t),T.has(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:T.has(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),ya}function Aa(e){return 0===e?"":`${e}`}function ba(e){if(e<0||e>va){const t=new Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than ${va+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}const $a=eo(Qs,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze($a);const xa=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ro,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),wa=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Na,Ia,_a;function Pa(e=void 0){return function(){return e}}(Ia=Na||(Na={}))[Ia.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",Ia[Ia.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",Ia[Ia.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",Ia[Ia.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",Ia[Ia.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",Ia[Ia.LEFT_RECURSION=5]="LEFT_RECURSION",Ia[Ia.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",Ia[Ia.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",Ia[Ia.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",Ia[Ia.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",Ia[Ia.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",Ia[Ia.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",Ia[Ia.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",Ia[Ia.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION";class La{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",()=>{$i(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),T.forEach(this.definedRulesNames,e=>{const t=this[e].originalGrammarAction;let r;this.TRACE_INIT(`${e} Rule`,()=>{r=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=r})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=Go({rules:T.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(T.isEmpty(r)&&!1===this.skipValidations){const r=(e={rules:T.values(this.gastProductionsCache),tokenTypes:T.values(this.tokensMap),errMsgProvider:io,grammarName:t},Po((e=T.defaults(e,{errMsgProvider:io})).rules,e.tokenTypes,e.errMsgProvider,e.grammarName)),n=function(e){const t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return T.map(t,e=>Object.assign({type:Na.CUSTOM_LOOKAHEAD_VALIDATION},e))}({lookaheadStrategy:this.lookaheadStrategy,rules:T.values(this.gastProductionsCache),tokenTypes:T.values(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(r,n)}var e}),T.isEmpty(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const e=function(e){const t={};return T.forEach(e,e=>{const r=new Hi(e).startWalking();T.assign(t,r)}),t}(T.values(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:T.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(T.values(this.gastProductionsCache))})),!La.DEFER_DEFINITION_ERRORS_HANDLING&&!T.isEmpty(this.definitionErrors))throw e=T.map(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 r=this;if(r.initErrorHandler(t),r.initLexerAdapter(),r.initLooksAhead(t),r.initRecognizerEngine(e,t),r.initRecoverable(t),r.initTreeBuilder(t),r.initContentAssist(),r.initGastRecorder(t),r.initPerformanceTracer(t),T.has(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=T.has(t,"skipValidations")?t.skipValidations:xa.skipValidations}}La.DEFER_DEFINITION_ERRORS_HANDLING=!1,_a=La,[class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=T.has(e,"recoveryEnabled")?e.recoveryEnabled:xa.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=na)}getTokenToInsert(e){const t=eo(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,r,n){const i=this.findReSyncTokenType(),s=this.exportLexerState(),o=[];let a=!1;const c=this.LA(1);let l=this.LA(1);const u=()=>{const e=this.LA(0),t=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),r=new Xo(t,c,this.LA(0));r.resyncedTokens=T.dropRight(o),this.SAVE_ERROR(r)};for(;!a;){if(this.tokenMatcher(l,n))return void u();if(r.call(this))return u(),void e.apply(this,t);this.tokenMatcher(l,i)?a=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o))}this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,t,r){return!1!==r&&!this.tokenMatcher(this.LA(1),e)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t))}getFollowsForInRuleRecovery(e,t){const r=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(r)}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 ra("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(T.isEmpty(t))return!1;const r=this.LA(1);return void 0!==T.find(t,e=>this.tokenMatcher(r,e))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(t);return T.includes(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),r=2;for(;;){const n=T.find(e,e=>to(t,e));if(void 0!==n)return n;t=this.LA(r),r++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return ea;const e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return T.map(e,(r,n)=>0===n?ea:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:t[n],inRule:this.shortRuleNameToFullName(e[n-1])})}flattenFollowSet(){const e=T.map(this.buildFullFollowKeyStack(),e=>this.getFollowSetFromFollowKey(e));return T.flatten(e)}getFollowSetFromFollowKey(e){if(e===ea)return[Qs];const t=e.ruleName+e.idxInCallingRule+Vi+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,Qs)||t.push(e),t}reSyncTo(e){const t=[];let r=this.LA(1);for(;!1===this.tokenMatcher(r,e);)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return T.dropRight(t)}attemptInRepetitionRecovery(e,t,r,n,i,s,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:T.clone(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return T.map(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}},class{initLooksAhead(e){this.dynamicTokensEnabled=T.has(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:xa.dynamicTokensEnabled,this.maxLookahead=T.has(e,"maxLookahead")?e.maxLookahead:xa.maxLookahead,this.lookaheadStrategy=T.has(e,"lookaheadStrategy")?e.lookaheadStrategy:new ca({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){T.forEach(e,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{const{alternation:t,repetition:r,option:n,repetitionMandatory:i,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:o}=function(e){la.reset(),e.accept(la);const t=la.dslMethods;return la.reset(),t}(e);T.forEach(t,t=>{const r=0===t.idx?"":t.idx;this.TRACE_INIT(`${zi(t)}${r}`,()=>{const r=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),n=aa(this.fullRuleNameToShort[e.name],256,t.idx);this.setLaFuncCache(n,r)})}),T.forEach(r,t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,zi(t))}),T.forEach(n,t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,zi(t))}),T.forEach(i,t=>{this.computeLookaheadFunc(e,t.idx,ia,"RepetitionMandatory",t.maxLookahead,zi(t))}),T.forEach(s,t=>{this.computeLookaheadFunc(e,t.idx,oa,"RepetitionMandatoryWithSeparator",t.maxLookahead,zi(t))}),T.forEach(o,t=>{this.computeLookaheadFunc(e,t.idx,sa,"RepetitionWithSeparator",t.maxLookahead,zi(t))})})})}computeLookaheadFunc(e,t,r,n,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:n}),o=aa(this.fullRuleNameToShort[e.name],r,t);this.setLaFuncCache(o,s)})}getKeyForAutomaticLookahead(e,t){return aa(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=T.has(e,"nodeLocationTracking")?e.nodeLocationTracking:xa.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=da,this.setNodeLocationFromNode=da,this.cstPostRule=T.noop,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=T.noop,this.setNodeLocationFromNode=T.noop,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ua,this.setNodeLocationFromNode=ua,this.cstPostRule=T.noop,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=T.noop,this.setNodeLocationFromNode=T.noop,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=T.noop,this.setNodeLocationFromNode=T.noop,this.cstPostRule=T.noop,this.setInitialNodeLocation=T.noop}else this.cstInvocationStateUpdate=T.noop,this.cstFinallyStateUpdate=T.noop,this.cstPostTerminal=T.noop,this.cstPostNonTerminal=T.noop,this.cstPostRule=T.noop}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),r=e.location;r.startOffset<=t.startOffset==1?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),r=e.location;r.startOffset<=t.startOffset==1?r.endOffset=t.endOffset:r.startOffset=NaN}cstPostTerminal(e,t){const r=this.CST_STACK[this.CST_STACK.length-1];var n,i,s;i=t,s=e,void 0===(n=r).children[s]?n.children[s]=[i]:n.children[s].push(i),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){const r=this.CST_STACK[this.CST_STACK.length-1];!function(e,t,r){void 0===e.children[t]?e.children[t]=[r]:e.children[t].push(r)}(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(T.isUndefined(this.baseCstVisitorConstructor)){const e=fa(this.className,T.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(T.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){const e=function(e,t,r){const n=function(){};ha(n,e+"BaseSemanticsWithDefaults");const i=Object.create(r.prototype);return T.forEach(t,e=>{i[e]=pa}),(n.prototype=i).constructor=n,n}(this.className,T.keys(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)):$a}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?$a: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=xs,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},T.has(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(T.isArray(e)){if(T.isEmpty(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(T.isArray(e))this.tokensMap=T.reduce(e,(e,t)=>(e[t.name]=t,e),{});else if(T.has(e,"modes")&&T.every(T.flatten(T.values(e.modes)),Os)){const t=T.flatten(T.values(e.modes)),r=T.uniq(t);this.tokensMap=T.reduce(r,(e,t)=>(e[t.name]=t,e),{})}else{if(!T.isObject(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=T.clone(e)}this.tokensMap.EOF=Qs;const r=T.has(e,"modes")?T.flatten(T.values(e.modes)):T.values(e),n=T.every(r,e=>T.isEmpty(e.categoryMatches));this.tokenMatcher=n?xs:$s,Is(T.values(this.tokensMap))}defineRule(e,t,r){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 n=T.has(r,"resyncEnabled")?r.resyncEnabled:wa.resyncEnabled,i=T.has(r,"recoveryValueFunc")?r.recoveryValueFunc:wa.recoveryValueFunc,s=this.ruleShortNameIdx<<12;let o;return this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s,o=!0===this.outputCst?function(...r){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,r);const n=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(n),n}catch(o){return this.invokeRuleCatch(o,n,i)}finally{this.ruleFinallyStateUpdate()}}:function(...r){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,r)}catch(o){return this.invokeRuleCatch(o,n,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,r){const n=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Ho(e)){const t=e;if(i){const n=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(n)){if(t.resyncedTokens=this.reSyncTo(n),this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return r(e)}if(this.outputCst){const e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(n)return this.moveToTerminatedState(),r(e);throw t}throw e}optionInternal(e,t){const r=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,r)}optionInternalLogic(e,t,r){let n,i=this.getLaFuncFromCache(r);if("function"!=typeof e){n=e.DEF;const t=e.GATE;if(void 0!==t){const e=i;i=()=>t.call(this)&&e.call(this)}}else n=e;if(!0===i.call(this))return n.call(this)}atLeastOneInternal(e,t){const r=this.getKeyForAutomaticLookahead(ia,e);return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let n,i=this.getLaFuncFromCache(r);if("function"!=typeof t){n=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else n=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,yo.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(n);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(n)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,ia,e,ho)}atLeastOneSepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(oa,e);this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){const n=t.DEF,i=t.SEP;if(!0!==this.getLaFuncFromCache(r).call(this))throw this.raiseEarlyExitException(e,yo.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{n.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,n,po],t,oa,e,po)}}manyInternal(e,t){const r=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let n,i=this.getLaFuncFromCache(r);if("function"!=typeof t){n=t.DEF;const e=t.GATE;if(void 0!==e){const t=i;i=()=>e.call(this)&&t.call(this)}}else n=t;let s=!0;for(;!0===i.call(this)&&!0===s;)s=this.doSingleRepetition(n);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,lo,s)}manySepFirstInternal(e,t){const r=this.getKeyForAutomaticLookahead(sa,e);this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){const n=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(r).call(this)){n.call(this);const t=()=>this.tokenMatcher(this.LA(1),i);for(;!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,n,uo],t,sa,e,uo)}}repetitionSepSecondInternal(e,t,r,n,i){for(;r();)this.CONSUME(t),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,n,i],r,oa,e,i)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const r=this.getKeyForAutomaticLookahead(256,t),n=T.isArray(e)?e:e.DEF,i=this.getLaFuncFromCache(r).call(this,n);if(void 0!==i)return n[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 Zo(t,e))}}subruleInternal(e,t,r){let n;try{const i=void 0!==r?r.ARGS:void 0;return this.subruleIdx=t,n=e.apply(this,i),this.cstPostNonTerminal(n,void 0!==r&&void 0!==r.LABEL?r.LABEL:e.ruleName),n}catch(i){throw this.subruleInternalError(i,r,e.ruleName)}}subruleInternalError(e,t,r){throw Ho(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,t,r){let n;try{const t=this.LA(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),n=t):this.consumeInternalError(e,t,r)}catch(i){n=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(void 0!==r&&void 0!==r.LABEL?r.LABEL:e.name,n),n}consumeInternalError(e,t,r){let n;const i=this.LA(0);throw n=void 0!==r&&r.ERR_MSG?r.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Xo(n,t,i))}consumeInternalRecovery(e,t,r){if(!this.recoveryEnabled||"MismatchedTokenException"!==r.name||this.isBackTracking())throw r;{const i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(n){throw n.name===ta?r:n}}}saveRecogState(){const e=this.errors,t=T.clone(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,r){this.RULE_OCCURRENCE_STACK.push(r),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),Qs)}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,r){return this.consumeInternal(t,e,r)}subrule(e,t,r){return this.subruleInternal(t,e,r)}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,r=wa){if(T.includes(this.definedRulesNames,e)){const t={message:io.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Na.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);const n=this.defineRule(e,t,r);return this[e]=n,n}OVERRIDE_RULE(e,t,r=wa){const n=function(e,t,r){const n=[];let i;return T.includes(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Na.INVALID_RULE_OVERRIDE,ruleName:e})),n}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(n);const i=this.defineRule(e,t,r);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,t),!0}catch(n){if(Ho(n))return!1;throw n}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return e=T.values(this.gastProductionsCache),T.map(e,ji);var e}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=T.has(e,"errorMessageProvider")?e.errorMessageProvider:xa.errorMessageProvider}SAVE_ERROR(e){if(Ho(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:T.clone(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return T.clone(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,r){const n=this.getCurrRuleFullName(),i=No(e,this.getGAstProductions()[n],t,this.maxLookahead)[0],s=[];for(let a=1;a<=this.maxLookahead;a++)s.push(this.LA(a));const o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:s,previous:this.LA(0),customUserDescription:r,ruleName:n});throw this.SAVE_ERROR(new Qo(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const r=this.getCurrRuleFullName(),n=wo(e,this.getGAstProductions()[r],this.maxLookahead),i=[];for(let a=1;a<=this.maxLookahead;a++)i.push(this.LA(a));const s=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:n,actual:i,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Jo(o,this.LA(1),s))}},class{initContentAssist(){}computeContentAssist(e,t){const r=this.gastProductionsCache[e];if(T.isUndefined(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return mo([r],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=T.first(e.ruleStack),r=this.getGAstProductions()[t];return new ao(r,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,r){return this.consumeInternalRecord(t,e,r)},this[`SUBRULE${t}`]=function(t,r){return this.subruleInternalRecord(t,e,r)},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,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},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 r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return $a}topLevelRuleRecord(e,t){try{const r=new Ii({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(!0!==r.KNOWN_RECORDER_ERROR)try{r.message=r.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(n){throw r}throw r}}optionInternalRecord(e,t){return ka.call(this,Pi,e,t)}atLeastOneInternalRecord(e,t){ka.call(this,Li,t,e)}atLeastOneSepFirstInternalRecord(e,t){ka.call(this,Oi,t,e,Ta)}manyInternalRecord(e,t){ka.call(this,Di,t,e)}manySepFirstInternalRecord(e,t){ka.call(this,Mi,t,e,Ta)}orInternalRecord(e,t){return Ca.call(this,e,t)}subruleInternalRecord(e,t,r){if(ba(t),!e||!1===T.has(e,"ruleName")){const r=new Error(`<SUBRULE${Aa(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw r.KNOWN_RECORDER_ERROR=!0,r}const n=T.last(this.recordingProdStack),i=e.ruleName,s=new Ni({idx:t,nonTerminalName:i,label:null==r?void 0:r.LABEL,referencedRule:void 0});return n.definition.push(s),this.outputCst?Sa:ya}consumeInternalRecord(e,t,r){if(ba(t),!Ps(e)){const r=new Error(`<CONSUME${Aa(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw r.KNOWN_RECORDER_ERROR=!0,r}const n=T.last(this.recordingProdStack),i=new qi({idx:t,terminalType:e,label:null==r?void 0:r.LABEL});return n.definition.push(i),Ea}},class{initPerformanceTracer(e){if(T.has(e,"traceInitPerf")){const t=e.traceInitPerf,r="number"==typeof t;this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=xa.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--\x3e <${e}>`);const{time:n,value:i}=bi(t),s=n>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${r}<-- <${e}> time: ${n}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{const t=e.prototype;Object.getOwnPropertyNames(t).forEach(r=>{if("constructor"===r)return;const n=Object.getOwnPropertyDescriptor(t,r);n&&(n.get||n.set)?Object.defineProperty(_a.prototype,r,n):_a.prototype[r]=e.prototype[r]})});class Oa extends La{constructor(e,t=xa){const r=T.clone(t);r.outputCst=!1,super(e,r)}}function Da(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Ma(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new v.MapCache;++t<r;)this.add(e[t])}function Fa(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function qa(e,t){return e.has(t)}Ma.prototype.add=Ma.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ma.prototype.has=function(e){return this.__data__.has(e)};function ja(e,t,r,n,i,s){var o=1&r,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(e),u=s.get(t);if(l&&u)return l==t&&u==e;var d=-1,h=!0,p=2&r?new Ma:void 0;for(s.set(e,t),s.set(t,e);++d<a;){var f=e[d],m=t[d];if(n)var g=o?n(m,f,d,t,e,s):n(f,m,d,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!Fa(t,function(e,t){if(!qa(p,t)&&(f===e||i(f,e,r,n,s)))return p.push(t)})){h=!1;break}}else if(f!==m&&!i(f,m,r,n,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Ua(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function Ga(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var za=v.Symbol?v.Symbol.prototype:void 0,Ba=za?za.valueOf:void 0;var Ka=Object.prototype.hasOwnProperty;var Wa="[object Arguments]",Va="[object Array]",Ha="[object Object]",Ya=Object.prototype.hasOwnProperty;function Xa(e,t,r,n,i,s){var o=v.isArray(e),a=v.isArray(t),c=o?Va:v.getTag(e),l=a?Va:v.getTag(t),u=(c=c==Wa?Ha:c)==Ha,d=(l=l==Wa?Ha:l)==Ha,h=c==l;if(h&&v.isBuffer(e)){if(!v.isBuffer(t))return!1;o=!0,u=!1}if(h&&!u)return s||(s=new v.Stack),o||v.isTypedArray(e)?ja(e,t,r,n,i,s):function(e,t,r,n,i,s,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new v.Uint8Array(e),new v.Uint8Array(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return v.eq(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Ua;case"[object Set]":var c=1&n;if(a||(a=Ga),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;n|=2,o.set(e,t);var u=ja(a(e),a(t),n,i,s,o);return o.delete(e),u;case"[object Symbol]":if(Ba)return Ba.call(e)==Ba.call(t)}return!1}(e,t,c,r,n,i,s);if(!(1&r)){var p=u&&Ya.call(e,"__wrapped__"),f=d&&Ya.call(t,"__wrapped__");if(p||f){var m=p?e.value():e,g=f?t.value():t;return s||(s=new v.Stack),i(m,g,r,n,s)}}return!!h&&(s||(s=new v.Stack),function(e,t,r,n,i,s){var o=1&r,a=R.getAllKeys(e),c=a.length;if(c!=R.getAllKeys(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:Ka.call(t,u)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var p=!0;s.set(e,t),s.set(t,e);for(var f=o;++l<c;){var m=e[u=a[l]],g=t[u];if(n)var y=o?n(g,m,u,t,e,s):n(m,g,u,e,t,s);if(!(void 0===y?m===g||i(m,g,r,n,s):y)){p=!1;break}f||(f="constructor"==u)}if(p&&!f){var T=e.constructor,v=t.constructor;T==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof T&&T instanceof T&&"function"==typeof v&&v instanceof v||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,r,n,i,s))}function Ja(e,t,r,n,i){return e===t||(null==e||null==t||!v.isObjectLike(e)&&!v.isObjectLike(t)?e!=e&&t!=t:Xa(e,t,r,n,Ja,i))}function Za(e){return e==e&&!v.isObject(e)}function Qa(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}function ec(e){var t=function(e){for(var t=R.keys(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Za(i)]}return t}(e);return 1==t.length&&t[0][2]?Qa(t[0][0],t[0][1]):function(r){return r===e||function(e,t,r,n){var i=r.length,s=i;if(null==e)return!s;for(e=Object(e);i--;){var o=r[i];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++i<s;){var a=(o=r[i])[0],c=e[a],l=o[1];if(o[2]){if(void 0===c&&!(a in e))return!1}else if(!Ja(l,c,3,n,new v.Stack))return!1}return!0}(r,0,t)}}function tc(e){return"symbol"==typeof e||v.isObjectLike(e)&&"[object Symbol]"==v.baseGetTag(e)}var rc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nc=/^\w*$/;function ic(e,t){if(v.isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!tc(e))||(nc.test(e)||!rc.test(e)||null!=t&&e in Object(t))}var sc,oc,ac,cc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lc=/\\(\\)?/g,uc=(sc=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(cc,function(e,r,n,i){t.push(n?i.replace(lc,"$1"):r||e)}),t},oc=v.memoize(sc,function(e){return 500===ac.size&&ac.clear(),e}),ac=oc.cache,oc),dc=v.Symbol?v.Symbol.prototype:void 0,hc=dc?dc.toString:void 0;function pc(e){if("string"==typeof e)return e;if(v.isArray(e))return Da(e,pc)+"";if(tc(e))return hc?hc.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function fc(e,t){return v.isArray(e)?e:ic(e,t)?[e]:uc(function(e){return null==e?"":pc(e)}(e))}function mc(e){if("string"==typeof e||tc(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function gc(e,t){for(var r=0,n=(t=fc(t,e)).length;null!=e&&r<n;)e=e[mc(t[r++])];return r&&r==n?e:void 0}function yc(e,t){return null!=e&&t in Object(e)}function Tc(e,t){return null!=e&&function(e,t,r){for(var n=-1,i=(t=fc(t,e)).length,s=!1;++n<i;){var o=mc(t[n]);if(!(s=null!=e&&r(e,o)))break;e=e[o]}return s||++n!=i?s:!!(i=null==e?0:e.length)&&v.isLength(i)&&v.isIndex(o,i)&&(v.isArray(e)||v.isArguments(e))}(e,t,yc)}function vc(e,t){return ic(e)&&Za(t)?Qa(mc(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:gc(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?Tc(r,e):Ja(t,n,3)}}function Rc(e){return ic(e)?(t=mc(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return gc(t,e)}}(e);var t}function Ec(e){return"function"==typeof e?e:null==e?v.identity:"object"==typeof e?v.isArray(e)?vc(e[0],e[1]):ec(e):Rc(e)}var Sc,kc=(Sc=function(e,t){return e&&v.baseFor(e,t,R.keys)},function(e,t){if(null==e)return e;if(!v.isArrayLike(e))return Sc(e,t);for(var r=e.length,n=-1,i=Object(e);++n<r&&!1!==t(i[n],n,i););return e});function Cc(e,t){var r=-1,n=v.isArrayLike(e)?Array(e.length):[];return kc(e,function(e,i,s){n[++r]=t(e,i,s)}),n}function Ac(e,t){return(v.isArray(e)?Da:Cc)(e,Ec(t))}function bc(e,t){var r=[];return kc(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function $c(e,t,r){return`${e.name}_${t}_${r}`}class xc{constructor(e){this.target=e}isEpsilon(){return!1}}class wc extends xc{constructor(e,t){super(e),this.tokenType=t}}class Nc extends xc{constructor(e){super(e)}isEpsilon(){return!0}}class Ic extends xc{constructor(e,t,r){super(e),this.rule=t,this.followState=r}isEpsilon(){return!0}}function _c(e){const t={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};!function(e,t){const r=t.length;for(let n=0;n<r;n++){const r=t[n],i=Gc(e,r,void 0,{type:2}),s=Gc(e,r,void 0,{type:7});i.stop=s,e.ruleToStartState.set(r,i),e.ruleToStopState.set(r,s)}}(t,e);const r=e.length;for(let n=0;n<r;n++){const r=e[n],i=Lc(t,r,r);void 0!==i&&jc(t,r,i)}return t}function Pc(e,t,r){return r instanceof qi?qc(e,t,r.terminalType,r):r instanceof Ni?function(e,t,r){const n=r.referencedRule,i=e.ruleToStartState.get(n),s=Gc(e,t,r,{type:1}),o=Gc(e,t,r,{type:1}),a=new Ic(i,n,o);return zc(s,a),{left:s,right:o}}(e,t,r):r instanceof Fi?function(e,t,r){const n=Gc(e,t,r,{type:1});Mc(e,n);const i=Ac(r.definition,r=>Pc(e,t,r)),s=Fc(e,t,n,r,...i);return s}(e,t,r):r instanceof Pi?function(e,t,r){const n=Gc(e,t,r,{type:1});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r));return function(e,t,r,n){const i=n.left,s=n.right;return Uc(i,s),e.decisionMap[$c(t,"Option",r.idx)]=i,n}(e,t,r,i)}(e,t,r):r instanceof Di?function(e,t,r){const n=Gc(e,t,r,{type:5});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r));return Dc(e,t,r,i)}(e,t,r):r instanceof Mi?function(e,t,r){const n=Gc(e,t,r,{type:5});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r)),s=qc(e,t,r.separator,r);return Dc(e,t,r,i,s)}(e,t,r):r instanceof Li?function(e,t,r){const n=Gc(e,t,r,{type:4});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r));return Oc(e,t,r,i)}(e,t,r):r instanceof Oi?function(e,t,r){const n=Gc(e,t,r,{type:4});Mc(e,n);const i=Fc(e,t,n,r,Lc(e,t,r)),s=qc(e,t,r.separator,r);return Oc(e,t,r,i,s)}(e,t,r):Lc(e,t,r)}function Lc(e,t,r){const n=(i=Ac(r.definition,r=>Pc(e,t,r)),s=e=>void 0!==e,(v.isArray(i)?R.arrayFilter:bc)(i,Ec(s)));var i,s;return 1===n.length?n[0]:0===n.length?void 0:function(e,t){const r=t.length;for(let s=0;s<r-1;s++){const r=t[s];let n;1===r.left.transitions.length&&(n=r.left.transitions[0]);const i=n instanceof Ic,o=n,a=t[s+1].left;1===r.left.type&&1===r.right.type&&void 0!==n&&(i&&o.followState===r.right||n.target===r.right)?(i?o.followState=a:n.target=a,Bc(e,r.right)):Uc(r.right,a)}const n=t[0],i=t[r-1];return{left:n.left,right:i.right}}(e,n)}function Oc(e,t,r,n,i){const s=n.left,o=n.right,a=Gc(e,t,r,{type:11});Mc(e,a);const c=Gc(e,t,r,{type:12});return s.loopback=a,c.loopback=a,e.decisionMap[$c(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=a,Uc(o,a),void 0===i?(Uc(a,s),Uc(a,c)):(Uc(a,c),Uc(a,i.left),Uc(i.right,s)),{left:s,right:c}}function Dc(e,t,r,n,i){const s=n.left,o=n.right,a=Gc(e,t,r,{type:10});Mc(e,a);const c=Gc(e,t,r,{type:12}),l=Gc(e,t,r,{type:9});return a.loopback=l,c.loopback=l,Uc(a,s),Uc(a,c),Uc(o,l),void 0!==i?(Uc(l,c),Uc(l,i.left),Uc(i.right,s)):Uc(l,a),e.decisionMap[$c(t,i?"RepetitionWithSeparator":"Repetition",r.idx)]=a,{left:a,right:c}}function Mc(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function Fc(e,t,r,n,...i){const s=Gc(e,t,n,{type:8,start:r});r.end=s;for(const a of i)void 0!==a?(Uc(r,a.left),Uc(a.right,s)):Uc(r,s);const o={left:r,right:s};return e.decisionMap[$c(t,function(e){if(e instanceof Fi)return"Alternation";if(e instanceof Pi)return"Option";if(e instanceof Di)return"Repetition";if(e instanceof Mi)return"RepetitionWithSeparator";if(e instanceof Li)return"RepetitionMandatory";if(e instanceof Oi)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}(n),n.idx)]=r,o}function qc(e,t,r,n){const i=Gc(e,t,n,{type:1}),s=Gc(e,t,n,{type:1});return zc(i,new wc(s,r)),{left:i,right:s}}function jc(e,t,r){const n=e.ruleToStartState.get(t);Uc(n,r.left);const i=e.ruleToStopState.get(t);Uc(r.right,i);return{left:n,right:i}}function Uc(e,t){zc(e,new Nc(t))}function Gc(e,t,r,n){const i=Object.assign({atn:e,production:r,epsilonOnlyTransitions:!1,rule:t,transitions:[],nextTokenWithinRule:[],stateNumber:e.states.length},n);return e.states.push(i),i}function zc(e,t){0===e.transitions.length&&(e.epsilonOnlyTransitions=t.isEpsilon()),e.transitions.push(t)}function Bc(e,t){e.states.splice(e.states.indexOf(t),1)}const Kc={};class Wc{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const t=Vc(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return Ac(this.configs,e=>e.alt)}get key(){let e="";for(const t in this.map)e+=t+":";return e}}function Vc(e,t=!0){return`${t?`a${e.alt}`:""}s${e.state.stateNumber}:${e.stack.map(e=>e.stateNumber.toString()).join("_")}`}function Hc(e,t){return e<t}function Yc(e){return e&&e.length?function(e,t,r){for(var n=-1,i=e.length;++n<i;){var s=e[n],o=t(s);if(null!=o&&(void 0===a?o==o&&!tc(o):r(o,a)))var a=o,c=s}return c}(e,v.identity,Hc):void 0}var Xc=v.Symbol?v.Symbol.isConcatSpreadable:void 0;function Jc(e){return v.isArray(e)||v.isArguments(e)||!!(Xc&&e&&e[Xc])}function Zc(e,t,r,n,i){var s=-1,o=e.length;for(r||(r=Jc),i||(i=[]);++s<o;){var a=e[s];r(a)?R.arrayPush(i,a):i[i.length]=a}return i}function Qc(e){return e!=e}function el(e,t){return!!(null==e?0:e.length)&&function(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):function(e,t,r){for(var n=e.length,i=r+-1;++i<n;)if(t(e[i],i,e))return i;return-1}(e,Qc,r)}(e,t,0)>-1}var tl=v.Set&&1/Ga(new v.Set([,-0]))[1]==1/0?function(e){return new v.Set(e)}:function(){};function rl(e,t){return e&&e.length?function(e,t,r){var n=-1,i=el,s=e.length,o=!0,a=[],c=a;if(s>=200){var l=t?null:tl(e);if(l)return Ga(l);o=!1,i=qa,c=new Ma}else c=t?[]:a;e:for(;++n<s;){var u=e[n],d=t?t(u):u;if(u=0!==u?u:0,o&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),a.push(u)}else i(c,d,r)||(c!==a&&c.push(d),a.push(u))}return a}(e,Ec(t)):[]}function nl(e,t){var r;return(v.isArray(e)?R.arrayEach:kc)(e,"function"==typeof(r=t)?r:v.identity)}function il(e,t,r,n){var i=-1,s=null==e?0:e.length;for(n&&s&&(r=e[++i]);++i<s;)r=t(r,e[i],i,e);return r}function sl(e,t,r,n,i){return i(e,function(e,i,s){r=n?(n=!1,e):t(r,e,i,s)}),r}function ol(e,t,r){var n=v.isArray(e)?il:sl,i=arguments.length<3;return n(e,Ec(t),r,i,kc)}function al(e,t){const r={};return n=>{const i=n.toString();let s=r[i];return void 0!==s||(s={atnStartState:e,decision:t,states:{}},r[i]=s),s}}class cl{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 r=0;r<t;r++)e+=!0===this.predicates[r]?"1":"0";return e}}const ll=new cl;class ul extends ca{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=_c(e.rules),this.dfas=function(e){const t=e.decisionStates.length,r=Array(t);for(let n=0;n<t;n++)r[n]=al(e.decisionStates[n],n);return r}(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:t,rule:r,hasPredicates:n,dynamicTokensEnabled:i}=e,s=this.dfas,o=this.logging,a=$c(r,"Alternation",t),c=this.atn.decisionMap[a].decision,l=Ac(Ro({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:r}),e=>Ac(e,e=>e[0]));if(dl(l,!1)&&!i){const e=ol(l,(e,t,r)=>(nl(t,t=>{t&&(e[t.tokenTypeIdx]=r,nl(t.categoryMatches,t=>{e[t]=r}))}),e),{});return n?function(t){var r;const n=this.LA(1),i=e[n.tokenTypeIdx];if(void 0!==t&&void 0!==i){const e=null===(r=t[i])||void 0===r?void 0:r.GATE;if(void 0!==e&&!1===e.call(this))return}return i}:function(){const t=this.LA(1);return e[t.tokenTypeIdx]}}return n?function(e){const t=new cl,r=void 0===e?0:e.length;for(let i=0;i<r;i++){const r=null==e?void 0:e[i].GATE;t.set(i,void 0===r||r.call(this))}const n=hl.call(this,s,c,t,o);return"number"==typeof n?n:void 0}:function(){const e=hl.call(this,s,c,ll,o);return"number"==typeof e?e:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:t,rule:r,prodType:n,dynamicTokensEnabled:i}=e,s=this.dfas,o=this.logging,a=$c(r,n,t),c=this.atn.decisionMap[a].decision,l=Ac(Ro({maxLookahead:1,occurrence:t,prodType:n,rule:r}),e=>Ac(e,e=>e[0]));if(dl(l)&&l[0][0]&&!i){const e=l[0],t=null!=(u=e)&&u.length?Zc(u):[];if(1===t.length&&v.isEmpty(t[0].categoryMatches)){const e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{const e=ol(t,(e,t)=>(void 0!==t&&(e[t.tokenTypeIdx]=!0,nl(t.categoryMatches,t=>{e[t]=!0})),e),{});return function(){const t=this.LA(1);return!0===e[t.tokenTypeIdx]}}}var u;return function(){const e=hl.call(this,s,c,ll,o);return"object"!=typeof e&&0===e}}}function dl(e,t=!0){const r=new Set;for(const n of e){const e=new Set;for(const i of n){if(void 0===i){if(t)break;return!1}const n=[i.tokenTypeIdx].concat(i.categoryMatches);for(const t of n)if(r.has(t)){if(!e.has(t))return!1}else r.add(t),e.add(t)}}return!0}function hl(e,t,r,n){const i=e[t](r);let s=i.start;if(void 0===s){s=El(i,vl(function(e){const t=new Wc,r=e.transitions.length;for(let n=0;n<r;n++){Sl({state:e.transitions[n].target,alt:n,stack:[]},t)}return t}(i.atnStartState))),i.start=s}return pl.apply(this,[i,s,r,n])}function pl(e,t,r,n){let i=t,s=1;const o=[];let a=this.LA(s++);for(;;){let t=yl(i,a);if(void 0===t&&(t=fl.apply(this,[e,i,a,s,r,n])),t===Kc)return gl(o,i,a);if(!0===t.isAcceptState)return t.prediction;i=t,o.push(a),a=this.LA(s++)}}function fl(e,t,r,n,i,s){const o=function(e,t,r){const n=new Wc,i=[];for(const o of e.elements){if(!1===r.is(o.alt))continue;if(7===o.state.type){i.push(o);continue}const e=o.state.transitions.length;for(let r=0;r<e;r++){const e=Tl(o.state.transitions[r],t);void 0!==e&&n.add({state:e,alt:o.alt,stack:o.stack})}}let s;0===i.length&&1===n.size&&(s=n);if(void 0===s){s=new Wc;for(const e of n.elements)Sl(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 o of i)s.add(o);return s}(t.configs,r,i);if(0===o.size)return Rl(e,t,r,Kc),Kc;let a=vl(o);const c=function(e,t){let r;for(const n of e.elements)if(!0===t.is(n.alt))if(void 0===r)r=n.alt;else if(r!==n.alt)return;return r}(o,i);if(void 0!==c)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;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 r of e){const e=Vc(r,!1);let n=t.get(e);void 0===n&&(n={},t.set(e,n)),n[r.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)}(o)){const t=Yc(o.alts);a.isAcceptState=!0,a.prediction=t,a.configs.uniqueAlt=t,ml.apply(this,[e,n,o.alts,s])}return a=Rl(e,t,r,a),a}function ml(e,t,r,n){const i=[];for(let o=1;o<=t;o++)i.push(this.LA(o).tokenType);const s=e.atnStartState;n(function(e){const t=Ac(e.prefixPath,e=>Us(e)).join(", "),r=0===e.production.idx?"":e.production.idx;let n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${function(e){if(e instanceof Ni)return"SUBRULE";if(e instanceof Pi)return"OPTION";if(e instanceof Fi)return"OR";if(e instanceof Li)return"AT_LEAST_ONE";if(e instanceof Oi)return"AT_LEAST_ONE_SEP";if(e instanceof Mi)return"MANY_SEP";if(e instanceof Di)return"MANY";if(e instanceof qi)return"CONSUME";throw Error("non exhaustive match")}(e.production)}${r}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\n`;return n+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details.",n}({topLevelRule:s.rule,ambiguityIndices:r,production:s.production,prefixPath:i}))}function gl(e,t,r){return{actualToken:r,possibleTokenTypes:rl(Zc(Ac(t.configs.elements,e=>e.state.transitions)).filter(e=>e instanceof wc).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:e}}function yl(e,t){return e.edges[t.tokenTypeIdx]}function Tl(e,t){if(e instanceof wc&&to(t,e.tokenType))return e.target}function vl(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function Rl(e,t,r,n){return n=El(e,n),t.edges[r.tokenTypeIdx]=n,n}function El(e,t){if(t===Kc)return t;const r=t.configs.key,n=e.states[r];return void 0!==n?n:(t.configs.finalize(),e.states[r]=t,t)}function Sl(e,t){const r=e.state;if(7===r.type){if(e.stack.length>0){const r=[...e.stack];Sl({state:r.pop(),alt:e.alt,stack:r},t)}else t.add(e);return}r.epsilonOnlyTransitions||t.add(e);const n=r.transitions.length;for(let i=0;i<n;i++){const n=kl(e,r.transitions[i]);void 0!==n&&Sl(n,t)}}function kl(e,t){if(t instanceof Nc)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof Ic){const r=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:r}}}var Cl,Al,bl,$l,xl,wl,Nl,Il,_l,Pl,Ll,Ol,Dl,Ml,Fl,ql,jl,Ul,Gl,zl,Bl,Kl,Wl,Vl,Hl,Yl,Xl,Jl,Zl,Ql,eu,tu,ru,nu,iu,su,ou,au,cu,lu,uu,du,hu,pu,fu,mu,gu,yu,Tu,vu,Ru,Eu,Su,ku,Cu,Au,bu,$u,xu,wu,Nu,Iu,_u,Pu,Lu,Ou,Du,Mu,Fu,qu,ju,Uu,Gu,zu,Bu,Ku,Wu,Vu,Hu,Yu,Xu,Ju,Zu,Qu,ed,td,rd,nd,id,sd,od,ad,cd,ld,ud,dd,hd,pd,fd,md,gd,yd,Td,vd,Rd,Ed,Sd,kd,Cd,Ad,bd,$d,xd,wd,Nd,Id,_d,Pd,Ld,Od,Dd,Md,Fd,qd,jd,Ud,Gd,zd,Bd,Kd,Wd,Vd;(Cl||(Cl={})).is=function(e){return"string"==typeof e},(Al||(Al={})).is=function(e){return"string"==typeof e},($l=bl||(bl={})).MIN_VALUE=-2147483648,$l.MAX_VALUE=2147483647,$l.is=function(e){return"number"==typeof e&&$l.MIN_VALUE<=e&&e<=$l.MAX_VALUE},(wl=xl||(xl={})).MIN_VALUE=0,wl.MAX_VALUE=2147483647,wl.is=function(e){return"number"==typeof e&&wl.MIN_VALUE<=e&&e<=wl.MAX_VALUE},(Il=Nl||(Nl={})).create=function(e,t){return e===Number.MAX_VALUE&&(e=xl.MAX_VALUE),t===Number.MAX_VALUE&&(t=xl.MAX_VALUE),{line:e,character:t}},Il.is=function(e){let t=e;return Zd.objectLiteral(t)&&Zd.uinteger(t.line)&&Zd.uinteger(t.character)},(Pl=_l||(_l={})).create=function(e,t,r,n){if(Zd.uinteger(e)&&Zd.uinteger(t)&&Zd.uinteger(r)&&Zd.uinteger(n))return{start:Nl.create(e,t),end:Nl.create(r,n)};if(Nl.is(e)&&Nl.is(t))return{start:e,end:t};throw new Error(`Range#create called with invalid arguments[${e}, ${t}, ${r}, ${n}]`)},Pl.is=function(e){let t=e;return Zd.objectLiteral(t)&&Nl.is(t.start)&&Nl.is(t.end)},(Ol=Ll||(Ll={})).create=function(e,t){return{uri:e,range:t}},Ol.is=function(e){let t=e;return Zd.objectLiteral(t)&&_l.is(t.range)&&(Zd.string(t.uri)||Zd.undefined(t.uri))},(Ml=Dl||(Dl={})).create=function(e,t,r,n){return{targetUri:e,targetRange:t,targetSelectionRange:r,originSelectionRange:n}},Ml.is=function(e){let t=e;return Zd.objectLiteral(t)&&_l.is(t.targetRange)&&Zd.string(t.targetUri)&&_l.is(t.targetSelectionRange)&&(_l.is(t.originSelectionRange)||Zd.undefined(t.originSelectionRange))},(ql=Fl||(Fl={})).create=function(e,t,r,n){return{red:e,green:t,blue:r,alpha:n}},ql.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.numberRange(t.red,0,1)&&Zd.numberRange(t.green,0,1)&&Zd.numberRange(t.blue,0,1)&&Zd.numberRange(t.alpha,0,1)},(Ul=jl||(jl={})).create=function(e,t){return{range:e,color:t}},Ul.is=function(e){const t=e;return Zd.objectLiteral(t)&&_l.is(t.range)&&Fl.is(t.color)},(zl=Gl||(Gl={})).create=function(e,t,r){return{label:e,textEdit:t,additionalTextEdits:r}},zl.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.label)&&(Zd.undefined(t.textEdit)||su.is(t))&&(Zd.undefined(t.additionalTextEdits)||Zd.typedArray(t.additionalTextEdits,su.is))},(Kl=Bl||(Bl={})).Comment="comment",Kl.Imports="imports",Kl.Region="region",(Vl=Wl||(Wl={})).create=function(e,t,r,n,i,s){const o={startLine:e,endLine:t};return Zd.defined(r)&&(o.startCharacter=r),Zd.defined(n)&&(o.endCharacter=n),Zd.defined(i)&&(o.kind=i),Zd.defined(s)&&(o.collapsedText=s),o},Vl.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.uinteger(t.startLine)&&Zd.uinteger(t.startLine)&&(Zd.undefined(t.startCharacter)||Zd.uinteger(t.startCharacter))&&(Zd.undefined(t.endCharacter)||Zd.uinteger(t.endCharacter))&&(Zd.undefined(t.kind)||Zd.string(t.kind))},(Yl=Hl||(Hl={})).create=function(e,t){return{location:e,message:t}},Yl.is=function(e){let t=e;return Zd.defined(t)&&Ll.is(t.location)&&Zd.string(t.message)},(Jl=Xl||(Xl={})).Error=1,Jl.Warning=2,Jl.Information=3,Jl.Hint=4,(Ql=Zl||(Zl={})).Unnecessary=1,Ql.Deprecated=2,(eu||(eu={})).is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.href)},(ru=tu||(tu={})).create=function(e,t,r,n,i,s){let o={range:e,message:t};return Zd.defined(r)&&(o.severity=r),Zd.defined(n)&&(o.code=n),Zd.defined(i)&&(o.source=i),Zd.defined(s)&&(o.relatedInformation=s),o},ru.is=function(e){var t;let r=e;return Zd.defined(r)&&_l.is(r.range)&&Zd.string(r.message)&&(Zd.number(r.severity)||Zd.undefined(r.severity))&&(Zd.integer(r.code)||Zd.string(r.code)||Zd.undefined(r.code))&&(Zd.undefined(r.codeDescription)||Zd.string(null===(t=r.codeDescription)||void 0===t?void 0:t.href))&&(Zd.string(r.source)||Zd.undefined(r.source))&&(Zd.undefined(r.relatedInformation)||Zd.typedArray(r.relatedInformation,Hl.is))},(iu=nu||(nu={})).create=function(e,t,...r){let n={title:e,command:t};return Zd.defined(r)&&r.length>0&&(n.arguments=r),n},iu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.title)&&Zd.string(t.command)},(ou=su||(su={})).replace=function(e,t){return{range:e,newText:t}},ou.insert=function(e,t){return{range:{start:e,end:e},newText:t}},ou.del=function(e){return{range:e,newText:""}},ou.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.newText)&&_l.is(t.range)},(cu=au||(au={})).create=function(e,t,r){const n={label:e};return void 0!==t&&(n.needsConfirmation=t),void 0!==r&&(n.description=r),n},cu.is=function(e){const t=e;return Zd.objectLiteral(t)&&Zd.string(t.label)&&(Zd.boolean(t.needsConfirmation)||void 0===t.needsConfirmation)&&(Zd.string(t.description)||void 0===t.description)},(lu||(lu={})).is=function(e){const t=e;return Zd.string(t)},(du=uu||(uu={})).replace=function(e,t,r){return{range:e,newText:t,annotationId:r}},du.insert=function(e,t,r){return{range:{start:e,end:e},newText:t,annotationId:r}},du.del=function(e,t){return{range:e,newText:"",annotationId:t}},du.is=function(e){const t=e;return su.is(t)&&(au.is(t.annotationId)||lu.is(t.annotationId))},(pu=hu||(hu={})).create=function(e,t){return{textDocument:e,edits:t}},pu.is=function(e){let t=e;return Zd.defined(t)&&Au.is(t.textDocument)&&Array.isArray(t.edits)},(mu=fu||(fu={})).create=function(e,t,r){let n={kind:"create",uri:e};return void 0===t||void 0===t.overwrite&&void 0===t.ignoreIfExists||(n.options=t),void 0!==r&&(n.annotationId=r),n},mu.is=function(e){let t=e;return t&&"create"===t.kind&&Zd.string(t.uri)&&(void 0===t.options||(void 0===t.options.overwrite||Zd.boolean(t.options.overwrite))&&(void 0===t.options.ignoreIfExists||Zd.boolean(t.options.ignoreIfExists)))&&(void 0===t.annotationId||lu.is(t.annotationId))},(yu=gu||(gu={})).create=function(e,t,r,n){let i={kind:"rename",oldUri:e,newUri:t};return void 0===r||void 0===r.overwrite&&void 0===r.ignoreIfExists||(i.options=r),void 0!==n&&(i.annotationId=n),i},yu.is=function(e){let t=e;return t&&"rename"===t.kind&&Zd.string(t.oldUri)&&Zd.string(t.newUri)&&(void 0===t.options||(void 0===t.options.overwrite||Zd.boolean(t.options.overwrite))&&(void 0===t.options.ignoreIfExists||Zd.boolean(t.options.ignoreIfExists)))&&(void 0===t.annotationId||lu.is(t.annotationId))},(vu=Tu||(Tu={})).create=function(e,t,r){let n={kind:"delete",uri:e};return void 0===t||void 0===t.recursive&&void 0===t.ignoreIfNotExists||(n.options=t),void 0!==r&&(n.annotationId=r),n},vu.is=function(e){let t=e;return t&&"delete"===t.kind&&Zd.string(t.uri)&&(void 0===t.options||(void 0===t.options.recursive||Zd.boolean(t.options.recursive))&&(void 0===t.options.ignoreIfNotExists||Zd.boolean(t.options.ignoreIfNotExists)))&&(void 0===t.annotationId||lu.is(t.annotationId))},(Ru||(Ru={})).is=function(e){let t=e;return t&&(void 0!==t.changes||void 0!==t.documentChanges)&&(void 0===t.documentChanges||t.documentChanges.every(e=>Zd.string(e.kind)?fu.is(e)||gu.is(e)||Tu.is(e):hu.is(e)))};class Hd{constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,i;if(void 0===r?n=su.insert(e,t):lu.is(r)?(i=r,n=uu.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=uu.insert(e,t,i)),this.edits.push(n),void 0!==i)return i}replace(e,t,r){let n,i;if(void 0===r?n=su.replace(e,t):lu.is(r)?(i=r,n=uu.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=uu.replace(e,t,i)),this.edits.push(n),void 0!==i)return i}delete(e,t){let r,n;if(void 0===t?r=su.del(e):lu.is(t)?(n=t,r=uu.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=uu.del(e,n)),this.edits.push(r),void 0!==n)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(void 0===e)throw new Error("Text edit change is not configured to manage change annotations.")}}class Yd{constructor(e){this._annotations=void 0===e?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(lu.is(e)?r=e:(r=this.nextId(),t=e),void 0!==this._annotations[r])throw new Error(`Id ${r} is already in use.`);if(void 0===t)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}}(Su=Eu||(Eu={})).create=function(e){return{uri:e}},Su.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)},(Cu=ku||(ku={})).create=function(e,t){return{uri:e,version:t}},Cu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)&&Zd.integer(t.version)},(bu=Au||(Au={})).create=function(e,t){return{uri:e,version:t}},bu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)&&(null===t.version||Zd.integer(t.version))},(xu=$u||($u={})).create=function(e,t,r,n){return{uri:e,languageId:t,version:r,text:n}},xu.is=function(e){let t=e;return Zd.defined(t)&&Zd.string(t.uri)&&Zd.string(t.languageId)&&Zd.integer(t.version)&&Zd.string(t.text)},(Nu=wu||(wu={})).PlainText="plaintext",Nu.Markdown="markdown",Nu.is=function(e){const t=e;return t===Nu.PlainText||t===Nu.Markdown},(Iu||(Iu={})).is=function(e){const t=e;return Zd.objectLiteral(e)&&wu.is(t.kind)&&Zd.string(t.value)},(Pu=_u||(_u={})).Text=1,Pu.Method=2,Pu.Function=3,Pu.Constructor=4,Pu.Field=5,Pu.Variable=6,Pu.Class=7,Pu.Interface=8,Pu.Module=9,Pu.Property=10,Pu.Unit=11,Pu.Value=12,Pu.Enum=13,Pu.Keyword=14,Pu.Snippet=15,Pu.Color=16,Pu.File=17,Pu.Reference=18,Pu.Folder=19,Pu.EnumMember=20,Pu.Constant=21,Pu.Struct=22,Pu.Event=23,Pu.Operator=24,Pu.TypeParameter=25,(Ou=Lu||(Lu={})).PlainText=1,Ou.Snippet=2,(Du||(Du={})).Deprecated=1,(Fu=Mu||(Mu={})).create=function(e,t,r){return{newText:e,insert:t,replace:r}},Fu.is=function(e){const t=e;return t&&Zd.string(t.newText)&&_l.is(t.insert)&&_l.is(t.replace)},(ju=qu||(qu={})).asIs=1,ju.adjustIndentation=2,(Uu||(Uu={})).is=function(e){const t=e;return t&&(Zd.string(t.detail)||void 0===t.detail)&&(Zd.string(t.description)||void 0===t.description)},(Gu||(Gu={})).create=function(e){return{label:e}},(zu||(zu={})).create=function(e,t){return{items:e||[],isIncomplete:!!t}},(Ku=Bu||(Bu={})).fromPlainText=function(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},Ku.is=function(e){const t=e;return Zd.string(t)||Zd.objectLiteral(t)&&Zd.string(t.language)&&Zd.string(t.value)},(Wu||(Wu={})).is=function(e){let t=e;return!!t&&Zd.objectLiteral(t)&&(Iu.is(t.contents)||Bu.is(t.contents)||Zd.typedArray(t.contents,Bu.is))&&(void 0===e.range||_l.is(e.range))},(Vu||(Vu={})).create=function(e,t){return t?{label:e,documentation:t}:{label:e}},(Hu||(Hu={})).create=function(e,t,...r){let n={label:e};return Zd.defined(t)&&(n.documentation=t),Zd.defined(r)?n.parameters=r:n.parameters=[],n},(Xu=Yu||(Yu={})).Text=1,Xu.Read=2,Xu.Write=3,(Ju||(Ju={})).create=function(e,t){let r={range:e};return Zd.number(t)&&(r.kind=t),r},(Qu=Zu||(Zu={})).File=1,Qu.Module=2,Qu.Namespace=3,Qu.Package=4,Qu.Class=5,Qu.Method=6,Qu.Property=7,Qu.Field=8,Qu.Constructor=9,Qu.Enum=10,Qu.Interface=11,Qu.Function=12,Qu.Variable=13,Qu.Constant=14,Qu.String=15,Qu.Number=16,Qu.Boolean=17,Qu.Array=18,Qu.Object=19,Qu.Key=20,Qu.Null=21,Qu.EnumMember=22,Qu.Struct=23,Qu.Event=24,Qu.Operator=25,Qu.TypeParameter=26,(ed||(ed={})).Deprecated=1,(td||(td={})).create=function(e,t,r,n,i){let s={name:e,kind:t,location:{uri:n,range:r}};return i&&(s.containerName=i),s},(rd||(rd={})).create=function(e,t,r,n){return void 0!==n?{name:e,kind:t,location:{uri:r,range:n}}:{name:e,kind:t,location:{uri:r}}},(id=nd||(nd={})).create=function(e,t,r,n,i,s){let o={name:e,detail:t,kind:r,range:n,selectionRange:i};return void 0!==s&&(o.children=s),o},id.is=function(e){let t=e;return t&&Zd.string(t.name)&&Zd.number(t.kind)&&_l.is(t.range)&&_l.is(t.selectionRange)&&(void 0===t.detail||Zd.string(t.detail))&&(void 0===t.deprecated||Zd.boolean(t.deprecated))&&(void 0===t.children||Array.isArray(t.children))&&(void 0===t.tags||Array.isArray(t.tags))},(od=sd||(sd={})).Empty="",od.QuickFix="quickfix",od.Refactor="refactor",od.RefactorExtract="refactor.extract",od.RefactorInline="refactor.inline",od.RefactorRewrite="refactor.rewrite",od.Source="source",od.SourceOrganizeImports="source.organizeImports",od.SourceFixAll="source.fixAll",(cd=ad||(ad={})).Invoked=1,cd.Automatic=2,(ud=ld||(ld={})).create=function(e,t,r){let n={diagnostics:e};return null!=t&&(n.only=t),null!=r&&(n.triggerKind=r),n},ud.is=function(e){let t=e;return Zd.defined(t)&&Zd.typedArray(t.diagnostics,tu.is)&&(void 0===t.only||Zd.typedArray(t.only,Zd.string))&&(void 0===t.triggerKind||t.triggerKind===ad.Invoked||t.triggerKind===ad.Automatic)},(hd=dd||(dd={})).create=function(e,t,r){let n={title:e},i=!0;return"string"==typeof t?(i=!1,n.kind=t):nu.is(t)?n.command=t:n.edit=t,i&&void 0!==r&&(n.kind=r),n},hd.is=function(e){let t=e;return t&&Zd.string(t.title)&&(void 0===t.diagnostics||Zd.typedArray(t.diagnostics,tu.is))&&(void 0===t.kind||Zd.string(t.kind))&&(void 0!==t.edit||void 0!==t.command)&&(void 0===t.command||nu.is(t.command))&&(void 0===t.isPreferred||Zd.boolean(t.isPreferred))&&(void 0===t.edit||Ru.is(t.edit))},(fd=pd||(pd={})).create=function(e,t){let r={range:e};return Zd.defined(t)&&(r.data=t),r},fd.is=function(e){let t=e;return Zd.defined(t)&&_l.is(t.range)&&(Zd.undefined(t.command)||nu.is(t.command))},(gd=md||(md={})).create=function(e,t){return{tabSize:e,insertSpaces:t}},gd.is=function(e){let t=e;return Zd.defined(t)&&Zd.uinteger(t.tabSize)&&Zd.boolean(t.insertSpaces)},(Td=yd||(yd={})).create=function(e,t,r){return{range:e,target:t,data:r}},Td.is=function(e){let t=e;return Zd.defined(t)&&_l.is(t.range)&&(Zd.undefined(t.target)||Zd.string(t.target))},(Rd=vd||(vd={})).create=function(e,t){return{range:e,parent:t}},Rd.is=function(e){let t=e;return Zd.objectLiteral(t)&&_l.is(t.range)&&(void 0===t.parent||Rd.is(t.parent))},(Sd=Ed||(Ed={})).namespace="namespace",Sd.type="type",Sd.class="class",Sd.enum="enum",Sd.interface="interface",Sd.struct="struct",Sd.typeParameter="typeParameter",Sd.parameter="parameter",Sd.variable="variable",Sd.property="property",Sd.enumMember="enumMember",Sd.event="event",Sd.function="function",Sd.method="method",Sd.macro="macro",Sd.keyword="keyword",Sd.modifier="modifier",Sd.comment="comment",Sd.string="string",Sd.number="number",Sd.regexp="regexp",Sd.operator="operator",Sd.decorator="decorator",(Cd=kd||(kd={})).declaration="declaration",Cd.definition="definition",Cd.readonly="readonly",Cd.static="static",Cd.deprecated="deprecated",Cd.abstract="abstract",Cd.async="async",Cd.modification="modification",Cd.documentation="documentation",Cd.defaultLibrary="defaultLibrary",(Ad||(Ad={})).is=function(e){const t=e;return Zd.objectLiteral(t)&&(void 0===t.resultId||"string"==typeof t.resultId)&&Array.isArray(t.data)&&(0===t.data.length||"number"==typeof t.data[0])},($d=bd||(bd={})).create=function(e,t){return{range:e,text:t}},$d.is=function(e){const t=e;return null!=t&&_l.is(t.range)&&Zd.string(t.text)},(wd=xd||(xd={})).create=function(e,t,r){return{range:e,variableName:t,caseSensitiveLookup:r}},wd.is=function(e){const t=e;return null!=t&&_l.is(t.range)&&Zd.boolean(t.caseSensitiveLookup)&&(Zd.string(t.variableName)||void 0===t.variableName)},(Id=Nd||(Nd={})).create=function(e,t){return{range:e,expression:t}},Id.is=function(e){const t=e;return null!=t&&_l.is(t.range)&&(Zd.string(t.expression)||void 0===t.expression)},(Pd=_d||(_d={})).create=function(e,t){return{frameId:e,stoppedLocation:t}},Pd.is=function(e){const t=e;return Zd.defined(t)&&_l.is(e.stoppedLocation)},(Od=Ld||(Ld={})).Type=1,Od.Parameter=2,Od.is=function(e){return 1===e||2===e},(Md=Dd||(Dd={})).create=function(e){return{value:e}},Md.is=function(e){const t=e;return Zd.objectLiteral(t)&&(void 0===t.tooltip||Zd.string(t.tooltip)||Iu.is(t.tooltip))&&(void 0===t.location||Ll.is(t.location))&&(void 0===t.command||nu.is(t.command))},(qd=Fd||(Fd={})).create=function(e,t,r){const n={position:e,label:t};return void 0!==r&&(n.kind=r),n},qd.is=function(e){const t=e;return Zd.objectLiteral(t)&&Nl.is(t.position)&&(Zd.string(t.label)||Zd.typedArray(t.label,Dd.is))&&(void 0===t.kind||Ld.is(t.kind))&&void 0===t.textEdits||Zd.typedArray(t.textEdits,su.is)&&(void 0===t.tooltip||Zd.string(t.tooltip)||Iu.is(t.tooltip))&&(void 0===t.paddingLeft||Zd.boolean(t.paddingLeft))&&(void 0===t.paddingRight||Zd.boolean(t.paddingRight))},(jd||(jd={})).createSnippet=function(e){return{kind:"snippet",value:e}},(Ud||(Ud={})).create=function(e,t,r,n){return{insertText:e,filterText:t,range:r,command:n}},(Gd||(Gd={})).create=function(e){return{items:e}},(Bd=zd||(zd={})).Invoked=0,Bd.Automatic=1,(Kd||(Kd={})).create=function(e,t){return{range:e,text:t}},(Wd||(Wd={})).create=function(e,t){return{triggerKind:e,selectedCompletionInfo:t}},(Vd||(Vd={})).is=function(e){const t=e;return Zd.objectLiteral(t)&&Al.is(t.uri)&&Zd.string(t.name)};var Xd;!function(e){function t(e,r){if(e.length<=1)return e;const n=e.length/2|0,i=e.slice(0,n),s=e.slice(n);t(i,r),t(s,r);let o=0,a=0,c=0;for(;o<i.length&&a<s.length;){let t=r(i[o],s[a]);e[c++]=t<=0?i[o++]:s[a++]}for(;o<i.length;)e[c++]=i[o++];for(;a<s.length;)e[c++]=s[a++];return e}e.create=function(e,t,r,n){return new Jd(e,t,r,n)},e.is=function(e){let t=e;return!!(Zd.defined(t)&&Zd.string(t.uri)&&(Zd.undefined(t.languageId)||Zd.string(t.languageId))&&Zd.uinteger(t.lineCount)&&Zd.func(t.getText)&&Zd.func(t.positionAt)&&Zd.func(t.offsetAt))},e.applyEdits=function(e,r){let n=e.getText(),i=t(r,(e,t)=>{let r=e.range.start.line-t.range.start.line;return 0===r?e.range.start.character-t.range.start.character:r}),s=n.length;for(let t=i.length-1;t>=0;t--){let r=i[t],o=e.offsetAt(r.range.start),a=e.offsetAt(r.range.end);if(!(a<=s))throw new Error("Overlapping edit");n=n.substring(0,o)+r.newText+n.substring(a,n.length),s=o}return n}}(Xd||(Xd={}));let Jd=class{constructor(e,t,r,n){this._uri=e,this._languageId=t,this._version=r,this._content=n,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(t,r)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(void 0===this._lineOffsets){let e=[],t=this._content,r=!0;for(let n=0;n<t.length;n++){r&&(e.push(n),r=!1);let i=t.charAt(n);r="\r"===i||"\n"===i,"\r"===i&&n+1<t.length&&"\n"===t.charAt(n+1)&&n++}r&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,n=t.length;if(0===n)return Nl.create(0,e);for(;r<n;){let i=Math.floor((r+n)/2);t[i]>e?n=i:r=i+1}let i=r-1;return Nl.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],n=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,n),r)}get lineCount(){return this.getLineOffsets().length}};var Zd;!function(e){const t=Object.prototype.toString;e.defined=function(e){return void 0!==e},e.undefined=function(e){return void 0===e},e.boolean=function(e){return!0===e||!1===e},e.string=function(e){return"[object String]"===t.call(e)},e.number=function(e){return"[object Number]"===t.call(e)},e.numberRange=function(e,r,n){return"[object Number]"===t.call(e)&&r<=e&&e<=n},e.integer=function(e){return"[object Number]"===t.call(e)&&-2147483648<=e&&e<=2147483647},e.uinteger=function(e){return"[object Number]"===t.call(e)&&0<=e&&e<=2147483647},e.func=function(e){return"[object Function]"===t.call(e)},e.objectLiteral=function(e){return null!==e&&"object"==typeof e},e.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)}}(Zd||(Zd={}));const Qd=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return uu},get ChangeAnnotation(){return au},get ChangeAnnotationIdentifier(){return lu},get CodeAction(){return dd},get CodeActionContext(){return ld},get CodeActionKind(){return sd},get CodeActionTriggerKind(){return ad},get CodeDescription(){return eu},get CodeLens(){return pd},get Color(){return Fl},get ColorInformation(){return jl},get ColorPresentation(){return Gl},get Command(){return nu},get CompletionItem(){return Gu},get CompletionItemKind(){return _u},get CompletionItemLabelDetails(){return Uu},get CompletionItemTag(){return Du},get CompletionList(){return zu},get CreateFile(){return fu},get DeleteFile(){return Tu},get Diagnostic(){return tu},get DiagnosticRelatedInformation(){return Hl},get DiagnosticSeverity(){return Xl},get DiagnosticTag(){return Zl},get DocumentHighlight(){return Ju},get DocumentHighlightKind(){return Yu},get DocumentLink(){return yd},get DocumentSymbol(){return nd},get DocumentUri(){return Cl},EOL:["\n","\r\n","\r"],get FoldingRange(){return Wl},get FoldingRangeKind(){return Bl},get FormattingOptions(){return md},get Hover(){return Wu},get InlayHint(){return Fd},get InlayHintKind(){return Ld},get InlayHintLabelPart(){return Dd},get InlineCompletionContext(){return Wd},get InlineCompletionItem(){return Ud},get InlineCompletionList(){return Gd},get InlineCompletionTriggerKind(){return zd},get InlineValueContext(){return _d},get InlineValueEvaluatableExpression(){return Nd},get InlineValueText(){return bd},get InlineValueVariableLookup(){return xd},get InsertReplaceEdit(){return Mu},get InsertTextFormat(){return Lu},get InsertTextMode(){return qu},get Location(){return Ll},get LocationLink(){return Dl},get MarkedString(){return Bu},get MarkupContent(){return Iu},get MarkupKind(){return wu},get OptionalVersionedTextDocumentIdentifier(){return Au},get ParameterInformation(){return Vu},get Position(){return Nl},get Range(){return _l},get RenameFile(){return gu},get SelectedCompletionInfo(){return Kd},get SelectionRange(){return vd},get SemanticTokenModifiers(){return kd},get SemanticTokenTypes(){return Ed},get SemanticTokens(){return Ad},get SignatureInformation(){return Hu},get StringValue(){return jd},get SymbolInformation(){return td},get SymbolKind(){return Zu},get SymbolTag(){return ed},get TextDocument(){return Xd},get TextDocumentEdit(){return hu},get TextDocumentIdentifier(){return Eu},get TextDocumentItem(){return $u},get TextEdit(){return su},get URI(){return Al},get VersionedTextDocumentIdentifier(){return ku},WorkspaceChange:class{constructor(e){this._textEditChanges=Object.create(null),void 0!==e?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Yd(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(e=>{if(hu.is(e)){const t=new Hd(e.edits,this._changeAnnotations);this._textEditChanges[e.textDocument.uri]=t}})):e.changes&&Object.keys(e.changes).forEach(t=>{const r=new Hd(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(0===this._changeAnnotations.size?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Au.is(e)){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");const t={uri:e.uri,version:e.version};let r=this._textEditChanges[t.uri];if(!r){const e=[],n={textDocument:t,edits:e};this._workspaceEdit.documentChanges.push(n),r=new Hd(e,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}{if(this.initChanges(),void 0===this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new Hd(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._changeAnnotations=new Yd,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let n,i,s;if(au.is(t)||lu.is(t)?n=t:r=t,void 0===n?i=fu.create(e,r):(s=lu.is(n)?n:this._changeAnnotations.manage(n),i=fu.create(e,r,s)),this._workspaceEdit.documentChanges.push(i),void 0!==s)return s}renameFile(e,t,r,n){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let i,s,o;if(au.is(r)||lu.is(r)?i=r:n=r,void 0===i?s=gu.create(e,t,n):(o=lu.is(i)?i:this._changeAnnotations.manage(i),s=gu.create(e,t,n,o)),this._workspaceEdit.documentChanges.push(s),void 0!==o)return o}deleteFile(e,t,r){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");let n,i,s;if(au.is(t)||lu.is(t)?n=t:r=t,void 0===n?i=Tu.create(e,r):(s=lu.is(n)?n:this._changeAnnotations.manage(n),i=Tu.create(e,r,s)),this._workspaceEdit.documentChanges.push(i),void 0!==s)return s}},get WorkspaceEdit(){return Ru},get WorkspaceFolder(){return Vd},get WorkspaceSymbol(){return rd},get integer(){return bl},get uinteger(){return xl}},Symbol.toStringTag,{value:"Module"}));class eh{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new sh(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const t=new nh;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){const r=new rh(e.startOffset,e.image.length,_n(e),e.tokenType,!t);return r.grammarSource=t,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const t=e.container;if(t){const r=t.content.indexOf(e);r>=0&&t.content.splice(r,1)}}addHiddenNodes(e){const t=[];for(const i of e){const e=new rh(i.startOffset,i.image.length,_n(i),i.tokenType,!0);e.root=this.rootNode,t.push(e)}let r=this.current,n=!1;if(r.content.length>0)r.content.push(...t);else{for(;r.container;){const e=r.container.content.indexOf(r);if(e>0){r.container.content.splice(e,0,...t),n=!0;break}r=r.container}n||this.rootNode.content.unshift(...t)}}construct(e){const t=this.current;"string"!=typeof e.$type||e.$infixName||(this.current.astNode=e),e.$cstNode=t;const r=this.nodeStack.pop();0===(null==r?void 0:r.content.length)&&this.removeNode(r)}}class th{get hidden(){return!1}get astNode(){var e,t;const r="string"==typeof(null==(e=this._astNode)?void 0:e.$type)?this._astNode:null==(t=this.container)?void 0:t.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get text(){return this.root.fullText.substring(this.offset,this.end)}}class rh extends th{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,r,n,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=n,this._length=t,this._range=r}}class nh extends th{constructor(){super(...arguments),this.content=new ih(this)}get offset(){var e;return(null==(e=this.firstNonHiddenNode)?void 0:e.offset)??0}get length(){return this.end-this.offset}get end(){var e;return(null==(e=this.lastNonHiddenNode)?void 0:e.end)??0}get range(){const e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(void 0===this._rangeCache){const{range:r}=e,{range:n}=t;this._rangeCache={start:r.start,end:n.end.line<r.start.line?r.start:n.end}}return this._rangeCache}return{start:Nl.create(0,0),end:Nl.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 ih extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,ih.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...r){return this.addParents(r),super.splice(e,t,...r)}addParents(e){for(const t of e)t.container=this.parent}}class sh extends nh{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const oh=Symbol("Datatype");function ah(e){return e.$type===oh}const ch=e=>e.endsWith("")?e:e+"";class lh{constructor(e){var t;this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const r=this.lexer.definition,n="production"===e.LanguageMetaData.mode;(null==(t=e.shared.profilers.LangiumProfiler)?void 0:t.isActive("parsing"))?this.wrapper=new gh(r,{...e.parser.ParserConfig,skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider},e.shared.profilers.LangiumProfiler.createTask("parsing",e.LanguageMetaData.languageId)):this.wrapper=new mh(r,{...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 uh extends lh{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new eh,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){const r=this.computeRuleType(e);let n;Rt(e)&&(n=e.name,this.registerPrecedenceMap(e));const i=this.wrapper.DEFINE_RULE(ch(e.name),this.startImplementation(r,n,t).bind(this));return this.allRules.set(e.name,i),ar(e)&&e.entry&&(this.mainRule=i),i}registerPrecedenceMap(e){const t=e.name,r=new Map;for(let n=0;n<e.operators.precedences.length;n++){const t=e.operators.precedences[n];for(const e of t.operators)r.set(e.value,{precedence:n,rightAssoc:"right"===t.associativity})}this.operatorPrecedence.set(t,r)}computeRuleType(e){return Rt(e)?Ti(e):e.fragment?void 0:mi(e)?oh:Ti(e)}parse(e,t={}){this.nodeBuilder.buildRootNode(e);const r=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=r.tokens;const n=t.rule?this.allRules.get(t.rule):this.mainRule;if(!n)throw new Error(t.rule?`No rule found with name '${t.rule}'`:"No main rule available.");const i=this.doParse(n);return this.nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,F(i,{deep:!0}),{value:i,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}doParse(e){let t=this.wrapper.rule(e);if(this.stack.length>0&&(t=this.construct()),void 0===t)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return t}startImplementation(e,t,r){return n=>{const i=!this.isRecording()&&void 0!==e;if(i){const r={$type:e};this.stack.push(r),e===oh?r.value="":void 0!==t&&(r.$infixName=t)}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){const t=this.lexerResult.hidden;if(!t.length)return[];const r=e.startOffset;for(let n=0;n<t.length;n++){if(t[n].startOffset>r)return t.splice(0,n)}return t.splice(0,t.length)}consume(e,t,r){const n=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(n)){const e=this.extractHiddenTokens(n);this.nodeBuilder.addHiddenNodes(e);const t=this.nodeBuilder.buildLeafNode(n,r),{assignment:i,crossRef:s}=this.getAssignment(r),o=this.current;if(i){const e=Lt(r)?n.image:this.converter.convert(n.image,t);this.assign(i.operator,i.feature,e,t,s)}else if(ah(o)){let e=n.image;Lt(r)||(e=this.converter.convert(e,t).toString()),o.value+=e}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&"number"==typeof e.endOffset&&!isNaN(e.endOffset)}subrule(e,t,r,n,i){let s,o;this.isRecording()||r||(s=this.nodeBuilder.buildCompositeNode(n));try{o=this.wrapper.wrapSubrule(e,t,i)}finally{this.isRecording()||(void 0!==o||r||(o=this.construct()),void 0!==o&&s&&s.length>0&&this.performSubruleAssignment(o,n,s))}}performSubruleAssignment(e,t,r){const{assignment:n,crossRef:i}=this.getAssignment(t);if(n)this.assign(n.operator,n.feature,e,r,i);else if(!n){const t=this.current;if(ah(t))t.value+=e.toString();else if("object"==typeof e&&e){const r=this.assignWithoutOverride(e,t);this.stack.pop(),this.stack.push(r)}}}action(e,t){if(!this.isRecording()){let r=this.current;if(t.feature&&t.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode);this.nodeBuilder.buildCompositeNode(t).content.push(r.$cstNode);const n={$type:e};this.stack.push(n),this.assign(t.operator,t.feature,r,r.$cstNode)}else r.$type=e}}construct(){if(this.isRecording())return;const e=this.stack.pop();return this.nodeBuilder.construct(e),"$infixName"in e?this.constructInfix(e,this.operatorPrecedence.get(e.$infixName)):ah(e)?this.converter.convert(e.value,e.$cstNode):(function(e,t){const r=e.getTypeMetaData(t.$type),n=t;for(const i of Object.values(r.properties))void 0!==i.defaultValue&&void 0===n[i.name]&&(n[i.name]=H(i.defaultValue))}(this.astReflection,e),e)}constructInfix(e,t){const r=e.parts;if(!Array.isArray(r)||0===r.length)return;const n=e.operators;if(!Array.isArray(n)||r.length<2)return r[0];let i=0,s=-1;for(let f=0;f<n.length;f++){const e=n[f],r=t.get(e)??{precedence:1/0,rightAssoc:!1};r.precedence>s?(s=r.precedence,i=f):r.precedence===s&&(r.rightAssoc||(i=f))}const o=n.slice(0,i),a=n.slice(i+1),c=r.slice(0,i+1),l=r.slice(i+1),u={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:c,operators:o},d={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:l,operators:a},h=this.constructInfix(u,t),p=this.constructInfix(d,t);return{$type:e.$type,$cstNode:e.$cstNode,left:h,operator:n[i],right:p}}getAssignment(e){if(!this.assignmentMap.has(e)){const t=q(e,ke);this.assignmentMap.set(e,{assignment:t,crossRef:t&&Ge(t.terminal)?t.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(e)}assign(e,t,r,n,i){const s=this.current;let o;switch(o="single"===i&&"string"==typeof r?this.linker.buildReference(s,t,n,r):"multi"===i&&"string"==typeof r?this.linker.buildMultiReference(s,t,n,r):r,e){case"=":s[t]=o;break;case"?=":s[t]=!0;break;case"+=":Array.isArray(s[t])||(s[t]=[]),s[t].push(o)}}assignWithoutOverride(e,t){for(const[n,i]of Object.entries(t)){const t=e[n];void 0===t?e[n]=i:Array.isArray(t)&&Array.isArray(i)&&(i.push(...t),e[n]=i)}const r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class dh{buildMismatchTokenMessage(e){return ro.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return ro.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return ro.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return ro.buildEarlyExitMessage(e)}}class hh extends dh{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 ph extends lh{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 r=this.wrapper.DEFINE_RULE(ch(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{const r=this.keepStackSize();try{e(t)}finally{this.resetStackSize(r)}}}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,r){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,r,n,i){this.before(n),this.wrapper.wrapSubrule(e,t,i),this.after(n)}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 fh={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new hh};class mh extends Oa{constructor(e,t){super(e,{...fh,lookaheadStrategy:t&&"maxLookahead"in t?new ca({maxLookahead:t.maxLookahead}):new ul({logging:t.skipValidations?()=>{}:void 0}),...t})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t,r){return this.RULE(e,t,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t,void 0)}wrapSubrule(e,t,r){return this.subrule(e,t,{ARGS:[r]})}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)}rule(e){return e.call(this,{})}}class gh extends mh{constructor(e,t,r){super(e,t),this.task=r}rule(e){this.task.start(),this.task.startSubTask(this.ruleName(e));try{return super.rule(e)}finally{this.task.stopSubTask(this.ruleName(e)),this.task.stop()}}ruleName(e){return e.ruleName}subrule(e,t,r){this.task.startSubTask(this.ruleName(t));try{return super.subrule(e,t,r)}finally{this.task.stopSubTask(this.ruleName(t))}}}function yh(e,t,r){return function(e,t){const r=ai(t,!1),n=L(t.rules).filter(ar).filter(e=>r.has(e));for(const s of n){const t={...e,consume:1,optional:1,subrule:1,many:1,or:1};e.parser.rule(s,vh(t,s.definition))}const i=L(t.rules).filter(Rt).filter(e=>r.has(e));for(const s of i)e.parser.rule(s,Th(e,s))}({parser:t,tokens:r,ruleNames:new Map},e),t}function Th(e,t){const r=t.call.rule.ref;if(!r)throw new Error("Could not resolve reference to infix operator rule: "+t.call.rule.$refText);if(Jr(r))throw new Error("Cannot use terminal rule in infix expression");const n=t.operators.precedences.flatMap(e=>e.operators),i={$type:"Group",elements:[]},s={$container:i,$type:"Assignment",feature:"parts",operator:"+=",terminal:t.call},o={$container:i,$type:"Group",elements:[],cardinality:"*"};i.elements.push(s,o);const a={$container:o,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:n}},c={...s,$container:o};o.elements.push(a,c);const l=n.map(t=>e.tokens[t.value]).map((t,r)=>({ALT:()=>e.parser.consume(r,t,a)}));let u;return t=>{u??(u=Ch(e,r)),e.parser.subrule(0,u,!1,s,t),e.parser.many(0,{DEF:()=>{e.parser.alternatives(0,l),e.parser.subrule(1,u,!1,c,t)}})}}function vh(e,t,r=!1){let n;if(Lt(t))n=function(e,t){const r=e.consume++,n=e.tokens[t.value];if(!n)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(r,n,t)}(e,t);else if(ce(t))n=function(e,t){const r=Ti(t);return()=>e.parser.action(r,t)}(e,t);else if(ke(t))n=vh(e,t.terminal);else if(Ge(t))n=Sh(e,t);else if(kr(t))n=function(e,t){const r=t.rule.ref;if(Q(r)){const n=e.subrule++,i=ar(r)&&r.fragment,s=t.arguments.length>0?function(e,t){if(t.some(e=>e.calledByName)){const e=t.map(e=>{var t,r;return{parameterName:null==(r=null==(t=e.parameter)?void 0:t.ref)?void 0:r.name,predicate:Rh(e.value)}});return t=>{const r={};for(const{parameterName:n,predicate:i}of e)n&&(r[n]=i(t));return r}}{const r=t.map(e=>Rh(e.value));return t=>{const n={};for(let i=0;i<r.length;i++)if(i<e.parameters.length){const s=e.parameters[i].name,o=r[i];n[s]=o(t)}return n}}}(r,t.arguments):()=>({});let o;return a=>{o??(o=Ch(e,r)),e.parser.subrule(n,o,i,t,s(a))}}if(Jr(r)){const n=e.consume++,i=Ah(e,r.name);return()=>e.parser.consume(n,i,t)}if(!r)throw new Fn(t.$cstNode,`Undefined rule: ${t.rule.$refText}`);qn()}(e,t);else if(he(t))n=function(e,t){if(1===t.elements.length)return vh(e,t.elements[0]);{const r=[];for(const i of t.elements){const t={ALT:vh(e,i,!0)},n=Eh(i);n&&(t.GATE=Rh(n)),r.push(t)}const n=e.or++;return t=>e.parser.alternatives(n,r.map(e=>{const r={ALT:()=>e.ALT(t)},n=e.GATE;return n&&(r.GATE=()=>n(t)),r}))}}(e,t);else if(Tn(t))n=function(e,t){if(1===t.elements.length)return vh(e,t.elements[0]);const r=[];for(const a of t.elements){const t={ALT:vh(e,a,!0)},n=Eh(a);n&&(t.GATE=Rh(n)),r.push(t)}const n=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join("-")}`,s=t=>e.parser.alternatives(n,r.map((r,s)=>{const o={ALT:()=>!0},a=e.parser;o.ALT=()=>{if(r.ALT(t),!a.isRecording()){const e=i(n,a);a.unorderedGroups.get(e)||a.unorderedGroups.set(e,[]);const t=a.unorderedGroups.get(e);void 0===(null==t?void 0:t[s])&&(t[s]=!0)}};const c=r.GATE;return o.GATE=c?()=>c(t):()=>{const e=a.unorderedGroups.get(i(n,a));return!(null==e?void 0:e[s])},o})),o=kh(e,Eh(t),s,"*");return t=>{o(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(n,e.parser))}}(e,t);else if(ct(t))n=function(e,t){const r=t.elements.map(t=>vh(e,t));return e=>r.forEach(t=>t(e))}(e,t);else{if(i=t,!Nn.isInstance(i,We))throw new Fn(t.$cstNode,`Unexpected element type: ${t.$type}`);{const r=e.consume++;n=()=>e.parser.consume(r,Qs,t)}}var i;return kh(e,r?void 0:Eh(t),n,t.cardinality)}function Rh(e){if(t=e,Nn.isInstance(t,ze)){const t=Rh(e.left),r=Rh(e.right);return e=>t(e)||r(e)}if(function(e){return Nn.isInstance(e,Pe)}(e)){const t=Rh(e.left),r=Rh(e.right);return e=>t(e)&&r(e)}if(function(e){return Nn.isInstance(e,Bt)}(e)){const t=Rh(e.value);return e=>!t(e)}if(function(e){return Nn.isInstance(e,Xt)}(e)){const t=e.parameter.ref.name;return e=>void 0!==e&&!0===e[t]}if(function(e){return Nn.isInstance(e,Ce)}(e)){const t=Boolean(e.true);return()=>t}var t;qn()}function Eh(e){if(ct(e))return e.guardCondition}function Sh(e,t,r=t.terminal){if(r){if(kr(r)&&ar(r.rule.ref)){const n=r.rule.ref,i=e.subrule++;let s;return r=>{s??(s=Ch(e,n)),e.parser.subrule(i,s,!1,t,r)}}if(kr(r)&&Jr(r.rule.ref)){const n=e.consume++,i=Ah(e,r.rule.ref.name);return()=>e.parser.consume(n,i,t)}if(Lt(r)){const n=e.consume++,i=Ah(e,r.value);return()=>e.parser.consume(n,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 r=pi(t.type.ref),n=null==r?void 0:r.terminal;if(!n)throw new Error("Could not find name assignment for type: "+Ti(t.type.ref));return Sh(e,t,n)}}function kh(e,t,r,n){const i=t&&Rh(t);if(!n){if(i){const t=e.or++;return n=>e.parser.alternatives(t,[{ALT:()=>r(n),GATE:()=>i(n)},{ALT:Pa(),GATE:()=>!i(n)}])}return r}if("*"===n){const t=e.many++;return n=>e.parser.many(t,{DEF:()=>r(n),GATE:i?()=>i(n):void 0})}if("+"===n){const t=e.many++;if(i){const n=e.or++;return s=>e.parser.alternatives(n,[{ALT:()=>e.parser.atLeastOne(t,{DEF:()=>r(s)}),GATE:()=>i(s)},{ALT:Pa(),GATE:()=>!i(s)}])}return n=>e.parser.atLeastOne(t,{DEF:()=>r(n)})}if("?"===n){const t=e.optional++;return n=>e.parser.optional(t,{DEF:()=>r(n),GATE:i?()=>i(n):void 0})}qn()}function Ch(e,t){const r=function(e,t){if(Q(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let r=t,n=r.$container,i=t.$type;for(;!ar(n);){if(ct(n)||he(n)||Tn(n)){i=n.elements.indexOf(r).toString()+":"+i}r=n,n=n.$container}return i=n.name+":"+i,e.ruleNames.set(t,i),i}}(e,t),n=e.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function Ah(e,t){const r=e.tokens[t];if(!r)throw new Error(`Token "${t}" not found."`);return r}function bh(e){const t=function(e){const t=e.Grammar,r=e.parser.Lexer,n=new uh(e);return yh(t,n,r.definition)}(e);return t.finalize(),t}class $h{constructor(){this.diagnostics=[]}buildTokens(e,t){const r=L(ai(e,!1)),n=this.buildTerminalTokens(r),i=this.buildKeywordTokens(r,n,t);return i.push(...n),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Jr).filter(e=>!e.fragment).map(e=>this.buildTerminalToken(e)).toArray()}buildTerminalToken(e){const t=vi(e),r=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,n={name:e.name,PATTERN:r};return"function"==typeof r&&(n.LINE_BREAKS=!0),e.hidden&&(n.GROUP=ii(t)?js.SKIPPED:"hidden"),n}requiresCustomPattern(e){return!(!e.flags.includes("u")&&!e.flags.includes("s"))}regexPatternFunction(e){const t=new RegExp(e,e.flags+"y");return(e,r)=>{t.lastIndex=r;return t.exec(e)}}buildKeywordTokens(e,t,r){return e.filter(Q).flatMap(e=>B(e).filter(Lt)).distinct(e=>e.value).toArray().sort((e,t)=>t.value.length-e.value.length).map(e=>this.buildKeywordToken(e,t,Boolean(null==r?void 0:r.caseInsensitive)))}buildKeywordToken(e,t,r){const n=this.buildKeywordPattern(e,r),i={name:e.value,PATTERN:n,LONGER_ALT:this.findLongerAlt(e,t)};return"function"==typeof n&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(si(e.value),"i"):e.value}findLongerAlt(e,t){return t.reduce((t,r)=>{const n=null==r?void 0:r.PATTERN;return(null==n?void 0:n.source)&&oi("^"+n.source+"$",e.value)&&t.push(r),t},[])}}class xh{convert(e,t){let r=t.grammarSource;if(Ge(r)&&(r=function(e){if(e.terminal)return e.terminal;if(e.type.ref){const t=pi(e.type.ref);return null==t?void 0:t.terminal}}(r)),kr(r)){const n=r.rule.ref;if(!n)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(n,e,t)}return e}runConverter(e,t,r){var n;switch(e.name.toUpperCase()){case"INT":return wh.convertInt(t);case"STRING":return wh.convertString(t);case"ID":return wh.convertID(t)}switch(null==(n=function(e){var t;return Jr(e)?(null==(t=e.type)?void 0:t.name)??"string":yi(e)??e.name}(e))?void 0:n.toLowerCase()){case"number":return wh.convertNumber(t);case"boolean":return wh.convertBoolean(t);case"bigint":return wh.convertBigint(t);case"date":return wh.convertDate(t);default:return t}}}var wh;!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 r="";for(let n=1;n<e.length-1;n++){const i=e.charAt(n);if("\\"===i){r+=t(e.charAt(++n))}else r+=i}return r},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()}}(wh||(wh={}));var Nh={},Ih={};let _h;function Ph(){if(void 0===_h)throw new Error("No runtime abstraction layer installed");return _h}Object.defineProperty(Ih,"__esModule",{value:!0}),(Ph||(Ph={})).install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");_h=e},Ih.default=Ph;var Lh={};function Oh(e){return"string"==typeof e||e instanceof String}function Dh(e){return Array.isArray(e)}Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.stringArray=Lh.array=Lh.func=Lh.error=Lh.number=Lh.string=Lh.boolean=void 0,Lh.boolean=function(e){return!0===e||!1===e},Lh.string=Oh,Lh.number=function(e){return"number"==typeof e||e instanceof Number},Lh.error=function(e){return e instanceof Error},Lh.func=function(e){return"function"==typeof e},Lh.array=Dh,Lh.stringArray=function(e){return Dh(e)&&e.every(e=>Oh(e))};var Mh={};Object.defineProperty(Mh,"__esModule",{value:!0});var Fh=Mh.Emitter=Mh.Event=void 0;const qh=Ih;var jh,Uh;!function(e){const t={dispose(){}};e.None=function(){return t}}(jh||(Mh.Event=jh={}));class Gh{add(e,t=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let r=!1;for(let n=0,i=this._callbacks.length;n<i;n++)if(this._callbacks[n]===e){if(this._contexts[n]===t)return this._callbacks.splice(n,1),void this._contexts.splice(n,1);r=!0}if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const t=[],r=this._callbacks.slice(0),n=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{t.push(r[s].apply(n[s],e))}catch(i){(0,qh.default)().console.error(i)}return t}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class zh{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,r)=>{this._callbacks||(this._callbacks=new Gh),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const n={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),n.dispose=zh._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(n),n}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}Fh=Mh.Emitter=zh,zh._noop=function(){},Object.defineProperty(Nh,"__esModule",{value:!0});var Bh=Nh.CancellationTokenSource=Uh=Nh.CancellationToken=void 0;const Kh=Ih,Wh=Lh,Vh=Mh;var Hh,Yh;(Yh=Hh||(Uh=Nh.CancellationToken=Hh={})).None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vh.Event.None}),Yh.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Vh.Event.None}),Yh.is=function(e){const t=e;return t&&(t===Yh.None||t===Yh.Cancelled||Wh.boolean(t.isCancellationRequested)&&!!t.onCancellationRequested)};const Xh=Object.freeze(function(e,t){const r=(0,Kh.default)().timer.setTimeout(e.bind(t),0);return{dispose(){r.dispose()}}});class Jh{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Xh:(this._emitter||(this._emitter=new Vh.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}Bh=Nh.CancellationTokenSource=class{get token(){return this._token||(this._token=new Jh),this._token}cancel(){this._token?this._token.cancel():this._token=Hh.Cancelled}dispose(){this._token?this._token instanceof Jh&&this._token.dispose():this._token=Hh.None}};let Zh=0;const Qh=Symbol("OperationCancelled");function ep(e){return e===Qh}async function tp(e){if(e===Uh.None)return;const t=performance.now();if(t-Zh>=10&&(Zh=t,await new Promise(e=>{"undefined"==typeof setImmediate?setTimeout(e,0):setImmediate(e)}),Zh=performance.now()),e.isCancellationRequested)throw Qh}class rp{constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)})}}class np{constructor(e,t,r,n){this._uri=e,this._languageId=t,this._version=r,this._content=n,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),r=this.offsetAt(e.end);return this._content.substring(t,r)}return this._content}update(e,t){for(const r of e)if(np.isIncremental(r)){const e=up(r.range),t=this.offsetAt(e.start),n=this.offsetAt(e.end);this._content=this._content.substring(0,t)+r.text+this._content.substring(n,this._content.length);const i=Math.max(e.start.line,0),s=Math.max(e.end.line,0);let o=this._lineOffsets;const a=cp(r.text,!1,t);if(s-i===a.length)for(let r=0,l=a.length;r<l;r++)o[r+i+1]=a[r];else a.length<1e4?o.splice(i+1,s-i,...a):this._lineOffsets=o=o.slice(0,i+1).concat(a,o.slice(s+1));const c=r.text.length-(n-t);if(0!==c)for(let r=i+1+a.length,l=o.length;r<l;r++)o[r]=o[r]+c}else{if(!np.isFull(r))throw new Error("Unknown change event received");this._content=r.text,this._lineOffsets=void 0}this._version=t}getLineOffsets(){return void 0===this._lineOffsets&&(this._lineOffsets=cp(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const t=this.getLineOffsets();let r=0,n=t.length;if(0===n)return{line:0,character:e};for(;r<n;){const i=Math.floor((r+n)/2);t[i]>e?n=i:r=i+1}const i=r-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 r=t[e.line];if(e.character<=0)return r;const n=e.line+1<t.length?t[e.line+1]:this._content.length,i=Math.min(r+e.character,n);return this.ensureBeforeEOL(i,r)}ensureBeforeEOL(e,t){for(;e>t&&lp(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 ip,sp,op;function ap(e,t){if(e.length<=1)return e;const r=e.length/2|0,n=e.slice(0,r),i=e.slice(r);ap(n,t),ap(i,t);let s=0,o=0,a=0;for(;s<n.length&&o<i.length;){const r=t(n[s],i[o]);e[a++]=r<=0?n[s++]:i[o++]}for(;s<n.length;)e[a++]=n[s++];for(;o<i.length;)e[a++]=i[o++];return e}function cp(e,t,r=0){const n=t?[r]:[];for(let i=0;i<e.length;i++){const t=e.charCodeAt(i);lp(t)&&(13===t&&i+1<e.length&&10===e.charCodeAt(i+1)&&i++,n.push(r+i+1))}return n}function lp(e){return 13===e||10===e}function up(e){const t=e.start,r=e.end;return t.line>r.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}function dp(e){const t=up(e.range);return t!==e.range?{newText:e.newText,range:t}:e}(sp=ip||(ip={})).create=function(e,t,r,n){return new np(e,t,r,n)},sp.update=function(e,t,r){if(e instanceof np)return e.update(t,r),e;throw new Error("TextDocument.update: document must be created by TextDocument.create")},sp.applyEdits=function(e,t){const r=e.getText(),n=ap(t.map(dp),(e,t)=>{const r=e.range.start.line-t.range.start.line;return 0===r?e.range.start.character-t.range.start.character:r});let i=0;const s=[];for(const o of n){const t=e.offsetAt(o.range.start);if(t<i)throw new Error("Overlapping edit");t>i&&s.push(r.substring(i,t)),o.newText.length&&s.push(o.newText),i=e.offsetAt(o.range.end)}return s.push(r.substr(i)),s.join("")},(()=>{var e={975:e=>{function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",i=0,s=-1,o=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(s===a-1||1===o);else if(s!==a-1&&2===o){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var c=n.lastIndexOf("/");if(c!==n.length-1){-1===c?(n="",i=0):i=(n=n.slice(0,c)).length-1-n.lastIndexOf("/"),s=a,o=0;continue}}else if(2===n.length||1===n.length){n="",i=0,s=a,o=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),i=a-s-1;s=a,o=0}else 46===r&&-1!==o?++o:o=-1}return n}var n={resolve:function(){for(var e,n="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var o;s>=0?o=arguments[s]:(void 0===e&&(e=process.cwd()),o=e),t(o),0!==o.length&&(n=o+"/"+n,i=47===o.charCodeAt(0))}return n=r(n,!i),i?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&i&&(e+="/"),n?"/"+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,r=0;r<arguments.length;++r){var i=arguments[r];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var s=e.length,o=s-i,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var c=r.length-a,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(47===r.charCodeAt(a+d))return r.slice(a+d+1);if(0===d)return r.slice(a+d)}else o>l&&(47===e.charCodeAt(i+d)?u=d:0===d&&(u=0));break}var h=e.charCodeAt(i+d);if(h!==r.charCodeAt(a+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+r.slice(a+u):(a+=u,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,i=-1,s=!0,o=e.length-1;o>=1;--o)if(47===(r=e.charCodeAt(o))){if(!s){i=o;break}}else s=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,i=0,s=-1,o=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,c=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!o){i=n+1;break}}else-1===c&&(o=!1,c=n+1),a>=0&&(l===r.charCodeAt(a)?-1==--a&&(s=n):(a=-1,s=c))}return i===s?s=c:-1===s&&(s=e.length),e.slice(i,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!o){i=n+1;break}}else-1===s&&(o=!1,s=n+1);return-1===s?"":e.slice(i,s)},extname:function(e){t(e);for(var r=-1,n=0,i=-1,s=!0,o=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===i&&(s=!1,i=a+1),46===c?-1===r?r=a:1!==o&&(o=1):-1!==r&&(o=-1);else if(!s){n=a+1;break}}return-1===r||-1===i||0===o||1===o&&r===i-1&&r===n+1?"":e.slice(r,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 r=(t=e).dir||t.root,n=t.base||(t.name||"")+(t.ext||""),r?r===t.root?r+n:r+"/"+n:n;var t,r,n},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,i=e.charCodeAt(0),s=47===i;s?(r.root="/",n=1):n=0;for(var o=-1,a=0,c=-1,l=!0,u=e.length-1,d=0;u>=n;--u)if(47!==(i=e.charCodeAt(u)))-1===c&&(l=!1,c=u+1),46===i?-1===o?o=u:1!==d&&(d=1):-1!==o&&(d=-1);else if(!l){a=u+1;break}return-1===o||-1===c||0===d||1===d&&o===c-1&&o===a+1?-1!==c&&(r.base=r.name=0===a&&s?e.slice(1,c):e.slice(a,c)):(0===a&&s?(r.name=e.slice(1,o),r.base=e.slice(1,c)):(r.name=e.slice(a,o),r.base=e.slice(a,c)),r.ext=e.slice(o,c)),a>0?r.dir=e.slice(0,a-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};let i;if(r.r(n),r.d(n,{URI:()=>h,Utils:()=>$}),"object"==typeof process)i="win32"===process.platform;else if("object"==typeof navigator){let e=navigator.userAgent;i=e.indexOf("Windows")>=0}const s=/^\w[\w\d+.-]*$/,o=/^\//,a=/^\/\//;function c(e,t){if(!e.scheme&&t)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!s.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!o.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(a.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 l="",u="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class h{constructor(e,t,r,n,i,s=!1){y(this,"scheme"),y(this,"authority"),y(this,"path"),y(this,"query"),y(this,"fragment"),"object"==typeof e?(this.scheme=e.scheme||l,this.authority=e.authority||l,this.path=e.path||l,this.query=e.query||l,this.fragment=e.fragment||l):(this.scheme=function(e,t){return e||t?e:"file"}(e,s),this.authority=t||l,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==u&&(t=u+t):t=u}return t}(this.scheme,r||l),this.query=n||l,this.fragment=i||l,c(this,s))}static isUri(e){return e instanceof h||!!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 v(this)}with(e){if(!e)return this;let{scheme:t,authority:r,path:n,query:i,fragment:s}=e;return void 0===t?t=this.scheme:null===t&&(t=l),void 0===r?r=this.authority:null===r&&(r=l),void 0===n?n=this.path:null===n&&(n=l),void 0===i?i=this.query:null===i&&(i=l),void 0===s?s=this.fragment:null===s&&(s=l),t===this.scheme&&r===this.authority&&n===this.path&&i===this.query&&s===this.fragment?this:new f(t,r,n,i,s)}static parse(e,t=!1){const r=d.exec(e);return r?new f(r[2]||l,k(r[4]||l),k(r[5]||l),k(r[7]||l),k(r[9]||l),t):new f(l,l,l,l,l)}static file(e){let t=l;if(i&&(e=e.replace(/\\/g,u)),e[0]===u&&e[1]===u){const r=e.indexOf(u,2);-1===r?(t=e.substring(2),e=u):(t=e.substring(2,r),e=e.substring(r)||u)}return new f("file",t,e,l,l)}static from(e){const t=new f(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return R(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof h)return e;{const t=new f(e);return t._formatted=e.external,t._fsPath=e._sep===p?e.fsPath:null,t}}return e}}const p=i?1:void 0;class f extends h{constructor(){super(...arguments),y(this,"_formatted",null),y(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString(e=!1){return e?R(this,!0):(this._formatted||(this._formatted=R(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=p),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 m={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 g(e,t,r){let n,i=-1;for(let s=0;s<e.length;s++){const o=e.charCodeAt(s);if(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||45===o||46===o||95===o||126===o||t&&47===o||r&&91===o||r&&93===o||r&&58===o)-1!==i&&(n+=encodeURIComponent(e.substring(i,s)),i=-1),void 0!==n&&(n+=e.charAt(s));else{void 0===n&&(n=e.substr(0,s));const t=m[o];void 0!==t?(-1!==i&&(n+=encodeURIComponent(e.substring(i,s)),i=-1),n+=t):-1===i&&(i=s)}}return-1!==i&&(n+=encodeURIComponent(e.substring(i))),void 0!==n?n:e}function T(e){let t;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);35===n||63===n?(void 0===t&&(t=e.substr(0,r)),t+=m[n]):void 0!==t&&(t+=e[r])}return void 0!==t?t:e}function v(e,t){let r;return r=e.authority&&e.path.length>1&&"file"===e.scheme?`//${e.authority}${e.path}`:47===e.path.charCodeAt(0)&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&58===e.path.charCodeAt(2)?e.path[1].toLowerCase()+e.path.substr(2):e.path,i&&(r=r.replace(/\//g,"\\")),r}function R(e,t){const r=t?T:g;let n="",{scheme:i,authority:s,path:o,query:a,fragment:c}=e;if(i&&(n+=i,n+=":"),(s||"file"===i)&&(n+=u,n+=u),s){let e=s.indexOf("@");if(-1!==e){const t=s.substr(0,e);s=s.substr(e+1),e=t.lastIndexOf(":"),-1===e?n+=r(t,!1,!1):(n+=r(t.substr(0,e),!1,!1),n+=":",n+=r(t.substr(e+1),!1,!0)),n+="@"}s=s.toLowerCase(),e=s.lastIndexOf(":"),-1===e?n+=r(s,!1,!0):(n+=r(s.substr(0,e),!1,!0),n+=s.substr(e))}if(o){if(o.length>=3&&47===o.charCodeAt(0)&&58===o.charCodeAt(2)){const e=o.charCodeAt(1);e>=65&&e<=90&&(o=`/${String.fromCharCode(e+32)}:${o.substr(3)}`)}else if(o.length>=2&&58===o.charCodeAt(1)){const e=o.charCodeAt(0);e>=65&&e<=90&&(o=`${String.fromCharCode(e+32)}:${o.substr(2)}`)}n+=r(o,!0,!1)}return a&&(n+="?",n+=r(a,!1,!1)),c&&(n+="#",n+=t?c:g(c,!1,!1)),n}function E(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+E(e.substr(3)):e}}const S=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function k(e){return e.match(S)?e.replace(S,e=>E(e)):e}var C=r(975);const A=C.posix||C,b="/";var $,x;(x=$||($={})).joinPath=function(e,...t){return e.with({path:A.join(e.path,...t)})},x.resolvePath=function(e,...t){let r=e.path,n=!1;r[0]!==b&&(r=b+r,n=!0);let i=A.resolve(r,...t);return n&&i[0]===b&&!e.authority&&(i=i.substring(1)),e.with({path:i})},x.dirname=function(e){if(0===e.path.length||e.path===b)return e;let t=A.dirname(e.path);return 1===t.length&&46===t.charCodeAt(0)&&(t=""),e.with({path:t})},x.basename=function(e){return A.basename(e.path)},x.extname=function(e){return A.extname(e.path)},op=n})();const{URI:hp,Utils:pp}=op;var fp,mp,gp;!function(e){e.basename=pp.basename,e.dirname=pp.dirname,e.extname=pp.extname,e.joinPath=pp.joinPath,e.resolvePath=pp.resolvePath;const t="object"==typeof process&&"win32"===(null==process?void 0:process.platform);e.equals=function(e,t){return(null==e?void 0:e.toString())===(null==t?void 0:t.toString())},e.relative=function(e,r){const n="string"==typeof e?hp.parse(e).path:e.path,i="string"==typeof r?hp.parse(r).path:r.path,s=n.split("/").filter(e=>e.length>0),o=i.split("/").filter(e=>e.length>0);if(t){const e=/^[A-Z]:$/;if(s[0]&&e.test(s[0])&&(s[0]=s[0].toLowerCase()),o[0]&&e.test(o[0])&&(o[0]=o[0].toLowerCase()),s[0]!==o[0])return i.substring(1)}let a=0;for(;a<s.length&&s[a]===o[a];a++);return"../".repeat(s.length-a)+o.slice(a).join("/")},e.normalize=function(e){return hp.parse(e.toString()).toString()},e.contains=function(e,t){let r="string"==typeof e?e:e.path,n="string"==typeof t?t:t.path;return"/"===n.charAt(n.length-1)&&(n=n.slice(0,-1)),"/"===r.charAt(r.length-1)&&(r=r.slice(0,-1)),n===r||!(n.length<r.length)&&("/"===n.charAt(r.length)&&n.startsWith(r))}}(fp||(fp={}));class yp{constructor(){this.root={name:"",children:new Map}}normalizeUri(e){return fp.normalize(e)}clear(){this.root.children.clear()}insert(e,t){this.getNode(this.normalizeUri(e),!0).element=t}delete(e){const t=this.getNode(this.normalizeUri(e),!1);(null==t?void 0:t.parent)&&t.parent.children.delete(t.name)}has(e){var t;return void 0!==(null==(t=this.getNode(this.normalizeUri(e),!1))?void 0:t.element)}hasNode(e){return void 0!==this.getNode(this.normalizeUri(e),!1)}find(e){var t;return null==(t=this.getNode(this.normalizeUri(e),!1))?void 0:t.element}findNode(e){const t=this.normalizeUri(e),r=this.getNode(t,!1);if(r)return{name:r.name,uri:fp.joinPath(hp.parse(t),r.name).toString(),element:r.element}}findChildren(e){const t=this.normalizeUri(e),r=this.getNode(t,!1);return r?Array.from(r.children.values()).map(e=>({name:e.name,uri:fp.joinPath(hp.parse(t),e.name).toString(),element:e.element})):[]}all(){return this.collectValues(this.root)}findAll(e){const t=this.getNode(fp.normalize(e),!1);return t?this.collectValues(t):[]}getNode(e,t){const r=e.split("/");"/"===e.charAt(e.length-1)&&r.pop();let n=this.root;for(const i of r){let e=n.children.get(i);if(!e){if(!t)return;e={name:i,children:new Map,parent:n},n.children.set(i,e)}n=e}return n}collectValues(e){const t=[];e.element&&t.push(e.element);for(const r of e.children.values())t.push(...this.collectValues(r));return t}}(gp=mp||(mp={}))[gp.Changed=0]="Changed",gp[gp.Parsed=1]="Parsed",gp[gp.IndexedContent=2]="IndexedContent",gp[gp.ComputedScopes=3]="ComputedScopes",gp[gp.Linked=4]="Linked",gp[gp.IndexedReferences=5]="IndexedReferences",gp[gp.Validated=6]="Validated";class Tp{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Uh.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,t)}fromTextDocument(e,t,r){return t=t??hp.parse(e.uri),Uh.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromString(e,t,r){return Uh.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,r){if("string"==typeof t){const n=this.parse(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}if("$model"in t){const r={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(r,e)}{const n=this.parse(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}async createAsync(e,t,r){if("string"==typeof t){const n=await this.parseAsync(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}{const n=await this.parseAsync(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}createLangiumDocument(e,t,r,n){let i;if(r)i={parseResult:e,uri:t,state:mp.Parsed,references:[],textDocument:r};else{const r=this.createTextDocumentGetter(t,n);i={parseResult:e,uri:t,state:mp.Parsed,references:[],get textDocument(){return r()}}}return e.value.$document=i,i}async update(e,t){var r,n;const i=null==(r=e.parseResult.value.$cstNode)?void 0:r.root.fullText,s=null==(n=this.textDocuments)?void 0:n.get(e.uri.toString()),o=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{const t=this.createTextDocumentGetter(e.uri,o);Object.defineProperty(e,"textDocument",{get:t})}return i!==o&&(e.parseResult=await this.parseAsync(e.uri,o,t),e.parseResult.value.$document=e),e.state=mp.Parsed,e}parse(e,t,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,r)}parseAsync(e,t,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,r)}createTextDocumentGetter(e,t){const r=this.serviceRegistry;let n;return()=>n??(n=ip.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,t??""))}}class vp{constructor(e){this.documentTrie=new yp,this.services=e,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.documentBuilder=()=>e.workspace.DocumentBuilder}get all(){return L(this.documentTrie.all())}addDocument(e){const t=e.uri.toString();if(this.documentTrie.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentTrie.insert(t,e)}getDocument(e){const t=e.toString();return this.documentTrie.find(t)}getDocuments(e){const t=e.toString();return this.documentTrie.findAll(t)}async getOrCreateDocument(e,t){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(r),r)}createDocument(e,t,r){if(r)return this.langiumDocumentFactory.fromString(t,e,r).then(e=>(this.addDocument(e),e));{const r=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(r),r}}hasDocument(e){return this.documentTrie.has(e.toString())}invalidateDocument(e){const t=e.toString(),r=this.documentTrie.find(t);return r&&this.documentBuilder().resetToState(r,mp.Changed),r}deleteDocument(e){const t=e.toString(),r=this.documentTrie.find(t);return r&&(r.state=mp.Changed,this.documentTrie.delete(t)),r}deleteDocuments(e){const t=e.toString(),r=this.documentTrie.findAll(t);for(const n of r)n.state=mp.Changed;return this.documentTrie.delete(t),r}}const Rp=Symbol("RefResolving");class Ep{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async link(e,t=Uh.None){var r;if(null==(r=this.profiler)?void 0:r.isActive("linking")){const r=this.profiler.createTask("linking",this.languageId);r.start();try{for(const n of K(e.parseResult.value))await tp(t),V(n).forEach(t=>{const i=`${n.$type}:${t.property}`;r.startSubTask(i);try{this.doLink(t,e)}finally{r.stopSubTask(i)}})}finally{r.stop()}}else for(const n of K(e.parseResult.value))await tp(t),V(n).forEach(t=>this.doLink(t,e))}doLink(e,t){const r=e.reference;if("_ref"in r&&void 0===r._ref){r._ref=Rp;try{const t=this.getCandidate(e);if(C(t))r._ref=t;else{r._nodeDescription=t;const n=this.loadAstNode(t);r._ref=n??this.createLinkingError(e,t)}}catch(n){console.error(`An error occurred while resolving reference to '${r.$refText}':`,n);const t=n.message??String(n);r._ref={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${t}`}}t.references.push(r)}else if("_items"in r&&void 0===r._items){r._items=Rp;try{const t=this.getCandidates(e),n=[];if(C(t))r._linkingError=t;else for(const e of t){const t=this.loadAstNode(e);t&&n.push({ref:t,$nodeDescription:e})}r._items=n}catch(n){r._linkingError={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${n}`},r._items=[]}t.references.push(r)}}unlink(e){for(const t of e.references)"_ref"in t?(t._ref=void 0,delete t._nodeDescription):"_items"in t&&(t._items=void 0,delete t._linkingError);e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}getCandidates(e){const t=this.scopeProvider.getScope(e).getElements(e.reference.$refText).distinct(e=>`${e.documentUri}#${e.path}`).toArray();return t.length>0?t:this.createLinkingError(e)}buildReference(e,t,r,n){const i=this,s={$refNode:r,$refText:n,_ref:void 0,get ref(){if(E(this._ref))return this._ref;if("object"==typeof(r=this._nodeDescription)&&null!==r&&"string"==typeof r.name&&"string"==typeof r.type&&"string"==typeof r.path){const r=i.loadAstNode(this._nodeDescription);this._ref=r??i.createLinkingError({reference:s,container:e,property:t},this._nodeDescription)}else if(void 0===this._ref){this._ref=Rp;const r=U(e).$document,n=i.getLinkedNode({reference:s,container:e,property:t});if(n.error&&r&&r.state<mp.ComputedScopes)return this._ref=void 0;this._ref=n.node??n.error,this._nodeDescription=n.descr,null==r||r.references.push(this)}else this._ref===Rp&&i.throwCyclicReferenceError(e,t,n);var r;return E(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return C(this._ref)?this._ref:void 0}};return s}buildMultiReference(e,t,r,n){const i=this,s={$refNode:r,$refText:n,_items:void 0,get items(){if(Array.isArray(this._items))return this._items;if(void 0===this._items){this._items=Rp;const r=U(e).$document,n=i.getCandidates({reference:s,container:e,property:t}),o=[];if(C(n))this._linkingError=n;else for(const e of n){const t=i.loadAstNode(e);t&&o.push({ref:t,$nodeDescription:e})}this._items=o,null==r||r.references.push(this)}else this._items===Rp&&i.throwCyclicReferenceError(e,t,n);return Array.isArray(this._items)?this._items:[]},get error(){if(this._linkingError)return this._linkingError;return this.items.length>0?void 0:this._linkingError=i.createLinkingError({reference:s,container:e,property:t})}};return s}throwCyclicReferenceError(e,t,r){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`)}getLinkedNode(e){try{const t=this.getCandidate(e);if(C(t))return{error:t};const r=this.loadAstNode(t);return r?{node:r,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,t);const r=t.message??String(t);return{error:{info: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 r=U(e.container).$document;r&&r.state<mp.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);return{info:e,message:`Could not resolve reference to ${this.reflection.getReferenceType(e)} named '${e.reference.$refText}'.`,targetDescription:t}}}class Sp{getName(e){if(function(e){return"string"==typeof e.name}(e))return e.name}getNameNode(e){return ui(e.$cstNode,"name")}}class kp{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator,this.documents=e.shared.workspace.LangiumDocuments,this.hasMultiReference=K(e.Grammar).some(e=>Ge(e)&&e.isMulti)}findDeclarations(e){if(e){const t=function(e){var t;const r=e.astNode;for(;r===(null==(t=e.container)?void 0:t.astNode);){const t=q(e.grammarSource,ke);if(t)return t;e=e.container}}(e),r=e.astNode;if(t&&r){const n=r[t.feature];if(S(n)||k(n))return G(n);if(Array.isArray(n))for(const t of n)if((S(t)||k(t))&&t.$refNode&&t.$refNode.offset<=e.offset&&t.$refNode.end>=e.end)return G(t)}if(r){const t=this.nameProvider.getNameNode(r);if(t&&(t===e||function(e,t){for(;e.container;)if((e=e.container)===t)return!0;return!1}(e,t)))return this.getSelfNodes(r)}}return[]}getSelfNodes(e){if(this.hasMultiReference){const t=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)),r=this.getNodeFromReferenceDescription(t.head());if(r)for(const n of V(r))if(k(n.reference)&&n.reference.items.some(t=>t.ref===e))return n.reference.items.map(e=>e.ref);return[e]}return[e]}getNodeFromReferenceDescription(e){if(!e)return;const t=this.documents.getDocument(e.sourceUri);return t?this.nodeLocator.getAstNode(t.parseResult.value,e.sourcePath):void 0}findDeclarationNodes(e){const t=this.findDeclarations(e),r=[];for(const n of t){const e=this.nameProvider.getNameNode(n)??n.$cstNode;e&&r.push(e)}return r}findReferences(e,t){const r=[];t.includeDeclaration&&r.push(...this.getSelfReferences(e));let n=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(n=n.filter(e=>fp.equals(e.sourceUri,t.documentUri))),r.push(...n),L(r)}getSelfReferences(e){const t=this.getSelfNodes(e),r=[];for(const n of t){const e=this.nameProvider.getNameNode(n);if(e){const t=j(n),i=this.nodeLocator.getAstNodePath(n);r.push({sourceUri:t.uri,sourcePath:i,targetUri:t.uri,targetPath:i,segment:Pn(e),local:!0})}}return r}}class Cp{constructor(e){if(this.map=new Map,e)for(const[t,r]of e)this.add(t,r)}get size(){return D.sum(L(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(void 0===t)return this.map.delete(e);{const r=this.map.get(e);if(r){const n=r.indexOf(t);if(n>=0)return 1===r.length?this.map.delete(e):r.splice(n,1),!0}return!1}}get(e){return this.map.get(e)??[]}getStream(e){const t=this.map.get(e);return t?L(t):_}has(e,t){if(void 0===t)return this.map.has(e);{const r=this.map.get(e);return!!r&&r.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,r)=>t.forEach(t=>e(t,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return L(this.map.entries()).flatMap(([e,t])=>t.map(t=>[e,t]))}keys(){return L(this.map.keys())}values(){return L(this.map.values()).flat()}entriesGroupedByKey(){return L(this.map.entries())}}class Ap{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[t,r]of e)this.set(t,r)}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 bp{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(e,t=Uh.None){return this.collectExportedSymbolsForNode(e.parseResult.value,e,void 0,t)}async collectExportedSymbolsForNode(e,t,r=z,n=Uh.None){const i=[];this.addExportedSymbol(e,i,t);for(const s of r(e))await tp(n),this.addExportedSymbol(s,i,t);return i}addExportedSymbol(e,t,r){const n=this.nameProvider.getName(e);n&&t.push(this.descriptions.createDescription(e,n,r))}async collectLocalSymbols(e,t=Uh.None){const r=e.parseResult.value,n=new Cp;for(const i of B(r))await tp(t),this.addLocalSymbol(i,e,n);return n}addLocalSymbol(e,t,r){const n=e.$container;if(n){const i=this.nameProvider.getName(e);i&&r.add(n,this.descriptions.createDescription(e,i,t))}}}class $p{constructor(e,t,r){this.elements=e,this.outerScope=t,this.caseInsensitive=(null==r?void 0:r.caseInsensitive)??!1,this.concatOuterScope=(null==r?void 0:r.concatOuterScope)??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.find(e=>e.name.toLowerCase()===t):this.elements.find(t=>t.name===e);return r||(this.outerScope?this.outerScope.getElement(e):void 0)}getElements(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.filter(e=>e.name.toLowerCase()===t):this.elements.filter(t=>t.name===e);return(this.concatOuterScope||r.isEmpty())&&this.outerScope?r.concat(this.outerScope.getElements(e)):r}}class xp{constructor(e,t,r){this.elements=new Cp,this.caseInsensitive=(null==r?void 0:r.caseInsensitive)??!1,this.concatOuterScope=(null==r?void 0:r.concatOuterScope)??!0;for(const n of e){const e=this.caseInsensitive?n.name.toLowerCase():n.name;this.elements.add(e,n)}this.outerScope=t}getElement(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t)[0];return r||(this.outerScope?this.outerScope.getElement(e):void 0)}getElements(e){const t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);return(this.concatOuterScope||0===r.length)&&this.outerScope?L(r).concat(this.outerScope.getElements(e)):L(r)}getAllElements(){let e=L(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class wp{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 Np extends wp{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 r=t();return this.cache.set(e,r),r}}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class Ip extends wp{constructor(e){super(),this.cache=new Map,this.converter=e??(e=>e)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,r){this.throwIfDisposed(),this.cacheForContext(e).set(t,r)}get(e,t,r){this.throwIfDisposed();const n=this.cacheForContext(e);if(n.has(t))return n.get(t);if(r){const e=r();return n.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 r=this.cache.get(t);return r||(r=new Map,this.cache.set(t,r)),r}}class _p extends Np{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 Pp{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 _p(e.shared)}getScope(e){const t=[],r=this.reflection.getReferenceType(e),n=j(e.container).localSymbols;if(n){let i=e.container;do{n.has(i)&&t.push(n.getStream(i).filter(e=>this.reflection.isSubtype(e.type,r))),i=i.$container}while(i)}let i=this.getGlobalScope(r,e);for(let s=t.length-1;s>=0;s--)i=this.createScope(t[s],i);return i}createScope(e,t,r){return new $p(L(e),t,r)}createScopeForNodes(e,t,r){const n=L(e).map(e=>{const t=this.nameProvider.getName(e);if(t)return this.descriptions.createDescription(e,t)}).nonNullable();return new $p(n,t,r)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new xp(this.indexManager.allElements(e)))}}function Lp(e){return"object"==typeof e&&!!e&&("$ref"in e||"$error"in e)}class Op{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 r=t??{},n=null==t?void 0:t.replacer,i=(e,t)=>this.replacer(e,t,r),s=n?(e,t)=>n(e,t,i):i;try{return this.currentDocument=j(e),JSON.stringify(e,s,null==t?void 0:t.space)}finally{this.currentDocument=void 0}}deserialize(e,t){const r=t??{},n=JSON.parse(e);return this.linkNode(n,n,r),n}replacer(e,t,{refText:r,sourceText:n,textRegions:i,comments:s,uriConverter:o}){var a,c,l;if(!this.ignoreProperties.has(e)){if(S(t)){const e=t.ref,n=r?t.$refText:void 0;if(e){const t=j(e);let r="";this.currentDocument&&this.currentDocument!==t&&(r=o?o(t.uri,e):t.uri.toString());return{$ref:`${r}#${this.astNodeLocator.getAstNodePath(e)}`,$refText:n}}return{$error:(null==(a=t.error)?void 0:a.message)??"Could not resolve reference",$refText:n}}if(k(t)){const e=r?t.$refText:void 0,n=[];for(const r of t.items){const e=r.ref,t=j(r.ref);let i="";this.currentDocument&&this.currentDocument!==t&&(i=o?o(t.uri,e):t.uri.toString());const s=this.astNodeLocator.getAstNodePath(e);n.push(`${i}#${s}`)}return{$refs:n,$refText:e}}if(E(t)){let r;if(i&&(r=this.addAstNodeRegionWithAssignmentsTo({...t}),e&&!t.$document||!(null==r?void 0:r.$textRegion)||(r.$textRegion.documentURI=null==(c=this.currentDocument)?void 0:c.uri.toString())),n&&!e&&(r??(r={...t}),r.$sourceText=null==(l=t.$cstNode)?void 0:l.text),s){r??(r={...t});const e=this.commentProvider.getComment(t);e&&(r.$comment=e.replace(/\r/g,""))}return r??t}return t}}addAstNodeRegionWithAssignmentsTo(e){const t=e=>({offset:e.offset,end:e.end,length:e.length,range:e.range});if(e.$cstNode){const r=(e.$textRegion=t(e.$cstNode)).assignments={};return Object.keys(e).filter(e=>!e.startsWith("$")).forEach(n=>{const i=function(e,t){return e&&t?di(e,t,e.astNode,!0):[]}(e.$cstNode,n).map(t);0!==i.length&&(r[n]=i)}),e}}linkNode(e,t,r,n,i,s){for(const[a,c]of Object.entries(e))if(Array.isArray(c))for(let n=0;n<c.length;n++){const i=c[n];Lp(i)?c[n]=this.reviveReference(e,a,t,i,r):E(i)&&this.linkNode(i,t,r,e,a,n)}else Lp(c)?e[a]=this.reviveReference(e,a,t,c,r):E(c)&&this.linkNode(c,t,r,e,a);const o=e;o.$container=n,o.$containerProperty=i,o.$containerIndex=s}reviveReference(e,t,r,n,i){let s,o=n.$refText,a=n.$error;if(n.$ref){const e=this.getRefNode(r,n.$ref,i.uriConverter);if(E(e))return o||(o=this.nameProvider.getName(e)),{$refText:o??"",ref:e};a=e}else if(n.$refs){const e=[];for(const t of n.$refs){const n=this.getRefNode(r,t,i.uriConverter);E(n)&&e.push({ref:n})}if(0!==e.length)return{$refText:o??"",items:e};s={$refText:o??"",items:e},a??(a="Could not resolve multi-reference")}return a?(s??(s={$refText:o??"",ref:void 0}),s.error={info:{container:e,property:t,reference:s},message:a},s):void 0}getRefNode(e,t,r){try{const n=t.indexOf("#");if(0===n){const r=this.astNodeLocator.getAstNode(e,t.substring(1));return r||"Could not resolve path: "+t}if(n<0){const e=r?r(t):hp.parse(t),n=this.langiumDocuments.getDocument(e);return n?n.parseResult.value:"Could not find document for URI: "+t}const i=r?r(t.substring(0,n)):hp.parse(t.substring(0,n)),s=this.langiumDocuments.getDocument(i);if(!s)return"Could not find document for URI: "+t;if(n===t.length-1)return s.parseResult.value;const o=this.astNodeLocator.getAstNode(s.parseResult.value,t.substring(n+1));return o||"Could not resolve URI: "+t}catch(n){return String(n)}}}class Dp{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=null==e?void 0:e.workspace.TextDocuments}register(e){const t=e.LanguageMetaData;for(const r of t.fileExtensions)this.fileExtensionMap.has(r)&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileExtensionMap.set(r,e);if(t.fileNames)for(const r of t.fileNames)this.fileNameMap.has(r)&&console.warn(`The file name ${r} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileNameMap.set(r,e);this.languageIdMap.set(t.languageId,e)}getServices(e){var t,r;if(0===this.languageIdMap.size)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const n=null==(r=null==(t=this.textDocuments)?void 0:t.get(e))?void 0:r.languageId;if(void 0!==n){const e=this.languageIdMap.get(n);if(e)return e}const i=fp.extname(e),s=fp.basename(e),o=this.fileNameMap.get(s)??this.fileExtensionMap.get(i);if(!o)throw n?new Error(`The service registry contains no services for the extension '${i}' for language '${n}'.`):new Error(`The service registry contains no services for the extension '${i}'.`);return o}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function Mp(e){return{code:e}}var Fp,qp;(qp=Fp||(Fp={})).defaults=["fast","slow","built-in"],qp.all=qp.defaults;class jp{constructor(e){this.entries=new Cp,this.knownCategories=new Set(Fp.defaults),this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,t=this,r="fast"){if("built-in"===r)throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");this.knownCategories.add(r);for(const[n,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:r};this.addEntry(n,e)}else if("function"==typeof e){const i={check:this.wrapValidationException(e,t),category:r};this.addEntry(n,i)}else qn()}}wrapValidationException(e,t){return async(r,n,i)=>{await this.handleException(()=>e.call(t,r,n,i),"An error occurred during validation",n,r)}}async handleException(e,t,r,n){try{await e()}catch(i){if(ep(i))throw i;console.error(`${t}:`,i),i instanceof Error&&i.stack&&console.error(i.stack);r("error",`${t}: ${i instanceof Error?i.message:String(i)}`,{node:n})}}addEntry(e,t){if("AstNode"!==e)for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,t);else this.entries.add("AstNode",t)}getChecks(e,t){let r=L(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(r=r.filter(e=>t.includes(e.category))),r.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,r){return async(n,i,s,o)=>{await this.handleException(()=>e.call(r,n,i,s,o),t,i,n)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(e){return this.knownCategories}}const Up=Object.freeze({validateNode:!0,validateChildren:!0});class Gp{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async validateDocument(e,t={},r=Uh.None){const n=e.parseResult,i=[];if(await tp(r),!t.categories||t.categories.includes("built-in")){if(this.processLexingErrors(n,i,t),t.stopAfterLexingErrors&&i.some(e=>{var t;return(null==(t=e.data)?void 0:t.code)===Wp.LexingError}))return i;if(this.processParsingErrors(n,i,t),t.stopAfterParsingErrors&&i.some(e=>{var t;return(null==(t=e.data)?void 0:t.code)===Wp.ParsingError}))return i;if(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some(e=>{var t;return(null==(t=e.data)?void 0:t.code)===Wp.LinkingError}))return i}try{i.push(...await this.validateAst(n.value,t,r))}catch(s){if(ep(s))throw s;console.error("An error occurred during validation:",s)}return await tp(r),i}processLexingErrors(e,t,r){var n;const i=[...e.lexerErrors,...(null==(n=e.lexerReport)?void 0:n.diagnostics)??[]];for(const s of i){const e=s.severity??"error",r={severity:Bp(e),range:{start:{line:s.line-1,character:s.column-1},end:{line:s.line-1,character:s.column+s.length-1}},message:s.message,data:Kp(e),source:this.getSource()};t.push(r)}}processParsingErrors(e,t,r){for(const n of e.parserErrors){let e;if(isNaN(n.token.startOffset)){if("previousToken"in n){const t=n.previousToken;if(isNaN(t.startOffset)){const t={line:0,character:0};e={start:t,end:t}}else{const r={line:t.endLine-1,character:t.endColumn};e={start:r,end:r}}}}else e=_n(n.token);if(e){const r={severity:Bp("error"),range:e,message:n.message,data:Mp(Wp.ParsingError),source:this.getSource()};t.push(r)}}}processLinkingErrors(e,t,r){var n;for(const i of e.references){const e=i.error;if(e){const r={node:e.info.container,range:null==(n=i.$refNode)?void 0:n.range,property:e.info.property,index:e.info.index,data:{code:Wp.LinkingError,containerType:e.info.container.$type,property:e.info.property,refText:e.info.reference.$refText}};t.push(this.toDiagnostic("error",e.message,r))}}}async validateAst(e,t,r=Uh.None){const n=[],i=(e,t,r)=>{n.push(this.toDiagnostic(e,t,r))};return await this.validateAstBefore(e,t,i,r),await this.validateAstNodes(e,t,i,r),await this.validateAstAfter(e,t,i,r),n}async validateAstBefore(e,t,r,n=Uh.None){const i=this.validationRegistry.checksBefore;for(const s of i)await tp(n),await s(e,r,t.categories??[],n)}async validateAstNodes(e,t,r,n=Uh.None){var i;if(null==(i=this.profiler)?void 0:i.isActive("validating")){const i=this.profiler.createTask("validating",this.languageId);i.start();try{const s=K(e).iterator();for(const e of s){i.startSubTask(e.$type);const o=this.validateSingleNodeOptions(e,t);if(o.validateNode)try{const i=this.validationRegistry.getChecks(e.$type,t.categories);for(const t of i)await t(e,r,n)}finally{i.stopSubTask(e.$type)}o.validateChildren||s.prune()}}finally{i.stop()}}else{const i=K(e).iterator();for(const e of i){await tp(n);const s=this.validateSingleNodeOptions(e,t);if(s.validateNode){const i=this.validationRegistry.getChecks(e.$type,t.categories);for(const t of i)await t(e,r,n)}s.validateChildren||i.prune()}}}validateSingleNodeOptions(e,t){return Up}async validateAstAfter(e,t,r,n=Uh.None){const i=this.validationRegistry.checksAfter;for(const s of i)await tp(n),await s(e,r,t.categories??[],n)}toDiagnostic(e,t,r){return{message:t,range:zp(r),severity:Bp(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function zp(e){if(e.range)return e.range;let t;return"string"==typeof e.property?t=ui(e.node.$cstNode,e.property,e.index):"string"==typeof e.keyword&&(t=hi(e.node.$cstNode,e.keyword,e.index)),t??(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Bp(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 Kp(e){switch(e){case"error":return Mp(Wp.LexingError);case"warning":return Mp(Wp.LexingWarning);case"info":return Mp(Wp.LexingInfo);case"hint":return Mp(Wp.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}var Wp,Vp;(Vp=Wp||(Wp={})).LexingError="lexing-error",Vp.LexingWarning="lexing-warning",Vp.LexingInfo="lexing-info",Vp.LexingHint="lexing-hint",Vp.ParsingError="parsing-error",Vp.LinkingError="linking-error";class Hp{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,r){const n=r??j(e);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 o=()=>s??(s=Pn(this.nameProvider.getNameNode(e)??e.$cstNode));return{node:e,name:t,get nameSegment(){return o()},selectionSegment:Pn(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}}class Yp{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Uh.None){const r=[],n=e.parseResult.value;for(const i of K(n))await tp(t),V(i).forEach(e=>{e.reference.error||r.push(...this.createInfoDescriptions(e))});return r}createInfoDescriptions(e){const t=e.reference;if(t.error||!t.$refNode)return[];let r=[];S(t)&&t.$nodeDescription?r=[t.$nodeDescription]:k(t)&&(r=t.items.map(e=>e.$nodeDescription).filter(e=>void 0!==e));const n=j(e.container).uri,i=this.nodeLocator.getAstNodePath(e.container),s=[],o=Pn(t.$refNode);for(const a of r)s.push({sourceUri:n,sourcePath:i,targetUri:a.documentUri,targetPath:a.path,segment:o,local:fp.equals(a.documentUri,n)});return s}}class Xp{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const t=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return t+this.segmentSeparator+r}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 r=t.indexOf(this.indexSeparator);if(r>0){const n=t.substring(0,r),i=parseInt(t.substring(r+1)),s=e[n];return null==s?void 0:s[i]}return e[t]},e)}}class Jp{constructor(e){this._ready=new rp,this.onConfigurationSectionUpdateEmitter=new Fh,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var t;this.workspaceConfig=(null==(t=e.capabilities.workspace)?void 0:t.configuration)??!1}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)})),r=await e.fetchConfiguration(t);t.forEach((e,t)=>{this.updateSectionConfiguration(e.section,r[t])})}}this._ready.resolve()}updateConfiguration(e){"object"==typeof e.settings&&null!==e.settings&&Object.entries(e.settings).forEach(([e,t])=>{this.updateSectionConfiguration(e,t),this.onConfigurationSectionUpdateEmitter.fire({section:e,configuration:t})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;const r=this.toSectionName(e);if(this.settings[r])return this.settings[r][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var Zp={},Qp={},ef={},tf={},rf={};Object.defineProperty(rf,"__esModule",{value:!0}),rf.Message=rf.NotificationType9=rf.NotificationType8=rf.NotificationType7=rf.NotificationType6=rf.NotificationType5=rf.NotificationType4=rf.NotificationType3=rf.NotificationType2=rf.NotificationType1=rf.NotificationType0=rf.NotificationType=rf.RequestType9=rf.RequestType8=rf.RequestType7=rf.RequestType6=rf.RequestType5=rf.RequestType4=rf.RequestType3=rf.RequestType2=rf.RequestType1=rf.RequestType=rf.RequestType0=rf.AbstractMessageSignature=rf.ParameterStructures=rf.ResponseError=rf.ErrorCodes=void 0;const nf=Lh;var sf,of,af,cf;(of=sf||(rf.ErrorCodes=sf={})).ParseError=-32700,of.InvalidRequest=-32600,of.MethodNotFound=-32601,of.InvalidParams=-32602,of.InternalError=-32603,of.jsonrpcReservedErrorRangeStart=-32099,of.serverErrorStart=-32099,of.MessageWriteError=-32099,of.MessageReadError=-32098,of.PendingResponseRejected=-32097,of.ConnectionInactive=-32096,of.ServerNotInitialized=-32002,of.UnknownErrorCode=-32001,of.jsonrpcReservedErrorRangeEnd=-32e3,of.serverErrorEnd=-32e3;class lf extends Error{constructor(e,t,r){super(t),this.code=nf.number(e)?e:sf.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,lf.prototype)}toJson(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),e}}rf.ResponseError=lf;class uf{constructor(e){this.kind=e}static is(e){return e===uf.auto||e===uf.byName||e===uf.byPosition}toString(){return this.kind}}rf.ParameterStructures=uf,uf.auto=new uf("auto"),uf.byPosition=new uf("byPosition"),uf.byName=new uf("byName");class df{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return uf.auto}}rf.AbstractMessageSignature=df;rf.RequestType0=class extends df{constructor(e){super(e,0)}};rf.RequestType=class extends df{constructor(e,t=uf.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};rf.RequestType1=class extends df{constructor(e,t=uf.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};rf.RequestType2=class extends df{constructor(e){super(e,2)}};rf.RequestType3=class extends df{constructor(e){super(e,3)}};rf.RequestType4=class extends df{constructor(e){super(e,4)}};rf.RequestType5=class extends df{constructor(e){super(e,5)}};rf.RequestType6=class extends df{constructor(e){super(e,6)}};rf.RequestType7=class extends df{constructor(e){super(e,7)}};rf.RequestType8=class extends df{constructor(e){super(e,8)}};rf.RequestType9=class extends df{constructor(e){super(e,9)}};rf.NotificationType=class extends df{constructor(e,t=uf.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};rf.NotificationType0=class extends df{constructor(e){super(e,0)}};rf.NotificationType1=class extends df{constructor(e,t=uf.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};rf.NotificationType2=class extends df{constructor(e){super(e,2)}};rf.NotificationType3=class extends df{constructor(e){super(e,3)}};rf.NotificationType4=class extends df{constructor(e){super(e,4)}};rf.NotificationType5=class extends df{constructor(e){super(e,5)}};rf.NotificationType6=class extends df{constructor(e){super(e,6)}};rf.NotificationType7=class extends df{constructor(e){super(e,7)}};rf.NotificationType8=class extends df{constructor(e){super(e,8)}};rf.NotificationType9=class extends df{constructor(e){super(e,9)}},(cf=af||(rf.Message=af={})).isRequest=function(e){const t=e;return t&&nf.string(t.method)&&(nf.string(t.id)||nf.number(t.id))},cf.isNotification=function(e){const t=e;return t&&nf.string(t.method)&&void 0===e.id},cf.isResponse=function(e){const t=e;return t&&(void 0!==t.result||!!t.error)&&(nf.string(t.id)||nf.number(t.id)||null===t.id)};var hf,pf,ff,mf={};Object.defineProperty(mf,"__esModule",{value:!0}),mf.LRUCache=mf.LinkedMap=mf.Touch=void 0,(ff=pf||(mf.Touch=pf={})).None=0,ff.First=1,ff.AsOld=ff.First,ff.Last=2,ff.AsNew=ff.Last;class gf{constructor(){this[hf]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return null==(e=this._head)?void 0:e.value}get last(){var e;return null==(e=this._tail)?void 0:e.value}has(e){return this._map.has(e)}get(e,t=pf.None){const r=this._map.get(e);if(r)return t!==pf.None&&this.touch(r,t),r.value}set(e,t,r=pf.None){let n=this._map.get(e);if(n)n.value=t,r!==pf.None&&this.touch(n,r);else{switch(n={key:e,value:t,next:void 0,previous:void 0},r){case pf.None:this.addItemLast(n);break;case pf.First:this.addItemFirst(n);break;case pf.Last:default:this.addItemLast(n)}this._map.set(e,n),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const r=this._state;let n=this._head;for(;n;){if(t?e.bind(t)(n.value,n.key,this):e(n.value,n.key,this),this._state!==r)throw new Error("LinkedMap got modified during iteration.");n=n.next}}keys(){const e=this._state;let t=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return r}values(){const e=this._state;let t=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return r}entries(){const e=this._state;let t=this._head;const r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return r}[(hf=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();let t=this._head,r=this.size;for(;t&&r>e;)this._map.delete(t.key),t=t.next,r--;this._head=t,this._size=r,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,r=e.previous;if(!t||!r)throw new Error("Invalid list");t.previous=r,r.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(t===pf.First||t===pf.Last)if(t===pf.First){if(e===this._head)return;const t=e.next,r=e.previous;e===this._tail?(r.next=void 0,this._tail=r):(t.previous=r,r.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===pf.Last){if(e===this._tail)return;const t=e.next,r=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=r,r.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach((t,r)=>{e.push([r,t])}),e}fromJSON(e){this.clear();for(const[t,r]of e)this.set(t,r)}}mf.LinkedMap=gf;mf.LRUCache=class extends gf{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=pf.AsNew){return super.get(e,t)}peek(e){return super.get(e,pf.None)}set(e,t){return super.set(e,t,pf.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};var yf,Tf={};Object.defineProperty(Tf,"__esModule",{value:!0}),Tf.Disposable=void 0,(yf||(Tf.Disposable=yf={})).create=function(e){return{dispose:e}};var vf={};Object.defineProperty(vf,"__esModule",{value:!0}),vf.SharedArrayReceiverStrategy=vf.SharedArraySenderStrategy=void 0;const Rf=Nh;var Ef,Sf;(Sf=Ef||(Ef={})).Continue=0,Sf.Cancelled=1;vf.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(null===e.id)return;const t=new SharedArrayBuffer(4);new Int32Array(t,0,1)[0]=Ef.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){const r=this.buffers.get(t);if(void 0===r)return;const n=new Int32Array(r,0,1);Atomics.store(n,0,Ef.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};class kf{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Ef.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class Cf{constructor(e){this.token=new kf(e)}cancel(){}dispose(){}}vf.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(e){const t=e.$cancellationData;return void 0===t?new Rf.CancellationTokenSource:new Cf(t)}};var Af={},bf={};Object.defineProperty(bf,"__esModule",{value:!0}),bf.Semaphore=void 0;const $f=Ih;bf.Semaphore=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,r)=>{this._waiting.push({thunk:e,resolve:t,reject:r}),this.runNext()})}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,$f.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const t=e.thunk();t instanceof Promise?t.then(t=>{this._active--,e.resolve(t),this.runNext()},t=>{this._active--,e.reject(t),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}},Object.defineProperty(Af,"__esModule",{value:!0}),Af.ReadableStreamMessageReader=Af.AbstractMessageReader=Af.MessageReader=void 0;const xf=Ih,wf=Lh,Nf=Mh,If=bf;var _f,Pf;(_f||(Af.MessageReader=_f={})).is=function(e){let t=e;return t&&wf.func(t.listen)&&wf.func(t.dispose)&&wf.func(t.onError)&&wf.func(t.onClose)&&wf.func(t.onPartialMessage)};class Lf{constructor(){this.errorEmitter=new Nf.Emitter,this.closeEmitter=new Nf.Emitter,this.partialMessageEmitter=new Nf.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${wf.string(e.message)?e.message:"unknown"}`)}}Af.AbstractMessageReader=Lf,(Pf||(Pf={})).fromOptions=function(e){let t,r;const n=new Map;let i;const s=new Map;if(void 0===e||"string"==typeof e)t=e??"utf-8";else{if(t=e.charset??"utf-8",void 0!==e.contentDecoder&&(r=e.contentDecoder,n.set(r.name,r)),void 0!==e.contentDecoders)for(const t of e.contentDecoders)n.set(t.name,t);if(void 0!==e.contentTypeDecoder&&(i=e.contentTypeDecoder,s.set(i.name,i)),void 0!==e.contentTypeDecoders)for(const t of e.contentTypeDecoders)s.set(t.name,t)}return void 0===i&&(i=(0,xf.default)().applicationJson.decoder,s.set(i.name,i)),{charset:t,contentDecoder:r,contentDecoders:n,contentTypeDecoder:i,contentTypeDecoders:s}};Af.ReadableStreamMessageReader=class extends Lf{constructor(e,t){super(),this.readable=e,this.options=Pf.fromOptions(t),this.buffer=(0,xf.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new If.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const t=this.readable.onData(e=>{this.onData(e)});return this.readable.onError(e=>this.fireError(e)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(-1===this.nextMessageLength){const e=this.buffer.tryReadHeaders(!0);if(!e)return;const t=e.get("content-length");if(!t)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));const r=parseInt(t);if(isNaN(r))return void this.fireError(new Error(`Content-Length value must be a number. Got ${t}`));this.nextMessageLength=r}const e=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===e)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const t=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(e):e,r=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(r)}).catch(e=>{this.fireError(e)})}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,xf.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};var Of={};Object.defineProperty(Of,"__esModule",{value:!0}),Of.WriteableStreamMessageWriter=Of.AbstractMessageWriter=Of.MessageWriter=void 0;const Df=Ih,Mf=Lh,Ff=bf,qf=Mh;var jf,Uf;(jf||(Of.MessageWriter=jf={})).is=function(e){let t=e;return t&&Mf.func(t.dispose)&&Mf.func(t.onClose)&&Mf.func(t.onError)&&Mf.func(t.write)};class Gf{constructor(){this.errorEmitter=new qf.Emitter,this.closeEmitter=new qf.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,r){this.errorEmitter.fire([this.asError(e),t,r])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${Mf.string(e.message)?e.message:"unknown"}`)}}Of.AbstractMessageWriter=Gf,(Uf||(Uf={})).fromOptions=function(e){return void 0===e||"string"==typeof e?{charset:e??"utf-8",contentTypeEncoder:(0,Df.default)().applicationJson.encoder}:{charset:e.charset??"utf-8",contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,Df.default)().applicationJson.encoder}};Of.WriteableStreamMessageWriter=class extends Gf{constructor(e,t){super(),this.writable=e,this.options=Uf.fromOptions(t),this.errorCount=0,this.writeSemaphore=new Ff.Semaphore(1),this.writable.onError(e=>this.fireError(e)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(e=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(e):e).then(t=>{const r=[];return r.push("Content-Length: ",t.byteLength.toString(),"\r\n"),r.push("\r\n"),this.doWrite(e,r,t)},e=>{throw this.fireError(e),e}))}async doWrite(e,t,r){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(r)}catch(n){return this.handleError(n,e),Promise.reject(n)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};var zf={};Object.defineProperty(zf,"__esModule",{value:!0}),zf.AbstractMessageBuffer=void 0;zf.AbstractMessageBuffer=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const t="string"==typeof e?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(0===this._chunks.length)return;let t=0,r=0,n=0,i=0;e:for(;r<this._chunks.length;){const e=this._chunks[r];for(n=0;n<e.length;){switch(e[n]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,n++;break e;default:t=0}break;default:t=0}n++}i+=e.byteLength,r++}if(4!==t)return;const s=this._read(i+n),o=new Map,a=this.toString(s,"ascii").split("\r\n");if(a.length<2)return o;for(let c=0;c<a.length-2;c++){const t=a[c],r=t.indexOf(":");if(-1===r)throw new Error(`Message header must separate key and value using ':'\n${t}`);const n=t.substr(0,r),i=t.substr(r+1).trim();o.set(e?n.toLowerCase():n,i)}return o}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(0===e)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){const t=this._chunks[0],r=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,r}const t=this.allocNative(e);let r=0;for(;e>0;){const n=this._chunks[0];if(n.byteLength>e){const i=n.slice(0,e);t.set(i,r),r+=e,this._chunks[0]=n.slice(e),this._totalLength-=e,e-=e}else t.set(n,r),r+=n.byteLength,this._chunks.shift(),this._totalLength-=n.byteLength,e-=n.byteLength}return t}};var Bf={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;const t=Ih,r=Lh,n=rf,i=mf,s=Mh,o=Nh;var a,c,l,u,d,h,p,f,m,g,y,T,v,R,E,S,k,C,A,b,$,x,w,N,I,_,P;(a||(a={})).type=new n.NotificationType("$/cancelRequest"),(c||(e.ProgressToken=c={})).is=function(e){return"string"==typeof e||"number"==typeof e},(l||(l={})).type=new n.NotificationType("$/progress");e.ProgressType=class{constructor(){}},(u||(u={})).is=function(e){return r.func(e)},e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),(h=d||(e.Trace=d={}))[h.Off=0]="Off",h[h.Messages=1]="Messages",h[h.Compact=2]="Compact",h[h.Verbose=3]="Verbose",(f=p||(e.TraceValues=p={})).Off="off",f.Messages="messages",f.Compact="compact",f.Verbose="verbose",function(e){e.fromString=function(t){if(!r.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":default:return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}}(d||(e.Trace=d={})),(g=m||(e.TraceFormat=m={})).Text="text",g.JSON="json",function(e){e.fromString=function(t){return r.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(m||(e.TraceFormat=m={})),(y||(e.SetTraceNotification=y={})).type=new n.NotificationType("$/setTrace"),(T||(e.LogTraceNotification=T={})).type=new n.NotificationType("$/logTrace"),(R=v||(e.ConnectionErrors=v={}))[R.Closed=1]="Closed",R[R.Disposed=2]="Disposed",R[R.AlreadyListening=3]="AlreadyListening";class L extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,L.prototype)}}e.ConnectionError=L,(E||(e.ConnectionStrategy=E={})).is=function(e){const t=e;return t&&r.func(t.cancelUndispatched)},(S||(e.IdCancellationReceiverStrategy=S={})).is=function(e){const t=e;return t&&(void 0===t.kind||"id"===t.kind)&&r.func(t.createCancellationTokenSource)&&(void 0===t.dispose||r.func(t.dispose))},(k||(e.RequestCancellationReceiverStrategy=k={})).is=function(e){const t=e;return t&&"request"===t.kind&&r.func(t.createCancellationTokenSource)&&(void 0===t.dispose||r.func(t.dispose))},(A=C||(e.CancellationReceiverStrategy=C={})).Message=Object.freeze({createCancellationTokenSource:e=>new o.CancellationTokenSource}),A.is=function(e){return S.is(e)||k.is(e)},($=b||(e.CancellationSenderStrategy=b={})).Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(a.type,{id:t}),cleanup(e){}}),$.is=function(e){const t=e;return t&&r.func(t.sendCancellation)&&r.func(t.cleanup)},(w=x||(e.CancellationStrategy=x={})).Message=Object.freeze({receiver:C.Message,sender:b.Message}),w.is=function(e){const t=e;return t&&C.is(t.receiver)&&b.is(t.sender)},(N||(e.MessageStrategy=N={})).is=function(e){const t=e;return t&&r.func(t.handleMessage)},(I||(e.ConnectionOptions=I={})).is=function(e){const t=e;return t&&(x.is(t.cancellationStrategy)||E.is(t.connectionStrategy)||N.is(t.messageStrategy))},(P=_||(_={}))[P.New=1]="New",P[P.Listening=2]="Listening",P[P.Closed=3]="Closed",P[P.Disposed=4]="Disposed",e.createMessageConnection=function(h,p,f,g){const R=void 0!==f?f:e.NullLogger;let E=0,k=0,C=0;const A="2.0";let b;const $=new Map;let w;const I=new Map,P=new Map;let O,D,M=new i.LinkedMap,F=new Map,q=new Set,j=new Map,U=d.Off,G=m.Text,z=_.New;const B=new s.Emitter,K=new s.Emitter,W=new s.Emitter,V=new s.Emitter,H=new s.Emitter,Y=g&&g.cancellationStrategy?g.cancellationStrategy:x.Message;function X(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function J(e,t){var r;n.Message.isRequest(t)?e.set(X(t.id),t):n.Message.isResponse(t)?e.set(null===(r=t.id)?"res-unknown-"+(++C).toString():"res-"+r.toString(),t):e.set("not-"+(++k).toString(),t)}function Z(e){}function Q(){return z===_.Listening}function ee(){return z===_.Closed}function te(){return z===_.Disposed}function re(){z!==_.New&&z!==_.Listening||(z=_.Closed,K.fire(void 0))}function ne(){O||0===M.size||(O=(0,t.default)().timer.setImmediate(()=>{O=void 0,function(){if(0===M.size)return;const e=M.shift();try{const t=null==g?void 0:g.messageStrategy;N.is(t)?t.handleMessage(e,ie):ie(e)}finally{ne()}}()}))}function ie(e){n.Message.isRequest(e)?function(e){if(te())return;function t(t,r,i){const s={jsonrpc:A,id:e.id};t instanceof n.ResponseError?s.error=t.toJson():s.result=void 0===t?null:t,ae(s,r,i),p.write(s).catch(()=>R.error("Sending response failed."))}function i(t,r,n){const i={jsonrpc:A,id:e.id,error:t.toJson()};ae(i,r,n),p.write(i).catch(()=>R.error("Sending response failed."))}function s(t,r,n){void 0===t&&(t=null);const i={jsonrpc:A,id:e.id,result:t};ae(i,r,n),p.write(i).catch(()=>R.error("Sending response failed."))}!function(e){if(U===d.Off||!D)return;if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||!e.params||(t=`Params: ${oe(e.params)}\n\n`),D.log(`Received request '${e.method} - (${e.id})'.`,t)}else le("receive-request",e)}(e);const o=$.get(e.method);let a,c;o&&(a=o.type,c=o.handler);const l=Date.now();if(c||b){const o=e.id??String(Date.now()),d=S.is(Y.receiver)?Y.receiver.createCancellationTokenSource(o):Y.receiver.createCancellationTokenSource(e);null!==e.id&&q.has(e.id)&&d.cancel(),null!==e.id&&j.set(o,d);try{let u;if(c)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void i(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but received none.`),e.method,l);u=c(d.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===n.ParameterStructures.byName)return void i(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);u=c(...e.params,d.token)}else{if(void 0!==a&&a.parameterStructures===n.ParameterStructures.byPosition)return void i(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);u=c(e.params,d.token)}else b&&(u=b(e.method,e.params,d.token));const h=u;u?h.then?h.then(r=>{j.delete(o),t(r,e.method,l)},t=>{j.delete(o),t instanceof n.ResponseError?i(t,e.method,l):t&&r.string(t.message)?i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}):(j.delete(o),t(u,e.method,l)):(j.delete(o),s(u,e.method,l))}catch(u){j.delete(o),u instanceof n.ResponseError?t(u,e.method,l):u&&r.string(u.message)?i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${u.message}`),e.method,l):i(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else i(new n.ResponseError(n.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}(e):n.Message.isNotification(e)?function(e){if(te())return;let t,r;if(e.method===a.type.method){const t=e.params.id;return q.delete(t),void ce(e)}{const n=I.get(e.method);n&&(r=n.handler,t=n.type)}if(r||w)try{if(ce(e),r)if(void 0===e.params)void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==n.ParameterStructures.byName&&R.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),r();else if(Array.isArray(e.params)){const i=e.params;e.method===l.type.method&&2===i.length&&c.is(i[0])?r({token:i[0],value:i[1]}):(void 0!==t&&(t.parameterStructures===n.ParameterStructures.byName&&R.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&R.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${i.length} arguments`)),r(...i))}else void 0!==t&&t.parameterStructures===n.ParameterStructures.byPosition&&R.error(`Notification ${e.method} defines parameters by position but received parameters by name`),r(e.params);else w&&w(e.method,e.params)}catch(i){i.message?R.error(`Notification handler '${e.method}' failed with message: ${i.message}`):R.error(`Notification handler '${e.method}' failed unexpectedly.`)}else W.fire(e)}(e):n.Message.isResponse(e)?function(e){if(te())return;if(null===e.id)e.error?R.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):R.error("Received response message without id. No further error information provided.");else{const r=e.id,i=F.get(r);if(function(e,t){if(U===d.Off||!D)return;if(G===m.Text){let r;if(U!==d.Verbose&&U!==d.Compact||(e.error&&e.error.data?r=`Error data: ${oe(e.error.data)}\n\n`:e.result?r=`Result: ${oe(e.result)}\n\n`:void 0===e.error&&(r="No result returned.\n\n")),t){const n=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";D.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${n}`,r)}else D.log(`Received response ${e.id} without active response promise.`,r)}else le("receive-response",e)}(e,i),void 0!==i){F.delete(r);try{if(e.error){const t=e.error;i.reject(new n.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");i.resolve(e.result)}}catch(t){t.message?R.error(`Response handler '${i.method}' failed with message: ${t.message}`):R.error(`Response handler '${i.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void R.error("Received empty message.");R.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(r.string(t.id)||r.number(t.id)){const e=t.id,r=F.get(e);r&&r.reject(new Error("The received response has neither a result nor an error property."))}}(e)}h.onClose(re),h.onError(function(e){B.fire([e,void 0,void 0])}),p.onClose(re),p.onError(function(e){B.fire(e)});const se=e=>{try{if(n.Message.isNotification(e)&&e.method===a.type.method){const t=e.params.id,r=X(t),i=M.get(r);if(n.Message.isRequest(i)){const n=null==g?void 0:g.connectionStrategy,s=n&&n.cancelUndispatched?n.cancelUndispatched(i,Z):void 0;if(s&&(void 0!==s.error||void 0!==s.result))return M.delete(r),j.delete(t),s.id=i.id,ae(s,e.method,Date.now()),void p.write(s).catch(()=>R.error("Sending response for canceled message failed."))}const s=j.get(t);if(void 0!==s)return s.cancel(),void ce(e);q.add(t)}J(M,e)}finally{ne()}};function oe(e){if(null!=e)switch(U){case d.Verbose:return JSON.stringify(e,null,4);case d.Compact:return JSON.stringify(e);default:return}}function ae(e,t,r){if(U!==d.Off&&D)if(G===m.Text){let n;U!==d.Verbose&&U!==d.Compact||(e.error&&e.error.data?n=`Error data: ${oe(e.error.data)}\n\n`:e.result?n=`Result: ${oe(e.result)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),D.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-r}ms`,n)}else le("send-response",e)}function ce(e){if(U!==d.Off&&D&&e.method!==T.type.method)if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||(t=e.params?`Params: ${oe(e.params)}\n\n`:"No parameters provided.\n\n"),D.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!D||U===d.Off)return;const r={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};D.log(r)}function ue(){if(ee())throw new L(v.Closed,"Connection is closed.");if(te())throw new L(v.Disposed,"Connection is disposed.")}function de(e){return void 0===e?null:e}function he(e){return null===e?void 0:e}function pe(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function fe(e,t){switch(e){case n.ParameterStructures.auto:return pe(t)?he(t):[de(t)];case n.ParameterStructures.byName:if(!pe(t))throw new Error("Received parameters by name but param is not an object literal.");return he(t);case n.ParameterStructures.byPosition:return[de(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function me(e,t){let r;const n=e.numberOfParams;switch(n){case 0:r=void 0;break;case 1:r=fe(e.parameterStructures,t[0]);break;default:r=[];for(let e=0;e<t.length&&e<n;e++)r.push(de(t[e]));if(t.length<n)for(let e=t.length;e<n;e++)r.push(null)}return r}const ge={sendNotification:(e,...t)=>{let i,s;if(ue(),r.string(e)){i=e;const r=t[0];let o=0,a=n.ParameterStructures.auto;n.ParameterStructures.is(r)&&(o=1,a=r);let c=t.length;const l=c-o;switch(l){case 0:s=void 0;break;case 1:s=fe(a,t[o]);break;default:if(a===n.ParameterStructures.byName)throw new Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);s=t.slice(o,c).map(e=>de(e))}}else{const r=t;i=e.method,s=me(e,r)}const o={jsonrpc:A,method:i,params:s};return function(e){if(U!==d.Off&&D)if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||(t=e.params?`Params: ${oe(e.params)}\n\n`:"No parameters provided.\n\n"),D.log(`Sending notification '${e.method}'.`,t)}else le("send-notification",e)}(o),p.write(o).catch(e=>{throw R.error("Sending notification failed."),e})},onNotification:(e,t)=>{let n;return ue(),r.func(e)?w=e:t&&(r.string(e)?(n=e,I.set(e,{type:void 0,handler:t})):(n=e.method,I.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==n?I.delete(n):w=void 0}}},onProgress:(e,t,r)=>{if(P.has(t))throw new Error(`Progress handler for token ${t} already registered`);return P.set(t,r),{dispose:()=>{P.delete(t)}}},sendProgress:(e,t,r)=>ge.sendNotification(l.type,{token:t,value:r}),onUnhandledProgress:V.event,sendRequest:(e,...t)=>{let i,s,a;if(ue(),function(){if(!Q())throw new Error("Call listen() first.")}(),r.string(e)){i=e;const r=t[0],c=t[t.length-1];let l=0,u=n.ParameterStructures.auto;n.ParameterStructures.is(r)&&(l=1,u=r);let d=t.length;o.CancellationToken.is(c)&&(d-=1,a=c);const h=d-l;switch(h){case 0:s=void 0;break;case 1:s=fe(u,t[l]);break;default:if(u===n.ParameterStructures.byName)throw new Error(`Received ${h} parameters for 'by Name' request parameter structure.`);s=t.slice(l,d).map(e=>de(e))}}else{const r=t;i=e.method,s=me(e,r);const n=e.numberOfParams;a=o.CancellationToken.is(r[n])?r[n]:void 0}const c=E++;let l;a&&(l=a.onCancellationRequested(()=>{const e=Y.sender.sendCancellation(ge,c);return void 0===e?(R.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch(()=>{R.log(`Sending cancellation messages for id ${c} failed`)})}));const u={jsonrpc:A,id:c,method:i,params:s};return function(e){if(U!==d.Off&&D)if(G===m.Text){let t;U!==d.Verbose&&U!==d.Compact||!e.params||(t=`Params: ${oe(e.params)}\n\n`),D.log(`Sending request '${e.method} - (${e.id})'.`,t)}else le("send-request",e)}(u),"function"==typeof Y.sender.enableCancellation&&Y.sender.enableCancellation(u),new Promise(async(e,t)=>{const r={method:i,timerStart:Date.now(),resolve:t=>{e(t),Y.sender.cleanup(c),null==l||l.dispose()},reject:e=>{t(e),Y.sender.cleanup(c),null==l||l.dispose()}};try{await p.write(u),F.set(c,r)}catch(s){throw R.error("Sending request failed."),r.reject(new n.ResponseError(n.ErrorCodes.MessageWriteError,s.message?s.message:"Unknown reason")),s}})},onRequest:(e,t)=>{ue();let n=null;return u.is(e)?(n=void 0,b=e):r.string(e)?(n=null,void 0!==t&&(n=e,$.set(e,{handler:t,type:void 0}))):void 0!==t&&(n=e.method,$.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==n&&(void 0!==n?$.delete(n):b=void 0)}}},hasPendingResponse:()=>F.size>0,trace:async(e,t,n)=>{let i=!1,s=m.Text;void 0!==n&&(r.boolean(n)?i=n:(i=n.sendNotification||!1,s=n.traceFormat||m.Text)),U=e,G=s,D=U===d.Off?void 0:t,!i||ee()||te()||await ge.sendNotification(y.type,{value:d.toString(e)})},onError:B.event,onClose:K.event,onUnhandledNotification:W.event,onDispose:H.event,end:()=>{p.end()},dispose:()=>{if(te())return;z=_.Disposed,H.fire(void 0);const e=new n.ResponseError(n.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const t of F.values())t.reject(e);F=new Map,j=new Map,q=new Set,M=new i.LinkedMap,r.func(p.dispose)&&p.dispose(),r.func(h.dispose)&&h.dispose()},listen:()=>{ue(),function(){if(Q())throw new L(v.AlreadyListening,"Connection is already listening")}(),z=_.Listening,h.listen(se)},inspect:()=>{(0,t.default)().console.log("inspect")}};return ge.onNotification(T.type,e=>{if(U===d.Off||!D)return;const t=U===d.Verbose||U===d.Compact;D.log(e.message,t?e.verbose:void 0)}),ge.onNotification(l.type,e=>{const t=P.get(e.token);t?t(e.value):V.fire(e)}),ge}}(Bf),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;const t=rf;Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});const r=mf;Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return r.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return r.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return r.Touch}});const n=Tf;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return n.Disposable}});const i=Mh;Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=Nh;Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const o=vf;Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});const a=Af;Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const c=Of;Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});const l=zf;Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});const u=Bf;Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:function(){return u.MessageStrategy}});const d=Ih;e.RAL=d.default}(tf),Object.defineProperty(ef,"__esModule",{value:!0});const Kf=tf;class Wf extends Kf.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return Wf.emptyBuffer}fromString(e,t){return(new TextEncoder).encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}Wf.emptyBuffer=new Uint8Array(0);class Vf{constructor(e){this.socket=e,this._onData=new Kf.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then(e=>{this._onData.fire(new Uint8Array(e))},()=>{(0,Kf.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),Kf.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),Kf.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),Kf.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}}class Hf{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),Kf.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),Kf.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),Kf.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const Yf=new TextEncoder,Xf=Object.freeze({messageBuffer:Object.freeze({create:e=>new Wf(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(Yf.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new Vf(e),asWritableStream:e=>new Hf(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...r){const n=setTimeout(e,t,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(e,...t){const r=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(r)}},setInterval(e,t,...r){const n=setInterval(e,t,...r);return{dispose:()=>clearInterval(n)}}})});function Jf(){return Xf}(Jf||(Jf={})).install=function(){Kf.RAL.install(Xf)},ef.default=Jf,function(e){var t=v.commonjsGlobal&&v.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=v.commonjsGlobal&&v.commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0;ef.default.install();const n=tf;r(tf,e);class i extends n.AbstractMessageReader{constructor(e){super(),this._onData=new n.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",e=>this.fireError(e)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}e.BrowserMessageReader=i;class s extends n.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",e=>this.fireError(e))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.BrowserMessageWriter=s,e.createMessageConnection=function(e,t,r,i){return void 0===r&&(r=n.NullLogger),n.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,n.createMessageConnection)(e,t,r,i)}}(Qp);var Zf=Qp,Qf={};const em=v.getAugmentedNamespace(Qd);var tm={};Object.defineProperty(tm,"__esModule",{value:!0}),tm.ProtocolNotificationType=tm.ProtocolNotificationType0=tm.ProtocolRequestType=tm.ProtocolRequestType0=tm.RegistrationType=tm.MessageDirection=void 0;const rm=Qp;var nm,im;(im=nm||(tm.MessageDirection=nm={})).clientToServer="clientToServer",im.serverToClient="serverToClient",im.both="both";tm.RegistrationType=class{constructor(e){this.method=e}};tm.ProtocolRequestType0=class extends rm.RequestType0{constructor(e){super(e)}};tm.ProtocolRequestType=class extends rm.RequestType{constructor(e){super(e,rm.ParameterStructures.byName)}};tm.ProtocolNotificationType0=class extends rm.NotificationType0{constructor(e){super(e)}};tm.ProtocolNotificationType=class extends rm.NotificationType{constructor(e){super(e,rm.ParameterStructures.byName)}};var sm={},om={};function am(e){return"string"==typeof e||e instanceof String}function cm(e){return Array.isArray(e)}Object.defineProperty(om,"__esModule",{value:!0}),om.objectLiteral=om.typedArray=om.stringArray=om.array=om.func=om.error=om.number=om.string=om.boolean=void 0,om.boolean=function(e){return!0===e||!1===e},om.string=am,om.number=function(e){return"number"==typeof e||e instanceof Number},om.error=function(e){return e instanceof Error},om.func=function(e){return"function"==typeof e},om.array=cm,om.stringArray=function(e){return cm(e)&&e.every(e=>am(e))},om.typedArray=function(e,t){return Array.isArray(e)&&e.every(t)},om.objectLiteral=function(e){return null!==e&&"object"==typeof e};var lm={};Object.defineProperty(lm,"__esModule",{value:!0}),lm.ImplementationRequest=void 0;const um=tm;var dm,hm;(hm=dm||(lm.ImplementationRequest=dm={})).method="textDocument/implementation",hm.messageDirection=um.MessageDirection.clientToServer,hm.type=new um.ProtocolRequestType(hm.method);var pm={};Object.defineProperty(pm,"__esModule",{value:!0}),pm.TypeDefinitionRequest=void 0;const fm=tm;var mm,gm;(gm=mm||(pm.TypeDefinitionRequest=mm={})).method="textDocument/typeDefinition",gm.messageDirection=fm.MessageDirection.clientToServer,gm.type=new fm.ProtocolRequestType(gm.method);var ym={};Object.defineProperty(ym,"__esModule",{value:!0}),ym.DidChangeWorkspaceFoldersNotification=ym.WorkspaceFoldersRequest=void 0;const Tm=tm;var vm,Rm,Em,Sm;(Rm=vm||(ym.WorkspaceFoldersRequest=vm={})).method="workspace/workspaceFolders",Rm.messageDirection=Tm.MessageDirection.serverToClient,Rm.type=new Tm.ProtocolRequestType0(Rm.method),(Sm=Em||(ym.DidChangeWorkspaceFoldersNotification=Em={})).method="workspace/didChangeWorkspaceFolders",Sm.messageDirection=Tm.MessageDirection.clientToServer,Sm.type=new Tm.ProtocolNotificationType(Sm.method);var km={};Object.defineProperty(km,"__esModule",{value:!0}),km.ConfigurationRequest=void 0;const Cm=tm;var Am,bm;(bm=Am||(km.ConfigurationRequest=Am={})).method="workspace/configuration",bm.messageDirection=Cm.MessageDirection.serverToClient,bm.type=new Cm.ProtocolRequestType(bm.method);var $m={};Object.defineProperty($m,"__esModule",{value:!0}),$m.ColorPresentationRequest=$m.DocumentColorRequest=void 0;const xm=tm;var wm,Nm,Im,_m;(Nm=wm||($m.DocumentColorRequest=wm={})).method="textDocument/documentColor",Nm.messageDirection=xm.MessageDirection.clientToServer,Nm.type=new xm.ProtocolRequestType(Nm.method),(_m=Im||($m.ColorPresentationRequest=Im={})).method="textDocument/colorPresentation",_m.messageDirection=xm.MessageDirection.clientToServer,_m.type=new xm.ProtocolRequestType(_m.method);var Pm={};Object.defineProperty(Pm,"__esModule",{value:!0}),Pm.FoldingRangeRefreshRequest=Pm.FoldingRangeRequest=void 0;const Lm=tm;var Om,Dm,Mm,Fm;(Dm=Om||(Pm.FoldingRangeRequest=Om={})).method="textDocument/foldingRange",Dm.messageDirection=Lm.MessageDirection.clientToServer,Dm.type=new Lm.ProtocolRequestType(Dm.method),(Fm=Mm||(Pm.FoldingRangeRefreshRequest=Mm={})).method="workspace/foldingRange/refresh",Fm.messageDirection=Lm.MessageDirection.serverToClient,Fm.type=new Lm.ProtocolRequestType0(Fm.method);var qm={};Object.defineProperty(qm,"__esModule",{value:!0}),qm.DeclarationRequest=void 0;const jm=tm;var Um,Gm;(Gm=Um||(qm.DeclarationRequest=Um={})).method="textDocument/declaration",Gm.messageDirection=jm.MessageDirection.clientToServer,Gm.type=new jm.ProtocolRequestType(Gm.method);var zm={};Object.defineProperty(zm,"__esModule",{value:!0}),zm.SelectionRangeRequest=void 0;const Bm=tm;var Km,Wm;(Wm=Km||(zm.SelectionRangeRequest=Km={})).method="textDocument/selectionRange",Wm.messageDirection=Bm.MessageDirection.clientToServer,Wm.type=new Bm.ProtocolRequestType(Wm.method);var Vm={};Object.defineProperty(Vm,"__esModule",{value:!0}),Vm.WorkDoneProgressCancelNotification=Vm.WorkDoneProgressCreateRequest=Vm.WorkDoneProgress=void 0;const Hm=Qp,Ym=tm;var Xm,Jm,Zm,Qm,eg,tg;(Jm=Xm||(Vm.WorkDoneProgress=Xm={})).type=new Hm.ProgressType,Jm.is=function(e){return e===Jm.type},(Qm=Zm||(Vm.WorkDoneProgressCreateRequest=Zm={})).method="window/workDoneProgress/create",Qm.messageDirection=Ym.MessageDirection.serverToClient,Qm.type=new Ym.ProtocolRequestType(Qm.method),(tg=eg||(Vm.WorkDoneProgressCancelNotification=eg={})).method="window/workDoneProgress/cancel",tg.messageDirection=Ym.MessageDirection.clientToServer,tg.type=new Ym.ProtocolNotificationType(tg.method);var rg={};Object.defineProperty(rg,"__esModule",{value:!0}),rg.CallHierarchyOutgoingCallsRequest=rg.CallHierarchyIncomingCallsRequest=rg.CallHierarchyPrepareRequest=void 0;const ng=tm;var ig,sg,og,ag,cg,lg;(sg=ig||(rg.CallHierarchyPrepareRequest=ig={})).method="textDocument/prepareCallHierarchy",sg.messageDirection=ng.MessageDirection.clientToServer,sg.type=new ng.ProtocolRequestType(sg.method),(ag=og||(rg.CallHierarchyIncomingCallsRequest=og={})).method="callHierarchy/incomingCalls",ag.messageDirection=ng.MessageDirection.clientToServer,ag.type=new ng.ProtocolRequestType(ag.method),(lg=cg||(rg.CallHierarchyOutgoingCallsRequest=cg={})).method="callHierarchy/outgoingCalls",lg.messageDirection=ng.MessageDirection.clientToServer,lg.type=new ng.ProtocolRequestType(lg.method);var ug={};Object.defineProperty(ug,"__esModule",{value:!0}),ug.SemanticTokensRefreshRequest=ug.SemanticTokensRangeRequest=ug.SemanticTokensDeltaRequest=ug.SemanticTokensRequest=ug.SemanticTokensRegistrationType=ug.TokenFormat=void 0;const dg=tm;var hg,pg,fg,mg,gg,yg,Tg,vg,Rg,Eg,Sg;(hg||(ug.TokenFormat=hg={})).Relative="relative",(fg=pg||(ug.SemanticTokensRegistrationType=pg={})).method="textDocument/semanticTokens",fg.type=new dg.RegistrationType(fg.method),(gg=mg||(ug.SemanticTokensRequest=mg={})).method="textDocument/semanticTokens/full",gg.messageDirection=dg.MessageDirection.clientToServer,gg.type=new dg.ProtocolRequestType(gg.method),gg.registrationMethod=pg.method,(Tg=yg||(ug.SemanticTokensDeltaRequest=yg={})).method="textDocument/semanticTokens/full/delta",Tg.messageDirection=dg.MessageDirection.clientToServer,Tg.type=new dg.ProtocolRequestType(Tg.method),Tg.registrationMethod=pg.method,(Rg=vg||(ug.SemanticTokensRangeRequest=vg={})).method="textDocument/semanticTokens/range",Rg.messageDirection=dg.MessageDirection.clientToServer,Rg.type=new dg.ProtocolRequestType(Rg.method),Rg.registrationMethod=pg.method,(Sg=Eg||(ug.SemanticTokensRefreshRequest=Eg={})).method="workspace/semanticTokens/refresh",Sg.messageDirection=dg.MessageDirection.serverToClient,Sg.type=new dg.ProtocolRequestType0(Sg.method);var kg={};Object.defineProperty(kg,"__esModule",{value:!0}),kg.ShowDocumentRequest=void 0;const Cg=tm;var Ag,bg;(bg=Ag||(kg.ShowDocumentRequest=Ag={})).method="window/showDocument",bg.messageDirection=Cg.MessageDirection.serverToClient,bg.type=new Cg.ProtocolRequestType(bg.method);var $g={};Object.defineProperty($g,"__esModule",{value:!0}),$g.LinkedEditingRangeRequest=void 0;const xg=tm;var wg,Ng;(Ng=wg||($g.LinkedEditingRangeRequest=wg={})).method="textDocument/linkedEditingRange",Ng.messageDirection=xg.MessageDirection.clientToServer,Ng.type=new xg.ProtocolRequestType(Ng.method);var Ig={};Object.defineProperty(Ig,"__esModule",{value:!0}),Ig.WillDeleteFilesRequest=Ig.DidDeleteFilesNotification=Ig.DidRenameFilesNotification=Ig.WillRenameFilesRequest=Ig.DidCreateFilesNotification=Ig.WillCreateFilesRequest=Ig.FileOperationPatternKind=void 0;const _g=tm;var Pg,Lg,Og,Dg,Mg,Fg,qg,jg,Ug,Gg,zg,Bg,Kg,Wg;(Lg=Pg||(Ig.FileOperationPatternKind=Pg={})).file="file",Lg.folder="folder",(Dg=Og||(Ig.WillCreateFilesRequest=Og={})).method="workspace/willCreateFiles",Dg.messageDirection=_g.MessageDirection.clientToServer,Dg.type=new _g.ProtocolRequestType(Dg.method),(Fg=Mg||(Ig.DidCreateFilesNotification=Mg={})).method="workspace/didCreateFiles",Fg.messageDirection=_g.MessageDirection.clientToServer,Fg.type=new _g.ProtocolNotificationType(Fg.method),(jg=qg||(Ig.WillRenameFilesRequest=qg={})).method="workspace/willRenameFiles",jg.messageDirection=_g.MessageDirection.clientToServer,jg.type=new _g.ProtocolRequestType(jg.method),(Gg=Ug||(Ig.DidRenameFilesNotification=Ug={})).method="workspace/didRenameFiles",Gg.messageDirection=_g.MessageDirection.clientToServer,Gg.type=new _g.ProtocolNotificationType(Gg.method),(Bg=zg||(Ig.DidDeleteFilesNotification=zg={})).method="workspace/didDeleteFiles",Bg.messageDirection=_g.MessageDirection.clientToServer,Bg.type=new _g.ProtocolNotificationType(Bg.method),(Wg=Kg||(Ig.WillDeleteFilesRequest=Kg={})).method="workspace/willDeleteFiles",Wg.messageDirection=_g.MessageDirection.clientToServer,Wg.type=new _g.ProtocolRequestType(Wg.method);var Vg={};Object.defineProperty(Vg,"__esModule",{value:!0}),Vg.MonikerRequest=Vg.MonikerKind=Vg.UniquenessLevel=void 0;const Hg=tm;var Yg,Xg,Jg,Zg,Qg,ey;(Xg=Yg||(Vg.UniquenessLevel=Yg={})).document="document",Xg.project="project",Xg.group="group",Xg.scheme="scheme",Xg.global="global",(Zg=Jg||(Vg.MonikerKind=Jg={})).$import="import",Zg.$export="export",Zg.local="local",(ey=Qg||(Vg.MonikerRequest=Qg={})).method="textDocument/moniker",ey.messageDirection=Hg.MessageDirection.clientToServer,ey.type=new Hg.ProtocolRequestType(ey.method);var ty={};Object.defineProperty(ty,"__esModule",{value:!0}),ty.TypeHierarchySubtypesRequest=ty.TypeHierarchySupertypesRequest=ty.TypeHierarchyPrepareRequest=void 0;const ry=tm;var ny,iy,sy,oy,ay,cy;(iy=ny||(ty.TypeHierarchyPrepareRequest=ny={})).method="textDocument/prepareTypeHierarchy",iy.messageDirection=ry.MessageDirection.clientToServer,iy.type=new ry.ProtocolRequestType(iy.method),(oy=sy||(ty.TypeHierarchySupertypesRequest=sy={})).method="typeHierarchy/supertypes",oy.messageDirection=ry.MessageDirection.clientToServer,oy.type=new ry.ProtocolRequestType(oy.method),(cy=ay||(ty.TypeHierarchySubtypesRequest=ay={})).method="typeHierarchy/subtypes",cy.messageDirection=ry.MessageDirection.clientToServer,cy.type=new ry.ProtocolRequestType(cy.method);var ly={};Object.defineProperty(ly,"__esModule",{value:!0}),ly.InlineValueRefreshRequest=ly.InlineValueRequest=void 0;const uy=tm;var dy,hy,py,fy;(hy=dy||(ly.InlineValueRequest=dy={})).method="textDocument/inlineValue",hy.messageDirection=uy.MessageDirection.clientToServer,hy.type=new uy.ProtocolRequestType(hy.method),(fy=py||(ly.InlineValueRefreshRequest=py={})).method="workspace/inlineValue/refresh",fy.messageDirection=uy.MessageDirection.serverToClient,fy.type=new uy.ProtocolRequestType0(fy.method);var my={};Object.defineProperty(my,"__esModule",{value:!0}),my.InlayHintRefreshRequest=my.InlayHintResolveRequest=my.InlayHintRequest=void 0;const gy=tm;var yy,Ty,vy,Ry,Ey,Sy;(Ty=yy||(my.InlayHintRequest=yy={})).method="textDocument/inlayHint",Ty.messageDirection=gy.MessageDirection.clientToServer,Ty.type=new gy.ProtocolRequestType(Ty.method),(Ry=vy||(my.InlayHintResolveRequest=vy={})).method="inlayHint/resolve",Ry.messageDirection=gy.MessageDirection.clientToServer,Ry.type=new gy.ProtocolRequestType(Ry.method),(Sy=Ey||(my.InlayHintRefreshRequest=Ey={})).method="workspace/inlayHint/refresh",Sy.messageDirection=gy.MessageDirection.serverToClient,Sy.type=new gy.ProtocolRequestType0(Sy.method);var ky={};Object.defineProperty(ky,"__esModule",{value:!0}),ky.DiagnosticRefreshRequest=ky.WorkspaceDiagnosticRequest=ky.DocumentDiagnosticRequest=ky.DocumentDiagnosticReportKind=ky.DiagnosticServerCancellationData=void 0;const Cy=Qp,Ay=om,by=tm;var $y,xy,wy,Ny,Iy,_y,Py,Ly,Oy;($y||(ky.DiagnosticServerCancellationData=$y={})).is=function(e){const t=e;return t&&Ay.boolean(t.retriggerRequest)},(wy=xy||(ky.DocumentDiagnosticReportKind=xy={})).Full="full",wy.Unchanged="unchanged",(Iy=Ny||(ky.DocumentDiagnosticRequest=Ny={})).method="textDocument/diagnostic",Iy.messageDirection=by.MessageDirection.clientToServer,Iy.type=new by.ProtocolRequestType(Iy.method),Iy.partialResult=new Cy.ProgressType,(Py=_y||(ky.WorkspaceDiagnosticRequest=_y={})).method="workspace/diagnostic",Py.messageDirection=by.MessageDirection.clientToServer,Py.type=new by.ProtocolRequestType(Py.method),Py.partialResult=new Cy.ProgressType,(Oy=Ly||(ky.DiagnosticRefreshRequest=Ly={})).method="workspace/diagnostic/refresh",Oy.messageDirection=by.MessageDirection.serverToClient,Oy.type=new by.ProtocolRequestType0(Oy.method);var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0}),Dy.DidCloseNotebookDocumentNotification=Dy.DidSaveNotebookDocumentNotification=Dy.DidChangeNotebookDocumentNotification=Dy.NotebookCellArrayChange=Dy.DidOpenNotebookDocumentNotification=Dy.NotebookDocumentSyncRegistrationType=Dy.NotebookDocument=Dy.NotebookCell=Dy.ExecutionSummary=Dy.NotebookCellKind=void 0;const My=em,Fy=om,qy=tm;var jy,Uy,Gy,zy,By,Ky,Wy,Vy,Hy,Yy,Xy,Jy,Zy,Qy,eT,tT,rT,nT,iT;(Uy=jy||(Dy.NotebookCellKind=jy={})).Markup=1,Uy.Code=2,Uy.is=function(e){return 1===e||2===e},(zy=Gy||(Dy.ExecutionSummary=Gy={})).create=function(e,t){const r={executionOrder:e};return!0!==t&&!1!==t||(r.success=t),r},zy.is=function(e){const t=e;return Fy.objectLiteral(t)&&My.uinteger.is(t.executionOrder)&&(void 0===t.success||Fy.boolean(t.success))},zy.equals=function(e,t){return e===t||null!=e&&null!=t&&e.executionOrder===t.executionOrder&&e.success===t.success},function(e){function t(e,r){if(e===r)return!0;if(null==e||null==r)return!1;if(typeof e!=typeof r)return!1;if("object"!=typeof e)return!1;const n=Array.isArray(e),i=Array.isArray(r);if(n!==i)return!1;if(n&&i){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!t(e[n],r[n]))return!1}if(Fy.objectLiteral(e)&&Fy.objectLiteral(r)){const n=Object.keys(e),i=Object.keys(r);if(n.length!==i.length)return!1;if(n.sort(),i.sort(),!t(n,i))return!1;for(let s=0;s<n.length;s++){const i=n[s];if(!t(e[i],r[i]))return!1}}return!0}e.create=function(e,t){return{kind:e,document:t}},e.is=function(e){const t=e;return Fy.objectLiteral(t)&&jy.is(t.kind)&&My.DocumentUri.is(t.document)&&(void 0===t.metadata||Fy.objectLiteral(t.metadata))},e.diff=function(e,r){const n=new Set;return e.document!==r.document&&n.add("document"),e.kind!==r.kind&&n.add("kind"),e.executionSummary!==r.executionSummary&&n.add("executionSummary"),void 0===e.metadata&&void 0===r.metadata||t(e.metadata,r.metadata)||n.add("metadata"),void 0===e.executionSummary&&void 0===r.executionSummary||Gy.equals(e.executionSummary,r.executionSummary)||n.add("executionSummary"),n}}(By||(Dy.NotebookCell=By={})),(Wy=Ky||(Dy.NotebookDocument=Ky={})).create=function(e,t,r,n){return{uri:e,notebookType:t,version:r,cells:n}},Wy.is=function(e){const t=e;return Fy.objectLiteral(t)&&Fy.string(t.uri)&&My.integer.is(t.version)&&Fy.typedArray(t.cells,By.is)},(Hy=Vy||(Dy.NotebookDocumentSyncRegistrationType=Vy={})).method="notebookDocument/sync",Hy.messageDirection=qy.MessageDirection.clientToServer,Hy.type=new qy.RegistrationType(Hy.method),(Xy=Yy||(Dy.DidOpenNotebookDocumentNotification=Yy={})).method="notebookDocument/didOpen",Xy.messageDirection=qy.MessageDirection.clientToServer,Xy.type=new qy.ProtocolNotificationType(Xy.method),Xy.registrationMethod=Vy.method,(Zy=Jy||(Dy.NotebookCellArrayChange=Jy={})).is=function(e){const t=e;return Fy.objectLiteral(t)&&My.uinteger.is(t.start)&&My.uinteger.is(t.deleteCount)&&(void 0===t.cells||Fy.typedArray(t.cells,By.is))},Zy.create=function(e,t,r){const n={start:e,deleteCount:t};return void 0!==r&&(n.cells=r),n},(eT=Qy||(Dy.DidChangeNotebookDocumentNotification=Qy={})).method="notebookDocument/didChange",eT.messageDirection=qy.MessageDirection.clientToServer,eT.type=new qy.ProtocolNotificationType(eT.method),eT.registrationMethod=Vy.method,(rT=tT||(Dy.DidSaveNotebookDocumentNotification=tT={})).method="notebookDocument/didSave",rT.messageDirection=qy.MessageDirection.clientToServer,rT.type=new qy.ProtocolNotificationType(rT.method),rT.registrationMethod=Vy.method,(iT=nT||(Dy.DidCloseNotebookDocumentNotification=nT={})).method="notebookDocument/didClose",iT.messageDirection=qy.MessageDirection.clientToServer,iT.type=new qy.ProtocolNotificationType(iT.method),iT.registrationMethod=Vy.method;var sT={};Object.defineProperty(sT,"__esModule",{value:!0}),sT.InlineCompletionRequest=void 0;const oT=tm;var aT,cT;(cT=aT||(sT.InlineCompletionRequest=aT={})).method="textDocument/inlineCompletion",cT.messageDirection=oT.MessageDirection.clientToServer,cT.type=new oT.ProtocolRequestType(cT.method),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceSymbolRequest=e.CodeActionResolveRequest=e.CodeActionRequest=e.DocumentSymbolRequest=e.DocumentHighlightRequest=e.ReferencesRequest=e.DefinitionRequest=e.SignatureHelpRequest=e.SignatureHelpTriggerKind=e.HoverRequest=e.CompletionResolveRequest=e.CompletionRequest=e.CompletionTriggerKind=e.PublishDiagnosticsNotification=e.WatchKind=e.RelativePattern=e.FileChangeType=e.DidChangeWatchedFilesNotification=e.WillSaveTextDocumentWaitUntilRequest=e.WillSaveTextDocumentNotification=e.TextDocumentSaveReason=e.DidSaveTextDocumentNotification=e.DidCloseTextDocumentNotification=e.DidChangeTextDocumentNotification=e.TextDocumentContentChangeEvent=e.DidOpenTextDocumentNotification=e.TextDocumentSyncKind=e.TelemetryEventNotification=e.LogMessageNotification=e.ShowMessageRequest=e.ShowMessageNotification=e.MessageType=e.DidChangeConfigurationNotification=e.ExitNotification=e.ShutdownRequest=e.InitializedNotification=e.InitializeErrorCodes=e.InitializeRequest=e.WorkDoneProgressOptions=e.TextDocumentRegistrationOptions=e.StaticRegistrationOptions=e.PositionEncodingKind=e.FailureHandlingKind=e.ResourceOperationKind=e.UnregistrationRequest=e.RegistrationRequest=e.DocumentSelector=e.NotebookCellTextDocumentFilter=e.NotebookDocumentFilter=e.TextDocumentFilter=void 0,e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.WillRenameFilesRequest=e.DidRenameFilesNotification=e.WillCreateFilesRequest=e.DidCreateFilesNotification=e.FileOperationPatternKind=e.LinkedEditingRangeRequest=e.ShowDocumentRequest=e.SemanticTokensRegistrationType=e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.TokenFormat=e.CallHierarchyPrepareRequest=e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=e.SelectionRangeRequest=e.DeclarationRequest=e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=e.ColorPresentationRequest=e.DocumentColorRequest=e.ConfigurationRequest=e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=e.TypeDefinitionRequest=e.ImplementationRequest=e.ApplyWorkspaceEditRequest=e.ExecuteCommandRequest=e.PrepareRenameRequest=e.RenameRequest=e.PrepareSupportDefaultBehavior=e.DocumentOnTypeFormattingRequest=e.DocumentRangesFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.InlineCompletionRequest=e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=e.InlineValueRefreshRequest=e.InlineValueRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=void 0;const t=tm,r=em,n=om,i=lm;Object.defineProperty(e,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=pm;Object.defineProperty(e,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=ym;Object.defineProperty(e,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),Object.defineProperty(e,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=km;Object.defineProperty(e,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=$m;Object.defineProperty(e,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(e,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const l=Pm;Object.defineProperty(e,"FoldingRangeRequest",{enumerable:!0,get:function(){return l.FoldingRangeRequest}}),Object.defineProperty(e,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return l.FoldingRangeRefreshRequest}});const u=qm;Object.defineProperty(e,"DeclarationRequest",{enumerable:!0,get:function(){return u.DeclarationRequest}});const d=zm;Object.defineProperty(e,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const h=Vm;Object.defineProperty(e,"WorkDoneProgress",{enumerable:!0,get:function(){return h.WorkDoneProgress}}),Object.defineProperty(e,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return h.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return h.WorkDoneProgressCancelNotification}});const p=rg;Object.defineProperty(e,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return p.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return p.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return p.CallHierarchyPrepareRequest}});const f=ug;Object.defineProperty(e,"TokenFormat",{enumerable:!0,get:function(){return f.TokenFormat}}),Object.defineProperty(e,"SemanticTokensRequest",{enumerable:!0,get:function(){return f.SemanticTokensRequest}}),Object.defineProperty(e,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return f.SemanticTokensDeltaRequest}}),Object.defineProperty(e,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return f.SemanticTokensRangeRequest}}),Object.defineProperty(e,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return f.SemanticTokensRefreshRequest}}),Object.defineProperty(e,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return f.SemanticTokensRegistrationType}});const m=kg;Object.defineProperty(e,"ShowDocumentRequest",{enumerable:!0,get:function(){return m.ShowDocumentRequest}});const g=$g;Object.defineProperty(e,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return g.LinkedEditingRangeRequest}});const y=Ig;Object.defineProperty(e,"FileOperationPatternKind",{enumerable:!0,get:function(){return y.FileOperationPatternKind}}),Object.defineProperty(e,"DidCreateFilesNotification",{enumerable:!0,get:function(){return y.DidCreateFilesNotification}}),Object.defineProperty(e,"WillCreateFilesRequest",{enumerable:!0,get:function(){return y.WillCreateFilesRequest}}),Object.defineProperty(e,"DidRenameFilesNotification",{enumerable:!0,get:function(){return y.DidRenameFilesNotification}}),Object.defineProperty(e,"WillRenameFilesRequest",{enumerable:!0,get:function(){return y.WillRenameFilesRequest}}),Object.defineProperty(e,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return y.DidDeleteFilesNotification}}),Object.defineProperty(e,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return y.WillDeleteFilesRequest}});const T=Vg;Object.defineProperty(e,"UniquenessLevel",{enumerable:!0,get:function(){return T.UniquenessLevel}}),Object.defineProperty(e,"MonikerKind",{enumerable:!0,get:function(){return T.MonikerKind}}),Object.defineProperty(e,"MonikerRequest",{enumerable:!0,get:function(){return T.MonikerRequest}});const v=ty;Object.defineProperty(e,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return v.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return v.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return v.TypeHierarchySupertypesRequest}});const R=ly;Object.defineProperty(e,"InlineValueRequest",{enumerable:!0,get:function(){return R.InlineValueRequest}}),Object.defineProperty(e,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return R.InlineValueRefreshRequest}});const E=my;Object.defineProperty(e,"InlayHintRequest",{enumerable:!0,get:function(){return E.InlayHintRequest}}),Object.defineProperty(e,"InlayHintResolveRequest",{enumerable:!0,get:function(){return E.InlayHintResolveRequest}}),Object.defineProperty(e,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return E.InlayHintRefreshRequest}});const S=ky;Object.defineProperty(e,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return S.DiagnosticServerCancellationData}}),Object.defineProperty(e,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return S.DocumentDiagnosticReportKind}}),Object.defineProperty(e,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return S.DocumentDiagnosticRequest}}),Object.defineProperty(e,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return S.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return S.DiagnosticRefreshRequest}});const k=Dy;Object.defineProperty(e,"NotebookCellKind",{enumerable:!0,get:function(){return k.NotebookCellKind}}),Object.defineProperty(e,"ExecutionSummary",{enumerable:!0,get:function(){return k.ExecutionSummary}}),Object.defineProperty(e,"NotebookCell",{enumerable:!0,get:function(){return k.NotebookCell}}),Object.defineProperty(e,"NotebookDocument",{enumerable:!0,get:function(){return k.NotebookDocument}}),Object.defineProperty(e,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return k.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,"NotebookCellArrayChange",{enumerable:!0,get:function(){return k.NotebookCellArrayChange}}),Object.defineProperty(e,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return k.DidCloseNotebookDocumentNotification}});const C=sT;var A,b,$,x,w,N,I,_,P,L,O,D,M,F,q,j,U,G,z,B,K,W,V,H,Y,X,J,Z,Q,ee,te,re,ne,ie,se,oe,ae,ce,le,ue,de,he,pe,fe,me,ge,ye,Te,ve,Re,Ee,Se,ke,Ce,Ae,be,$e,xe,we,Ne,Ie,_e,Pe,Le,Oe,De,Me,Fe,qe,je,Ue,Ge,ze,Be,Ke,We,Ve,He,Ye,Xe,Je,Ze,Qe,et,tt,rt,nt,it,st,ot,at,ct,lt,ut,dt,ht,pt,ft,mt,gt,yt,Tt,vt,Rt,Et,St,kt,Ct,At,bt,$t,xt,wt,Nt,It,_t,Pt,Lt,Ot,Dt,Mt;Object.defineProperty(e,"InlineCompletionRequest",{enumerable:!0,get:function(){return C.InlineCompletionRequest}}),(A||(e.TextDocumentFilter=A={})).is=function(e){const t=e;return n.string(t)||n.string(t.language)||n.string(t.scheme)||n.string(t.pattern)},(b||(e.NotebookDocumentFilter=b={})).is=function(e){const t=e;return n.objectLiteral(t)&&(n.string(t.notebookType)||n.string(t.scheme)||n.string(t.pattern))},($||(e.NotebookCellTextDocumentFilter=$={})).is=function(e){const t=e;return n.objectLiteral(t)&&(n.string(t.notebook)||b.is(t.notebook))&&(void 0===t.language||n.string(t.language))},(x||(e.DocumentSelector=x={})).is=function(e){if(!Array.isArray(e))return!1;for(let t of e)if(!n.string(t)&&!A.is(t)&&!$.is(t))return!1;return!0},(N=w||(e.RegistrationRequest=w={})).method="client/registerCapability",N.messageDirection=t.MessageDirection.serverToClient,N.type=new t.ProtocolRequestType(N.method),(_=I||(e.UnregistrationRequest=I={})).method="client/unregisterCapability",_.messageDirection=t.MessageDirection.serverToClient,_.type=new t.ProtocolRequestType(_.method),(L=P||(e.ResourceOperationKind=P={})).Create="create",L.Rename="rename",L.Delete="delete",(D=O||(e.FailureHandlingKind=O={})).Abort="abort",D.Transactional="transactional",D.TextOnlyTransactional="textOnlyTransactional",D.Undo="undo",(F=M||(e.PositionEncodingKind=M={})).UTF8="utf-8",F.UTF16="utf-16",F.UTF32="utf-32",(q||(e.StaticRegistrationOptions=q={})).hasId=function(e){const t=e;return t&&n.string(t.id)&&t.id.length>0},(j||(e.TextDocumentRegistrationOptions=j={})).is=function(e){const t=e;return t&&(null===t.documentSelector||x.is(t.documentSelector))},(G=U||(e.WorkDoneProgressOptions=U={})).is=function(e){const t=e;return n.objectLiteral(t)&&(void 0===t.workDoneProgress||n.boolean(t.workDoneProgress))},G.hasWorkDoneProgress=function(e){const t=e;return t&&n.boolean(t.workDoneProgress)},(B=z||(e.InitializeRequest=z={})).method="initialize",B.messageDirection=t.MessageDirection.clientToServer,B.type=new t.ProtocolRequestType(B.method),(K||(e.InitializeErrorCodes=K={})).unknownProtocolVersion=1,(V=W||(e.InitializedNotification=W={})).method="initialized",V.messageDirection=t.MessageDirection.clientToServer,V.type=new t.ProtocolNotificationType(V.method),(Y=H||(e.ShutdownRequest=H={})).method="shutdown",Y.messageDirection=t.MessageDirection.clientToServer,Y.type=new t.ProtocolRequestType0(Y.method),(J=X||(e.ExitNotification=X={})).method="exit",J.messageDirection=t.MessageDirection.clientToServer,J.type=new t.ProtocolNotificationType0(J.method),(Q=Z||(e.DidChangeConfigurationNotification=Z={})).method="workspace/didChangeConfiguration",Q.messageDirection=t.MessageDirection.clientToServer,Q.type=new t.ProtocolNotificationType(Q.method),(te=ee||(e.MessageType=ee={})).Error=1,te.Warning=2,te.Info=3,te.Log=4,te.Debug=5,(ne=re||(e.ShowMessageNotification=re={})).method="window/showMessage",ne.messageDirection=t.MessageDirection.serverToClient,ne.type=new t.ProtocolNotificationType(ne.method),(se=ie||(e.ShowMessageRequest=ie={})).method="window/showMessageRequest",se.messageDirection=t.MessageDirection.serverToClient,se.type=new t.ProtocolRequestType(se.method),(ae=oe||(e.LogMessageNotification=oe={})).method="window/logMessage",ae.messageDirection=t.MessageDirection.serverToClient,ae.type=new t.ProtocolNotificationType(ae.method),(le=ce||(e.TelemetryEventNotification=ce={})).method="telemetry/event",le.messageDirection=t.MessageDirection.serverToClient,le.type=new t.ProtocolNotificationType(le.method),(de=ue||(e.TextDocumentSyncKind=ue={})).None=0,de.Full=1,de.Incremental=2,(pe=he||(e.DidOpenTextDocumentNotification=he={})).method="textDocument/didOpen",pe.messageDirection=t.MessageDirection.clientToServer,pe.type=new t.ProtocolNotificationType(pe.method),(me=fe||(e.TextDocumentContentChangeEvent=fe={})).isIncremental=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0!==t.range&&(void 0===t.rangeLength||"number"==typeof t.rangeLength)},me.isFull=function(e){let t=e;return null!=t&&"string"==typeof t.text&&void 0===t.range&&void 0===t.rangeLength},(ye=ge||(e.DidChangeTextDocumentNotification=ge={})).method="textDocument/didChange",ye.messageDirection=t.MessageDirection.clientToServer,ye.type=new t.ProtocolNotificationType(ye.method),(ve=Te||(e.DidCloseTextDocumentNotification=Te={})).method="textDocument/didClose",ve.messageDirection=t.MessageDirection.clientToServer,ve.type=new t.ProtocolNotificationType(ve.method),(Ee=Re||(e.DidSaveTextDocumentNotification=Re={})).method="textDocument/didSave",Ee.messageDirection=t.MessageDirection.clientToServer,Ee.type=new t.ProtocolNotificationType(Ee.method),(ke=Se||(e.TextDocumentSaveReason=Se={})).Manual=1,ke.AfterDelay=2,ke.FocusOut=3,(Ae=Ce||(e.WillSaveTextDocumentNotification=Ce={})).method="textDocument/willSave",Ae.messageDirection=t.MessageDirection.clientToServer,Ae.type=new t.ProtocolNotificationType(Ae.method),($e=be||(e.WillSaveTextDocumentWaitUntilRequest=be={})).method="textDocument/willSaveWaitUntil",$e.messageDirection=t.MessageDirection.clientToServer,$e.type=new t.ProtocolRequestType($e.method),(we=xe||(e.DidChangeWatchedFilesNotification=xe={})).method="workspace/didChangeWatchedFiles",we.messageDirection=t.MessageDirection.clientToServer,we.type=new t.ProtocolNotificationType(we.method),(Ie=Ne||(e.FileChangeType=Ne={})).Created=1,Ie.Changed=2,Ie.Deleted=3,(_e||(e.RelativePattern=_e={})).is=function(e){const t=e;return n.objectLiteral(t)&&(r.URI.is(t.baseUri)||r.WorkspaceFolder.is(t.baseUri))&&n.string(t.pattern)},(Le=Pe||(e.WatchKind=Pe={})).Create=1,Le.Change=2,Le.Delete=4,(De=Oe||(e.PublishDiagnosticsNotification=Oe={})).method="textDocument/publishDiagnostics",De.messageDirection=t.MessageDirection.serverToClient,De.type=new t.ProtocolNotificationType(De.method),(Fe=Me||(e.CompletionTriggerKind=Me={})).Invoked=1,Fe.TriggerCharacter=2,Fe.TriggerForIncompleteCompletions=3,(je=qe||(e.CompletionRequest=qe={})).method="textDocument/completion",je.messageDirection=t.MessageDirection.clientToServer,je.type=new t.ProtocolRequestType(je.method),(Ge=Ue||(e.CompletionResolveRequest=Ue={})).method="completionItem/resolve",Ge.messageDirection=t.MessageDirection.clientToServer,Ge.type=new t.ProtocolRequestType(Ge.method),(Be=ze||(e.HoverRequest=ze={})).method="textDocument/hover",Be.messageDirection=t.MessageDirection.clientToServer,Be.type=new t.ProtocolRequestType(Be.method),(We=Ke||(e.SignatureHelpTriggerKind=Ke={})).Invoked=1,We.TriggerCharacter=2,We.ContentChange=3,(He=Ve||(e.SignatureHelpRequest=Ve={})).method="textDocument/signatureHelp",He.messageDirection=t.MessageDirection.clientToServer,He.type=new t.ProtocolRequestType(He.method),(Xe=Ye||(e.DefinitionRequest=Ye={})).method="textDocument/definition",Xe.messageDirection=t.MessageDirection.clientToServer,Xe.type=new t.ProtocolRequestType(Xe.method),(Ze=Je||(e.ReferencesRequest=Je={})).method="textDocument/references",Ze.messageDirection=t.MessageDirection.clientToServer,Ze.type=new t.ProtocolRequestType(Ze.method),(et=Qe||(e.DocumentHighlightRequest=Qe={})).method="textDocument/documentHighlight",et.messageDirection=t.MessageDirection.clientToServer,et.type=new t.ProtocolRequestType(et.method),(rt=tt||(e.DocumentSymbolRequest=tt={})).method="textDocument/documentSymbol",rt.messageDirection=t.MessageDirection.clientToServer,rt.type=new t.ProtocolRequestType(rt.method),(it=nt||(e.CodeActionRequest=nt={})).method="textDocument/codeAction",it.messageDirection=t.MessageDirection.clientToServer,it.type=new t.ProtocolRequestType(it.method),(ot=st||(e.CodeActionResolveRequest=st={})).method="codeAction/resolve",ot.messageDirection=t.MessageDirection.clientToServer,ot.type=new t.ProtocolRequestType(ot.method),(ct=at||(e.WorkspaceSymbolRequest=at={})).method="workspace/symbol",ct.messageDirection=t.MessageDirection.clientToServer,ct.type=new t.ProtocolRequestType(ct.method),(ut=lt||(e.WorkspaceSymbolResolveRequest=lt={})).method="workspaceSymbol/resolve",ut.messageDirection=t.MessageDirection.clientToServer,ut.type=new t.ProtocolRequestType(ut.method),(ht=dt||(e.CodeLensRequest=dt={})).method="textDocument/codeLens",ht.messageDirection=t.MessageDirection.clientToServer,ht.type=new t.ProtocolRequestType(ht.method),(ft=pt||(e.CodeLensResolveRequest=pt={})).method="codeLens/resolve",ft.messageDirection=t.MessageDirection.clientToServer,ft.type=new t.ProtocolRequestType(ft.method),(gt=mt||(e.CodeLensRefreshRequest=mt={})).method="workspace/codeLens/refresh",gt.messageDirection=t.MessageDirection.serverToClient,gt.type=new t.ProtocolRequestType0(gt.method),(Tt=yt||(e.DocumentLinkRequest=yt={})).method="textDocument/documentLink",Tt.messageDirection=t.MessageDirection.clientToServer,Tt.type=new t.ProtocolRequestType(Tt.method),(Rt=vt||(e.DocumentLinkResolveRequest=vt={})).method="documentLink/resolve",Rt.messageDirection=t.MessageDirection.clientToServer,Rt.type=new t.ProtocolRequestType(Rt.method),(St=Et||(e.DocumentFormattingRequest=Et={})).method="textDocument/formatting",St.messageDirection=t.MessageDirection.clientToServer,St.type=new t.ProtocolRequestType(St.method),(Ct=kt||(e.DocumentRangeFormattingRequest=kt={})).method="textDocument/rangeFormatting",Ct.messageDirection=t.MessageDirection.clientToServer,Ct.type=new t.ProtocolRequestType(Ct.method),(bt=At||(e.DocumentRangesFormattingRequest=At={})).method="textDocument/rangesFormatting",bt.messageDirection=t.MessageDirection.clientToServer,bt.type=new t.ProtocolRequestType(bt.method),(xt=$t||(e.DocumentOnTypeFormattingRequest=$t={})).method="textDocument/onTypeFormatting",xt.messageDirection=t.MessageDirection.clientToServer,xt.type=new t.ProtocolRequestType(xt.method),(wt||(e.PrepareSupportDefaultBehavior=wt={})).Identifier=1,(It=Nt||(e.RenameRequest=Nt={})).method="textDocument/rename",It.messageDirection=t.MessageDirection.clientToServer,It.type=new t.ProtocolRequestType(It.method),(Pt=_t||(e.PrepareRenameRequest=_t={})).method="textDocument/prepareRename",Pt.messageDirection=t.MessageDirection.clientToServer,Pt.type=new t.ProtocolRequestType(Pt.method),(Ot=Lt||(e.ExecuteCommandRequest=Lt={})).method="workspace/executeCommand",Ot.messageDirection=t.MessageDirection.clientToServer,Ot.type=new t.ProtocolRequestType(Ot.method),(Mt=Dt||(e.ApplyWorkspaceEditRequest=Dt={})).method="workspace/applyEdit",Mt.messageDirection=t.MessageDirection.serverToClient,Mt.type=new t.ProtocolRequestType("workspace/applyEdit")}(sm);var lT={};Object.defineProperty(lT,"__esModule",{value:!0}),lT.createProtocolConnection=void 0;const uT=Qp;var dT;lT.createProtocolConnection=function(e,t,r,n){return uT.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,uT.createMessageConnection)(e,t,r,n)},function(e){var t=v.commonjsGlobal&&v.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=v.commonjsGlobal&&v.commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,r(Qp,e),r(em,e),r(tm,e),r(sm,e);var n,i,s=lT;Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:function(){return s.createProtocolConnection}}),(i=n||(e.LSPErrorCodes=n={})).lspReservedErrorRangeStart=-32899,i.RequestFailed=-32803,i.ServerCancelled=-32802,i.ContentModified=-32801,i.RequestCancelled=-32800,i.lspReservedErrorRangeEnd=-32800}(Qf),function(e){var t=v.commonjsGlobal&&v.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=v.commonjsGlobal&&v.commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;const n=Zf;r(Zf,e),r(Qf,e),e.createProtocolConnection=function(e,t,r,i){return(0,n.createMessageConnection)(e,t,r,i)}}(Zp),(dT||(dT={})).create=function(e){return{dispose:async()=>await e()}};class hT{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Cp,this.documentPhaseListeners=new Cp,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=mp.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.fileSystemProvider=e.workspace.FileSystemProvider,this.workspaceManager=()=>e.workspace.WorkspaceManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},r=Uh.None){var n;for(const i of e){const e=i.uri.toString();if(i.state===mp.Validated){if("boolean"==typeof t.validation&&t.validation)this.resetToState(i,mp.IndexedReferences);else if("object"==typeof t.validation){const r=this.findMissingValidationCategories(i,t);r.length>0&&(this.buildState.set(e,{completed:!1,options:{validation:{categories:r}},result:null==(n=this.buildState.get(e))?void 0:n.result}),i.state=mp.IndexedReferences)}}else this.buildState.delete(e)}this.currentState=mp.Changed,await this.emitUpdate(e.map(e=>e.uri),[]),await this.buildDocuments(e,t,r)}async update(e,t,r=Uh.None){this.currentState=mp.Changed;const n=[];for(const a of t){const e=this.langiumDocuments.deleteDocuments(a);for(const t of e)n.push(t.uri),this.cleanUpDeleted(t)}const i=(await Promise.all(e.map(e=>this.findChangedUris(e)))).flat();for(const a of i){let e=this.langiumDocuments.getDocument(a);void 0===e&&(e=this.langiumDocumentFactory.fromModel({$type:"INVALID"},a),e.state=mp.Changed,this.langiumDocuments.addDocument(e)),this.resetToState(e,mp.Changed)}const s=L(i).concat(n).map(e=>e.toString()).toSet();this.langiumDocuments.all.filter(e=>!s.has(e.uri.toString())&&this.shouldRelink(e,s)).forEach(e=>this.resetToState(e,mp.ComputedScopes)),await this.emitUpdate(i,n),await tp(r);const o=this.sortDocuments(this.langiumDocuments.all.filter(e=>{var t;return e.state<mp.Validated||!(null==(t=this.buildState.get(e.uri.toString()))?void 0:t.completed)||this.resultsAreIncomplete(e,this.updateBuildOptions)}).toArray());await this.buildDocuments(o,this.updateBuildOptions,r)}resultsAreIncomplete(e,t){return this.findMissingValidationCategories(e,t).length>=1}findMissingValidationCategories(e,t){var r,n;const i=this.buildState.get(e.uri.toString()),s=this.serviceRegistry.getServices(e.uri).validation.ValidationRegistry.getAllValidationCategories(e),o=(null==(r=null==i?void 0:i.result)?void 0:r.validationChecks)?new Set(null==(n=null==i?void 0:i.result)?void 0:n.validationChecks):(null==i?void 0:i.completed)?s:new Set;return L(void 0===t||!0===t.validation?s:"object"==typeof t.validation?t.validation.categories??s:[]).filter(e=>!o.has(e)).toArray()}async findChangedUris(e){var t;if(this.langiumDocuments.getDocument(e)??(null==(t=this.textDocuments)?void 0:t.get(e)))return[e];try{const t=await this.fileSystemProvider.stat(e);if(t.isDirectory){return await this.workspaceManager().searchFolder(e)}if(this.workspaceManager().shouldIncludeEntry(t))return[e]}catch{}return[]}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(r=>r(e,t)))}sortDocuments(e){let t=0,r=e.length-1;for(;t<r;){for(;t<e.length&&this.hasTextDocument(e[t]);)t++;for(;r>=0&&!this.hasTextDocument(e[r]);)r--;t<r&&([e[t],e[r]]=[e[r],e[t]])}return e}hasTextDocument(e){var t;return Boolean(null==(t=this.textDocuments)?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),dT.create(()=>{const t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}resetToState(e,t){switch(t){case mp.Changed:case mp.Parsed:this.indexManager.removeContent(e.uri);case mp.IndexedContent:e.localSymbols=void 0;case mp.ComputedScopes:this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e);case mp.Linked:this.indexManager.removeReferences(e.uri);case mp.IndexedReferences:e.diagnostics=void 0,this.buildState.delete(e.uri.toString());case mp.Validated:}e.state>t&&(e.state=t)}cleanUpDeleted(e){this.buildState.delete(e.uri.toString()),this.indexManager.remove(e.uri),e.state=mp.Changed}async buildDocuments(e,t,r){this.prepareBuild(e,t),await this.runCancelable(e,mp.Parsed,r,e=>this.langiumDocumentFactory.update(e,r)),await this.runCancelable(e,mp.IndexedContent,r,e=>this.indexManager.updateContent(e,r)),await this.runCancelable(e,mp.ComputedScopes,r,async e=>{const t=this.serviceRegistry.getServices(e.uri).references.ScopeComputation;e.localSymbols=await t.collectLocalSymbols(e,r)});const n=e.filter(e=>this.shouldLink(e));await this.runCancelable(n,mp.Linked,r,e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,r)),await this.runCancelable(n,mp.IndexedReferences,r,e=>this.indexManager.updateReferences(e,r));const i=e.filter(e=>!!this.shouldValidate(e)||(this.markAsCompleted(e),!1));await this.runCancelable(i,mp.Validated,r,async e=>{await this.validate(e,r),this.markAsCompleted(e)})}markAsCompleted(e){const t=this.buildState.get(e.uri.toString());t&&(t.completed=!0)}prepareBuild(e,t){for(const r of e){const e=r.uri.toString(),n=this.buildState.get(e);n&&!n.completed||this.buildState.set(e,{completed:!1,options:t,result:null==n?void 0:n.result})}}async runCancelable(e,t,r,n){for(const s of e)s.state<t&&(await tp(r),await n(s),s.state=t,await this.notifyDocumentPhase(s,t,r));const i=e.filter(e=>e.state===t);await this.notifyBuildPhase(i,t,r),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),dT.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),dT.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,r){let n;return t&&"path"in t?n=t:r=t,r??(r=Uh.None),n?this.awaitDocumentState(e,n,r):this.awaitBuilderState(e,r)}awaitDocumentState(e,t,r){const n=this.langiumDocuments.getDocument(t);return n?n.state>=e?Promise.resolve(t):r.isCancellationRequested?Promise.reject(Qh):this.currentState>=e&&e>n.state?Promise.reject(new Zp.ResponseError(Zp.LSPErrorCodes.RequestFailed,`Document state of ${t.toString()} is ${mp[n.state]}, requiring ${mp[e]}, but workspace state is already ${mp[this.currentState]}. Returning undefined.`)):new Promise((n,i)=>{const s=this.onDocumentPhase(e,e=>{fp.equals(e.uri,t)&&(s.dispose(),o.dispose(),n(e.uri))}),o=r.onCancellationRequested(()=>{s.dispose(),o.dispose(),i(Qh)})}):Promise.reject(new Zp.ResponseError(Zp.LSPErrorCodes.ServerCancelled,`No document found for URI: ${t.toString()}`))}awaitBuilderState(e,t){return this.currentState>=e?Promise.resolve():t.isCancellationRequested?Promise.reject(Qh):new Promise((r,n)=>{const i=this.onBuildPhase(e,()=>{i.dispose(),s.dispose(),r()}),s=t.onCancellationRequested(()=>{i.dispose(),s.dispose(),n(Qh)})})}async notifyDocumentPhase(e,t,r){const n=this.documentPhaseListeners.get(t).slice();for(const s of n)try{await tp(r),await s(e,r)}catch(i){if(!ep(i))throw i}}async notifyBuildPhase(e,t,r){if(0===e.length)return;const n=this.buildPhaseListeners.get(t).slice();for(const i of n)await tp(r),await i(e,r)}shouldLink(e){return this.getBuildOptions(e).eagerLinking??!0}shouldValidate(e){return Boolean(this.getBuildOptions(e).validation)}async validate(e,t){const r=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,n=this.getBuildOptions(e),i="object"==typeof n.validation?{...n.validation}:{};i.categories=this.findMissingValidationCategories(e,n);const s=await r.validateDocument(e,i,t);e.diagnostics?e.diagnostics.push(...s):e.diagnostics=s;const o=this.buildState.get(e.uri.toString());o&&(o.result??(o.result={}),o.result.validationChecks?o.result.validationChecks=L(o.result.validationChecks).concat(i.categories).distinct().toArray():o.result.validationChecks=[...i.categories])}getBuildOptions(e){var t;return(null==(t=this.buildState.get(e.uri.toString()))?void 0:t.options)??{}}}class pT{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Ip,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){const r=j(e).uri,n=[];return this.referenceIndex.forEach(e=>{e.forEach(e=>{fp.equals(e.targetUri,r)&&e.targetPath===t&&n.push(e)})}),L(n)}allElements(e,t){let r=L(this.symbolIndex.keys());return t&&(r=r.filter(e=>!t||t.has(e))),r.map(t=>this.getFileDescriptions(t,e)).flat()}getFileDescriptions(e,t){if(!t)return this.symbolIndex.get(e)??[];return this.symbolByTypeIndex.get(e,t,()=>(this.symbolIndex.get(e)??[]).filter(e=>this.astReflection.isSubtype(e.type,t)))}remove(e){this.removeContent(e),this.removeReferences(e)}removeContent(e){const t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t)}removeReferences(e){const t=e.toString();this.referenceIndex.delete(t)}async updateContent(e,t=Uh.None){const r=this.serviceRegistry.getServices(e.uri),n=await r.references.ScopeComputation.collectExportedSymbols(e,t),i=e.uri.toString();this.symbolIndex.set(i,n),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=Uh.None){const r=this.serviceRegistry.getServices(e.uri),n=await r.workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),n)}isAffected(e,t){const r=this.referenceIndex.get(e.uri.toString());return!!r&&r.some(e=>!e.local&&t.has(e.targetUri.toString()))}}class fT{constructor(e){this.initialBuildOptions={},this._ready=new rp,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){this.folders=e.workspaceFolders??void 0}initialized(e){return this.mutex.write(e=>this.initializeWorkspace(this.folders??[],e))}async initializeWorkspace(e,t=Uh.None){const r=await this.performStartup(e);await tp(t),await this.documentBuilder.build(r,this.initialBuildOptions,t)}async performStartup(e){const t=[],r=e=>{t.push(e),this.langiumDocuments.hasDocument(e.uri)||this.langiumDocuments.addDocument(e)};await this.loadAdditionalDocuments(e,r);const n=[];await Promise.all(e.map(e=>this.getRootFolder(e)).map(async e=>this.traverseFolder(e,n)));const i=L(n).distinct(e=>e.toString()).filter(e=>!this.langiumDocuments.hasDocument(e));return await this.loadWorkspaceDocuments(i,r),this._ready.resolve(),t}async loadWorkspaceDocuments(e,t){await Promise.all(e.map(async e=>{const r=await this.langiumDocuments.getOrCreateDocument(e);t(r)}))}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return hp.parse(e.uri)}async traverseFolder(e,t){try{const r=await this.fileSystemProvider.readDirectory(e);await Promise.all(r.map(async e=>{this.shouldIncludeEntry(e)&&(e.isDirectory?await this.traverseFolder(e.uri,t):e.isFile&&t.push(e.uri))}))}catch(r){console.error("Failure to read directory content of "+e.toString(!0),r)}}async searchFolder(e){const t=[];return await this.traverseFolder(e,t),t}shouldIncludeEntry(e){const t=fp.basename(e.uri);return!t.startsWith(".")&&(e.isDirectory?"node_modules"!==t&&"out"!==t:!!e.isFile&&this.serviceRegistry.hasServices(e.uri))}}class mT{buildUnexpectedCharactersMessage(e,t,r,n,i){return Ds.buildUnexpectedCharactersMessage(e,t,r,n,i)}buildUnableToPopLexerModeMessage(e){return Ds.buildUnableToPopLexerModeMessage(e)}}const gT={mode:"full"};class yT{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 r=vT(t)?Object.values(t):t,n="production"===e.LanguageMetaData.mode;this.chevrotainLexer=new js(r,{positionTracking:"full",skipValidations:n,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=gT){var r,n;const i=this.chevrotainLexer.tokenize(e);return{tokens:i.tokens,errors:i.errors,hidden:i.groups.hidden??[],report:null==(n=(r=this.tokenBuilder).flushLexingReport)?void 0:n.call(r,e)}}toTokenTypeDictionary(e){if(vT(e))return e;const t=TT(e)?Object.values(e.modes).flat():e,r={};return t.forEach(e=>r[e.name]=e),r}}function TT(e){return e&&"modes"in e&&"defaultMode"in e}function vT(e){return!function(e){return Array.isArray(e)&&(0===e.length||"name"in e[0])}(e)&&!TT(e)}function RT(e,t,r){let n,i;"string"==typeof e?(i=t,n=r):(i=e.range.start,n=t),i||(i=Nl.create(0,0));const s=function(e){var t,r,n;const i=[];let s=e.position.line,o=e.position.character;for(let a=0;a<e.lines.length;a++){const c=0===a,l=a===e.lines.length-1;let u=e.lines[a],d=0;if(c&&e.options.start){const r=null==(t=e.options.start)?void 0:t.exec(u);r&&(d=r.index+r[0].length)}else{const t=null==(r=e.options.line)?void 0:r.exec(u);t&&(d=t.index+t[0].length)}if(l){const t=null==(n=e.options.end)?void 0:n.exec(u);t&&(u=u.substring(0,t.index))}u=u.substring(0,xT(u));if($T(u,d)>=u.length){if(i.length>0){const e=Nl.create(s,o);i.push({type:"break",content:"",range:_l.create(e,e)})}}else{ST.lastIndex=d;const e=ST.exec(u);if(e){const t=e[0],r=e[1],n=Nl.create(s,o+d),a=Nl.create(s,o+d+t.length);i.push({type:"tag",content:r,range:_l.create(n,a)}),d+=t.length,d=$T(u,d)}if(d<u.length){const e=u.substring(d),t=Array.from(e.matchAll(kT));i.push(...CT(t,e,s,o+d))}}s++,o=0}if(i.length>0&&"break"===i[i.length-1].type)return i.slice(0,-1);return i}({lines:ET(e),position:i,options:LT(n)});return function(e){var t,r;const n=Nl.create(e.position.line,e.position.character);if(0===e.tokens.length)return new DT([],_l.create(n,n));const i=[];for(;e.index<e.tokens.length;){const t=wT(e,i[i.length-1]);t&&i.push(t)}const s=(null==(t=i[0])?void 0:t.range.start)??n,o=(null==(r=i[i.length-1])?void 0:r.range.end)??n;return new DT(i,_l.create(s,o))}({index:0,tokens:s,position:i})}function ET(e){let t="";t="string"==typeof e?e:e.text;return t.split(Qn)}const ST=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,kT=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function CT(e,t,r,n){const i=[];if(0===e.length){const e=Nl.create(r,n),s=Nl.create(r,n+t.length);i.push({type:"text",content:t,range:_l.create(e,s)})}else{let s=0;for(const a of e){const e=a.index,o=t.substring(s,e);o.length>0&&i.push({type:"text",content:t.substring(s,e),range:_l.create(Nl.create(r,s+n),Nl.create(r,e+n))});let c=o.length+1;const l=a[1];if(i.push({type:"inline-tag",content:l,range:_l.create(Nl.create(r,s+c+n),Nl.create(r,s+c+l.length+n))}),c+=l.length,4===a.length){c+=a[2].length;const e=a[3];i.push({type:"text",content:e,range:_l.create(Nl.create(r,s+c+n),Nl.create(r,s+c+e.length+n))})}else i.push({type:"text",content:"",range:_l.create(Nl.create(r,s+c+n),Nl.create(r,s+c+n))});s=e+a[0].length}const o=t.substring(s);o.length>0&&i.push({type:"text",content:o,range:_l.create(Nl.create(r,s+n),Nl.create(r,s+n+o.length))})}return i}const AT=/\S/,bT=/\s*$/;function $T(e,t){const r=e.substring(t).match(AT);return r?t+r.index:e.length}function xT(e){const t=e.match(bT);if(t&&"number"==typeof t.index)return t.index}function wT(e,t){const r=e.tokens[e.index];return"tag"===r.type?_T(e,!1):"text"===r.type||"inline-tag"===r.type?NT(e):(function(e,t){if(t){const r=new qT("",e.range);"inlines"in t?t.inlines.push(r):t.content.inlines.push(r)}}(r,t),void e.index++)}function NT(e){let t=e.tokens[e.index];const r=t;let n=t;const i=[];for(;t&&"break"!==t.type&&"tag"!==t.type;)i.push(IT(e)),n=t,t=e.tokens[e.index];return new FT(i,_l.create(r.range.start,n.range.end))}function IT(e){return"inline-tag"===e.tokens[e.index].type?_T(e,!0):PT(e)}function _T(e,t){const r=e.tokens[e.index++],n=r.content.substring(1),i=e.tokens[e.index];if("text"===(null==i?void 0:i.type)){if(t){const i=PT(e);return new MT(n,new FT([i],i.range),t,_l.create(r.range.start,i.range.end))}{const i=NT(e);return new MT(n,i,t,_l.create(r.range.start,i.range.end))}}{const e=r.range;return new MT(n,new FT([],e),t,e)}}function PT(e){const t=e.tokens[e.index++];return new qT(t.content,t.range)}function LT(e){if(!e)return LT({start:"/**",end:"*/",line:"*"});const{start:t,end:r,line:n}=e;return{start:OT(t,!0),end:OT(r,!1),line:OT(n,!0)}}function OT(e,t){if("string"==typeof e||"object"==typeof e){const r="string"==typeof e?si(e):e.source;return t?new RegExp(`^\\s*${r}`):new RegExp(`\\s*${r}\\s*$`)}return e}class DT{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 r=t.toString();e+=jT(e)+r}return e.trim()}toMarkdown(e){let t="";for(const r of this.elements)if(0===t.length)t=r.toMarkdown(e);else{const n=r.toMarkdown(e);t+=jT(t)+n}return t.trim()}}class MT{constructor(e,t,r,n){this.name=e,this.content=t,this.inline=r,this.range=n}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;return(null==(t=null==e?void 0:e.renderTag)?void 0:t.call(e,this))??this.toMarkdownDefault(e)}toMarkdownDefault(e){const t=this.content.toMarkdown(e);if(this.inline){const r=function(e,t,r){var n;if("linkplain"===e||"linkcode"===e||"link"===e){const i=t.indexOf(" ");let s=t;if(i>0){const e=$T(t,i);s=t.substring(e),t=t.substring(0,i)}("linkcode"===e||"link"===e&&"code"===r.link)&&(s=`\`${s}\``);const o=(null==(n=r.renderLink)?void 0:n.call(r,t,s))??function(e,t){try{return hp.parse(e,!0),`[${t}](${e})`}catch{return e}}(t,s);return o}return}(this.name,t,e??{});if("string"==typeof r)return r}let r="";"italic"===(null==e?void 0:e.tag)||void 0===(null==e?void 0:e.tag)?r="*":"bold"===(null==e?void 0:e.tag)?r="**":"bold-italic"===(null==e?void 0:e.tag)&&(r="***");let n=`${r}@${this.name}${r}`;return 1===this.content.inlines.length?n=`${n} — ${t}`:this.content.inlines.length>1&&(n=`${n}\n${t}`),this.inline?`{${n}}`:n}}class FT{constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;t<this.inlines.length;t++){const r=this.inlines[t],n=this.inlines[t+1];e+=r.toString(),n&&n.range.start.line>r.range.start.line&&(e+="\n")}return e}toMarkdown(e){let t="";for(let r=0;r<this.inlines.length;r++){const n=this.inlines[r],i=this.inlines[r+1];t+=n.toMarkdown(e),i&&i.range.start.line>n.range.start.line&&(t+="\n")}return t}}class qT{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}}function jT(e){return e.endsWith("\n")?"\n":"\n\n"}class UT{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 r=LT(t),n=ET(e);if(0===n.length)return!1;const i=n[0],s=n[n.length-1],o=r.start,a=r.end;return Boolean(null==o?void 0:o.exec(i))&&Boolean(null==a?void 0:a.exec(s))}(t)){return RT(t).toMarkdown({renderLink:(t,r)=>this.documentationLinkRenderer(e,t,r),renderTag:t=>this.documentationTagRenderer(e,t)})}}documentationLinkRenderer(e,t,r){const n=this.findNameInLocalSymbols(e,t)??this.findNameInGlobalScope(e,t);if(n&&n.nameSegment){const e=n.nameSegment.range.start.line+1,t=n.nameSegment.range.start.character+1;return`[${r}](${n.documentUri.with({fragment:`L${e},${t}`}).toString()})`}}documentationTagRenderer(e,t){}findNameInLocalSymbols(e,t){const r=j(e).localSymbols;if(!r)return;let n=e;do{const e=r.getStream(n).find(e=>e.name===t);if(e)return e;n=n.$container}while(n)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(e=>e.name===t)}}class GT{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 r=function(e,t=!0){for(;e.container;){const r=e.container;let n=r.content.indexOf(e);for(;n>0;){n--;const e=r.content[n];if(t||!e.hidden)return e}e=r}}(e,!0);if(r&&Mn(r,t))return r;if(x(e))for(let n=e.content.findIndex(e=>!e.hidden)-1;n>=0;n--){const r=e.content[n];if(Mn(r,t))return r}}}(e.$cstNode,this.grammarConfig().multilineCommentRules))?void 0:t.text}}class zT{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}}class BT{constructor(){this.previousTokenSource=new Bh,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const t=(Zh=performance.now(),new Bh);return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r=Uh.None){const n=new rp,i={action:t,deferred:n,cancellationToken:r};return e.push(i),this.performNextOperation(),n.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:r})=>{try{const n=await Promise.resolve().then(()=>e(r));t.resolve(n)}catch(n){ep(n)?t.resolve(void 0):t.reject(n)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class KT{constructor(e){this.grammarElementIdMap=new Ap,this.tokenTypeIdMap=new Ap,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=>({...e,message:e.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const t=new Map,r=new Map;for(const n of K(e))t.set(n,{});if(e.$cstNode)for(const n of In(e.$cstNode))r.set(n,{});return{astNodes:t,cstNodes:r}}dehydrateAstNode(e,t){const r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,void 0!==e.$cstNode&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(const[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){const e=[];r[n]=e;for(const r of i)E(r)?e.push(this.dehydrateAstNode(r,t)):S(r)?e.push(this.dehydrateReference(r,t)):e.push(r)}else E(i)?r[n]=this.dehydrateAstNode(i,t):S(i)?r[n]=this.dehydrateReference(i,t):void 0!==i&&(r[n]=i);return r}dehydrateReference(e,t){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=t.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,t){const r=t.cstNodes.get(e);return x(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=t.astNodes.get(e.astNode),b(e)?r.content=e.content.map(e=>this.dehydrateCstNode(e,t)):$(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const t=e.value,r=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,r)}}createHydrationContext(e){const t=new Map,r=new Map;for(const i of K(e))t.set(i,{});let n;if(e.$cstNode)for(const i of In(e.$cstNode)){let e;"fullText"in i?(e=new sh(i.fullText),n=e):"content"in i?e=new nh:"tokenType"in i&&(e=this.hydrateCstLeafNode(i)),e&&(r.set(i,e),e.root=n)}return{astNodes:t,cstNodes:r}}hydrateAstNode(e,t){const r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=t.cstNodes.get(e.$cstNode));for(const[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){const e=[];r[n]=e;for(const s of i)E(s)?e.push(this.setParent(this.hydrateAstNode(s,t),r)):S(s)?e.push(this.hydrateReference(s,r,n,t)):e.push(s)}else E(i)?r[n]=this.setParent(this.hydrateAstNode(i,t),r):S(i)?r[n]=this.hydrateReference(i,r,n,t):void 0!==i&&(r[n]=i);return r}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,r,n){return this.linker.buildReference(t,r,n.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,r=0){const n=t.cstNodes.get(e);if("number"==typeof e.grammarSource&&(n.grammarSource=this.getGrammarElement(e.grammarSource)),n.astNode=t.astNodes.get(e.astNode),b(n))for(const i of e.content){const e=this.hydrateCstNode(i,t,r++);n.content.push(e)}return n}hydrateCstLeafNode(e){const t=this.getTokenType(e.tokenType),r=e.offset,n=e.length,i=e.startLine,s=e.startColumn,o=e.endLine,a=e.endColumn,c=e.hidden;return new rh(r,n,{start:{line:i,character:s},end:{line:o,character:a}},t,c)}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 t of K(this.grammar))J(t)&&this.grammarElementIdMap.set(t,e++)}}function WT(e){return{documentation:{CommentProvider:e=>new GT(e),DocumentationProvider:e=>new UT(e)},parser:{AsyncParser:e=>new zT(e),GrammarConfig:e=>function(e){const t=[],r=e.Grammar;for(const n of r.rules)Jr(n)&&li(n)&&ri(vi(n))&&t.push(n.name);return{multilineCommentRules:t,nameRegexp:Dn}}(e),LangiumParser:e=>bh(e),CompletionParser:e=>function(e){const t=e.Grammar,r=e.parser.Lexer,n=new ph(e);return yh(t,n,r.definition),n.finalize(),n}(e),ValueConverter:()=>new xh,TokenBuilder:()=>new $h,Lexer:e=>new yT(e),ParserErrorMessageProvider:()=>new hh,LexerErrorMessageProvider:()=>new mT},workspace:{AstNodeLocator:()=>new Xp,AstNodeDescriptionProvider:e=>new Hp(e),ReferenceDescriptionProvider:e=>new Yp(e)},references:{Linker:e=>new Ep(e),NameProvider:()=>new Sp,ScopeProvider:e=>new Pp(e),ScopeComputation:e=>new bp(e),References:e=>new kp(e)},serializer:{Hydrator:e=>new KT(e),JsonSerializer:e=>new Op(e)},validation:{DocumentValidator:e=>new Gp(e),ValidationRegistry:e=>new jp(e)},shared:()=>e.shared}}function VT(e){return{ServiceRegistry:e=>new Dp(e),workspace:{LangiumDocuments:e=>new vp(e),LangiumDocumentFactory:e=>new Tp(e),DocumentBuilder:e=>new hT(e),IndexManager:e=>new pT(e),WorkspaceManager:e=>new fT(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new BT,ConfigurationProvider:e=>new Jp(e)},profilers:{}}}var HT;function YT(e,t,r,n,i,s,o,a,c){return JT([e,t,r,n,i,s,o,a,c].reduce(ev,{}))}(HT||(HT={})).merge=(e,t)=>ev(ev({},e),t);const XT=Symbol("isProxy");function JT(e,t){const r=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(n,i)=>i===XT||QT(n,i,e,t||r),getOwnPropertyDescriptor:(n,i)=>(QT(n,i,e,t||r),Object.getOwnPropertyDescriptor(n,i)),has:(t,r)=>r in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return r}const ZT=Symbol();function QT(e,t,r,n){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]===ZT)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 r){const s=r[t];e[t]=ZT;try{e[t]="function"==typeof s?s(n):JT(s,n)}catch(i){throw e[t]=i instanceof Error?i:void 0,i}return e[t]}}function ev(e,t){if(t)for(const[r,n]of Object.entries(t))if(null!=n)if("object"==typeof n){const t=e[r];e[r]=ev("object"==typeof t&&null!==t?t:{},n)}else e[r]=n;return e}class tv{stat(e){throw new Error("No file system is available.")}statSync(e){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}}const rv={fileSystemProvider:()=>new tv},nv={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},iv={AstReflection:()=>new wn};function sv(e){const t=function(){const e=YT(VT(rv),iv),t=YT(WT({shared:e}),nv);return e.ServiceRegistry.register(t),t}(),r=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(r,hp.parse(`memory:/${r.name??"grammar"}.langium`)),r}var ov,av,cv,lv,uv,dv,hv,pv=Object.defineProperty,fv=(e,t)=>pv(e,"name",{value:t,configurable:!0});(ov||(ov={})).Terminals={ARROW_DIRECTION:/L|R|T|B/,ARROW_GROUP:/\{group\}/,ARROW_INTO:/<|>/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ARCH_ICON:/\([\w-:]+\)/,ARCH_TITLE:/\[[\w ]+\]/},(av||(av={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,REFERENCE:/\w([-\./\w]*[-\w])?/},(cv||(cv={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(lv||(lv={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(uv||(uv={})).Terminals={NUMBER_PIE:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(dv||(dv={})).Terminals={GRATICULE:/circle|polygon/,BOOLEAN:/true|false/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NUMBER:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/},(hv||(hv={})).Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,TREEMAP_KEYWORD:/treemap-beta|treemap/,CLASS_DEF:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,STYLE_SEPARATOR:/:::/,SEPARATOR:/:/,COMMA:/,/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,ID2:/[a-zA-Z_][a-zA-Z0-9_]*/,NUMBER2:/[0-9_\.\,]+/,STRING2:/"[^"]*"|'[^']*'/},ov.Terminals,av.Terminals,cv.Terminals,lv.Terminals,uv.Terminals,dv.Terminals,hv.Terminals;var mv="Architecture",gv="accDescr",yv="accTitle",Tv="edges",vv="groups",Rv="junctions",Ev="services",Sv="title";fv(function(e){return GE.isInstance(e,mv)},"isArchitecture");var kv="Axis",Cv="label",Av="name",bv="Branch",$v="name",xv="order";fv(function(e){return GE.isInstance(e,bv)},"isBranch");var wv="Checkout",Nv="branch",Iv="CherryPicking",_v="id",Pv="parent",Lv="tags",Ov="ClassDefStatement",Dv="className",Mv="styleText",Fv="Commit",qv="id",jv="message",Uv="tags",Gv="type";fv(function(e){return GE.isInstance(e,Fv)},"isCommit");var zv="Curve",Bv="entries",Kv="label",Wv="name",Vv="Direction",Hv="accDescr",Yv="accTitle",Xv="dir",Jv="statements",Zv="title",Qv="Edge",eR="lhsDir",tR="lhsGroup",rR="lhsId",nR="lhsInto",iR="rhsDir",sR="rhsGroup",oR="rhsId",aR="rhsInto",cR="title",lR="Entry",uR="axis",dR="value",hR="GitGraph",pR="accDescr",fR="accTitle",mR="statements",gR="title";fv(function(e){return GE.isInstance(e,hR)},"isGitGraph");var yR="Group",TR="icon",vR="id",RR="in",ER="title",SR="Info",kR="accDescr",CR="accTitle",AR="title";fv(function(e){return GE.isInstance(e,SR)},"isInfo");var bR="Item",$R="classSelector",xR="name",wR="Junction",NR="id",IR="in",_R="Leaf",PR="classSelector",LR="name",OR="value",DR="Merge",MR="branch",FR="id",qR="tags",jR="type";fv(function(e){return GE.isInstance(e,DR)},"isMerge");var UR="Option",GR="name",zR="value",BR="Packet",KR="accDescr",WR="accTitle",VR="blocks",HR="title";fv(function(e){return GE.isInstance(e,BR)},"isPacket");var YR="PacketBlock",XR="bits",JR="end",ZR="label",QR="start";fv(function(e){return GE.isInstance(e,YR)},"isPacketBlock");var eE="Pie",tE="accDescr",rE="accTitle",nE="sections",iE="showData",sE="title";fv(function(e){return GE.isInstance(e,eE)},"isPie");var oE="PieSection",aE="label",cE="value";fv(function(e){return GE.isInstance(e,oE)},"isPieSection");var lE="Radar",uE="accDescr",dE="accTitle",hE="axes",pE="curves",fE="options",mE="title",gE="Section",yE="classSelector",TE="name",vE="Service",RE="icon",EE="iconText",SE="id",kE="in",CE="title",AE="Statement",bE="Treemap",$E="accDescr",xE="accTitle",wE="title",NE="TreemapRows";fv(function(e){return GE.isInstance(e,bE)},"isTreemap");var IE,_E,PE,LE,OE,DE,ME,FE="TreemapRow",qE="indent",jE="item",UE=(fv(e=class extends A{constructor(){super(...arguments),this.types={Architecture:{name:mv,properties:{accDescr:{name:gv},accTitle:{name:yv},edges:{name:Tv,defaultValue:[]},groups:{name:vv,defaultValue:[]},junctions:{name:Rv,defaultValue:[]},services:{name:Ev,defaultValue:[]},title:{name:Sv}},superTypes:[]},Axis:{name:kv,properties:{label:{name:Cv},name:{name:Av}},superTypes:[]},Branch:{name:bv,properties:{name:{name:$v},order:{name:xv}},superTypes:[AE]},Checkout:{name:wv,properties:{branch:{name:Nv}},superTypes:[AE]},CherryPicking:{name:Iv,properties:{id:{name:_v},parent:{name:Pv},tags:{name:Lv,defaultValue:[]}},superTypes:[AE]},ClassDefStatement:{name:Ov,properties:{className:{name:Dv},styleText:{name:Mv}},superTypes:[]},Commit:{name:Fv,properties:{id:{name:qv},message:{name:jv},tags:{name:Uv,defaultValue:[]},type:{name:Gv}},superTypes:[AE]},Curve:{name:zv,properties:{entries:{name:Bv,defaultValue:[]},label:{name:Kv},name:{name:Wv}},superTypes:[]},Direction:{name:Vv,properties:{accDescr:{name:Hv},accTitle:{name:Yv},dir:{name:Xv},statements:{name:Jv,defaultValue:[]},title:{name:Zv}},superTypes:[hR]},Edge:{name:Qv,properties:{lhsDir:{name:eR},lhsGroup:{name:tR,defaultValue:!1},lhsId:{name:rR},lhsInto:{name:nR,defaultValue:!1},rhsDir:{name:iR},rhsGroup:{name:sR,defaultValue:!1},rhsId:{name:oR},rhsInto:{name:aR,defaultValue:!1},title:{name:cR}},superTypes:[]},Entry:{name:lR,properties:{axis:{name:uR,referenceType:kv},value:{name:dR}},superTypes:[]},GitGraph:{name:hR,properties:{accDescr:{name:pR},accTitle:{name:fR},statements:{name:mR,defaultValue:[]},title:{name:gR}},superTypes:[]},Group:{name:yR,properties:{icon:{name:TR},id:{name:vR},in:{name:RR},title:{name:ER}},superTypes:[]},Info:{name:SR,properties:{accDescr:{name:kR},accTitle:{name:CR},title:{name:AR}},superTypes:[]},Item:{name:bR,properties:{classSelector:{name:$R},name:{name:xR}},superTypes:[]},Junction:{name:wR,properties:{id:{name:NR},in:{name:IR}},superTypes:[]},Leaf:{name:_R,properties:{classSelector:{name:PR},name:{name:LR},value:{name:OR}},superTypes:[bR]},Merge:{name:DR,properties:{branch:{name:MR},id:{name:FR},tags:{name:qR,defaultValue:[]},type:{name:jR}},superTypes:[AE]},Option:{name:UR,properties:{name:{name:GR},value:{name:zR,defaultValue:!1}},superTypes:[]},Packet:{name:BR,properties:{accDescr:{name:KR},accTitle:{name:WR},blocks:{name:VR,defaultValue:[]},title:{name:HR}},superTypes:[]},PacketBlock:{name:YR,properties:{bits:{name:XR},end:{name:JR},label:{name:ZR},start:{name:QR}},superTypes:[]},Pie:{name:eE,properties:{accDescr:{name:tE},accTitle:{name:rE},sections:{name:nE,defaultValue:[]},showData:{name:iE,defaultValue:!1},title:{name:sE}},superTypes:[]},PieSection:{name:oE,properties:{label:{name:aE},value:{name:cE}},superTypes:[]},Radar:{name:lE,properties:{accDescr:{name:uE},accTitle:{name:dE},axes:{name:hE,defaultValue:[]},curves:{name:pE,defaultValue:[]},options:{name:fE,defaultValue:[]},title:{name:mE}},superTypes:[]},Section:{name:gE,properties:{classSelector:{name:yE},name:{name:TE}},superTypes:[bR]},Service:{name:vE,properties:{icon:{name:RE},iconText:{name:EE},id:{name:SE},in:{name:kE},title:{name:CE}},superTypes:[]},Statement:{name:AE,properties:{},superTypes:[]},Treemap:{name:bE,properties:{accDescr:{name:$E},accTitle:{name:xE},title:{name:wE},TreemapRows:{name:NE,defaultValue:[]}},superTypes:[]},TreemapRow:{name:FE,properties:{indent:{name:qE},item:{name:jE}},superTypes:[]}}}},"MermaidAstReflection"),e),GE=new UE,zE=fv(()=>IE??(IE=sv('{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$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":[]}}]},"entry":false,"parameters":[]},{"$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":[]}}]},"entry":false,"parameters":[]},{"$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":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"ArchitectureGrammarGrammar"),BE=fv(()=>_E??(_E=sv('{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$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"}]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}')),"GitGraphGrammarGrammar"),KE=fv(()=>PE??(PE=sv('{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"InfoGrammarGrammar"),WE=fv(()=>LE??(LE=sv('{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PacketGrammarGrammar"),VE=fv(()=>OE??(OE=sv('{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}')),"PieGrammarGrammar"),HE=fv(()=>DE??(DE=sv('{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|\'([^\'\\\\\\\\]|\\\\\\\\.)*\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}')),"RadarGrammarGrammar"),YE=fv(()=>ME??(ME=sv('{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|\'[^\']*\'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}')),"TreemapGrammarGrammar"),XE={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},JE={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},ZE={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},QE={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},eS={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},tS={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},rS={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},nS={AstReflection:fv(()=>new UE,"AstReflection")},iS={Grammar:fv(()=>zE(),"Grammar"),LanguageMetaData:fv(()=>XE,"LanguageMetaData"),parser:{}},sS={Grammar:fv(()=>BE(),"Grammar"),LanguageMetaData:fv(()=>JE,"LanguageMetaData"),parser:{}},oS={Grammar:fv(()=>KE(),"Grammar"),LanguageMetaData:fv(()=>ZE,"LanguageMetaData"),parser:{}},aS={Grammar:fv(()=>WE(),"Grammar"),LanguageMetaData:fv(()=>QE,"LanguageMetaData"),parser:{}},cS={Grammar:fv(()=>VE(),"Grammar"),LanguageMetaData:fv(()=>eS,"LanguageMetaData"),parser:{}},lS={Grammar:fv(()=>HE(),"Grammar"),LanguageMetaData:fv(()=>tS,"LanguageMetaData"),parser:{}},uS={Grammar:fv(()=>YE(),"Grammar"),LanguageMetaData:fv(()=>rS,"LanguageMetaData"),parser:{}},dS={ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/accTitle[\t ]*:([^\n\r]*)/,TITLE:/title([\t ][^\n\r]*|)/},hS=(fv(t=class extends xh{runConverter(e,t,r){let n=this.runCommonConverter(e,t,r);return void 0===n&&(n=this.runCustomConverter(e,t,r)),void 0===n?super.runConverter(e,t,r):n}runCommonConverter(e,t,r){const n=dS[e.name];if(void 0===n)return;const i=n.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),pS=(fv(r=class extends hS{runCustomConverter(e,t,r){}},"CommonValueConverter"),r),fS=(fv(n=class extends $h{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,r){const n=super.buildKeywordTokens(e,t,r);return n.forEach(e=>{this.keywords.has(e.name)&&void 0!==e.PATTERN&&(e.PATTERN=new RegExp(e.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}},"AbstractMermaidTokenBuilder"),n);fv(class extends fS{},"CommonTokenBuilder");var mS=(fv(i=class extends fS{constructor(){super(["gitGraph"])}},"GitGraphTokenBuilder"),i),gS={parser:{TokenBuilder:fv(()=>new mS,"TokenBuilder"),ValueConverter:fv(()=>new pS,"ValueConverter")}};function yS(e=rv){const t=YT(VT(e),nS),r=YT(WT({shared:t}),sS,gS);return t.ServiceRegistry.register(r),{shared:t,GitGraph:r}}fv(yS,"createGitGraphServices");var TS=(fv(s=class extends fS{constructor(){super(["info","showInfo"])}},"InfoTokenBuilder"),s),vS={parser:{TokenBuilder:fv(()=>new TS,"TokenBuilder"),ValueConverter:fv(()=>new pS,"ValueConverter")}};function RS(e=rv){const t=YT(VT(e),nS),r=YT(WT({shared:t}),oS,vS);return t.ServiceRegistry.register(r),{shared:t,Info:r}}fv(RS,"createInfoServices");var ES=(fv(o=class extends fS{constructor(){super(["packet"])}},"PacketTokenBuilder"),o),SS={parser:{TokenBuilder:fv(()=>new ES,"TokenBuilder"),ValueConverter:fv(()=>new pS,"ValueConverter")}};function kS(e=rv){const t=YT(VT(e),nS),r=YT(WT({shared:t}),aS,SS);return t.ServiceRegistry.register(r),{shared:t,Packet:r}}fv(kS,"createPacketServices");var CS=(fv(a=class extends fS{constructor(){super(["pie","showData"])}},"PieTokenBuilder"),a),AS=(fv(c=class extends hS{runCustomConverter(e,t,r){if("PIE_SECTION_LABEL"===e.name)return t.replace(/"/g,"").trim()}},"PieValueConverter"),c),bS={parser:{TokenBuilder:fv(()=>new CS,"TokenBuilder"),ValueConverter:fv(()=>new AS,"ValueConverter")}};function $S(e=rv){const t=YT(VT(e),nS),r=YT(WT({shared:t}),cS,bS);return t.ServiceRegistry.register(r),{shared:t,Pie:r}}fv($S,"createPieServices");var xS=(fv(l=class extends fS{constructor(){super(["architecture"])}},"ArchitectureTokenBuilder"),l),wS=(fv(u=class extends hS{runCustomConverter(e,t,r){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),NS={parser:{TokenBuilder:fv(()=>new xS,"TokenBuilder"),ValueConverter:fv(()=>new wS,"ValueConverter")}};function IS(e=rv){const t=YT(VT(e),nS),r=YT(WT({shared:t}),iS,NS);return t.ServiceRegistry.register(r),{shared:t,Architecture:r}}fv(IS,"createArchitectureServices");var _S=(fv(d=class extends fS{constructor(){super(["radar-beta"])}},"RadarTokenBuilder"),d),PS={parser:{TokenBuilder:fv(()=>new _S,"TokenBuilder"),ValueConverter:fv(()=>new pS,"ValueConverter")}};function LS(e=rv){const t=YT(VT(e),nS),r=YT(WT({shared:t}),lS,PS);return t.ServiceRegistry.register(r),{shared:t,Radar:r}}fv(LS,"createRadarServices");var OS=(fv(h=class extends fS{constructor(){super(["treemap"])}},"TreemapTokenBuilder"),h),DS=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,MS=(fv(p=class extends hS{runCustomConverter(e,t,r){if("NUMBER2"===e.name)return parseFloat(t.replace(/,/g,""));if("SEPARATOR"===e.name)return t.substring(1,t.length-1);if("STRING2"===e.name)return t.substring(1,t.length-1);if("INDENTATION"===e.name)return t.length;if("ClassDef"===e.name){if("string"!=typeof t)return t;const e=DS.exec(t);if(e)return{$type:"ClassDefStatement",className:e[1],styleText:e[2]||void 0}}}},"TreemapValueConverter"),p);function FS(e){const t=e.validation.TreemapValidator,r=e.validation.ValidationRegistry;if(r){const e={Treemap:t.checkSingleRoot.bind(t)};r.register(e,t)}}fv(FS,"registerValidationChecks");var qS=(fv(f=class{checkSingleRoot(e,t){let r;for(const n of e.TreemapRows)n.item&&(void 0===r&&void 0===n.indent?r=0:(void 0===n.indent||void 0!==r&&r>=parseInt(n.indent,10))&&t("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}))}},"TreemapValidator"),f),jS={parser:{TokenBuilder:fv(()=>new OS,"TokenBuilder"),ValueConverter:fv(()=>new MS,"ValueConverter")},validation:{TreemapValidator:fv(()=>new qS,"TreemapValidator")}};function US(e=rv){const t=YT(VT(e),nS),r=YT(WT({shared:t}),uS,jS);return t.ServiceRegistry.register(r),FS(r),{shared:t,Treemap:r}}fv(US,"createTreemapServices");var GS={},zS={info:fv(async()=>{const{createInfoServices:e}=await Promise.resolve().then(()=>require("./info-VBDWY6EO-D5dR6PPz.cjs")),t=e().Info.parser.LangiumParser;GS.info=t},"info"),packet:fv(async()=>{const{createPacketServices:e}=await Promise.resolve().then(()=>require("./packet-DYOGHKS2-CR7ugQ48.cjs")),t=e().Packet.parser.LangiumParser;GS.packet=t},"packet"),pie:fv(async()=>{const{createPieServices:e}=await Promise.resolve().then(()=>require("./pie-VRWISCQL-BXJW8jKm.cjs")),t=e().Pie.parser.LangiumParser;GS.pie=t},"pie"),architecture:fv(async()=>{const{createArchitectureServices:e}=await Promise.resolve().then(()=>require("./architecture-7HQA4BMR-VRHl0WAG.cjs")),t=e().Architecture.parser.LangiumParser;GS.architecture=t},"architecture"),gitGraph:fv(async()=>{const{createGitGraphServices:e}=await Promise.resolve().then(()=>require("./gitGraph-G5XIXVHT-D0HIYGjj.cjs")),t=e().GitGraph.parser.LangiumParser;GS.gitGraph=t},"gitGraph"),radar:fv(async()=>{const{createRadarServices:e}=await Promise.resolve().then(()=>require("./radar-ZZBFDIW7-DvMtYd_q.cjs")),t=e().Radar.parser.LangiumParser;GS.radar=t},"radar"),treemap:fv(async()=>{const{createTreemapServices:e}=await Promise.resolve().then(()=>require("./treemap-GDKQZRPO-C_BDlIt0.cjs")),t=e().Treemap.parser.LangiumParser;GS.treemap=t},"treemap")};async function BS(e,t){const r=zS[e];if(!r)throw new Error(`Unknown diagram type: ${e}`);GS[e]||await r();const n=GS[e].parse(t);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new KS(n);return n.value}fv(BS,"parse");var KS=(m=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}},fv(m,"MermaidParseError"),m);exports.ArchitectureModule=NS,exports.GitGraphModule=gS,exports.InfoModule=vS,exports.PacketModule=SS,exports.PieModule=bS,exports.RadarModule=PS,exports.TreemapModule=jS,exports.createArchitectureServices=IS,exports.createGitGraphServices=yS,exports.createInfoServices=RS,exports.createPacketServices=kS,exports.createPieServices=$S,exports.createRadarServices=LS,exports.createTreemapServices=US,exports.parse=BS;
|
|
2
|
+
//# sourceMappingURL=mermaid-parser.core-BDJaQNLh.cjs.map
|