likec4 1.55.0 → 1.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/__app__/chunks/ColorSchemeToggle.mjs +1 -0
  2. package/__app__/chunks/DiagramActorProvider.mjs +10 -0
  3. package/__app__/chunks/Fallback.mjs +1 -0
  4. package/__app__/chunks/Header.mjs +13 -0
  5. package/__app__/chunks/IconRenderer.mjs +1 -0
  6. package/__app__/chunks/LikeC4Diagram.mjs +19 -0
  7. package/__app__/chunks/LikeC4ModelContext.mjs +1 -0
  8. package/__app__/chunks/LikeC4ModelContext2.mjs +1 -0
  9. package/__app__/chunks/LikeC4Styles.mjs +48 -0
  10. package/__app__/chunks/NavigationPanel.mjs +1 -0
  11. package/__app__/chunks/StaticLikeC4Diagram.mjs +1 -0
  12. package/__app__/chunks/ViewReact.mjs +1 -0
  13. package/__app__/chunks/__root.mjs +1 -0
  14. package/__app__/chunks/adhoc-editor.mjs +1 -0
  15. package/__app__/chunks/hooks.mjs +1 -0
  16. package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -0
  17. package/__app__/chunks/libs/@floating-ui/core.mjs +1 -0
  18. package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -0
  19. package/__app__/chunks/libs/@floating-ui/react.mjs +1 -0
  20. package/__app__/chunks/libs/@mantine/core.mjs +41 -0
  21. package/__app__/chunks/libs/@mantine/hooks.mjs +1 -0
  22. package/__app__/chunks/libs/@nanostores/react.mjs +1 -0
  23. package/__app__/chunks/libs/@react-hookz/web.mjs +1 -0
  24. package/__app__/chunks/libs/@tabler/icons-react.mjs +15 -0
  25. package/__app__/chunks/libs/@tanstack/history.mjs +1 -0
  26. package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -0
  27. package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -0
  28. package/__app__/chunks/libs/@xstate/react.mjs +1 -0
  29. package/__app__/chunks/libs/@xstate/store.mjs +1 -0
  30. package/__app__/chunks/libs/@xyflow/react.mjs +7 -0
  31. package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -0
  32. package/__app__/chunks/libs/@zag-js/collection.mjs +1 -0
  33. package/__app__/chunks/libs/@zag-js/core.mjs +1 -0
  34. package/__app__/chunks/libs/@zag-js/react.mjs +1 -0
  35. package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -0
  36. package/__app__/chunks/libs/bezier-js.mjs +1 -0
  37. package/__app__/chunks/libs/d3-path.mjs +1 -0
  38. package/__app__/chunks/libs/d3-shape.mjs +1 -0
  39. package/__app__/chunks/libs/fast-equals.mjs +1 -0
  40. package/__app__/chunks/libs/framer-motion.mjs +9 -0
  41. package/__app__/chunks/libs/html-to-image.mjs +2 -0
  42. package/__app__/chunks/libs/motion-dom.mjs +1 -0
  43. package/__app__/chunks/libs/motion.mjs +1 -0
  44. package/__app__/chunks/libs/nanostores.mjs +1 -0
  45. package/__app__/chunks/libs/react-error-boundary.mjs +1 -0
  46. package/__app__/chunks/libs/react-resizable-panels.mjs +1 -0
  47. package/__app__/chunks/libs/remeda.mjs +1 -0
  48. package/__app__/chunks/libs/xstate.mjs +1 -0
  49. package/__app__/chunks/libs/zod.mjs +39 -0
  50. package/__app__/chunks/rolldown-runtime.mjs +1 -0
  51. package/__app__/chunks/safeCtx.mjs +1 -0
  52. package/__app__/chunks/searchParams.mjs +1 -0
  53. package/__app__/chunks/single-index.mjs +1 -0
  54. package/__app__/chunks/styled-system.mjs +1 -0
  55. package/__app__/chunks/styles.css.mjs +1 -0
  56. package/__app__/chunks/useLikeC4Project.mjs +1 -0
  57. package/__app__/chunks/useUpdateEffect.mjs +1 -0
  58. package/__app__/codegen/react.mjs +11 -0
  59. package/__app__/codegen/webcomponent.mjs +790 -0
  60. package/__app__/src/fonts.css +1 -1
  61. package/__app__/src/main.mjs +1 -0
  62. package/__app__/src/pages/AdHocViewEditor.mjs +1 -0
  63. package/__app__/src/pages/EmbedPage.mjs +1 -0
  64. package/__app__/src/pages/ExportPage.mjs +1 -0
  65. package/__app__/src/pages/ProjectsOverview.mjs +1 -0
  66. package/__app__/src/pages/ViewAsD2.mjs +1 -0
  67. package/__app__/src/pages/ViewAsDot.mjs +1 -0
  68. package/__app__/src/pages/ViewAsMmd.mjs +1 -0
  69. package/__app__/src/pages/ViewAsPuml.mjs +1 -0
  70. package/__app__/src/pages/ViewEditor.mjs +1 -0
  71. package/__app__/src/pages/ViewReact.mjs +1 -0
  72. package/__app__/src/routeTree.gen.mjs +1 -0
  73. package/__app__/src/routes/__root.mjs +1 -0
  74. package/__app__/src/routes/_single/adhoc.mjs +1 -0
  75. package/__app__/src/routes/_single/embed._viewId.mjs +1 -0
  76. package/__app__/src/routes/_single/export._viewId.mjs +1 -0
  77. package/__app__/src/routes/_single/route.mjs +1 -0
  78. package/__app__/src/routes/_single/single-index.mjs +1 -0
  79. package/__app__/src/routes/_single/view._viewId.d2.mjs +1 -0
  80. package/__app__/src/routes/_single/view._viewId.dot.mjs +1 -0
  81. package/__app__/src/routes/_single/view._viewId.index.mjs +1 -0
  82. package/__app__/src/routes/_single/view._viewId.mjs +1 -0
  83. package/__app__/src/routes/_single/view._viewId.mmd.mjs +1 -0
  84. package/__app__/src/routes/_single/view._viewId.puml.mjs +1 -0
  85. package/__app__/src/routes/_single/webcomponent._.mjs +33 -0
  86. package/__app__/src/routes/index.mjs +1 -0
  87. package/__app__/src/routes/project._projectId/-components.mjs +1 -0
  88. package/__app__/src/routes/project._projectId/adhoc.mjs +1 -0
  89. package/__app__/src/routes/project._projectId/embed._viewId.mjs +1 -0
  90. package/__app__/src/routes/project._projectId/export._viewId.mjs +1 -0
  91. package/__app__/src/routes/project._projectId/index.mjs +1 -0
  92. package/__app__/src/routes/project._projectId/route.mjs +1 -0
  93. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +1 -0
  94. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +1 -0
  95. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +1 -0
  96. package/__app__/src/routes/project._projectId/view._viewId.mjs +1 -0
  97. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +1 -0
  98. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +1 -0
  99. package/__app__/src/routes/projects.mjs +1 -0
  100. package/__app__/src/style.css +1 -1
  101. package/dist/chunks/filenames.mjs +17 -0
  102. package/dist/{_chunks → chunks}/index.d.mts +2 -1
  103. package/dist/{_chunks → chunks}/index2.d.mts +71 -12
  104. package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
  105. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
  106. package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
  107. package/dist/chunks/libs/@hono/mcp.mjs +45 -0
  108. package/dist/chunks/libs/@hono/node-server.mjs +1 -0
  109. package/dist/{_chunks → chunks}/libs/@logtape/logtape.d.mts +2 -0
  110. package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
  111. package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
  112. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
  113. package/dist/chunks/libs/ajv.mjs +1 -0
  114. package/dist/chunks/libs/ansi-align.mjs +2 -0
  115. package/dist/chunks/libs/ansi-regex.mjs +1 -0
  116. package/dist/chunks/libs/ansi-styles.mjs +1 -0
  117. package/dist/chunks/libs/atomically.mjs +1 -0
  118. package/dist/chunks/libs/birpc.mjs +1 -0
  119. package/dist/chunks/libs/boxen.mjs +22 -0
  120. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
  121. package/dist/chunks/libs/chevrotain.mjs +58 -0
  122. package/dist/chunks/libs/conf.mjs +1 -0
  123. package/dist/chunks/libs/defu.mjs +1 -0
  124. package/dist/chunks/libs/destr.mjs +1 -0
  125. package/dist/chunks/libs/eventemitter3.mjs +1 -0
  126. package/dist/chunks/libs/find-up-simple.mjs +1 -0
  127. package/dist/chunks/libs/get-port.mjs +1 -0
  128. package/dist/chunks/libs/hono.mjs +1 -0
  129. package/dist/chunks/libs/is-docker.mjs +1 -0
  130. package/dist/chunks/libs/is-error-instance.mjs +1 -0
  131. package/dist/chunks/libs/is-inside-container.mjs +1 -0
  132. package/dist/chunks/libs/is-plain-obj.mjs +1 -0
  133. package/dist/chunks/libs/isexe.mjs +1 -0
  134. package/dist/chunks/libs/json5.mjs +14 -0
  135. package/dist/chunks/libs/khroma.mjs +1 -0
  136. package/dist/chunks/libs/ky.mjs +3 -0
  137. package/dist/{_chunks → chunks}/libs/langium.d.mts +4 -4
  138. package/dist/chunks/libs/langium.mjs +32 -0
  139. package/dist/chunks/libs/merge-error-cause.mjs +2 -0
  140. package/dist/chunks/libs/p-debounce.mjs +1 -0
  141. package/dist/chunks/libs/p-limit.mjs +1 -0
  142. package/dist/chunks/libs/p-queue.mjs +1 -0
  143. package/dist/chunks/libs/p-timeout.mjs +1 -0
  144. package/dist/chunks/libs/package-manager-detector.mjs +1 -0
  145. package/dist/chunks/libs/package-up.mjs +1 -0
  146. package/dist/chunks/libs/pako.mjs +1 -0
  147. package/dist/chunks/libs/parse-ms.mjs +1 -0
  148. package/dist/chunks/libs/pathe.mjs +1 -0
  149. package/dist/chunks/libs/picomatch.mjs +1 -0
  150. package/dist/chunks/libs/pretty-ms.mjs +1 -0
  151. package/dist/chunks/libs/remeda.mjs +1 -0
  152. package/dist/chunks/libs/safe-stringify.mjs +1 -0
  153. package/dist/chunks/libs/strip-indent.mjs +1 -0
  154. package/dist/chunks/libs/tinyrainbow.mjs +1 -0
  155. package/dist/{_chunks → chunks}/libs/ts-graphviz.d.mts +2 -0
  156. package/dist/chunks/libs/ts-graphviz.mjs +4 -0
  157. package/dist/chunks/libs/ufo.mjs +1 -0
  158. package/dist/chunks/libs/unstorage.mjs +1 -0
  159. package/dist/chunks/libs/which.mjs +1 -0
  160. package/dist/chunks/libs/word-wrap.mjs +12 -0
  161. package/dist/{_chunks → chunks}/libs/zod.d.mts +2 -0
  162. package/dist/chunks/node.mjs +76 -0
  163. package/dist/chunks/plugin.mjs +400 -0
  164. package/dist/chunks/rolldown-runtime.mjs +1 -0
  165. package/dist/chunks/sequence-view.mjs +1 -0
  166. package/dist/cli/index.mjs +262 -123
  167. package/dist/config/index.d.mts +1 -2
  168. package/dist/config/index.mjs +1 -1
  169. package/dist/index.d.mts +4 -8
  170. package/dist/index.mjs +1 -1
  171. package/dist/model/index.d.mts +2 -1
  172. package/dist/model/index.mjs +1 -1
  173. package/dist/vite-plugin/index.d.mts +38 -8
  174. package/dist/vite-plugin/index.mjs +1 -1
  175. package/dist/{_chunks → vite-plugin/internal/chunks}/libs/@nanostores/react.d.mts +2 -56
  176. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +1 -0
  177. package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +1 -0
  178. package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +1 -0
  179. package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +59 -0
  180. package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +1 -0
  181. package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +1 -0
  182. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -0
  183. package/dist/vite-plugin/{internal.d.mts → internal/index.d.mts} +12 -3
  184. package/dist/vite-plugin/internal/index.mjs +1 -0
  185. package/package.json +37 -57
  186. package/react/index.d.mts +2 -28
  187. package/react/index.mjs +50520 -53827
  188. package/vite-plugin/internal/package.json +2 -2
  189. package/vite-plugin-modules.d.ts +14 -0
  190. package/__app__/react/likec4.tsx +0 -25
  191. package/__app__/src/ProjectsOverview.js +0 -16
  192. package/__app__/src/const.js +0 -19
  193. package/__app__/src/likec4.js +0 -21225
  194. package/__app__/src/main.js +0 -7
  195. package/__app__/src/routes/index.js +0 -324
  196. package/__app__/src/routes/projects.js +0 -189
  197. package/__app__/src/routes/single.js +0 -1924
  198. package/__app__/src/vendors.js +0 -52672
  199. package/__app__/src/webcomponent.js +0 -68
  200. package/dist/THIRD-PARTY-LICENSES.md +0 -1609
  201. package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
  202. package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
  203. package/dist/_chunks/libs/@chevrotain/types.d.mts +0 -1
  204. package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
  205. package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
  206. package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
  207. package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
  208. package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
  209. package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
  210. package/dist/_chunks/libs/@nanostores/react.mjs +0 -1
  211. package/dist/_chunks/libs/ajv.mjs +0 -1
  212. package/dist/_chunks/libs/ansi-align.mjs +0 -2
  213. package/dist/_chunks/libs/ansi-regex.mjs +0 -1
  214. package/dist/_chunks/libs/ansi-styles.mjs +0 -1
  215. package/dist/_chunks/libs/atomically.mjs +0 -1
  216. package/dist/_chunks/libs/birpc.mjs +0 -1
  217. package/dist/_chunks/libs/boxen.mjs +0 -22
  218. package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
  219. package/dist/_chunks/libs/chevrotain.mjs +0 -58
  220. package/dist/_chunks/libs/conf.mjs +0 -1
  221. package/dist/_chunks/libs/defu.mjs +0 -1
  222. package/dist/_chunks/libs/destr.mjs +0 -1
  223. package/dist/_chunks/libs/esm-env.mjs +0 -1
  224. package/dist/_chunks/libs/eventemitter3.mjs +0 -1
  225. package/dist/_chunks/libs/fast-equals.mjs +0 -1
  226. package/dist/_chunks/libs/find-up-simple.mjs +0 -1
  227. package/dist/_chunks/libs/get-port.mjs +0 -1
  228. package/dist/_chunks/libs/is-docker.mjs +0 -1
  229. package/dist/_chunks/libs/is-error-instance.mjs +0 -1
  230. package/dist/_chunks/libs/is-inside-container.mjs +0 -1
  231. package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
  232. package/dist/_chunks/libs/isexe.mjs +0 -1
  233. package/dist/_chunks/libs/json5.mjs +0 -14
  234. package/dist/_chunks/libs/khroma.mjs +0 -1
  235. package/dist/_chunks/libs/ky.mjs +0 -3
  236. package/dist/_chunks/libs/langium.mjs +0 -33
  237. package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
  238. package/dist/_chunks/libs/p-limit.mjs +0 -1
  239. package/dist/_chunks/libs/p-queue.mjs +0 -1
  240. package/dist/_chunks/libs/p-timeout.mjs +0 -1
  241. package/dist/_chunks/libs/package-manager-detector.mjs +0 -1
  242. package/dist/_chunks/libs/package-up.mjs +0 -1
  243. package/dist/_chunks/libs/pako.mjs +0 -1
  244. package/dist/_chunks/libs/parse-ms.mjs +0 -1
  245. package/dist/_chunks/libs/pathe.mjs +0 -1
  246. package/dist/_chunks/libs/picomatch.mjs +0 -1
  247. package/dist/_chunks/libs/pretty-ms.mjs +0 -1
  248. package/dist/_chunks/libs/remeda.mjs +0 -2
  249. package/dist/_chunks/libs/safe-stringify.mjs +0 -1
  250. package/dist/_chunks/libs/strip-indent.mjs +0 -1
  251. package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
  252. package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
  253. package/dist/_chunks/libs/ufo.mjs +0 -1
  254. package/dist/_chunks/libs/unstorage.mjs +0 -1
  255. package/dist/_chunks/libs/which.mjs +0 -1
  256. package/dist/_chunks/libs/word-wrap.mjs +0 -12
  257. package/dist/_chunks/node.mjs +0 -76
  258. package/dist/_chunks/rolldown-runtime.mjs +0 -1
  259. package/dist/_chunks/sequence.mjs +0 -1
  260. package/dist/_chunks/src.mjs +0 -17
  261. package/dist/_chunks/src2.mjs +0 -499
  262. package/dist/vite-plugin/internal.mjs +0 -1
  263. /package/dist/{_chunks → chunks}/libs/vscode-languageserver.mjs +0 -0
@@ -0,0 +1,32 @@
1
+ import{a as t,c as n,i,n as o,o as s,r as c,s as u,t as f}from"../rolldown-runtime.mjs";import{n as p,t as h}from"./@chevrotain/regexp-to-ast.mjs";import{a as g,l as _,n as x,o as S,r as T,t as E,u as D}from"./chevrotain.mjs";import{t as ee}from"./chevrotain-allstar.mjs";import*as O from"node:fs";function isAstNode(t){return typeof t==`object`&&!!t&&typeof t.$type==`string`}function isReference(t){return typeof t==`object`&&!!t&&typeof t.$refText==`string`}function isAstNodeDescription(t){return typeof t==`object`&&!!t&&typeof t.name==`string`&&typeof t.type==`string`&&typeof t.path==`string`}function isLinkingError(t){return typeof t==`object`&&!!t&&isAstNode(t.container)&&isReference(t.reference)&&typeof t.message==`string`}var AbstractAstReflection=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(t,n){return isAstNode(t)&&this.isSubtype(t.$type,n)}isSubtype(t,n){if(t===n)return!0;let i=this.subtypes[t];i||=this.subtypes[t]={};let o=i[n];if(o!==void 0)return o;{let o=this.computeIsSubtype(t,n);return i[n]=o,o}}getAllSubTypes(t){let n=this.allSubtypes[t];if(n)return n;{let n=this.getAllTypes(),i=[];for(let o of n)this.isSubtype(o,t)&&i.push(o);return this.allSubtypes[t]=i,i}}};function isCompositeCstNode(t){return typeof t==`object`&&!!t&&Array.isArray(t.content)}function isLeafCstNode(t){return typeof t==`object`&&!!t&&typeof t.tokenType==`object`}function isRootCstNode(t){return isCompositeCstNode(t)&&typeof t.fullText==`string`}var k=class StreamImpl{constructor(t,n){this.startFn=t,this.nextFn=n}iterator(){let t={state:this.startFn(),next:()=>this.nextFn(t.state),[Symbol.iterator]:()=>t};return t}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let t=this.iterator(),n=0,i=t.next();for(;!i.done;)n++,i=t.next();return n}toArray(){let t=[],n=this.iterator(),i;do i=n.next(),i.value!==void 0&&t.push(i.value);while(!i.done);return t}toSet(){return new Set(this)}toMap(t,n){let i=this.map(i=>[t?t(i):i,n?n(i):i]);return new Map(i)}toString(){return this.join()}concat(t){return new StreamImpl(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),t=>{let n;if(!t.firstDone){do if(n=this.nextFn(t.first),!n.done)return n;while(!n.done);t.firstDone=!0}do if(n=t.iterator.next(),!n.done)return n;while(!n.done);return j})}join(t=`,`){let n=this.iterator(),i=``,o,s=!1;do o=n.next(),o.done||(s&&(i+=t),i+=toString$1(o.value)),s=!0;while(!o.done);return i}indexOf(t,n=0){let i=this.iterator(),o=0,s=i.next();for(;!s.done;){if(o>=n&&s.value===t)return o;s=i.next(),o++}return-1}every(t){let n=this.iterator(),i=n.next();for(;!i.done;){if(!t(i.value))return!1;i=n.next()}return!0}some(t){let n=this.iterator(),i=n.next();for(;!i.done;){if(t(i.value))return!0;i=n.next()}return!1}forEach(t){let n=this.iterator(),i=0,o=n.next();for(;!o.done;)t(o.value,i),o=n.next(),i++}map(t){return new StreamImpl(this.startFn,n=>{let{done:i,value:o}=this.nextFn(n);return i?j:{done:!1,value:t(o)}})}filter(t){return new StreamImpl(this.startFn,n=>{let i;do if(i=this.nextFn(n),!i.done&&t(i.value))return i;while(!i.done);return j})}nonNullable(){return this.filter(t=>t!=null)}reduce(t,n){let i=this.iterator(),o=n,s=i.next();for(;!s.done;)o=o===void 0?s.value:t(o,s.value),s=i.next();return o}reduceRight(t,n){return this.recursiveReduce(this.iterator(),t,n)}recursiveReduce(t,n,i){let o=t.next();if(o.done)return i;let s=this.recursiveReduce(t,n,i);return s===void 0?o.value:n(s,o.value)}find(t){let n=this.iterator(),i=n.next();for(;!i.done;){if(t(i.value))return i.value;i=n.next()}}findIndex(t){let n=this.iterator(),i=0,o=n.next();for(;!o.done;){if(t(o.value))return i;o=n.next(),i++}return-1}includes(t){let n=this.iterator(),i=n.next();for(;!i.done;){if(i.value===t)return!0;i=n.next()}return!1}flatMap(t){return new StreamImpl(()=>({this:this.startFn()}),n=>{do{if(n.iterator){let t=n.iterator.next();if(t.done)n.iterator=void 0;else return t}let{done:i,value:o}=this.nextFn(n.this);if(!i){let i=t(o);if(isIterable(i))n.iterator=i[Symbol.iterator]();else return{done:!1,value:i}}}while(n.iterator);return j})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let n=t>1?this.flat(t-1):this;return new StreamImpl(()=>({this:n.startFn()}),t=>{do{if(t.iterator){let n=t.iterator.next();if(n.done)t.iterator=void 0;else return n}let{done:i,value:o}=n.nextFn(t.this);if(!i)if(isIterable(o))t.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(t.iterator);return j})}head(){let t=this.iterator().next();if(!t.done)return t.value}tail(t=1){return new StreamImpl(()=>{let n=this.startFn();for(let i=0;i<t;i++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(t){return new StreamImpl(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>t?j:this.nextFn(n.state)))}distinct(t){return new StreamImpl(()=>({set:new Set,internalState:this.startFn()}),n=>{let i;do if(i=this.nextFn(n.internalState),!i.done){let o=t?t(i.value):i.value;if(!n.set.has(o))return n.set.add(o),i}while(!i.done);return j})}exclude(t,n){let i=new Set;for(let o of t){let t=n?n(o):o;i.add(t)}return this.filter(t=>{let o=n?n(t):t;return!i.has(o)})}};function toString$1(t){return typeof t==`string`?t:t===void 0?`undefined`:typeof t.toString==`function`?t.toString():Object.prototype.toString.call(t)}i(toString$1,`toString`);function isIterable(t){return!!t&&typeof t[Symbol.iterator]==`function`}const A=new k(()=>void 0,()=>j),j=Object.freeze({done:!0,value:void 0});function stream(...t){if(t.length===1){let n=t[0];if(n instanceof k)return n;if(isIterable(n))return new k(()=>n[Symbol.iterator](),t=>t.next());if(typeof n.length==`number`)return new k(()=>({index:0}),t=>t.index<n.length?{done:!1,value:n[t.index++]}:j)}return t.length>1?new k(()=>({collIndex:0,arrIndex:0}),n=>{do{if(n.iterator){let t=n.iterator.next();if(!t.done)return t;n.iterator=void 0}if(n.array){if(n.arrIndex<n.array.length)return{done:!1,value:n.array[n.arrIndex++]};n.array=void 0,n.arrIndex=0}if(n.collIndex<t.length){let i=t[n.collIndex++];isIterable(i)?n.iterator=i[Symbol.iterator]():i&&typeof i.length==`number`&&(n.array=i)}}while(n.iterator||n.array||n.collIndex<t.length);return j}):A}var TreeStreamImpl=class extends k{constructor(t,n,i){super(()=>({iterators:i?.includeRoot?[[t][Symbol.iterator]()]:[n(t)[Symbol.iterator]()],pruned:!1}),t=>{for(t.pruned&&=(t.iterators.pop(),!1);t.iterators.length>0;){let i=t.iterators[t.iterators.length-1].next();if(i.done)t.iterators.pop();else return t.iterators.push(n(i.value)[Symbol.iterator]()),i}return j})}iterator(){let t={state:this.startFn(),next:()=>this.nextFn(t.state),prune:()=>{t.state.pruned=!0},[Symbol.iterator]:()=>t};return t}},M;(function(t){function sum(t){return t.reduce((t,n)=>t+n,0)}t.sum=sum;function product(t){return t.reduce((t,n)=>t*n,0)}t.product=product;function min(t){return t.reduce((t,n)=>Math.min(t,n))}t.min=min;function max(t){return t.reduce((t,n)=>Math.max(t,n))}t.max=max})(M||={});function streamCst(t){return new TreeStreamImpl(t,t=>isCompositeCstNode(t)?t.content:[],{includeRoot:!0})}function flattenCst(t){return streamCst(t).filter(isLeafCstNode)}function isChildNode(t,n){for(;t.container;)if(t=t.container,t===n)return!0;return!1}function tokenToRange(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function toDocumentSegment(t){if(!t)return;let{offset:n,end:i,range:o}=t;return{range:o,offset:n,end:i,length:i-n}}var N;(function(t){t[t.Before=0]=`Before`,t[t.After=1]=`After`,t[t.OverlapFront=2]=`OverlapFront`,t[t.OverlapBack=3]=`OverlapBack`,t[t.Inside=4]=`Inside`,t[t.Outside=5]=`Outside`})(N||={});function compareRange(t,n){if(t.end.line<n.start.line||t.end.line===n.start.line&&t.end.character<=n.start.character)return N.Before;if(t.start.line>n.end.line||t.start.line===n.end.line&&t.start.character>=n.end.character)return N.After;let i=t.start.line>n.start.line||t.start.line===n.start.line&&t.start.character>=n.start.character,o=t.end.line<n.end.line||t.end.line===n.end.line&&t.end.character<=n.end.character;return i&&o?N.Inside:i?N.OverlapBack:o?N.OverlapFront:N.Outside}function inRange(t,n){return compareRange(t,n)>N.After}const P=/^[\w\p{L}]$/u;function findDeclarationNodeAtOffset(t,n,i=P){if(t){if(n>0){let o=n-t.offset,s=t.text.charAt(o);i.test(s)||n--}return findLeafNodeAtOffset(t,n)}}function findCommentNode(t,n){if(t){let i=getPreviousNode(t,!0);if(i&&isCommentNode(i,n))return i;if(isRootCstNode(t)){let i=t.content.findIndex(t=>!t.hidden);for(let o=i-1;o>=0;o--){let i=t.content[o];if(isCommentNode(i,n))return i}}}}function isCommentNode(t,n){return isLeafCstNode(t)&&n.includes(t.tokenType.name)}function findLeafNodeAtOffset(t,n){if(isLeafCstNode(t))return t;if(isCompositeCstNode(t)){let i=binarySearch(t,n,!1);if(i)return findLeafNodeAtOffset(i,n)}}function findLeafNodeBeforeOffset(t,n){if(isLeafCstNode(t))return t;if(isCompositeCstNode(t)){let i=binarySearch(t,n,!0);if(i)return findLeafNodeBeforeOffset(i,n)}}function binarySearch(t,n,i){let o=0,s=t.content.length-1,c;for(;o<=s;){let u=Math.floor((o+s)/2),f=t.content[u];if(f.offset<=n&&f.end>n)return f;f.end<=n?(c=i?f:void 0,o=u+1):s=u-1}return c}function getPreviousNode(t,n=!0){for(;t.container;){let i=t.container,o=i.content.indexOf(t);for(;o>0;){o--;let t=i.content[o];if(n||!t.hidden)return t}t=i}}function getNextNode(t,n=!0){for(;t.container;){let i=t.container,o=i.content.indexOf(t),s=i.content.length-1;for(;o<s;){o++;let t=i.content[o];if(n||!t.hidden)return t}t=i}}function getInteriorNodes(t,n){let i=getCommonParent(t,n);return i?i.parent.content.slice(i.a+1,i.b):[]}function getCommonParent(t,n){let i=getParentChain(t),o=getParentChain(n),s;for(let t=0;t<i.length&&t<o.length;t++){let n=i[t],c=o[t];if(n.parent===c.parent)s={parent:n.parent,a:n.index,b:c.index};else break}return s}function getParentChain(t){let n=[];for(;t.container;){let i=t.container,o=i.content.indexOf(t);n.push({parent:i,index:o}),t=i}return n.reverse()}var ErrorWithLocation=class extends Error{constructor(t,n){super(t?`${n} at ${t.range.start.line}:${t.range.start.character}`:n)}};function assertUnreachable(t){throw Error(`Error! The input value was not handled.`)}const te=`AbstractRule`,F=`AbstractType`,ne=`Condition`,re=`TypeDefinition`,ie=`ValueLiteral`,ae=`AbstractElement`;function isAbstractElement(t){return H.isInstance(t,ae)}const oe=`ArrayLiteral`,se=`ArrayType`;function isArrayType(t){return H.isInstance(t,se)}const ce=`BooleanLiteral`;function isBooleanLiteral(t){return H.isInstance(t,ce)}const le=`Conjunction`;function isConjunction(t){return H.isInstance(t,le)}const I=`Disjunction`;function isDisjunction(t){return H.isInstance(t,I)}const L=`Grammar`,ue=`GrammarImport`,R=`InferredType`;function isInferredType(t){return H.isInstance(t,R)}const z=`Interface`;function isInterface(t){return H.isInstance(t,z)}const de=`NamedArgument`,B=`Negation`;function isNegation(t){return H.isInstance(t,B)}const fe=`NumberLiteral`,pe=`Parameter`,me=`ParameterReference`;function isParameterReference(t){return H.isInstance(t,me)}const he=`ParserRule`;function isParserRule(t){return H.isInstance(t,he)}const ge=`ReferenceType`;function isReferenceType(t){return H.isInstance(t,ge)}const _e=`ReturnType`;function isReturnType(t){return H.isInstance(t,_e)}const V=`SimpleType`;function isSimpleType(t){return H.isInstance(t,V)}const ve=`StringLiteral`,ye=`TerminalRule`;function isTerminalRule(t){return H.isInstance(t,ye)}const be=`Type`;function isType(t){return H.isInstance(t,be)}const xe=`TypeAttribute`,Se=`UnionType`;function isUnionType(t){return H.isInstance(t,Se)}const Ce=`Action`;function isAction(t){return H.isInstance(t,Ce)}const we=`Alternatives`;function isAlternatives(t){return H.isInstance(t,we)}const Te=`Assignment`;function isAssignment(t){return H.isInstance(t,Te)}const Ee=`CharacterRange`;function isCharacterRange(t){return H.isInstance(t,Ee)}const De=`CrossReference`;function isCrossReference(t){return H.isInstance(t,De)}const Oe=`EndOfFile`;function isEndOfFile(t){return H.isInstance(t,Oe)}const ke=`Group`;function isGroup(t){return H.isInstance(t,ke)}const Ae=`Keyword`;function isKeyword(t){return H.isInstance(t,Ae)}const je=`NegatedToken`;function isNegatedToken(t){return H.isInstance(t,je)}const Me=`RegexToken`;function isRegexToken(t){return H.isInstance(t,Me)}const Ne=`RuleCall`;function isRuleCall(t){return H.isInstance(t,Ne)}const Pe=`TerminalAlternatives`;function isTerminalAlternatives(t){return H.isInstance(t,Pe)}const Fe=`TerminalGroup`;function isTerminalGroup(t){return H.isInstance(t,Fe)}const Ie=`TerminalRuleCall`;function isTerminalRuleCall(t){return H.isInstance(t,Ie)}const Le=`UnorderedGroup`;function isUnorderedGroup(t){return H.isInstance(t,Le)}const Re=`UntilToken`;function isUntilToken(t){return H.isInstance(t,Re)}const ze=`Wildcard`;function isWildcard(t){return H.isInstance(t,ze)}var LangiumGrammarAstReflection=class extends AbstractAstReflection{getAllTypes(){return[ae,te,F,Ce,we,oe,se,Te,ce,Ee,ne,le,De,I,Oe,L,ue,ke,R,z,Ae,de,je,B,fe,pe,me,he,ge,Me,_e,Ne,V,ve,Pe,Fe,ye,Ie,be,xe,re,Se,Le,Re,ie,ze]}computeIsSubtype(t,n){switch(t){case Ce:case we:case Te:case Ee:case De:case Oe:case ke:case Ae:case je:case Me:case Ne:case Pe:case Fe:case Ie:case Le:case Re:case ze:return this.isSubtype(ae,n);case oe:case fe:case ve:return this.isSubtype(ie,n);case se:case ge:case V:case Se:return this.isSubtype(re,n);case ce:return this.isSubtype(`Condition`,n)||this.isSubtype(`ValueLiteral`,n);case le:case I:case B:case me:return this.isSubtype(ne,n);case R:case z:case be:return this.isSubtype(F,n);case he:return this.isSubtype(`AbstractRule`,n)||this.isSubtype(`AbstractType`,n);case ye:return this.isSubtype(te,n);default:return!1}}getReferenceType(t){let n=`${t.container.$type}:${t.property}`;switch(n){case`Action:type`:case`CrossReference:type`:case`Interface:superTypes`:case`ParserRule:returnType`:case`SimpleType:typeRef`:return F;case`Grammar:hiddenTokens`:case`ParserRule:hiddenTokens`:case`RuleCall:rule`:return te;case`Grammar:usedGrammars`:return L;case`NamedArgument:parameter`:case`ParameterReference:parameter`:return pe;case`TerminalRuleCall:rule`:return ye;default:throw Error(`${n} is not a valid reference id.`)}}getTypeMetaData(t){switch(t){case ae:return{name:ae,properties:[{name:`cardinality`},{name:`lookahead`}]};case oe:return{name:oe,properties:[{name:`elements`,defaultValue:[]}]};case se:return{name:se,properties:[{name:`elementType`}]};case ce:return{name:ce,properties:[{name:`true`,defaultValue:!1}]};case le:return{name:le,properties:[{name:`left`},{name:`right`}]};case I:return{name:I,properties:[{name:`left`},{name:`right`}]};case L:return{name:L,properties:[{name:`definesHiddenTokens`,defaultValue:!1},{name:`hiddenTokens`,defaultValue:[]},{name:`imports`,defaultValue:[]},{name:`interfaces`,defaultValue:[]},{name:`isDeclared`,defaultValue:!1},{name:`name`},{name:`rules`,defaultValue:[]},{name:`types`,defaultValue:[]},{name:`usedGrammars`,defaultValue:[]}]};case ue:return{name:ue,properties:[{name:`path`}]};case R:return{name:R,properties:[{name:`name`}]};case z:return{name:z,properties:[{name:`attributes`,defaultValue:[]},{name:`name`},{name:`superTypes`,defaultValue:[]}]};case de:return{name:de,properties:[{name:`calledByName`,defaultValue:!1},{name:`parameter`},{name:`value`}]};case B:return{name:B,properties:[{name:`value`}]};case fe:return{name:fe,properties:[{name:`value`}]};case pe:return{name:pe,properties:[{name:`name`}]};case me:return{name:me,properties:[{name:`parameter`}]};case he:return{name:he,properties:[{name:`dataType`},{name:`definesHiddenTokens`,defaultValue:!1},{name:`definition`},{name:`entry`,defaultValue:!1},{name:`fragment`,defaultValue:!1},{name:`hiddenTokens`,defaultValue:[]},{name:`inferredType`},{name:`name`},{name:`parameters`,defaultValue:[]},{name:`returnType`},{name:`wildcard`,defaultValue:!1}]};case ge:return{name:ge,properties:[{name:`referenceType`}]};case _e:return{name:_e,properties:[{name:`name`}]};case V:return{name:V,properties:[{name:`primitiveType`},{name:`stringType`},{name:`typeRef`}]};case ve:return{name:ve,properties:[{name:`value`}]};case ye:return{name:ye,properties:[{name:`definition`},{name:`fragment`,defaultValue:!1},{name:`hidden`,defaultValue:!1},{name:`name`},{name:`type`}]};case be:return{name:be,properties:[{name:`name`},{name:`type`}]};case xe:return{name:xe,properties:[{name:`defaultValue`},{name:`isOptional`,defaultValue:!1},{name:`name`},{name:`type`}]};case Se:return{name:Se,properties:[{name:`types`,defaultValue:[]}]};case Ce:return{name:Ce,properties:[{name:`cardinality`},{name:`feature`},{name:`inferredType`},{name:`lookahead`},{name:`operator`},{name:`type`}]};case we:return{name:we,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Te:return{name:Te,properties:[{name:`cardinality`},{name:`feature`},{name:`lookahead`},{name:`operator`},{name:`terminal`}]};case Ee:return{name:Ee,properties:[{name:`cardinality`},{name:`left`},{name:`lookahead`},{name:`right`}]};case De:return{name:De,properties:[{name:`cardinality`},{name:`deprecatedSyntax`,defaultValue:!1},{name:`lookahead`},{name:`terminal`},{name:`type`}]};case Oe:return{name:Oe,properties:[{name:`cardinality`},{name:`lookahead`}]};case ke:return{name:ke,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`guardCondition`},{name:`lookahead`}]};case Ae:return{name:Ae,properties:[{name:`cardinality`},{name:`lookahead`},{name:`value`}]};case je:return{name:je,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case Me:return{name:Me,properties:[{name:`cardinality`},{name:`lookahead`},{name:`regex`}]};case Ne:return{name:Ne,properties:[{name:`arguments`,defaultValue:[]},{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case Pe:return{name:Pe,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Fe:return{name:Fe,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Ie:return{name:Ie,properties:[{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case Le:return{name:Le,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Re:return{name:Re,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case ze:return{name:ze,properties:[{name:`cardinality`},{name:`lookahead`}]};default:return{name:t,properties:[]}}}};const H=new LangiumGrammarAstReflection;var Be=c({assignMandatoryProperties:()=>assignMandatoryProperties,copyAstNode:()=>copyAstNode,findLocalReferences:()=>findLocalReferences,findRootNode:()=>findRootNode,getContainerOfType:()=>getContainerOfType,getDocument:()=>getDocument,hasContainerOfType:()=>hasContainerOfType,linkContentToContainer:()=>linkContentToContainer,streamAllContents:()=>streamAllContents,streamAst:()=>streamAst,streamContents:()=>streamContents,streamReferences:()=>streamReferences});function linkContentToContainer(t){for(let[n,i]of Object.entries(t))n.startsWith(`$`)||(Array.isArray(i)?i.forEach((i,o)=>{isAstNode(i)&&(i.$container=t,i.$containerProperty=n,i.$containerIndex=o)}):isAstNode(i)&&(i.$container=t,i.$containerProperty=n))}function getContainerOfType(t,n){let i=t;for(;i;){if(n(i))return i;i=i.$container}}function hasContainerOfType(t,n){let i=t;for(;i;){if(n(i))return!0;i=i.$container}return!1}function getDocument(t){let n=findRootNode(t).$document;if(!n)throw Error(`AST node has no document.`);return n}function findRootNode(t){for(;t.$container;)t=t.$container;return t}function streamContents(t,n){if(!t)throw Error(`Node must be an AstNode.`);let i=n?.range;return new k(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndex<n.keys.length;){let o=n.keys[n.keyIndex];if(!o.startsWith(`$`)){let s=t[o];if(isAstNode(s)){if(n.keyIndex++,isAstNodeInRange(s,i))return{done:!1,value:s}}else if(Array.isArray(s)){for(;n.arrayIndex<s.length;){let t=s[n.arrayIndex++];if(isAstNode(t)&&isAstNodeInRange(t,i))return{done:!1,value:t}}n.arrayIndex=0}}n.keyIndex++}return j})}function streamAllContents(t,n){if(!t)throw Error(`Root node must be an AstNode.`);return new TreeStreamImpl(t,t=>streamContents(t,n))}function streamAst(t,n){if(!t)throw Error(`Root node must be an AstNode.`);return n?.range&&!isAstNodeInRange(t,n.range)?new TreeStreamImpl(t,()=>[]):new TreeStreamImpl(t,t=>streamContents(t,n),{includeRoot:!0})}function isAstNodeInRange(t,n){if(!n)return!0;let i=t.$cstNode?.range;return i?inRange(i,n):!1}function streamReferences(t){return new k(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndex<n.keys.length;){let i=n.keys[n.keyIndex];if(!i.startsWith(`$`)){let o=t[i];if(isReference(o))return n.keyIndex++,{done:!1,value:{reference:o,container:t,property:i}};if(Array.isArray(o)){for(;n.arrayIndex<o.length;){let s=n.arrayIndex++,c=o[s];if(isReference(c))return{done:!1,value:{reference:c,container:t,property:i,index:s}}}n.arrayIndex=0}}n.keyIndex++}return j})}function findLocalReferences(t,n=getDocument(t).parseResult.value){let i=[];return streamAst(n).forEach(n=>{streamReferences(n).forEach(n=>{n.reference.ref===t&&i.push(n.reference)})}),stream(i)}function assignMandatoryProperties(t,n){let i=t.getTypeMetaData(n.$type),o=n;for(let t of i.properties)t.defaultValue!==void 0&&o[t.name]===void 0&&(o[t.name]=copyDefaultValue(t.defaultValue))}function copyDefaultValue(t){return Array.isArray(t)?[...t.map(copyDefaultValue)]:t}function copyAstNode(t,n){let i={$type:t.$type};for(let[o,s]of Object.entries(t))if(!o.startsWith(`$`))if(isAstNode(s))i[o]=copyAstNode(s,n);else if(isReference(s))i[o]=n(i,o,s.$refNode,s.$refText);else if(Array.isArray(s)){let t=[];for(let c of s)isAstNode(c)?t.push(copyAstNode(c,n)):isReference(c)?t.push(n(i,o,c.$refNode,c.$refText)):t.push(c);i[o]=t}else i[o]=s;return linkContentToContainer(i),i}const Ve=/\r?\n/gm,He=new p;var TerminalRegExpVisitor=class extends h{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join(``)}reset(t){this.multiline=!1,this.regex=t,this.startRegexp=``,this.isStarting=!0,this.endRegexpStack=[]}visitGroup(t){t.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(t){let n=String.fromCharCode(t.value);if(!this.multiline&&n===`
2
+ `&&(this.multiline=!0),t.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=escapeRegExp(n);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitSet(t){if(!this.multiline){let n=this.regex.substring(t.loc.begin,t.loc.end),i=new RegExp(n);this.multiline=!!`
3
+ `.match(i)}if(t.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let n=this.regex.substring(t.loc.begin,t.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(t){t.type===`Group`&&t.quantifier||super.visitChildren(t)}};const Ue=new TerminalRegExpVisitor;function isMultilineComment(t){try{return typeof t==`string`&&(t=new RegExp(t)),t=t.toString(),Ue.reset(t),Ue.visit(He.pattern(t)),Ue.multiline}catch{return!1}}const We=`\f
4
+ \r \v \xA0            \u2028\u2029   `.split(``);function isWhitespace(t){let n=typeof t==`string`?new RegExp(t):t;return We.some(t=>n.test(t))}function escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function partialMatches(t,n){let i=partialRegExp(t),o=n.match(i);return!!o&&o[0].length>0}function partialRegExp(t){typeof t==`string`&&(t=new RegExp(t));let n=t,i=t.source,o=0;function process(){let t=``,s;function appendRaw(n){t+=i.substr(o,n),o+=n}function appendOptional(n){t+=`(?:`+i.substr(o,n)+`|$)`,o+=n}for(;o<i.length;)switch(i[o]){case`\\`:switch(i[o+1]){case`c`:appendOptional(3);break;case`x`:appendOptional(4);break;case`u`:n.unicode?i[o+2]===`{`?appendOptional(i.indexOf(`}`,o)-o+1):appendOptional(6):appendOptional(2);break;case`p`:case`P`:n.unicode?appendOptional(i.indexOf(`}`,o)-o+1):appendOptional(2);break;case`k`:appendOptional(i.indexOf(`>`,o)-o+1);break;default:appendOptional(2);break}break;case`[`:s=/\[(?:\\.|.)*?\]/g,s.lastIndex=o,s=s.exec(i)||[],appendOptional(s[0].length);break;case`|`:case`^`:case`$`:case`*`:case`+`:case`?`:appendRaw(1);break;case`{`:s=/\{\d+,?\d*\}/g,s.lastIndex=o,s=s.exec(i),s?appendRaw(s[0].length):appendOptional(1);break;case`(`:if(i[o+1]===`?`)switch(i[o+2]){case`:`:t+=`(?:`,o+=3,t+=process()+`|$)`;break;case`=`:t+=`(?=`,o+=3,t+=process()+`)`;break;case`!`:s=o,o+=3,process(),t+=i.substr(s,o-s);break;case`<`:switch(i[o+3]){case`=`:case`!`:s=o,o+=4,process(),t+=i.substr(s,o-s);break;default:appendRaw(i.indexOf(`>`,o)-o+1),t+=process()+`|$)`;break}break}else appendRaw(1),t+=process()+`|$)`;break;case`)`:return++o,t;default:appendOptional(1);break}return t}return new RegExp(process(),t.flags)}var Ge=c({findAssignment:()=>findAssignment,findNameAssignment:()=>findNameAssignment,findNodeForKeyword:()=>findNodeForKeyword,findNodeForProperty:()=>findNodeForProperty,findNodesForKeyword:()=>findNodesForKeyword,findNodesForKeywordInternal:()=>findNodesForKeywordInternal,findNodesForProperty:()=>findNodesForProperty,getActionAtElement:()=>getActionAtElement,getActionType:()=>getActionType,getAllReachableRules:()=>getAllReachableRules,getAllRulesUsedForCrossReferences:()=>getAllRulesUsedForCrossReferences,getCrossReferenceTerminal:()=>getCrossReferenceTerminal,getEntryRule:()=>getEntryRule,getExplicitRuleType:()=>getExplicitRuleType,getHiddenRules:()=>getHiddenRules,getRuleType:()=>getRuleType,getRuleTypeName:()=>getRuleTypeName,getTypeName:()=>getTypeName,isArrayCardinality:()=>isArrayCardinality,isArrayOperator:()=>isArrayOperator,isCommentTerminal:()=>isCommentTerminal,isDataType:()=>isDataType,isDataTypeRule:()=>isDataTypeRule,isOptionalCardinality:()=>isOptionalCardinality,terminalRegex:()=>terminalRegex});function getEntryRule(t){return t.rules.find(t=>isParserRule(t)&&t.entry)}function getHiddenRules(t){return t.rules.filter(t=>isTerminalRule(t)&&t.hidden)}function getAllReachableRules(t,n){let i=new Set,o=getEntryRule(t);if(!o)return new Set(t.rules);let s=[o].concat(getHiddenRules(t));for(let t of s)ruleDfs(t,i,n);let c=new Set;for(let n of t.rules)(i.has(n.name)||isTerminalRule(n)&&n.hidden)&&c.add(n);return c}function ruleDfs(t,n,i){n.add(t.name),streamAllContents(t).forEach(t=>{if(isRuleCall(t)||i&&isTerminalRuleCall(t)){let o=t.rule.ref;o&&!n.has(o.name)&&ruleDfs(o,n,i)}})}function getAllRulesUsedForCrossReferences(t){let n=new Set;return streamAllContents(t).forEach(t=>{isCrossReference(t)&&(isParserRule(t.type.ref)&&n.add(t.type.ref),isInferredType(t.type.ref)&&isParserRule(t.type.ref.$container)&&n.add(t.type.ref.$container))}),n}function getCrossReferenceTerminal(t){if(t.terminal)return t.terminal;if(t.type.ref)return findNameAssignment(t.type.ref)?.terminal}function isCommentTerminal(t){return t.hidden&&!isWhitespace(terminalRegex(t))}function findNodesForProperty(t,n){return!t||!n?[]:findNodesForPropertyInternal(t,n,t.astNode,!0)}function findNodeForProperty(t,n,i){if(!t||!n)return;let o=findNodesForPropertyInternal(t,n,t.astNode,!0);if(o.length!==0)return i=i===void 0?0:Math.max(0,Math.min(i,o.length-1)),o[i]}function findNodesForPropertyInternal(t,n,i,o){if(!o){let i=getContainerOfType(t.grammarSource,isAssignment);if(i&&i.feature===n)return[t]}return isCompositeCstNode(t)&&t.astNode===i?t.content.flatMap(t=>findNodesForPropertyInternal(t,n,i,!1)):[]}function findNodesForKeyword(t,n){return t?findNodesForKeywordInternal(t,n,t?.astNode):[]}function findNodeForKeyword(t,n,i){if(!t)return;let o=findNodesForKeywordInternal(t,n,t?.astNode);if(o.length!==0)return i=i===void 0?0:Math.max(0,Math.min(i,o.length-1)),o[i]}function findNodesForKeywordInternal(t,n,i){if(t.astNode!==i)return[];if(isKeyword(t.grammarSource)&&t.grammarSource.value===n)return[t];let o=streamCst(t).iterator(),s,c=[];do if(s=o.next(),!s.done){let t=s.value;t.astNode===i?isKeyword(t.grammarSource)&&t.grammarSource.value===n&&c.push(t):o.prune()}while(!s.done);return c}function findAssignment(t){let n=t.astNode;for(;n===t.container?.astNode;){let n=getContainerOfType(t.grammarSource,isAssignment);if(n)return n;t=t.container}}function findNameAssignment(t){let n=t;return isInferredType(n)&&(isAction(n.$container)?n=n.$container.$container:isParserRule(n.$container)?n=n.$container:assertUnreachable(n.$container)),findNameAssignmentInternal(t,n,new Map)}function findNameAssignmentInternal(t,n,i){function go(n,o){let s;return getContainerOfType(n,isAssignment)||(s=findNameAssignmentInternal(o,o,i)),i.set(t,s),s}if(i.has(t))return i.get(t);i.set(t,void 0);for(let o of streamAllContents(n))if(isAssignment(o)&&o.feature.toLowerCase()===`name`)return i.set(t,o),o;else if(isRuleCall(o)&&isParserRule(o.rule.ref))return go(o,o.rule.ref);else if(isSimpleType(o)&&o.typeRef?.ref)return go(o,o.typeRef.ref)}function getActionAtElement(t){let n=t.$container;if(isGroup(n)){let i=n.elements,o=i.indexOf(t);for(let t=o-1;t>=0;t--){let n=i[t];if(isAction(n))return n;{let n=streamAllContents(i[t]).find(isAction);if(n)return n}}}if(isAbstractElement(n))return getActionAtElement(n)}function isOptionalCardinality(t,n){return t===`?`||t===`*`||isGroup(n)&&!!n.guardCondition}function isArrayCardinality(t){return t===`*`||t===`+`}function isArrayOperator(t){return t===`+=`}function isDataTypeRule(t){return isDataTypeRuleInternal(t,new Set)}function isDataTypeRuleInternal(t,n){if(n.has(t))return!0;n.add(t);for(let i of streamAllContents(t))if(isRuleCall(i)){if(!i.rule.ref||isParserRule(i.rule.ref)&&!isDataTypeRuleInternal(i.rule.ref,n))return!1}else if(isAssignment(i))return!1;else if(isAction(i))return!1;return!!t.definition}function isDataType(t){return isDataTypeInternal(t.type,new Set)}function isDataTypeInternal(t,n){if(n.has(t))return!0;if(n.add(t),isArrayType(t)||isReferenceType(t))return!1;if(isUnionType(t))return t.types.every(t=>isDataTypeInternal(t,n));if(isSimpleType(t)){if(t.primitiveType!==void 0||t.stringType!==void 0)return!0;if(t.typeRef!==void 0){let i=t.typeRef.ref;return isType(i)?isDataTypeInternal(i.type,n):!1}else return!1}else return!1}function getExplicitRuleType(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){let n=t.returnType.ref;if(n&&(isParserRule(n)||isInterface(n)||isType(n)))return n.name}}function getTypeName(t){if(isParserRule(t))return isDataTypeRule(t)?t.name:getExplicitRuleType(t)??t.name;if(isInterface(t)||isType(t)||isReturnType(t))return t.name;if(isAction(t)){let n=getActionType(t);if(n)return n}else if(isInferredType(t))return t.name;throw Error(`Cannot get name of Unknown Type`)}function getActionType(t){if(t.inferredType)return t.inferredType.name;if(t.type?.ref)return getTypeName(t.type.ref)}function getRuleTypeName(t){return isTerminalRule(t)?t.type?.name??`string`:isDataTypeRule(t)?t.name:getExplicitRuleType(t)??t.name}function getRuleType(t){return isTerminalRule(t)?t.type?.name??`string`:getExplicitRuleType(t)??t.name}function terminalRegex(t){let n={s:!1,i:!1,u:!1},i=abstractElementToRegex(t.definition,n),o=Object.entries(n).filter(([,t])=>t).map(([t])=>t).join(``);return new RegExp(i,o)}const Ke=`[\\s\\S]`;function abstractElementToRegex(t,n){if(isTerminalAlternatives(t))return terminalAlternativesToRegex(t);if(isTerminalGroup(t))return terminalGroupToRegex(t);if(isCharacterRange(t))return characterRangeToRegex(t);if(isTerminalRuleCall(t)){let n=t.rule.ref;if(!n)throw Error(`Missing rule reference.`);return withCardinality(abstractElementToRegex(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else if(isNegatedToken(t))return negateTokenToRegex(t);else if(isUntilToken(t))return untilTokenToRegex(t);else if(isRegexToken(t)){let i=t.regex.lastIndexOf(`/`),o=t.regex.substring(1,i),s=t.regex.substring(i+1);return n&&(n.i=s.includes(`i`),n.s=s.includes(`s`),n.u=s.includes(`u`)),withCardinality(o,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else if(isWildcard(t))return withCardinality(Ke,{cardinality:t.cardinality,lookahead:t.lookahead});else throw Error(`Invalid terminal element: ${t?.$type}`)}function terminalAlternativesToRegex(t){return withCardinality(t.elements.map(t=>abstractElementToRegex(t)).join(`|`),{cardinality:t.cardinality,lookahead:t.lookahead})}function terminalGroupToRegex(t){return withCardinality(t.elements.map(t=>abstractElementToRegex(t)).join(``),{cardinality:t.cardinality,lookahead:t.lookahead})}function untilTokenToRegex(t){return withCardinality(`${Ke}*?${abstractElementToRegex(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function negateTokenToRegex(t){return withCardinality(`(?!${abstractElementToRegex(t.terminal)})${Ke}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function characterRangeToRegex(t){return t.right?withCardinality(`[${keywordToRegex(t.left)}-${keywordToRegex(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):withCardinality(keywordToRegex(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function keywordToRegex(t){return escapeRegExp(t.value)}function withCardinality(t,n){return(n.wrap!==!1||n.lookahead)&&(t=`(${n.lookahead??``}${t})`),n.cardinality?`${t}${n.cardinality}`:t}function createGrammarConfig(t){let n=[],i=t.Grammar;for(let t of i.rules)isTerminalRule(t)&&isCommentTerminal(t)&&isMultilineComment(terminalRegex(t))&&n.push(t.name);return{multilineCommentRules:n,nameRegexp:P}}var qe=c({AnnotatedTextEdit:()=>pt,ChangeAnnotation:()=>ft,ChangeAnnotationIdentifier:()=>G,CodeAction:()=>qt,CodeActionContext:()=>Kt,CodeActionKind:()=>Wt,CodeActionTriggerKind:()=>Gt,CodeDescription:()=>ct,CodeLens:()=>Jt,Color:()=>et,ColorInformation:()=>tt,ColorPresentation:()=>nt,Command:()=>ut,CompletionItem:()=>jt,CompletionItemKind:()=>Tt,CompletionItemLabelDetails:()=>At,CompletionItemTag:()=>Dt,CompletionList:()=>Mt,CreateFile:()=>ht,DeleteFile:()=>_t,Diagnostic:()=>lt,DiagnosticRelatedInformation:()=>at,DiagnosticSeverity:()=>ot,DiagnosticTag:()=>st,DocumentHighlight:()=>Rt,DocumentHighlightKind:()=>Lt,DocumentLink:()=>Xt,DocumentSymbol:()=>Ut,DocumentUri:()=>Je,EOL:()=>gn,FoldingRange:()=>it,FoldingRangeKind:()=>rt,FormattingOptions:()=>Yt,Hover:()=>Pt,InlayHint:()=>cn,InlayHintKind:()=>on,InlayHintLabelPart:()=>sn,InlineCompletionContext:()=>mn,InlineCompletionItem:()=>un,InlineCompletionList:()=>dn,InlineCompletionTriggerKind:()=>fn,InlineValueContext:()=>an,InlineValueEvaluatableExpression:()=>rn,InlineValueText:()=>tn,InlineValueVariableLookup:()=>nn,InsertReplaceEdit:()=>Ot,InsertTextFormat:()=>Et,InsertTextMode:()=>kt,Location:()=>Qe,LocationLink:()=>$e,MarkedString:()=>Nt,MarkupContent:()=>wt,MarkupKind:()=>Ct,OptionalVersionedTextDocumentIdentifier:()=>xt,ParameterInformation:()=>Ft,Position:()=>U,Range:()=>W,RenameFile:()=>gt,SelectedCompletionInfo:()=>pn,SelectionRange:()=>Zt,SemanticTokenModifiers:()=>$t,SemanticTokenTypes:()=>Qt,SemanticTokens:()=>en,SignatureInformation:()=>It,StringValue:()=>ln,SymbolInformation:()=>Vt,SymbolKind:()=>zt,SymbolTag:()=>Bt,TextDocument:()=>_n,TextDocumentEdit:()=>mt,TextDocumentIdentifier:()=>yt,TextDocumentItem:()=>St,TextEdit:()=>dt,URI:()=>Ye,VersionedTextDocumentIdentifier:()=>bt,WorkspaceChange:()=>WorkspaceChange,WorkspaceEdit:()=>vt,WorkspaceFolder:()=>hn,WorkspaceSymbol:()=>Ht,integer:()=>Xe,uinteger:()=>Ze}),Je,Ye,Xe,Ze,U,W,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,G,pt,mt,ht,gt,_t,vt,TextEditChangeImpl,ChangeAnnotations,WorkspaceChange,yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,FullTextDocument$1,K,vn=o((()=>{(function(t){function is(t){return typeof t==`string`}t.is=is})(Je||={}),(function(t){function is(t){return typeof t==`string`}t.is=is})(Ye||={}),(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function is(n){return typeof n==`number`&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=is})(Xe||={}),(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function is(n){return typeof n==`number`&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=is})(Ze||={}),(function(t){function create(t,n){return t===Number.MAX_VALUE&&(t=Ze.MAX_VALUE),n===Number.MAX_VALUE&&(n=Ze.MAX_VALUE),{line:t,character:n}}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&K.uinteger(n.line)&&K.uinteger(n.character)}t.is=is})(U||={}),(function(t){function create(t,n,i,o){if(K.uinteger(t)&&K.uinteger(n)&&K.uinteger(i)&&K.uinteger(o))return{start:U.create(t,n),end:U.create(i,o)};if(U.is(t)&&U.is(n))return{start:t,end:n};throw Error(`Range#create called with invalid arguments[${t}, ${n}, ${i}, ${o}]`)}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&U.is(n.start)&&U.is(n.end)}t.is=is})(W||={}),(function(t){function create(t,n){return{uri:t,range:n}}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&W.is(n.range)&&(K.string(n.uri)||K.undefined(n.uri))}t.is=is})(Qe||={}),(function(t){function create(t,n,i,o){return{targetUri:t,targetRange:n,targetSelectionRange:i,originSelectionRange:o}}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&W.is(n.targetRange)&&K.string(n.targetUri)&&W.is(n.targetSelectionRange)&&(W.is(n.originSelectionRange)||K.undefined(n.originSelectionRange))}t.is=is})($e||={}),(function(t){function create(t,n,i,o){return{red:t,green:n,blue:i,alpha:o}}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&K.numberRange(n.red,0,1)&&K.numberRange(n.green,0,1)&&K.numberRange(n.blue,0,1)&&K.numberRange(n.alpha,0,1)}t.is=is})(et||={}),(function(t){function create(t,n){return{range:t,color:n}}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&W.is(n.range)&&et.is(n.color)}t.is=is})(tt||={}),(function(t){function create(t,n,i){return{label:t,textEdit:n,additionalTextEdits:i}}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&K.string(n.label)&&(K.undefined(n.textEdit)||dt.is(n))&&(K.undefined(n.additionalTextEdits)||K.typedArray(n.additionalTextEdits,dt.is))}t.is=is})(nt||={}),(function(t){t.Comment=`comment`,t.Imports=`imports`,t.Region=`region`})(rt||={}),(function(t){function create(t,n,i,o,s,c){let u={startLine:t,endLine:n};return K.defined(i)&&(u.startCharacter=i),K.defined(o)&&(u.endCharacter=o),K.defined(s)&&(u.kind=s),K.defined(c)&&(u.collapsedText=c),u}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&K.uinteger(n.startLine)&&K.uinteger(n.startLine)&&(K.undefined(n.startCharacter)||K.uinteger(n.startCharacter))&&(K.undefined(n.endCharacter)||K.uinteger(n.endCharacter))&&(K.undefined(n.kind)||K.string(n.kind))}t.is=is})(it||={}),(function(t){function create(t,n){return{location:t,message:n}}t.create=create;function is(t){let n=t;return K.defined(n)&&Qe.is(n.location)&&K.string(n.message)}t.is=is})(at||={}),(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(ot||={}),(function(t){t.Unnecessary=1,t.Deprecated=2})(st||={}),(function(t){function is(t){let n=t;return K.objectLiteral(n)&&K.string(n.href)}t.is=is})(ct||={}),(function(t){function create(t,n,i,o,s,c){let u={range:t,message:n};return K.defined(i)&&(u.severity=i),K.defined(o)&&(u.code=o),K.defined(s)&&(u.source=s),K.defined(c)&&(u.relatedInformation=c),u}t.create=create;function is(t){let n=t;return K.defined(n)&&W.is(n.range)&&K.string(n.message)&&(K.number(n.severity)||K.undefined(n.severity))&&(K.integer(n.code)||K.string(n.code)||K.undefined(n.code))&&(K.undefined(n.codeDescription)||K.string(n.codeDescription?.href))&&(K.string(n.source)||K.undefined(n.source))&&(K.undefined(n.relatedInformation)||K.typedArray(n.relatedInformation,at.is))}t.is=is})(lt||={}),(function(t){function create(t,n,...i){let o={title:t,command:n};return K.defined(i)&&i.length>0&&(o.arguments=i),o}t.create=create;function is(t){let n=t;return K.defined(n)&&K.string(n.title)&&K.string(n.command)}t.is=is})(ut||={}),(function(t){function replace(t,n){return{range:t,newText:n}}t.replace=replace;function insert(t,n){return{range:{start:t,end:t},newText:n}}t.insert=insert;function del(t){return{range:t,newText:``}}t.del=del;function is(t){let n=t;return K.objectLiteral(n)&&K.string(n.newText)&&W.is(n.range)}t.is=is})(dt||={}),(function(t){function create(t,n,i){let o={label:t};return n!==void 0&&(o.needsConfirmation=n),i!==void 0&&(o.description=i),o}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&K.string(n.label)&&(K.boolean(n.needsConfirmation)||n.needsConfirmation===void 0)&&(K.string(n.description)||n.description===void 0)}t.is=is})(ft||={}),(function(t){function is(t){let n=t;return K.string(n)}t.is=is})(G||={}),(function(t){function replace(t,n,i){return{range:t,newText:n,annotationId:i}}t.replace=replace;function insert(t,n,i){return{range:{start:t,end:t},newText:n,annotationId:i}}t.insert=insert;function del(t,n){return{range:t,newText:``,annotationId:n}}t.del=del;function is(t){let n=t;return dt.is(n)&&(ft.is(n.annotationId)||G.is(n.annotationId))}t.is=is})(pt||={}),(function(t){function create(t,n){return{textDocument:t,edits:n}}t.create=create;function is(t){let n=t;return K.defined(n)&&xt.is(n.textDocument)&&Array.isArray(n.edits)}t.is=is})(mt||={}),(function(t){function create(t,n,i){let o={kind:`create`,uri:t};return n!==void 0&&(n.overwrite!==void 0||n.ignoreIfExists!==void 0)&&(o.options=n),i!==void 0&&(o.annotationId=i),o}t.create=create;function is(t){let n=t;return n&&n.kind===`create`&&K.string(n.uri)&&(n.options===void 0||(n.options.overwrite===void 0||K.boolean(n.options.overwrite))&&(n.options.ignoreIfExists===void 0||K.boolean(n.options.ignoreIfExists)))&&(n.annotationId===void 0||G.is(n.annotationId))}t.is=is})(ht||={}),(function(t){function create(t,n,i,o){let s={kind:`rename`,oldUri:t,newUri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),o!==void 0&&(s.annotationId=o),s}t.create=create;function is(t){let n=t;return n&&n.kind===`rename`&&K.string(n.oldUri)&&K.string(n.newUri)&&(n.options===void 0||(n.options.overwrite===void 0||K.boolean(n.options.overwrite))&&(n.options.ignoreIfExists===void 0||K.boolean(n.options.ignoreIfExists)))&&(n.annotationId===void 0||G.is(n.annotationId))}t.is=is})(gt||={}),(function(t){function create(t,n,i){let o={kind:`delete`,uri:t};return n!==void 0&&(n.recursive!==void 0||n.ignoreIfNotExists!==void 0)&&(o.options=n),i!==void 0&&(o.annotationId=i),o}t.create=create;function is(t){let n=t;return n&&n.kind===`delete`&&K.string(n.uri)&&(n.options===void 0||(n.options.recursive===void 0||K.boolean(n.options.recursive))&&(n.options.ignoreIfNotExists===void 0||K.boolean(n.options.ignoreIfNotExists)))&&(n.annotationId===void 0||G.is(n.annotationId))}t.is=is})(_t||={}),(function(t){function is(t){let n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(t=>K.string(t.kind)?ht.is(t)||gt.is(t)||_t.is(t):mt.is(t)))}t.is=is})(vt||={}),TextEditChangeImpl=class{constructor(t,n){this.edits=t,this.changeAnnotations=n}insert(t,n,i){let o,s;if(i===void 0?o=dt.insert(t,n):G.is(i)?(s=i,o=pt.insert(t,n,i)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(i),o=pt.insert(t,n,s)),this.edits.push(o),s!==void 0)return s}replace(t,n,i){let o,s;if(i===void 0?o=dt.replace(t,n):G.is(i)?(s=i,o=pt.replace(t,n,i)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(i),o=pt.replace(t,n,s)),this.edits.push(o),s!==void 0)return s}delete(t,n){let i,o;if(n===void 0?i=dt.del(t):G.is(n)?(o=n,i=pt.del(t,n)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(n),i=pt.del(t,o)),this.edits.push(i),o!==void 0)return o}add(t){this.edits.push(t)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(t){if(t===void 0)throw Error(`Text edit change is not configured to manage change annotations.`)}},ChangeAnnotations=class{constructor(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(t,n){let i;if(G.is(t)?i=t:(i=this.nextId(),n=t),this._annotations[i]!==void 0)throw Error(`Id ${i} is already in use.`);if(n===void 0)throw Error(`No annotation provided for id ${i}`);return this._annotations[i]=n,this._size++,i}nextId(){return this._counter++,this._counter.toString()}},WorkspaceChange=class{constructor(t){this._textEditChanges=Object.create(null),t===void 0?this._workspaceEdit={}:(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new ChangeAnnotations(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(t=>{if(mt.is(t)){let n=new TextEditChangeImpl(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=n}})):t.changes&&Object.keys(t.changes).forEach(n=>{let i=new TextEditChangeImpl(t.changes[n]);this._textEditChanges[n]=i}))}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(t){if(xt.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let n={uri:t.uri,version:t.version},i=this._textEditChanges[n.uri];if(!i){let t=[],o={textDocument:n,edits:t};this._workspaceEdit.documentChanges.push(o),i=new TextEditChangeImpl(t,this._changeAnnotations),this._textEditChanges[n.uri]=i}return i}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw Error(`Workspace edit is not configured for normal text edit changes.`);let n=this._textEditChanges[t];if(!n){let i=[];this._workspaceEdit.changes[t]=i,n=new TextEditChangeImpl(i),this._textEditChanges[t]=n}return n}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new ChangeAnnotations,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(t,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let o;ft.is(n)||G.is(n)?o=n:i=n;let s,c;if(o===void 0?s=ht.create(t,i):(c=G.is(o)?o:this._changeAnnotations.manage(o),s=ht.create(t,i,c)),this._workspaceEdit.documentChanges.push(s),c!==void 0)return c}renameFile(t,n,i,o){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let s;ft.is(i)||G.is(i)?s=i:o=i;let c,u;if(s===void 0?c=gt.create(t,n,o):(u=G.is(s)?s:this._changeAnnotations.manage(s),c=gt.create(t,n,o,u)),this._workspaceEdit.documentChanges.push(c),u!==void 0)return u}deleteFile(t,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let o;ft.is(n)||G.is(n)?o=n:i=n;let s,c;if(o===void 0?s=_t.create(t,i):(c=G.is(o)?o:this._changeAnnotations.manage(o),s=_t.create(t,i,c)),this._workspaceEdit.documentChanges.push(s),c!==void 0)return c}},(function(t){function create(t){return{uri:t}}t.create=create;function is(t){let n=t;return K.defined(n)&&K.string(n.uri)}t.is=is})(yt||={}),(function(t){function create(t,n){return{uri:t,version:n}}t.create=create;function is(t){let n=t;return K.defined(n)&&K.string(n.uri)&&K.integer(n.version)}t.is=is})(bt||={}),(function(t){function create(t,n){return{uri:t,version:n}}t.create=create;function is(t){let n=t;return K.defined(n)&&K.string(n.uri)&&(n.version===null||K.integer(n.version))}t.is=is})(xt||={}),(function(t){function create(t,n,i,o){return{uri:t,languageId:n,version:i,text:o}}t.create=create;function is(t){let n=t;return K.defined(n)&&K.string(n.uri)&&K.string(n.languageId)&&K.integer(n.version)&&K.string(n.text)}t.is=is})(St||={}),(function(t){t.PlainText=`plaintext`,t.Markdown=`markdown`;function is(n){let i=n;return i===t.PlainText||i===t.Markdown}t.is=is})(Ct||={}),(function(t){function is(t){let n=t;return K.objectLiteral(t)&&Ct.is(n.kind)&&K.string(n.value)}t.is=is})(wt||={}),(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Tt||={}),(function(t){t.PlainText=1,t.Snippet=2})(Et||={}),(function(t){t.Deprecated=1})(Dt||={}),(function(t){function create(t,n,i){return{newText:t,insert:n,replace:i}}t.create=create;function is(t){let n=t;return n&&K.string(n.newText)&&W.is(n.insert)&&W.is(n.replace)}t.is=is})(Ot||={}),(function(t){t.asIs=1,t.adjustIndentation=2})(kt||={}),(function(t){function is(t){let n=t;return n&&(K.string(n.detail)||n.detail===void 0)&&(K.string(n.description)||n.description===void 0)}t.is=is})(At||={}),(function(t){function create(t){return{label:t}}t.create=create})(jt||={}),(function(t){function create(t,n){return{items:t||[],isIncomplete:!!n}}t.create=create})(Mt||={}),(function(t){function fromPlainText(t){return t.replace(/[\\`*_{}[\]()#+\-.!]/g,`\\$&`)}t.fromPlainText=fromPlainText;function is(t){let n=t;return K.string(n)||K.objectLiteral(n)&&K.string(n.language)&&K.string(n.value)}t.is=is})(Nt||={}),(function(t){function is(t){let n=t;return!!n&&K.objectLiteral(n)&&(wt.is(n.contents)||Nt.is(n.contents)||K.typedArray(n.contents,Nt.is))&&(t.range===void 0||W.is(t.range))}t.is=is})(Pt||={}),(function(t){function create(t,n){return n?{label:t,documentation:n}:{label:t}}t.create=create})(Ft||={}),(function(t){function create(t,n,...i){let o={label:t};return K.defined(n)&&(o.documentation=n),K.defined(i)?o.parameters=i:o.parameters=[],o}t.create=create})(It||={}),(function(t){t.Text=1,t.Read=2,t.Write=3})(Lt||={}),(function(t){function create(t,n){let i={range:t};return K.number(n)&&(i.kind=n),i}t.create=create})(Rt||={}),(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(zt||={}),(function(t){t.Deprecated=1})(Bt||={}),(function(t){function create(t,n,i,o,s){let c={name:t,kind:n,location:{uri:o,range:i}};return s&&(c.containerName=s),c}t.create=create})(Vt||={}),(function(t){function create(t,n,i,o){return o===void 0?{name:t,kind:n,location:{uri:i}}:{name:t,kind:n,location:{uri:i,range:o}}}t.create=create})(Ht||={}),(function(t){function create(t,n,i,o,s,c){let u={name:t,detail:n,kind:i,range:o,selectionRange:s};return c!==void 0&&(u.children=c),u}t.create=create;function is(t){let n=t;return n&&K.string(n.name)&&K.number(n.kind)&&W.is(n.range)&&W.is(n.selectionRange)&&(n.detail===void 0||K.string(n.detail))&&(n.deprecated===void 0||K.boolean(n.deprecated))&&(n.children===void 0||Array.isArray(n.children))&&(n.tags===void 0||Array.isArray(n.tags))}t.is=is})(Ut||={}),(function(t){t.Empty=``,t.QuickFix=`quickfix`,t.Refactor=`refactor`,t.RefactorExtract=`refactor.extract`,t.RefactorInline=`refactor.inline`,t.RefactorRewrite=`refactor.rewrite`,t.Source=`source`,t.SourceOrganizeImports=`source.organizeImports`,t.SourceFixAll=`source.fixAll`})(Wt||={}),(function(t){t.Invoked=1,t.Automatic=2})(Gt||={}),(function(t){function create(t,n,i){let o={diagnostics:t};return n!=null&&(o.only=n),i!=null&&(o.triggerKind=i),o}t.create=create;function is(t){let n=t;return K.defined(n)&&K.typedArray(n.diagnostics,lt.is)&&(n.only===void 0||K.typedArray(n.only,K.string))&&(n.triggerKind===void 0||n.triggerKind===Gt.Invoked||n.triggerKind===Gt.Automatic)}t.is=is})(Kt||={}),(function(t){function create(t,n,i){let o={title:t},s=!0;return typeof n==`string`?(s=!1,o.kind=n):ut.is(n)?o.command=n:o.edit=n,s&&i!==void 0&&(o.kind=i),o}t.create=create;function is(t){let n=t;return n&&K.string(n.title)&&(n.diagnostics===void 0||K.typedArray(n.diagnostics,lt.is))&&(n.kind===void 0||K.string(n.kind))&&(n.edit!==void 0||n.command!==void 0)&&(n.command===void 0||ut.is(n.command))&&(n.isPreferred===void 0||K.boolean(n.isPreferred))&&(n.edit===void 0||vt.is(n.edit))}t.is=is})(qt||={}),(function(t){function create(t,n){let i={range:t};return K.defined(n)&&(i.data=n),i}t.create=create;function is(t){let n=t;return K.defined(n)&&W.is(n.range)&&(K.undefined(n.command)||ut.is(n.command))}t.is=is})(Jt||={}),(function(t){function create(t,n){return{tabSize:t,insertSpaces:n}}t.create=create;function is(t){let n=t;return K.defined(n)&&K.uinteger(n.tabSize)&&K.boolean(n.insertSpaces)}t.is=is})(Yt||={}),(function(t){function create(t,n,i){return{range:t,target:n,data:i}}t.create=create;function is(t){let n=t;return K.defined(n)&&W.is(n.range)&&(K.undefined(n.target)||K.string(n.target))}t.is=is})(Xt||={}),(function(t){function create(t,n){return{range:t,parent:n}}t.create=create;function is(n){let i=n;return K.objectLiteral(i)&&W.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=is})(Zt||={}),(function(t){t.namespace=`namespace`,t.type=`type`,t.class=`class`,t.enum=`enum`,t.interface=`interface`,t.struct=`struct`,t.typeParameter=`typeParameter`,t.parameter=`parameter`,t.variable=`variable`,t.property=`property`,t.enumMember=`enumMember`,t.event=`event`,t.function=`function`,t.method=`method`,t.macro=`macro`,t.keyword=`keyword`,t.modifier=`modifier`,t.comment=`comment`,t.string=`string`,t.number=`number`,t.regexp=`regexp`,t.operator=`operator`,t.decorator=`decorator`})(Qt||={}),(function(t){t.declaration=`declaration`,t.definition=`definition`,t.readonly=`readonly`,t.static=`static`,t.deprecated=`deprecated`,t.abstract=`abstract`,t.async=`async`,t.modification=`modification`,t.documentation=`documentation`,t.defaultLibrary=`defaultLibrary`})($t||={}),(function(t){function is(t){let n=t;return K.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId==`string`)&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]==`number`)}t.is=is})(en||={}),(function(t){function create(t,n){return{range:t,text:n}}t.create=create;function is(t){let n=t;return n!=null&&W.is(n.range)&&K.string(n.text)}t.is=is})(tn||={}),(function(t){function create(t,n,i){return{range:t,variableName:n,caseSensitiveLookup:i}}t.create=create;function is(t){let n=t;return n!=null&&W.is(n.range)&&K.boolean(n.caseSensitiveLookup)&&(K.string(n.variableName)||n.variableName===void 0)}t.is=is})(nn||={}),(function(t){function create(t,n){return{range:t,expression:n}}t.create=create;function is(t){let n=t;return n!=null&&W.is(n.range)&&(K.string(n.expression)||n.expression===void 0)}t.is=is})(rn||={}),(function(t){function create(t,n){return{frameId:t,stoppedLocation:n}}t.create=create;function is(t){let n=t;return K.defined(n)&&W.is(t.stoppedLocation)}t.is=is})(an||={}),(function(t){t.Type=1,t.Parameter=2;function is(t){return t===1||t===2}t.is=is})(on||={}),(function(t){function create(t){return{value:t}}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&(n.tooltip===void 0||K.string(n.tooltip)||wt.is(n.tooltip))&&(n.location===void 0||Qe.is(n.location))&&(n.command===void 0||ut.is(n.command))}t.is=is})(sn||={}),(function(t){function create(t,n,i){let o={position:t,label:n};return i!==void 0&&(o.kind=i),o}t.create=create;function is(t){let n=t;return K.objectLiteral(n)&&U.is(n.position)&&(K.string(n.label)||K.typedArray(n.label,sn.is))&&(n.kind===void 0||on.is(n.kind))&&n.textEdits===void 0||K.typedArray(n.textEdits,dt.is)&&(n.tooltip===void 0||K.string(n.tooltip)||wt.is(n.tooltip))&&(n.paddingLeft===void 0||K.boolean(n.paddingLeft))&&(n.paddingRight===void 0||K.boolean(n.paddingRight))}t.is=is})(cn||={}),(function(t){function createSnippet(t){return{kind:`snippet`,value:t}}t.createSnippet=createSnippet})(ln||={}),(function(t){function create(t,n,i,o){return{insertText:t,filterText:n,range:i,command:o}}t.create=create})(un||={}),(function(t){function create(t){return{items:t}}t.create=create})(dn||={}),(function(t){t.Invoked=0,t.Automatic=1})(fn||={}),(function(t){function create(t,n){return{range:t,text:n}}t.create=create})(pn||={}),(function(t){function create(t,n){return{triggerKind:t,selectedCompletionInfo:n}}t.create=create})(mn||={}),(function(t){function is(t){let n=t;return K.objectLiteral(n)&&Ye.is(n.uri)&&K.string(n.name)}t.is=is})(hn||={}),gn=[`
5
+ `,`\r
6
+ `,`\r`],(function(t){function create(t,n,i,o){return new FullTextDocument$1(t,n,i,o)}t.create=create;function is(t){let n=t;return!!(K.defined(n)&&K.string(n.uri)&&(K.undefined(n.languageId)||K.string(n.languageId))&&K.uinteger(n.lineCount)&&K.func(n.getText)&&K.func(n.positionAt)&&K.func(n.offsetAt))}t.is=is;function applyEdits(t,n){let i=t.getText(),o=mergeSort(n,(t,n)=>{let i=t.range.start.line-n.range.start.line;return i===0?t.range.start.character-n.range.start.character:i}),s=i.length;for(let n=o.length-1;n>=0;n--){let c=o[n],u=t.offsetAt(c.range.start),f=t.offsetAt(c.range.end);if(f<=s)i=i.substring(0,u)+c.newText+i.substring(f,i.length);else throw Error(`Overlapping edit`);s=u}return i}t.applyEdits=applyEdits;function mergeSort(t,n){if(t.length<=1)return t;let i=t.length/2|0,o=t.slice(0,i),s=t.slice(i);mergeSort(o,n),mergeSort(s,n);let c=0,u=0,f=0;for(;c<o.length&&u<s.length;)n(o[c],s[u])<=0?t[f++]=o[c++]:t[f++]=s[u++];for(;c<o.length;)t[f++]=o[c++];for(;u<s.length;)t[f++]=s[u++];return t}})(_n||={}),FullTextDocument$1=class{static{i(this,`FullTextDocument`)}constructor(t,n,i,o){this._uri=t,this._languageId=n,this._version=i,this._content=o,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),i=this.offsetAt(t.end);return this._content.substring(n,i)}return this._content}update(t,n){this._content=t.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let t=[],n=this._content,i=!0;for(let o=0;o<n.length;o++){i&&=(t.push(o),!1);let s=n.charAt(o);i=s===`\r`||s===`
7
+ `,s===`\r`&&o+1<n.length&&n.charAt(o+1)===`
8
+ `&&o++}i&&n.length>0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),i=0,o=n.length;if(o===0)return U.create(0,t);for(;i<o;){let s=Math.floor((i+o)/2);n[s]>t?o=s:i=s+1}let s=i-1;return U.create(s,t-n[s])}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let i=n[t.line],o=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(i+t.character,o),i)}get lineCount(){return this.getLineOffsets().length}},(function(t){let n=Object.prototype.toString;function defined(t){return t!==void 0}t.defined=defined;function undefined(t){return t===void 0}t.undefined=undefined;function boolean(t){return t===!0||t===!1}t.boolean=boolean;function string(t){return n.call(t)===`[object String]`}t.string=string;function number(t){return n.call(t)===`[object Number]`}t.number=number;function numberRange(t,i,o){return n.call(t)===`[object Number]`&&i<=t&&t<=o}t.numberRange=numberRange;function integer(t){return n.call(t)===`[object Number]`&&-2147483648<=t&&t<=2147483647}t.integer=integer;function uinteger(t){return n.call(t)===`[object Number]`&&0<=t&&t<=2147483647}t.uinteger=uinteger;function func(t){return n.call(t)===`[object Function]`}t.func=func;function objectLiteral(t){return typeof t==`object`&&!!t}t.objectLiteral=objectLiteral;function typedArray(t,n){return Array.isArray(t)&&t.every(n)}t.typedArray=typedArray})(K||={})}));vn();var CstNodeBuilder=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(t){return this.rootNode=new RootCstNodeImpl(t),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(t){let n=new CompositeCstNodeImpl;return n.grammarSource=t,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(t,n){let i=new LeafCstNodeImpl(t.startOffset,t.image.length,tokenToRange(t),t.tokenType,!n);return i.grammarSource=n,i.root=this.rootNode,this.current.content.push(i),i}removeNode(t){let n=t.container;if(n){let i=n.content.indexOf(t);i>=0&&n.content.splice(i,1)}}addHiddenNodes(t){let n=[];for(let i of t){let t=new LeafCstNodeImpl(i.startOffset,i.image.length,tokenToRange(i),i.tokenType,!0);t.root=this.rootNode,n.push(t)}let i=this.current,o=!1;if(i.content.length>0){i.content.push(...n);return}for(;i.container;){let t=i.container.content.indexOf(i);if(t>0){i.container.content.splice(t,0,...n),o=!0;break}i=i.container}o||this.rootNode.content.unshift(...n)}construct(t){let n=this.current;typeof t.$type==`string`&&(this.current.astNode=t),t.$cstNode=n;let i=this.nodeStack.pop();i?.content.length===0&&this.removeNode(i)}},AbstractCstNode=class{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){let t=typeof this._astNode?.$type==`string`?this._astNode:this.container?.astNode;if(!t)throw Error(`This node has no associated AST element`);return t}set astNode(t){this._astNode=t}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}},LeafCstNodeImpl=class extends AbstractCstNode{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(t,n,i,o,s=!1){super(),this._hidden=s,this._offset=t,this._tokenType=o,this._length=n,this._range=i}},CompositeCstNodeImpl=class extends AbstractCstNode{constructor(){super(...arguments),this.content=new yn(this)}get children(){return this.content}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let t=this.firstNonHiddenNode,n=this.lastNonHiddenNode;if(t&&n){if(this._rangeCache===void 0){let{range:i}=t,{range:o}=n;this._rangeCache={start:i.start,end:o.end.line<i.start.line?i.start:o.end}}return this._rangeCache}else return{start:U.create(0,0),end:U.create(0,0)}}get firstNonHiddenNode(){for(let t of this.content)if(!t.hidden)return t;return this.content[0]}get lastNonHiddenNode(){for(let t=this.content.length-1;t>=0;t--){let n=this.content[t];if(!n.hidden)return n}return this.content[this.content.length-1]}},yn=class CstNodeContainer extends Array{constructor(t){super(),this.parent=t,Object.setPrototypeOf(this,CstNodeContainer.prototype)}push(...t){return this.addParents(t),super.push(...t)}unshift(...t){return this.addParents(t),super.unshift(...t)}splice(t,n,...i){return this.addParents(i),super.splice(t,n,...i)}addParents(t){for(let n of t)n.container=this.parent}},RootCstNodeImpl=class extends CompositeCstNodeImpl{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(t){super(),this._text=``,this._text=t??``}};const bn=Symbol(`Datatype`);function isDataTypeNode(t){return t.$type===bn}const withRuleSuffix=t=>t.endsWith(`​`)?t:t+`​`;var AbstractLangiumParser=class{constructor(t){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=t.parser.Lexer;let n=this.lexer.definition,i=t.LanguageMetaData.mode===`production`;this.wrapper=new ChevrotainWrapper(n,Object.assign(Object.assign({},t.parser.ParserConfig),{skipValidations:i,errorMessageProvider:t.parser.ParserErrorMessageProvider}))}alternatives(t,n){this.wrapper.wrapOr(t,n)}optional(t,n){this.wrapper.wrapOption(t,n)}many(t,n){this.wrapper.wrapMany(t,n)}atLeastOne(t,n){this.wrapper.wrapAtLeastOne(t,n)}getRule(t){return this.allRules.get(t)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},LangiumParser=class extends AbstractLangiumParser{get current(){return this.stack[this.stack.length-1]}constructor(t){super(t),this.nodeBuilder=new CstNodeBuilder,this.stack=[],this.assignmentMap=new Map,this.linker=t.references.Linker,this.converter=t.parser.ValueConverter,this.astReflection=t.shared.AstReflection}rule(t,n){let i=this.computeRuleType(t),o=this.wrapper.DEFINE_RULE(withRuleSuffix(t.name),this.startImplementation(i,n).bind(this));return this.allRules.set(t.name,o),t.entry&&(this.mainRule=o),o}computeRuleType(t){if(!t.fragment)return isDataTypeRule(t)?bn:getExplicitRuleType(t)??t.name}parse(t,n={}){this.nodeBuilder.buildRootNode(t);let i=this.lexerResult=this.lexer.tokenize(t);this.wrapper.input=i.tokens;let o=n.rule?this.allRules.get(n.rule):this.mainRule;if(!o)throw Error(n.rule?`No rule found with name '${n.rule}'`:`No main rule available.`);let s=this.doParse(o);return this.nodeBuilder.addHiddenNodes(i.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:s,lexerErrors:i.errors,lexerReport:i.report,parserErrors:this.wrapper.errors}}doParse(t){let n=t.call(this.wrapper,{});if(this.stack.length>0&&(n=this.construct()),n===void 0)throw Error(`No result from parser`);if(this.stack.length>0)throw Error(`Parser stack is not empty after parsing`);return n}startImplementation(t,n){return i=>{let o=!this.isRecording()&&t!==void 0;if(o){let n={$type:t};this.stack.push(n),t===bn&&(n.value=``)}return n(i),o?this.construct():void 0}}extractHiddenTokens(t){let n=this.lexerResult.hidden;if(!n.length)return[];let i=t.startOffset;for(let t=0;t<n.length;t++)if(n[t].startOffset>i)return n.splice(0,t);return n.splice(0,n.length)}consume(t,n,i){let o=this.wrapper.wrapConsume(t,n);if(!this.isRecording()&&this.isValidToken(o)){let t=this.extractHiddenTokens(o);this.nodeBuilder.addHiddenNodes(t);let n=this.nodeBuilder.buildLeafNode(o,i),{assignment:s,isCrossRef:c}=this.getAssignment(i),u=this.current;if(s){let t=isKeyword(i)?o.image:this.converter.convert(o.image,n);this.assign(s.operator,s.feature,t,n,c)}else if(isDataTypeNode(u)){let t=o.image;isKeyword(i)||(t=this.converter.convert(t,n).toString()),u.value+=t}}}isValidToken(t){return!t.isInsertedInRecovery&&!isNaN(t.startOffset)&&typeof t.endOffset==`number`&&!isNaN(t.endOffset)}subrule(t,n,i,o,s){let c;!this.isRecording()&&!i&&(c=this.nodeBuilder.buildCompositeNode(o));let u;try{u=this.wrapper.wrapSubrule(t,n,s)}finally{this.isRecording()||(u===void 0&&!i&&(u=this.construct()),u!==void 0&&c&&c.length>0&&this.performSubruleAssignment(u,o,c))}}performSubruleAssignment(t,n,i){let{assignment:o,isCrossRef:s}=this.getAssignment(n);if(o)this.assign(o.operator,o.feature,t,i,s);else if(!o){let n=this.current;if(isDataTypeNode(n))n.value+=t.toString();else if(typeof t==`object`&&t){let i=this.assignWithoutOverride(t,n);this.stack.pop(),this.stack.push(i)}}}action(t,n){if(!this.isRecording()){let i=this.current;if(n.feature&&n.operator){i=this.construct(),this.nodeBuilder.removeNode(i.$cstNode),this.nodeBuilder.buildCompositeNode(n).content.push(i.$cstNode);let o={$type:t};this.stack.push(o),this.assign(n.operator,n.feature,i,i.$cstNode,!1)}else i.$type=t}}construct(){if(this.isRecording())return;let t=this.current;return linkContentToContainer(t),this.nodeBuilder.construct(t),this.stack.pop(),isDataTypeNode(t)?this.converter.convert(t.value,t.$cstNode):(assignMandatoryProperties(this.astReflection,t),t)}getAssignment(t){if(!this.assignmentMap.has(t)){let n=getContainerOfType(t,isAssignment);this.assignmentMap.set(t,{assignment:n,isCrossRef:n?isCrossReference(n.terminal):!1})}return this.assignmentMap.get(t)}assign(t,n,i,o,s){let c=this.current,u;switch(u=s&&typeof i==`string`?this.linker.buildReference(c,n,o,i):i,t){case`=`:c[n]=u;break;case`?=`:c[n]=!0;break;case`+=`:Array.isArray(c[n])||(c[n]=[]),c[n].push(u)}}assignWithoutOverride(t,n){for(let[i,o]of Object.entries(n)){let n=t[i];n===void 0?t[i]=o:Array.isArray(n)&&Array.isArray(o)&&(o.push(...n),t[i]=o)}let i=t.$cstNode;return i&&(i.astNode=void 0,t.$cstNode=void 0),t}get definitionErrors(){return this.wrapper.definitionErrors}},AbstractParserErrorMessageProvider=class{buildMismatchTokenMessage(t){return g.buildMismatchTokenMessage(t)}buildNotAllInputParsedMessage(t){return g.buildNotAllInputParsedMessage(t)}buildNoViableAltMessage(t){return g.buildNoViableAltMessage(t)}buildEarlyExitMessage(t){return g.buildEarlyExitMessage(t)}},LangiumParserErrorMessageProvider=class extends AbstractParserErrorMessageProvider{buildMismatchTokenMessage({expected:t,actual:n}){return`Expecting ${t.LABEL?"`"+t.LABEL+"`":t.name.endsWith(`:KW`)?`keyword '${t.name.substring(0,t.name.length-3)}'`:`token of type '${t.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:t}){return`Expecting end of file but found \`${t.image}\`.`}},LangiumCompletionParser=class extends AbstractLangiumParser{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(t){this.resetState();let n=this.lexer.tokenize(t,{mode:`partial`});return this.tokens=n.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(t,n){let i=this.wrapper.DEFINE_RULE(withRuleSuffix(t.name),this.startImplementation(n).bind(this));return this.allRules.set(t.name,i),t.entry&&(this.mainRule=i),i}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(t){return n=>{let i=this.keepStackSize();try{t(n)}finally{this.resetStackSize(i)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let t=this.elementStack.length;return this.stackSize=t,t}resetStackSize(t){this.removeUnexpectedElements(),this.stackSize=t}consume(t,n,i){this.wrapper.wrapConsume(t,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,i],this.nextTokenIndex=this.currIdx+1)}subrule(t,n,i,o,s){this.before(o),this.wrapper.wrapSubrule(t,n,s),this.after(o)}before(t){this.isRecording()||this.elementStack.push(t)}after(t){if(!this.isRecording()){let n=this.elementStack.lastIndexOf(t);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}};const xn={recoveryEnabled:!0,nodeLocationTracking:`full`,skipValidations:!0,errorMessageProvider:new LangiumParserErrorMessageProvider};var ChevrotainWrapper=class extends x{constructor(t,n){let i=n&&`maxLookahead`in n;super(t,Object.assign(Object.assign(Object.assign({},xn),{lookaheadStrategy:i?new T({maxLookahead:n.maxLookahead}):new ee({logging:n.skipValidations?()=>{}:void 0})}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(t,n,i){return this.RULE(t,n,i)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(t,n){return this.consume(t,n,void 0)}wrapSubrule(t,n,i){return this.subrule(t,n,{ARGS:[i]})}wrapOr(t,n){this.or(t,n)}wrapOption(t,n){this.option(t,n)}wrapMany(t,n){this.many(t,n)}wrapAtLeastOne(t,n){this.atLeastOne(t,n)}};function createParser(t,n,i){return buildRules({parser:n,tokens:i,ruleNames:new Map},t),n}function buildRules(t,n){let i=getAllReachableRules(n,!1),o=stream(n.rules).filter(isParserRule).filter(t=>i.has(t));for(let n of o){let i=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(n,buildElement(i,n.definition))}}function buildElement(t,n,i=!1){let method;if(isKeyword(n))method=buildKeyword(t,n);else if(isAction(n))method=buildAction(t,n);else if(isAssignment(n))method=buildElement(t,n.terminal);else if(isCrossReference(n))method=buildCrossReference(t,n);else if(isRuleCall(n))method=buildRuleCall(t,n);else if(isAlternatives(n))method=buildAlternatives(t,n);else if(isUnorderedGroup(n))method=buildUnorderedGroup(t,n);else if(isGroup(n))method=buildGroup(t,n);else if(isEndOfFile(n)){let i=t.consume++;method=()=>t.parser.consume(i,S,n)}else throw new ErrorWithLocation(n.$cstNode,`Unexpected element type: ${n.$type}`);return wrap(t,i?void 0:getGuardCondition(n),method,n.cardinality)}function buildAction(t,n){let i=getTypeName(n);return()=>t.parser.action(i,n)}function buildRuleCall(t,n){let i=n.rule.ref;if(isParserRule(i)){let o=t.subrule++,s=i.fragment,c=n.arguments.length>0?buildRuleCallPredicate(i,n.arguments):()=>({});return u=>t.parser.subrule(o,getRule(t,i),s,n,c(u))}else if(isTerminalRule(i)){let o=t.consume++,s=getToken(t,i.name);return()=>t.parser.consume(o,s,n)}else if(i)assertUnreachable(i);else throw new ErrorWithLocation(n.$cstNode,`Undefined rule: ${n.rule.$refText}`)}function buildRuleCallPredicate(t,n){let i=n.map(t=>buildPredicate(t.value));return n=>{let o={};for(let s=0;s<i.length;s++){let c=t.parameters[s],u=i[s];o[c.name]=u(n)}return o}}function buildPredicate(t){if(isDisjunction(t)){let n=buildPredicate(t.left),i=buildPredicate(t.right);return t=>n(t)||i(t)}else if(isConjunction(t)){let n=buildPredicate(t.left),i=buildPredicate(t.right);return t=>n(t)&&i(t)}else if(isNegation(t)){let n=buildPredicate(t.value);return t=>!n(t)}else if(isParameterReference(t)){let n=t.parameter.ref.name;return t=>t!==void 0&&t[n]===!0}else if(isBooleanLiteral(t)){let n=!!t.true;return()=>n}assertUnreachable(t)}function buildAlternatives(t,n){if(n.elements.length===1)return buildElement(t,n.elements[0]);{let i=[];for(let o of n.elements){let n={ALT:buildElement(t,o,!0)},s=getGuardCondition(o);s&&(n.GATE=buildPredicate(s)),i.push(n)}let o=t.or++;return n=>t.parser.alternatives(o,i.map(t=>{let i={ALT:()=>t.ALT(n)},o=t.GATE;return o&&(i.GATE=()=>o(n)),i}))}}function buildUnorderedGroup(t,n){if(n.elements.length===1)return buildElement(t,n.elements[0]);let i=[];for(let o of n.elements){let n={ALT:buildElement(t,o,!0)},s=getGuardCondition(o);s&&(n.GATE=buildPredicate(s)),i.push(n)}let o=t.or++,idFunc=(t,n)=>`uGroup_${t}_${n.getRuleStack().join(`-`)}`,alternatives=n=>t.parser.alternatives(o,i.map((i,s)=>{let c={ALT:()=>!0},u=t.parser;c.ALT=()=>{if(i.ALT(n),!u.isRecording()){let t=idFunc(o,u);u.unorderedGroups.get(t)||u.unorderedGroups.set(t,[]);let n=u.unorderedGroups.get(t);n?.[s]===void 0&&(n[s]=!0)}};let f=i.GATE;return f?c.GATE=()=>f(n):c.GATE=()=>!u.unorderedGroups.get(idFunc(o,u))?.[s],c})),s=wrap(t,getGuardCondition(n),alternatives,`*`);return n=>{s(n),t.parser.isRecording()||t.parser.unorderedGroups.delete(idFunc(o,t.parser))}}function buildGroup(t,n){let i=n.elements.map(n=>buildElement(t,n));return t=>i.forEach(n=>n(t))}function getGuardCondition(t){if(isGroup(t))return t.guardCondition}function buildCrossReference(t,n,i=n.terminal){if(!i){if(!n.type.ref)throw Error(`Could not resolve reference to type: `+n.type.$refText);let i=findNameAssignment(n.type.ref)?.terminal;if(!i)throw Error(`Could not find name assignment for type: `+getTypeName(n.type.ref));return buildCrossReference(t,n,i)}else if(isRuleCall(i)&&isParserRule(i.rule.ref)){let o=i.rule.ref,s=t.subrule++;return i=>t.parser.subrule(s,getRule(t,o),!1,n,i)}else if(isRuleCall(i)&&isTerminalRule(i.rule.ref)){let o=t.consume++,s=getToken(t,i.rule.ref.name);return()=>t.parser.consume(o,s,n)}else if(isKeyword(i)){let o=t.consume++,s=getToken(t,i.value);return()=>t.parser.consume(o,s,n)}else throw Error(`Could not build cross reference parser`)}function buildKeyword(t,n){let i=t.consume++,o=t.tokens[n.value];if(!o)throw Error(`Could not find token for keyword: `+n.value);return()=>t.parser.consume(i,o,n)}function wrap(t,n,i,o){let s=n&&buildPredicate(n);if(!o)if(s){let n=t.or++;return o=>t.parser.alternatives(n,[{ALT:()=>i(o),GATE:()=>s(o)},{ALT:E(),GATE:()=>!s(o)}])}else return i;if(o===`*`){let n=t.many++;return o=>t.parser.many(n,{DEF:()=>i(o),GATE:s?()=>s(o):void 0})}else if(o===`+`){let n=t.many++;if(s){let o=t.or++;return c=>t.parser.alternatives(o,[{ALT:()=>t.parser.atLeastOne(n,{DEF:()=>i(c)}),GATE:()=>s(c)},{ALT:E(),GATE:()=>!s(c)}])}else return o=>t.parser.atLeastOne(n,{DEF:()=>i(o)})}else if(o===`?`){let n=t.optional++;return o=>t.parser.optional(n,{DEF:()=>i(o),GATE:s?()=>s(o):void 0})}else assertUnreachable(o)}function getRule(t,n){let i=getRuleName(t,n),o=t.parser.getRule(i);if(!o)throw Error(`Rule "${i}" not found."`);return o}function getRuleName(t,n){if(isParserRule(n))return n.name;if(t.ruleNames.has(n))return t.ruleNames.get(n);{let i=n,o=i.$container,s=n.$type;for(;!isParserRule(o);)(isGroup(o)||isAlternatives(o)||isUnorderedGroup(o))&&(s=o.elements.indexOf(i).toString()+`:`+s),i=o,o=o.$container;return s=o.name+`:`+s,t.ruleNames.set(n,s),s}}function getToken(t,n){let i=t.tokens[n];if(!i)throw Error(`Token "${n}" not found."`);return i}function createCompletionParser(t){let n=t.Grammar,i=t.parser.Lexer,o=new LangiumCompletionParser(t);return createParser(n,o,i.definition),o.finalize(),o}function createLangiumParser(t){let n=prepareLangiumParser(t);return n.finalize(),n}function prepareLangiumParser(t){let n=t.Grammar,i=t.parser.Lexer;return createParser(n,new LangiumParser(t),i.definition)}var DefaultTokenBuilder=class{constructor(){this.diagnostics=[]}buildTokens(t,n){let i=stream(getAllReachableRules(t,!1)),o=this.buildTerminalTokens(i),s=this.buildKeywordTokens(i,o,n);return s.push(...o),s}flushLexingReport(t){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let t=[...this.diagnostics];return this.diagnostics=[],t}buildTerminalTokens(t){return t.filter(isTerminalRule).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(t){let n=terminalRegex(t),i=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,o={name:t.name,PATTERN:i};return typeof i==`function`&&(o.LINE_BREAKS=!0),t.hidden&&(o.GROUP=isWhitespace(n)?_.SKIPPED:`hidden`),o}requiresCustomPattern(t){return t.flags.includes(`u`)||t.flags.includes(`s`)?!0:!!(t.source.includes(`?<=`)||t.source.includes(`?<!`))}regexPatternFunction(t){let n=new RegExp(t,t.flags+`y`);return(t,i)=>(n.lastIndex=i,n.exec(t))}buildKeywordTokens(t,n,i){return t.filter(isParserRule).flatMap(t=>streamAllContents(t).filter(isKeyword)).distinct(t=>t.value).toArray().sort((t,n)=>n.value.length-t.value.length).map(t=>this.buildKeywordToken(t,n,!!i?.caseInsensitive))}buildKeywordToken(t,n,i){let o=this.buildKeywordPattern(t,i),s={name:t.value,PATTERN:o,LONGER_ALT:this.findLongerAlt(t,n)};return typeof o==`function`&&(s.LINE_BREAKS=!0),s}buildKeywordPattern(t,n){return n?new RegExp(escapeRegExp(t.value),`i`):t.value}findLongerAlt(t,n){return n.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&partialMatches(`^`+o.source+`$`,t.value)&&n.push(i),n},[])}},DefaultValueConverter=class{convert(t,n){let i=n.grammarSource;if(isCrossReference(i)&&(i=getCrossReferenceTerminal(i)),isRuleCall(i)){let o=i.rule.ref;if(!o)throw Error(`This cst node was not parsed by a rule.`);return this.runConverter(o,t,n)}return t}runConverter(t,n,i){switch(t.name.toUpperCase()){case`INT`:return Sn.convertInt(n);case`STRING`:return Sn.convertString(n);case`ID`:return Sn.convertID(n)}switch(getRuleType(t)?.toLowerCase()){case`number`:return Sn.convertNumber(n);case`boolean`:return Sn.convertBoolean(n);case`bigint`:return Sn.convertBigint(n);case`date`:return Sn.convertDate(n);default:return n}}},Sn;(function(t){function convertString(t){let n=``;for(let i=1;i<t.length-1;i++){let o=t.charAt(i);if(o===`\\`){let o=t.charAt(++i);n+=convertEscapeCharacter(o)}else n+=o}return n}t.convertString=convertString;function convertEscapeCharacter(t){switch(t){case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
9
+ `;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;case`0`:return`\0`;default:return t}}function convertID(t){return t.charAt(0)===`^`?t.substring(1):t}t.convertID=convertID;function convertInt(t){return parseInt(t)}t.convertInt=convertInt;function convertBigint(t){return BigInt(t)}t.convertBigint=convertBigint;function convertDate(t){return new Date(t)}t.convertDate=convertDate;function convertNumber(t){return Number(t)}t.convertNumber=convertNumber;function convertBoolean(t){return t.toLowerCase()===`true`}t.convertBoolean=convertBoolean})(Sn||={});var Cn=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n;function RAL(){if(n===void 0)throw Error(`No runtime abstraction layer installed`);return n}(function(t){function install(t){if(t===void 0)throw Error(`No runtime abstraction layer provided`);n=t}t.install=install})(RAL||={}),t.default=RAL})),wn=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.stringArray=t.array=t.func=t.error=t.number=t.string=t.boolean=void 0;function boolean(t){return t===!0||t===!1}t.boolean=boolean;function string(t){return typeof t==`string`||t instanceof String}t.string=string;function number(t){return typeof t==`number`||t instanceof Number}t.number=number;function error(t){return t instanceof Error}t.error=error;function func(t){return typeof t==`function`}t.func=func;function array(t){return Array.isArray(t)}t.array=array;function stringArray(t){return array(t)&&t.every(t=>string(t))}t.stringArray=stringArray})),Tn=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Emitter=t.Event=void 0;let n=Cn();var i;(function(t){let n={dispose(){}};t.None=function(){return n}})(i||(t.Event=i={}));var CallbackList=class{add(t,n=null,i){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(n),Array.isArray(i)&&i.push({dispose:()=>this.remove(t,n)})}remove(t,n=null){if(!this._callbacks)return;let i=!1;for(let o=0,s=this._callbacks.length;o<s;o++)if(this._callbacks[o]===t)if(this._contexts[o]===n){this._callbacks.splice(o,1),this._contexts.splice(o,1);return}else i=!0;if(i)throw Error(`When adding a listener with a context, you should remove it with the same context`)}invoke(...t){if(!this._callbacks)return[];let i=[],o=this._callbacks.slice(0),s=this._contexts.slice(0);for(let c=0,u=o.length;c<u;c++)try{i.push(o[c].apply(s[c],t))}catch(t){(0,n.default)().console.error(t)}return i}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},o=class Emitter{constructor(t){this._options=t}get event(){return this._event||=(t,n,i)=>{this._callbacks||=new CallbackList,this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let o={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),o.dispose=Emitter._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(i)&&i.push(o),o},this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&=(this._callbacks.dispose(),void 0)}};t.Emitter=o,o._noop=function(){}})),En=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0;let n=Cn(),i=wn(),o=Tn();var s;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:o.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:o.Event.None});function is(n){let o=n;return o&&(o===t.None||o===t.Cancelled||i.boolean(o.isCancellationRequested)&&!!o.onCancellationRequested)}t.is=is})(s||(t.CancellationToken=s={}));let c=Object.freeze(function(t,i){let o=(0,n.default)().timer.setTimeout(t.bind(i),0);return{dispose(){o.dispose()}}});var MutableToken=class{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?c:(this._emitter||=new o.Emitter,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),void 0)}},CancellationTokenSource=class{get token(){return this._token||=new MutableToken,this._token}cancel(){this._token?this._token.cancel():this._token=s.Cancelled}dispose(){this._token?this._token instanceof MutableToken&&this._token.dispose():this._token=s.None}};t.CancellationTokenSource=CancellationTokenSource})),q=c({});t(q,n(En(),1));function delayNextTick(){return new Promise(t=>{typeof setImmediate>`u`?setTimeout(t,0):setImmediate(t)})}let Dn=0;function startCancelableOperation(){return Dn=performance.now(),new q.CancellationTokenSource}const On=Symbol(`OperationCancelled`);function isOperationCancelled(t){return t===On}async function interruptAndCheck(t){if(t===q.CancellationToken.None)return;let n=performance.now();if(n-Dn>=10&&(Dn=n,await delayNextTick(),Dn=performance.now()),t.isCancellationRequested)throw On}var Deferred=class{constructor(){this.promise=new Promise((t,n)=>{this.resolve=n=>(t(n),this),this.reject=t=>(n(t),this)})}},kn=class FullTextDocument{constructor(t,n,i,o){this._uri=t,this._languageId=n,this._version=i,this._content=o,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let n=this.offsetAt(t.start),i=this.offsetAt(t.end);return this._content.substring(n,i)}return this._content}update(t,n){for(let n of t)if(FullTextDocument.isIncremental(n)){let t=getWellformedRange(n.range),i=this.offsetAt(t.start),o=this.offsetAt(t.end);this._content=this._content.substring(0,i)+n.text+this._content.substring(o,this._content.length);let s=Math.max(t.start.line,0),c=Math.max(t.end.line,0),u=this._lineOffsets,f=computeLineOffsets(n.text,!1,i);if(c-s===f.length)for(let t=0,n=f.length;t<n;t++)u[t+s+1]=f[t];else f.length<1e4?u.splice(s+1,c-s,...f):this._lineOffsets=u=u.slice(0,s+1).concat(f,u.slice(c+1));let p=n.text.length-(o-i);if(p!==0)for(let t=s+1+f.length,n=u.length;t<n;t++)u[t]=u[t]+p}else if(FullTextDocument.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw Error(`Unknown change event received`);this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=computeLineOffsets(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),i=0,o=n.length;if(o===0)return{line:0,character:t};for(;i<o;){let s=Math.floor((i+o)/2);n[s]>t?o=s:i=s+1}let s=i-1;return{line:s,character:t-n[s]}}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let i=n[t.line],o=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(i+t.character,o),i)}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let n=t;return n!=null&&typeof n.text==`string`&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength==`number`)}static isFull(t){let n=t;return n!=null&&typeof n.text==`string`&&n.range===void 0&&n.rangeLength===void 0}},An;(function(t){function create(t,n,i,o){return new kn(t,n,i,o)}t.create=create;function update(t,n,i){if(t instanceof kn)return t.update(n,i),t;throw Error(`TextDocument.update: document must be created by TextDocument.create`)}t.update=update;function applyEdits(t,n){let i=t.getText(),o=mergeSort(n.map(getWellformedEdit),(t,n)=>{let i=t.range.start.line-n.range.start.line;return i===0?t.range.start.character-n.range.start.character:i}),s=0,c=[];for(let n of o){let o=t.offsetAt(n.range.start);if(o<s)throw Error(`Overlapping edit`);o>s&&c.push(i.substring(s,o)),n.newText.length&&c.push(n.newText),s=t.offsetAt(n.range.end)}return c.push(i.substr(s)),c.join(``)}t.applyEdits=applyEdits})(An||={});function mergeSort(t,n){if(t.length<=1)return t;let i=t.length/2|0,o=t.slice(0,i),s=t.slice(i);mergeSort(o,n),mergeSort(s,n);let c=0,u=0,f=0;for(;c<o.length&&u<s.length;)n(o[c],s[u])<=0?t[f++]=o[c++]:t[f++]=s[u++];for(;c<o.length;)t[f++]=o[c++];for(;u<s.length;)t[f++]=s[u++];return t}function computeLineOffsets(t,n,i=0){let o=n?[i]:[];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);(s===13||s===10)&&(s===13&&n+1<t.length&&t.charCodeAt(n+1)===10&&n++,o.push(i+n+1))}return o}function getWellformedRange(t){let n=t.start,i=t.end;return n.line>i.line||n.line===i.line&&n.character>i.character?{start:i,end:n}:t}function getWellformedEdit(t){let n=getWellformedRange(t.range);return n===t.range?t:{newText:t.newText,range:n}}var jn;(()=>{var t={975:t=>{function e(t){if(typeof t!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(t))}function r(t,n){for(var i,o=``,s=0,c=-1,u=0,f=0;f<=t.length;++f){if(f<t.length)i=t.charCodeAt(f);else{if(i===47)break;i=47}if(i===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(o.length<2||s!==2||o.charCodeAt(o.length-1)!==46||o.charCodeAt(o.length-2)!==46){if(o.length>2){var p=o.lastIndexOf(`/`);if(p!==o.length-1){p===-1?(o=``,s=0):s=(o=o.slice(0,p)).length-1-o.lastIndexOf(`/`),c=f,u=0;continue}}else if(o.length===2||o.length===1){o=``,s=0,c=f,u=0;continue}}n&&(o.length>0?o+=`/..`:o=`..`,s=2)}else o.length>0?o+=`/`+t.slice(c+1,f):o=t.slice(c+1,f),s=f-c-1;c=f,u=0}else i===46&&u!==-1?++u:u=-1}return o}var n={resolve:function(){for(var t,n=``,i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s;o>=0?s=arguments[o]:(t===void 0&&(t=process.cwd()),s=t),e(s),s.length!==0&&(n=s+`/`+n,i=s.charCodeAt(0)===47)}return n=r(n,!i),i?n.length>0?`/`+n:`/`:n.length>0?n:`.`},normalize:function(t){if(e(t),t.length===0)return`.`;var n=t.charCodeAt(0)===47,i=t.charCodeAt(t.length-1)===47;return(t=r(t,!n)).length!==0||n||(t=`.`),t.length>0&&i&&(t+=`/`),n?`/`+t:t},isAbsolute:function(t){return e(t),t.length>0&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var t,i=0;i<arguments.length;++i){var o=arguments[i];e(o),o.length>0&&(t===void 0?t=o:t+=`/`+o)}return t===void 0?`.`:n.normalize(t)},relative:function(t,i){if(e(t),e(i),t===i||(t=n.resolve(t))===(i=n.resolve(i)))return``;for(var o=1;o<t.length&&t.charCodeAt(o)===47;++o);for(var s=t.length,c=s-o,u=1;u<i.length&&i.charCodeAt(u)===47;++u);for(var f=i.length-u,p=c<f?c:f,h=-1,g=0;g<=p;++g){if(g===p){if(f>p){if(i.charCodeAt(u+g)===47)return i.slice(u+g+1);if(g===0)return i.slice(u+g)}else c>p&&(t.charCodeAt(o+g)===47?h=g:g===0&&(h=0));break}var _=t.charCodeAt(o+g);if(_!==i.charCodeAt(u+g))break;_===47&&(h=g)}var x=``;for(g=o+h+1;g<=s;++g)g!==s&&t.charCodeAt(g)!==47||(x.length===0?x+=`..`:x+=`/..`);return x.length>0?x+i.slice(u+h):(u+=h,i.charCodeAt(u)===47&&++u,i.slice(u))},_makeLong:function(t){return t},dirname:function(t){if(e(t),t.length===0)return`.`;for(var n=t.charCodeAt(0),i=n===47,o=-1,s=!0,c=t.length-1;c>=1;--c)if((n=t.charCodeAt(c))===47){if(!s){o=c;break}}else s=!1;return o===-1?i?`/`:`.`:i&&o===1?`//`:t.slice(0,o)},basename:function(t,n){if(n!==void 0&&typeof n!=`string`)throw TypeError(`"ext" argument must be a string`);e(t);var i,o=0,s=-1,c=!0;if(n!==void 0&&n.length>0&&n.length<=t.length){if(n.length===t.length&&n===t)return``;var u=n.length-1,f=-1;for(i=t.length-1;i>=0;--i){var p=t.charCodeAt(i);if(p===47){if(!c){o=i+1;break}}else f===-1&&(c=!1,f=i+1),u>=0&&(p===n.charCodeAt(u)?--u==-1&&(s=i):(u=-1,s=f))}return o===s?s=f:s===-1&&(s=t.length),t.slice(o,s)}for(i=t.length-1;i>=0;--i)if(t.charCodeAt(i)===47){if(!c){o=i+1;break}}else s===-1&&(c=!1,s=i+1);return s===-1?``:t.slice(o,s)},extname:function(t){e(t);for(var n=-1,i=0,o=-1,s=!0,c=0,u=t.length-1;u>=0;--u){var f=t.charCodeAt(u);if(f!==47)o===-1&&(s=!1,o=u+1),f===46?n===-1?n=u:c!==1&&(c=1):n!==-1&&(c=-1);else if(!s){i=u+1;break}}return n===-1||o===-1||c===0||c===1&&n===o-1&&n===i+1?``:t.slice(n,o)},format:function(t){if(typeof t!=`object`||!t)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof t);return function(t,n){var i=n.dir||n.root,o=n.base||(n.name||``)+(n.ext||``);return i?i===n.root?i+o:i+`/`+o:o}(0,t)},parse:function(t){e(t);var n={root:``,dir:``,base:``,ext:``,name:``};if(t.length===0)return n;var i,o=t.charCodeAt(0),s=o===47;s?(n.root=`/`,i=1):i=0;for(var c=-1,u=0,f=-1,p=!0,h=t.length-1,g=0;h>=i;--h)if((o=t.charCodeAt(h))!==47)f===-1&&(p=!1,f=h+1),o===46?c===-1?c=h:g!==1&&(g=1):c!==-1&&(g=-1);else if(!p){u=h+1;break}return c===-1||f===-1||g===0||g===1&&c===f-1&&c===u+1?f!==-1&&(n.base=n.name=u===0&&s?t.slice(1,f):t.slice(u,f)):(u===0&&s?(n.name=t.slice(1,c),n.base=t.slice(1,f)):(n.name=t.slice(u,c),n.base=t.slice(u,f)),n.ext=t.slice(c,f)),u>0?n.dir=t.slice(0,u-1):s&&(n.dir=`/`),n},sep:`/`,delimiter:`:`,win32:null,posix:null};n.posix=n,t.exports=n}},n={};function r(i){var o=n[i];if(o!==void 0)return o.exports;var s=n[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.d=(t,n)=>{for(var i in n)r.o(n,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},r.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r.r=t=>{typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(t,`__esModule`,{value:!0})};var i={};let o;r.r(i),r.d(i,{URI:()=>l,Utils:()=>S}),typeof process==`object`?o=process.platform===`win32`:typeof navigator==`object`&&(o=navigator.userAgent.indexOf(`Windows`)>=0);let s=/^\w[\w\d+.-]*$/,c=/^\//,u=/^\/\//;function a(t,n){if(!t.scheme&&n)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t.authority}", path: "${t.path}", query: "${t.query}", fragment: "${t.fragment}"}`);if(t.scheme&&!s.test(t.scheme))throw Error(`[UriError]: Scheme contains illegal characters.`);if(t.path){if(t.authority){if(!c.test(t.path))throw 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(u.test(t.path))throw Error(`[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")`)}}let f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class l{static isUri(t){return t instanceof l||!!t&&typeof t.authority==`string`&&typeof t.fragment==`string`&&typeof t.path==`string`&&typeof t.query==`string`&&typeof t.scheme==`string`&&typeof t.fsPath==`string`&&typeof t.with==`function`&&typeof t.toString==`function`}scheme;authority;path;query;fragment;constructor(t,n,i,o,s,c=!1){typeof t==`object`?(this.scheme=t.scheme||``,this.authority=t.authority||``,this.path=t.path||``,this.query=t.query||``,this.fragment=t.fragment||``):(this.scheme=function(t,n){return t||n?t:`file`}(t,c),this.authority=n||``,this.path=function(t,n){switch(t){case`https`:case`http`:case`file`:n?n[0]!==`/`&&(n=`/`+n):n=`/`}return n}(this.scheme,i||``),this.query=o||``,this.fragment=s||``,a(this,c))}get fsPath(){return v(this,!1)}with(t){if(!t)return this;let{scheme:n,authority:i,path:o,query:s,fragment:c}=t;return n===void 0?n=this.scheme:n===null&&(n=``),i===void 0?i=this.authority:i===null&&(i=``),o===void 0?o=this.path:o===null&&(o=``),s===void 0?s=this.query:s===null&&(s=``),c===void 0?c=this.fragment:c===null&&(c=``),n===this.scheme&&i===this.authority&&o===this.path&&s===this.query&&c===this.fragment?this:new d(n,i,o,s,c)}static parse(t,n=!1){let i=f.exec(t);return i?new d(i[2]||``,w(i[4]||``),w(i[5]||``),w(i[7]||``),w(i[9]||``),n):new d(``,``,``,``,``)}static file(t){let n=``;if(o&&(t=t.replace(/\\/g,`/`)),t[0]===`/`&&t[1]===`/`){let i=t.indexOf(`/`,2);i===-1?(n=t.substring(2),t=`/`):(n=t.substring(2,i),t=t.substring(i)||`/`)}return new d(`file`,n,t,``,``)}static from(t){let n=new d(t.scheme,t.authority,t.path,t.query,t.fragment);return a(n,!0),n}toString(t=!1){return b(this,t)}toJSON(){return this}static revive(t){if(t){if(t instanceof l)return t;{let n=new d(t);return n._formatted=t.external,n._fsPath=t._sep===p?t.fsPath:null,n}}return t}}let p=o?1:void 0;class d extends l{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||=v(this,!1),this._fsPath}toString(t=!1){return t?b(this,!0):(this._formatted||=b(this,!1),this._formatted)}toJSON(){let t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=p),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t}}let h={58:`%3A`,47:`%2F`,63:`%3F`,35:`%23`,91:`%5B`,93:`%5D`,64:`%40`,33:`%21`,36:`%24`,38:`%26`,39:`%27`,40:`%28`,41:`%29`,42:`%2A`,43:`%2B`,44:`%2C`,59:`%3B`,61:`%3D`,32:`%20`};function m(t,n,i){let o,s=-1;for(let c=0;c<t.length;c++){let u=t.charCodeAt(c);if(u>=97&&u<=122||u>=65&&u<=90||u>=48&&u<=57||u===45||u===46||u===95||u===126||n&&u===47||i&&u===91||i&&u===93||i&&u===58)s!==-1&&(o+=encodeURIComponent(t.substring(s,c)),s=-1),o!==void 0&&(o+=t.charAt(c));else{o===void 0&&(o=t.substr(0,c));let n=h[u];n===void 0?s===-1&&(s=c):(s!==-1&&(o+=encodeURIComponent(t.substring(s,c)),s=-1),o+=n)}}return s!==-1&&(o+=encodeURIComponent(t.substring(s))),o===void 0?t:o}function y(t){let n;for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);o===35||o===63?(n===void 0&&(n=t.substr(0,i)),n+=h[o]):n!==void 0&&(n+=t[i])}return n===void 0?t:n}function v(t,n){let i;return i=t.authority&&t.path.length>1&&t.scheme===`file`?`//${t.authority}${t.path}`:t.path.charCodeAt(0)===47&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&t.path.charCodeAt(2)===58?n?t.path.substr(1):t.path[1].toLowerCase()+t.path.substr(2):t.path,o&&(i=i.replace(/\//g,`\\`)),i}function b(t,n){let i=n?y:m,o=``,{scheme:s,authority:c,path:u,query:f,fragment:p}=t;if(s&&(o+=s,o+=`:`),(c||s===`file`)&&(o+=`/`,o+=`/`),c){let t=c.indexOf(`@`);if(t!==-1){let n=c.substr(0,t);c=c.substr(t+1),t=n.lastIndexOf(`:`),t===-1?o+=i(n,!1,!1):(o+=i(n.substr(0,t),!1,!1),o+=`:`,o+=i(n.substr(t+1),!1,!0)),o+=`@`}c=c.toLowerCase(),t=c.lastIndexOf(`:`),t===-1?o+=i(c,!1,!0):(o+=i(c.substr(0,t),!1,!0),o+=c.substr(t))}if(u){if(u.length>=3&&u.charCodeAt(0)===47&&u.charCodeAt(2)===58){let t=u.charCodeAt(1);t>=65&&t<=90&&(u=`/${String.fromCharCode(t+32)}:${u.substr(3)}`)}else if(u.length>=2&&u.charCodeAt(1)===58){let t=u.charCodeAt(0);t>=65&&t<=90&&(u=`${String.fromCharCode(t+32)}:${u.substr(2)}`)}o+=i(u,!0,!1)}return f&&(o+=`?`,o+=i(f,!1,!1)),p&&(o+=`#`,o+=n?p:m(p,!1,!1)),o}function C(t){try{return decodeURIComponent(t)}catch{return t.length>3?t.substr(0,3)+C(t.substr(3)):t}}let g=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function w(t){return t.match(g)?t.replace(g,(t=>C(t))):t}var _=r(975);let x=_.posix||_;var S;(function(t){t.joinPath=function(t,...n){return t.with({path:x.join(t.path,...n)})},t.resolvePath=function(t,...n){let i=t.path,o=!1;i[0]!==`/`&&(i=`/`+i,o=!0);let s=x.resolve(i,...n);return o&&s[0]===`/`&&!t.authority&&(s=s.substring(1)),t.with({path:s})},t.dirname=function(t){if(t.path.length===0||t.path===`/`)return t;let n=x.dirname(t.path);return n.length===1&&n.charCodeAt(0)===46&&(n=``),t.with({path:n})},t.basename=function(t){return x.basename(t.path)},t.extname=function(t){return x.extname(t.path)}})(S||={}),jn=i})();const{URI:J,Utils:Mn}=jn;var Y;(function(t){t.basename=Mn.basename,t.dirname=Mn.dirname,t.extname=Mn.extname,t.joinPath=Mn.joinPath,t.resolvePath=Mn.resolvePath;let n=typeof process==`object`&&(process==null?void 0:process.platform)===`win32`;function equals(t,n){return t?.toString()===n?.toString()}t.equals=equals;function relative(t,i){let o=typeof t==`string`?J.parse(t).path:t.path,s=typeof i==`string`?J.parse(i).path:i.path,c=o.split(`/`).filter(t=>t.length>0),u=s.split(`/`).filter(t=>t.length>0);if(n){let t=/^[A-Z]:$/;if(c[0]&&t.test(c[0])&&(c[0]=c[0].toLowerCase()),u[0]&&t.test(u[0])&&(u[0]=u[0].toLowerCase()),c[0]!==u[0])return s.substring(1)}let f=0;for(;f<c.length&&c[f]===u[f];f++);return`../`.repeat(c.length-f)+u.slice(f).join(`/`)}t.relative=relative;function normalize(t){return J.parse(t.toString()).toString()}t.normalize=normalize})(Y||={});var X;(function(t){t[t.Changed=0]=`Changed`,t[t.Parsed=1]=`Parsed`,t[t.IndexedContent=2]=`IndexedContent`,t[t.ComputedScopes=3]=`ComputedScopes`,t[t.Linked=4]=`Linked`,t[t.IndexedReferences=5]=`IndexedReferences`,t[t.Validated=6]=`Validated`})(X||={});var DefaultLangiumDocumentFactory=class{constructor(t){this.serviceRegistry=t.ServiceRegistry,this.textDocuments=t.workspace.TextDocuments,this.fileSystemProvider=t.workspace.FileSystemProvider}async fromUri(t,n=q.CancellationToken.None){let i=await this.fileSystemProvider.readFile(t);return this.createAsync(t,i,n)}fromTextDocument(t,n,i){return n??=J.parse(t.uri),q.CancellationToken.is(i)?this.createAsync(n,t,i):this.create(n,t,i)}fromString(t,n,i){return q.CancellationToken.is(i)?this.createAsync(n,t,i):this.create(n,t,i)}fromModel(t,n){return this.create(n,{$model:t})}create(t,n,i){if(typeof n==`string`){let o=this.parse(t,n,i);return this.createLangiumDocument(o,t,void 0,n)}else if(`$model`in n){let i={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,t)}else{let o=this.parse(t,n.getText(),i);return this.createLangiumDocument(o,t,n)}}async createAsync(t,n,i){if(typeof n==`string`){let o=await this.parseAsync(t,n,i);return this.createLangiumDocument(o,t,void 0,n)}else{let o=await this.parseAsync(t,n.getText(),i);return this.createLangiumDocument(o,t,n)}}createLangiumDocument(t,n,i,o){let s;if(i)s={parseResult:t,uri:n,state:X.Parsed,references:[],textDocument:i};else{let i=this.createTextDocumentGetter(n,o);s={parseResult:t,uri:n,state:X.Parsed,references:[],get textDocument(){return i()}}}return t.value.$document=s,s}async update(t,n){let i=t.parseResult.value.$cstNode?.root.fullText,o=this.textDocuments?.get(t.uri.toString()),s=o?o.getText():await this.fileSystemProvider.readFile(t.uri);if(o)Object.defineProperty(t,`textDocument`,{value:o});else{let n=this.createTextDocumentGetter(t.uri,s);Object.defineProperty(t,`textDocument`,{get:n})}return i!==s&&(t.parseResult=await this.parseAsync(t.uri,s,n),t.parseResult.value.$document=t),t.state=X.Parsed,t}parse(t,n,i){return this.serviceRegistry.getServices(t).parser.LangiumParser.parse(n,i)}parseAsync(t,n,i){return this.serviceRegistry.getServices(t).parser.AsyncParser.parse(n,i)}createTextDocumentGetter(t,n){let i=this.serviceRegistry,o;return()=>o??=An.create(t.toString(),i.getServices(t).LanguageMetaData.languageId,0,n??``)}},DefaultLangiumDocuments=class{constructor(t){this.documentMap=new Map,this.langiumDocumentFactory=t.workspace.LangiumDocumentFactory,this.serviceRegistry=t.ServiceRegistry}get all(){return stream(this.documentMap.values())}addDocument(t){let n=t.uri.toString();if(this.documentMap.has(n))throw Error(`A document with the URI '${n}' is already present.`);this.documentMap.set(n,t)}getDocument(t){let n=t.toString();return this.documentMap.get(n)}async getOrCreateDocument(t,n){let i=this.getDocument(t);return i||(i=await this.langiumDocumentFactory.fromUri(t,n),this.addDocument(i),i)}createDocument(t,n,i){if(i)return this.langiumDocumentFactory.fromString(n,t,i).then(t=>(this.addDocument(t),t));{let i=this.langiumDocumentFactory.fromString(n,t);return this.addDocument(i),i}}hasDocument(t){return this.documentMap.has(t.toString())}invalidateDocument(t){let n=t.toString(),i=this.documentMap.get(n);return i&&(this.serviceRegistry.getServices(t).references.Linker.unlink(i),i.state=X.Changed,i.precomputedScopes=void 0,i.diagnostics=void 0),i}deleteDocument(t){let n=t.toString(),i=this.documentMap.get(n);return i&&(i.state=X.Changed,this.documentMap.delete(n)),i}};const Nn=Symbol(`ref_resolving`);var DefaultLinker=class{constructor(t){this.reflection=t.shared.AstReflection,this.langiumDocuments=()=>t.shared.workspace.LangiumDocuments,this.scopeProvider=t.references.ScopeProvider,this.astNodeLocator=t.workspace.AstNodeLocator}async link(t,n=q.CancellationToken.None){for(let i of streamAst(t.parseResult.value))await interruptAndCheck(n),streamReferences(i).forEach(n=>this.doLink(n,t))}doLink(t,n){let i=t.reference;if(i._ref===void 0){i._ref=Nn;try{let n=this.getCandidate(t);isLinkingError(n)?i._ref=n:(i._nodeDescription=n,this.langiumDocuments().hasDocument(n.documentUri)?i._ref=this.loadAstNode(n)??this.createLinkingError(t,n):i._ref=void 0)}catch(n){console.error(`An error occurred while resolving reference to '${i.$refText}':`,n);let o=n.message??String(n);i._ref=Object.assign(Object.assign({},t),{message:`An error occurred while resolving reference to '${i.$refText}': ${o}`})}n.references.push(i)}}unlink(t){for(let n of t.references)delete n._ref,delete n._nodeDescription;t.references=[]}getCandidate(t){return this.scopeProvider.getScope(t).getElement(t.reference.$refText)??this.createLinkingError(t)}buildReference(t,n,i,o){let s=this,c={$refNode:i,$refText:o,get ref(){if(isAstNode(this._ref))return this._ref;if(isAstNodeDescription(this._nodeDescription)){let i=s.loadAstNode(this._nodeDescription);this._ref=i??s.createLinkingError({reference:c,container:t,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=Nn;let i=findRootNode(t).$document,o=s.getLinkedNode({reference:c,container:t,property:n});if(o.error&&i&&i.state<X.ComputedScopes){this._ref=void 0;return}this._ref=o.node??o.error,this._nodeDescription=o.descr,i?.references.push(this)}else if(this._ref===Nn)throw Error(`Cyclic reference resolution detected: ${s.astNodeLocator.getAstNodePath(t)}/${n} (symbol '${o}')`);return isAstNode(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return isLinkingError(this._ref)?this._ref:void 0}};return c}getLinkedNode(t){try{let n=this.getCandidate(t);if(isLinkingError(n))return{error:n};let i=this.loadAstNode(n);return i?{node:i,descr:n}:{descr:n,error:this.createLinkingError(t,n)}}catch(n){console.error(`An error occurred while resolving reference to '${t.reference.$refText}':`,n);let i=n.message??String(n);return{error:Object.assign(Object.assign({},t),{message:`An error occurred while resolving reference to '${t.reference.$refText}': ${i}`})}}}loadAstNode(t){if(t.node)return t.node;let n=this.langiumDocuments().getDocument(t.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,t.path)}createLinkingError(t,n){let i=findRootNode(t.container).$document;i&&i.state<X.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${i.uri}).`);let o=this.reflection.getReferenceType(t);return Object.assign(Object.assign({},t),{message:`Could not resolve reference to ${o} named '${t.reference.$refText}'.`,targetDescription:n})}};function isNamed(t){return typeof t.name==`string`}var DefaultNameProvider=class{getName(t){if(isNamed(t))return t.name}getNameNode(t){return findNodeForProperty(t.$cstNode,`name`)}},DefaultReferences=class{constructor(t){this.nameProvider=t.references.NameProvider,this.index=t.shared.workspace.IndexManager,this.nodeLocator=t.workspace.AstNodeLocator}findDeclaration(t){if(t){let n=findAssignment(t),i=t.astNode;if(n&&i){let o=i[n.feature];if(isReference(o))return o.ref;if(Array.isArray(o)){for(let n of o)if(isReference(n)&&n.$refNode&&n.$refNode.offset<=t.offset&&n.$refNode.end>=t.end)return n.ref}}if(i){let n=this.nameProvider.getNameNode(i);if(n&&(n===t||isChildNode(t,n)))return i}}}findDeclarationNode(t){let n=this.findDeclaration(t);if(n?.$cstNode)return this.nameProvider.getNameNode(n)??n.$cstNode}findReferences(t,n){let i=[];if(n.includeDeclaration){let n=this.getReferenceToSelf(t);n&&i.push(n)}let o=this.index.findAllReferences(t,this.nodeLocator.getAstNodePath(t));return n.documentUri&&(o=o.filter(t=>Y.equals(t.sourceUri,n.documentUri))),i.push(...o),stream(i)}getReferenceToSelf(t){let n=this.nameProvider.getNameNode(t);if(n){let i=getDocument(t),o=this.nodeLocator.getAstNodePath(t);return{sourceUri:i.uri,sourcePath:o,targetUri:i.uri,targetPath:o,segment:toDocumentSegment(n),local:!0}}}},MultiMap=class{constructor(t){if(this.map=new Map,t)for(let[n,i]of t)this.add(n,i)}get size(){return M.sum(stream(this.map.values()).map(t=>t.length))}clear(){this.map.clear()}delete(t,n){if(n===void 0)return this.map.delete(t);{let i=this.map.get(t);if(i){let o=i.indexOf(n);if(o>=0)return i.length===1?this.map.delete(t):i.splice(o,1),!0}return!1}}get(t){return this.map.get(t)??[]}has(t,n){if(n===void 0)return this.map.has(t);{let i=this.map.get(t);return i?i.indexOf(n)>=0:!1}}add(t,n){return this.map.has(t)?this.map.get(t).push(n):this.map.set(t,[n]),this}addAll(t,n){return this.map.has(t)?this.map.get(t).push(...n):this.map.set(t,Array.from(n)),this}forEach(t){this.map.forEach((n,i)=>n.forEach(n=>t(n,i,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return stream(this.map.entries()).flatMap(([t,n])=>n.map(n=>[t,n]))}keys(){return stream(this.map.keys())}values(){return stream(this.map.values()).flat()}entriesGroupedByKey(){return stream(this.map.entries())}},BiMap=class{get size(){return this.map.size}constructor(t){if(this.map=new Map,this.inverse=new Map,t)for(let[n,i]of t)this.set(n,i)}clear(){this.map.clear(),this.inverse.clear()}set(t,n){return this.map.set(t,n),this.inverse.set(n,t),this}get(t){return this.map.get(t)}getKey(t){return this.inverse.get(t)}delete(t){let n=this.map.get(t);return n===void 0?!1:(this.map.delete(t),this.inverse.delete(n),!0)}},DefaultScopeComputation=class{constructor(t){this.nameProvider=t.references.NameProvider,this.descriptions=t.workspace.AstNodeDescriptionProvider}async computeExports(t,n=q.CancellationToken.None){return this.computeExportsForNode(t.parseResult.value,t,void 0,n)}async computeExportsForNode(t,n,i=streamContents,o=q.CancellationToken.None){let s=[];this.exportNode(t,s,n);for(let c of i(t))await interruptAndCheck(o),this.exportNode(c,s,n);return s}exportNode(t,n,i){let o=this.nameProvider.getName(t);o&&n.push(this.descriptions.createDescription(t,o,i))}async computeLocalScopes(t,n=q.CancellationToken.None){let i=t.parseResult.value,o=new MultiMap;for(let s of streamAllContents(i))await interruptAndCheck(n),this.processNode(s,t,o);return o}processNode(t,n,i){let o=t.$container;if(o){let s=this.nameProvider.getName(t);s&&i.add(o,this.descriptions.createDescription(t,s,n))}}},StreamScope=class{constructor(t,n,i){this.elements=t,this.outerScope=n,this.caseInsensitive=i?.caseInsensitive??!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(t){let n=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===t.toLowerCase()):this.elements.find(n=>n.name===t);if(n)return n;if(this.outerScope)return this.outerScope.getElement(t)}},MapScope=class{constructor(t,n,i){this.elements=new Map,this.caseInsensitive=i?.caseInsensitive??!1;for(let n of t){let t=this.caseInsensitive?n.name.toLowerCase():n.name;this.elements.set(t,n)}this.outerScope=n}getElement(t){let n=this.caseInsensitive?t.toLowerCase():t,i=this.elements.get(n);if(i)return i;if(this.outerScope)return this.outerScope.getElement(t)}getAllElements(){let t=stream(this.elements.values());return this.outerScope&&(t=t.concat(this.outerScope.getAllElements())),t}};const Pn={getElement(){},getAllElements(){return A}};var DisposableCache=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(t){this.toDispose.push(t)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(t=>t.dispose())}throwIfDisposed(){if(this.isDisposed)throw Error(`This cache has already been disposed`)}},SimpleCache=class extends DisposableCache{constructor(){super(...arguments),this.cache=new Map}has(t){return this.throwIfDisposed(),this.cache.has(t)}set(t,n){this.throwIfDisposed(),this.cache.set(t,n)}get(t,n){if(this.throwIfDisposed(),this.cache.has(t))return this.cache.get(t);if(n){let i=n();return this.cache.set(t,i),i}else return}delete(t){return this.throwIfDisposed(),this.cache.delete(t)}clear(){this.throwIfDisposed(),this.cache.clear()}},ContextCache=class extends DisposableCache{constructor(t){super(),this.cache=new Map,this.converter=t??(t=>t)}has(t,n){return this.throwIfDisposed(),this.cacheForContext(t).has(n)}set(t,n,i){this.throwIfDisposed(),this.cacheForContext(t).set(n,i)}get(t,n,i){this.throwIfDisposed();let o=this.cacheForContext(t);if(o.has(n))return o.get(n);if(i){let t=i();return o.set(n,t),t}else return}delete(t,n){return this.throwIfDisposed(),this.cacheForContext(t).delete(n)}clear(t){if(this.throwIfDisposed(),t){let n=this.converter(t);this.cache.delete(n)}else this.cache.clear()}cacheForContext(t){let n=this.converter(t),i=this.cache.get(n);return i||(i=new Map,this.cache.set(n,i)),i}},WorkspaceCache=class extends SimpleCache{constructor(t,n){super(),n?(this.toDispose.push(t.workspace.DocumentBuilder.onBuildPhase(n,()=>{this.clear()})),this.toDispose.push(t.workspace.DocumentBuilder.onUpdate((t,n)=>{n.length>0&&this.clear()}))):this.toDispose.push(t.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}},DefaultScopeProvider=class{constructor(t){this.reflection=t.shared.AstReflection,this.nameProvider=t.references.NameProvider,this.descriptions=t.workspace.AstNodeDescriptionProvider,this.indexManager=t.shared.workspace.IndexManager,this.globalScopeCache=new WorkspaceCache(t.shared)}getScope(t){let n=[],i=this.reflection.getReferenceType(t),o=getDocument(t.container).precomputedScopes;if(o){let s=t.container;do{let t=o.get(s);t.length>0&&n.push(stream(t).filter(t=>this.reflection.isSubtype(t.type,i))),s=s.$container}while(s)}let s=this.getGlobalScope(i,t);for(let t=n.length-1;t>=0;t--)s=this.createScope(n[t],s);return s}createScope(t,n,i){return new StreamScope(stream(t),n,i)}createScopeForNodes(t,n,i){return new StreamScope(stream(t).map(t=>{let n=this.nameProvider.getName(t);if(n)return this.descriptions.createDescription(t,n)}).nonNullable(),n,i)}getGlobalScope(t,n){return this.globalScopeCache.get(t,()=>new MapScope(this.indexManager.allElements(t)))}};function isAstNodeWithComment(t){return typeof t.$comment==`string`}function isIntermediateReference(t){return typeof t==`object`&&!!t&&(`$ref`in t||`$error`in t)}var DefaultJsonSerializer=class{constructor(t){this.ignoreProperties=new Set([`$container`,`$containerProperty`,`$containerIndex`,`$document`,`$cstNode`]),this.langiumDocuments=t.shared.workspace.LangiumDocuments,this.astNodeLocator=t.workspace.AstNodeLocator,this.nameProvider=t.references.NameProvider,this.commentProvider=t.documentation.CommentProvider}serialize(t,n){let i=n??{},o=n?.replacer,defaultReplacer=(t,n)=>this.replacer(t,n,i),s=o?(t,n)=>o(t,n,defaultReplacer):defaultReplacer;try{return this.currentDocument=getDocument(t),JSON.stringify(t,s,n?.space)}finally{this.currentDocument=void 0}}deserialize(t,n){let i=n??{},o=JSON.parse(t);return this.linkNode(o,o,i),o}replacer(t,n,{refText:i,sourceText:o,textRegions:s,comments:c,uriConverter:u}){if(!this.ignoreProperties.has(t))if(isReference(n)){let t=n.ref,o=i?n.$refText:void 0;if(t){let i=getDocument(t),s=``;this.currentDocument&&this.currentDocument!==i&&(s=u?u(i.uri,n):i.uri.toString());let c=this.astNodeLocator.getAstNodePath(t);return{$ref:`${s}#${c}`,$refText:o}}else return{$error:n.error?.message??`Could not resolve reference`,$refText:o}}else if(isAstNode(n)){let i;if(s&&(i=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!t||n.$document)&&i?.$textRegion&&(i.$textRegion.documentURI=this.currentDocument?.uri.toString())),o&&!t&&(i??=Object.assign({},n),i.$sourceText=n.$cstNode?.text),c){i??=Object.assign({},n);let t=this.commentProvider.getComment(n);t&&(i.$comment=t.replace(/\r/g,``))}return i??n}else return n}addAstNodeRegionWithAssignmentsTo(t){let createDocumentSegment=t=>({offset:t.offset,end:t.end,length:t.length,range:t.range});if(t.$cstNode){let n=t.$textRegion=createDocumentSegment(t.$cstNode),i=n.assignments={};return Object.keys(t).filter(t=>!t.startsWith(`$`)).forEach(n=>{let o=findNodesForProperty(t.$cstNode,n).map(createDocumentSegment);o.length!==0&&(i[n]=o)}),t}}linkNode(t,n,i,o,s,c){for(let[o,s]of Object.entries(t))if(Array.isArray(s))for(let c=0;c<s.length;c++){let u=s[c];isIntermediateReference(u)?s[c]=this.reviveReference(t,o,n,u,i):isAstNode(u)&&this.linkNode(u,n,i,t,o,c)}else isIntermediateReference(s)?t[o]=this.reviveReference(t,o,n,s,i):isAstNode(s)&&this.linkNode(s,n,i,t,o);let u=t;u.$container=o,u.$containerProperty=s,u.$containerIndex=c}reviveReference(t,n,i,o,s){let c=o.$refText,u=o.$error;if(o.$ref){let t=this.getRefNode(i,o.$ref,s.uriConverter);if(isAstNode(t))return c||=this.nameProvider.getName(t),{$refText:c??``,ref:t};u=t}if(u){let i={$refText:c??``};return i.error={container:t,property:n,message:u,reference:i},i}else return}getRefNode(t,n,i){try{let o=n.indexOf(`#`);if(o===0)return this.astNodeLocator.getAstNode(t,n.substring(1))||`Could not resolve path: `+n;if(o<0){let t=i?i(n):J.parse(n),o=this.langiumDocuments.getDocument(t);return o?o.parseResult.value:`Could not find document for URI: `+n}let s=i?i(n.substring(0,o)):J.parse(n.substring(0,o)),c=this.langiumDocuments.getDocument(s);return c?o===n.length-1?c.parseResult.value:this.astNodeLocator.getAstNode(c.parseResult.value,n.substring(o+1))||`Could not resolve URI: `+n:`Could not find document for URI: `+n}catch(t){return String(t)}}},DefaultServiceRegistry=class{get map(){return this.fileExtensionMap}constructor(t){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=t?.workspace.TextDocuments}register(t){let n=t.LanguageMetaData;for(let i of n.fileExtensions)this.fileExtensionMap.has(i)&&console.warn(`The file extension ${i} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileExtensionMap.set(i,t);if(n.fileNames)for(let i of n.fileNames)this.fileNameMap.has(i)&&console.warn(`The file name ${i} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileNameMap.set(i,t);this.languageIdMap.set(n.languageId,t),this.languageIdMap.size===1?this.singleton=t:this.singleton=void 0}getServices(t){if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw Error("The service registry is empty. Use `register` to register the services of a language.");let n=this.textDocuments?.get(t)?.languageId;if(n!==void 0){let t=this.languageIdMap.get(n);if(t)return t}let i=Y.extname(t),o=Y.basename(t),s=this.fileNameMap.get(o)??this.fileExtensionMap.get(i);if(!s)throw Error(n?`The service registry contains no services for the extension '${i}' for language '${n}'.`:`The service registry contains no services for the extension '${i}'.`);return s}hasServices(t){try{return this.getServices(t),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function diagnosticData(t){return{code:t}}var Fn;(function(t){t.all=[`fast`,`slow`,`built-in`]})(Fn||={});var ValidationRegistry=class{constructor(t){this.entries=new MultiMap,this.entriesBefore=[],this.entriesAfter=[],this.reflection=t.shared.AstReflection}register(t,n=this,i=`fast`){if(i===`built-in`)throw Error(`The 'built-in' category is reserved for lexer, parser, and linker errors.`);for(let[o,s]of Object.entries(t)){let t=s;if(Array.isArray(t))for(let s of t){let t={check:this.wrapValidationException(s,n),category:i};this.addEntry(o,t)}else if(typeof t==`function`){let s={check:this.wrapValidationException(t,n),category:i};this.addEntry(o,s)}else assertUnreachable(t)}}wrapValidationException(t,n){return async(i,o,s)=>{await this.handleException(()=>t.call(n,i,o,s),`An error occurred during validation`,o,i)}}async handleException(t,n,i,o){try{await t()}catch(t){if(isOperationCancelled(t))throw t;console.error(`${n}:`,t),t instanceof Error&&t.stack&&console.error(t.stack),i(`error`,`${n}: ${t instanceof Error?t.message:String(t)}`,{node:o})}}addEntry(t,n){if(t===`AstNode`){this.entries.add(`AstNode`,n);return}for(let i of this.reflection.getAllSubTypes(t))this.entries.add(i,n)}getChecks(t,n){let i=stream(this.entries.get(t)).concat(this.entries.get(`AstNode`));return n&&(i=i.filter(t=>n.includes(t.category))),i.map(t=>t.check)}registerBeforeDocument(t,n=this){this.entriesBefore.push(this.wrapPreparationException(t,`An error occurred during set-up of the validation`,n))}registerAfterDocument(t,n=this){this.entriesAfter.push(this.wrapPreparationException(t,`An error occurred during tear-down of the validation`,n))}wrapPreparationException(t,n,i){return async(o,s,c,u)=>{await this.handleException(()=>t.call(i,o,s,c,u),n,s,o)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}},DefaultDocumentValidator=class{constructor(t){this.validationRegistry=t.validation.ValidationRegistry,this.metadata=t.LanguageMetaData}async validateDocument(t,n={},i=q.CancellationToken.None){let o=t.parseResult,s=[];if(await interruptAndCheck(i),(!n.categories||n.categories.includes(`built-in`))&&(this.processLexingErrors(o,s,n),n.stopAfterLexingErrors&&s.some(t=>t.data?.code===In.LexingError)||(this.processParsingErrors(o,s,n),n.stopAfterParsingErrors&&s.some(t=>t.data?.code===In.ParsingError))||(this.processLinkingErrors(t,s,n),n.stopAfterLinkingErrors&&s.some(t=>t.data?.code===In.LinkingError))))return s;try{s.push(...await this.validateAst(o.value,n,i))}catch(t){if(isOperationCancelled(t))throw t;console.error(`An error occurred during validation:`,t)}return await interruptAndCheck(i),s}processLexingErrors(t,n,i){let o=[...t.lexerErrors,...t.lexerReport?.diagnostics??[]];for(let t of o){let i=t.severity??`error`,o={severity:toDiagnosticSeverity(i),range:{start:{line:t.line-1,character:t.column-1},end:{line:t.line-1,character:t.column+t.length-1}},message:t.message,data:toDiagnosticData(i),source:this.getSource()};n.push(o)}}processParsingErrors(t,n,i){for(let i of t.parserErrors){let t;if(isNaN(i.token.startOffset)){if(`previousToken`in i){let n=i.previousToken;if(isNaN(n.startOffset)){let n={line:0,character:0};t={start:n,end:n}}else{let i={line:n.endLine-1,character:n.endColumn};t={start:i,end:i}}}}else t=tokenToRange(i.token);if(t){let o={severity:toDiagnosticSeverity(`error`),range:t,message:i.message,data:diagnosticData(In.ParsingError),source:this.getSource()};n.push(o)}}}processLinkingErrors(t,n,i){for(let i of t.references){let t=i.error;if(t){let i={node:t.container,property:t.property,index:t.index,data:{code:In.LinkingError,containerType:t.container.$type,property:t.property,refText:t.reference.$refText}};n.push(this.toDiagnostic(`error`,t.message,i))}}}async validateAst(t,n,i=q.CancellationToken.None){let o=[],acceptor=(t,n,i)=>{o.push(this.toDiagnostic(t,n,i))};return await this.validateAstBefore(t,n,acceptor,i),await this.validateAstNodes(t,n,acceptor,i),await this.validateAstAfter(t,n,acceptor,i),o}async validateAstBefore(t,n,i,o=q.CancellationToken.None){let s=this.validationRegistry.checksBefore;for(let c of s)await interruptAndCheck(o),await c(t,i,n.categories??[],o)}async validateAstNodes(t,n,i,o=q.CancellationToken.None){await Promise.all(streamAst(t).map(async t=>{await interruptAndCheck(o);let s=this.validationRegistry.getChecks(t.$type,n.categories);for(let n of s)await n(t,i,o)}))}async validateAstAfter(t,n,i,o=q.CancellationToken.None){let s=this.validationRegistry.checksAfter;for(let c of s)await interruptAndCheck(o),await c(t,i,n.categories??[],o)}toDiagnostic(t,n,i){return{message:n,range:getDiagnosticRange(i),severity:toDiagnosticSeverity(t),code:i.code,codeDescription:i.codeDescription,tags:i.tags,relatedInformation:i.relatedInformation,data:i.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function getDiagnosticRange(t){if(t.range)return t.range;let n;return typeof t.property==`string`?n=findNodeForProperty(t.node.$cstNode,t.property,t.index):typeof t.keyword==`string`&&(n=findNodeForKeyword(t.node.$cstNode,t.keyword,t.index)),n??=t.node.$cstNode,n?n.range:{start:{line:0,character:0},end:{line:0,character:0}}}function toDiagnosticSeverity(t){switch(t){case`error`:return 1;case`warning`:return 2;case`info`:return 3;case`hint`:return 4;default:throw Error(`Invalid diagnostic severity: `+t)}}function toDiagnosticData(t){switch(t){case`error`:return diagnosticData(In.LexingError);case`warning`:return diagnosticData(In.LexingWarning);case`info`:return diagnosticData(In.LexingInfo);case`hint`:return diagnosticData(In.LexingHint);default:throw Error(`Invalid diagnostic severity: `+t)}}var In;(function(t){t.LexingError=`lexing-error`,t.LexingWarning=`lexing-warning`,t.LexingInfo=`lexing-info`,t.LexingHint=`lexing-hint`,t.ParsingError=`parsing-error`,t.LinkingError=`linking-error`})(In||={});var DefaultAstNodeDescriptionProvider=class{constructor(t){this.astNodeLocator=t.workspace.AstNodeLocator,this.nameProvider=t.references.NameProvider}createDescription(t,n,i){let o=i??getDocument(t);n??=this.nameProvider.getName(t);let s=this.astNodeLocator.getAstNodePath(t);if(!n)throw Error(`Node at path ${s} has no name.`);let c,nameSegmentGetter=()=>c??=toDocumentSegment(this.nameProvider.getNameNode(t)??t.$cstNode);return{node:t,name:n,get nameSegment(){return nameSegmentGetter()},selectionSegment:toDocumentSegment(t.$cstNode),type:t.$type,documentUri:o.uri,path:s}}},DefaultReferenceDescriptionProvider=class{constructor(t){this.nodeLocator=t.workspace.AstNodeLocator}async createDescriptions(t,n=q.CancellationToken.None){let i=[],o=t.parseResult.value;for(let t of streamAst(o))await interruptAndCheck(n),streamReferences(t).filter(t=>!isLinkingError(t)).forEach(t=>{let n=this.createDescription(t);n&&i.push(n)});return i}createDescription(t){let n=t.reference.$nodeDescription,i=t.reference.$refNode;if(!n||!i)return;let o=getDocument(t.container).uri;return{sourceUri:o,sourcePath:this.nodeLocator.getAstNodePath(t.container),targetUri:n.documentUri,targetPath:n.path,segment:toDocumentSegment(i),local:Y.equals(n.documentUri,o)}}},DefaultAstNodeLocator=class{constructor(){this.segmentSeparator=`/`,this.indexSeparator=`@`}getAstNodePath(t){if(t.$container){let n=this.getAstNodePath(t.$container),i=this.getPathSegment(t);return n+this.segmentSeparator+i}return``}getPathSegment({$containerProperty:t,$containerIndex:n}){if(!t)throw Error(`Missing '$containerProperty' in AST node.`);return n===void 0?t:t+this.indexSeparator+n}getAstNode(t,n){return n.split(this.segmentSeparator).reduce((t,n)=>{if(!t||n.length===0)return t;let i=n.indexOf(this.indexSeparator);if(i>0){let o=n.substring(0,i),s=parseInt(n.substring(i+1));return t[o]?.[s]}return t[n]},t)}},Ln=c({});t(Ln,n(Tn(),1));var DefaultConfigurationProvider=class{constructor(t){this._ready=new Deferred,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Ln.Emitter,this.serviceRegistry=t.ServiceRegistry}get ready(){return this._ready.promise}initialize(t){this.workspaceConfig=t.capabilities.workspace?.configuration??!1}async initialized(t){if(this.workspaceConfig){if(t.register){let n=this.serviceRegistry.all;t.register({section:n.map(t=>this.toSectionName(t.LanguageMetaData.languageId))})}if(t.fetchConfiguration){let n=this.serviceRegistry.all.map(t=>({section:this.toSectionName(t.LanguageMetaData.languageId)})),i=await t.fetchConfiguration(n);n.forEach((t,n)=>{this.updateSectionConfiguration(t.section,i[n])})}}this._ready.resolve()}updateConfiguration(t){t.settings&&Object.keys(t.settings).forEach(n=>{let i=t.settings[n];this.updateSectionConfiguration(n,i),this.onConfigurationSectionUpdateEmitter.fire({section:n,configuration:i})})}updateSectionConfiguration(t,n){this.settings[t]=n}async getConfiguration(t,n){await this.ready;let i=this.toSectionName(t);if(this.settings[i])return this.settings[i][n]}toSectionName(t){return`${t}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}},Rn;(function(t){function create(t){return{dispose:async()=>await t()}}t.create=create})(Rn||={});var DefaultDocumentBuilder=class{constructor(t){this.updateBuildOptions={validation:{categories:[`built-in`,`fast`]}},this.updateListeners=[],this.buildPhaseListeners=new MultiMap,this.documentPhaseListeners=new MultiMap,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=X.Changed,this.langiumDocuments=t.workspace.LangiumDocuments,this.langiumDocumentFactory=t.workspace.LangiumDocumentFactory,this.textDocuments=t.workspace.TextDocuments,this.indexManager=t.workspace.IndexManager,this.serviceRegistry=t.ServiceRegistry}async build(t,n={},i=q.CancellationToken.None){for(let i of t){let t=i.uri.toString();if(i.state===X.Validated){if(typeof n.validation==`boolean`&&n.validation)i.state=X.IndexedReferences,i.diagnostics=void 0,this.buildState.delete(t);else if(typeof n.validation==`object`){let o=this.buildState.get(t),s=o?.result?.validationChecks;if(s){let c=(n.validation.categories??Fn.all).filter(t=>!s.includes(t));c.length>0&&(this.buildState.set(t,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:c})},result:o.result}),i.state=X.IndexedReferences)}}}else this.buildState.delete(t)}this.currentState=X.Changed,await this.emitUpdate(t.map(t=>t.uri),[]),await this.buildDocuments(t,n,i)}async update(t,n,i=q.CancellationToken.None){this.currentState=X.Changed;for(let t of n)this.langiumDocuments.deleteDocument(t),this.buildState.delete(t.toString()),this.indexManager.remove(t);for(let n of t){if(!this.langiumDocuments.invalidateDocument(n)){let t=this.langiumDocumentFactory.fromModel({$type:`INVALID`},n);t.state=X.Changed,this.langiumDocuments.addDocument(t)}this.buildState.delete(n.toString())}let o=stream(t).concat(n).map(t=>t.toString()).toSet();this.langiumDocuments.all.filter(t=>!o.has(t.uri.toString())&&this.shouldRelink(t,o)).forEach(t=>{this.serviceRegistry.getServices(t.uri).references.Linker.unlink(t),t.state=Math.min(t.state,X.ComputedScopes),t.diagnostics=void 0}),await this.emitUpdate(t,n),await interruptAndCheck(i);let s=this.sortDocuments(this.langiumDocuments.all.filter(t=>t.state<X.Linked||!this.buildState.get(t.uri.toString())?.completed).toArray());await this.buildDocuments(s,this.updateBuildOptions,i)}async emitUpdate(t,n){await Promise.all(this.updateListeners.map(i=>i(t,n)))}sortDocuments(t){let n=0,i=t.length-1;for(;n<i;){for(;n<t.length&&this.hasTextDocument(t[n]);)n++;for(;i>=0&&!this.hasTextDocument(t[i]);)i--;n<i&&([t[n],t[i]]=[t[i],t[n]])}return t}hasTextDocument(t){return!!this.textDocuments?.get(t.uri)}shouldRelink(t,n){return t.references.some(t=>t.error!==void 0)?!0:this.indexManager.isAffected(t,n)}onUpdate(t){return this.updateListeners.push(t),Rn.create(()=>{let n=this.updateListeners.indexOf(t);n>=0&&this.updateListeners.splice(n,1)})}async buildDocuments(t,n,i){this.prepareBuild(t,n),await this.runCancelable(t,X.Parsed,i,t=>this.langiumDocumentFactory.update(t,i)),await this.runCancelable(t,X.IndexedContent,i,t=>this.indexManager.updateContent(t,i)),await this.runCancelable(t,X.ComputedScopes,i,async t=>{t.precomputedScopes=await this.serviceRegistry.getServices(t.uri).references.ScopeComputation.computeLocalScopes(t,i)});let o=t.filter(t=>this.shouldLink(t));await this.runCancelable(o,X.Linked,i,t=>this.serviceRegistry.getServices(t.uri).references.Linker.link(t,i)),await this.runCancelable(o,X.IndexedReferences,i,t=>this.indexManager.updateReferences(t,i));let s=t.filter(t=>this.shouldValidate(t));await this.runCancelable(s,X.Validated,i,t=>this.validate(t,i));for(let n of t){let t=this.buildState.get(n.uri.toString());t&&(t.completed=!0)}}prepareBuild(t,n){for(let i of t){let t=i.uri.toString(),o=this.buildState.get(t);(!o||o.completed)&&this.buildState.set(t,{completed:!1,options:n,result:o?.result})}}async runCancelable(t,n,i,o){let s=t.filter(t=>t.state<n);for(let t of s)await interruptAndCheck(i),await o(t),t.state=n,await this.notifyDocumentPhase(t,n,i);let c=t.filter(t=>t.state===n);await this.notifyBuildPhase(c,n,i),this.currentState=n}onBuildPhase(t,n){return this.buildPhaseListeners.add(t,n),Rn.create(()=>{this.buildPhaseListeners.delete(t,n)})}onDocumentPhase(t,n){return this.documentPhaseListeners.add(t,n),Rn.create(()=>{this.documentPhaseListeners.delete(t,n)})}waitUntil(t,n,i){let o;if(n&&`path`in n?o=n:i=n,i??=q.CancellationToken.None,o){let n=this.langiumDocuments.getDocument(o);if(n&&n.state>=t)return Promise.resolve(o)}return this.currentState>=t?Promise.resolve(void 0):i.isCancellationRequested?Promise.reject(On):new Promise((n,s)=>{let c=this.onBuildPhase(t,()=>{c.dispose(),u.dispose(),n(o?this.langiumDocuments.getDocument(o)?.uri:void 0)}),u=i.onCancellationRequested(()=>{c.dispose(),u.dispose(),s(On)})})}async notifyDocumentPhase(t,n,i){let o=this.documentPhaseListeners.get(n).slice();for(let n of o)try{await n(t,i)}catch(t){if(!isOperationCancelled(t))throw t}}async notifyBuildPhase(t,n,i){if(t.length===0)return;let o=this.buildPhaseListeners.get(n).slice();for(let n of o)await interruptAndCheck(i),await n(t,i)}shouldLink(t){return this.getBuildOptions(t).eagerLinking??!0}shouldValidate(t){return!!this.getBuildOptions(t).validation}async validate(t,n){let i=this.serviceRegistry.getServices(t.uri).validation.DocumentValidator,o=this.getBuildOptions(t).validation,s=typeof o==`object`?o:void 0,c=await i.validateDocument(t,s,n);t.diagnostics?t.diagnostics.push(...c):t.diagnostics=c;let u=this.buildState.get(t.uri.toString());if(u){u.result??={};let t=s?.categories??Fn.all;u.result.validationChecks?u.result.validationChecks.push(...t):u.result.validationChecks=[...t]}}getBuildOptions(t){return this.buildState.get(t.uri.toString())?.options??{}}},DefaultIndexManager=class{constructor(t){this.symbolIndex=new Map,this.symbolByTypeIndex=new ContextCache,this.referenceIndex=new Map,this.documents=t.workspace.LangiumDocuments,this.serviceRegistry=t.ServiceRegistry,this.astReflection=t.AstReflection}findAllReferences(t,n){let i=getDocument(t).uri,o=[];return this.referenceIndex.forEach(t=>{t.forEach(t=>{Y.equals(t.targetUri,i)&&t.targetPath===n&&o.push(t)})}),stream(o)}allElements(t,n){let i=stream(this.symbolIndex.keys());return n&&(i=i.filter(t=>!n||n.has(t))),i.map(n=>this.getFileDescriptions(n,t)).flat()}getFileDescriptions(t,n){return n?this.symbolByTypeIndex.get(t,n,()=>(this.symbolIndex.get(t)??[]).filter(t=>this.astReflection.isSubtype(t.type,n))):this.symbolIndex.get(t)??[]}remove(t){let n=t.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n),this.referenceIndex.delete(n)}async updateContent(t,n=q.CancellationToken.None){let i=await this.serviceRegistry.getServices(t.uri).references.ScopeComputation.computeExports(t,n),o=t.uri.toString();this.symbolIndex.set(o,i),this.symbolByTypeIndex.clear(o)}async updateReferences(t,n=q.CancellationToken.None){let i=await this.serviceRegistry.getServices(t.uri).workspace.ReferenceDescriptionProvider.createDescriptions(t,n);this.referenceIndex.set(t.uri.toString(),i)}isAffected(t,n){let i=this.referenceIndex.get(t.uri.toString());return i?i.some(t=>!t.local&&n.has(t.targetUri.toString())):!1}},DefaultWorkspaceManager=class{constructor(t){this.initialBuildOptions={},this._ready=new Deferred,this.serviceRegistry=t.ServiceRegistry,this.langiumDocuments=t.workspace.LangiumDocuments,this.documentBuilder=t.workspace.DocumentBuilder,this.fileSystemProvider=t.workspace.FileSystemProvider,this.mutex=t.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(t){this.folders=t.workspaceFolders??void 0}initialized(t){return this.mutex.write(t=>this.initializeWorkspace(this.folders??[],t))}async initializeWorkspace(t,n=q.CancellationToken.None){let i=await this.performStartup(t);await interruptAndCheck(n),await this.documentBuilder.build(i,this.initialBuildOptions,n)}async performStartup(t){let n=this.serviceRegistry.all.flatMap(t=>t.LanguageMetaData.fileExtensions),i=this.serviceRegistry.all.flatMap(t=>t.LanguageMetaData.fileNames??[]),o=[],collector=t=>{o.push(t),this.langiumDocuments.hasDocument(t.uri)||this.langiumDocuments.addDocument(t)};return await this.loadAdditionalDocuments(t,collector),await Promise.all(t.map(t=>[t,this.getRootFolder(t)]).map(async t=>this.traverseFolder(...t,{fileExtensions:n,fileNames:i},collector))),this._ready.resolve(),o}loadAdditionalDocuments(t,n){return Promise.resolve()}getRootFolder(t){return J.parse(t.uri)}async traverseFolder(t,n,i,o){let s=await this.fileSystemProvider.readDirectory(n);await Promise.all(s.map(async n=>{this.includeEntry(t,n,i)&&(n.isDirectory?await this.traverseFolder(t,n.uri,i,o):n.isFile&&o(await this.langiumDocuments.getOrCreateDocument(n.uri)))}))}includeEntry(t,n,i){let o=Y.basename(n.uri);return o.startsWith(`.`)?!1:n.isDirectory?o!==`node_modules`&&o!==`out`:n.isFile?i.fileExtensions.includes(Y.extname(n.uri))||i.fileNames.includes(Y.basename(n.uri)):!1}},DefaultLexerErrorMessageProvider=class{buildUnexpectedCharactersMessage(t,n,i,o,s){return D.buildUnexpectedCharactersMessage(t,n,i,o,s)}buildUnableToPopLexerModeMessage(t){return D.buildUnableToPopLexerModeMessage(t)}};const zn={mode:`full`};var DefaultLexer=class{constructor(t){this.errorMessageProvider=t.parser.LexerErrorMessageProvider,this.tokenBuilder=t.parser.TokenBuilder;let n=this.tokenBuilder.buildTokens(t.Grammar,{caseInsensitive:t.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);let i=isTokenTypeDictionary(n)?Object.values(n):n,o=t.LanguageMetaData.mode===`production`;this.chevrotainLexer=new _(i,{positionTracking:`full`,skipValidations:o,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(t,n=zn){var i;let o=this.chevrotainLexer.tokenize(t);return{tokens:o.tokens,errors:o.errors,hidden:o.groups.hidden??[],report:(i=this.tokenBuilder).flushLexingReport?.call(i,t)}}toTokenTypeDictionary(t){if(isTokenTypeDictionary(t))return t;let n=isIMultiModeLexerDefinition(t)?Object.values(t.modes).flat():t,i={};return n.forEach(t=>i[t.name]=t),i}};function isTokenTypeArray(t){return Array.isArray(t)&&(t.length===0||`name`in t[0])}function isIMultiModeLexerDefinition(t){return t&&`modes`in t&&`defaultMode`in t}function isTokenTypeDictionary(t){return!isTokenTypeArray(t)&&!isIMultiModeLexerDefinition(t)}vn();function parseJSDoc(t,n,i){let o,s;typeof t==`string`?(s=n,o=i):(s=t.range.start,o=n),s||=U.create(0,0);let c=getLines(t),u=normalizeOptions(o);return parseJSDocComment({index:0,tokens:tokenize({lines:c,position:s,options:u}),position:s})}function isJSDoc(t,n){let i=normalizeOptions(n),o=getLines(t);if(o.length===0)return!1;let s=o[0],c=o[o.length-1],u=i.start,f=i.end;return!!u?.exec(s)&&!!f?.exec(c)}function getLines(t){let n=``;return n=typeof t==`string`?t:t.text,n.split(Ve)}const Bn=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,Vn=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function tokenize(t){let n=[],i=t.position.line,o=t.position.character;for(let s=0;s<t.lines.length;s++){let c=s===0,u=s===t.lines.length-1,f=t.lines[s],p=0;if(c&&t.options.start){let n=t.options.start?.exec(f);n&&(p=n.index+n[0].length)}else{let n=t.options.line?.exec(f);n&&(p=n.index+n[0].length)}if(u){let n=t.options.end?.exec(f);n&&(f=f.substring(0,n.index))}if(f=f.substring(0,lastCharacter(f)),skipWhitespace(f,p)>=f.length){if(n.length>0){let t=U.create(i,o);n.push({type:`break`,content:``,range:W.create(t,t)})}}else{Bn.lastIndex=p;let t=Bn.exec(f);if(t){let s=t[0],c=t[1],u=U.create(i,o+p),h=U.create(i,o+p+s.length);n.push({type:`tag`,content:c,range:W.create(u,h)}),p+=s.length,p=skipWhitespace(f,p)}if(p<f.length){let t=f.substring(p),s=Array.from(t.matchAll(Vn));n.push(...buildInlineTokens(s,t,i,o+p))}}i++,o=0}return n.length>0&&n[n.length-1].type===`break`?n.slice(0,-1):n}function buildInlineTokens(t,n,i,o){let s=[];if(t.length===0){let t=U.create(i,o),c=U.create(i,o+n.length);s.push({type:`text`,content:n,range:W.create(t,c)})}else{let c=0;for(let u of t){let t=u.index,f=n.substring(c,t);f.length>0&&s.push({type:`text`,content:n.substring(c,t),range:W.create(U.create(i,c+o),U.create(i,t+o))});let p=f.length+1,h=u[1];if(s.push({type:`inline-tag`,content:h,range:W.create(U.create(i,c+p+o),U.create(i,c+p+h.length+o))}),p+=h.length,u.length===4){p+=u[2].length;let t=u[3];s.push({type:`text`,content:t,range:W.create(U.create(i,c+p+o),U.create(i,c+p+t.length+o))})}else s.push({type:`text`,content:``,range:W.create(U.create(i,c+p+o),U.create(i,c+p+o))});c=t+u[0].length}let u=n.substring(c);u.length>0&&s.push({type:`text`,content:u,range:W.create(U.create(i,c+o),U.create(i,c+o+u.length))})}return s}const Hn=/\S/,Un=/\s*$/;function skipWhitespace(t,n){let i=t.substring(n).match(Hn);return i?n+i.index:t.length}function lastCharacter(t){let n=t.match(Un);if(n&&typeof n.index==`number`)return n.index}function parseJSDocComment(t){let n=U.create(t.position.line,t.position.character);if(t.tokens.length===0)return new JSDocCommentImpl([],W.create(n,n));let i=[];for(;t.index<t.tokens.length;){let n=parseJSDocElement(t,i[i.length-1]);n&&i.push(n)}let o=i[0]?.range.start??n,s=i[i.length-1]?.range.end??n;return new JSDocCommentImpl(i,W.create(o,s))}function parseJSDocElement(t,n){let i=t.tokens[t.index];if(i.type===`tag`)return parseJSDocTag(t,!1);if(i.type===`text`||i.type===`inline-tag`)return parseJSDocText(t);appendEmptyLine(i,n),t.index++}function appendEmptyLine(t,n){if(n){let i=new JSDocLineImpl(``,t.range);`inlines`in n?n.inlines.push(i):n.content.inlines.push(i)}}function parseJSDocText(t){let n=t.tokens[t.index],i=n,o=n,s=[];for(;n&&n.type!==`break`&&n.type!==`tag`;)s.push(parseJSDocInline(t)),o=n,n=t.tokens[t.index];return new JSDocTextImpl(s,W.create(i.range.start,o.range.end))}function parseJSDocInline(t){return t.tokens[t.index].type===`inline-tag`?parseJSDocTag(t,!0):parseJSDocLine(t)}function parseJSDocTag(t,n){let i=t.tokens[t.index++],o=i.content.substring(1);if(t.tokens[t.index]?.type===`text`)if(n){let s=parseJSDocLine(t);return new JSDocTagImpl(o,new JSDocTextImpl([s],s.range),n,W.create(i.range.start,s.range.end))}else{let s=parseJSDocText(t);return new JSDocTagImpl(o,s,n,W.create(i.range.start,s.range.end))}else{let t=i.range;return new JSDocTagImpl(o,new JSDocTextImpl([],t),n,t)}}function parseJSDocLine(t){let n=t.tokens[t.index++];return new JSDocLineImpl(n.content,n.range)}function normalizeOptions(t){if(!t)return normalizeOptions({start:`/**`,end:`*/`,line:`*`});let{start:n,end:i,line:o}=t;return{start:normalizeOption(n,!0),end:normalizeOption(i,!1),line:normalizeOption(o,!0)}}function normalizeOption(t,n){if(typeof t==`string`||typeof t==`object`){let i=typeof t==`string`?escapeRegExp(t):t.source;return RegExp(n?`^\\s*${i}`:`\\s*${i}\\s*$`)}else return t}var JSDocCommentImpl=class{constructor(t,n){this.elements=t,this.range=n}getTag(t){return this.getAllTags().find(n=>n.name===t)}getTags(t){return this.getAllTags().filter(n=>n.name===t)}getAllTags(){return this.elements.filter(t=>`name`in t)}toString(){let t=``;for(let n of this.elements)if(t.length===0)t=n.toString();else{let i=n.toString();t+=fillNewlines(t)+i}return t.trim()}toMarkdown(t){let n=``;for(let i of this.elements)if(n.length===0)n=i.toMarkdown(t);else{let o=i.toMarkdown(t);n+=fillNewlines(n)+o}return n.trim()}},JSDocTagImpl=class{constructor(t,n,i,o){this.name=t,this.content=n,this.inline=i,this.range=o}toString(){let t=`@${this.name}`,n=this.content.toString();return this.content.inlines.length===1?t=`${t} ${n}`:this.content.inlines.length>1&&(t=`${t}\n${n}`),this.inline?`{${t}}`:t}toMarkdown(t){return(t?.renderTag)?.call(t,this)??this.toMarkdownDefault(t)}toMarkdownDefault(t){let n=this.content.toMarkdown(t);if(this.inline){let i=renderInlineTag(this.name,n,t??{});if(typeof i==`string`)return i}let i=``;t?.tag===`italic`||t?.tag===void 0?i=`*`:t?.tag===`bold`?i=`**`:t?.tag===`bold-italic`&&(i=`***`);let o=`${i}@${this.name}${i}`;return this.content.inlines.length===1?o=`${o} — ${n}`:this.content.inlines.length>1&&(o=`${o}\n${n}`),this.inline?`{${o}}`:o}};function renderInlineTag(t,n,i){if(t===`linkplain`||t===`linkcode`||t===`link`){let o=n.indexOf(` `),s=n;if(o>0){let t=skipWhitespace(n,o);s=n.substring(t),n=n.substring(0,o)}return(t===`linkcode`||t===`link`&&i.link===`code`)&&(s=`\`${s}\``),i.renderLink?.call(i,n,s)??renderLinkDefault(n,s)}}function renderLinkDefault(t,n){try{return J.parse(t,!0),`[${n}](${t})`}catch{return t}}var JSDocTextImpl=class{constructor(t,n){this.inlines=t,this.range=n}toString(){let t=``;for(let n=0;n<this.inlines.length;n++){let i=this.inlines[n],o=this.inlines[n+1];t+=i.toString(),o&&o.range.start.line>i.range.start.line&&(t+=`
10
+ `)}return t}toMarkdown(t){let n=``;for(let i=0;i<this.inlines.length;i++){let o=this.inlines[i],s=this.inlines[i+1];n+=o.toMarkdown(t),s&&s.range.start.line>o.range.start.line&&(n+=`
11
+ `)}return n}},JSDocLineImpl=class{constructor(t,n){this.text=t,this.range=n}toString(){return this.text}toMarkdown(){return this.text}};function fillNewlines(t){return t.endsWith(`
12
+ `)?`
13
+ `:`
14
+
15
+ `}var JSDocDocumentationProvider=class{constructor(t){this.indexManager=t.shared.workspace.IndexManager,this.commentProvider=t.documentation.CommentProvider}getDocumentation(t){let n=this.commentProvider.getComment(t);if(n&&isJSDoc(n))return parseJSDoc(n).toMarkdown({renderLink:(n,i)=>this.documentationLinkRenderer(t,n,i),renderTag:n=>this.documentationTagRenderer(t,n)})}documentationLinkRenderer(t,n,i){let o=this.findNameInPrecomputedScopes(t,n)??this.findNameInGlobalScope(t,n);if(o&&o.nameSegment){let t=o.nameSegment.range.start.line+1,n=o.nameSegment.range.start.character+1;return`[${i}](${o.documentUri.with({fragment:`L${t},${n}`}).toString()})`}else return}documentationTagRenderer(t,n){}findNameInPrecomputedScopes(t,n){let i=getDocument(t).precomputedScopes;if(!i)return;let o=t;do{let t=i.get(o).find(t=>t.name===n);if(t)return t;o=o.$container}while(o)}findNameInGlobalScope(t,n){return this.indexManager.allElements().find(t=>t.name===n)}},DefaultCommentProvider=class{constructor(t){this.grammarConfig=()=>t.parser.GrammarConfig}getComment(t){return isAstNodeWithComment(t)?t.$comment:findCommentNode(t.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},DefaultAsyncParser=class{constructor(t){this.syncParser=t.parser.LangiumParser}parse(t,n){return Promise.resolve(this.syncParser.parse(t))}},DefaultWorkspaceLock=class{constructor(){this.previousTokenSource=new q.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(t){this.cancelWrite();let n=startCancelableOperation();return this.previousTokenSource=n,this.enqueue(this.writeQueue,t,n.token)}read(t){return this.enqueue(this.readQueue,t)}enqueue(t,n,i=q.CancellationToken.None){let o=new Deferred,s={action:n,deferred:o,cancellationToken:i};return t.push(s),this.performNextOperation(),o.promise}async performNextOperation(){if(!this.done)return;let t=[];if(this.writeQueue.length>0)t.push(this.writeQueue.shift());else if(this.readQueue.length>0)t.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(t.map(async({action:t,deferred:n,cancellationToken:i})=>{try{let o=await Promise.resolve().then(()=>t(i));n.resolve(o)}catch(t){isOperationCancelled(t)?n.resolve(void 0):n.reject(t)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}},DefaultHydrator=class{constructor(t){this.grammarElementIdMap=new BiMap,this.tokenTypeIdMap=new BiMap,this.grammar=t.Grammar,this.lexer=t.parser.Lexer,this.linker=t.references.Linker}dehydrate(t){return{lexerErrors:t.lexerErrors,lexerReport:t.lexerReport?this.dehydrateLexerReport(t.lexerReport):void 0,parserErrors:t.parserErrors.map(t=>Object.assign(Object.assign({},t),{message:t.message})),value:this.dehydrateAstNode(t.value,this.createDehyrationContext(t.value))}}dehydrateLexerReport(t){return t}createDehyrationContext(t){let n=new Map,i=new Map;for(let i of streamAst(t))n.set(i,{});if(t.$cstNode)for(let n of streamCst(t.$cstNode))i.set(n,{});return{astNodes:n,cstNodes:i}}dehydrateAstNode(t,n){let i=n.astNodes.get(t);i.$type=t.$type,i.$containerIndex=t.$containerIndex,i.$containerProperty=t.$containerProperty,t.$cstNode!==void 0&&(i.$cstNode=this.dehydrateCstNode(t.$cstNode,n));for(let[o,s]of Object.entries(t))if(!o.startsWith(`$`))if(Array.isArray(s)){let t=[];i[o]=t;for(let i of s)isAstNode(i)?t.push(this.dehydrateAstNode(i,n)):isReference(i)?t.push(this.dehydrateReference(i,n)):t.push(i)}else isAstNode(s)?i[o]=this.dehydrateAstNode(s,n):isReference(s)?i[o]=this.dehydrateReference(s,n):s!==void 0&&(i[o]=s);return i}dehydrateReference(t,n){let i={};return i.$refText=t.$refText,t.$refNode&&(i.$refNode=n.cstNodes.get(t.$refNode)),i}dehydrateCstNode(t,n){let i=n.cstNodes.get(t);return isRootCstNode(t)?i.fullText=t.fullText:i.grammarSource=this.getGrammarElementId(t.grammarSource),i.hidden=t.hidden,i.astNode=n.astNodes.get(t.astNode),isCompositeCstNode(t)?i.content=t.content.map(t=>this.dehydrateCstNode(t,n)):isLeafCstNode(t)&&(i.tokenType=t.tokenType.name,i.offset=t.offset,i.length=t.length,i.startLine=t.range.start.line,i.startColumn=t.range.start.character,i.endLine=t.range.end.line,i.endColumn=t.range.end.character),i}hydrate(t){let n=t.value,i=this.createHydrationContext(n);return`$cstNode`in n&&this.hydrateCstNode(n.$cstNode,i),{lexerErrors:t.lexerErrors,lexerReport:t.lexerReport,parserErrors:t.parserErrors,value:this.hydrateAstNode(n,i)}}createHydrationContext(t){let n=new Map,i=new Map;for(let i of streamAst(t))n.set(i,{});let o;if(t.$cstNode)for(let n of streamCst(t.$cstNode)){let t;`fullText`in n?(t=new RootCstNodeImpl(n.fullText),o=t):`content`in n?t=new CompositeCstNodeImpl:`tokenType`in n&&(t=this.hydrateCstLeafNode(n)),t&&(i.set(n,t),t.root=o)}return{astNodes:n,cstNodes:i}}hydrateAstNode(t,n){let i=n.astNodes.get(t);i.$type=t.$type,i.$containerIndex=t.$containerIndex,i.$containerProperty=t.$containerProperty,t.$cstNode&&(i.$cstNode=n.cstNodes.get(t.$cstNode));for(let[o,s]of Object.entries(t))if(!o.startsWith(`$`))if(Array.isArray(s)){let t=[];i[o]=t;for(let c of s)isAstNode(c)?t.push(this.setParent(this.hydrateAstNode(c,n),i)):isReference(c)?t.push(this.hydrateReference(c,i,o,n)):t.push(c)}else isAstNode(s)?i[o]=this.setParent(this.hydrateAstNode(s,n),i):isReference(s)?i[o]=this.hydrateReference(s,i,o,n):s!==void 0&&(i[o]=s);return i}setParent(t,n){return t.$container=n,t}hydrateReference(t,n,i,o){return this.linker.buildReference(n,i,o.cstNodes.get(t.$refNode),t.$refText)}hydrateCstNode(t,n,i=0){let o=n.cstNodes.get(t);if(typeof t.grammarSource==`number`&&(o.grammarSource=this.getGrammarElement(t.grammarSource)),o.astNode=n.astNodes.get(t.astNode),isCompositeCstNode(o))for(let s of t.content){let t=this.hydrateCstNode(s,n,i++);o.content.push(t)}return o}hydrateCstLeafNode(t){let n=this.getTokenType(t.tokenType),i=t.offset,o=t.length,s=t.startLine,c=t.startColumn,u=t.endLine,f=t.endColumn,p=t.hidden;return new LeafCstNodeImpl(i,o,{start:{line:s,character:c},end:{line:u,character:f}},n,p)}getTokenType(t){return this.lexer.definition[t]}getGrammarElementId(t){if(t)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(t)}getGrammarElement(t){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(t)}createGrammarElementIdMap(){let t=0;for(let n of streamAst(this.grammar))isAbstractElement(n)&&this.grammarElementIdMap.set(n,t++)}};function createDefaultCoreModule(t){return{documentation:{CommentProvider:t=>new DefaultCommentProvider(t),DocumentationProvider:t=>new JSDocDocumentationProvider(t)},parser:{AsyncParser:t=>new DefaultAsyncParser(t),GrammarConfig:t=>createGrammarConfig(t),LangiumParser:t=>createLangiumParser(t),CompletionParser:t=>createCompletionParser(t),ValueConverter:()=>new DefaultValueConverter,TokenBuilder:()=>new DefaultTokenBuilder,Lexer:t=>new DefaultLexer(t),ParserErrorMessageProvider:()=>new LangiumParserErrorMessageProvider,LexerErrorMessageProvider:()=>new DefaultLexerErrorMessageProvider},workspace:{AstNodeLocator:()=>new DefaultAstNodeLocator,AstNodeDescriptionProvider:t=>new DefaultAstNodeDescriptionProvider(t),ReferenceDescriptionProvider:t=>new DefaultReferenceDescriptionProvider(t)},references:{Linker:t=>new DefaultLinker(t),NameProvider:()=>new DefaultNameProvider,ScopeProvider:t=>new DefaultScopeProvider(t),ScopeComputation:t=>new DefaultScopeComputation(t),References:t=>new DefaultReferences(t)},serializer:{Hydrator:t=>new DefaultHydrator(t),JsonSerializer:t=>new DefaultJsonSerializer(t)},validation:{DocumentValidator:t=>new DefaultDocumentValidator(t),ValidationRegistry:t=>new ValidationRegistry(t)},shared:()=>t.shared}}function createDefaultSharedCoreModule(t){return{ServiceRegistry:t=>new DefaultServiceRegistry(t),workspace:{LangiumDocuments:t=>new DefaultLangiumDocuments(t),LangiumDocumentFactory:t=>new DefaultLangiumDocumentFactory(t),DocumentBuilder:t=>new DefaultDocumentBuilder(t),IndexManager:t=>new DefaultIndexManager(t),WorkspaceManager:t=>new DefaultWorkspaceManager(t),FileSystemProvider:n=>t.fileSystemProvider(n),WorkspaceLock:()=>new DefaultWorkspaceLock,ConfigurationProvider:t=>new DefaultConfigurationProvider(t)}}}var Wn;(function(t){t.merge=(t,n)=>_merge(_merge({},t),n)})(Wn||={});function inject(t,n,i,o,s,c,u,f,p){return _inject([t,n,i,o,s,c,u,f,p].reduce(_merge,{}))}const Gn=Symbol(`isProxy`);function eagerLoad(t){if(t&&t[Gn])for(let n of Object.values(t))eagerLoad(n);return t}function _inject(t,n){let i=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw Error(`Cannot set property on injected service container`)},get:(o,s)=>s===Gn?!0:_resolve(o,s,t,n||i),getOwnPropertyDescriptor:(o,s)=>(_resolve(o,s,t,n||i),Object.getOwnPropertyDescriptor(o,s)),has:(n,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return i}const Kn=Symbol();function _resolve(t,n,i,o){if(n in t){if(t[n]instanceof Error)throw Error(`Construction failure. Please make sure that your dependencies are constructable.`,{cause:t[n]});if(t[n]===Kn)throw Error(`Cycle detected. Please make "`+String(n)+`" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies`);return t[n]}else if(n in i){let s=i[n];t[n]=Kn;try{t[n]=typeof s==`function`?s(o):_inject(s,o)}catch(i){throw t[n]=i instanceof Error?i:void 0,i}return t[n]}else return}function _merge(t,n){if(n){for(let[i,o]of Object.entries(n))if(o!==void 0){let n=t[i];n!==null&&o!==null&&typeof n==`object`&&typeof o==`object`?t[i]=_merge(n,o):t[i]=o}}return t}var EmptyFileSystemProvider=class{readFile(){throw Error(`No file system is available.`)}async readDirectory(){return[]}};const qn={fileSystemProvider:()=>new EmptyFileSystemProvider},Jn={Grammar:()=>void 0,LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[`.langium`],languageId:`langium`})},Yn={AstReflection:()=>new LangiumGrammarAstReflection};function createMinimalGrammarServices(){let t=inject(createDefaultSharedCoreModule(qn),Yn),n=inject(createDefaultCoreModule({shared:t}),Jn);return t.ServiceRegistry.register(n),n}function loadGrammarFromJson(t){let n=createMinimalGrammarServices(),i=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(i,J.parse(`memory://${i.name??`grammar`}.langium`)),i}var Xn=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.thenable=t.typedArray=t.stringArray=t.array=t.func=t.error=t.number=t.string=t.boolean=void 0;function boolean(t){return t===!0||t===!1}t.boolean=boolean;function string(t){return typeof t==`string`||t instanceof String}t.string=string;function number(t){return typeof t==`number`||t instanceof Number}t.number=number;function error(t){return t instanceof Error}t.error=error;function func(t){return typeof t==`function`}t.func=func;function array(t){return Array.isArray(t)}t.array=array;function stringArray(t){return array(t)&&t.every(t=>string(t))}t.stringArray=stringArray;function typedArray(t,n){return Array.isArray(t)&&t.every(n)}t.typedArray=typedArray;function thenable(t){return t&&func(t.then)}t.thenable=thenable})),Zn=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Message=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType=t.RequestType0=t.AbstractMessageSignature=t.ParameterStructures=t.ResponseError=t.ErrorCodes=void 0;let n=wn();var i;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(i||(t.ErrorCodes=i={})),t.ResponseError=class ResponseError extends Error{constructor(t,o,s){super(o),this.code=n.number(t)?t:i.UnknownErrorCode,this.data=s,Object.setPrototypeOf(this,ResponseError.prototype)}toJson(){let t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),t}};var o=class ParameterStructures{constructor(t){this.kind=t}static is(t){return t===ParameterStructures.auto||t===ParameterStructures.byName||t===ParameterStructures.byPosition}toString(){return this.kind}};t.ParameterStructures=o,o.auto=new o(`auto`),o.byPosition=new o(`byPosition`),o.byName=new o(`byName`);var AbstractMessageSignature=class{constructor(t,n){this.method=t,this.numberOfParams=n}get parameterStructures(){return o.auto}};t.AbstractMessageSignature=AbstractMessageSignature;var RequestType0=class extends AbstractMessageSignature{constructor(t){super(t,0)}};t.RequestType0=RequestType0;var RequestType=class extends AbstractMessageSignature{constructor(t,n=o.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};t.RequestType=RequestType;var RequestType1=class extends AbstractMessageSignature{constructor(t,n=o.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};t.RequestType1=RequestType1;var RequestType2=class extends AbstractMessageSignature{constructor(t){super(t,2)}};t.RequestType2=RequestType2;var RequestType3=class extends AbstractMessageSignature{constructor(t){super(t,3)}};t.RequestType3=RequestType3;var RequestType4=class extends AbstractMessageSignature{constructor(t){super(t,4)}};t.RequestType4=RequestType4;var RequestType5=class extends AbstractMessageSignature{constructor(t){super(t,5)}};t.RequestType5=RequestType5;var RequestType6=class extends AbstractMessageSignature{constructor(t){super(t,6)}};t.RequestType6=RequestType6;var RequestType7=class extends AbstractMessageSignature{constructor(t){super(t,7)}};t.RequestType7=RequestType7;var RequestType8=class extends AbstractMessageSignature{constructor(t){super(t,8)}};t.RequestType8=RequestType8;var RequestType9=class extends AbstractMessageSignature{constructor(t){super(t,9)}};t.RequestType9=RequestType9;var NotificationType=class extends AbstractMessageSignature{constructor(t,n=o.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};t.NotificationType=NotificationType;var NotificationType0=class extends AbstractMessageSignature{constructor(t){super(t,0)}};t.NotificationType0=NotificationType0;var NotificationType1=class extends AbstractMessageSignature{constructor(t,n=o.auto){super(t,1),this._parameterStructures=n}get parameterStructures(){return this._parameterStructures}};t.NotificationType1=NotificationType1;var NotificationType2=class extends AbstractMessageSignature{constructor(t){super(t,2)}};t.NotificationType2=NotificationType2;var NotificationType3=class extends AbstractMessageSignature{constructor(t){super(t,3)}};t.NotificationType3=NotificationType3;var NotificationType4=class extends AbstractMessageSignature{constructor(t){super(t,4)}};t.NotificationType4=NotificationType4;var NotificationType5=class extends AbstractMessageSignature{constructor(t){super(t,5)}};t.NotificationType5=NotificationType5;var NotificationType6=class extends AbstractMessageSignature{constructor(t){super(t,6)}};t.NotificationType6=NotificationType6;var NotificationType7=class extends AbstractMessageSignature{constructor(t){super(t,7)}};t.NotificationType7=NotificationType7;var NotificationType8=class extends AbstractMessageSignature{constructor(t){super(t,8)}};t.NotificationType8=NotificationType8;var NotificationType9=class extends AbstractMessageSignature{constructor(t){super(t,9)}};t.NotificationType9=NotificationType9;var s;(function(t){function isRequest(t){let i=t;return i&&n.string(i.method)&&(n.string(i.id)||n.number(i.id))}t.isRequest=isRequest;function isNotification(t){let i=t;return i&&n.string(i.method)&&t.id===void 0}t.isNotification=isNotification;function isResponse(t){let i=t;return i&&(i.result!==void 0||!!i.error)&&(n.string(i.id)||n.number(i.id)||i.id===null)}t.isResponse=isResponse})(s||(t.Message=s={}))})),Qn=f((t=>{var n;Object.defineProperty(t,`__esModule`,{value:!0}),t.LRUCache=t.LinkedMap=t.Touch=void 0;var i;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(i||(t.Touch=i={}));var LinkedMap=class{constructor(){this[n]=`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(){return this._head?.value}get last(){return this._tail?.value}has(t){return this._map.has(t)}get(t,n=i.None){let o=this._map.get(t);if(o)return n!==i.None&&this.touch(o,n),o.value}set(t,n,o=i.None){let s=this._map.get(t);if(s)s.value=n,o!==i.None&&this.touch(s,o);else{switch(s={key:t,value:n,next:void 0,previous:void 0},o){case i.None:this.addItemLast(s);break;case i.First:this.addItemFirst(s);break;case i.Last:this.addItemLast(s);break;default:this.addItemLast(s);break}this._map.set(t,s),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let n=this._map.get(t);if(n)return this._map.delete(t),this.removeItem(n),this._size--,n.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw Error(`Invalid list`);let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,n){let i=this._state,o=this._head;for(;o;){if(n?t.bind(n)(o.value,o.key,this):t(o.value,o.key,this),this._state!==i)throw Error(`LinkedMap got modified during iteration.`);o=o.next}}keys(){let t=this._state,n=this._head,i={[Symbol.iterator]:()=>i,next:()=>{if(this._state!==t)throw Error(`LinkedMap got modified during iteration.`);if(n){let t={value:n.key,done:!1};return n=n.next,t}else return{value:void 0,done:!0}}};return i}values(){let t=this._state,n=this._head,i={[Symbol.iterator]:()=>i,next:()=>{if(this._state!==t)throw Error(`LinkedMap got modified during iteration.`);if(n){let t={value:n.value,done:!1};return n=n.next,t}else return{value:void 0,done:!0}}};return i}entries(){let t=this._state,n=this._head,i={[Symbol.iterator]:()=>i,next:()=>{if(this._state!==t)throw Error(`LinkedMap got modified during iteration.`);if(n){let t={value:[n.key,n.value],done:!1};return n=n.next,t}else return{value:void 0,done:!0}}};return i}[(n=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let n=this._head,i=this.size;for(;n&&i>t;)this._map.delete(n.key),n=n.next,i--;this._head=n,this._size=i,n&&(n.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw Error(`Invalid list`);this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw Error(`Invalid list`);this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw Error(`Invalid list`);t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw Error(`Invalid list`);t.previous.next=void 0,this._tail=t.previous}else{let n=t.next,i=t.previous;if(!n||!i)throw Error(`Invalid list`);n.previous=i,i.next=n}t.next=void 0,t.previous=void 0,this._state++}touch(t,n){if(!this._head||!this._tail)throw Error(`Invalid list`);if(!(n!==i.First&&n!==i.Last)){if(n===i.First){if(t===this._head)return;let n=t.next,i=t.previous;t===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(n===i.Last){if(t===this._tail)return;let n=t.next,i=t.previous;t===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((n,i)=>{t.push([i,n])}),t}fromJSON(t){this.clear();for(let[n,i]of t)this.set(n,i)}};t.LinkedMap=LinkedMap;var LRUCache=class extends LinkedMap{constructor(t,n=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,n),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,n=i.AsNew){return super.get(t,n)}peek(t){return super.get(t,i.None)}set(t,n){return super.set(t,n,i.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};t.LRUCache=LRUCache})),$n=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Disposable=void 0;var n;(function(t){function create(t){return{dispose:t}}t.create=create})(n||(t.Disposable=n={}))})),er=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=void 0;let n=En();var i;(function(t){t.Continue=0,t.Cancelled=1})(i||={});var SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(t){if(t.id===null)return;let n=new SharedArrayBuffer(4),o=new Int32Array(n,0,1);o[0]=i.Continue,this.buffers.set(t.id,n),t.$cancellationData=n}async sendCancellation(t,n){let o=this.buffers.get(n);if(o===void 0)return;let s=new Int32Array(o,0,1);Atomics.store(s,0,i.Cancelled)}cleanup(t){this.buffers.delete(t)}dispose(){this.buffers.clear()}};t.SharedArraySenderStrategy=SharedArraySenderStrategy;var SharedArrayBufferCancellationToken=class{constructor(t){this.data=new Int32Array(t,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===i.Cancelled}get onCancellationRequested(){throw Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`)}},SharedArrayBufferCancellationTokenSource=class{constructor(t){this.token=new SharedArrayBufferCancellationToken(t)}cancel(){}dispose(){}},SharedArrayReceiverStrategy=class{constructor(){this.kind=`request`}createCancellationTokenSource(t){let i=t.$cancellationData;return i===void 0?new n.CancellationTokenSource:new SharedArrayBufferCancellationTokenSource(i)}};t.SharedArrayReceiverStrategy=SharedArrayReceiverStrategy})),tr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Semaphore=void 0;let n=Cn();var Semaphore=class{constructor(t=1){if(t<=0)throw Error(`Capacity must be greater than 0`);this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((n,i)=>{this._waiting.push({thunk:t,resolve:n,reject:i}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,n.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw Error(`To many thunks active`);try{let n=t.thunk();n instanceof Promise?n.then(n=>{this._active--,t.resolve(n),this.runNext()},n=>{this._active--,t.reject(n),this.runNext()}):(this._active--,t.resolve(n),this.runNext())}catch(n){this._active--,t.reject(n),this.runNext()}}};t.Semaphore=Semaphore})),nr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=void 0;let n=Cn(),i=wn(),o=Tn(),s=tr();var c;(function(t){function is(t){let n=t;return n&&i.func(n.listen)&&i.func(n.dispose)&&i.func(n.onError)&&i.func(n.onClose)&&i.func(n.onPartialMessage)}t.is=is})(c||(t.MessageReader=c={}));var AbstractMessageReader=class{constructor(){this.errorEmitter=new o.Emitter,this.closeEmitter=new o.Emitter,this.partialMessageEmitter=new o.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t){this.errorEmitter.fire(this.asError(t))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(t){this.partialMessageEmitter.fire(t)}asError(t){return t instanceof Error?t:Error(`Reader received error. Reason: ${i.string(t.message)?t.message:`unknown`}`)}};t.AbstractMessageReader=AbstractMessageReader;var u;(function(t){function fromOptions(t){let i,o,s=new Map,c,u=new Map;if(t===void 0||typeof t==`string`)i=t??`utf-8`;else{if(i=t.charset??`utf-8`,t.contentDecoder!==void 0&&(o=t.contentDecoder,s.set(o.name,o)),t.contentDecoders!==void 0)for(let n of t.contentDecoders)s.set(n.name,n);if(t.contentTypeDecoder!==void 0&&(c=t.contentTypeDecoder,u.set(c.name,c)),t.contentTypeDecoders!==void 0)for(let n of t.contentTypeDecoders)u.set(n.name,n)}return c===void 0&&(c=(0,n.default)().applicationJson.decoder,u.set(c.name,c)),{charset:i,contentDecoder:o,contentDecoders:s,contentTypeDecoder:c,contentTypeDecoders:u}}t.fromOptions=fromOptions})(u||={});var ReadableStreamMessageReader=class extends AbstractMessageReader{constructor(t,i){super(),this.readable=t,this.options=u.fromOptions(i),this.buffer=(0,n.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new s.Semaphore(1)}set partialMessageTimeout(t){this._partialMessageTimeout=t}get partialMessageTimeout(){return this._partialMessageTimeout}listen(t){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=t;let n=this.readable.onData(t=>{this.onData(t)});return this.readable.onError(t=>this.fireError(t)),this.readable.onClose(()=>this.fireClose()),n}onData(t){try{for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let t=this.buffer.tryReadHeaders(!0);if(!t)return;let n=t.get(`content-length`);if(!n){this.fireError(Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(t))}`));return}let i=parseInt(n);if(isNaN(i)){this.fireError(Error(`Content-Length value must be a number. Got ${n}`));return}this.nextMessageLength=i}let t=this.buffer.tryReadBody(this.nextMessageLength);if(t===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder===void 0?t:await this.options.contentDecoder.decode(t),i=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(i)}).catch(t=>{this.fireError(t)})}}catch(t){this.fireError(t)}}clearPartialMessageTimer(){this.partialMessageTimer&&=(this.partialMessageTimer.dispose(),void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,n.default)().timer.setTimeout((t,n)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:n}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};t.ReadableStreamMessageReader=ReadableStreamMessageReader})),rr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=void 0;let n=Cn(),i=wn(),o=tr(),s=Tn();var c;(function(t){function is(t){let n=t;return n&&i.func(n.dispose)&&i.func(n.onClose)&&i.func(n.onError)&&i.func(n.write)}t.is=is})(c||(t.MessageWriter=c={}));var AbstractMessageWriter=class{constructor(){this.errorEmitter=new s.Emitter,this.closeEmitter=new s.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,n,i){this.errorEmitter.fire([this.asError(t),n,i])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:Error(`Writer received error. Reason: ${i.string(t.message)?t.message:`unknown`}`)}};t.AbstractMessageWriter=AbstractMessageWriter;var u;(function(t){function fromOptions(t){return t===void 0||typeof t==`string`?{charset:t??`utf-8`,contentTypeEncoder:(0,n.default)().applicationJson.encoder}:{charset:t.charset??`utf-8`,contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,n.default)().applicationJson.encoder}}t.fromOptions=fromOptions})(u||={});var WriteableStreamMessageWriter=class extends AbstractMessageWriter{constructor(t,n){super(),this.writable=t,this.options=u.fromOptions(n),this.errorCount=0,this.writeSemaphore=new o.Semaphore(1),this.writable.onError(t=>this.fireError(t)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(t=>this.options.contentEncoder===void 0?t:this.options.contentEncoder.encode(t)).then(n=>{let i=[];return i.push(`Content-Length: `,n.byteLength.toString(),`\r
16
+ `),i.push(`\r
17
+ `),this.doWrite(t,i,n)},t=>{throw this.fireError(t),t}))}async doWrite(t,n,i){try{return await this.writable.write(n.join(``),`ascii`),this.writable.write(i)}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){this.writable.end()}};t.WriteableStreamMessageWriter=WriteableStreamMessageWriter})),ir=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.AbstractMessageBuffer=void 0;var AbstractMessageBuffer=class{constructor(t=`utf-8`){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let n=typeof t==`string`?this.fromString(t,this._encoding):t;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(t=!1){if(this._chunks.length===0)return;let n=0,i=0,o=0,s=0;row:for(;i<this._chunks.length;){let t=this._chunks[i];o=0;column:for(;o<t.length;){switch(t[o]){case 13:switch(n){case 0:n=1;break;case 2:n=3;break;default:n=0}break;case 10:switch(n){case 1:n=2;break;case 3:n=4,o++;break row;default:n=0}break;default:n=0}o++}s+=t.byteLength,i++}if(n!==4)return;let c=this._read(s+o),u=new Map,f=this.toString(c,`ascii`).split(`\r
18
+ `);if(f.length<2)return u;for(let n=0;n<f.length-2;n++){let i=f[n],o=i.indexOf(`:`);if(o===-1)throw Error(`Message header must separate key and value using ':'\n${i}`);let s=i.substr(0,o),c=i.substr(o+1).trim();u.set(t?s.toLowerCase():s,c)}return u}tryReadBody(t){if(!(this._totalLength<t))return this._read(t)}get numberOfBytes(){return this._totalLength}_read(t){if(t===0)return this.emptyBuffer();if(t>this._totalLength)throw Error(`Cannot read so many bytes!`);if(this._chunks[0].byteLength===t){let n=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(n)}if(this._chunks[0].byteLength>t){let n=this._chunks[0],i=this.asNative(n,t);return this._chunks[0]=n.slice(t),this._totalLength-=t,i}let n=this.allocNative(t),i=0;for(;t>0;){let o=this._chunks[0];if(o.byteLength>t){let s=o.slice(0,t);n.set(s,i),i+=t,this._chunks[0]=o.slice(t),this._totalLength-=t,t-=t}else n.set(o,i),i+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,t-=o.byteLength}return n}};t.AbstractMessageBuffer=AbstractMessageBuffer})),ar=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;let n=Cn(),i=wn(),o=Zn(),s=Qn(),c=Tn(),u=En();var f;(function(t){t.type=new o.NotificationType(`$/cancelRequest`)})(f||={});var p;(function(t){function is(t){return typeof t==`string`||typeof t==`number`}t.is=is})(p||(t.ProgressToken=p={}));var h;(function(t){t.type=new o.NotificationType(`$/progress`)})(h||={});var ProgressType=class{constructor(){}};t.ProgressType=ProgressType;var g;(function(t){function is(t){return i.func(t)}t.is=is})(g||={}),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var _;(function(t){t[t.Off=0]=`Off`,t[t.Messages=1]=`Messages`,t[t.Compact=2]=`Compact`,t[t.Verbose=3]=`Verbose`})(_||(t.Trace=_={}));var x;(function(t){t.Off=`off`,t.Messages=`messages`,t.Compact=`compact`,t.Verbose=`verbose`})(x||(t.TraceValues=x={})),(function(t){function fromString(n){if(!i.string(n))return t.Off;switch(n=n.toLowerCase(),n){case`off`:return t.Off;case`messages`:return t.Messages;case`compact`:return t.Compact;case`verbose`:return t.Verbose;default:return t.Off}}t.fromString=fromString;function toString(n){switch(n){case t.Off:return`off`;case t.Messages:return`messages`;case t.Compact:return`compact`;case t.Verbose:return`verbose`;default:return`off`}}t.toString=toString})(_||(t.Trace=_={}));var S;(function(t){t.Text=`text`,t.JSON=`json`})(S||(t.TraceFormat=S={})),(function(t){function fromString(n){return i.string(n)?(n=n.toLowerCase(),n===`json`?t.JSON:t.Text):t.Text}t.fromString=fromString})(S||(t.TraceFormat=S={}));var T;(function(t){t.type=new o.NotificationType(`$/setTrace`)})(T||(t.SetTraceNotification=T={}));var E;(function(t){t.type=new o.NotificationType(`$/logTrace`)})(E||(t.LogTraceNotification=E={}));var D;(function(t){t[t.Closed=1]=`Closed`,t[t.Disposed=2]=`Disposed`,t[t.AlreadyListening=3]=`AlreadyListening`})(D||(t.ConnectionErrors=D={}));var ee=class ConnectionError extends Error{constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,ConnectionError.prototype)}};t.ConnectionError=ee;var O;(function(t){function is(t){let n=t;return n&&i.func(n.cancelUndispatched)}t.is=is})(O||(t.ConnectionStrategy=O={}));var k;(function(t){function is(t){let n=t;return n&&(n.kind===void 0||n.kind===`id`)&&i.func(n.createCancellationTokenSource)&&(n.dispose===void 0||i.func(n.dispose))}t.is=is})(k||(t.IdCancellationReceiverStrategy=k={}));var A;(function(t){function is(t){let n=t;return n&&n.kind===`request`&&i.func(n.createCancellationTokenSource)&&(n.dispose===void 0||i.func(n.dispose))}t.is=is})(A||(t.RequestCancellationReceiverStrategy=A={}));var j;(function(t){t.Message=Object.freeze({createCancellationTokenSource(t){return new u.CancellationTokenSource}});function is(t){return k.is(t)||A.is(t)}t.is=is})(j||(t.CancellationReceiverStrategy=j={}));var M;(function(t){t.Message=Object.freeze({sendCancellation(t,n){return t.sendNotification(f.type,{id:n})},cleanup(t){}});function is(t){let n=t;return n&&i.func(n.sendCancellation)&&i.func(n.cleanup)}t.is=is})(M||(t.CancellationSenderStrategy=M={}));var N;(function(t){t.Message=Object.freeze({receiver:j.Message,sender:M.Message});function is(t){let n=t;return n&&j.is(n.receiver)&&M.is(n.sender)}t.is=is})(N||(t.CancellationStrategy=N={}));var P;(function(t){function is(t){let n=t;return n&&i.func(n.handleMessage)}t.is=is})(P||(t.MessageStrategy=P={}));var te;(function(t){function is(t){let n=t;return n&&(N.is(n.cancellationStrategy)||O.is(n.connectionStrategy)||P.is(n.messageStrategy))}t.is=is})(te||(t.ConnectionOptions=te={}));var F;(function(t){t[t.New=1]=`New`,t[t.Listening=2]=`Listening`,t[t.Closed=3]=`Closed`,t[t.Disposed=4]=`Disposed`})(F||={});function createMessageConnection(x,O,A,j){let M=A===void 0?t.NullLogger:A,te=0,ne=0,re=0,ie,ae=new Map,oe,se=new Map,ce=new Map,le,I=new s.LinkedMap,L=new Map,ue=new Set,R=new Map,z=_.Off,de=S.Text,B,fe=F.New,pe=new c.Emitter,me=new c.Emitter,he=new c.Emitter,ge=new c.Emitter,_e=new c.Emitter,V=j&&j.cancellationStrategy?j.cancellationStrategy:N.Message;function createRequestQueueKey(t){if(t===null)throw Error(`Can't send requests with id null since the response can't be correlated.`);return`req-`+t.toString()}function createResponseQueueKey(t){return t===null?`res-unknown-`+(++re).toString():`res-`+t.toString()}function createNotificationQueueKey(){return`not-`+(++ne).toString()}function addMessageToQueue(t,n){o.Message.isRequest(n)?t.set(createRequestQueueKey(n.id),n):o.Message.isResponse(n)?t.set(createResponseQueueKey(n.id),n):t.set(createNotificationQueueKey(),n)}function cancelUndispatched(t){}function isListening(){return fe===F.Listening}function isClosed(){return fe===F.Closed}function isDisposed(){return fe===F.Disposed}function closeHandler(){(fe===F.New||fe===F.Listening)&&(fe=F.Closed,me.fire(void 0))}function readErrorHandler(t){pe.fire([t,void 0,void 0])}function writeErrorHandler(t){pe.fire(t)}x.onClose(closeHandler),x.onError(readErrorHandler),O.onClose(closeHandler),O.onError(writeErrorHandler);function triggerMessageQueue(){le||I.size===0||(le=(0,n.default)().timer.setImmediate(()=>{le=void 0,processMessageQueue()}))}function handleMessage(t){o.Message.isRequest(t)?handleRequest(t):o.Message.isNotification(t)?handleNotification(t):o.Message.isResponse(t)?handleResponse(t):handleInvalidMessage(t)}function processMessageQueue(){if(I.size===0)return;let t=I.shift();try{let n=j?.messageStrategy;P.is(n)?n.handleMessage(t,handleMessage):handleMessage(t)}finally{triggerMessageQueue()}}let callback=t=>{try{if(o.Message.isNotification(t)&&t.method===f.type.method){let n=t.params.id,i=createRequestQueueKey(n),s=I.get(i);if(o.Message.isRequest(s)){let o=j?.connectionStrategy,c=o&&o.cancelUndispatched?o.cancelUndispatched(s,cancelUndispatched):void 0;if(c&&(c.error!==void 0||c.result!==void 0)){I.delete(i),R.delete(n),c.id=s.id,traceSendingResponse(c,t.method,Date.now()),O.write(c).catch(()=>M.error(`Sending response for canceled message failed.`));return}}let c=R.get(n);if(c!==void 0){c.cancel(),traceReceivedNotification(t);return}else ue.add(n)}addMessageToQueue(I,t)}finally{triggerMessageQueue()}};function handleRequest(t){if(isDisposed())return;function reply(n,i,s){let c={jsonrpc:`2.0`,id:t.id};n instanceof o.ResponseError?c.error=n.toJson():c.result=n===void 0?null:n,traceSendingResponse(c,i,s),O.write(c).catch(()=>M.error(`Sending response failed.`))}function replyError(n,i,o){let s={jsonrpc:`2.0`,id:t.id,error:n.toJson()};traceSendingResponse(s,i,o),O.write(s).catch(()=>M.error(`Sending response failed.`))}function replySuccess(n,i,o){n===void 0&&(n=null);let s={jsonrpc:`2.0`,id:t.id,result:n};traceSendingResponse(s,i,o),O.write(s).catch(()=>M.error(`Sending response failed.`))}traceReceivedRequest(t);let n=ae.get(t.method),s,c;n&&(s=n.type,c=n.handler);let u=Date.now();if(c||ie){let n=t.id??String(Date.now()),f=k.is(V.receiver)?V.receiver.createCancellationTokenSource(n):V.receiver.createCancellationTokenSource(t);t.id!==null&&ue.has(t.id)&&f.cancel(),t.id!==null&&R.set(n,f);try{let p;if(c)if(t.params===void 0){if(s!==void 0&&s.numberOfParams!==0){replyError(new o.ResponseError(o.ErrorCodes.InvalidParams,`Request ${t.method} defines ${s.numberOfParams} params but received none.`),t.method,u);return}p=c(f.token)}else if(Array.isArray(t.params)){if(s!==void 0&&s.parameterStructures===o.ParameterStructures.byName){replyError(new o.ResponseError(o.ErrorCodes.InvalidParams,`Request ${t.method} defines parameters by name but received parameters by position`),t.method,u);return}p=c(...t.params,f.token)}else{if(s!==void 0&&s.parameterStructures===o.ParameterStructures.byPosition){replyError(new o.ResponseError(o.ErrorCodes.InvalidParams,`Request ${t.method} defines parameters by position but received parameters by name`),t.method,u);return}p=c(t.params,f.token)}else ie&&(p=ie(t.method,t.params,f.token));let h=p;p?h.then?h.then(i=>{R.delete(n),reply(i,t.method,u)},s=>{R.delete(n),s instanceof o.ResponseError?replyError(s,t.method,u):s&&i.string(s.message)?replyError(new o.ResponseError(o.ErrorCodes.InternalError,`Request ${t.method} failed with message: ${s.message}`),t.method,u):replyError(new o.ResponseError(o.ErrorCodes.InternalError,`Request ${t.method} failed unexpectedly without providing any details.`),t.method,u)}):(R.delete(n),reply(p,t.method,u)):(R.delete(n),replySuccess(p,t.method,u))}catch(s){R.delete(n),s instanceof o.ResponseError?reply(s,t.method,u):s&&i.string(s.message)?replyError(new o.ResponseError(o.ErrorCodes.InternalError,`Request ${t.method} failed with message: ${s.message}`),t.method,u):replyError(new o.ResponseError(o.ErrorCodes.InternalError,`Request ${t.method} failed unexpectedly without providing any details.`),t.method,u)}}else replyError(new o.ResponseError(o.ErrorCodes.MethodNotFound,`Unhandled method ${t.method}`),t.method,u)}function handleResponse(t){if(!isDisposed())if(t.id===null)t.error?M.error(`Received response message without id: Error is: \n${JSON.stringify(t.error,void 0,4)}`):M.error(`Received response message without id. No further error information provided.`);else{let n=t.id,i=L.get(n);if(traceReceivedResponse(t,i),i!==void 0){L.delete(n);try{if(t.error){let n=t.error;i.reject(new o.ResponseError(n.code,n.message,n.data))}else if(t.result!==void 0)i.resolve(t.result);else throw Error(`Should never happen.`)}catch(t){t.message?M.error(`Response handler '${i.method}' failed with message: ${t.message}`):M.error(`Response handler '${i.method}' failed unexpectedly.`)}}}}function handleNotification(t){if(isDisposed())return;let n,i;if(t.method===f.type.method){let n=t.params.id;ue.delete(n),traceReceivedNotification(t);return}else{let o=se.get(t.method);o&&(i=o.handler,n=o.type)}if(i||oe)try{if(traceReceivedNotification(t),i)if(t.params===void 0)n!==void 0&&n.numberOfParams!==0&&n.parameterStructures!==o.ParameterStructures.byName&&M.error(`Notification ${t.method} defines ${n.numberOfParams} params but received none.`),i();else if(Array.isArray(t.params)){let s=t.params;t.method===h.type.method&&s.length===2&&p.is(s[0])?i({token:s[0],value:s[1]}):(n!==void 0&&(n.parameterStructures===o.ParameterStructures.byName&&M.error(`Notification ${t.method} defines parameters by name but received parameters by position`),n.numberOfParams!==t.params.length&&M.error(`Notification ${t.method} defines ${n.numberOfParams} params but received ${s.length} arguments`)),i(...s))}else n!==void 0&&n.parameterStructures===o.ParameterStructures.byPosition&&M.error(`Notification ${t.method} defines parameters by position but received parameters by name`),i(t.params);else oe&&oe(t.method,t.params)}catch(n){n.message?M.error(`Notification handler '${t.method}' failed with message: ${n.message}`):M.error(`Notification handler '${t.method}' failed unexpectedly.`)}else he.fire(t)}function handleInvalidMessage(t){if(!t){M.error(`Received empty message.`);return}M.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(t,null,4)}`);let n=t;if(i.string(n.id)||i.number(n.id)){let t=n.id,i=L.get(t);i&&i.reject(Error(`The received response has neither a result nor an error property.`))}}function stringifyTrace(t){if(t!=null)switch(z){case _.Verbose:return JSON.stringify(t,null,4);case _.Compact:return JSON.stringify(t);default:return}}function traceSendingRequest(t){if(!(z===_.Off||!B))if(de===S.Text){let n;(z===_.Verbose||z===_.Compact)&&t.params&&(n=`Params: ${stringifyTrace(t.params)}\n\n`),B.log(`Sending request '${t.method} - (${t.id})'.`,n)}else logLSPMessage(`send-request`,t)}function traceSendingNotification(t){if(!(z===_.Off||!B))if(de===S.Text){let n;(z===_.Verbose||z===_.Compact)&&(n=t.params?`Params: ${stringifyTrace(t.params)}\n\n`:`No parameters provided.
19
+
20
+ `),B.log(`Sending notification '${t.method}'.`,n)}else logLSPMessage(`send-notification`,t)}function traceSendingResponse(t,n,i){if(!(z===_.Off||!B))if(de===S.Text){let o;(z===_.Verbose||z===_.Compact)&&(t.error&&t.error.data?o=`Error data: ${stringifyTrace(t.error.data)}\n\n`:t.result?o=`Result: ${stringifyTrace(t.result)}\n\n`:t.error===void 0&&(o=`No result returned.
21
+
22
+ `)),B.log(`Sending response '${n} - (${t.id})'. Processing request took ${Date.now()-i}ms`,o)}else logLSPMessage(`send-response`,t)}function traceReceivedRequest(t){if(!(z===_.Off||!B))if(de===S.Text){let n;(z===_.Verbose||z===_.Compact)&&t.params&&(n=`Params: ${stringifyTrace(t.params)}\n\n`),B.log(`Received request '${t.method} - (${t.id})'.`,n)}else logLSPMessage(`receive-request`,t)}function traceReceivedNotification(t){if(!(z===_.Off||!B||t.method===E.type.method))if(de===S.Text){let n;(z===_.Verbose||z===_.Compact)&&(n=t.params?`Params: ${stringifyTrace(t.params)}\n\n`:`No parameters provided.
23
+
24
+ `),B.log(`Received notification '${t.method}'.`,n)}else logLSPMessage(`receive-notification`,t)}function traceReceivedResponse(t,n){if(!(z===_.Off||!B))if(de===S.Text){let i;if((z===_.Verbose||z===_.Compact)&&(t.error&&t.error.data?i=`Error data: ${stringifyTrace(t.error.data)}\n\n`:t.result?i=`Result: ${stringifyTrace(t.result)}\n\n`:t.error===void 0&&(i=`No result returned.
25
+
26
+ `)),n){let o=t.error?` Request failed: ${t.error.message} (${t.error.code}).`:``;B.log(`Received response '${n.method} - (${t.id})' in ${Date.now()-n.timerStart}ms.${o}`,i)}else B.log(`Received response ${t.id} without active response promise.`,i)}else logLSPMessage(`receive-response`,t)}function logLSPMessage(t,n){if(!B||z===_.Off)return;let i={isLSPMessage:!0,type:t,message:n,timestamp:Date.now()};B.log(i)}function throwIfClosedOrDisposed(){if(isClosed())throw new ee(D.Closed,`Connection is closed.`);if(isDisposed())throw new ee(D.Disposed,`Connection is disposed.`)}function throwIfListening(){if(isListening())throw new ee(D.AlreadyListening,`Connection is already listening`)}function throwIfNotListening(){if(!isListening())throw Error(`Call listen() first.`)}function undefinedToNull(t){return t===void 0?null:t}function nullToUndefined(t){if(t!==null)return t}function isNamedParam(t){return t!=null&&!Array.isArray(t)&&typeof t==`object`}function computeSingleParam(t,n){switch(t){case o.ParameterStructures.auto:return isNamedParam(n)?nullToUndefined(n):[undefinedToNull(n)];case o.ParameterStructures.byName:if(!isNamedParam(n))throw Error(`Received parameters by name but param is not an object literal.`);return nullToUndefined(n);case o.ParameterStructures.byPosition:return[undefinedToNull(n)];default:throw Error(`Unknown parameter structure ${t.toString()}`)}}function computeMessageParams(t,n){let i,o=t.numberOfParams;switch(o){case 0:i=void 0;break;case 1:i=computeSingleParam(t.parameterStructures,n[0]);break;default:i=[];for(let t=0;t<n.length&&t<o;t++)i.push(undefinedToNull(n[t]));if(n.length<o)for(let t=n.length;t<o;t++)i.push(null);break}return i}let ve={sendNotification:(t,...n)=>{throwIfClosedOrDisposed();let s,c;if(i.string(t)){s=t;let i=n[0],u=0,f=o.ParameterStructures.auto;o.ParameterStructures.is(i)&&(u=1,f=i);let p=n.length,h=p-u;switch(h){case 0:c=void 0;break;case 1:c=computeSingleParam(f,n[u]);break;default:if(f===o.ParameterStructures.byName)throw Error(`Received ${h} parameters for 'by Name' notification parameter structure.`);c=n.slice(u,p).map(t=>undefinedToNull(t));break}}else{let i=n;s=t.method,c=computeMessageParams(t,i)}let u={jsonrpc:`2.0`,method:s,params:c};return traceSendingNotification(u),O.write(u).catch(t=>{throw M.error(`Sending notification failed.`),t})},onNotification:(t,n)=>{throwIfClosedOrDisposed();let o;return i.func(t)?oe=t:n&&(i.string(t)?(o=t,se.set(t,{type:void 0,handler:n})):(o=t.method,se.set(t.method,{type:t,handler:n}))),{dispose:()=>{o===void 0?oe=void 0:se.delete(o)}}},onProgress:(t,n,i)=>{if(ce.has(n))throw Error(`Progress handler for token ${n} already registered`);return ce.set(n,i),{dispose:()=>{ce.delete(n)}}},sendProgress:(t,n,i)=>ve.sendNotification(h.type,{token:n,value:i}),onUnhandledProgress:ge.event,sendRequest:(t,...n)=>{throwIfClosedOrDisposed(),throwIfNotListening();let s,c,f;if(i.string(t)){s=t;let i=n[0],p=n[n.length-1],h=0,g=o.ParameterStructures.auto;o.ParameterStructures.is(i)&&(h=1,g=i);let _=n.length;u.CancellationToken.is(p)&&(--_,f=p);let x=_-h;switch(x){case 0:c=void 0;break;case 1:c=computeSingleParam(g,n[h]);break;default:if(g===o.ParameterStructures.byName)throw Error(`Received ${x} parameters for 'by Name' request parameter structure.`);c=n.slice(h,_).map(t=>undefinedToNull(t));break}}else{let i=n;s=t.method,c=computeMessageParams(t,i);let o=t.numberOfParams;f=u.CancellationToken.is(i[o])?i[o]:void 0}let p=te++,h;f&&(h=f.onCancellationRequested(()=>{let t=V.sender.sendCancellation(ve,p);return t===void 0?(M.log(`Received no promise from cancellation strategy when cancelling id ${p}`),Promise.resolve()):t.catch(()=>{M.log(`Sending cancellation messages for id ${p} failed`)})}));let g={jsonrpc:`2.0`,id:p,method:s,params:c};return traceSendingRequest(g),typeof V.sender.enableCancellation==`function`&&V.sender.enableCancellation(g),new Promise(async(t,n)=>{let resolveWithCleanup=n=>{t(n),V.sender.cleanup(p),h?.dispose()},rejectWithCleanup=t=>{n(t),V.sender.cleanup(p),h?.dispose()},i={method:s,timerStart:Date.now(),resolve:resolveWithCleanup,reject:rejectWithCleanup};try{L.set(p,i),await O.write(g)}catch(t){throw L.delete(p),i.reject(new o.ResponseError(o.ErrorCodes.MessageWriteError,t.message?t.message:`Unknown reason`)),M.error(`Sending request failed.`),t}})},onRequest:(t,n)=>{throwIfClosedOrDisposed();let o=null;return g.is(t)?(o=void 0,ie=t):i.string(t)?(o=null,n!==void 0&&(o=t,ae.set(t,{handler:n,type:void 0}))):n!==void 0&&(o=t.method,ae.set(t.method,{type:t,handler:n})),{dispose:()=>{o!==null&&(o===void 0?ie=void 0:ae.delete(o))}}},hasPendingResponse:()=>L.size>0,trace:async(t,n,o)=>{let s=!1,c=S.Text;o!==void 0&&(i.boolean(o)?s=o:(s=o.sendNotification||!1,c=o.traceFormat||S.Text)),z=t,de=c,B=z===_.Off?void 0:n,s&&!isClosed()&&!isDisposed()&&await ve.sendNotification(T.type,{value:_.toString(t)})},onError:pe.event,onClose:me.event,onUnhandledNotification:he.event,onDispose:_e.event,end:()=>{O.end()},dispose:()=>{if(isDisposed())return;fe=F.Disposed,_e.fire(void 0);let t=new o.ResponseError(o.ErrorCodes.PendingResponseRejected,`Pending response rejected since connection got disposed`);for(let n of L.values())n.reject(t);L=new Map,R=new Map,ue=new Set,I=new s.LinkedMap,i.func(O.dispose)&&O.dispose(),i.func(x.dispose)&&x.dispose()},listen:()=>{throwIfClosedOrDisposed(),throwIfListening(),fe=F.Listening,x.listen(callback)},inspect:()=>{(0,n.default)().console.log(`inspect`)}};return ve.onNotification(E.type,t=>{if(z===_.Off||!B)return;let n=z===_.Verbose||z===_.Compact;B.log(t.message,n?t.verbose:void 0)}),ve.onNotification(h.type,t=>{let n=ce.get(t.token);n?n(t.value):ge.fire(t)}),ve}t.createMessageConnection=createMessageConnection})),or=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.AbstractMessageBuffer=t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=t.CancellationToken=t.CancellationTokenSource=t.Emitter=t.Event=t.Disposable=t.LRUCache=t.Touch=t.LinkedMap=t.ParameterStructures=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.ErrorCodes=t.ResponseError=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType0=t.RequestType=t.Message=t.RAL=void 0,t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=void 0;let n=Zn();Object.defineProperty(t,`Message`,{enumerable:!0,get:function(){return n.Message}}),Object.defineProperty(t,`RequestType`,{enumerable:!0,get:function(){return n.RequestType}}),Object.defineProperty(t,`RequestType0`,{enumerable:!0,get:function(){return n.RequestType0}}),Object.defineProperty(t,`RequestType1`,{enumerable:!0,get:function(){return n.RequestType1}}),Object.defineProperty(t,`RequestType2`,{enumerable:!0,get:function(){return n.RequestType2}}),Object.defineProperty(t,`RequestType3`,{enumerable:!0,get:function(){return n.RequestType3}}),Object.defineProperty(t,`RequestType4`,{enumerable:!0,get:function(){return n.RequestType4}}),Object.defineProperty(t,`RequestType5`,{enumerable:!0,get:function(){return n.RequestType5}}),Object.defineProperty(t,`RequestType6`,{enumerable:!0,get:function(){return n.RequestType6}}),Object.defineProperty(t,`RequestType7`,{enumerable:!0,get:function(){return n.RequestType7}}),Object.defineProperty(t,`RequestType8`,{enumerable:!0,get:function(){return n.RequestType8}}),Object.defineProperty(t,`RequestType9`,{enumerable:!0,get:function(){return n.RequestType9}}),Object.defineProperty(t,`ResponseError`,{enumerable:!0,get:function(){return n.ResponseError}}),Object.defineProperty(t,`ErrorCodes`,{enumerable:!0,get:function(){return n.ErrorCodes}}),Object.defineProperty(t,`NotificationType`,{enumerable:!0,get:function(){return n.NotificationType}}),Object.defineProperty(t,`NotificationType0`,{enumerable:!0,get:function(){return n.NotificationType0}}),Object.defineProperty(t,`NotificationType1`,{enumerable:!0,get:function(){return n.NotificationType1}}),Object.defineProperty(t,`NotificationType2`,{enumerable:!0,get:function(){return n.NotificationType2}}),Object.defineProperty(t,`NotificationType3`,{enumerable:!0,get:function(){return n.NotificationType3}}),Object.defineProperty(t,`NotificationType4`,{enumerable:!0,get:function(){return n.NotificationType4}}),Object.defineProperty(t,`NotificationType5`,{enumerable:!0,get:function(){return n.NotificationType5}}),Object.defineProperty(t,`NotificationType6`,{enumerable:!0,get:function(){return n.NotificationType6}}),Object.defineProperty(t,`NotificationType7`,{enumerable:!0,get:function(){return n.NotificationType7}}),Object.defineProperty(t,`NotificationType8`,{enumerable:!0,get:function(){return n.NotificationType8}}),Object.defineProperty(t,`NotificationType9`,{enumerable:!0,get:function(){return n.NotificationType9}}),Object.defineProperty(t,`ParameterStructures`,{enumerable:!0,get:function(){return n.ParameterStructures}});let i=Qn();Object.defineProperty(t,`LinkedMap`,{enumerable:!0,get:function(){return i.LinkedMap}}),Object.defineProperty(t,`LRUCache`,{enumerable:!0,get:function(){return i.LRUCache}}),Object.defineProperty(t,`Touch`,{enumerable:!0,get:function(){return i.Touch}});let o=$n();Object.defineProperty(t,`Disposable`,{enumerable:!0,get:function(){return o.Disposable}});let s=Tn();Object.defineProperty(t,`Event`,{enumerable:!0,get:function(){return s.Event}}),Object.defineProperty(t,`Emitter`,{enumerable:!0,get:function(){return s.Emitter}});let c=En();Object.defineProperty(t,`CancellationTokenSource`,{enumerable:!0,get:function(){return c.CancellationTokenSource}}),Object.defineProperty(t,`CancellationToken`,{enumerable:!0,get:function(){return c.CancellationToken}});let u=er();Object.defineProperty(t,`SharedArraySenderStrategy`,{enumerable:!0,get:function(){return u.SharedArraySenderStrategy}}),Object.defineProperty(t,`SharedArrayReceiverStrategy`,{enumerable:!0,get:function(){return u.SharedArrayReceiverStrategy}});let f=nr();Object.defineProperty(t,`MessageReader`,{enumerable:!0,get:function(){return f.MessageReader}}),Object.defineProperty(t,`AbstractMessageReader`,{enumerable:!0,get:function(){return f.AbstractMessageReader}}),Object.defineProperty(t,`ReadableStreamMessageReader`,{enumerable:!0,get:function(){return f.ReadableStreamMessageReader}});let p=rr();Object.defineProperty(t,`MessageWriter`,{enumerable:!0,get:function(){return p.MessageWriter}}),Object.defineProperty(t,`AbstractMessageWriter`,{enumerable:!0,get:function(){return p.AbstractMessageWriter}}),Object.defineProperty(t,`WriteableStreamMessageWriter`,{enumerable:!0,get:function(){return p.WriteableStreamMessageWriter}});let h=ir();Object.defineProperty(t,`AbstractMessageBuffer`,{enumerable:!0,get:function(){return h.AbstractMessageBuffer}});let g=ar();Object.defineProperty(t,`ConnectionStrategy`,{enumerable:!0,get:function(){return g.ConnectionStrategy}}),Object.defineProperty(t,`ConnectionOptions`,{enumerable:!0,get:function(){return g.ConnectionOptions}}),Object.defineProperty(t,`NullLogger`,{enumerable:!0,get:function(){return g.NullLogger}}),Object.defineProperty(t,`createMessageConnection`,{enumerable:!0,get:function(){return g.createMessageConnection}}),Object.defineProperty(t,`ProgressToken`,{enumerable:!0,get:function(){return g.ProgressToken}}),Object.defineProperty(t,`ProgressType`,{enumerable:!0,get:function(){return g.ProgressType}}),Object.defineProperty(t,`Trace`,{enumerable:!0,get:function(){return g.Trace}}),Object.defineProperty(t,`TraceValues`,{enumerable:!0,get:function(){return g.TraceValues}}),Object.defineProperty(t,`TraceFormat`,{enumerable:!0,get:function(){return g.TraceFormat}}),Object.defineProperty(t,`SetTraceNotification`,{enumerable:!0,get:function(){return g.SetTraceNotification}}),Object.defineProperty(t,`LogTraceNotification`,{enumerable:!0,get:function(){return g.LogTraceNotification}}),Object.defineProperty(t,`ConnectionErrors`,{enumerable:!0,get:function(){return g.ConnectionErrors}}),Object.defineProperty(t,`ConnectionError`,{enumerable:!0,get:function(){return g.ConnectionError}}),Object.defineProperty(t,`CancellationReceiverStrategy`,{enumerable:!0,get:function(){return g.CancellationReceiverStrategy}}),Object.defineProperty(t,`CancellationSenderStrategy`,{enumerable:!0,get:function(){return g.CancellationSenderStrategy}}),Object.defineProperty(t,`CancellationStrategy`,{enumerable:!0,get:function(){return g.CancellationStrategy}}),Object.defineProperty(t,`MessageStrategy`,{enumerable:!0,get:function(){return g.MessageStrategy}}),t.RAL=Cn().default})),sr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=s(`node:util`),i=or();var o=class MessageBuffer extends i.AbstractMessageBuffer{constructor(t=`utf-8`){super(t)}emptyBuffer(){return MessageBuffer.emptyBuffer}fromString(t,n){return Buffer.from(t,n)}toString(t,i){return t instanceof Buffer?t.toString(i):new n.TextDecoder(i).decode(t)}asNative(t,n){return n===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,n):Buffer.from(t,0,n)}allocNative(t){return Buffer.allocUnsafe(t)}};o.emptyBuffer=Buffer.allocUnsafe(0);var ReadableStreamWrapper=class{constructor(t){this.stream=t}onClose(t){return this.stream.on(`close`,t),i.Disposable.create(()=>this.stream.off(`close`,t))}onError(t){return this.stream.on(`error`,t),i.Disposable.create(()=>this.stream.off(`error`,t))}onEnd(t){return this.stream.on(`end`,t),i.Disposable.create(()=>this.stream.off(`end`,t))}onData(t){return this.stream.on(`data`,t),i.Disposable.create(()=>this.stream.off(`data`,t))}},WritableStreamWrapper=class{constructor(t){this.stream=t}onClose(t){return this.stream.on(`close`,t),i.Disposable.create(()=>this.stream.off(`close`,t))}onError(t){return this.stream.on(`error`,t),i.Disposable.create(()=>this.stream.off(`error`,t))}onEnd(t){return this.stream.on(`end`,t),i.Disposable.create(()=>this.stream.off(`end`,t))}write(t,n){return new Promise((i,o)=>{let callback=t=>{t==null?i():o(t)};typeof t==`string`?this.stream.write(t,n,callback):this.stream.write(t,callback)})}end(){this.stream.end()}};let c=Object.freeze({messageBuffer:Object.freeze({create:t=>new o(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:`application/json`,encode:(t,n)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),n.charset))}catch(t){return Promise.reject(t)}}}),decoder:Object.freeze({name:`application/json`,decode:(t,i)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(i.charset))):Promise.resolve(JSON.parse(new n.TextDecoder(i.charset).decode(t)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:t=>new ReadableStreamWrapper(t),asWritableStream:t=>new WritableStreamWrapper(t)}),console,timer:Object.freeze({setTimeout(t,n,...i){let o=setTimeout(t,n,...i);return{dispose:()=>clearTimeout(o)}},setImmediate(t,...n){let i=setImmediate(t,...n);return{dispose:()=>clearImmediate(i)}},setInterval(t,n,...i){let o=setInterval(t,n,...i);return{dispose:()=>clearInterval(o)}}})});function RIL(){return c}(function(t){function install(){i.RAL.install(c)}t.install=install})(RIL||={}),t.default=RIL})),cr=f((t=>{var n=t&&t.__createBinding||(Object.create?(function(t,n,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||(`get`in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,o,s)}):(function(t,n,i,o){o===void 0&&(o=i),t[o]=n[i]})),i=t&&t.__exportStar||function(t,i){for(var o in t)o!==`default`&&!Object.prototype.hasOwnProperty.call(i,o)&&n(i,t,o)};Object.defineProperty(t,`__esModule`,{value:!0}),t.createMessageConnection=t.createServerSocketTransport=t.createClientSocketTransport=t.createServerPipeTransport=t.createClientPipeTransport=t.generateRandomPipeName=t.StreamMessageWriter=t.StreamMessageReader=t.SocketMessageWriter=t.SocketMessageReader=t.PortMessageWriter=t.PortMessageReader=t.IPCMessageWriter=t.IPCMessageReader=void 0;let o=sr();o.default.install();let c=s(`node:path`),u=s(`node:os`),f=s(`node:crypto`),p=s(`node:net`),h=or();i(or(),t);var IPCMessageReader=class extends h.AbstractMessageReader{constructor(t){super(),this.process=t;let n=this.process;n.on(`error`,t=>this.fireError(t)),n.on(`close`,()=>this.fireClose())}listen(t){return this.process.on(`message`,t),h.Disposable.create(()=>this.process.off(`message`,t))}};t.IPCMessageReader=IPCMessageReader;var IPCMessageWriter=class extends h.AbstractMessageWriter{constructor(t){super(),this.process=t,this.errorCount=0;let n=this.process;n.on(`error`,t=>this.fireError(t)),n.on(`close`,()=>this.fireClose)}write(t){try{return typeof this.process.send==`function`&&this.process.send(t,void 0,void 0,n=>{n?(this.errorCount++,this.handleError(n,t)):this.errorCount=0}),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};t.IPCMessageWriter=IPCMessageWriter;var PortMessageReader=class extends h.AbstractMessageReader{constructor(t){super(),this.onData=new h.Emitter,t.on(`close`,()=>this.fireClose),t.on(`error`,t=>this.fireError(t)),t.on(`message`,t=>{this.onData.fire(t)})}listen(t){return this.onData.event(t)}};t.PortMessageReader=PortMessageReader;var PortMessageWriter=class extends h.AbstractMessageWriter{constructor(t){super(),this.port=t,this.errorCount=0,t.on(`close`,()=>this.fireClose()),t.on(`error`,t=>this.fireError(t))}write(t){try{return this.port.postMessage(t),Promise.resolve()}catch(n){return this.handleError(n,t),Promise.reject(n)}}handleError(t,n){this.errorCount++,this.fireError(t,n,this.errorCount)}end(){}};t.PortMessageWriter=PortMessageWriter;var SocketMessageReader=class extends h.ReadableStreamMessageReader{constructor(t,n=`utf-8`){super((0,o.default)().stream.asReadableStream(t),n)}};t.SocketMessageReader=SocketMessageReader;var SocketMessageWriter=class extends h.WriteableStreamMessageWriter{constructor(t,n){super((0,o.default)().stream.asWritableStream(t),n),this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};t.SocketMessageWriter=SocketMessageWriter;var StreamMessageReader=class extends h.ReadableStreamMessageReader{constructor(t,n){super((0,o.default)().stream.asReadableStream(t),n)}};t.StreamMessageReader=StreamMessageReader;var StreamMessageWriter=class extends h.WriteableStreamMessageWriter{constructor(t,n){super((0,o.default)().stream.asWritableStream(t),n)}};t.StreamMessageWriter=StreamMessageWriter;let g=process.env.XDG_RUNTIME_DIR,_=new Map([[`linux`,107],[`darwin`,103]]);function generateRandomPipeName(){let t=(0,f.randomBytes)(21).toString(`hex`);if(process.platform===`win32`)return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let n;n=g?c.join(g,`vscode-ipc-${t}.sock`):c.join(u.tmpdir(),`vscode-${t}.sock`);let i=_.get(process.platform);return i!==void 0&&n.length>i&&(0,o.default)().console.warn(`WARNING: IPC handle "${n}" is longer than ${i} characters.`),n}t.generateRandomPipeName=generateRandomPipeName;function createClientPipeTransport(t,n=`utf-8`){let i,o=new Promise((t,n)=>{i=t});return new Promise((s,c)=>{let u=(0,p.createServer)(t=>{u.close(),i([new SocketMessageReader(t,n),new SocketMessageWriter(t,n)])});u.on(`error`,c),u.listen(t,()=>{u.removeListener(`error`,c),s({onConnected:()=>o})})})}t.createClientPipeTransport=createClientPipeTransport;function createServerPipeTransport(t,n=`utf-8`){let i=(0,p.createConnection)(t);return[new SocketMessageReader(i,n),new SocketMessageWriter(i,n)]}t.createServerPipeTransport=createServerPipeTransport;function createClientSocketTransport(t,n=`utf-8`){let i,o=new Promise((t,n)=>{i=t});return new Promise((s,c)=>{let u=(0,p.createServer)(t=>{u.close(),i([new SocketMessageReader(t,n),new SocketMessageWriter(t,n)])});u.on(`error`,c),u.listen(t,`127.0.0.1`,()=>{u.removeListener(`error`,c),s({onConnected:()=>o})})})}t.createClientSocketTransport=createClientSocketTransport;function createServerSocketTransport(t,n=`utf-8`){let i=(0,p.createConnection)(t,`127.0.0.1`);return[new SocketMessageReader(i,n),new SocketMessageWriter(i,n)]}t.createServerSocketTransport=createServerSocketTransport;function isReadableStream(t){let n=t;return n.read!==void 0&&n.addListener!==void 0}function isWritableStream(t){let n=t;return n.write!==void 0&&n.addListener!==void 0}function createMessageConnection(t,n,i,o){i||=h.NullLogger;let s=isReadableStream(t)?new StreamMessageReader(t):t,c=isWritableStream(n)?new StreamMessageWriter(n):n;return h.ConnectionStrategy.is(o)&&(o={connectionStrategy:o}),(0,h.createMessageConnection)(s,c,i,o)}t.createMessageConnection=createMessageConnection})),lr=f(((t,n)=>{n.exports=cr()})),Z=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ProtocolNotificationType=t.ProtocolNotificationType0=t.ProtocolRequestType=t.ProtocolRequestType0=t.RegistrationType=t.MessageDirection=void 0;let n=cr();var i;(function(t){t.clientToServer=`clientToServer`,t.serverToClient=`serverToClient`,t.both=`both`})(i||(t.MessageDirection=i={}));var RegistrationType=class{constructor(t){this.method=t}};t.RegistrationType=RegistrationType;var ProtocolRequestType0=class extends n.RequestType0{constructor(t){super(t)}};t.ProtocolRequestType0=ProtocolRequestType0;var ProtocolRequestType=class extends n.RequestType{constructor(t){super(t,n.ParameterStructures.byName)}};t.ProtocolRequestType=ProtocolRequestType;var ProtocolNotificationType0=class extends n.NotificationType0{constructor(t){super(t)}};t.ProtocolNotificationType0=ProtocolNotificationType0;var ProtocolNotificationType=class extends n.NotificationType{constructor(t){super(t,n.ParameterStructures.byName)}};t.ProtocolNotificationType=ProtocolNotificationType})),ur=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.objectLiteral=t.typedArray=t.stringArray=t.array=t.func=t.error=t.number=t.string=t.boolean=void 0;function boolean(t){return t===!0||t===!1}t.boolean=boolean;function string(t){return typeof t==`string`||t instanceof String}t.string=string;function number(t){return typeof t==`number`||t instanceof Number}t.number=number;function error(t){return t instanceof Error}t.error=error;function func(t){return typeof t==`function`}t.func=func;function array(t){return Array.isArray(t)}t.array=array;function stringArray(t){return array(t)&&t.every(t=>string(t))}t.stringArray=stringArray;function typedArray(t,n){return Array.isArray(t)&&t.every(n)}t.typedArray=typedArray;function objectLiteral(t){return typeof t==`object`&&!!t}t.objectLiteral=objectLiteral})),dr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ImplementationRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/implementation`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.ImplementationRequest=i={}))})),fr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TypeDefinitionRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/typeDefinition`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.TypeDefinitionRequest=i={}))})),pr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DidChangeWorkspaceFoldersNotification=t.WorkspaceFoldersRequest=void 0;let n=Z();var i;(function(t){t.method=`workspace/workspaceFolders`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType0(t.method)})(i||(t.WorkspaceFoldersRequest=i={}));var o;(function(t){t.method=`workspace/didChangeWorkspaceFolders`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(o||(t.DidChangeWorkspaceFoldersNotification=o={}))})),mr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ConfigurationRequest=void 0;let n=Z();var i;(function(t){t.method=`workspace/configuration`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType(t.method)})(i||(t.ConfigurationRequest=i={}))})),hr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ColorPresentationRequest=t.DocumentColorRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/documentColor`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.DocumentColorRequest=i={}));var o;(function(t){t.method=`textDocument/colorPresentation`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(o||(t.ColorPresentationRequest=o={}))})),gr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.FoldingRangeRefreshRequest=t.FoldingRangeRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/foldingRange`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.FoldingRangeRequest=i={}));var o;(function(t){t.method=`workspace/foldingRange/refresh`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType0(t.method)})(o||(t.FoldingRangeRefreshRequest=o={}))})),_r=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DeclarationRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/declaration`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.DeclarationRequest=i={}))})),vr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SelectionRangeRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/selectionRange`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.SelectionRangeRequest=i={}))})),yr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WorkDoneProgressCancelNotification=t.WorkDoneProgressCreateRequest=t.WorkDoneProgress=void 0;let n=cr(),i=Z();var o;(function(t){t.type=new n.ProgressType;function is(n){return n===t.type}t.is=is})(o||(t.WorkDoneProgress=o={}));var s;(function(t){t.method=`window/workDoneProgress/create`,t.messageDirection=i.MessageDirection.serverToClient,t.type=new i.ProtocolRequestType(t.method)})(s||(t.WorkDoneProgressCreateRequest=s={}));var c;(function(t){t.method=`window/workDoneProgress/cancel`,t.messageDirection=i.MessageDirection.clientToServer,t.type=new i.ProtocolNotificationType(t.method)})(c||(t.WorkDoneProgressCancelNotification=c={}))})),br=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CallHierarchyOutgoingCallsRequest=t.CallHierarchyIncomingCallsRequest=t.CallHierarchyPrepareRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/prepareCallHierarchy`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.CallHierarchyPrepareRequest=i={}));var o;(function(t){t.method=`callHierarchy/incomingCalls`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(o||(t.CallHierarchyIncomingCallsRequest=o={}));var s;(function(t){t.method=`callHierarchy/outgoingCalls`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(s||(t.CallHierarchyOutgoingCallsRequest=s={}))})),xr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SemanticTokensRefreshRequest=t.SemanticTokensRangeRequest=t.SemanticTokensDeltaRequest=t.SemanticTokensRequest=t.SemanticTokensRegistrationType=t.TokenFormat=void 0;let n=Z();var i;(function(t){t.Relative=`relative`})(i||(t.TokenFormat=i={}));var o;(function(t){t.method=`textDocument/semanticTokens`,t.type=new n.RegistrationType(t.method)})(o||(t.SemanticTokensRegistrationType=o={}));var s;(function(t){t.method=`textDocument/semanticTokens/full`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method),t.registrationMethod=o.method})(s||(t.SemanticTokensRequest=s={}));var c;(function(t){t.method=`textDocument/semanticTokens/full/delta`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method),t.registrationMethod=o.method})(c||(t.SemanticTokensDeltaRequest=c={}));var u;(function(t){t.method=`textDocument/semanticTokens/range`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method),t.registrationMethod=o.method})(u||(t.SemanticTokensRangeRequest=u={}));var f;(function(t){t.method=`workspace/semanticTokens/refresh`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType0(t.method)})(f||(t.SemanticTokensRefreshRequest=f={}))})),Sr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ShowDocumentRequest=void 0;let n=Z();var i;(function(t){t.method=`window/showDocument`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType(t.method)})(i||(t.ShowDocumentRequest=i={}))})),Cr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.LinkedEditingRangeRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/linkedEditingRange`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.LinkedEditingRangeRequest=i={}))})),wr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WillDeleteFilesRequest=t.DidDeleteFilesNotification=t.DidRenameFilesNotification=t.WillRenameFilesRequest=t.DidCreateFilesNotification=t.WillCreateFilesRequest=t.FileOperationPatternKind=void 0;let n=Z();var i;(function(t){t.file=`file`,t.folder=`folder`})(i||(t.FileOperationPatternKind=i={}));var o;(function(t){t.method=`workspace/willCreateFiles`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(o||(t.WillCreateFilesRequest=o={}));var s;(function(t){t.method=`workspace/didCreateFiles`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(s||(t.DidCreateFilesNotification=s={}));var c;(function(t){t.method=`workspace/willRenameFiles`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(c||(t.WillRenameFilesRequest=c={}));var u;(function(t){t.method=`workspace/didRenameFiles`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(u||(t.DidRenameFilesNotification=u={}));var f;(function(t){t.method=`workspace/didDeleteFiles`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(f||(t.DidDeleteFilesNotification=f={}));var p;(function(t){t.method=`workspace/willDeleteFiles`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(p||(t.WillDeleteFilesRequest=p={}))})),Tr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MonikerRequest=t.MonikerKind=t.UniquenessLevel=void 0;let n=Z();var i;(function(t){t.document=`document`,t.project=`project`,t.group=`group`,t.scheme=`scheme`,t.global=`global`})(i||(t.UniquenessLevel=i={}));var o;(function(t){t.$import=`import`,t.$export=`export`,t.local=`local`})(o||(t.MonikerKind=o={}));var s;(function(t){t.method=`textDocument/moniker`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(s||(t.MonikerRequest=s={}))})),Er=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TypeHierarchySubtypesRequest=t.TypeHierarchySupertypesRequest=t.TypeHierarchyPrepareRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/prepareTypeHierarchy`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.TypeHierarchyPrepareRequest=i={}));var o;(function(t){t.method=`typeHierarchy/supertypes`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(o||(t.TypeHierarchySupertypesRequest=o={}));var s;(function(t){t.method=`typeHierarchy/subtypes`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(s||(t.TypeHierarchySubtypesRequest=s={}))})),Dr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InlineValueRefreshRequest=t.InlineValueRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/inlineValue`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.InlineValueRequest=i={}));var o;(function(t){t.method=`workspace/inlineValue/refresh`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType0(t.method)})(o||(t.InlineValueRefreshRequest=o={}))})),Or=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InlayHintRefreshRequest=t.InlayHintResolveRequest=t.InlayHintRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/inlayHint`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.InlayHintRequest=i={}));var o;(function(t){t.method=`inlayHint/resolve`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(o||(t.InlayHintResolveRequest=o={}));var s;(function(t){t.method=`workspace/inlayHint/refresh`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType0(t.method)})(s||(t.InlayHintRefreshRequest=s={}))})),kr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DiagnosticRefreshRequest=t.WorkspaceDiagnosticRequest=t.DocumentDiagnosticRequest=t.DocumentDiagnosticReportKind=t.DiagnosticServerCancellationData=void 0;let n=cr(),i=ur(),o=Z();var s;(function(t){function is(t){let n=t;return n&&i.boolean(n.retriggerRequest)}t.is=is})(s||(t.DiagnosticServerCancellationData=s={}));var c;(function(t){t.Full=`full`,t.Unchanged=`unchanged`})(c||(t.DocumentDiagnosticReportKind=c={}));var u;(function(t){t.method=`textDocument/diagnostic`,t.messageDirection=o.MessageDirection.clientToServer,t.type=new o.ProtocolRequestType(t.method),t.partialResult=new n.ProgressType})(u||(t.DocumentDiagnosticRequest=u={}));var f;(function(t){t.method=`workspace/diagnostic`,t.messageDirection=o.MessageDirection.clientToServer,t.type=new o.ProtocolRequestType(t.method),t.partialResult=new n.ProgressType})(f||(t.WorkspaceDiagnosticRequest=f={}));var p;(function(t){t.method=`workspace/diagnostic/refresh`,t.messageDirection=o.MessageDirection.serverToClient,t.type=new o.ProtocolRequestType0(t.method)})(p||(t.DiagnosticRefreshRequest=p={}))})),Ar=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DidCloseNotebookDocumentNotification=t.DidSaveNotebookDocumentNotification=t.DidChangeNotebookDocumentNotification=t.NotebookCellArrayChange=t.DidOpenNotebookDocumentNotification=t.NotebookDocumentSyncRegistrationType=t.NotebookDocument=t.NotebookCell=t.ExecutionSummary=t.NotebookCellKind=void 0;let n=(vn(),u(qe)),i=ur(),o=Z();var s;(function(t){t.Markup=1,t.Code=2;function is(t){return t===1||t===2}t.is=is})(s||(t.NotebookCellKind=s={}));var c;(function(t){function create(t,n){let i={executionOrder:t};return(n===!0||n===!1)&&(i.success=n),i}t.create=create;function is(t){let o=t;return i.objectLiteral(o)&&n.uinteger.is(o.executionOrder)&&(o.success===void 0||i.boolean(o.success))}t.is=is;function equals(t,n){return t===n?!0:t==null||n==null?!1:t.executionOrder===n.executionOrder&&t.success===n.success}t.equals=equals})(c||(t.ExecutionSummary=c={}));var f;(function(t){function create(t,n){return{kind:t,document:n}}t.create=create;function is(t){let o=t;return i.objectLiteral(o)&&s.is(o.kind)&&n.DocumentUri.is(o.document)&&(o.metadata===void 0||i.objectLiteral(o.metadata))}t.is=is;function diff(t,n){let i=new Set;return t.document!==n.document&&i.add(`document`),t.kind!==n.kind&&i.add(`kind`),t.executionSummary!==n.executionSummary&&i.add(`executionSummary`),(t.metadata!==void 0||n.metadata!==void 0)&&!equalsMetadata(t.metadata,n.metadata)&&i.add(`metadata`),(t.executionSummary!==void 0||n.executionSummary!==void 0)&&!c.equals(t.executionSummary,n.executionSummary)&&i.add(`executionSummary`),i}t.diff=diff;function equalsMetadata(t,n){if(t===n)return!0;if(t==null||n==null||typeof t!=typeof n||typeof t!=`object`)return!1;let o=Array.isArray(t),s=Array.isArray(n);if(o!==s)return!1;if(o&&s){if(t.length!==n.length)return!1;for(let i=0;i<t.length;i++)if(!equalsMetadata(t[i],n[i]))return!1}if(i.objectLiteral(t)&&i.objectLiteral(n)){let i=Object.keys(t),o=Object.keys(n);if(i.length!==o.length||(i.sort(),o.sort(),!equalsMetadata(i,o)))return!1;for(let o=0;o<i.length;o++){let s=i[o];if(!equalsMetadata(t[s],n[s]))return!1}}return!0}})(f||(t.NotebookCell=f={}));var p;(function(t){function create(t,n,i,o){return{uri:t,notebookType:n,version:i,cells:o}}t.create=create;function is(t){let o=t;return i.objectLiteral(o)&&i.string(o.uri)&&n.integer.is(o.version)&&i.typedArray(o.cells,f.is)}t.is=is})(p||(t.NotebookDocument=p={}));var h;(function(t){t.method=`notebookDocument/sync`,t.messageDirection=o.MessageDirection.clientToServer,t.type=new o.RegistrationType(t.method)})(h||(t.NotebookDocumentSyncRegistrationType=h={}));var g;(function(t){t.method=`notebookDocument/didOpen`,t.messageDirection=o.MessageDirection.clientToServer,t.type=new o.ProtocolNotificationType(t.method),t.registrationMethod=h.method})(g||(t.DidOpenNotebookDocumentNotification=g={}));var _;(function(t){function is(t){let o=t;return i.objectLiteral(o)&&n.uinteger.is(o.start)&&n.uinteger.is(o.deleteCount)&&(o.cells===void 0||i.typedArray(o.cells,f.is))}t.is=is;function create(t,n,i){let o={start:t,deleteCount:n};return i!==void 0&&(o.cells=i),o}t.create=create})(_||(t.NotebookCellArrayChange=_={}));var x;(function(t){t.method=`notebookDocument/didChange`,t.messageDirection=o.MessageDirection.clientToServer,t.type=new o.ProtocolNotificationType(t.method),t.registrationMethod=h.method})(x||(t.DidChangeNotebookDocumentNotification=x={}));var S;(function(t){t.method=`notebookDocument/didSave`,t.messageDirection=o.MessageDirection.clientToServer,t.type=new o.ProtocolNotificationType(t.method),t.registrationMethod=h.method})(S||(t.DidSaveNotebookDocumentNotification=S={}));var T;(function(t){t.method=`notebookDocument/didClose`,t.messageDirection=o.MessageDirection.clientToServer,t.type=new o.ProtocolNotificationType(t.method),t.registrationMethod=h.method})(T||(t.DidCloseNotebookDocumentNotification=T={}))})),jr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InlineCompletionRequest=void 0;let n=Z();var i;(function(t){t.method=`textDocument/inlineCompletion`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(i||(t.InlineCompletionRequest=i={}))})),Mr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WorkspaceSymbolRequest=t.CodeActionResolveRequest=t.CodeActionRequest=t.DocumentSymbolRequest=t.DocumentHighlightRequest=t.ReferencesRequest=t.DefinitionRequest=t.SignatureHelpRequest=t.SignatureHelpTriggerKind=t.HoverRequest=t.CompletionResolveRequest=t.CompletionRequest=t.CompletionTriggerKind=t.PublishDiagnosticsNotification=t.WatchKind=t.RelativePattern=t.FileChangeType=t.DidChangeWatchedFilesNotification=t.WillSaveTextDocumentWaitUntilRequest=t.WillSaveTextDocumentNotification=t.TextDocumentSaveReason=t.DidSaveTextDocumentNotification=t.DidCloseTextDocumentNotification=t.DidChangeTextDocumentNotification=t.TextDocumentContentChangeEvent=t.DidOpenTextDocumentNotification=t.TextDocumentSyncKind=t.TelemetryEventNotification=t.LogMessageNotification=t.ShowMessageRequest=t.ShowMessageNotification=t.MessageType=t.DidChangeConfigurationNotification=t.ExitNotification=t.ShutdownRequest=t.InitializedNotification=t.InitializeErrorCodes=t.InitializeRequest=t.WorkDoneProgressOptions=t.TextDocumentRegistrationOptions=t.StaticRegistrationOptions=t.PositionEncodingKind=t.FailureHandlingKind=t.ResourceOperationKind=t.UnregistrationRequest=t.RegistrationRequest=t.DocumentSelector=t.NotebookCellTextDocumentFilter=t.NotebookDocumentFilter=t.TextDocumentFilter=void 0,t.MonikerRequest=t.MonikerKind=t.UniquenessLevel=t.WillDeleteFilesRequest=t.DidDeleteFilesNotification=t.WillRenameFilesRequest=t.DidRenameFilesNotification=t.WillCreateFilesRequest=t.DidCreateFilesNotification=t.FileOperationPatternKind=t.LinkedEditingRangeRequest=t.ShowDocumentRequest=t.SemanticTokensRegistrationType=t.SemanticTokensRefreshRequest=t.SemanticTokensRangeRequest=t.SemanticTokensDeltaRequest=t.SemanticTokensRequest=t.TokenFormat=t.CallHierarchyPrepareRequest=t.CallHierarchyOutgoingCallsRequest=t.CallHierarchyIncomingCallsRequest=t.WorkDoneProgressCancelNotification=t.WorkDoneProgressCreateRequest=t.WorkDoneProgress=t.SelectionRangeRequest=t.DeclarationRequest=t.FoldingRangeRefreshRequest=t.FoldingRangeRequest=t.ColorPresentationRequest=t.DocumentColorRequest=t.ConfigurationRequest=t.DidChangeWorkspaceFoldersNotification=t.WorkspaceFoldersRequest=t.TypeDefinitionRequest=t.ImplementationRequest=t.ApplyWorkspaceEditRequest=t.ExecuteCommandRequest=t.PrepareRenameRequest=t.RenameRequest=t.PrepareSupportDefaultBehavior=t.DocumentOnTypeFormattingRequest=t.DocumentRangesFormattingRequest=t.DocumentRangeFormattingRequest=t.DocumentFormattingRequest=t.DocumentLinkResolveRequest=t.DocumentLinkRequest=t.CodeLensRefreshRequest=t.CodeLensResolveRequest=t.CodeLensRequest=t.WorkspaceSymbolResolveRequest=void 0,t.InlineCompletionRequest=t.DidCloseNotebookDocumentNotification=t.DidSaveNotebookDocumentNotification=t.DidChangeNotebookDocumentNotification=t.NotebookCellArrayChange=t.DidOpenNotebookDocumentNotification=t.NotebookDocumentSyncRegistrationType=t.NotebookDocument=t.NotebookCell=t.ExecutionSummary=t.NotebookCellKind=t.DiagnosticRefreshRequest=t.WorkspaceDiagnosticRequest=t.DocumentDiagnosticRequest=t.DocumentDiagnosticReportKind=t.DiagnosticServerCancellationData=t.InlayHintRefreshRequest=t.InlayHintResolveRequest=t.InlayHintRequest=t.InlineValueRefreshRequest=t.InlineValueRequest=t.TypeHierarchySupertypesRequest=t.TypeHierarchySubtypesRequest=t.TypeHierarchyPrepareRequest=void 0;let n=Z(),i=(vn(),u(qe)),o=ur(),s=dr();Object.defineProperty(t,`ImplementationRequest`,{enumerable:!0,get:function(){return s.ImplementationRequest}});let c=fr();Object.defineProperty(t,`TypeDefinitionRequest`,{enumerable:!0,get:function(){return c.TypeDefinitionRequest}});let f=pr();Object.defineProperty(t,`WorkspaceFoldersRequest`,{enumerable:!0,get:function(){return f.WorkspaceFoldersRequest}}),Object.defineProperty(t,`DidChangeWorkspaceFoldersNotification`,{enumerable:!0,get:function(){return f.DidChangeWorkspaceFoldersNotification}});let p=mr();Object.defineProperty(t,`ConfigurationRequest`,{enumerable:!0,get:function(){return p.ConfigurationRequest}});let h=hr();Object.defineProperty(t,`DocumentColorRequest`,{enumerable:!0,get:function(){return h.DocumentColorRequest}}),Object.defineProperty(t,`ColorPresentationRequest`,{enumerable:!0,get:function(){return h.ColorPresentationRequest}});let g=gr();Object.defineProperty(t,`FoldingRangeRequest`,{enumerable:!0,get:function(){return g.FoldingRangeRequest}}),Object.defineProperty(t,`FoldingRangeRefreshRequest`,{enumerable:!0,get:function(){return g.FoldingRangeRefreshRequest}});let _=_r();Object.defineProperty(t,`DeclarationRequest`,{enumerable:!0,get:function(){return _.DeclarationRequest}});let x=vr();Object.defineProperty(t,`SelectionRangeRequest`,{enumerable:!0,get:function(){return x.SelectionRangeRequest}});let S=yr();Object.defineProperty(t,`WorkDoneProgress`,{enumerable:!0,get:function(){return S.WorkDoneProgress}}),Object.defineProperty(t,`WorkDoneProgressCreateRequest`,{enumerable:!0,get:function(){return S.WorkDoneProgressCreateRequest}}),Object.defineProperty(t,`WorkDoneProgressCancelNotification`,{enumerable:!0,get:function(){return S.WorkDoneProgressCancelNotification}});let T=br();Object.defineProperty(t,`CallHierarchyIncomingCallsRequest`,{enumerable:!0,get:function(){return T.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(t,`CallHierarchyOutgoingCallsRequest`,{enumerable:!0,get:function(){return T.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(t,`CallHierarchyPrepareRequest`,{enumerable:!0,get:function(){return T.CallHierarchyPrepareRequest}});let E=xr();Object.defineProperty(t,`TokenFormat`,{enumerable:!0,get:function(){return E.TokenFormat}}),Object.defineProperty(t,`SemanticTokensRequest`,{enumerable:!0,get:function(){return E.SemanticTokensRequest}}),Object.defineProperty(t,`SemanticTokensDeltaRequest`,{enumerable:!0,get:function(){return E.SemanticTokensDeltaRequest}}),Object.defineProperty(t,`SemanticTokensRangeRequest`,{enumerable:!0,get:function(){return E.SemanticTokensRangeRequest}}),Object.defineProperty(t,`SemanticTokensRefreshRequest`,{enumerable:!0,get:function(){return E.SemanticTokensRefreshRequest}}),Object.defineProperty(t,`SemanticTokensRegistrationType`,{enumerable:!0,get:function(){return E.SemanticTokensRegistrationType}});let D=Sr();Object.defineProperty(t,`ShowDocumentRequest`,{enumerable:!0,get:function(){return D.ShowDocumentRequest}});let ee=Cr();Object.defineProperty(t,`LinkedEditingRangeRequest`,{enumerable:!0,get:function(){return ee.LinkedEditingRangeRequest}});let O=wr();Object.defineProperty(t,`FileOperationPatternKind`,{enumerable:!0,get:function(){return O.FileOperationPatternKind}}),Object.defineProperty(t,`DidCreateFilesNotification`,{enumerable:!0,get:function(){return O.DidCreateFilesNotification}}),Object.defineProperty(t,`WillCreateFilesRequest`,{enumerable:!0,get:function(){return O.WillCreateFilesRequest}}),Object.defineProperty(t,`DidRenameFilesNotification`,{enumerable:!0,get:function(){return O.DidRenameFilesNotification}}),Object.defineProperty(t,`WillRenameFilesRequest`,{enumerable:!0,get:function(){return O.WillRenameFilesRequest}}),Object.defineProperty(t,`DidDeleteFilesNotification`,{enumerable:!0,get:function(){return O.DidDeleteFilesNotification}}),Object.defineProperty(t,`WillDeleteFilesRequest`,{enumerable:!0,get:function(){return O.WillDeleteFilesRequest}});let k=Tr();Object.defineProperty(t,`UniquenessLevel`,{enumerable:!0,get:function(){return k.UniquenessLevel}}),Object.defineProperty(t,`MonikerKind`,{enumerable:!0,get:function(){return k.MonikerKind}}),Object.defineProperty(t,`MonikerRequest`,{enumerable:!0,get:function(){return k.MonikerRequest}});let A=Er();Object.defineProperty(t,`TypeHierarchyPrepareRequest`,{enumerable:!0,get:function(){return A.TypeHierarchyPrepareRequest}}),Object.defineProperty(t,`TypeHierarchySubtypesRequest`,{enumerable:!0,get:function(){return A.TypeHierarchySubtypesRequest}}),Object.defineProperty(t,`TypeHierarchySupertypesRequest`,{enumerable:!0,get:function(){return A.TypeHierarchySupertypesRequest}});let j=Dr();Object.defineProperty(t,`InlineValueRequest`,{enumerable:!0,get:function(){return j.InlineValueRequest}}),Object.defineProperty(t,`InlineValueRefreshRequest`,{enumerable:!0,get:function(){return j.InlineValueRefreshRequest}});let M=Or();Object.defineProperty(t,`InlayHintRequest`,{enumerable:!0,get:function(){return M.InlayHintRequest}}),Object.defineProperty(t,`InlayHintResolveRequest`,{enumerable:!0,get:function(){return M.InlayHintResolveRequest}}),Object.defineProperty(t,`InlayHintRefreshRequest`,{enumerable:!0,get:function(){return M.InlayHintRefreshRequest}});let N=kr();Object.defineProperty(t,`DiagnosticServerCancellationData`,{enumerable:!0,get:function(){return N.DiagnosticServerCancellationData}}),Object.defineProperty(t,`DocumentDiagnosticReportKind`,{enumerable:!0,get:function(){return N.DocumentDiagnosticReportKind}}),Object.defineProperty(t,`DocumentDiagnosticRequest`,{enumerable:!0,get:function(){return N.DocumentDiagnosticRequest}}),Object.defineProperty(t,`WorkspaceDiagnosticRequest`,{enumerable:!0,get:function(){return N.WorkspaceDiagnosticRequest}}),Object.defineProperty(t,`DiagnosticRefreshRequest`,{enumerable:!0,get:function(){return N.DiagnosticRefreshRequest}});let P=Ar();Object.defineProperty(t,`NotebookCellKind`,{enumerable:!0,get:function(){return P.NotebookCellKind}}),Object.defineProperty(t,`ExecutionSummary`,{enumerable:!0,get:function(){return P.ExecutionSummary}}),Object.defineProperty(t,`NotebookCell`,{enumerable:!0,get:function(){return P.NotebookCell}}),Object.defineProperty(t,`NotebookDocument`,{enumerable:!0,get:function(){return P.NotebookDocument}}),Object.defineProperty(t,`NotebookDocumentSyncRegistrationType`,{enumerable:!0,get:function(){return P.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(t,`DidOpenNotebookDocumentNotification`,{enumerable:!0,get:function(){return P.DidOpenNotebookDocumentNotification}}),Object.defineProperty(t,`NotebookCellArrayChange`,{enumerable:!0,get:function(){return P.NotebookCellArrayChange}}),Object.defineProperty(t,`DidChangeNotebookDocumentNotification`,{enumerable:!0,get:function(){return P.DidChangeNotebookDocumentNotification}}),Object.defineProperty(t,`DidSaveNotebookDocumentNotification`,{enumerable:!0,get:function(){return P.DidSaveNotebookDocumentNotification}}),Object.defineProperty(t,`DidCloseNotebookDocumentNotification`,{enumerable:!0,get:function(){return P.DidCloseNotebookDocumentNotification}});let te=jr();Object.defineProperty(t,`InlineCompletionRequest`,{enumerable:!0,get:function(){return te.InlineCompletionRequest}});var F;(function(t){function is(t){let n=t;return o.string(n)||o.string(n.language)||o.string(n.scheme)||o.string(n.pattern)}t.is=is})(F||(t.TextDocumentFilter=F={}));var ne;(function(t){function is(t){let n=t;return o.objectLiteral(n)&&(o.string(n.notebookType)||o.string(n.scheme)||o.string(n.pattern))}t.is=is})(ne||(t.NotebookDocumentFilter=ne={}));var re;(function(t){function is(t){let n=t;return o.objectLiteral(n)&&(o.string(n.notebook)||ne.is(n.notebook))&&(n.language===void 0||o.string(n.language))}t.is=is})(re||(t.NotebookCellTextDocumentFilter=re={}));var ie;(function(t){function is(t){if(!Array.isArray(t))return!1;for(let n of t)if(!o.string(n)&&!F.is(n)&&!re.is(n))return!1;return!0}t.is=is})(ie||(t.DocumentSelector=ie={}));var ae;(function(t){t.method=`client/registerCapability`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType(t.method)})(ae||(t.RegistrationRequest=ae={}));var oe;(function(t){t.method=`client/unregisterCapability`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType(t.method)})(oe||(t.UnregistrationRequest=oe={}));var se;(function(t){t.Create=`create`,t.Rename=`rename`,t.Delete=`delete`})(se||(t.ResourceOperationKind=se={}));var ce;(function(t){t.Abort=`abort`,t.Transactional=`transactional`,t.TextOnlyTransactional=`textOnlyTransactional`,t.Undo=`undo`})(ce||(t.FailureHandlingKind=ce={}));var le;(function(t){t.UTF8=`utf-8`,t.UTF16=`utf-16`,t.UTF32=`utf-32`})(le||(t.PositionEncodingKind=le={}));var I;(function(t){function hasId(t){let n=t;return n&&o.string(n.id)&&n.id.length>0}t.hasId=hasId})(I||(t.StaticRegistrationOptions=I={}));var L;(function(t){function is(t){let n=t;return n&&(n.documentSelector===null||ie.is(n.documentSelector))}t.is=is})(L||(t.TextDocumentRegistrationOptions=L={}));var ue;(function(t){function is(t){let n=t;return o.objectLiteral(n)&&(n.workDoneProgress===void 0||o.boolean(n.workDoneProgress))}t.is=is;function hasWorkDoneProgress(t){let n=t;return n&&o.boolean(n.workDoneProgress)}t.hasWorkDoneProgress=hasWorkDoneProgress})(ue||(t.WorkDoneProgressOptions=ue={}));var R;(function(t){t.method=`initialize`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(R||(t.InitializeRequest=R={}));var z;(function(t){t.unknownProtocolVersion=1})(z||(t.InitializeErrorCodes=z={}));var de;(function(t){t.method=`initialized`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(de||(t.InitializedNotification=de={}));var B;(function(t){t.method=`shutdown`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType0(t.method)})(B||(t.ShutdownRequest=B={}));var fe;(function(t){t.method=`exit`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType0(t.method)})(fe||(t.ExitNotification=fe={}));var pe;(function(t){t.method=`workspace/didChangeConfiguration`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(pe||(t.DidChangeConfigurationNotification=pe={}));var me;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(me||(t.MessageType=me={}));var he;(function(t){t.method=`window/showMessage`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolNotificationType(t.method)})(he||(t.ShowMessageNotification=he={}));var ge;(function(t){t.method=`window/showMessageRequest`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType(t.method)})(ge||(t.ShowMessageRequest=ge={}));var _e;(function(t){t.method=`window/logMessage`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolNotificationType(t.method)})(_e||(t.LogMessageNotification=_e={}));var V;(function(t){t.method=`telemetry/event`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolNotificationType(t.method)})(V||(t.TelemetryEventNotification=V={}));var ve;(function(t){t.None=0,t.Full=1,t.Incremental=2})(ve||(t.TextDocumentSyncKind=ve={}));var ye;(function(t){t.method=`textDocument/didOpen`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(ye||(t.DidOpenTextDocumentNotification=ye={}));var be;(function(t){function isIncremental(t){let n=t;return n!=null&&typeof n.text==`string`&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength==`number`)}t.isIncremental=isIncremental;function isFull(t){let n=t;return n!=null&&typeof n.text==`string`&&n.range===void 0&&n.rangeLength===void 0}t.isFull=isFull})(be||(t.TextDocumentContentChangeEvent=be={}));var xe;(function(t){t.method=`textDocument/didChange`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(xe||(t.DidChangeTextDocumentNotification=xe={}));var Se;(function(t){t.method=`textDocument/didClose`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(Se||(t.DidCloseTextDocumentNotification=Se={}));var Ce;(function(t){t.method=`textDocument/didSave`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(Ce||(t.DidSaveTextDocumentNotification=Ce={}));var we;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(we||(t.TextDocumentSaveReason=we={}));var Te;(function(t){t.method=`textDocument/willSave`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(Te||(t.WillSaveTextDocumentNotification=Te={}));var Ee;(function(t){t.method=`textDocument/willSaveWaitUntil`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ee||(t.WillSaveTextDocumentWaitUntilRequest=Ee={}));var De;(function(t){t.method=`workspace/didChangeWatchedFiles`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolNotificationType(t.method)})(De||(t.DidChangeWatchedFilesNotification=De={}));var Oe;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(Oe||(t.FileChangeType=Oe={}));var ke;(function(t){function is(t){let n=t;return o.objectLiteral(n)&&(i.URI.is(n.baseUri)||i.WorkspaceFolder.is(n.baseUri))&&o.string(n.pattern)}t.is=is})(ke||(t.RelativePattern=ke={}));var Ae;(function(t){t.Create=1,t.Change=2,t.Delete=4})(Ae||(t.WatchKind=Ae={}));var je;(function(t){t.method=`textDocument/publishDiagnostics`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolNotificationType(t.method)})(je||(t.PublishDiagnosticsNotification=je={}));var Me;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(Me||(t.CompletionTriggerKind=Me={}));var Ne;(function(t){t.method=`textDocument/completion`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ne||(t.CompletionRequest=Ne={}));var Pe;(function(t){t.method=`completionItem/resolve`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Pe||(t.CompletionResolveRequest=Pe={}));var Fe;(function(t){t.method=`textDocument/hover`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Fe||(t.HoverRequest=Fe={}));var Ie;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(Ie||(t.SignatureHelpTriggerKind=Ie={}));var Le;(function(t){t.method=`textDocument/signatureHelp`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Le||(t.SignatureHelpRequest=Le={}));var Re;(function(t){t.method=`textDocument/definition`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Re||(t.DefinitionRequest=Re={}));var ze;(function(t){t.method=`textDocument/references`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(ze||(t.ReferencesRequest=ze={}));var H;(function(t){t.method=`textDocument/documentHighlight`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(H||(t.DocumentHighlightRequest=H={}));var Be;(function(t){t.method=`textDocument/documentSymbol`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Be||(t.DocumentSymbolRequest=Be={}));var Ve;(function(t){t.method=`textDocument/codeAction`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ve||(t.CodeActionRequest=Ve={}));var He;(function(t){t.method=`codeAction/resolve`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(He||(t.CodeActionResolveRequest=He={}));var Ue;(function(t){t.method=`workspace/symbol`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ue||(t.WorkspaceSymbolRequest=Ue={}));var We;(function(t){t.method=`workspaceSymbol/resolve`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(We||(t.WorkspaceSymbolResolveRequest=We={}));var Ge;(function(t){t.method=`textDocument/codeLens`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ge||(t.CodeLensRequest=Ge={}));var Ke;(function(t){t.method=`codeLens/resolve`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ke||(t.CodeLensResolveRequest=Ke={}));var Je;(function(t){t.method=`workspace/codeLens/refresh`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType0(t.method)})(Je||(t.CodeLensRefreshRequest=Je={}));var Ye;(function(t){t.method=`textDocument/documentLink`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ye||(t.DocumentLinkRequest=Ye={}));var Xe;(function(t){t.method=`documentLink/resolve`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Xe||(t.DocumentLinkResolveRequest=Xe={}));var Ze;(function(t){t.method=`textDocument/formatting`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Ze||(t.DocumentFormattingRequest=Ze={}));var U;(function(t){t.method=`textDocument/rangeFormatting`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(U||(t.DocumentRangeFormattingRequest=U={}));var W;(function(t){t.method=`textDocument/rangesFormatting`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(W||(t.DocumentRangesFormattingRequest=W={}));var Qe;(function(t){t.method=`textDocument/onTypeFormatting`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(Qe||(t.DocumentOnTypeFormattingRequest=Qe={}));var $e;(function(t){t.Identifier=1})($e||(t.PrepareSupportDefaultBehavior=$e={}));var et;(function(t){t.method=`textDocument/rename`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(et||(t.RenameRequest=et={}));var tt;(function(t){t.method=`textDocument/prepareRename`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(tt||(t.PrepareRenameRequest=tt={}));var nt;(function(t){t.method=`workspace/executeCommand`,t.messageDirection=n.MessageDirection.clientToServer,t.type=new n.ProtocolRequestType(t.method)})(nt||(t.ExecuteCommandRequest=nt={}));var rt;(function(t){t.method=`workspace/applyEdit`,t.messageDirection=n.MessageDirection.serverToClient,t.type=new n.ProtocolRequestType(`workspace/applyEdit`)})(rt||(t.ApplyWorkspaceEditRequest=rt={}))})),Nr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createProtocolConnection=void 0;let n=cr();function createProtocolConnection(t,i,o,s){return n.ConnectionStrategy.is(s)&&(s={connectionStrategy:s}),(0,n.createMessageConnection)(t,i,o,s)}t.createProtocolConnection=createProtocolConnection})),Pr=f((t=>{var n=t&&t.__createBinding||(Object.create?(function(t,n,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||(`get`in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,o,s)}):(function(t,n,i,o){o===void 0&&(o=i),t[o]=n[i]})),i=t&&t.__exportStar||function(t,i){for(var o in t)o!==`default`&&!Object.prototype.hasOwnProperty.call(i,o)&&n(i,t,o)};Object.defineProperty(t,`__esModule`,{value:!0}),t.LSPErrorCodes=t.createProtocolConnection=void 0,i(cr(),t),i((vn(),u(qe)),t),i(Z(),t),i(Mr(),t);var o=Nr();Object.defineProperty(t,`createProtocolConnection`,{enumerable:!0,get:function(){return o.createProtocolConnection}});var s;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(s||(t.LSPErrorCodes=s={}))})),Q=f((t=>{var n=t&&t.__createBinding||(Object.create?(function(t,n,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||(`get`in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,o,s)}):(function(t,n,i,o){o===void 0&&(o=i),t[o]=n[i]})),i=t&&t.__exportStar||function(t,i){for(var o in t)o!==`default`&&!Object.prototype.hasOwnProperty.call(i,o)&&n(i,t,o)};Object.defineProperty(t,`__esModule`,{value:!0}),t.createProtocolConnection=void 0;let o=lr();i(lr(),t),i(Pr(),t);function createProtocolConnection(t,n,i,s){return(0,o.createMessageConnection)(t,n,i,s)}t.createProtocolConnection=createProtocolConnection})),Fr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.generateUuid=t.parse=t.isUUID=t.v4=t.empty=void 0;var ValueUUID=class{constructor(t){this._value=t}asHex(){return this._value}equals(t){return this.asHex()===t.asHex()}},n=class V4UUID extends ValueUUID{static _oneOf(t){return t[Math.floor(t.length*Math.random())]}static _randomHex(){return V4UUID._oneOf(V4UUID._chars)}constructor(){super([V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),`-`,V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),`-`,`4`,V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),`-`,V4UUID._oneOf(V4UUID._timeHighBits),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),`-`,V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex()].join(``))}};n._chars=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`6`,`7`,`8`,`9`,`a`,`b`,`c`,`d`,`e`,`f`],n._timeHighBits=[`8`,`9`,`a`,`b`],t.empty=new ValueUUID(`00000000-0000-0000-0000-000000000000`);function v4(){return new n}t.v4=v4;let i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function isUUID(t){return i.test(t)}t.isUUID=isUUID;function parse(t){if(!isUUID(t))throw Error(`invalid uuid`);return new ValueUUID(t)}t.parse=parse;function generateUuid(){return v4().asHex()}t.generateUuid=generateUuid})),Ir=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.attachPartialResult=t.ProgressFeature=t.attachWorkDone=void 0;let n=Q(),i=Fr();var o=class WorkDoneProgressReporterImpl{constructor(t,n){this._connection=t,this._token=n,WorkDoneProgressReporterImpl.Instances.set(this._token,this)}begin(t,i,o,s){let c={kind:`begin`,title:t,percentage:i,message:o,cancellable:s};this._connection.sendProgress(n.WorkDoneProgress.type,this._token,c)}report(t,i){let o={kind:`report`};typeof t==`number`?(o.percentage=t,i!==void 0&&(o.message=i)):o.message=t,this._connection.sendProgress(n.WorkDoneProgress.type,this._token,o)}done(){WorkDoneProgressReporterImpl.Instances.delete(this._token),this._connection.sendProgress(n.WorkDoneProgress.type,this._token,{kind:`end`})}};o.Instances=new Map;var WorkDoneProgressServerReporterImpl=class extends o{constructor(t,i){super(t,i),this._source=new n.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},NullProgressReporter=class{constructor(){}begin(){}report(){}done(){}},NullProgressServerReporter=class extends NullProgressReporter{constructor(){super(),this._source=new n.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function attachWorkDone(t,n){if(n===void 0||n.workDoneToken===void 0)return new NullProgressReporter;let i=n.workDoneToken;return delete n.workDoneToken,new o(t,i)}t.attachWorkDone=attachWorkDone;let ProgressFeature=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(t){super.initialize(t),t?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(n.WorkDoneProgressCancelNotification.type,t=>{let n=o.Instances.get(t.token);(n instanceof WorkDoneProgressServerReporterImpl||n instanceof NullProgressServerReporter)&&n.cancel()}))}attachWorkDoneProgress(t){return t===void 0?new NullProgressReporter:new o(this.connection,t)}createWorkDoneProgress(){if(this._progressSupported){let t=(0,i.generateUuid)();return this.connection.sendRequest(n.WorkDoneProgressCreateRequest.type,{token:t}).then(()=>new WorkDoneProgressServerReporterImpl(this.connection,t))}else return Promise.resolve(new NullProgressServerReporter)}};t.ProgressFeature=ProgressFeature;var s;(function(t){t.type=new n.ProgressType})(s||={});var ResultProgressReporterImpl=class{constructor(t,n){this._connection=t,this._token=n}report(t){this._connection.sendProgress(s.type,this._token,t)}};function attachPartialResult(t,n){if(n===void 0||n.partialResultToken===void 0)return;let i=n.partialResultToken;return delete n.partialResultToken,new ResultProgressReporterImpl(t,i)}t.attachPartialResult=attachPartialResult})),Lr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ConfigurationFeature=void 0;let n=Q(),i=Xn(),ConfigurationFeature=t=>class extends t{getConfiguration(t){return t?i.string(t)?this._getConfiguration({section:t}):this._getConfiguration(t):this._getConfiguration({})}_getConfiguration(t){let i={items:Array.isArray(t)?t:[t]};return this.connection.sendRequest(n.ConfigurationRequest.type,i).then(n=>Array.isArray(n)?Array.isArray(t)?n:n[0]:Array.isArray(t)?[]:null)}};t.ConfigurationFeature=ConfigurationFeature})),Rr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WorkspaceFoldersFeature=void 0;let n=Q(),WorkspaceFoldersFeature=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(t){super.initialize(t);let i=t.workspace;i&&i.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new n.Emitter,this.connection.onNotification(n.DidChangeWorkspaceFoldersNotification.type,t=>{this._onDidChangeWorkspaceFolders.fire(t.event)}))}fillServerCapabilities(t){super.fillServerCapabilities(t);let n=t.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n==`string`}getWorkspaceFolders(){return this.connection.sendRequest(n.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw Error(`Client doesn't support sending workspace folder change events.`);return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(n.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};t.WorkspaceFoldersFeature=WorkspaceFoldersFeature})),zr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CallHierarchyFeature=void 0;let n=Q(),CallHierarchyFeature=t=>class extends t{get callHierarchy(){return{onPrepare:t=>this.connection.onRequest(n.CallHierarchyPrepareRequest.type,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:t=>{let i=n.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))},onOutgoingCalls:t=>{let i=n.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))}}}};t.CallHierarchyFeature=CallHierarchyFeature})),Br=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SemanticTokensBuilder=t.SemanticTokensDiff=t.SemanticTokensFeature=void 0;let n=Q(),SemanticTokensFeature=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(n.SemanticTokensRefreshRequest.type),on:t=>{let i=n.SemanticTokensRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))},onDelta:t=>{let i=n.SemanticTokensDeltaRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))},onRange:t=>{let i=n.SemanticTokensRangeRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))}}}};t.SemanticTokensFeature=SemanticTokensFeature;var SemanticTokensDiff=class{constructor(t,n){this.originalSequence=t,this.modifiedSequence=n}computeDiff(){let t=this.originalSequence.length,n=this.modifiedSequence.length,i=0;for(;i<n&&i<t&&this.originalSequence[i]===this.modifiedSequence[i];)i++;if(i<n&&i<t){let o=t-1,s=n-1;for(;o>=i&&s>=i&&this.originalSequence[o]===this.modifiedSequence[s];)o--,s--;(o<i||s<i)&&(o++,s++);let c=o-i+1,u=this.modifiedSequence.slice(i,s+1);return u.length===1&&u[0]===this.originalSequence[o]?[{start:i,deleteCount:c-1}]:[{start:i,deleteCount:c,data:u}]}else if(i<n)return[{start:i,deleteCount:0,data:this.modifiedSequence.slice(i)}];else if(i<t)return[{start:i,deleteCount:t-i}];else return[]}};t.SemanticTokensDiff=SemanticTokensDiff;var SemanticTokensBuilder=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(t,n,i,o,s){let c=t,u=n;this._dataLen>0&&(c-=this._prevLine,c===0&&(u-=this._prevChar)),this._data[this._dataLen++]=c,this._data[this._dataLen++]=u,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._data[this._dataLen++]=s,this._prevLine=t,this._prevChar=n}get id(){return this._id.toString()}previousResult(t){this.id===t&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData===void 0?this.build():{resultId:this.id,edits:new SemanticTokensDiff(this._prevData,this._data).computeDiff()}}};t.SemanticTokensBuilder=SemanticTokensBuilder})),Vr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ShowDocumentFeature=void 0;let n=Q(),ShowDocumentFeature=t=>class extends t{showDocument(t){return this.connection.sendRequest(n.ShowDocumentRequest.type,t)}};t.ShowDocumentFeature=ShowDocumentFeature})),Hr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.FileOperationsFeature=void 0;let n=Q(),FileOperationsFeature=t=>class extends t{onDidCreateFiles(t){return this.connection.onNotification(n.DidCreateFilesNotification.type,n=>{t(n)})}onDidRenameFiles(t){return this.connection.onNotification(n.DidRenameFilesNotification.type,n=>{t(n)})}onDidDeleteFiles(t){return this.connection.onNotification(n.DidDeleteFilesNotification.type,n=>{t(n)})}onWillCreateFiles(t){return this.connection.onRequest(n.WillCreateFilesRequest.type,(n,i)=>t(n,i))}onWillRenameFiles(t){return this.connection.onRequest(n.WillRenameFilesRequest.type,(n,i)=>t(n,i))}onWillDeleteFiles(t){return this.connection.onRequest(n.WillDeleteFilesRequest.type,(n,i)=>t(n,i))}};t.FileOperationsFeature=FileOperationsFeature})),Ur=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.LinkedEditingRangeFeature=void 0;let n=Q(),LinkedEditingRangeFeature=t=>class extends t{onLinkedEditingRange(t){return this.connection.onRequest(n.LinkedEditingRangeRequest.type,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),void 0))}};t.LinkedEditingRangeFeature=LinkedEditingRangeFeature})),Wr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TypeHierarchyFeature=void 0;let n=Q(),TypeHierarchyFeature=t=>class extends t{get typeHierarchy(){return{onPrepare:t=>this.connection.onRequest(n.TypeHierarchyPrepareRequest.type,(n,i)=>t(n,i,this.attachWorkDoneProgress(n),void 0)),onSupertypes:t=>{let i=n.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))},onSubtypes:t=>{let i=n.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))}}}};t.TypeHierarchyFeature=TypeHierarchyFeature})),Gr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InlineValueFeature=void 0;let n=Q(),InlineValueFeature=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(n.InlineValueRefreshRequest.type),on:t=>this.connection.onRequest(n.InlineValueRequest.type,(n,i)=>t(n,i,this.attachWorkDoneProgress(n)))}}};t.InlineValueFeature=InlineValueFeature})),Kr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.FoldingRangeFeature=void 0;let n=Q(),FoldingRangeFeature=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(n.FoldingRangeRefreshRequest.type),on:t=>{let i=n.FoldingRangeRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))}}}};t.FoldingRangeFeature=FoldingRangeFeature})),qr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InlayHintFeature=void 0;let n=Q(),InlayHintFeature=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(n.InlayHintRefreshRequest.type),on:t=>this.connection.onRequest(n.InlayHintRequest.type,(n,i)=>t(n,i,this.attachWorkDoneProgress(n))),resolve:t=>this.connection.onRequest(n.InlayHintResolveRequest.type,(n,i)=>t(n,i))}}};t.InlayHintFeature=InlayHintFeature})),Jr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DiagnosticFeature=void 0;let n=Q(),DiagnosticFeature=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(n.DiagnosticRefreshRequest.type),on:t=>this.connection.onRequest(n.DocumentDiagnosticRequest.type,(i,o)=>t(i,o,this.attachWorkDoneProgress(i),this.attachPartialResultProgress(n.DocumentDiagnosticRequest.partialResult,i))),onWorkspace:t=>this.connection.onRequest(n.WorkspaceDiagnosticRequest.type,(i,o)=>t(i,o,this.attachWorkDoneProgress(i),this.attachPartialResultProgress(n.WorkspaceDiagnosticRequest.partialResult,i)))}}};t.DiagnosticFeature=DiagnosticFeature})),Yr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TextDocuments=void 0;let n=Q();var TextDocuments=class{constructor(t){this._configuration=t,this._syncedDocuments=new Map,this._onDidChangeContent=new n.Emitter,this._onDidOpen=new n.Emitter,this._onDidClose=new n.Emitter,this._onDidSave=new n.Emitter,this._onWillSave=new n.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(t){this._willSaveWaitUntil=t}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(t){return this._syncedDocuments.get(t)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(t){t.__textDocumentSync=n.TextDocumentSyncKind.Incremental;let i=[];return i.push(t.onDidOpenTextDocument(t=>{let n=t.textDocument,i=this._configuration.create(n.uri,n.languageId,n.version,n.text);this._syncedDocuments.set(n.uri,i);let o=Object.freeze({document:i});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),i.push(t.onDidChangeTextDocument(t=>{let n=t.textDocument,i=t.contentChanges;if(i.length===0)return;let{version:o}=n;if(o==null)throw Error(`Received document change event for ${n.uri} without valid version identifier`);let s=this._syncedDocuments.get(n.uri);s!==void 0&&(s=this._configuration.update(s,i,o),this._syncedDocuments.set(n.uri,s),this._onDidChangeContent.fire(Object.freeze({document:s})))})),i.push(t.onDidCloseTextDocument(t=>{let n=this._syncedDocuments.get(t.textDocument.uri);n!==void 0&&(this._syncedDocuments.delete(t.textDocument.uri),this._onDidClose.fire(Object.freeze({document:n})))})),i.push(t.onWillSaveTextDocument(t=>{let n=this._syncedDocuments.get(t.textDocument.uri);n!==void 0&&this._onWillSave.fire(Object.freeze({document:n,reason:t.reason}))})),i.push(t.onWillSaveTextDocumentWaitUntil((t,n)=>{let i=this._syncedDocuments.get(t.textDocument.uri);return i!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:i,reason:t.reason}),n):[]})),i.push(t.onDidSaveTextDocument(t=>{let n=this._syncedDocuments.get(t.textDocument.uri);n!==void 0&&this._onDidSave.fire(Object.freeze({document:n}))})),n.Disposable.create(()=>{i.forEach(t=>t.dispose())})}};t.TextDocuments=TextDocuments})),Xr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.NotebookDocuments=t.NotebookSyncFeature=void 0;let n=Q(),i=Yr(),NotebookSyncFeature=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:t=>this.connection.onNotification(n.DidOpenNotebookDocumentNotification.type,n=>{t(n)}),onDidChangeNotebookDocument:t=>this.connection.onNotification(n.DidChangeNotebookDocumentNotification.type,n=>{t(n)}),onDidSaveNotebookDocument:t=>this.connection.onNotification(n.DidSaveNotebookDocumentNotification.type,n=>{t(n)}),onDidCloseNotebookDocument:t=>this.connection.onNotification(n.DidCloseNotebookDocumentNotification.type,n=>{t(n)})}}};t.NotebookSyncFeature=NotebookSyncFeature;var o=class CellTextDocumentConnection{onDidOpenTextDocument(t){return this.openHandler=t,n.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(t){this.openHandler&&this.openHandler(t)}onDidChangeTextDocument(t){return this.changeHandler=t,n.Disposable.create(()=>{this.changeHandler=t})}changeTextDocument(t){this.changeHandler&&this.changeHandler(t)}onDidCloseTextDocument(t){return this.closeHandler=t,n.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(t){this.closeHandler&&this.closeHandler(t)}onWillSaveTextDocument(){return CellTextDocumentConnection.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return CellTextDocumentConnection.NULL_DISPOSE}onDidSaveTextDocument(){return CellTextDocumentConnection.NULL_DISPOSE}};o.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var NotebookDocuments=class{constructor(t){t instanceof i.TextDocuments?this._cellTextDocuments=t:this._cellTextDocuments=new i.TextDocuments(t),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new n.Emitter,this._onDidChange=new n.Emitter,this._onDidSave=new n.Emitter,this._onDidClose=new n.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(t){return this._cellTextDocuments.get(t.document)}getNotebookDocument(t){return this.notebookDocuments.get(t)}getNotebookCell(t){let n=this.notebookCellMap.get(t);return n&&n[0]}findNotebookDocumentForCell(t){let n=typeof t==`string`?t:t.document,i=this.notebookCellMap.get(n);return i&&i[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(t){let i=new o,s=[];return s.push(this.cellTextDocuments.listen(i)),s.push(t.notebooks.synchronization.onDidOpenNotebookDocument(t=>{this.notebookDocuments.set(t.notebookDocument.uri,t.notebookDocument);for(let n of t.cellTextDocuments)i.openTextDocument({textDocument:n});this.updateCellMap(t.notebookDocument),this._onDidOpen.fire(t.notebookDocument)})),s.push(t.notebooks.synchronization.onDidChangeNotebookDocument(t=>{let n=this.notebookDocuments.get(t.notebookDocument.uri);if(n===void 0)return;n.version=t.notebookDocument.version;let o=n.metadata,s=!1,c=t.change;c.metadata!==void 0&&(s=!0,n.metadata=c.metadata);let u=[],f=[],p=[],h=[];if(c.cells!==void 0){let t=c.cells;if(t.structure!==void 0){let o=t.structure.array;if(n.cells.splice(o.start,o.deleteCount,...o.cells===void 0?[]:o.cells),t.structure.didOpen!==void 0)for(let n of t.structure.didOpen)i.openTextDocument({textDocument:n}),u.push(n.uri);if(t.structure.didClose)for(let n of t.structure.didClose)i.closeTextDocument({textDocument:n}),f.push(n.uri)}if(t.data!==void 0){let i=new Map(t.data.map(t=>[t.document,t]));for(let t=0;t<=n.cells.length;t++){let o=i.get(n.cells[t].document);if(o!==void 0){let s=n.cells.splice(t,1,o);if(p.push({old:s[0],new:o}),i.delete(o.document),i.size===0)break}}}if(t.textContent!==void 0)for(let n of t.textContent)i.changeTextDocument({textDocument:n.document,contentChanges:n.changes}),h.push(n.document.uri)}this.updateCellMap(n);let g={notebookDocument:n};s&&(g.metadata={old:o,new:n.metadata});let _=[];for(let t of u)_.push(this.getNotebookCell(t));let x=[];for(let t of f)x.push(this.getNotebookCell(t));let S=[];for(let t of h)S.push(this.getNotebookCell(t));(_.length>0||x.length>0||p.length>0||S.length>0)&&(g.cells={added:_,removed:x,changed:{data:p,textContent:S}}),(g.metadata!==void 0||g.cells!==void 0)&&this._onDidChange.fire(g)})),s.push(t.notebooks.synchronization.onDidSaveNotebookDocument(t=>{let n=this.notebookDocuments.get(t.notebookDocument.uri);n!==void 0&&this._onDidSave.fire(n)})),s.push(t.notebooks.synchronization.onDidCloseNotebookDocument(t=>{let n=this.notebookDocuments.get(t.notebookDocument.uri);if(n!==void 0){this._onDidClose.fire(n);for(let n of t.cellTextDocuments)i.closeTextDocument({textDocument:n});this.notebookDocuments.delete(t.notebookDocument.uri);for(let t of n.cells)this.notebookCellMap.delete(t.document)}})),n.Disposable.create(()=>{s.forEach(t=>t.dispose())})}updateCellMap(t){for(let n of t.cells)this.notebookCellMap.set(n.document,[n,t])}};t.NotebookDocuments=NotebookDocuments})),Zr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.MonikerFeature=void 0;let n=Q(),MonikerFeature=t=>class extends t{get moniker(){return{on:t=>{let i=n.MonikerRequest.type;return this.connection.onRequest(i,(n,o)=>t(n,o,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(i,n)))}}}};t.MonikerFeature=MonikerFeature})),Qr=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createConnection=t.combineFeatures=t.combineNotebooksFeatures=t.combineLanguagesFeatures=t.combineWorkspaceFeatures=t.combineWindowFeatures=t.combineClientFeatures=t.combineTracerFeatures=t.combineTelemetryFeatures=t.combineConsoleFeatures=t._NotebooksImpl=t._LanguagesImpl=t.BulkUnregistration=t.BulkRegistration=t.ErrorMessageTracker=void 0;let n=Q(),i=Xn(),o=Fr(),s=Ir(),c=Lr(),u=Rr(),f=zr(),p=Br(),h=Vr(),g=Hr(),_=Ur(),x=Wr(),S=Gr(),T=Kr(),E=qr(),D=Jr(),ee=Xr(),O=Zr();function null2Undefined(t){if(t!==null)return t}var ErrorMessageTracker=class{constructor(){this._messages=Object.create(null)}add(t){let n=this._messages[t];n||=0,n++,this._messages[t]=n}sendErrors(t){Object.keys(this._messages).forEach(n=>{t.window.showErrorMessage(n)})}};t.ErrorMessageTracker=ErrorMessageTracker;var RemoteConsoleImpl=class{constructor(){}rawAttach(t){this._rawConnection=t}attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}fillServerCapabilities(t){}initialize(t){}error(t){this.send(n.MessageType.Error,t)}warn(t){this.send(n.MessageType.Warning,t)}info(t){this.send(n.MessageType.Info,t)}log(t){this.send(n.MessageType.Log,t)}debug(t){this.send(n.MessageType.Debug,t)}send(t,i){this._rawConnection&&this._rawConnection.sendNotification(n.LogMessageNotification.type,{type:t,message:i}).catch(()=>{(0,n.RAL)().console.error(`Sending log message failed`)})}},_RemoteWindowImpl=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(t){}fillServerCapabilities(t){}showErrorMessage(t,...i){let o={type:n.MessageType.Error,message:t,actions:i};return this.connection.sendRequest(n.ShowMessageRequest.type,o).then(null2Undefined)}showWarningMessage(t,...i){let o={type:n.MessageType.Warning,message:t,actions:i};return this.connection.sendRequest(n.ShowMessageRequest.type,o).then(null2Undefined)}showInformationMessage(t,...i){let o={type:n.MessageType.Info,message:t,actions:i};return this.connection.sendRequest(n.ShowMessageRequest.type,o).then(null2Undefined)}};let k=(0,h.ShowDocumentFeature)((0,s.ProgressFeature)(_RemoteWindowImpl));var A;(function(t){function create(){return new BulkRegistrationImpl}t.create=create})(A||(t.BulkRegistration=A={}));var BulkRegistrationImpl=class{constructor(){this._registrations=[],this._registered=new Set}add(t,n){let s=i.string(t)?t:t.method;if(this._registered.has(s))throw Error(`${s} is already added to this registration`);let c=o.generateUuid();this._registrations.push({id:c,method:s,registerOptions:n||{}}),this._registered.add(s)}asRegistrationParams(){return{registrations:this._registrations}}},j;(function(t){function create(){return new BulkUnregistrationImpl(void 0,[])}t.create=create})(j||(t.BulkUnregistration=j={}));var BulkUnregistrationImpl=class{constructor(t,n){this._connection=t,this._unregistrations=new Map,n.forEach(t=>{this._unregistrations.set(t.method,t)})}get isAttached(){return!!this._connection}attach(t){this._connection=t}add(t){this._unregistrations.set(t.method,t)}dispose(){let t=[];for(let n of this._unregistrations.values())t.push(n);let i={unregisterations:t};this._connection.sendRequest(n.UnregistrationRequest.type,i).catch(()=>{this._connection.console.info(`Bulk unregistration failed.`)})}disposeSingle(t){let o=i.string(t)?t:t.method,s=this._unregistrations.get(o);if(!s)return!1;let c={unregisterations:[s]};return this._connection.sendRequest(n.UnregistrationRequest.type,c).then(()=>{this._unregistrations.delete(o)},t=>{this._connection.console.info(`Un-registering request handler for ${s.id} failed.`)}),!0}},RemoteClientImpl=class{attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(t){}fillServerCapabilities(t){}register(t,n,i){return t instanceof BulkRegistrationImpl?this.registerMany(t):t instanceof BulkUnregistrationImpl?this.registerSingle1(t,n,i):this.registerSingle2(t,n)}registerSingle1(t,s,c){let u=i.string(s)?s:s.method,f=o.generateUuid(),p={registrations:[{id:f,method:u,registerOptions:c||{}}]};return t.isAttached||t.attach(this.connection),this.connection.sendRequest(n.RegistrationRequest.type,p).then(n=>(t.add({id:f,method:u}),t),t=>(this.connection.console.info(`Registering request handler for ${u} failed.`),Promise.reject(t)))}registerSingle2(t,s){let c=i.string(t)?t:t.method,u=o.generateUuid(),f={registrations:[{id:u,method:c,registerOptions:s||{}}]};return this.connection.sendRequest(n.RegistrationRequest.type,f).then(t=>n.Disposable.create(()=>{this.unregisterSingle(u,c).catch(()=>{this.connection.console.info(`Un-registering capability with id ${u} failed.`)})}),t=>(this.connection.console.info(`Registering request handler for ${c} failed.`),Promise.reject(t)))}unregisterSingle(t,i){let o={unregisterations:[{id:t,method:i}]};return this.connection.sendRequest(n.UnregistrationRequest.type,o).catch(()=>{this.connection.console.info(`Un-registering request handler for ${t} failed.`)})}registerMany(t){let i=t.asRegistrationParams();return this.connection.sendRequest(n.RegistrationRequest.type,i).then(()=>new BulkUnregistrationImpl(this._connection,i.registrations.map(t=>({id:t.id,method:t.method}))),t=>(this.connection.console.info(`Bulk registration failed.`),Promise.reject(t)))}},_RemoteWorkspaceImpl=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(t){}fillServerCapabilities(t){}applyEdit(t){function isApplyWorkspaceEditParams(t){return t&&!!t.edit}let i=isApplyWorkspaceEditParams(t)?t:{edit:t};return this.connection.sendRequest(n.ApplyWorkspaceEditRequest.type,i)}};let M=(0,g.FileOperationsFeature)((0,u.WorkspaceFoldersFeature)((0,c.ConfigurationFeature)(_RemoteWorkspaceImpl)));var TracerImpl=class{constructor(){this._trace=n.Trace.Off}attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(t){}fillServerCapabilities(t){}set trace(t){this._trace=t}log(t,i){this._trace!==n.Trace.Off&&this.connection.sendNotification(n.LogTraceNotification.type,{message:t,verbose:this._trace===n.Trace.Verbose?i:void 0}).catch(()=>{})}},TelemetryImpl=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(t){}fillServerCapabilities(t){}logEvent(t){this.connection.sendNotification(n.TelemetryEventNotification.type,t).catch(()=>{this.connection.console.log(`Sending TelemetryEventNotification failed`)})}},_LanguagesImpl=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,s.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,s.attachPartialResult)(this.connection,n)}};t._LanguagesImpl=_LanguagesImpl;let N=(0,T.FoldingRangeFeature)((0,O.MonikerFeature)((0,D.DiagnosticFeature)((0,E.InlayHintFeature)((0,S.InlineValueFeature)((0,x.TypeHierarchyFeature)((0,_.LinkedEditingRangeFeature)((0,p.SemanticTokensFeature)((0,f.CallHierarchyFeature)(_LanguagesImpl)))))))));var _NotebooksImpl=class{constructor(){}attach(t){this._connection=t}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(t){}fillServerCapabilities(t){}attachWorkDoneProgress(t){return(0,s.attachWorkDone)(this.connection,t)}attachPartialResultProgress(t,n){return(0,s.attachPartialResult)(this.connection,n)}};t._NotebooksImpl=_NotebooksImpl;let P=(0,ee.NotebookSyncFeature)(_NotebooksImpl);function combineConsoleFeatures(t,n){return function(i){return n(t(i))}}t.combineConsoleFeatures=combineConsoleFeatures;function combineTelemetryFeatures(t,n){return function(i){return n(t(i))}}t.combineTelemetryFeatures=combineTelemetryFeatures;function combineTracerFeatures(t,n){return function(i){return n(t(i))}}t.combineTracerFeatures=combineTracerFeatures;function combineClientFeatures(t,n){return function(i){return n(t(i))}}t.combineClientFeatures=combineClientFeatures;function combineWindowFeatures(t,n){return function(i){return n(t(i))}}t.combineWindowFeatures=combineWindowFeatures;function combineWorkspaceFeatures(t,n){return function(i){return n(t(i))}}t.combineWorkspaceFeatures=combineWorkspaceFeatures;function combineLanguagesFeatures(t,n){return function(i){return n(t(i))}}t.combineLanguagesFeatures=combineLanguagesFeatures;function combineNotebooksFeatures(t,n){return function(i){return n(t(i))}}t.combineNotebooksFeatures=combineNotebooksFeatures;function combineFeatures(t,n){function combine(t,n,i){return t&&n?i(t,n):t||n}return{__brand:`features`,console:combine(t.console,n.console,combineConsoleFeatures),tracer:combine(t.tracer,n.tracer,combineTracerFeatures),telemetry:combine(t.telemetry,n.telemetry,combineTelemetryFeatures),client:combine(t.client,n.client,combineClientFeatures),window:combine(t.window,n.window,combineWindowFeatures),workspace:combine(t.workspace,n.workspace,combineWorkspaceFeatures),languages:combine(t.languages,n.languages,combineLanguagesFeatures),notebooks:combine(t.notebooks,n.notebooks,combineNotebooksFeatures)}}t.combineFeatures=combineFeatures;function createConnection(t,o,c){let u=c&&c.console?new(c.console(RemoteConsoleImpl)):new RemoteConsoleImpl,f=t(u);u.rawAttach(f);let p=c&&c.tracer?new(c.tracer(TracerImpl)):new TracerImpl,h=c&&c.telemetry?new(c.telemetry(TelemetryImpl)):new TelemetryImpl,g=c&&c.client?new(c.client(RemoteClientImpl)):new RemoteClientImpl,_=c&&c.window?new(c.window(k)):new k,x=c&&c.workspace?new(c.workspace(M)):new M,S=c&&c.languages?new(c.languages(N)):new N,T=c&&c.notebooks?new(c.notebooks(P)):new P,E=[u,p,h,g,_,x,S,T];function asPromise(t){return t instanceof Promise?t:i.thenable(t)?new Promise((n,i)=>{t.then(t=>n(t),t=>i(t))}):Promise.resolve(t)}let D,ee,O,A={listen:()=>f.listen(),sendRequest:(t,...n)=>f.sendRequest(i.string(t)?t:t.method,...n),onRequest:(t,n)=>f.onRequest(t,n),sendNotification:(t,n)=>{let o=i.string(t)?t:t.method;return f.sendNotification(o,n)},onNotification:(t,n)=>f.onNotification(t,n),onProgress:f.onProgress,sendProgress:f.sendProgress,onInitialize:t=>(ee=t,{dispose:()=>{ee=void 0}}),onInitialized:t=>f.onNotification(n.InitializedNotification.type,t),onShutdown:t=>(D=t,{dispose:()=>{D=void 0}}),onExit:t=>(O=t,{dispose:()=>{O=void 0}}),get console(){return u},get telemetry(){return h},get tracer(){return p},get client(){return g},get window(){return _},get workspace(){return x},get languages(){return S},get notebooks(){return T},onDidChangeConfiguration:t=>f.onNotification(n.DidChangeConfigurationNotification.type,t),onDidChangeWatchedFiles:t=>f.onNotification(n.DidChangeWatchedFilesNotification.type,t),__textDocumentSync:void 0,onDidOpenTextDocument:t=>f.onNotification(n.DidOpenTextDocumentNotification.type,t),onDidChangeTextDocument:t=>f.onNotification(n.DidChangeTextDocumentNotification.type,t),onDidCloseTextDocument:t=>f.onNotification(n.DidCloseTextDocumentNotification.type,t),onWillSaveTextDocument:t=>f.onNotification(n.WillSaveTextDocumentNotification.type,t),onWillSaveTextDocumentWaitUntil:t=>f.onRequest(n.WillSaveTextDocumentWaitUntilRequest.type,t),onDidSaveTextDocument:t=>f.onNotification(n.DidSaveTextDocumentNotification.type,t),sendDiagnostics:t=>f.sendNotification(n.PublishDiagnosticsNotification.type,t),onHover:t=>f.onRequest(n.HoverRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),void 0)),onCompletion:t=>f.onRequest(n.CompletionRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onCompletionResolve:t=>f.onRequest(n.CompletionResolveRequest.type,t),onSignatureHelp:t=>f.onRequest(n.SignatureHelpRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),void 0)),onDeclaration:t=>f.onRequest(n.DeclarationRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onDefinition:t=>f.onRequest(n.DefinitionRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onTypeDefinition:t=>f.onRequest(n.TypeDefinitionRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onImplementation:t=>f.onRequest(n.ImplementationRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onReferences:t=>f.onRequest(n.ReferencesRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onDocumentHighlight:t=>f.onRequest(n.DocumentHighlightRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onDocumentSymbol:t=>f.onRequest(n.DocumentSymbolRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onWorkspaceSymbol:t=>f.onRequest(n.WorkspaceSymbolRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onWorkspaceSymbolResolve:t=>f.onRequest(n.WorkspaceSymbolResolveRequest.type,t),onCodeAction:t=>f.onRequest(n.CodeActionRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onCodeActionResolve:t=>f.onRequest(n.CodeActionResolveRequest.type,(n,i)=>t(n,i)),onCodeLens:t=>f.onRequest(n.CodeLensRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onCodeLensResolve:t=>f.onRequest(n.CodeLensResolveRequest.type,(n,i)=>t(n,i)),onDocumentFormatting:t=>f.onRequest(n.DocumentFormattingRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),void 0)),onDocumentRangeFormatting:t=>f.onRequest(n.DocumentRangeFormattingRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),void 0)),onDocumentOnTypeFormatting:t=>f.onRequest(n.DocumentOnTypeFormattingRequest.type,(n,i)=>t(n,i)),onRenameRequest:t=>f.onRequest(n.RenameRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),void 0)),onPrepareRename:t=>f.onRequest(n.PrepareRenameRequest.type,(n,i)=>t(n,i)),onDocumentLinks:t=>f.onRequest(n.DocumentLinkRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onDocumentLinkResolve:t=>f.onRequest(n.DocumentLinkResolveRequest.type,(n,i)=>t(n,i)),onDocumentColor:t=>f.onRequest(n.DocumentColorRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onColorPresentation:t=>f.onRequest(n.ColorPresentationRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onFoldingRanges:t=>f.onRequest(n.FoldingRangeRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onSelectionRanges:t=>f.onRequest(n.SelectionRangeRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),(0,s.attachPartialResult)(f,n))),onExecuteCommand:t=>f.onRequest(n.ExecuteCommandRequest.type,(n,i)=>t(n,i,(0,s.attachWorkDone)(f,n),void 0)),dispose:()=>f.dispose()};for(let t of E)t.attach(A);return f.onRequest(n.InitializeRequest.type,t=>{o.initialize(t),i.string(t.trace)&&(p.trace=n.Trace.fromString(t.trace));for(let n of E)n.initialize(t.capabilities);if(ee)return asPromise(ee(t,new n.CancellationTokenSource().token,(0,s.attachWorkDone)(f,t),void 0)).then(t=>{if(t instanceof n.ResponseError)return t;let o=t;o||={capabilities:{}};let s=o.capabilities;s||(s={},o.capabilities=s),s.textDocumentSync===void 0||s.textDocumentSync===null?s.textDocumentSync=i.number(A.__textDocumentSync)?A.__textDocumentSync:n.TextDocumentSyncKind.None:!i.number(s.textDocumentSync)&&!i.number(s.textDocumentSync.change)&&(s.textDocumentSync.change=i.number(A.__textDocumentSync)?A.__textDocumentSync:n.TextDocumentSyncKind.None);for(let t of E)t.fillServerCapabilities(s);return o});{let t={capabilities:{textDocumentSync:n.TextDocumentSyncKind.None}};for(let n of E)n.fillServerCapabilities(t.capabilities);return t}}),f.onRequest(n.ShutdownRequest.type,()=>{if(o.shutdownReceived=!0,D)return D(new n.CancellationTokenSource().token)}),f.onNotification(n.ExitNotification.type,()=>{try{O&&O()}finally{o.shutdownReceived?o.exit(0):o.exit(1)}}),f.onNotification(n.SetTraceNotification.type,t=>{p.trace=n.Trace.fromString(t.value)}),A}t.createConnection=createConnection})),$r=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.resolveModulePath=t.FileSystem=t.resolveGlobalYarnPath=t.resolveGlobalNodePath=t.resolve=t.uriToFilePath=void 0;let n=s(`node:url`),i=s(`node:path`),o=s(`node:fs`),c=s(`node:child_process`);function uriToFilePath(t){let o=n.parse(t);if(o.protocol!==`file:`||!o.path)return;let s=o.path.split(`/`);for(var c=0,u=s.length;c<u;c++)s[c]=decodeURIComponent(s[c]);if(process.platform===`win32`&&s.length>1){let t=s[0],n=s[1];t.length===0&&n.length>1&&n[1]===`:`&&s.shift()}return i.normalize(s.join(`/`))}t.uriToFilePath=uriToFilePath;function isWindows(){return process.platform===`win32`}function resolve(t,n,s,u){let f=`NODE_PATH`,p=[`var p = process;`,`p.on('message',function(m){`,`if(m.c==='e'){`,`p.exit(0);`,`}`,`else if(m.c==='rs'){`,`try{`,`var r=require.resolve(m.a);`,`p.send({c:'r',s:true,r:r});`,`}`,`catch(err){`,`p.send({c:'r',s:false});`,`}`,`}`,`});`].join(``);return new Promise((h,g)=>{let _=process.env,x=Object.create(null);Object.keys(_).forEach(t=>x[t]=_[t]),n&&o.existsSync(n)&&(x[f]?x[f]=n+i.delimiter+x[f]:x[f]=n,u&&u(`NODE_PATH value is: ${x[f]}`)),x.ELECTRON_RUN_AS_NODE=`1`;try{let n=(0,c.fork)(``,[],{cwd:s,env:x,execArgv:[`-e`,p]});if(n.pid===void 0){g(Error(`Starting process to resolve node module ${t} failed`));return}n.on(`error`,t=>{g(t)}),n.on(`message`,i=>{i.c===`r`&&(n.send({c:`e`}),i.s?h(i.r):g(Error(`Failed to resolve module: ${t}`)))});let i={c:`rs`,a:t};n.send(i)}catch(t){g(t)}})}t.resolve=resolve;function resolveGlobalNodePath(t){let n=`npm`,o=Object.create(null);Object.keys(process.env).forEach(t=>o[t]=process.env[t]),o.NO_UPDATE_NOTIFIER=`true`;let s={encoding:`utf8`,env:o};isWindows()&&(n=`npm.cmd`,s.shell=!0);let handler=()=>{};try{process.on(`SIGPIPE`,handler);let o=(0,c.spawnSync)(n,[`config`,`get`,`prefix`],s).stdout;if(!o){t&&t(`'npm config get prefix' didn't return a value.`);return}let u=o.trim();return t&&t(`'npm config get prefix' value is: ${u}`),u.length>0?isWindows()?i.join(u,`node_modules`):i.join(u,`lib`,`node_modules`):void 0}catch{return}finally{process.removeListener(`SIGPIPE`,handler)}}t.resolveGlobalNodePath=resolveGlobalNodePath;function resolveGlobalYarnPath(t){let n=`yarn`,o={encoding:`utf8`};isWindows()&&(n=`yarn.cmd`,o.shell=!0);let handler=()=>{};try{process.on(`SIGPIPE`,handler);let s=(0,c.spawnSync)(n,[`global`,`dir`,`--json`],o),u=s.stdout;if(!u){t&&(t(`'yarn global dir' didn't return a value.`),s.stderr&&t(s.stderr));return}let f=u.trim().split(/\r?\n/);for(let t of f)try{let n=JSON.parse(t);if(n.type===`log`)return i.join(n.data,`node_modules`)}catch{}return}catch{return}finally{process.removeListener(`SIGPIPE`,handler)}}t.resolveGlobalYarnPath=resolveGlobalYarnPath;var u;(function(t){let n;function isCaseSensitive(){return n===void 0&&(n=process.platform===`win32`?!1:!o.existsSync(__filename.toUpperCase())||!o.existsSync(__filename.toLowerCase())),n}t.isCaseSensitive=isCaseSensitive;function isParent(t,n){return isCaseSensitive()?i.normalize(n).indexOf(i.normalize(t))===0:i.normalize(n).toLowerCase().indexOf(i.normalize(t).toLowerCase())===0}t.isParent=isParent})(u||(t.FileSystem=u={}));function resolveModulePath(t,n,o,s){return o?(i.isAbsolute(o)||(o=i.join(t,o)),resolve(n,o,o,s).then(t=>u.isParent(o,t)?t:Promise.reject(Error(`Failed to load ${n} from node path location.`))).then(void 0,i=>resolve(n,resolveGlobalNodePath(s),t,s))):resolve(n,resolveGlobalNodePath(s),t,s)}t.resolveModulePath=resolveModulePath})),ei=f(((t,n)=>{n.exports=Q()})),ti=f((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InlineCompletionFeature=void 0;let n=Q(),InlineCompletionFeature=t=>class extends t{get inlineCompletion(){return{on:t=>this.connection.onRequest(n.InlineCompletionRequest.type,(n,i)=>t(n,i,this.attachWorkDoneProgress(n)))}}};t.InlineCompletionFeature=InlineCompletionFeature})),ni=f((t=>{var n=t&&t.__createBinding||(Object.create?(function(t,n,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||(`get`in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,o,s)}):(function(t,n,i,o){o===void 0&&(o=i),t[o]=n[i]})),i=t&&t.__exportStar||function(t,i){for(var o in t)o!==`default`&&!Object.prototype.hasOwnProperty.call(i,o)&&n(i,t,o)};Object.defineProperty(t,`__esModule`,{value:!0}),t.ProposedFeatures=t.NotebookDocuments=t.TextDocuments=t.SemanticTokensBuilder=void 0;let o=Br();Object.defineProperty(t,`SemanticTokensBuilder`,{enumerable:!0,get:function(){return o.SemanticTokensBuilder}});let s=ti();i(Q(),t);let c=Yr();Object.defineProperty(t,`TextDocuments`,{enumerable:!0,get:function(){return c.TextDocuments}});let u=Xr();Object.defineProperty(t,`NotebookDocuments`,{enumerable:!0,get:function(){return u.NotebookDocuments}}),i(Qr(),t);var f;(function(t){t.all={__brand:`features`,languages:s.InlineCompletionFeature}})(f||(t.ProposedFeatures=f={}))})),ri=f((t=>{var n=t&&t.__createBinding||(Object.create?(function(t,n,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||(`get`in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,o,s)}):(function(t,n,i,o){o===void 0&&(o=i),t[o]=n[i]})),i=t&&t.__exportStar||function(t,i){for(var o in t)o!==`default`&&!Object.prototype.hasOwnProperty.call(i,o)&&n(i,t,o)};Object.defineProperty(t,`__esModule`,{value:!0}),t.createConnection=t.Files=void 0;let o=s(`node:util`),c=Xn(),u=Qr(),f=$r(),p=ei();i(ei(),t),i(ni(),t);var h;(function(t){t.uriToFilePath=f.uriToFilePath,t.resolveGlobalNodePath=f.resolveGlobalNodePath,t.resolveGlobalYarnPath=f.resolveGlobalYarnPath,t.resolve=f.resolve,t.resolveModulePath=f.resolveModulePath})(h||(t.Files=h={}));let g=!1,_;function setupExitTimer(){let t=`--clientProcessId`;function runTimer(t){try{let n=parseInt(t);isNaN(n)||(_=setInterval(()=>{try{process.kill(n,0)}catch{process.exit(+!g)}},3e3))}catch{}}for(let n=2;n<process.argv.length;n++){let i=process.argv[n];if(i===t&&n+1<process.argv.length){runTimer(process.argv[n+1]);return}else{let n=i.split(`=`);n[0]===t&&runTimer(n[1])}}}setupExitTimer();let x={initialize:t=>{let n=t.processId;c.number(n)&&_===void 0&&setInterval(()=>{try{process.kill(n,0)}catch{process.exit(+!g)}},3e3)},get shutdownReceived(){return g},set shutdownReceived(t){g=t},exit:t=>{process.exit(t)}};function createConnection(t,n,i,o){let s,c,u,f;return t!==void 0&&t.__brand===`features`&&(s=t,t=n,n=i,i=o),p.ConnectionStrategy.is(t)||p.ConnectionOptions.is(t)?f=t:(c=t,u=n,f=i),_createConnection(c,u,f,s)}t.createConnection=createConnection;function _createConnection(t,n,i,o){let s=!1;if(!t&&!n&&process.argv.length>2){let i,o,c=process.argv.slice(2);for(let u=0;u<c.length;u++){let h=c[u];if(h===`--node-ipc`){t=new p.IPCMessageReader(process),n=new p.IPCMessageWriter(process);break}else if(h===`--stdio`){s=!0,t=process.stdin,n=process.stdout;break}else if(h===`--socket`){i=parseInt(c[u+1]);break}else if(h===`--pipe`){o=c[u+1];break}else{var f=h.split(`=`);if(f[0]===`--socket`){i=parseInt(f[1]);break}else if(f[0]===`--pipe`){o=f[1];break}}}if(i){let o=(0,p.createServerSocketTransport)(i);t=o[0],n=o[1]}else if(o){let i=(0,p.createServerPipeTransport)(o);t=i[0],n=i[1]}}var h=`Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'`;if(!t)throw Error(`Connection input stream is not set. `+h);if(!n)throw Error(`Connection output stream is not set. `+h);if(c.func(t.read)&&c.func(t.on)){let n=t;n.on(`end`,()=>{process.exit(+!g)}),n.on(`close`,()=>{process.exit(+!g)})}let connectionFactory=o=>{let c=(0,p.createProtocolConnection)(t,n,o,i);return s&&patchConsole(o),c};return(0,u.createConnection)(connectionFactory,x,o)}function patchConsole(t){function serialize(t){return t.map(t=>typeof t==`string`?t:(0,o.inspect)(t)).join(` `)}let n=new Map;console.assert=function assert(n,...i){if(!n)if(i.length===0)t.error(`Assertion failed`);else{let[n,...o]=i;t.error(`Assertion failed: ${n} ${serialize(o)}`)}},console.count=function count(i=`default`){let o=String(i),s=n.get(o)??0;s+=1,n.set(o,s),t.log(`${o}: ${o}`)},console.countReset=function countReset(t){t===void 0?n.clear():n.delete(String(t))},console.debug=function debug(...n){t.log(serialize(n))},console.dir=function dir(n,i){t.log((0,o.inspect)(n,i))},console.log=function log(...n){t.log(serialize(n))},console.error=function error(...n){t.error(serialize(n))},console.trace=function trace(...n){let i=Error().stack.replace(/(.+\n){2}/,``),o=`Trace`;n.length!==0&&(o+=`: ${serialize(n)}`),t.log(`${o}\n${i}`)},console.warn=function warn(...n){t.warn(serialize(n))}}})),$=ri();function findNextFeatures(t,n){let i={stacks:t,tokens:n};return interpretTokens(i),i.stacks.flat().forEach(t=>{t.property=void 0}),findNextFeatureStacks(i.stacks).map(t=>t[t.length-1])}function findNextFeaturesInternal(t){let{next:n,cardinalities:i,visited:o,plus:s}=t,c=[],u=n.feature;if(o.has(u))return[];isGroup(u)||o.add(u);let f,p=u;for(;p.$container;)if(isGroup(p.$container)){f=p.$container;break}else if(isAbstractElement(p.$container))p=p.$container;else break;if(isArrayCardinality(p.cardinality)){let t=findFirstFeaturesInternal({next:{feature:p,type:n.type},cardinalities:i,visited:o,plus:s});for(let n of t)s.add(n.feature);c.push(...t)}if(f){let t=f.elements.indexOf(p);t!==void 0&&t<f.elements.length-1&&c.push(...findNextFeaturesInGroup({feature:f,type:n.type},t+1,i,o,s)),c.every(t=>isOptionalCardinality(t.feature.cardinality,t.feature)||isOptionalCardinality(i.get(t.feature))||s.has(t.feature))&&c.push(...findNextFeaturesInternal({next:{feature:f,type:n.type},cardinalities:i,visited:o,plus:s}))}return c}function findFirstFeatures(t){return isAstNode(t)&&(t={feature:t}),findFirstFeaturesInternal({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function findFirstFeaturesInternal(t){let{next:n,cardinalities:i,visited:o,plus:s}=t;if(n===void 0)return[];let{feature:c,type:u}=n;if(isGroup(c))return o.has(c)?[]:(o.add(c),findNextFeaturesInGroup(n,0,i,o,s).map(t=>modifyCardinality(t,c.cardinality,i)));if(isAlternatives(c)||isUnorderedGroup(c))return c.elements.flatMap(t=>findFirstFeaturesInternal({next:{feature:t,type:u,property:n.property},cardinalities:i,visited:o,plus:s})).map(t=>modifyCardinality(t,c.cardinality,i));if(isAssignment(c))return findFirstFeaturesInternal({next:{feature:c.terminal,type:u,property:n.property??c.feature},cardinalities:i,visited:o,plus:s}).map(t=>modifyCardinality(t,c.cardinality,i));if(isAction(c))return findNextFeaturesInternal({next:{feature:c,type:getTypeName(c),property:n.property??c.feature},cardinalities:i,visited:o,plus:s});if(isRuleCall(c)&&isParserRule(c.rule.ref)){let t=c.rule.ref;return findFirstFeaturesInternal({next:{feature:t.definition,type:t.fragment||t.dataType?void 0:getExplicitRuleType(t)??t.name,property:n.property},cardinalities:i,visited:o,plus:s}).map(t=>modifyCardinality(t,c.cardinality,i))}else return[n]}function modifyCardinality(t,n,i){return i.set(t.feature,n),t}function findNextFeaturesInGroup(t,n,i,o,s){let c=[],u;for(;n<t.feature.elements.length&&(u={feature:t.feature.elements[n++],type:t.type},c.push(...findFirstFeaturesInternal({next:u,cardinalities:i,visited:o,plus:s})),isOptionalCardinality(u.feature.cardinality??i.get(u.feature),u.feature)););return c}function interpretTokens(t){for(let n of t.tokens)t.stacks=findNextFeatureStacks(t.stacks,n)}function findNextFeatureStacks(t,n){let i=[];for(let o of t)i.push(...interpretStackToken(o,n));return i}function interpretStackToken(t,n){let i=new Map,o=new Set(t.map(t=>t.feature).filter(isPlusFeature)),s=[];for(;t.length>0;){let c=findNextFeaturesInternal({next:t.pop(),cardinalities:i,plus:o,visited:new Set}).filter(t=>n?featureMatches(t.feature,n):!0);for(let n of c)s.push([...t,n]);if(!c.every(t=>isOptionalCardinality(t.feature.cardinality,t.feature)||isOptionalCardinality(i.get(t.feature))))break}return s}function isPlusFeature(t){if(t.cardinality===`+`)return!0;let n=getContainerOfType(t,isAssignment);return!!(n&&n.cardinality===`+`)}function featureMatches(t,n){if(isKeyword(t))return t.value===n.image;if(isRuleCall(t))return ruleMatches(t.rule.ref,n);if(isCrossReference(t)){let i=getCrossReferenceTerminal(t);if(i)return featureMatches(i,n)}return!1}function ruleMatches(t,n){return isParserRule(t)?findFirstFeatures(t.definition).some(t=>featureMatches(t.feature,n)):isTerminalRule(t)?terminalRegex(t).test(n.image):!1}function mergeCompletionProviderOptions(t){let n=Array.from(new Set(t.flatMap(t=>t?.triggerCharacters??[]))),i=Array.from(new Set(t.flatMap(t=>t?.allCommitCharacters??[])));return{triggerCharacters:n.length>0?n:void 0,allCommitCharacters:i.length>0?i:void 0}}var DefaultCompletionProvider=class{constructor(t){this.scopeProvider=t.references.ScopeProvider,this.grammar=t.Grammar,this.completionParser=t.parser.CompletionParser,this.nameProvider=t.references.NameProvider,this.lexer=t.parser.Lexer,this.nodeKindProvider=t.shared.lsp.NodeKindProvider,this.fuzzyMatcher=t.shared.lsp.FuzzyMatcher,this.grammarConfig=t.parser.GrammarConfig,this.astReflection=t.shared.AstReflection,this.documentationProvider=t.documentation.DocumentationProvider}async getCompletion(t,n,i){let o=[],s=this.buildContexts(t,n.position),acceptor=(t,n)=>{let i=this.fillCompletionItem(t,n);i&&o.push(i)},distinctionFunction=t=>isKeyword(t.feature)?t.feature.value:t.feature,c=[];for(let t of s)if(await Promise.all(stream(t.features).distinct(distinctionFunction).exclude(c).map(n=>this.completionFor(t,n,acceptor))),c.push(...t.features),!this.continueCompletion(o))break;return $.CompletionList.create(this.deduplicateItems(o),!0)}deduplicateItems(t){return stream(t).distinct(t=>`${t.kind}_${t.label}_${t.detail}`).toArray()}findFeaturesAt(t,n){let i=t.getText({start:$.Position.create(0,0),end:t.positionAt(n)}),o=this.completionParser.parse(i),s=o.tokens;if(o.tokenIndex===0){let t=getEntryRule(this.grammar),n=findFirstFeatures({feature:t.definition,type:getExplicitRuleType(t)});return s.length>0?(s.shift(),findNextFeatures(n.map(t=>[t]),s)):n}let c=[...s].splice(o.tokenIndex);return findNextFeatures([o.elementStack.map(t=>({feature:t}))],c)}*buildContexts(t,n){let i=t.parseResult.value.$cstNode;if(!i)return;let o=t.textDocument,s=o.getText(),c=o.offsetAt(n),u={document:t,textDocument:o,offset:c,position:n},f=this.findDataTypeRuleStart(i,c);if(f){let[t,n]=f,s=findLeafNodeBeforeOffset(i,t)?.astNode;yield Object.assign(Object.assign({},u),{node:s,tokenOffset:t,tokenEndOffset:n,features:this.findFeaturesAt(o,t)})}let{nextTokenStart:p,nextTokenEnd:h,previousTokenStart:g,previousTokenEnd:_}=this.backtrackToAnyToken(s,c),x=p;c<=p&&g!==void 0&&(x=g);let S=findLeafNodeBeforeOffset(i,x)?.astNode,T=!0;if(g!==void 0&&_!==void 0&&_===c&&(yield Object.assign(Object.assign({},u),{node:S,tokenOffset:g,tokenEndOffset:_,features:this.findFeaturesAt(o,g)}),T=this.performNextTokenCompletion(t,s.substring(g,_),g,_),T&&(yield Object.assign(Object.assign({},u),{node:S,tokenOffset:_,tokenEndOffset:_,features:this.findFeaturesAt(o,_)}))),S)T&&(yield Object.assign(Object.assign({},u),{node:S,tokenOffset:p,tokenEndOffset:h,features:this.findFeaturesAt(o,p)}));else{let t=getEntryRule(this.grammar);if(!t)throw Error(`Missing entry parser rule`);yield Object.assign(Object.assign({},u),{tokenOffset:p,tokenEndOffset:h,features:findFirstFeatures(t.definition)})}}performNextTokenCompletion(t,n,i,o){return/\P{L}$/u.test(n)}findDataTypeRuleStart(t,n){let i=findDeclarationNodeAtOffset(t,n,this.grammarConfig.nameRegexp),o=!!getContainerOfType(i?.grammarSource,isParserRule)?.dataType;if(o){for(;o;)i=i?.container,o=!!getContainerOfType(i?.grammarSource,isParserRule)?.dataType;if(i)return[i.offset,i.end]}}continueCompletion(t){return t.length===0}backtrackToAnyToken(t,n){let i=this.lexer.tokenize(t).tokens;if(i.length===0)return{nextTokenStart:n,nextTokenEnd:n};let o;for(let t of i){if(t.startOffset>=n)return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:o?o.startOffset:void 0,previousTokenEnd:o?o.endOffset+1:void 0};if(t.endOffset>=n)return{nextTokenStart:t.startOffset,nextTokenEnd:t.endOffset+1,previousTokenStart:o?o.startOffset:void 0,previousTokenEnd:o?o.endOffset+1:void 0};o=t}return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:o?o.startOffset:void 0,previousTokenEnd:o?o.endOffset+1:void 0}}completionFor(t,n,i){if(isKeyword(n.feature))return this.completionForKeyword(t,n.feature,i);if(isCrossReference(n.feature)&&t.node)return this.completionForCrossReference(t,n,i)}completionForCrossReference(t,n,i){let o=getContainerOfType(n.feature,isAssignment),s=t.node;if(o&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},assignMandatoryProperties(this.astReflection,s));let c={reference:{$refText:``},container:s,property:o.feature};try{for(let n of this.getReferenceCandidates(c,t))i(t,this.createReferenceCompletionItem(n))}catch(t){console.error(t)}}}getReferenceCandidates(t,n){return this.scopeProvider.getScope(t).getAllElements()}createReferenceCompletionItem(t){return{nodeDescription:t,kind:this.nodeKindProvider.getCompletionItemKind(t),documentation:this.getReferenceDocumentation(t),detail:t.type,sortText:`0`}}getReferenceDocumentation(t){if(!t.node)return;let n=this.documentationProvider.getDocumentation(t.node);if(n)return{kind:`markdown`,value:n}}completionForKeyword(t,n,i){this.filterKeyword(t,n)&&i(t,{label:n.value,kind:this.getKeywordCompletionItemKind(n),detail:`Keyword`,sortText:`1`})}getKeywordCompletionItemKind(t){return $.CompletionItemKind.Keyword}filterKeyword(t,n){return/\p{L}/u.test(n.value)}fillCompletionItem(t,n){let i;if(typeof n.label==`string`)i=n.label;else if(`node`in n){let t=this.nameProvider.getName(n.node);if(!t)return;i=t}else if(`nodeDescription`in n)i=n.nodeDescription.name;else return;let o;o=typeof n.textEdit?.newText==`string`?n.textEdit.newText:typeof n.insertText==`string`?n.insertText:i;let s=n.textEdit??this.buildCompletionTextEdit(t,i,o);if(s)return{additionalTextEdits:n.additionalTextEdits,command:n.command,commitCharacters:n.commitCharacters,data:n.data,detail:n.detail,documentation:n.documentation,filterText:n.filterText,insertText:n.insertText,insertTextFormat:n.insertTextFormat,insertTextMode:n.insertTextMode,kind:n.kind,labelDetails:n.labelDetails,preselect:n.preselect,sortText:n.sortText,tags:n.tags,textEditText:n.textEditText,textEdit:s,label:i}}buildCompletionTextEdit(t,n,i){let o=t.textDocument.getText().substring(t.tokenOffset,t.offset);if(this.fuzzyMatcher.match(o,n))return{newText:i,range:{start:t.textDocument.positionAt(t.tokenOffset),end:t.position}}}},DefaultDefinitionProvider=class{constructor(t){this.nameProvider=t.references.NameProvider,this.references=t.references.References,this.grammarConfig=t.parser.GrammarConfig}getDefinition(t,n,i){let o=t.parseResult.value;if(o.$cstNode){let i=o.$cstNode,s=findDeclarationNodeAtOffset(i,t.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(s)return this.collectLocationLinks(s,n)}}collectLocationLinks(t,n){let i=this.findLink(t);if(i)return[$.LocationLink.create(i.targetDocument.textDocument.uri,(i.target.astNode.$cstNode??i.target).range,i.target.range,i.source.range)]}findLink(t){let n=this.references.findDeclarationNode(t);if(n?.astNode){let i=getDocument(n.astNode);if(n&&i)return{source:t,target:n,targetDocument:i}}}},DefaultDocumentHighlightProvider=class{constructor(t){this.references=t.references.References,this.nameProvider=t.references.NameProvider,this.grammarConfig=t.parser.GrammarConfig}getDocumentHighlight(t,n,i){let o=t.parseResult.value.$cstNode;if(!o)return;let s=findDeclarationNodeAtOffset(o,t.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(!s)return;let c=this.references.findDeclaration(s);if(c){let n=Y.equals(getDocument(c).uri,t.uri),i={documentUri:t.uri,includeDeclaration:n};return this.references.findReferences(c,i).map(t=>this.createDocumentHighlight(t)).toArray()}}createDocumentHighlight(t){return $.DocumentHighlight.create(t.segment.range)}},DefaultDocumentSymbolProvider=class{constructor(t){this.nameProvider=t.references.NameProvider,this.nodeKindProvider=t.shared.lsp.NodeKindProvider}getSymbols(t,n,i){return this.getSymbol(t,t.parseResult.value)}getSymbol(t,n){let i=n.$cstNode,o=this.nameProvider.getNameNode(n);if(o&&i){let s=this.nameProvider.getName(n);return[{kind:this.nodeKindProvider.getSymbolKind(n),name:s||o.text,range:i.range,selectionRange:o.range,children:this.getChildSymbols(t,n)}]}else return this.getChildSymbols(t,n)||[]}getChildSymbols(t,n){let i=[];for(let o of streamContents(n)){let n=this.getSymbol(t,o);i.push(...n)}if(i.length>0)return i}},DefaultDocumentUpdateHandler=class{constructor(t){this.workspaceManager=t.workspace.WorkspaceManager,this.documentBuilder=t.workspace.DocumentBuilder,this.workspaceLock=t.workspace.WorkspaceLock,this.serviceRegistry=t.ServiceRegistry;let n=!1;t.lsp.LanguageServer.onInitialize(t=>{n=!!t.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration}),t.lsp.LanguageServer.onInitialized(i=>{n&&this.registerFileWatcher(t)})}registerFileWatcher(t){let n=[],i=stream(t.ServiceRegistry.all).flatMap(t=>t.LanguageMetaData.fileExtensions).map(t=>t.startsWith(`.`)?t.substring(1):t).distinct().toArray();i.length>0&&n.push({globPattern:i.length===1?`**/*.${i[0]}`:`**/*.{${i.join(`,`)}}`});let o=stream(t.ServiceRegistry.all).flatMap(t=>t.LanguageMetaData.fileNames??[]).distinct().toArray();if(o.length>0&&n.push({globPattern:o.length===1?`**/${o[0]}`:`**/{${o.join(`,`)}}`}),n.length>0){let i=t.lsp.Connection,o={watchers:n};i?.client.register($.DidChangeWatchedFilesNotification.type,o)}}fireDocumentUpdate(t,n){t=t.filter(t=>this.serviceRegistry.hasServices(t)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(i=>this.documentBuilder.update(t,n,i))}).catch(t=>{console.error(`Workspace initialization failed. Could not perform document update.`,t)})}didChangeContent(t){this.fireDocumentUpdate([J.parse(t.document.uri)],[])}didChangeWatchedFiles(t){let n=stream(t.changes).filter(t=>t.type!==$.FileChangeType.Deleted).distinct(t=>t.uri).map(t=>J.parse(t.uri)).toArray(),i=stream(t.changes).filter(t=>t.type===$.FileChangeType.Deleted).distinct(t=>t.uri).map(t=>J.parse(t.uri)).toArray();this.fireDocumentUpdate(n,i)}},DefaultFoldingRangeProvider=class{constructor(t){this.commentNames=t.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(t,n,i){let o=[],acceptor=t=>o.push(t);return this.collectFolding(t,acceptor),o}collectFolding(t,n){let i=t.parseResult?.value;if(i){if(this.shouldProcessContent(i)){let o=streamAllContents(i).iterator(),s;do if(s=o.next(),!s.done){let i=s.value;this.shouldProcess(i)&&this.collectObjectFolding(t,i,n),this.shouldProcessContent(i)||o.prune()}while(!s.done)}this.collectCommentFolding(t,i,n)}}shouldProcess(t){return!0}shouldProcessContent(t){return!0}collectObjectFolding(t,n,i){let o=n.$cstNode;if(o){let n=this.toFoldingRange(t,o);n&&i(n)}}collectCommentFolding(t,n,i){let o=n.$cstNode;if(o){for(let n of flattenCst(o))if(this.commentNames.includes(n.tokenType.name)){let o=this.toFoldingRange(t,n,$.FoldingRangeKind.Comment);o&&i(o)}}}toFoldingRange(t,n,i){let o=n.range,s=o.start,c=o.end;if(!(c.line-s.line<2))return this.includeLastFoldingLine(n,i)||(c=t.textDocument.positionAt(t.textDocument.offsetAt({line:c.line,character:0})-1)),$.FoldingRange.create(s.line,c.line,s.character,c.character,i)}includeLastFoldingLine(t,n){if(n===$.FoldingRangeKind.Comment)return!1;let i=t.text,o=i.charAt(i.length-1);return!(o===`}`||o===`)`||o===`]`)}},DefaultFuzzyMatcher=class{match(t,n){if(t.length===0)return!0;let i=!1,o,s=0,c=n.length;for(let u=0;u<c;u++){let c=n.charCodeAt(u),f=t.charCodeAt(s);if((c===f||this.toUpperCharCode(c)===this.toUpperCharCode(f))&&(i||=o===void 0||this.isWordTransition(o,c),i&&s++,s===t.length))return!0;o=c}return!1}isWordTransition(t,n){return ii<=t&&t<=ai&&oi<=n&&n<=si||t===ci&&n!==ci}toUpperCharCode(t){return ii<=t&&t<=ai?t-32:t}};const ii=97,ai=122,oi=65,si=90,ci=95;var AstNodeHoverProvider=class{constructor(t){this.references=t.references.References,this.grammarConfig=t.parser.GrammarConfig}getHoverContent(t,n){let i=t.parseResult?.value?.$cstNode;if(i){let o=t.textDocument.offsetAt(n.position),s=findDeclarationNodeAtOffset(i,o,this.grammarConfig.nameRegexp);if(s&&s.offset+s.length>o){let t=this.references.findDeclaration(s);if(t)return this.getAstNodeHoverContent(t);if(isKeyword(s.grammarSource))return this.getKeywordHoverContent(s.grammarSource)}}}getKeywordHoverContent(t){let n=isAstNodeWithComment(t)?t.$comment:void 0;if(n||=findCommentNode(t.$cstNode,[`ML_COMMENT`])?.text,n&&isJSDoc(n)){let t=parseJSDoc(n).toMarkdown();if(t)return{contents:{kind:`markdown`,value:t}}}}},MultilineCommentHoverProvider=class extends AstNodeHoverProvider{constructor(t){super(t),this.documentationProvider=t.documentation.DocumentationProvider}getAstNodeHoverContent(t){let n=this.documentationProvider.getDocumentation(t);if(n)return{contents:{kind:`markdown`,value:n}}}},li=Q();const ui={[$.SemanticTokenTypes.class]:0,[$.SemanticTokenTypes.comment]:1,[$.SemanticTokenTypes.enum]:2,[$.SemanticTokenTypes.enumMember]:3,[$.SemanticTokenTypes.event]:4,[$.SemanticTokenTypes.function]:5,[$.SemanticTokenTypes.interface]:6,[$.SemanticTokenTypes.keyword]:7,[$.SemanticTokenTypes.macro]:8,[$.SemanticTokenTypes.method]:9,[$.SemanticTokenTypes.modifier]:10,[$.SemanticTokenTypes.namespace]:11,[$.SemanticTokenTypes.number]:12,[$.SemanticTokenTypes.operator]:13,[$.SemanticTokenTypes.parameter]:14,[$.SemanticTokenTypes.property]:15,[$.SemanticTokenTypes.regexp]:16,[$.SemanticTokenTypes.string]:17,[$.SemanticTokenTypes.struct]:18,[$.SemanticTokenTypes.type]:19,[$.SemanticTokenTypes.typeParameter]:20,[$.SemanticTokenTypes.variable]:21,[$.SemanticTokenTypes.decorator]:22},di={[$.SemanticTokenModifiers.abstract]:1,[$.SemanticTokenModifiers.async]:2,[$.SemanticTokenModifiers.declaration]:4,[$.SemanticTokenModifiers.defaultLibrary]:8,[$.SemanticTokenModifiers.definition]:16,[$.SemanticTokenModifiers.deprecated]:32,[$.SemanticTokenModifiers.documentation]:64,[$.SemanticTokenModifiers.modification]:128,[$.SemanticTokenModifiers.readonly]:256,[$.SemanticTokenModifiers.static]:512};function mergeSemanticTokenProviderOptions(t){let n=[],i=[],o=!0,s=!0,c=!0;for(let u of t)u&&(u.legend.tokenTypes.forEach((t,i)=>{let o=n[i];if(o&&o!==t)throw Error(`Cannot merge '${o}' and '${t}' token types. They use the same index ${i}.`);n[i]=t}),u.legend.tokenModifiers.forEach((t,n)=>{let o=i[n];if(o&&o!==t)throw Error(`Cannot merge '${o}' and '${t}' token modifier. They use the same index ${n}.`);i[n]=t}),u.full?typeof u.full==`object`&&!u.full.delta&&(s=!1):o=!1,u.range||(c=!1));return{legend:{tokenTypes:n,tokenModifiers:i},full:o&&{delta:s},range:c}}var SemanticTokensBuilder=class extends $.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(t,n,i,o,s){this._tokens.push({line:t,char:n,length:i,tokenType:o,tokenModifiers:s})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}flush(){this.previousResult(this.id)}applyTokens(){for(let t of this._tokens.sort(this.compareTokens))super.push(t.line,t.char,t.length,t.tokenType,t.tokenModifiers);this._tokens=[]}compareTokens(t,n){return t.line===n.line?t.char-n.char:t.line-n.line}},AbstractSemanticTokenProvider=class{constructor(t){this.tokensBuilders=new Map,t.shared.workspace.TextDocuments.onDidClose(t=>{this.tokensBuilders.delete(t.document.uri)}),t.shared.lsp.LanguageServer.onInitialize(t=>{this.initialize(t.capabilities.textDocument?.semanticTokens)})}initialize(t){this.clientCapabilities=t}get tokenTypes(){return ui}get tokenModifiers(){return di}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(t,n,i=q.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=t,this.currentTokensBuilder=this.getDocumentTokensBuilder(t),this.currentTokensBuilder.flush(),await this.computeHighlighting(t,this.createAcceptor(),i),this.currentTokensBuilder.build()}async semanticHighlightRange(t,n,i=q.CancellationToken.None){return this.currentRange=n.range,this.currentDocument=t,this.currentTokensBuilder=this.getDocumentTokensBuilder(t),this.currentTokensBuilder.flush(),await this.computeHighlighting(t,this.createAcceptor(),i),this.currentTokensBuilder.build()}async semanticHighlightDelta(t,n,i=q.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=t,this.currentTokensBuilder=this.getDocumentTokensBuilder(t),this.currentTokensBuilder.previousResult(n.previousResultId),await this.computeHighlighting(t,this.createAcceptor(),i),this.currentTokensBuilder.buildEdits()}createAcceptor(){let acceptor=t=>{`line`in t?this.highlightToken({range:{start:{line:t.line,character:t.char},end:{line:t.line,character:t.char+t.length}},type:t.type,modifier:t.modifier}):`range`in t?this.highlightToken(t):`keyword`in t?this.highlightKeyword(t):`property`in t?this.highlightProperty(t):this.highlightNode({node:t.cst,type:t.type,modifier:t.modifier})};return acceptor}getDocumentTokensBuilder(t){let n=this.tokensBuilders.get(t.uri.toString());if(n)return n;let i=new SemanticTokensBuilder;return this.tokensBuilders.set(t.uri.toString(),i),i}async computeHighlighting(t,n,i){let o=t.parseResult.value,s=streamAst(o,{range:this.currentRange}).iterator(),c;do if(c=s.next(),!c.done){await interruptAndCheck(i);let t=c.value;this.highlightElement(t,n)===`prune`&&s.prune()}while(!c.done)}highlightToken(t){let{range:n,type:i}=t,o=t.modifier;if(this.currentRange&&!inRange(n,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;let s=this.tokenTypes[i],c=0;if(o!==void 0){typeof o==`string`&&(o=[o]);for(let t of o){let n=this.tokenModifiers[t];c|=n}}let u=n.start.line,f=n.end.line;if(u===f){let t=n.start.character,i=n.end.character-t;this.currentTokensBuilder.push(u,t,i,s,c)}else if(this.clientCapabilities?.multilineTokenSupport){let t=n.start.character,i=this.currentDocument.textDocument.offsetAt(n.start),o=this.currentDocument.textDocument.offsetAt(n.end);this.currentTokensBuilder.push(u,t,o-i,s,c)}else{let t=n.start,i=this.currentDocument.textDocument.offsetAt({line:u+1,character:0});this.currentTokensBuilder.push(t.line,t.character,i-t.character-1,s,c);for(let t=u+1;t<f;t++){let n=i;i=this.currentDocument.textDocument.offsetAt({line:t+1,character:0}),this.currentTokensBuilder.push(t,0,i-n-1,s,c)}this.currentTokensBuilder.push(f,0,n.end.character,s,c)}}highlightProperty(t){let n=[];if(typeof t.index==`number`){let i=findNodeForProperty(t.node.$cstNode,t.property,t.index);i&&n.push(i)}else n.push(...findNodesForProperty(t.node.$cstNode,t.property));let{type:i,modifier:o}=t;for(let t of n)this.highlightNode({node:t,type:i,modifier:o})}highlightKeyword(t){let{node:n,keyword:i,type:o,index:s,modifier:c}=t,u=[];if(typeof s==`number`){let t=findNodeForKeyword(n.$cstNode,i,s);t&&u.push(t)}else u.push(...findNodesForKeyword(n.$cstNode,i));for(let t of u)this.highlightNode({node:t,type:o,modifier:c})}highlightNode(t){let{node:n,type:i,modifier:o}=t,s=n.range;this.highlightToken({range:s,type:i,modifier:o})}},fi;(function(t){function decode(t,n,i){let o=new Map;Object.entries(n).forEach(([t,n])=>o.set(n,t));let s=0,c=0;return sliceIntoChunks(t.data,5).map(t=>{s+=t[0],t[0]!==0&&(c=0),c+=t[1];let n=t[2];return{offset:i.textDocument.offsetAt({line:s,character:c}),tokenType:o.get(t[3]),tokenModifiers:t[4],text:i.textDocument.getText({start:{line:s,character:c},end:{line:s,character:c+n}})}})}t.decode=decode;function sliceIntoChunks(t,n){let i=[];for(let o=0;o<t.length;o+=n){let s=t.slice(o,o+n);i.push(s)}return i}})(fi||={});function mergeSignatureHelpOptions(t){let n=[],i=[];t.forEach(t=>{t?.triggerCharacters&&n.push(...t.triggerCharacters),t?.retriggerCharacters&&i.push(...t.retriggerCharacters)});let o={triggerCharacters:n.length>0?Array.from(new Set(n)).sort():void 0,retriggerCharacters:i.length>0?Array.from(new Set(i)).sort():void 0};return o.triggerCharacters?o:void 0}var DefaultLanguageServer=class{constructor(t){this.onInitializeEmitter=new li.Emitter,this.onInitializedEmitter=new li.Emitter,this.services=t}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(t){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(t),this.onInitializeEmitter.fire(t),this.onInitializeEmitter.dispose(),this.buildInitializeResult(t)}eagerLoadServices(){eagerLoad(this.services),this.services.ServiceRegistry.all.forEach(t=>eagerLoad(t))}hasService(t){return this.services.ServiceRegistry.all.some(n=>t(n)!==void 0)}buildInitializeResult(t){let n=this.services.lsp.DocumentUpdateHandler,i=this.services.lsp.FileOperationHandler?.fileOperationOptions,o=this.services.ServiceRegistry.all,s=this.hasService(t=>t.lsp?.Formatter),c=o.map(t=>t.lsp?.Formatter?.formatOnTypeOptions).find(t=>!!t),u=this.hasService(t=>t.lsp?.CodeActionProvider),f=this.hasService(t=>t.lsp?.SemanticTokenProvider),p=mergeSemanticTokenProviderOptions(o.map(t=>t.lsp?.SemanticTokenProvider?.semanticTokensOptions)),h=this.services.lsp?.ExecuteCommandHandler?.commands,g=this.hasService(t=>t.lsp?.DocumentLinkProvider),_=mergeSignatureHelpOptions(o.map(t=>t.lsp?.SignatureHelp?.signatureHelpOptions)),x=this.hasService(t=>t.lsp?.TypeProvider),S=this.hasService(t=>t.lsp?.ImplementationProvider),T=this.hasService(t=>t.lsp?.CompletionProvider),E=mergeCompletionProviderOptions(o.map(t=>t.lsp?.CompletionProvider?.completionOptions)),D=this.hasService(t=>t.lsp?.ReferencesProvider),ee=this.hasService(t=>t.lsp?.DocumentSymbolProvider),O=this.hasService(t=>t.lsp?.DefinitionProvider),k=this.hasService(t=>t.lsp?.DocumentHighlightProvider),A=this.hasService(t=>t.lsp?.FoldingRangeProvider),j=this.hasService(t=>t.lsp?.HoverProvider),M=this.hasService(t=>t.lsp?.RenameProvider),N=this.hasService(t=>t.lsp?.CallHierarchyProvider),P=this.hasService(t=>t.lsp?.TypeHierarchyProvider),te=this.hasService(t=>t.lsp?.CodeLensProvider),F=this.hasService(t=>t.lsp?.DeclarationProvider),ne=this.hasService(t=>t.lsp?.InlayHintProvider),re=this.services.lsp?.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:i},executeCommandProvider:h&&{commands:h},textDocumentSync:{change:li.TextDocumentSyncKind.Incremental,openClose:!0,save:!!n.didSaveDocument,willSave:!!n.willSaveDocument,willSaveWaitUntil:!!n.willSaveDocumentWaitUntil},completionProvider:T?E:void 0,referencesProvider:D,documentSymbolProvider:ee,definitionProvider:O,typeDefinitionProvider:x,documentHighlightProvider:k,codeActionProvider:u,documentFormattingProvider:s,documentRangeFormattingProvider:s,documentOnTypeFormattingProvider:c,foldingRangeProvider:A,hoverProvider:j,renameProvider:M?{prepareProvider:!0}:void 0,semanticTokensProvider:f?p:void 0,signatureHelpProvider:_,implementationProvider:S,callHierarchyProvider:N?{}:void 0,typeHierarchyProvider:P?{}:void 0,documentLinkProvider:g?{resolveProvider:!1}:void 0,codeLensProvider:te?{resolveProvider:!1}:void 0,declarationProvider:F,inlayHintProvider:ne?{resolveProvider:!1}:void 0,workspaceSymbolProvider:re?{resolveProvider:!!re.resolveSymbol}:void 0}}}initialized(t){this.fireInitializedOnDefaultServices(t),this.onInitializedEmitter.fire(t),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(t){this.services.workspace.ConfigurationProvider.initialize(t),this.services.workspace.WorkspaceManager.initialize(t)}fireInitializedOnDefaultServices(t){let n=this.services.lsp.Connection,i=n?Object.assign(Object.assign({},t),{register:t=>n.client.register(li.DidChangeConfigurationNotification.type,t),fetchConfiguration:t=>n.workspace.getConfiguration(t)}):t;this.services.workspace.ConfigurationProvider.initialized(i).catch(t=>console.error(`Error in ConfigurationProvider initialization:`,t)),this.services.workspace.WorkspaceManager.initialized(t).catch(t=>console.error(`Error in WorkspaceManager initialization:`,t))}};function startLanguageServer(t){let n=t.lsp.Connection;if(!n)throw Error(`Starting a language server requires the languageServer.Connection service to be set.`);addDocumentUpdateHandler(n,t),addFileOperationHandler(n,t),addDiagnosticsHandler(n,t),addCompletionHandler(n,t),addFindReferencesHandler(n,t),addDocumentSymbolHandler(n,t),addGotoDefinitionHandler(n,t),addGoToTypeDefinitionHandler(n,t),addGoToImplementationHandler(n,t),addDocumentHighlightsHandler(n,t),addFoldingRangeHandler(n,t),addFormattingHandler(n,t),addCodeActionHandler(n,t),addRenameHandler(n,t),addHoverHandler(n,t),addInlayHintHandler(n,t),addSemanticTokenHandler(n,t),addExecuteCommandHandler(n,t),addSignatureHelpHandler(n,t),addCallHierarchyHandler(n,t),addTypeHierarchyHandler(n,t),addCodeLensHandler(n,t),addDocumentLinkHandler(n,t),addConfigurationChangeHandler(n,t),addGoToDeclarationHandler(n,t),addWorkspaceSymbolHandler(n,t),n.onInitialize(n=>t.lsp.LanguageServer.initialize(n)),n.onInitialized(n=>{t.lsp.LanguageServer.initialized(n)}),t.workspace.TextDocuments.listen(n),n.listen()}function addDocumentUpdateHandler(t,n){let i=n.lsp.DocumentUpdateHandler,o=n.workspace.TextDocuments;i.didOpenDocument&&o.onDidOpen(t=>i.didOpenDocument(t)),i.didChangeContent&&o.onDidChangeContent(t=>i.didChangeContent(t)),i.didCloseDocument&&o.onDidClose(t=>i.didCloseDocument(t)),i.didSaveDocument&&o.onDidSave(t=>i.didSaveDocument(t)),i.willSaveDocument&&o.onWillSave(t=>i.willSaveDocument(t)),i.willSaveDocumentWaitUntil&&o.onWillSaveWaitUntil(t=>i.willSaveDocumentWaitUntil(t)),i.didChangeWatchedFiles&&t.onDidChangeWatchedFiles(t=>i.didChangeWatchedFiles(t))}function addFileOperationHandler(t,n){let i=n.lsp.FileOperationHandler;i&&(i.didCreateFiles&&t.workspace.onDidCreateFiles(t=>i.didCreateFiles(t)),i.didRenameFiles&&t.workspace.onDidRenameFiles(t=>i.didRenameFiles(t)),i.didDeleteFiles&&t.workspace.onDidDeleteFiles(t=>i.didDeleteFiles(t)),i.willCreateFiles&&t.workspace.onWillCreateFiles(t=>i.willCreateFiles(t)),i.willRenameFiles&&t.workspace.onWillRenameFiles(t=>i.willRenameFiles(t)),i.willDeleteFiles&&t.workspace.onWillDeleteFiles(t=>i.willDeleteFiles(t)))}function addDiagnosticsHandler(t,n){let i=n.workspace.DocumentBuilder;i.onUpdate(async(n,i)=>{for(let n of i)t.sendDiagnostics({uri:n.toString(),diagnostics:[]})}),i.onDocumentPhase(X.Validated,async n=>{n.diagnostics&&t.sendDiagnostics({uri:n.uri.toString(),diagnostics:n.diagnostics})})}function addCompletionHandler(t,n){t.onCompletion(createRequestHandler((t,n,i,o)=>(t.lsp?.CompletionProvider)?.getCompletion(n,i,o),n,X.IndexedReferences))}function addFindReferencesHandler(t,n){t.onReferences(createRequestHandler((t,n,i,o)=>(t.lsp?.ReferencesProvider)?.findReferences(n,i,o),n,X.IndexedReferences))}function addCodeActionHandler(t,n){t.onCodeAction(createRequestHandler((t,n,i,o)=>(t.lsp?.CodeActionProvider)?.getCodeActions(n,i,o),n,X.Validated))}function addDocumentSymbolHandler(t,n){t.onDocumentSymbol(createRequestHandler((t,n,i,o)=>(t.lsp?.DocumentSymbolProvider)?.getSymbols(n,i,o),n,X.Parsed))}function addGotoDefinitionHandler(t,n){t.onDefinition(createRequestHandler((t,n,i,o)=>(t.lsp?.DefinitionProvider)?.getDefinition(n,i,o),n,X.IndexedReferences))}function addGoToTypeDefinitionHandler(t,n){t.onTypeDefinition(createRequestHandler((t,n,i,o)=>(t.lsp?.TypeProvider)?.getTypeDefinition(n,i,o),n,X.IndexedReferences))}function addGoToImplementationHandler(t,n){t.onImplementation(createRequestHandler((t,n,i,o)=>(t.lsp?.ImplementationProvider)?.getImplementation(n,i,o),n,X.IndexedReferences))}function addGoToDeclarationHandler(t,n){t.onDeclaration(createRequestHandler((t,n,i,o)=>(t.lsp?.DeclarationProvider)?.getDeclaration(n,i,o),n,X.IndexedReferences))}function addDocumentHighlightsHandler(t,n){t.onDocumentHighlight(createRequestHandler((t,n,i,o)=>(t.lsp?.DocumentHighlightProvider)?.getDocumentHighlight(n,i,o),n,X.IndexedReferences))}function addHoverHandler(t,n){t.onHover(createRequestHandler((t,n,i,o)=>(t.lsp?.HoverProvider)?.getHoverContent(n,i,o),n,X.IndexedReferences))}function addFoldingRangeHandler(t,n){t.onFoldingRanges(createRequestHandler((t,n,i,o)=>(t.lsp?.FoldingRangeProvider)?.getFoldingRanges(n,i,o),n,X.Parsed))}function addFormattingHandler(t,n){t.onDocumentFormatting(createRequestHandler((t,n,i,o)=>(t.lsp?.Formatter)?.formatDocument(n,i,o),n,X.Parsed)),t.onDocumentRangeFormatting(createRequestHandler((t,n,i,o)=>(t.lsp?.Formatter)?.formatDocumentRange(n,i,o),n,X.Parsed)),t.onDocumentOnTypeFormatting(createRequestHandler((t,n,i,o)=>(t.lsp?.Formatter)?.formatDocumentOnType(n,i,o),n,X.Parsed))}function addRenameHandler(t,n){t.onRenameRequest(createRequestHandler((t,n,i,o)=>(t.lsp?.RenameProvider)?.rename(n,i,o),n,X.IndexedReferences)),t.onPrepareRename(createRequestHandler((t,n,i,o)=>(t.lsp?.RenameProvider)?.prepareRename(n,i,o),n,X.IndexedReferences))}function addInlayHintHandler(t,n){t.languages.inlayHint.on(createServerRequestHandler((t,n,i,o)=>(t.lsp?.InlayHintProvider)?.getInlayHints(n,i,o),n,X.IndexedReferences))}function addSemanticTokenHandler(t,n){let i={data:[]};t.languages.semanticTokens.on(createServerRequestHandler((t,n,o,s)=>t.lsp?.SemanticTokenProvider?t.lsp.SemanticTokenProvider.semanticHighlight(n,o,s):i,n,X.IndexedReferences)),t.languages.semanticTokens.onDelta(createServerRequestHandler((t,n,o,s)=>t.lsp?.SemanticTokenProvider?t.lsp.SemanticTokenProvider.semanticHighlightDelta(n,o,s):i,n,X.IndexedReferences)),t.languages.semanticTokens.onRange(createServerRequestHandler((t,n,o,s)=>t.lsp?.SemanticTokenProvider?t.lsp.SemanticTokenProvider.semanticHighlightRange(n,o,s):i,n,X.IndexedReferences))}function addConfigurationChangeHandler(t,n){t.onDidChangeConfiguration(t=>{t.settings&&n.workspace.ConfigurationProvider.updateConfiguration(t)})}function addExecuteCommandHandler(t,n){let i=n.lsp.ExecuteCommandHandler;i&&t.onExecuteCommand(async(t,n)=>{try{return await i.executeCommand(t.command,t.arguments??[],n)}catch(t){return responseError(t)}})}function addDocumentLinkHandler(t,n){t.onDocumentLinks(createServerRequestHandler((t,n,i,o)=>(t.lsp?.DocumentLinkProvider)?.getDocumentLinks(n,i,o),n,X.Parsed))}function addSignatureHelpHandler(t,n){t.onSignatureHelp(createServerRequestHandler((t,n,i,o)=>(t.lsp?.SignatureHelp)?.provideSignatureHelp(n,i,o),n,X.IndexedReferences))}function addCodeLensHandler(t,n){t.onCodeLens(createServerRequestHandler((t,n,i,o)=>(t.lsp?.CodeLensProvider)?.provideCodeLens(n,i,o),n,X.IndexedReferences))}function addWorkspaceSymbolHandler(t,n){let i=n.lsp.WorkspaceSymbolProvider;if(i){let o=n.workspace.DocumentBuilder;t.onWorkspaceSymbol(async(t,n)=>{try{return await o.waitUntil(X.IndexedContent,n),await i.getSymbols(t,n)}catch(t){return responseError(t)}});let s=i.resolveSymbol?.bind(i);s&&t.onWorkspaceSymbolResolve(async(t,n)=>{try{return await o.waitUntil(X.IndexedContent,n),await s(t,n)}catch(t){return responseError(t)}})}}function addCallHierarchyHandler(t,n){t.languages.callHierarchy.onPrepare(createServerRequestHandler(async(t,n,i,o)=>t.lsp?.CallHierarchyProvider?await t.lsp.CallHierarchyProvider.prepareCallHierarchy(n,i,o)??null:null,n,X.IndexedReferences)),t.languages.callHierarchy.onIncomingCalls(createHierarchyRequestHandler(async(t,n,i)=>t.lsp?.CallHierarchyProvider?await t.lsp.CallHierarchyProvider.incomingCalls(n,i)??null:null,n)),t.languages.callHierarchy.onOutgoingCalls(createHierarchyRequestHandler(async(t,n,i)=>t.lsp?.CallHierarchyProvider?await t.lsp.CallHierarchyProvider.outgoingCalls(n,i)??null:null,n))}function addTypeHierarchyHandler(t,n){n.ServiceRegistry.all.some(t=>t.lsp?.TypeHierarchyProvider)&&(t.languages.typeHierarchy.onPrepare(createServerRequestHandler(async(t,n,i,o)=>await(t.lsp?.TypeHierarchyProvider)?.prepareTypeHierarchy(n,i,o)??null,n,X.IndexedReferences)),t.languages.typeHierarchy.onSupertypes(createHierarchyRequestHandler(async(t,n,i)=>await(t.lsp?.TypeHierarchyProvider)?.supertypes(n,i)??null,n)),t.languages.typeHierarchy.onSubtypes(createHierarchyRequestHandler(async(t,n,i)=>await(t.lsp?.TypeHierarchyProvider)?.subtypes(n,i)??null,n)))}function createHierarchyRequestHandler(t,n){let i=n.ServiceRegistry;return async(o,s)=>{let c=J.parse(o.item.uri),u=await waitUntilPhase(n,s,c,X.IndexedReferences);if(u)return u;if(!i.hasServices(c)){let t=`Could not find service instance for uri: '${c}'`;return console.debug(t),responseError(Error(t))}let f=i.getServices(c);try{return await t(f,o,s)}catch(t){return responseError(t)}}}function createServerRequestHandler(t,n,i){let o=n.workspace.LangiumDocuments,s=n.ServiceRegistry;return async(c,u)=>{let f=J.parse(c.textDocument.uri),p=await waitUntilPhase(n,u,f,i);if(p)return p;if(!s.hasServices(f)){let t=`Could not find service instance for uri: '${f}'`;return console.debug(t),responseError(Error(t))}let h=s.getServices(f);try{return await t(h,await o.getOrCreateDocument(f),c,u)}catch(t){return responseError(t)}}}function createRequestHandler(t,n,i){let o=n.workspace.LangiumDocuments,s=n.ServiceRegistry;return async(c,u)=>{let f=J.parse(c.textDocument.uri),p=await waitUntilPhase(n,u,f,i);if(p)return p;if(!s.hasServices(f))return console.debug(`Could not find service instance for uri: '${f.toString()}'`),null;let h=s.getServices(f);try{return await t(h,await o.getOrCreateDocument(f),c,u)}catch(t){return responseError(t)}}}async function waitUntilPhase(t,n,i,o){if(o!==void 0){let s=t.workspace.DocumentBuilder;try{await s.waitUntil(o,i,n)}catch(t){return responseError(t)}}}function responseError(t){if(isOperationCancelled(t))return new li.ResponseError(li.LSPErrorCodes.RequestCancelled,`The request has been cancelled.`);if(t instanceof li.ResponseError)return t;throw t}var DefaultNodeKindProvider=class{getSymbolKind(t){return $.SymbolKind.Field}getCompletionItemKind(t){return $.CompletionItemKind.Reference}},DefaultReferencesProvider=class{constructor(t){this.nameProvider=t.references.NameProvider,this.references=t.references.References,this.grammarConfig=t.parser.GrammarConfig}findReferences(t,n,i){let o=t.parseResult.value.$cstNode;if(!o)return[];let s=findDeclarationNodeAtOffset(o,t.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);return s?this.getReferences(s,n,t):[]}getReferences(t,n,i){let o=[],s=this.references.findDeclaration(t);if(s){let t={includeDeclaration:n.context.includeDeclaration};this.references.findReferences(s,t).forEach(t=>{o.push($.Location.create(t.sourceUri.toString(),t.segment.range))})}return o}};vn();var DefaultRenameProvider=class{constructor(t){this.references=t.references.References,this.nameProvider=t.references.NameProvider,this.grammarConfig=t.parser.GrammarConfig}async rename(t,n,i){let o={},s=t.parseResult.value.$cstNode;if(!s)return;let c=findDeclarationNodeAtOffset(s,t.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(!c)return;let u=this.references.findDeclaration(c);if(u)return this.references.findReferences(u,{onlyLocal:!1,includeDeclaration:!0}).forEach(t=>{let i=dt.replace(t.segment.range,n.newName),s=t.sourceUri.toString();o[s]?o[s].push(i):o[s]=[i]}),{changes:o}}prepareRename(t,n,i){return this.renameNodeRange(t,n.position)}renameNodeRange(t,n){let i=t.parseResult.value.$cstNode,o=t.textDocument.offsetAt(n);if(i&&o){let t=findDeclarationNodeAtOffset(i,o,this.grammarConfig.nameRegexp);if(!t)return;if(this.references.findDeclaration(t)||this.isNameNode(t))return t.range}}isNameNode(t){return t?.astNode&&isNamed(t.astNode)&&t===this.nameProvider.getNameNode(t.astNode)}},DefaultWorkspaceSymbolProvider=class{constructor(t){this.indexManager=t.workspace.IndexManager,this.nodeKindProvider=t.lsp.NodeKindProvider,this.fuzzyMatcher=t.lsp.FuzzyMatcher}async getSymbols(t,n=q.CancellationToken.None){let i=[],o=t.query.toLowerCase();for(let t of this.indexManager.allElements())if(await interruptAndCheck(n),this.fuzzyMatcher.match(o,t.name)){let n=this.getWorkspaceSymbol(t);n&&i.push(n)}return i}getWorkspaceSymbol(t){let n=t.nameSegment;if(n)return{kind:this.nodeKindProvider.getSymbolKind(t),name:t.name,location:{range:n.range,uri:t.documentUri.toString()}}}},NormalizedTextDocuments=class{constructor(t){this._configuration=t,this._syncedDocuments=new Map,this._onDidChangeContent=new $.Emitter,this._onDidOpen=new $.Emitter,this._onDidClose=new $.Emitter,this._onDidSave=new $.Emitter,this._onWillSave=new $.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(t){this._willSaveWaitUntil=t}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(t){return this._syncedDocuments.get(Y.normalize(t))}set(t){let n=Y.normalize(t.uri),i=!0;this._syncedDocuments.has(n)&&(i=!1),this._syncedDocuments.set(n,t);let o=Object.freeze({document:t});return this._onDidOpen.fire(o),this._onDidChangeContent.fire(o),i}delete(t){let n=Y.normalize(typeof t==`object`&&`uri`in t?t.uri:t),i=this._syncedDocuments.get(n);i!==void 0&&(this._syncedDocuments.delete(n),this._onDidClose.fire(Object.freeze({document:i})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(t){t.__textDocumentSync=$.TextDocumentSyncKind.Incremental;let n=[];return n.push(t.onDidOpenTextDocument(t=>{let n=t.textDocument,i=Y.normalize(n.uri),o=this._configuration.create(i,n.languageId,n.version,n.text);this._syncedDocuments.set(i,o);let s=Object.freeze({document:o});this._onDidOpen.fire(s),this._onDidChangeContent.fire(s)})),n.push(t.onDidChangeTextDocument(t=>{let n=t.textDocument,i=t.contentChanges;if(i.length===0)return;let{version:o}=n;if(o==null)throw Error(`Received document change event for ${n.uri} without valid version identifier`);let s=Y.normalize(n.uri),c=this._syncedDocuments.get(s);c!==void 0&&(c=this._configuration.update(c,i,o),this._syncedDocuments.set(s,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),n.push(t.onDidCloseTextDocument(t=>{let n=Y.normalize(t.textDocument.uri),i=this._syncedDocuments.get(n);i!==void 0&&(this._syncedDocuments.delete(n),this._onDidClose.fire(Object.freeze({document:i})))})),n.push(t.onWillSaveTextDocument(t=>{let n=this._syncedDocuments.get(Y.normalize(t.textDocument.uri));n!==void 0&&this._onWillSave.fire(Object.freeze({document:n,reason:t.reason}))})),n.push(t.onWillSaveTextDocumentWaitUntil((t,n)=>{let i=this._syncedDocuments.get(Y.normalize(t.textDocument.uri));return i!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:i,reason:t.reason}),n):[]})),n.push(t.onDidSaveTextDocument(t=>{let n=this._syncedDocuments.get(Y.normalize(t.textDocument.uri));n!==void 0&&this._onDidSave.fire(Object.freeze({document:n}))})),$.Disposable.create(()=>{n.forEach(t=>t.dispose())})}},NormalizedNotebookDocuments=class{constructor(t){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new $.Emitter,this._onDidSave=new $.Emitter,this._onDidChange=new $.Emitter,this._onDidClose=new $.Emitter,`listen`in t?this._cellTextDocuments=t:this._cellTextDocuments=new NormalizedTextDocuments(t)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(t){return this._cellTextDocuments.get(t.document)}getNotebookDocument(t){return this.notebookDocuments.get(Y.normalize(t))}getNotebookCell(t){let n=this.notebookCellMap.get(Y.normalize(t));return n&&n[0]}findNotebookDocumentForCell(t){let n=typeof t==`string`||`scheme`in t?t:t.document,i=this.notebookCellMap.get(Y.normalize(n));return i&&i[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(t){let n=new pi,i=[];return i.push(this.cellTextDocuments.listen(n)),i.push(t.notebooks.synchronization.onDidOpenNotebookDocument(t=>{let i=Y.normalize(t.notebookDocument.uri);this.notebookDocuments.set(i,t.notebookDocument);for(let i of t.cellTextDocuments)n.openTextDocument({textDocument:i});this.updateCellMap(t.notebookDocument),this._onDidOpen.fire(t.notebookDocument)})),i.push(t.notebooks.synchronization.onDidChangeNotebookDocument(t=>{let i=Y.normalize(t.notebookDocument.uri),o=this.notebookDocuments.get(i);if(o===void 0)return;o.version=t.notebookDocument.version;let s=o.metadata,c=!1,u=t.change;u.metadata!==void 0&&(c=!0,o.metadata=u.metadata);let f=[],p=[],h=[],g=[];if(u.cells!==void 0){let t=u.cells;if(t.structure!==void 0){let i=t.structure.array;if(o.cells.splice(i.start,i.deleteCount,...i.cells===void 0?[]:i.cells),t.structure.didOpen!==void 0)for(let i of t.structure.didOpen)n.openTextDocument({textDocument:i}),f.push(i.uri);if(t.structure.didClose)for(let i of t.structure.didClose)n.closeTextDocument({textDocument:i}),p.push(i.uri)}if(t.data!==void 0){let n=new Map(t.data.map(t=>[t.document,t]));for(let t=0;t<=o.cells.length;t++){let i=n.get(o.cells[t].document);if(i!==void 0){let s=o.cells.splice(t,1,i);if(h.push({old:s[0],new:i}),n.delete(i.document),n.size===0)break}}}if(t.textContent!==void 0)for(let i of t.textContent)n.changeTextDocument({textDocument:i.document,contentChanges:i.changes}),g.push(i.document.uri)}this.updateCellMap(o);let _={notebookDocument:o};c&&(_.metadata={old:s,new:o.metadata});let x=[];for(let t of f)x.push(this.getNotebookCell(t));let S=[];for(let t of p)S.push(this.getNotebookCell(t));let T=[];for(let t of g)T.push(this.getNotebookCell(t));(x.length>0||S.length>0||h.length>0||T.length>0)&&(_.cells={added:x,removed:S,changed:{data:h,textContent:T}}),(_.metadata!==void 0||_.cells!==void 0)&&this._onDidChange.fire(_)})),i.push(t.notebooks.synchronization.onDidSaveNotebookDocument(t=>{let n=this.getNotebookDocument(t.notebookDocument.uri);n!==void 0&&this._onDidSave.fire(n)})),i.push(t.notebooks.synchronization.onDidCloseNotebookDocument(t=>{let i=Y.normalize(t.notebookDocument.uri),o=this.notebookDocuments.get(i);if(o!==void 0){this._onDidClose.fire(o);for(let i of t.cellTextDocuments)n.closeTextDocument({textDocument:i});this.notebookDocuments.delete(i);for(let t of o.cells)this.notebookCellMap.delete(t.document)}})),$.Disposable.create(()=>{i.forEach(t=>t.dispose())})}updateCellMap(t){for(let n of t.cells)this.notebookCellMap.set(n.document,[n,t])}},pi=class CellTextDocumentConnection{onDidOpenTextDocument(t){return this.openHandler=t,$.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(t){this.openHandler&&this.openHandler(t)}onDidChangeTextDocument(t){return this.changeHandler=t,$.Disposable.create(()=>{this.changeHandler=t})}changeTextDocument(t){this.changeHandler&&this.changeHandler(t)}onDidCloseTextDocument(t){return this.closeHandler=t,$.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(t){this.closeHandler&&this.closeHandler(t)}onWillSaveTextDocument(){return CellTextDocumentConnection.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return CellTextDocumentConnection.NULL_DISPOSE}onDidSaveTextDocument(){return CellTextDocumentConnection.NULL_DISPOSE}};pi.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function createDefaultModule(t){return Wn.merge(createDefaultCoreModule(t),createDefaultLSPModule(t))}function createDefaultLSPModule(t){return{lsp:{CompletionProvider:t=>new DefaultCompletionProvider(t),DocumentSymbolProvider:t=>new DefaultDocumentSymbolProvider(t),HoverProvider:t=>new MultilineCommentHoverProvider(t),FoldingRangeProvider:t=>new DefaultFoldingRangeProvider(t),ReferencesProvider:t=>new DefaultReferencesProvider(t),DefinitionProvider:t=>new DefaultDefinitionProvider(t),DocumentHighlightProvider:t=>new DefaultDocumentHighlightProvider(t),RenameProvider:t=>new DefaultRenameProvider(t)},shared:()=>t.shared}}function createDefaultSharedModule(t){return Wn.merge(createDefaultSharedCoreModule(t),createDefaultSharedLSPModule(t))}function createDefaultSharedLSPModule(t){return{lsp:{Connection:()=>t.connection,LanguageServer:t=>new DefaultLanguageServer(t),DocumentUpdateHandler:t=>new DefaultDocumentUpdateHandler(t),WorkspaceSymbolProvider:t=>new DefaultWorkspaceSymbolProvider(t),NodeKindProvider:()=>new DefaultNodeKindProvider,FuzzyMatcher:()=>new DefaultFuzzyMatcher},workspace:{TextDocuments:()=>new NormalizedTextDocuments(An),NotebookDocuments:t=>new NormalizedNotebookDocuments(t.workspace.TextDocuments)}}}var AbstractFormatter=class{constructor(){this.collector=()=>{}}getNodeFormatter(t){return new DefaultNodeFormatter(t,this.collector)}formatDocument(t,n){let i=t.parseResult;return i.lexerErrors.length===0&&i.parserErrors.length===0?this.doDocumentFormat(t,n.options):[]}isFormatRangeErrorFree(t,n){let i=t.parseResult;return i.lexerErrors.length||i.parserErrors.length?Math.min(...i.lexerErrors.map(t=>t.line??Number.MAX_VALUE),...i.parserErrors.map(t=>t.token.startLine??Number.MAX_VALUE))>n.end.line:!0}formatDocumentRange(t,n){return this.isFormatRangeErrorFree(t,n.range)?this.doDocumentFormat(t,n.options,n.range):[]}formatDocumentOnType(t,n){let i={start:{character:0,line:n.position.line},end:n.position};return this.isFormatRangeErrorFree(t,i)?this.doDocumentFormat(t,n.options,i):[]}get formatOnTypeOptions(){}doDocumentFormat(t,n,i){let o=new Map,collector=(t,n,i)=>{let s=this.nodeModeToKey(t,n),c=o.get(s),u=i.options.priority??0,f=c?.options.priority??0;(!c||f<=u)&&o.set(s,i)};this.collector=collector,this.iterateAstFormatting(t,i);let s=this.iterateCstFormatting(t,o,n,i);return this.avoidOverlappingEdits(t.textDocument,s)}avoidOverlappingEdits(t,n){let i=[];for(let o of n){let n=i[i.length-1];for(;n&&t.offsetAt(o.range.start)<t.offsetAt(n.range.end);)i.pop(),n=i[i.length-1];i.push(o)}return i.filter(n=>this.isNecessary(n,t))}iterateAstFormatting(t,n){let i=t.parseResult.value;this.format(i);let o=streamAllContents(i).iterator(),s;do if(s=o.next(),!s.done){let t=s.value;this.insideRange(t.$cstNode.range,n)?this.format(t):o.prune()}while(!s.done)}nodeModeToKey(t,n){return`${t.offset}:${t.end}:${n}`}insideRange(t,n){return!n||t.start.line<=n.start.line&&t.end.line>=n.end.line||t.start.line>=n.start.line&&t.end.line<=n.end.line||t.start.line<=n.end.line&&t.end.line>=n.end.line}isNecessary(t,n){return t.newText!==n.getText(t.range).replace(/\r/g,``)}iterateCstFormatting(t,n,i,o){let s={indentation:0,options:i,document:t.textDocument},c=[],u=this.iterateCstTree(t,s).iterator(),f,p;do if(p=u.next(),!p.done){let t=p.value,i=isLeafCstNode(t),u=this.nodeModeToKey(t,`prepend`),h=n.get(u);if(n.delete(u),h){let n=this.createTextEdit(f,t,h,s);for(let t of n)t&&this.insideRange(t.range,o)&&c.push(t)}let g=this.nodeModeToKey(t,`append`),_=n.get(g);if(n.delete(g),_){let n=getNextNode(t);if(n){let i=this.createTextEdit(t,n,_,s);for(let t of i)t&&this.insideRange(t.range,o)&&c.push(t)}}if(!h&&t.hidden){let n=this.createHiddenTextEdits(f,t,void 0,s);for(let t of n)t&&this.insideRange(t.range,o)&&c.push(t)}i&&(f=t)}while(!p.done);return c}createHiddenTextEdits(t,n,i,o){let s=n.range.start.line;if(t&&t.range.end.line===s)return[];let c=[],u={start:{character:0,line:s},end:n.range.start},f=o.document.getText(u),p=this.findFittingMove(u,i?.moves??[],o),h=this.getExistingIndentationCharacterCount(f,o),g=this.getIndentationCharacterCount(o,p)-h;if(g===0)return[];let _=``;g>0&&(_=(o.options.insertSpaces?` `:` `).repeat(g));let x=n.text.split(`
27
+ `);x[0]=f+x[0];for(let t=0;t<x.length;t++){let n=s+t,i={character:0,line:n};if(g>0)c.push({newText:_,range:{start:i,end:i}});else{let o=x[t],s=0;for(;s<o.length;s++){let t=o.charAt(s);if(t!==` `&&t!==` `)break}c.push({newText:``,range:{start:i,end:{line:n,character:Math.min(s,Math.abs(g))}}})}}return c}getExistingIndentationCharacterCount(t,n){let i=` `.repeat(n.options.tabSize);return(n.options.insertSpaces?t.replaceAll(` `,i):t.replaceAll(i,` `)).length}getIndentationCharacterCount(t,n){let i=t.indentation;return n&&n.tabs&&(i+=n.tabs),(t.options.insertSpaces?t.options.tabSize:1)*i}createTextEdit(t,n,i,o){if(n.hidden)return this.createHiddenTextEdits(t,n,i,o);if(t&&(t.range.end.line>n.range.start.line||t.range.end.line===n.range.start.line&&t.range.end.character>n.range.start.character))return[];let s={start:t?.range.end??{character:0,line:0},end:n.range.start},c=this.findFittingMove(s,i.moves,o);if(!c)return[];let u=c.characters,f=c.lines,p=c.tabs,h=o.indentation;o.indentation+=p??0;let g=[];return u===void 0?f===void 0?p!==void 0&&g.push(this.createTabTextEdit(s,!!t,o)):g.push(this.createLineTextEdit(s,f,o,i.options)):t?.hidden||g.push(this.createSpaceTextEdit(s,u,i.options)),isLeafCstNode(n)&&(o.indentation=h),g}createSpaceTextEdit(t,n,i){if(t.start.line===t.end.line){let o=t.end.character-t.start.character;n=this.fitIntoOptions(n,o,i)}return{newText:` `.repeat(n),range:t}}createLineTextEdit(t,n,i,o){let s=t.end.line-t.start.line;n=this.fitIntoOptions(n,s,o);let c=(i.options.insertSpaces?` `.repeat(i.options.tabSize):` `).repeat(i.indentation);return{newText:`${`
28
+ `.repeat(n)}${c}`,range:t}}createTabTextEdit(t,n,i){let o=(i.options.insertSpaces?` `.repeat(i.options.tabSize):` `).repeat(i.indentation),s=+!!n,c=Math.max(t.end.line-t.start.line,s);return{newText:`${`
29
+ `.repeat(c)}${o}`,range:t}}fitIntoOptions(t,n,i){return i.allowMore?t=Math.max(n,t):i.allowLess&&(t=Math.min(n,t)),t}findFittingMove(t,n,i){if(n.length===0)return;if(n.length===1)return n[0];let o=t.end.line-t.start.line;for(let t of n)if(t.lines!==void 0&&o<=t.lines)return t;else if(t.lines===void 0&&o===0)return t;return n[n.length-1]}iterateCstTree(t,n){let i=t.parseResult.value.$cstNode;return i?new TreeStreamImpl(i,t=>this.iterateCst(t,n)):A}iterateCst(t,n){if(!isCompositeCstNode(t))return A;let i=n.indentation;return new k(()=>({index:0}),o=>o.index<t.content.length?{done:!1,value:t.content[o.index++]}:(n.indentation=i,j))}},DefaultNodeFormatter=class{constructor(t,n){this.astNode=t,this.collector=n}node(t){return new mi(t.$cstNode?[t.$cstNode]:[],this.collector)}nodes(...t){let n=[];for(let i of t)i.$cstNode&&n.push(i.$cstNode);return new mi(n,this.collector)}property(t,n){let i=findNodeForProperty(this.astNode.$cstNode,t,n);return new mi(i?[i]:[],this.collector)}properties(...t){let n=[];for(let i of t){let t=findNodesForProperty(this.astNode.$cstNode,i);n.push(...t)}return new mi(n,this.collector)}keyword(t,n){let i=findNodeForKeyword(this.astNode.$cstNode,t,n);return new mi(i?[i]:[],this.collector)}keywords(...t){let n=[];for(let i of t){let t=findNodesForKeyword(this.astNode.$cstNode,i);n.push(...t)}return new mi(n,this.collector)}cst(t){return new mi([...t],this.collector)}interior(t,n){let i=t.nodes,o=n.nodes;if(i.length!==1||o.length!==1)return new mi([],this.collector);let s=i[0],c=o[0];if(s.offset>c.offset){let t=s;s=c,c=t}return new mi(getInteriorNodes(s,c),this.collector)}},mi=class FormattingRegion{constructor(t,n){this.nodes=t,this.collector=n}prepend(t){for(let n of this.nodes)this.collector(n,`prepend`,t);return this}append(t){for(let n of this.nodes)this.collector(n,`append`,t);return this}surround(t){for(let n of this.nodes)this.collector(n,`prepend`,t),this.collector(n,`append`,t);return this}slice(t,n){return new FormattingRegion(this.nodes.slice(t,n),this.collector)}},hi;(function(t){function fit(...t){return{options:{},moves:t.flatMap(t=>t.moves).sort(compareMoves)}}t.fit=fit;function noSpace(t){return spaces(0,t)}t.noSpace=noSpace;function oneSpace(t){return spaces(1,t)}t.oneSpace=oneSpace;function spaces(t,n){return{options:n??{},moves:[{characters:t}]}}t.spaces=spaces;function newLine(t){return newLines(1,t)}t.newLine=newLine;function newLines(t,n){return{options:n??{},moves:[{lines:t}]}}t.newLines=newLines;function indent(t){return{options:t??{},moves:[{tabs:1,lines:1}]}}t.indent=indent;function noIndent(t){return{options:t??{},moves:[{tabs:0}]}}t.noIndent=noIndent;function compareMoves(t,n){let i=t.lines??0,o=n.lines??0,s=t.tabs??0,c=n.tabs??0,u=t.characters??0,f=n.characters??0;return i<o?-1:i>o?1:s<c?-1:s>c?1:u<f?-1:+(u>f)}})(hi||={});var NodeFileSystemProvider=class{constructor(){this.encoding=`utf-8`}readFile(t){return O.promises.readFile(t.fsPath,this.encoding)}async readDirectory(t){return(await O.promises.readdir(t.fsPath,{withFileTypes:!0})).map(n=>({dirent:n,isFile:n.isFile(),isDirectory:n.isDirectory(),uri:Y.joinPath(t,n.name)}))}};function getSourceRegion(t){if(t){if(`astNode`in t)return getSourceRegionOfAstNode(t);if(Array.isArray(t))return t.reduce(mergeDocumentSegment,void 0);{let n=t;return copyDocumentSegment(n,isCstNode(n)?getDocumentURIOrUndefined(n?.root?.astNode??n?.astNode):void 0)}}}function isCstNode(t){return t!==void 0&&`element`in t&&`text`in t}function getDocumentURIOrUndefined(t){try{return getDocument(t).uri.toString()}catch{return}}function getSourceRegionOfAstNode(t){let{astNode:n,property:i,index:o}=t??{},s=n?.$cstNode??n?.$textRegion;if(!(n===void 0||s===void 0)){if(i===void 0)return copyDocumentSegment(s,getDocumentURI(n));{let getSingleOrCompoundRegion=t=>o!==void 0&&o>-1&&Array.isArray(n[i])?o<t.length?t[o]:void 0:t.reduce(mergeDocumentSegment,void 0);if(s.assignments?.[i]){let t=getSingleOrCompoundRegion(s.assignments[i]);return t&&copyDocumentSegment(t,getDocumentURI(n))}else if(n.$cstNode){let t=getSingleOrCompoundRegion(findNodesForProperty(n.$cstNode,i));return t&&copyDocumentSegment(t,getDocumentURI(n))}else return}}}function getDocumentURI(t){if(t.$cstNode)return(getDocument(t)?.uri)?.toString();if(t.$textRegion)return t.$textRegion.documentURI||new TreeStreamImpl(t,t=>t.$container?[t.$container]:[]).find(t=>t.$textRegion?.documentURI)?.$textRegion?.documentURI}function copyDocumentSegment(t,n){let i={offset:t.offset,end:t.end??t.offset+t.length,length:t.length??t.end-t.offset};return t.range&&(i.range=t.range),n??=t.fileURI,n&&(i.fileURI=n),i}function mergeDocumentSegment(t,n){if(!t)return n&&copyDocumentSegment(n);if(!n)return t&&copyDocumentSegment(t);let i=t.end??t.offset+t.length,o=n.end??n.offset+n.length,s=Math.min(t.offset,n.offset),c=Math.max(i,o),u={offset:s,end:c,length:c-s};if(t.range&&n.range&&(u.range={start:n.range.start.line<t.range.start.line||n.range.start.line===t.range.start.line&&n.range.start.character<t.range.start.character?n.range.start:t.range.start,end:n.range.end.line>t.range.end.line||n.range.end.line===t.range.end.line&&n.range.end.character>t.range.end.character?n.range.end:t.range.end}),t.fileURI||n.fileURI){let i=t.fileURI,o=n.fileURI;u.fileURI=i&&o&&i!==o?`<unmergable text regions of ${i}, ${o}>`:i??o}return u}var Context=class{constructor(t){this.defaultIndentation=` `,this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof t==`string`?this.defaultIndentation=t:typeof t==`number`&&(this.defaultIndentation=``.padStart(t))}get content(){return this.lines.map(t=>t.join(``)).join(``)}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join(``)}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.length}}append(t,n){if(t.length>0){let i=n&&this.currentPosition;this.lines[this.currentLineNumber].push(t),this.length+=t.length,i&&this.indentPendingTraceRegions(i)}}indentPendingTraceRegions(t){for(let n=this.traceData.length-1;n>=0;n--){let i=this.traceData[n];i.targetStart&&i.targetStart.offset===t.offset&&(i.targetStart=this.currentPosition)}}increaseIndent(t){this.currentIndents.push(t),t.indentImmediately||this.recentNonImmediateIndents.push(t)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(t=>!this.recentNonImmediateIndents.includes(t))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join(``).length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}addNewLine(){this.lines.push([]),this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}pushTraceRegion(t){let n=createTraceRegion(t,this.currentPosition,t=>(this.traceData[this.traceData.length-1]?.children)?.push(t));return this.traceData.push(n),n}popTraceRegion(t){let n=this.traceData.pop();return this.assertTrue(n===t,`Trace region mismatch!`),n}getParentTraceSourceFileURI(){for(let t=this.traceData.length-1;t>-1;t--){let n=this.traceData[t].sourceRegion?.fileURI;if(n)return n}}assertTrue(t,n){if(!t)throw Error(n)}};function createTraceRegion(t,n,i){let o={sourceRegion:t,targetRegion:void 0,children:[],targetStart:n,complete:t=>(o.targetRegion={offset:o.targetStart.offset,end:t.offset,length:t.offset-o.targetStart.offset,range:{start:{line:o.targetStart.line,character:o.targetStart.character},end:{line:t.line,character:t.character}}},delete o.targetStart,o.children?.length===0&&delete o.children,o.targetRegion?.length&&i(o),delete o.complete,o)};return o}function processGeneratorNode(t,n){let i=new Context(n),o=i.pushTraceRegion(void 0);processNodeInternal(t,i),i.popTraceRegion(o),o.complete&&o.complete(i.currentPosition);let s=o.children&&o.children.length===1?o.children[0]:void 0,c=s?.targetRegion,u=o.targetRegion;return c&&s.sourceRegion&&c.offset===u.offset&&c.length===u.length?{text:i.content,trace:s}:{text:i.content,trace:o}}function processNodeInternal(t,n){typeof t==`string`?processStringNode(t,n):t instanceof IndentNode?processIndentNode(t,n):t instanceof bi?processCompositeNode(t,n):t instanceof NewLineNode&&processNewLineNode(t,n)}function hasContent(t,n){return typeof t==`string`?t.length!==0:t instanceof bi?t.contents.some(t=>hasContent(t,n)):t instanceof NewLineNode?!(t.ifNotEmpty&&n.currentLineContent.length===0):!1}function processStringNode(t,n){t&&(handlePendingIndent(n,!1),n.append(t))}function handlePendingIndent(t,n){if(t.pendingIndent){let i=``;for(let o of t.relevantIndents.filter(t=>t.indentEmptyLines||!n))i+=o.indentation??t.defaultIndentation;t.append(i,!0),t.pendingIndent=!1}}function processCompositeNode(t,n){let i,o=getSourceRegion(t.tracedSource);o&&(i=n.pushTraceRegion(o));for(let i of t.contents)processNodeInternal(i,n);if(i){n.popTraceRegion(i);let t=n.getParentTraceSourceFileURI();t&&o?.fileURI===t&&delete o.fileURI,i.complete&&i.complete(n.currentPosition)}}function processIndentNode(t,n){if(hasContent(t,n)){t.indentImmediately&&!n.pendingIndent&&n.append(t.indentation??n.defaultIndentation,!0);try{n.increaseIndent(t),processCompositeNode(t,n)}finally{n.decreaseIndent()}}}function processNewLineNode(t,n){t.ifNotEmpty&&!hasNonWhitespace(n.currentLineContent)?n.resetCurrentLine():(handlePendingIndent(n,!0),n.append(t.lineDelimiter),n.addNewLine())}function hasNonWhitespace(t){return t.trimStart()!==``}Object.freeze(`__«SKIP^NEW^LINE^IF^EMPTY»__`);const gi=/\S|$/;function findIndentation(t){let n=t.filter(t=>t.length>0).map(t=>t.search(gi)),i=n.length===0?0:Math.min(...n);return Math.max(0,i)}function expandToNode(t,...n){return composeFinalGeneratorNode(splitTemplateLinesAndMergeWithSubstitutions(t,n,findIndentationAndTemplateStructure(t)))}function expandTracedToNode(t,n,i){return(o,...s)=>traceToNode(t,n,i)(expandToNode(o,...s))}function findIndentationAndTemplateStructure(t){let n=t.join(`_`).split(Ve),i=n.length>1&&n[0].trim().length===0,o=i&&n.length>1&&n[n.length-1].trim().length===0;if(n.length===1||n.length!==0&&n[0].trim().length!==0||n.length===2&&n[1].trim().length===0)return{indentation:0,omitFirstLine:i,omitLastLine:o,trimLastLine:n.length!==1&&n[n.length-1].trim().length===0};{let t=i?n.slice(1):n;t=o?t.slice(0,t.length-1):t,t=t.filter(t=>t.length!==0);let s=findIndentation(t);return{indentation:s,omitFirstLine:i,omitLastLine:o&&(n[n.length-1].length<s||!n[n.length-1].startsWith(t[0].substring(0,s)))}}}function splitTemplateLinesAndMergeWithSubstitutions(t,n,{indentation:i,omitFirstLine:o,omitLastLine:s,trimLastLine:c}){let u=[];t.forEach((t,s)=>{u.push(...t.split(Ve).map((t,n)=>n===0||t.length<i?t:t.substring(i)).reduce(s===0?(t,n,i)=>i===0?o?[]:[n]:i===1&&t.length===0?[n]:t.concat(_i,n):(t,n,i)=>i===0?[n]:t.concat(_i,n),[]).filter(t=>!(typeof t==`string`&&t.length===0)).concat(isGeneratorNode(n[s])?n[s]:n[s]===void 0?s<n.length?vi:[]:{content:String(n[s])}))});let f=u.length,p=f===0?void 0:u[f-1];return(s||c)&&typeof p==`string`&&p.trim().length===0?o&&f!==1&&u[f-2]===_i?u.slice(0,f-2):u.slice(0,f-1):u}const _i={isNewLine:!0},vi={isUndefinedSegment:!0},isNewLineMarker=t=>t===_i,isUndefinedSegmentMarker=t=>t===vi,isSubstitutionWrapper=t=>t.content!==void 0;function composeFinalGeneratorNode(t){return t.reduce((n,i,o)=>isUndefinedSegmentMarker(i)?n:isNewLineMarker(i)?{node:o!==0&&(isUndefinedSegmentMarker(t[o-1])||isGeneratorNode(t[o-1]))||o>1&&typeof t[o-1]==`string`&&(isUndefinedSegmentMarker(t[o-2])||isGeneratorNode(t[o-2]))?n.node.appendNewLineIfNotEmpty():n.node.appendNewLine()}:(()=>{let s=(o===0||isNewLineMarker(t[o-1]))&&typeof i==`string`&&i.length!==0?``.padStart(i.length-i.trimStart().length):``,c=isSubstitutionWrapper(i)?i.content:i,u;return{node:n.indented?n.node:s.length===0?n.node.append(c):n.node.indent({indentation:s,indentImmediately:!1,indentedChildren:t=>u=t.append(c)}),indented:u??n.indented?.append(c)}})(),{node:new bi}).node}const yi=typeof process>`u`?`
30
+ `:process.platform===`win32`?`\r
31
+ `:`
32
+ `;function isGeneratorNode(t){return t instanceof bi||t instanceof IndentNode||t instanceof NewLineNode}function toString(t,n){return isGeneratorNode(t)?processGeneratorNode(t,n).text:String(t)}var bi=class CompositeGeneratorNode{constructor(...t){this.contents=[],this.append(...t)}isEmpty(){return this.contents.length===0}trace(t,n,i){if(isAstNode(t)){if(this.tracedSource={astNode:t,property:n,index:i},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw Error(`Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.`)}else this.tracedSource=t;return this}append(...t){for(let n of t)typeof n==`function`?n(this):n&&this.contents.push(n);return this}appendIf(t,...n){return t?this.append(...n):this}appendNewLine(){return this.append(xi)}appendNewLineIf(t){return t?this.append(xi):this}appendNewLineIfNotEmpty(){return this.append(Si)}appendNewLineIfNotEmptyIf(t){return t?this.appendNewLineIfNotEmpty():this}appendTemplate(t,...n){return this.append(expandToNode(t,...n))}appendTemplateIf(t){return t?(t,...n)=>this.appendTemplate(t,...n):()=>this}indent(t){let{indentedChildren:n,indentation:i,indentEmptyLines:o,indentImmediately:s}=Array.isArray(t)||typeof t==`function`?{indentedChildren:t}:typeof t==`object`?t:{},c=new IndentNode(i,s,o);return this.contents.push(c),Array.isArray(n)?c.append(...n):n&&c.append(n),this}appendTraced(t,n,i){return o=>this.append(new CompositeGeneratorNode().trace(t,n,i).append(o))}appendTracedIf(t,n,i,o){return t?this.appendTraced(typeof n==`function`?n():n,i,o):()=>this}appendTracedTemplate(t,n,i){return(o,...s)=>this.append(expandTracedToNode(t,n,i)(o,...s))}appendTracedTemplateIf(t,n,i,o){return t?this.appendTracedTemplate(typeof n==`function`?n():n,i,o):()=>this}};function traceToNode(t,n,i){return o=>o instanceof bi&&o.tracedSource===void 0?o.trace(t,n,i):new bi().trace(t,n,i).append(o)}var IndentNode=class extends bi{constructor(t,n=!0,i=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof t==`string`?this.indentation=t:typeof t==`number`&&(this.indentation=``.padStart(t)),this.indentImmediately=n,this.indentEmptyLines=i}},NewLineNode=class{constructor(t,n=!1){this.ifNotEmpty=!1,this.lineDelimiter=t??yi,this.ifNotEmpty=n}};const xi=new NewLineNode,Si=new NewLineNode(void 0,!0),defaultToGenerated=t=>t===void 0||typeof t==`string`||isGeneratorNode(t)?t:String(t);function joinToNode(t,n=defaultToGenerated,i={}){let o=typeof n==`function`?n:defaultToGenerated,{filter:s,prefix:c,suffix:u,separator:f,appendNewLineIfNotEmpty:p,skipNewLineAfterLastItem:h}=typeof n==`object`?n:i,g=typeof c==`function`?c:(()=>c),_=typeof u==`function`?u:(()=>u);return reduceWithIsLast(t,(t,n,i,c)=>{if(s&&!s(n,i,c))return t;let u=o(n,i,c);return u===void 0?t:(t??=new bi).append(g(n,i,c)).append(u).append(_(n,i,c)).appendIf(!c,f).appendNewLineIfNotEmptyIf(!t.isEmpty()&&!!p&&(!c||!h))})}function reduceWithIsLast(t,n,i){let o=t[Symbol.iterator](),s=o.next(),c=0,u=i;for(;!s.done;){let t=o.next();u=n(u,s.value,c,!!t.done),s=t,c++}return u}export{$t as $,SimpleCache as A,X as B,DefaultWorkspaceManager as C,DefaultDocumentValidator as D,DefaultAstNodeDescriptionProvider as E,DefaultScopeComputation as F,isOperationCancelled as G,J as H,MultiMap as I,Tt as J,DefaultValueConverter as K,DefaultNameProvider as L,Pn as M,MapScope as N,DefaultScopeProvider as O,StreamScope as P,W as Q,isNamed as R,JSDocDocumentationProvider as S,Rn as T,An as U,Y as V,interruptAndCheck as W,Et as X,ot as Y,U as Z,ri as _,A as _t,expandToNode as a,findNodeForProperty as at,loadGrammarFromJson as b,isAstNode as bt,hi as c,Be as ct,DefaultWorkspaceSymbolProvider as d,hasContainerOfType as dt,Qt as et,startLanguageServer as f,streamAllContents as ft,DefaultCompletionProvider as g,findCommentNode as gt,DefaultDocumentHighlightProvider as h,isRuleCall as ht,toString as i,findNodeForKeyword as it,WorkspaceCache as j,ContextCache as k,createDefaultModule as l,getContainerOfType as lt,AstNodeHoverProvider as m,isKeyword as mt,bi as n,dt as nt,NodeFileSystemProvider as o,findNodesForProperty as ot,AbstractSemanticTokenProvider as p,isCrossReference as pt,Sn as q,xi as r,vn as rt,AbstractFormatter as s,Ge as st,joinToNode as t,zt as tt,createDefaultSharedModule as u,getDocument as ut,Q as v,stream as vt,DefaultIndexManager as w,inject as x,cr as y,AbstractAstReflection as yt,DefaultLangiumDocuments as z};