likec4 1.11.0 → 1.12.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 (611) hide show
  1. package/dist/__app__/src/chunks/{-index-overview-B8AbCuYt.js → -index-overview-Csz814YU.js} +6 -6
  2. package/dist/__app__/src/chunks/{likec4-DOemzWvz.js → likec4-DlkyDuSp.js} +20 -8
  3. package/dist/__app__/src/chunks/{main-OEl3ruxE.js → main-Bc_PC5BH.js} +3460 -291
  4. package/dist/__app__/src/chunks/{mantine-BqgMLMPH.js → mantine-IOl1S4mZ.js} +149 -51
  5. package/dist/__app__/src/chunks/{tanstack-router-Mzh8n5Lx.js → tanstack-router-CU5V4Ll-.js} +1 -1
  6. package/dist/__app__/src/const.js +2 -0
  7. package/dist/__app__/src/main.js +1 -1
  8. package/dist/__app__/src/style.css +1 -1
  9. package/dist/__app__/webcomponent/webcomponent.js +3829 -511
  10. package/dist/chunks/prompt.mjs +1 -1
  11. package/dist/cli/index.mjs +3 -3
  12. package/dist/index.d.mts +14 -4
  13. package/dist/index.d.ts +14 -4
  14. package/dist/index.mjs +1 -1
  15. package/dist/shared/likec4.Ceq7jJZD.mjs +1816 -0
  16. package/icons/all.d.ts +589 -0
  17. package/icons/all.js +1178 -0
  18. package/icons/azure/abs-member.js +21 -0
  19. package/icons/azure/active-directory-connect-health.js +115 -0
  20. package/icons/azure/activity-log.js +33 -0
  21. package/icons/azure/administrative-units.js +80 -0
  22. package/icons/azure/advisor.js +44 -0
  23. package/icons/azure/ai-studio.js +105 -0
  24. package/icons/azure/aks-automatic.js +105 -0
  25. package/icons/azure/aks-istio.js +63 -0
  26. package/icons/azure/alerts.js +29 -0
  27. package/icons/azure/all-resources.js +21 -0
  28. package/icons/azure/analysis-services.js +34 -0
  29. package/icons/azure/anomaly-detector.js +33 -0
  30. package/icons/azure/api-center.js +31 -0
  31. package/icons/azure/api-connections.js +44 -0
  32. package/icons/azure/api-management-services.js +29 -0
  33. package/icons/azure/api-proxy.js +32 -0
  34. package/icons/azure/app-compliance-automation.js +71 -0
  35. package/icons/azure/app-configuration.js +45 -0
  36. package/icons/azure/app-registrations.js +39 -0
  37. package/icons/azure/app-service-certificates.js +31 -0
  38. package/icons/azure/app-service-domains.js +23 -0
  39. package/icons/azure/app-service-environments.js +25 -0
  40. package/icons/azure/app-service-plans.js +44 -0
  41. package/icons/azure/app-services.js +82 -0
  42. package/icons/azure/app-space-component.js +39 -0
  43. package/icons/azure/app-space.js +37 -0
  44. package/icons/azure/applens.js +45 -0
  45. package/icons/azure/application-gateway-containers.js +113 -0
  46. package/icons/azure/application-gateways.js +60 -0
  47. package/icons/azure/application-group.js +21 -0
  48. package/icons/azure/application-insights.js +46 -0
  49. package/icons/azure/application-security-groups.js +43 -0
  50. package/icons/azure/aquila.js +95 -0
  51. package/icons/azure/arc-data-services.js +49 -0
  52. package/icons/azure/arc-kubernetes.js +73 -0
  53. package/icons/azure/arc-machines.js +40 -0
  54. package/icons/azure/arc-postgre-sql.js +62 -0
  55. package/icons/azure/arc-sql-managed-instance.js +54 -0
  56. package/icons/azure/arc-sql-server.js +40 -0
  57. package/icons/azure/atm-multistack.js +59 -0
  58. package/icons/azure/auto-scale.js +32 -0
  59. package/icons/azure/automanaged-vm.js +65 -0
  60. package/icons/azure/automation-accounts.js +62 -0
  61. package/icons/azure/availability-sets.js +48 -0
  62. package/icons/azure/avs-vm.js +32 -0
  63. package/icons/azure/azure-a.js +46 -0
  64. package/icons/azure/azure-ad-b2c.js +129 -0
  65. package/icons/azure/azure-api-for-fhir.js +22 -0
  66. package/icons/azure/azure-applied-ai-services.js +60 -0
  67. package/icons/azure/azure-arc.js +75 -0
  68. package/icons/azure/azure-attestation.js +35 -0
  69. package/icons/azure/azure-backup-center.js +63 -0
  70. package/icons/azure/azure-blockchain-service.js +51 -0
  71. package/icons/azure/azure-center-for-sap.js +37 -0
  72. package/icons/azure/azure-chaos-studio.js +41 -0
  73. package/icons/azure/azure-cloud-shell.js +28 -0
  74. package/icons/azure/azure-communication-services.js +41 -0
  75. package/icons/azure/azure-communications-gateway.js +32 -0
  76. package/icons/azure/azure-compute-galleries.js +24 -0
  77. package/icons/azure/azure-cosmos-db.js +41 -0
  78. package/icons/azure/azure-data-catalog.js +69 -0
  79. package/icons/azure/azure-data-explorer-clusters.js +82 -0
  80. package/icons/azure/azure-database-maria-db-server.js +45 -0
  81. package/icons/azure/azure-database-migration-services.js +62 -0
  82. package/icons/azure/azure-database-my-sql-server.js +45 -0
  83. package/icons/azure/azure-database-postgre-sql-server-group.js +65 -0
  84. package/icons/azure/azure-database-postgre-sql-server.js +57 -0
  85. package/icons/azure/azure-databox-gateway.js +28 -0
  86. package/icons/azure/azure-databricks.js +12 -0
  87. package/icons/azure/azure-deployment-environments.js +48 -0
  88. package/icons/azure/azure-dev-ops.js +21 -0
  89. package/icons/azure/azure-dev-tunnels.js +20 -0
  90. package/icons/azure/azure-edge-hardware-center.js +58 -0
  91. package/icons/azure/azure-experimentation-studio.js +77 -0
  92. package/icons/azure/azure-fileshares.js +46 -0
  93. package/icons/azure/azure-firewall-manager.js +49 -0
  94. package/icons/azure/azure-firewall-policy.js +37 -0
  95. package/icons/azure/azure-hcp-cache.js +23 -0
  96. package/icons/azure/azure-hpc-workbenches.js +68 -0
  97. package/icons/azure/azure-hybrid-center.js +22 -0
  98. package/icons/azure/azure-information-protection.js +51 -0
  99. package/icons/azure/azure-io-t-operations.js +46 -0
  100. package/icons/azure/azure-lighthouse.js +35 -0
  101. package/icons/azure/azure-load-testing.js +56 -0
  102. package/icons/azure/azure-managed-grafana.js +19 -0
  103. package/icons/azure/azure-maps-accounts.js +16 -0
  104. package/icons/azure/azure-media-service.js +90 -0
  105. package/icons/azure/azure-migrate.js +46 -0
  106. package/icons/azure/azure-monitor-dashboard.js +47 -0
  107. package/icons/azure/azure-monitor-pipeline.js +57 -0
  108. package/icons/azure/azure-monitors-for-sap-solutions.js +49 -0
  109. package/icons/azure/azure-net-app-files.js +36 -0
  110. package/icons/azure/azure-network-function-manager-functions.js +41 -0
  111. package/icons/azure/azure-network-function-manager.js +65 -0
  112. package/icons/azure/azure-object-understanding.js +39 -0
  113. package/icons/azure/azure-open-ai.js +29 -0
  114. package/icons/azure/azure-operator-5g-core.js +64 -0
  115. package/icons/azure/azure-operator-insights.js +31 -0
  116. package/icons/azure/azure-operator-nexus.js +54 -0
  117. package/icons/azure/azure-operator-service-manager.js +30 -0
  118. package/icons/azure/azure-orbital.js +115 -0
  119. package/icons/azure/azure-programmable-connectivity.js +145 -0
  120. package/icons/azure/azure-purview-accounts.js +56 -0
  121. package/icons/azure/azure-quotas.js +43 -0
  122. package/icons/azure/azure-red-hat-open-shift.js +44 -0
  123. package/icons/azure/azure-sentinel.js +37 -0
  124. package/icons/azure/azure-service-bus.js +66 -0
  125. package/icons/azure/azure-sphere.js +57 -0
  126. package/icons/azure/azure-spring-apps.js +67 -0
  127. package/icons/azure/azure-sql-edge.js +146 -0
  128. package/icons/azure/azure-sql-server-stretch-databases.js +54 -0
  129. package/icons/azure/azure-sql-vm.js +37 -0
  130. package/icons/azure/azure-sql.js +27 -0
  131. package/icons/azure/azure-stack-edge.js +33 -0
  132. package/icons/azure/azure-stack-hci-sizer.js +57 -0
  133. package/icons/azure/azure-stack.js +54 -0
  134. package/icons/azure/azure-storage-mover.js +58 -0
  135. package/icons/azure/azure-support-center-blue.js +31 -0
  136. package/icons/azure/azure-sustainability.js +42 -0
  137. package/icons/azure/azure-synapse-analytics.js +49 -0
  138. package/icons/azure/azure-token-service.js +46 -0
  139. package/icons/azure/azure-video-indexer.js +60 -0
  140. package/icons/azure/azure-virtual-desktop.js +19 -0
  141. package/icons/azure/azure-vmware-solution.js +35 -0
  142. package/icons/azure/azure-workbooks.js +72 -0
  143. package/icons/azure/azurite.js +34 -0
  144. package/icons/azure/backlog.js +48 -0
  145. package/icons/azure/backup-vault.js +49 -0
  146. package/icons/azure/bare-metal-infrastructure.js +41 -0
  147. package/icons/azure/bastions.js +71 -0
  148. package/icons/azure/batch-accounts.js +52 -0
  149. package/icons/azure/batch-ai.js +56 -0
  150. package/icons/azure/biz-talk.js +39 -0
  151. package/icons/azure/blob-block.js +17 -0
  152. package/icons/azure/blob-page.js +43 -0
  153. package/icons/azure/blockchain-applications.js +32 -0
  154. package/icons/azure/blueprints.js +56 -0
  155. package/icons/azure/bonsai.js +63 -0
  156. package/icons/azure/bot-services.js +43 -0
  157. package/icons/azure/branch.js +32 -0
  158. package/icons/azure/browser.js +16 -0
  159. package/icons/azure/bug.js +26 -0
  160. package/icons/azure/builds.js +48 -0
  161. package/icons/azure/business-process-tracking.js +28 -0
  162. package/icons/azure/cache-redis.js +72 -0
  163. package/icons/azure/cache.js +113 -0
  164. package/icons/azure/capacity-reservation-groups.js +47 -0
  165. package/icons/azure/capacity.js +74 -0
  166. package/icons/azure/cdn-profiles.js +21 -0
  167. package/icons/azure/central-service-instance-for-sap.js +44 -0
  168. package/icons/azure/ceres.js +58 -0
  169. package/icons/azure/change-analysis.js +93 -0
  170. package/icons/azure/client-apps.js +21 -0
  171. package/icons/azure/cloud-services-classic.js +37 -0
  172. package/icons/azure/cloud-services-extended-support.js +50 -0
  173. package/icons/azure/cloud-test.js +58 -0
  174. package/icons/azure/code-optimization.js +146 -0
  175. package/icons/azure/code.js +94 -0
  176. package/icons/azure/cognitive-search.js +26 -0
  177. package/icons/azure/cognitive-services-decisions.js +94 -0
  178. package/icons/azure/cognitive-services.js +42 -0
  179. package/icons/azure/collaborative-service.js +46 -0
  180. package/icons/azure/commit.js +30 -0
  181. package/icons/azure/community-images.js +35 -0
  182. package/icons/azure/compliance-center.js +48 -0
  183. package/icons/azure/compliance.js +35 -0
  184. package/icons/azure/compute-fleet.js +91 -0
  185. package/icons/azure/computer-vision.js +24 -0
  186. package/icons/azure/conditional-access.js +45 -0
  187. package/icons/azure/confidential-ledgers.js +63 -0
  188. package/icons/azure/connected-cache.js +77 -0
  189. package/icons/azure/connected-vehicle-platform.js +66 -0
  190. package/icons/azure/connections.js +54 -0
  191. package/icons/azure/consortium.js +63 -0
  192. package/icons/azure/container-apps-environments.js +44 -0
  193. package/icons/azure/container-instances.js +37 -0
  194. package/icons/azure/container-registries.js +57 -0
  195. package/icons/azure/container-services-deprecated.js +65 -0
  196. package/icons/azure/content-moderators.js +41 -0
  197. package/icons/azure/content-safety.js +77 -0
  198. package/icons/azure/controls-horizontal.js +135 -0
  199. package/icons/azure/controls.js +33 -0
  200. package/icons/azure/cost-alerts.js +28 -0
  201. package/icons/azure/cost-analysis.js +35 -0
  202. package/icons/azure/cost-budgets.js +30 -0
  203. package/icons/azure/cost-export.js +25 -0
  204. package/icons/azure/cost-management-and-billing.js +31 -0
  205. package/icons/azure/cost-management.js +35 -0
  206. package/icons/azure/counter.js +33 -0
  207. package/icons/azure/cubes.js +16 -0
  208. package/icons/azure/custom-ip-prefix.js +34 -0
  209. package/icons/azure/custom-vision.js +48 -0
  210. package/icons/azure/customer-lockbox-for-microsoft-azure.js +42 -0
  211. package/icons/azure/dashboard-hub.js +61 -0
  212. package/icons/azure/dashboard.js +42 -0
  213. package/icons/azure/data-box.js +33 -0
  214. package/icons/azure/data-collection-rules.js +42 -0
  215. package/icons/azure/data-factories.js +36 -0
  216. package/icons/azure/data-lake-analytics.js +32 -0
  217. package/icons/azure/data-lake-storage-gen1.js +38 -0
  218. package/icons/azure/data-lake-store-gen1.js +38 -0
  219. package/icons/azure/data-share-invitations.js +23 -0
  220. package/icons/azure/data-shares.js +67 -0
  221. package/icons/azure/database-instance-for-sap.js +69 -0
  222. package/icons/azure/ddo-s-protection-plans.js +36 -0
  223. package/icons/azure/dedicated-hsm.js +38 -0
  224. package/icons/azure/defender-cm-local-manager.js +131 -0
  225. package/icons/azure/defender-dcs-controller.js +66 -0
  226. package/icons/azure/defender-distributer-control-system.js +45 -0
  227. package/icons/azure/defender-engineering-station.js +71 -0
  228. package/icons/azure/defender-external-management.js +88 -0
  229. package/icons/azure/defender-freezer-monitor.js +151 -0
  230. package/icons/azure/defender-historian.js +53 -0
  231. package/icons/azure/defender-hmi.js +43 -0
  232. package/icons/azure/defender-industrial-packaging-system.js +75 -0
  233. package/icons/azure/defender-industrial-printer.js +34 -0
  234. package/icons/azure/defender-industrial-robot.js +99 -0
  235. package/icons/azure/defender-industrial-scale-system.js +58 -0
  236. package/icons/azure/defender-marquee.js +38 -0
  237. package/icons/azure/defender-meter.js +101 -0
  238. package/icons/azure/defender-plc.js +55 -0
  239. package/icons/azure/defender-pneumatic-device.js +50 -0
  240. package/icons/azure/defender-programable-board.js +82 -0
  241. package/icons/azure/defender-relay.js +49 -0
  242. package/icons/azure/defender-robot-controller.js +79 -0
  243. package/icons/azure/defender-rtu.js +23 -0
  244. package/icons/azure/defender-sensor.js +44 -0
  245. package/icons/azure/defender-slot.js +31 -0
  246. package/icons/azure/defender-web-guiding-system.js +167 -0
  247. package/icons/azure/detonation.js +30 -0
  248. package/icons/azure/dev-console.js +30 -0
  249. package/icons/azure/dev-ops-starter.js +102 -0
  250. package/icons/azure/dev-test-labs.js +46 -0
  251. package/icons/azure/device-compliance.js +40 -0
  252. package/icons/azure/device-configuration.js +33 -0
  253. package/icons/azure/device-enrollment.js +37 -0
  254. package/icons/azure/device-provisioning-services.js +43 -0
  255. package/icons/azure/device-security-apple.js +43 -0
  256. package/icons/azure/device-security-google.js +43 -0
  257. package/icons/azure/device-security-windows.js +43 -0
  258. package/icons/azure/device-update-io-t-hub.js +35 -0
  259. package/icons/azure/devices.js +29 -0
  260. package/icons/azure/diagnostics-settings.js +40 -0
  261. package/icons/azure/digital-twins.js +40 -0
  262. package/icons/azure/disk-encryption-sets.js +63 -0
  263. package/icons/azure/disk-pool.js +92 -0
  264. package/icons/azure/disks-classic.js +63 -0
  265. package/icons/azure/disks-snapshots.js +49 -0
  266. package/icons/azure/disks.js +63 -0
  267. package/icons/azure/dns-multistack.js +49 -0
  268. package/icons/azure/dns-private-resolver.js +39 -0
  269. package/icons/azure/dns-security-policy.js +90 -0
  270. package/icons/azure/dns-zones.js +37 -0
  271. package/icons/azure/download.js +60 -0
  272. package/icons/azure/e-books.js +42 -0
  273. package/icons/azure/edge-management.js +53 -0
  274. package/icons/azure/education.js +42 -0
  275. package/icons/azure/elastic-job-agents.js +50 -0
  276. package/icons/azure/elastic-san.js +65 -0
  277. package/icons/azure/endpoint-analytics.js +72 -0
  278. package/icons/azure/enterprise-applications.js +55 -0
  279. package/icons/azure/entra-connect-health.js +115 -0
  280. package/icons/azure/entra-connect-sync.js +86 -0
  281. package/icons/azure/entra-connect.js +123 -0
  282. package/icons/azure/entra-domain-services.js +99 -0
  283. package/icons/azure/entra-global-secure-access.js +37 -0
  284. package/icons/azure/entra-id-protection.js +63 -0
  285. package/icons/azure/entra-identity-custom-roles.js +62 -0
  286. package/icons/azure/entra-identity-licenses.js +52 -0
  287. package/icons/azure/entra-identity-risky-signins.js +28 -0
  288. package/icons/azure/entra-identity-risky-users.js +28 -0
  289. package/icons/azure/entra-identity-roles-and-administrators.js +31 -0
  290. package/icons/azure/entra-internet-access.js +72 -0
  291. package/icons/azure/entra-managed-identities.js +114 -0
  292. package/icons/azure/entra-private-access.js +60 -0
  293. package/icons/azure/entra-privleged-identity-management.js +114 -0
  294. package/icons/azure/entra-verified-id.js +53 -0
  295. package/icons/azure/error.js +30 -0
  296. package/icons/azure/event-grid-domains.js +65 -0
  297. package/icons/azure/event-grid-subscriptions.js +65 -0
  298. package/icons/azure/event-grid-topics.js +68 -0
  299. package/icons/azure/event-hub-clusters.js +77 -0
  300. package/icons/azure/event-hubs.js +64 -0
  301. package/icons/azure/exchange-access.js +45 -0
  302. package/icons/azure/exchange-on-premises-access.js +28 -0
  303. package/icons/azure/express-route-circuits.js +38 -0
  304. package/icons/azure/express-route-direct.js +50 -0
  305. package/icons/azure/express-route-traffic-collector.js +86 -0
  306. package/icons/azure/extended-security-updates.js +33 -0
  307. package/icons/azure/extensions.js +28 -0
  308. package/icons/azure/external-identities.js +42 -0
  309. package/icons/azure/face-apis.js +19 -0
  310. package/icons/azure/feature-previews.js +21 -0
  311. package/icons/azure/fhir-service.js +60 -0
  312. package/icons/azure/fiji.js +42 -0
  313. package/icons/azure/file.js +29 -0
  314. package/icons/azure/files.js +45 -0
  315. package/icons/azure/firewalls.js +32 -0
  316. package/icons/azure/folder-blank.js +28 -0
  317. package/icons/azure/folder-website.js +84 -0
  318. package/icons/azure/form-recognizers.js +48 -0
  319. package/icons/azure/free-services.js +43 -0
  320. package/icons/azure/front-door-and-cdn-profiles.js +26 -0
  321. package/icons/azure/ftp.js +17 -0
  322. package/icons/azure/function-apps.js +61 -0
  323. package/icons/azure/gear.js +37 -0
  324. package/icons/azure/genomics-accounts.js +57 -0
  325. package/icons/azure/genomics.js +57 -0
  326. package/icons/azure/globe-error.js +42 -0
  327. package/icons/azure/globe-success.js +52 -0
  328. package/icons/azure/globe-warning.js +53 -0
  329. package/icons/azure/groups.js +42 -0
  330. package/icons/azure/guide.js +17 -0
  331. package/icons/azure/hd-insight-clusters.js +38 -0
  332. package/icons/azure/hdi-aks-cluster.js +60 -0
  333. package/icons/azure/heart.js +31 -0
  334. package/icons/azure/help-and-support.js +33 -0
  335. package/icons/azure/host-groups.js +48 -0
  336. package/icons/azure/host-pools.js +19 -0
  337. package/icons/azure/hosts.js +46 -0
  338. package/icons/azure/ic-m-troubleshooting.js +60 -0
  339. package/icons/azure/identity-governance.js +41 -0
  340. package/icons/azure/identity-multi-factor-authentication.js +71 -0
  341. package/icons/azure/identity-secure-score.js +55 -0
  342. package/icons/azure/image-definitions.js +27 -0
  343. package/icons/azure/image-templates.js +32 -0
  344. package/icons/azure/image-versions.js +27 -0
  345. package/icons/azure/image.js +31 -0
  346. package/icons/azure/images.js +37 -0
  347. package/icons/azure/immersive-readers.js +60 -0
  348. package/icons/azure/import-export-jobs.js +25 -0
  349. package/icons/azure/industrial-io-t.js +53 -0
  350. package/icons/azure/information.js +21 -0
  351. package/icons/azure/infrastructure-backup.js +67 -0
  352. package/icons/azure/input-output.js +97 -0
  353. package/icons/azure/instance-pools.js +76 -0
  354. package/icons/azure/integration-accounts.js +30 -0
  355. package/icons/azure/integration-environments.js +94 -0
  356. package/icons/azure/integration-service-environments.js +58 -0
  357. package/icons/azure/internet-analyzer-profiles.js +48 -0
  358. package/icons/azure/intune-app-protection.js +46 -0
  359. package/icons/azure/intune-for-education.js +46 -0
  360. package/icons/azure/intune-trends.js +29 -0
  361. package/icons/azure/intune.js +46 -0
  362. package/icons/azure/io-t-central-applications.js +20 -0
  363. package/icons/azure/io-t-edge.js +25 -0
  364. package/icons/azure/io-t-hub.js +36 -0
  365. package/icons/azure/ip-address-manager.js +52 -0
  366. package/icons/azure/ip-groups.js +39 -0
  367. package/icons/azure/journey-hub.js +30 -0
  368. package/icons/azure/key-vaults.js +61 -0
  369. package/icons/azure/keys.js +97 -0
  370. package/icons/azure/kubernetes-fleet-manager.js +73 -0
  371. package/icons/azure/kubernetes-services.js +65 -0
  372. package/icons/azure/lab-accounts.js +47 -0
  373. package/icons/azure/lab-services.js +46 -0
  374. package/icons/azure/language-understanding.js +14 -0
  375. package/icons/azure/language.js +71 -0
  376. package/icons/azure/launch-portal.js +25 -0
  377. package/icons/azure/learn.js +61 -0
  378. package/icons/azure/load-balancer-hub.js +90 -0
  379. package/icons/azure/load-balancers.js +28 -0
  380. package/icons/azure/load-test.js +50 -0
  381. package/icons/azure/load-testing.js +71 -0
  382. package/icons/azure/local-network-gateways.js +33 -0
  383. package/icons/azure/location.js +34 -0
  384. package/icons/azure/log-analytics-query-pack.js +57 -0
  385. package/icons/azure/log-analytics-workspaces.js +36 -0
  386. package/icons/azure/log-streaming.js +46 -0
  387. package/icons/azure/logic-apps-custom-connector.js +43 -0
  388. package/icons/azure/logic-apps.js +54 -0
  389. package/icons/azure/machine-learning-studio-classic-web-services.js +38 -0
  390. package/icons/azure/machine-learning-studio-web-service-plans.js +62 -0
  391. package/icons/azure/machine-learning-studio-workspaces.js +44 -0
  392. package/icons/azure/machine-learning.js +29 -0
  393. package/icons/azure/machines-azure-arc.js +27 -0
  394. package/icons/azure/maintenance-configuration.js +62 -0
  395. package/icons/azure/managed-applications-center.js +44 -0
  396. package/icons/azure/managed-database.js +57 -0
  397. package/icons/azure/managed-desktop.js +40 -0
  398. package/icons/azure/managed-dev-ops-pools.js +59 -0
  399. package/icons/azure/managed-file-shares.js +59 -0
  400. package/icons/azure/managed-identities.js +44 -0
  401. package/icons/azure/managed-instance-apache-cassandra.js +49 -0
  402. package/icons/azure/managed-service-fabric.js +98 -0
  403. package/icons/azure/management-groups.js +66 -0
  404. package/icons/azure/management-portal.js +17 -0
  405. package/icons/azure/marketplace-management.js +36 -0
  406. package/icons/azure/marketplace.js +38 -0
  407. package/icons/azure/med-tech-service.js +65 -0
  408. package/icons/azure/media-file.js +36 -0
  409. package/icons/azure/media.js +108 -0
  410. package/icons/azure/mesh-applications.js +47 -0
  411. package/icons/azure/metrics-advisor.js +47 -0
  412. package/icons/azure/metrics.js +34 -0
  413. package/icons/azure/microsoft-defender-easm.js +69 -0
  414. package/icons/azure/microsoft-defender-for-cloud.js +50 -0
  415. package/icons/azure/microsoft-defender-for-io-t.js +43 -0
  416. package/icons/azure/microsoft-dev-box.js +143 -0
  417. package/icons/azure/mindaro.js +47 -0
  418. package/icons/azure/mission-landing-zone.js +48 -0
  419. package/icons/azure/mobile-engagement.js +35 -0
  420. package/icons/azure/mobile-networks.js +75 -0
  421. package/icons/azure/mobile.js +28 -0
  422. package/icons/azure/modular-data-center.js +61 -0
  423. package/icons/azure/module.js +25 -0
  424. package/icons/azure/monitor-health-models.js +77 -0
  425. package/icons/azure/monitor.js +61 -0
  426. package/icons/azure/multi-tenancy.js +47 -0
  427. package/icons/azure/multifactor-authentication.js +84 -0
  428. package/icons/azure/my-customers.js +42 -0
  429. package/icons/azure/nat.js +45 -0
  430. package/icons/azure/network-interfaces.js +41 -0
  431. package/icons/azure/network-managers.js +44 -0
  432. package/icons/azure/network-security-groups.js +42 -0
  433. package/icons/azure/network-security-perimeters.js +91 -0
  434. package/icons/azure/network-watcher.js +55 -0
  435. package/icons/azure/notification-hub-namespaces.js +22 -0
  436. package/icons/azure/notification-hubs.js +22 -0
  437. package/icons/azure/offers.js +35 -0
  438. package/icons/azure/on-premises-data-gateways.js +33 -0
  439. package/icons/azure/open-supply-chain-platform.js +54 -0
  440. package/icons/azure/operation-log-classic.js +33 -0
  441. package/icons/azure/oracle-database.js +33 -0
  442. package/icons/azure/os-images-classic.js +38 -0
  443. package/icons/azure/osconfig.js +71 -0
  444. package/icons/azure/outbound-connection.js +24 -0
  445. package/icons/azure/partner-namespace.js +97 -0
  446. package/icons/azure/partner-registration.js +95 -0
  447. package/icons/azure/partner-topic.js +82 -0
  448. package/icons/azure/peering-service.js +27 -0
  449. package/icons/azure/peerings.js +33 -0
  450. package/icons/azure/personalizers.js +55 -0
  451. package/icons/azure/plans.js +40 -0
  452. package/icons/azure/policy.js +34 -0
  453. package/icons/azure/power-bi-embedded.js +69 -0
  454. package/icons/azure/power-platform.js +163 -0
  455. package/icons/azure/power-up.js +42 -0
  456. package/icons/azure/power.js +31 -0
  457. package/icons/azure/powershell.js +30 -0
  458. package/icons/azure/preview-features.js +50 -0
  459. package/icons/azure/private-endpoints.js +69 -0
  460. package/icons/azure/private-link-service.js +83 -0
  461. package/icons/azure/private-link-services.js +72 -0
  462. package/icons/azure/private-link.js +94 -0
  463. package/icons/azure/process-explorer.js +23 -0
  464. package/icons/azure/production-ready-database.js +70 -0
  465. package/icons/azure/proximity-placement-groups.js +71 -0
  466. package/icons/azure/public-ip-addresses-classic.js +19 -0
  467. package/icons/azure/public-ip-addresses.js +19 -0
  468. package/icons/azure/public-ip-prefixes.js +53 -0
  469. package/icons/azure/qn-a-makers.js +50 -0
  470. package/icons/azure/quickstart-center.js +54 -0
  471. package/icons/azure/recent.js +57 -0
  472. package/icons/azure/recovery-services-vaults.js +45 -0
  473. package/icons/azure/region-management.js +42 -0
  474. package/icons/azure/relays.js +45 -0
  475. package/icons/azure/remote-rendering.js +71 -0
  476. package/icons/azure/reservations.js +37 -0
  477. package/icons/azure/reserved-capacity.js +45 -0
  478. package/icons/azure/reserved-ip-addresses-classic.js +21 -0
  479. package/icons/azure/resource-explorer.js +33 -0
  480. package/icons/azure/resource-graph-explorer.js +25 -0
  481. package/icons/azure/resource-group-list.js +48 -0
  482. package/icons/azure/resource-groups.js +40 -0
  483. package/icons/azure/resource-guard.js +46 -0
  484. package/icons/azure/resource-linked.js +40 -0
  485. package/icons/azure/resource-management-private-link.js +44 -0
  486. package/icons/azure/resource-mover.js +20 -0
  487. package/icons/azure/resources-provider.js +27 -0
  488. package/icons/azure/restore-points-collections.js +40 -0
  489. package/icons/azure/restore-points.js +39 -0
  490. package/icons/azure/route-filters.js +39 -0
  491. package/icons/azure/route-tables.js +40 -0
  492. package/icons/azure/rtos.js +64 -0
  493. package/icons/azure/savings-plans.js +53 -0
  494. package/icons/azure/scheduler-job-collections.js +73 -0
  495. package/icons/azure/scheduler.js +75 -0
  496. package/icons/azure/scvmm-management-servers.js +68 -0
  497. package/icons/azure/search-grid.js +48 -0
  498. package/icons/azure/search.js +28 -0
  499. package/icons/azure/security-baselines.js +44 -0
  500. package/icons/azure/security.js +22 -0
  501. package/icons/azure/send-grid-accounts.js +25 -0
  502. package/icons/azure/server-farm.js +54 -0
  503. package/icons/azure/serverless-search.js +54 -0
  504. package/icons/azure/service-catalog-mad.js +48 -0
  505. package/icons/azure/service-endpoint-policies.js +64 -0
  506. package/icons/azure/service-fabric-clusters.js +53 -0
  507. package/icons/azure/service-health.js +34 -0
  508. package/icons/azure/service-providers.js +38 -0
  509. package/icons/azure/shared-image-galleries.js +21 -0
  510. package/icons/azure/signal-r.js +22 -0
  511. package/icons/azure/software-as-a-service.js +43 -0
  512. package/icons/azure/software-updates.js +22 -0
  513. package/icons/azure/solutions.js +58 -0
  514. package/icons/azure/sonic-dash.js +73 -0
  515. package/icons/azure/spatial-anchor-accounts.js +44 -0
  516. package/icons/azure/speech-services.js +32 -0
  517. package/icons/azure/spot-vm.js +40 -0
  518. package/icons/azure/spot-vmss.js +66 -0
  519. package/icons/azure/sql-data-warehouses.js +54 -0
  520. package/icons/azure/sql-database.js +52 -0
  521. package/icons/azure/sql-elastic-pools.js +78 -0
  522. package/icons/azure/sql-managed-instance.js +51 -0
  523. package/icons/azure/sql-server-registries.js +64 -0
  524. package/icons/azure/sql-server.js +46 -0
  525. package/icons/azure/ssd.js +30 -0
  526. package/icons/azure/ssh-keys.js +42 -0
  527. package/icons/azure/ssis-lift-and-shift-ir.js +72 -0
  528. package/icons/azure/stack-hci-premium.js +78 -0
  529. package/icons/azure/static-apps.js +29 -0
  530. package/icons/azure/stor-simple-data-managers.js +57 -0
  531. package/icons/azure/stor-simple-device-managers.js +27 -0
  532. package/icons/azure/storage-accounts-classic.js +36 -0
  533. package/icons/azure/storage-accounts.js +35 -0
  534. package/icons/azure/storage-actions.js +66 -0
  535. package/icons/azure/storage-azure-files.js +30 -0
  536. package/icons/azure/storage-container.js +29 -0
  537. package/icons/azure/storage-explorer.js +27 -0
  538. package/icons/azure/storage-functions.js +40 -0
  539. package/icons/azure/storage-queue.js +18 -0
  540. package/icons/azure/storage-sync-services.js +52 -0
  541. package/icons/azure/stream-analytics-jobs.js +53 -0
  542. package/icons/azure/subnet.js +43 -0
  543. package/icons/azure/subscriptions.js +41 -0
  544. package/icons/azure/system-topic.js +103 -0
  545. package/icons/azure/table.js +23 -0
  546. package/icons/azure/tag.js +28 -0
  547. package/icons/azure/tags.js +46 -0
  548. package/icons/azure/targets-management.js +43 -0
  549. package/icons/azure/template-specs.js +67 -0
  550. package/icons/azure/templates.js +33 -0
  551. package/icons/azure/tenant-properties.js +51 -0
  552. package/icons/azure/tenant-status.js +40 -0
  553. package/icons/azure/test-base.js +56 -0
  554. package/icons/azure/tfs-vc-repository.js +42 -0
  555. package/icons/azure/time-series-data-sets.js +52 -0
  556. package/icons/azure/time-series-insights-access-policies.js +42 -0
  557. package/icons/azure/time-series-insights-environments.js +39 -0
  558. package/icons/azure/time-series-insights-event-sources.js +36 -0
  559. package/icons/azure/toolbox.js +26 -0
  560. package/icons/azure/traffic-manager-profiles.js +36 -0
  561. package/icons/azure/translator-text.js +75 -0
  562. package/icons/azure/troubleshoot.js +38 -0
  563. package/icons/azure/universal-print.js +35 -0
  564. package/icons/azure/update-management-center.js +69 -0
  565. package/icons/azure/updates.js +47 -0
  566. package/icons/azure/user-privacy.js +44 -0
  567. package/icons/azure/user-settings.js +46 -0
  568. package/icons/azure/user-subscriptions.js +82 -0
  569. package/icons/azure/users.js +26 -0
  570. package/icons/azure/verifiable-credentials.js +99 -0
  571. package/icons/azure/verification-as-a-service.js +84 -0
  572. package/icons/azure/versions.js +24 -0
  573. package/icons/azure/video-analyzers.js +42 -0
  574. package/icons/azure/virtual-clusters.js +77 -0
  575. package/icons/azure/virtual-enclaves.js +40 -0
  576. package/icons/azure/virtual-instance-for-sap.js +70 -0
  577. package/icons/azure/virtual-machine.js +30 -0
  578. package/icons/azure/virtual-machines-classic.js +31 -0
  579. package/icons/azure/virtual-network-gateways.js +45 -0
  580. package/icons/azure/virtual-networks-classic.js +64 -0
  581. package/icons/azure/virtual-networks.js +64 -0
  582. package/icons/azure/virtual-router.js +29 -0
  583. package/icons/azure/virtual-visits-builder.js +75 -0
  584. package/icons/azure/virtual-wan-hub.js +55 -0
  585. package/icons/azure/virtual-wans.js +60 -0
  586. package/icons/azure/vm-app-definitions.js +66 -0
  587. package/icons/azure/vm-app-versions.js +58 -0
  588. package/icons/azure/vm-image-version.js +59 -0
  589. package/icons/azure/vm-images-classic.js +38 -0
  590. package/icons/azure/vm-scale-sets.js +38 -0
  591. package/icons/azure/wac-installer.js +104 -0
  592. package/icons/azure/wac.js +56 -0
  593. package/icons/azure/web-app-database.js +160 -0
  594. package/icons/azure/web-application-firewall-policies-waf.js +91 -0
  595. package/icons/azure/web-jobs.js +119 -0
  596. package/icons/azure/web-slots.js +30 -0
  597. package/icons/azure/web-test.js +105 -0
  598. package/icons/azure/website-power.js +62 -0
  599. package/icons/azure/website-staging.js +24 -0
  600. package/icons/azure/windows-notification-services.js +67 -0
  601. package/icons/azure/windows10-core-services.js +50 -0
  602. package/icons/azure/workbooks.js +38 -0
  603. package/icons/azure/worker-container-app.js +69 -0
  604. package/icons/azure/workflow.js +36 -0
  605. package/icons/azure/workspace-gateway.js +64 -0
  606. package/icons/azure/workspaces.js +23 -0
  607. package/package.json +34 -35
  608. package/react/index.d.ts +11 -4
  609. package/react/index.mjs +4050 -746
  610. package/react/style.css +1 -1
  611. package/dist/shared/likec4.Cjx4es-x.mjs +0 -1224
@@ -1,1224 +0,0 @@
1
- import*as tb from"node:fs";import{writeFileSync as nb,statSync as aN,readFileSync as sg,appendFileSync as cN,createReadStream as rb,createWriteStream as ib,existsSync as uN}from"node:fs";import zr,{sep as lN,resolve as dN,basename as fN}from"node:path";import{fileURLToPath as og,pathToFileURL as hN}from"node:url";import{isatty as pN}from"tty";import{Graphviz as ag}from"@hpcc-js/wasm-graphviz";import*as gN from"node:util";import{formatWithOptions as mN,debuglog as yN,stripVTControlCharacters as vN,inspect as sb,promisify as wN,callbackify as wo,aborted as bN}from"node:util";import Ee,{platform as DN,hrtime as zl,execPath as EN,execArgv as TN}from"node:process";import*as cg from"node:tty";import ob from"node:tty";import{ChildProcess as ab,spawnSync as RN,spawn as SN}from"node:child_process";import{StringDecoder as cb}from"node:string_decoder";import*as $N from"child_process";import*as kN from"path";import*as CN from"fs";import{setTimeout as ub,scheduler as lb,setImmediate as _N}from"node:timers/promises";import{constants as As}from"node:os";import{once as cn,addAbortListener as db,EventEmitter as AN,on as Hl,setMaxListeners as IN}from"node:events";import{serialize as xN}from"node:v8";import{Transform as PN,getDefaultHighWaterMark as Kl,PassThrough as fb,Readable as Is,Writable as ug,Duplex as lg}from"node:stream";import{Buffer as dg}from"node:buffer";import{finished as Ai}from"node:stream/promises";import{createLogger as NN}from"vite";import{Buffer as fg}from"buffer";import*as ON from"util";import*as FN from"os";import*as LN from"crypto";import*as MN from"net";import*as BN from"url";function Xe(t,e){if(typeof t>"u"||t==null)throw new Error(e??`Expected defined value, but received ${t}`);return t}function ce(t,e){if(!t)throw new Error(e??"Invariant failed")}function $e(t){throw new Error(`NonExhaustive value: ${t}`)}function jN(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function Vl(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return jN(t,e,n);throw new Error("Wrong number of arguments")}function UN(t){return e=>!t(e)}function Ii(t){return t==null}function qN(t){return Array.isArray(t)}function WN(...t){return Vl(GN,t)}var GN=(t,e)=>e.every(n=>n(t));function zN(...t){return Vl(HN,t)}var HN=(t,e)=>e.some(n=>n(t));const hb="dashed",bo="normal",xs="gray";function KN(t,e){return e?e+"."+t:t}const VN=["solid","dashed","dotted","none"],YN=["rectangle","person","browser","mobile","cylinder","storage","queue"],Yl="primary",pb="rectangle";function gb(t){return"element"in t}function mb(t){return"expanded"in t}function yb(t){return"custom"in t&&(Xl(t.custom.expr)||hg(t.custom.expr))}function vb(t){return"wildcard"in t}function wb(t){return"elementKind"in t&&"isEqual"in t}function bb(t){return"elementTag"in t&&"isEqual"in t}function Xl(t){return gb(t)||vb(t)||wb(t)||bb(t)||mb(t)}function hg(t){return"where"in t&&Xl(t.where.expr)}function XN(t){return Xl(t)||hg(t)||yb(t)}function Db(t){return"source"in t&&"target"in t}function Eb(t){return"inout"in t}function Tb(t){return"incoming"in t}function Rb(t){return"outgoing"in t}function pg(t){return Db(t)||Eb(t)||Tb(t)||Rb(t)}function Sb(t){return"where"in t&&pg(t.where.expr)}function $b(t){return"customRelation"in t}function JN(t){return pg(t)||Sb(t)||$b(t)}const ie={__proto__:null,isCustomElement:yb,isCustomRelationExpr:$b,isElement:Xl,isElementKindExpr:wb,isElementPredicateExpr:XN,isElementRef:gb,isElementTagExpr:bb,isElementWhere:hg,isExpandedElementExpr:mb,isInOut:Eb,isIncoming:Tb,isOutgoing:Rb,isRelation:Db,isRelationExpression:pg,isRelationPredicateExpr:JN,isRelationWhere:Sb,isWildcard:vb},ZN=t=>"tag"in t,QN=t=>"kind"in t,e2=t=>"not"in t,gg=t=>"and"in t,mg=t=>"or"in t;function Do(t){switch(!0){case ZN(t):{if("eq"in t.tag){const n=t.tag.eq;return r=>Array.isArray(r.tags)&&r.tags.includes(n)}const e=t.tag.neq;return n=>!Array.isArray(n.tags)||!n.tags.includes(e)}case QN(t):{if("eq"in t.kind){const n=t.kind.eq;return r=>r.kind===n}const e=t.kind.neq;return n=>Ii(n.kind)||n.kind!==e}case e2(t):{const e=Do(t.not);return UN(e)}case gg(t):{const e=t.and.map(Do);return WN(e)}case mg(t):{const e=t.or.map(Do);return zN(e)}default:$e(t)}}const t2=["amber","blue","gray","slate","green","indigo","muted","primary","red","secondary","sky"];function kb(t){return t in t2}function n2(t){return"include"in t&&Array.isArray(t.include)||"exclude"in t&&Array.isArray(t.exclude)}function r2(t){return"style"in t&&"targets"in t}function Cb(t){return"autoLayout"in t}function i2(t){return"include"in t&&Array.isArray(t.include)}function s2(t){return"__parallel"in t&&qN(t.__parallel)}function Jl(t){return Ii(t.__)||t.__==="element"}function _b(t){return Jl(t)&&"extends"in t}function Ab(t){return Jl(t)&&"viewOf"in t}function Ib(t,e){const n=`step-${String(t).padStart(2,"0")}`;return e?`${n}.${e}`:n}function xb(t){return t.startsWith("step-")}function Pb(t){if(!xb(t))throw new Error(`Invalid step edge id: ${t}`);return parseFloat(t.slice(5))}function yg(t){return t.__==="dynamic"}function o2(t){return Ii(t.__)||t.__==="element"}const{min:a2,max:c2}=Math,Ps=(t,e=0,n=1)=>a2(c2(e,t),n),vg=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let e=0;e<=3;e++)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]=Ps(t[e],0,255)):e===3&&(t[e]=Ps(t[e],0,1));return t},Nb={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Nb[`[object ${t}]`]=t.toLowerCase();function ve(t){return Nb[Object.prototype.toString.call(t)]||"object"}const de=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):ve(t[0])=="object"&&e?e.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0),Eo=t=>{if(t.length<2)return null;const e=t.length-1;return ve(t[e])=="string"?t[e].toLowerCase():null},{PI:Zl,min:Ob,max:Fb}=Math,xn=t=>Math.round(t*100)/100,wg=t=>Math.round(t*100)/100,Hr=Zl*2,bg=Zl/3,u2=Zl/180,l2=180/Zl,le={format:{},autodetect:[]};let V=class{constructor(...e){const n=this;if(ve(e[0])==="object"&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let r=Eo(e),i=!1;if(!r){i=!0,le.sorted||(le.autodetect=le.autodetect.sort((s,o)=>o.p-s.p),le.sorted=!0);for(let s of le.autodetect)if(r=s.test(...e),r)break}if(le.format[r]){const s=le.format[r].apply(null,i?e:e.slice(0,-1));n._rgb=vg(s)}else throw new Error("unknown format: "+e);n._rgb.length===3&&n._rgb.push(1)}toString(){return ve(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const d2="3.1.1",De=(...t)=>new V(...t);De.version=d2;const To={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},f2=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,h2=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Lb=t=>{if(t.match(f2)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16),n=e>>16,r=e>>8&255,i=e&255;return[n,r,i,1]}if(t.match(h2)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16),n=e>>24&255,r=e>>16&255,i=e>>8&255,s=Math.round((e&255)/255*100)/100;return[n,r,i,s]}throw new Error(`unknown hex color: ${t}`)},{round:Ql}=Math,Mb=(...t)=>{let[e,n,r,i]=de(t,"rgba"),s=Eo(t)||"auto";i===void 0&&(i=1),s==="auto"&&(s=i<1?"rgba":"rgb"),e=Ql(e),n=Ql(n),r=Ql(r);let o="000000"+(e<<16|n<<8|r).toString(16);o=o.substr(o.length-6);let a="0"+Ql(i*255).toString(16);switch(a=a.substr(a.length-2),s.toLowerCase()){case"rgba":return`#${o}${a}`;case"argb":return`#${a}${o}`;default:return`#${o}`}};V.prototype.name=function(){const t=Mb(this._rgb,"rgb");for(let e of Object.keys(To))if(To[e]===t)return e.toLowerCase();return t},le.format.named=t=>{if(t=t.toLowerCase(),To[t])return Lb(To[t]);throw new Error("unknown color name: "+t)},le.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&ve(t)==="string"&&To[t.toLowerCase()])return"named"}}),V.prototype.alpha=function(t,e=!1){return t!==void 0&&ve(t)==="number"?e?(this._rgb[3]=t,this):new V([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},V.prototype.clipped=function(){return this._rgb._clipped||!1};const mr={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},p2=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function Kr(t){const e=p2.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);mr.labWhitePoint=t,mr.Xn=e[0],mr.Zn=e[1]}function Ua(){return mr.labWhitePoint}const Dg=(...t)=>{t=de(t,"lab");const[e,n,r]=t,[i,s,o]=g2(e,n,r),[a,c,u]=Bb(i,s,o);return[a,c,u,t.length>3?t[3]:1]},g2=(t,e,n)=>{const{kE:r,kK:i,kKE:s,Xn:o,Yn:a,Zn:c}=mr,u=(t+16)/116,l=.002*e+u,d=u-.005*n,f=l*l*l,h=d*d*d,p=f>r?f:(116*l-16)/i,y=t>s?Math.pow((t+16)/116,3):t/i,T=h>r?h:(116*d-16)/i,b=p*o,v=y*a,D=T*c;return[b,v,D]},Eg=t=>{const e=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*e},Bb=(t,e,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:i,MtxXYZ2RGB:s,RefWhiteRGB:o,Xn:a,Yn:c,Zn:u}=mr,l=a*r.m00+c*r.m10+u*r.m20,d=a*r.m01+c*r.m11+u*r.m21,f=a*r.m02+c*r.m12+u*r.m22,h=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,p=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,y=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,T=(t*r.m00+e*r.m10+n*r.m20)*(h/l),b=(t*r.m01+e*r.m11+n*r.m21)*(p/d),v=(t*r.m02+e*r.m12+n*r.m22)*(y/f),D=T*i.m00+b*i.m10+v*i.m20,k=T*i.m01+b*i.m11+v*i.m21,P=T*i.m02+b*i.m12+v*i.m22,M=Eg(D*s.m00+k*s.m10+P*s.m20),I=Eg(D*s.m01+k*s.m11+P*s.m21),G=Eg(D*s.m02+k*s.m12+P*s.m22);return[M*255,I*255,G*255]},Tg=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),[s,o,a]=jb(e,n,r),[c,u,l]=m2(s,o,a);return[c,u,l,...i.length>0&&i[0]<1?[i[0]]:[]]};function m2(t,e,n){const{Xn:r,Yn:i,Zn:s,kE:o,kK:a}=mr,c=t/r,u=e/i,l=n/s,d=c>o?Math.pow(c,1/3):(a*c+16)/116,f=u>o?Math.pow(u,1/3):(a*u+16)/116,h=l>o?Math.pow(l,1/3):(a*l+16)/116;return[116*f-16,500*(d-f),200*(f-h)]}function Rg(t){const e=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*e}const jb=(t,e,n)=>{t=Rg(t/255),e=Rg(e/255),n=Rg(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:i,MtxAdaptMaI:s,Xn:o,Yn:a,Zn:c,As:u,Bs:l,Cs:d}=mr;let f=t*r.m00+e*r.m10+n*r.m20,h=t*r.m01+e*r.m11+n*r.m21,p=t*r.m02+e*r.m12+n*r.m22;const y=o*i.m00+a*i.m10+c*i.m20,T=o*i.m01+a*i.m11+c*i.m21,b=o*i.m02+a*i.m12+c*i.m22;let v=f*i.m00+h*i.m10+p*i.m20,D=f*i.m01+h*i.m11+p*i.m21,k=f*i.m02+h*i.m12+p*i.m22;return v*=y/u,D*=T/l,k*=b/d,f=v*s.m00+D*s.m10+k*s.m20,h=v*s.m01+D*s.m11+k*s.m21,p=v*s.m02+D*s.m12+k*s.m22,[f,h,p]};V.prototype.lab=function(){return Tg(this._rgb)};const y2=(...t)=>new V(...t,"lab");Object.assign(De,{lab:y2,getLabWhitePoint:Ua,setLabWhitePoint:Kr}),le.format.lab=Dg,le.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"lab"),ve(t)==="array"&&t.length===3)return"lab"}}),V.prototype.darken=function(t=1){const e=this,n=e.lab();return n[0]-=mr.Kn*t,new V(n,"lab").alpha(e.alpha(),!0)},V.prototype.brighten=function(t=1){return this.darken(-t)},V.prototype.darker=V.prototype.darken,V.prototype.brighter=V.prototype.brighten,V.prototype.get=function(t){const[e,n]=t.split("."),r=this[e]();if(n){const i=e.indexOf(n)-(e.substr(0,2)==="ok"?2:0);if(i>-1)return r[i];throw new Error(`unknown channel ${n} in mode ${e}`)}else return r};const{pow:v2}=Math,w2=1e-7,b2=20;V.prototype.luminance=function(t,e="rgb"){if(t!==void 0&&ve(t)==="number"){if(t===0)return new V([0,0,0,this._rgb[3]],"rgb");if(t===1)return new V([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=b2;const i=(o,a)=>{const c=o.interpolate(a,.5,e),u=c.luminance();return Math.abs(t-u)<w2||!r--?c:u>t?i(o,c):i(c,a)},s=(n>t?i(new V([0,0,0]),this):i(this,new V([255,255,255]))).rgb();return new V([...s,this._rgb[3]])}return D2(...this._rgb.slice(0,3))};const D2=(t,e,n)=>(t=Sg(t),e=Sg(e),n=Sg(n),.2126*t+.7152*e+.0722*n),Sg=t=>(t/=255,t<=.03928?t/12.92:v2((t+.055)/1.055,2.4)),jt={},Ro=(t,e,n=.5,...r)=>{let i=r[0]||"lrgb";if(!jt[i]&&!r.length&&(i=Object.keys(jt)[0]),!jt[i])throw new Error(`interpolation mode ${i} is not defined`);return ve(t)!=="object"&&(t=new V(t)),ve(e)!=="object"&&(e=new V(e)),jt[i](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))};V.prototype.mix=V.prototype.interpolate=function(t,e=.5,...n){return Ro(this,t,e,...n)},V.prototype.premultiply=function(t=!1){const e=this._rgb,n=e[3];return t?(this._rgb=[e[0]*n,e[1]*n,e[2]*n,n],this):new V([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};const{sin:E2,cos:T2}=Math,Ub=(...t)=>{let[e,n,r]=de(t,"lch");return isNaN(r)&&(r=0),r=r*u2,[e,T2(r)*n,E2(r)*n]},$g=(...t)=>{t=de(t,"lch");const[e,n,r]=t,[i,s,o]=Ub(e,n,r),[a,c,u]=Dg(i,s,o);return[a,c,u,t.length>3?t[3]:1]},R2=(...t)=>{const e=de(t,"hcl").reverse();return $g(...e)},{sqrt:S2,atan2:$2,round:k2}=Math,qb=(...t)=>{const[e,n,r]=de(t,"lab"),i=S2(n*n+r*r);let s=($2(r,n)*l2+360)%360;return k2(i*1e4)===0&&(s=Number.NaN),[e,i,s]},kg=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),[s,o,a]=Tg(e,n,r),[c,u,l]=qb(s,o,a);return[c,u,l,...i.length>0&&i[0]<1?[i[0]]:[]]};V.prototype.lch=function(){return kg(this._rgb)},V.prototype.hcl=function(){return kg(this._rgb).reverse()};const C2=(...t)=>new V(...t,"lch"),_2=(...t)=>new V(...t,"hcl");Object.assign(De,{lch:C2,hcl:_2}),le.format.lch=$g,le.format.hcl=R2,["lch","hcl"].forEach(t=>le.autodetect.push({p:2,test:(...e)=>{if(e=de(e,t),ve(e)==="array"&&e.length===3)return t}})),V.prototype.saturate=function(t=1){const e=this,n=e.lch();return n[1]+=mr.Kn*t,n[1]<0&&(n[1]=0),new V(n,"lch").alpha(e.alpha(),!0)},V.prototype.desaturate=function(t=1){return this.saturate(-t)},V.prototype.set=function(t,e,n=!1){const[r,i]=t.split("."),s=this[r]();if(i){const o=r.indexOf(i)-(r.substr(0,2)==="ok"?2:0);if(o>-1){if(ve(e)=="string")switch(e.charAt(0)){case"+":s[o]+=+e;break;case"-":s[o]+=+e;break;case"*":s[o]*=+e.substr(1);break;case"/":s[o]/=+e.substr(1);break;default:s[o]=+e}else if(ve(e)==="number")s[o]=e;else throw new Error("unsupported value for Color.set");const a=new V(s,r);return n?(this._rgb=a._rgb,this):a}throw new Error(`unknown channel ${i} in mode ${r}`)}else return s},V.prototype.tint=function(t=.5,...e){return Ro(this,"white",t,...e)},V.prototype.shade=function(t=.5,...e){return Ro(this,"black",t,...e)};const A2=(t,e,n)=>{const r=t._rgb,i=e._rgb;return new V(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"rgb")};jt.rgb=A2;const{sqrt:Cg,pow:So}=Math,I2=(t,e,n)=>{const[r,i,s]=t._rgb,[o,a,c]=e._rgb;return new V(Cg(So(r,2)*(1-n)+So(o,2)*n),Cg(So(i,2)*(1-n)+So(a,2)*n),Cg(So(s,2)*(1-n)+So(c,2)*n),"rgb")};jt.lrgb=I2;const x2=(t,e,n)=>{const r=t.lab(),i=e.lab();return new V(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"lab")};jt.lab=x2;const $o=(t,e,n,r)=>{let i,s;r==="hsl"?(i=t.hsl(),s=e.hsl()):r==="hsv"?(i=t.hsv(),s=e.hsv()):r==="hcg"?(i=t.hcg(),s=e.hcg()):r==="hsi"?(i=t.hsi(),s=e.hsi()):r==="lch"||r==="hcl"?(r="hcl",i=t.hcl(),s=e.hcl()):r==="oklch"&&(i=t.oklch().reverse(),s=e.oklch().reverse());let o,a,c,u,l,d;(r.substr(0,1)==="h"||r==="oklch")&&([o,c,l]=i,[a,u,d]=s);let f,h,p,y;return!isNaN(o)&&!isNaN(a)?(a>o&&a-o>180?y=a-(o+360):a<o&&o-a>180?y=a+360-o:y=a-o,h=o+n*y):isNaN(o)?isNaN(a)?h=Number.NaN:(h=a,(l==1||l==0)&&r!="hsv"&&(f=u)):(h=o,(d==1||d==0)&&r!="hsv"&&(f=c)),f===void 0&&(f=c+n*(u-c)),p=l+n*(d-l),r==="oklch"?new V([p,f,h],r):new V([h,f,p],r)},Wb=(t,e,n)=>$o(t,e,n,"lch");jt.lch=Wb,jt.hcl=Wb;const P2=t=>{if(ve(t)=="number"&&t>=0&&t<=16777215){const e=t>>16,n=t>>8&255,r=t&255;return[e,n,r,1]}throw new Error("unknown num color: "+t)},N2=(...t)=>{const[e,n,r]=de(t,"rgb");return(e<<16)+(n<<8)+r};V.prototype.num=function(){return N2(this._rgb)};const O2=(...t)=>new V(...t,"num");Object.assign(De,{num:O2}),le.format.num=P2,le.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&ve(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return"num"}});const F2=(t,e,n)=>{const r=t.num(),i=e.num();return new V(r+n*(i-r),"num")};jt.num=F2;const{floor:L2}=Math,M2=(...t)=>{t=de(t,"hcg");let[e,n,r]=t,i,s,o;r=r*255;const a=n*255;if(n===0)i=s=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const c=L2(e),u=e-c,l=r*(1-n),d=l+a*(1-u),f=l+a*u,h=l+a;switch(c){case 0:[i,s,o]=[h,f,l];break;case 1:[i,s,o]=[d,h,l];break;case 2:[i,s,o]=[l,h,f];break;case 3:[i,s,o]=[l,d,h];break;case 4:[i,s,o]=[f,l,h];break;case 5:[i,s,o]=[h,l,d];break}}return[i,s,o,t.length>3?t[3]:1]},B2=(...t)=>{const[e,n,r]=de(t,"rgb"),i=Ob(e,n,r),s=Fb(e,n,r),o=s-i,a=o*100/255,c=i/(255-o)*100;let u;return o===0?u=Number.NaN:(e===s&&(u=(n-r)/o),n===s&&(u=2+(r-e)/o),r===s&&(u=4+(e-n)/o),u*=60,u<0&&(u+=360)),[u,a,c]};V.prototype.hcg=function(){return B2(this._rgb)};const j2=(...t)=>new V(...t,"hcg");De.hcg=j2,le.format.hcg=M2,le.autodetect.push({p:1,test:(...t)=>{if(t=de(t,"hcg"),ve(t)==="array"&&t.length===3)return"hcg"}});const U2=(t,e,n)=>$o(t,e,n,"hcg");jt.hcg=U2;const{cos:ko}=Math,q2=(...t)=>{t=de(t,"hsi");let[e,n,r]=t,i,s,o;return isNaN(e)&&(e=0),isNaN(n)&&(n=0),e>360&&(e-=360),e<0&&(e+=360),e/=360,e<1/3?(o=(1-n)/3,i=(1+n*ko(Hr*e)/ko(bg-Hr*e))/3,s=1-(o+i)):e<2/3?(e-=1/3,i=(1-n)/3,s=(1+n*ko(Hr*e)/ko(bg-Hr*e))/3,o=1-(i+s)):(e-=2/3,s=(1-n)/3,o=(1+n*ko(Hr*e)/ko(bg-Hr*e))/3,i=1-(s+o)),i=Ps(r*i*3),s=Ps(r*s*3),o=Ps(r*o*3),[i*255,s*255,o*255,t.length>3?t[3]:1]},{min:W2,sqrt:G2,acos:z2}=Math,H2=(...t)=>{let[e,n,r]=de(t,"rgb");e/=255,n/=255,r/=255;let i;const s=W2(e,n,r),o=(e+n+r)/3,a=o>0?1-s/o:0;return a===0?i=NaN:(i=(e-n+(e-r))/2,i/=G2((e-n)*(e-n)+(e-r)*(n-r)),i=z2(i),r>n&&(i=Hr-i),i/=Hr),[i*360,a,o]};V.prototype.hsi=function(){return H2(this._rgb)};const K2=(...t)=>new V(...t,"hsi");De.hsi=K2,le.format.hsi=q2,le.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"hsi"),ve(t)==="array"&&t.length===3)return"hsi"}});const V2=(t,e,n)=>$o(t,e,n,"hsi");jt.hsi=V2;const _g=(...t)=>{t=de(t,"hsl");const[e,n,r]=t;let i,s,o;if(n===0)i=s=o=r*255;else{const a=[0,0,0],c=[0,0,0],u=r<.5?r*(1+n):r+n-r*n,l=2*r-u,d=e/360;a[0]=d+1/3,a[1]=d,a[2]=d-1/3;for(let f=0;f<3;f++)a[f]<0&&(a[f]+=1),a[f]>1&&(a[f]-=1),6*a[f]<1?c[f]=l+(u-l)*6*a[f]:2*a[f]<1?c[f]=u:3*a[f]<2?c[f]=l+(u-l)*(2/3-a[f])*6:c[f]=l;[i,s,o]=[c[0]*255,c[1]*255,c[2]*255]}return t.length>3?[i,s,o,t[3]]:[i,s,o,1]},Gb=(...t)=>{t=de(t,"rgba");let[e,n,r]=t;e/=255,n/=255,r/=255;const i=Ob(e,n,r),s=Fb(e,n,r),o=(s+i)/2;let a,c;return s===i?(a=0,c=Number.NaN):a=o<.5?(s-i)/(s+i):(s-i)/(2-s-i),e==s?c=(n-r)/(s-i):n==s?c=2+(r-e)/(s-i):r==s&&(c=4+(e-n)/(s-i)),c*=60,c<0&&(c+=360),t.length>3&&t[3]!==void 0?[c,a,o,t[3]]:[c,a,o]};V.prototype.hsl=function(){return Gb(this._rgb)};const Y2=(...t)=>new V(...t,"hsl");De.hsl=Y2,le.format.hsl=_g,le.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"hsl"),ve(t)==="array"&&t.length===3)return"hsl"}});const X2=(t,e,n)=>$o(t,e,n,"hsl");jt.hsl=X2;const{floor:J2}=Math,Z2=(...t)=>{t=de(t,"hsv");let[e,n,r]=t,i,s,o;if(r*=255,n===0)i=s=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const a=J2(e),c=e-a,u=r*(1-n),l=r*(1-n*c),d=r*(1-n*(1-c));switch(a){case 0:[i,s,o]=[r,d,u];break;case 1:[i,s,o]=[l,r,u];break;case 2:[i,s,o]=[u,r,d];break;case 3:[i,s,o]=[u,l,r];break;case 4:[i,s,o]=[d,u,r];break;case 5:[i,s,o]=[r,u,l];break}}return[i,s,o,t.length>3?t[3]:1]},{min:Q2,max:eO}=Math,tO=(...t)=>{t=de(t,"rgb");let[e,n,r]=t;const i=Q2(e,n,r),s=eO(e,n,r),o=s-i;let a,c,u;return u=s/255,s===0?(a=Number.NaN,c=0):(c=o/s,e===s&&(a=(n-r)/o),n===s&&(a=2+(r-e)/o),r===s&&(a=4+(e-n)/o),a*=60,a<0&&(a+=360)),[a,c,u]};V.prototype.hsv=function(){return tO(this._rgb)};const nO=(...t)=>new V(...t,"hsv");De.hsv=nO,le.format.hsv=Z2,le.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"hsv"),ve(t)==="array"&&t.length===3)return"hsv"}});const rO=(t,e,n)=>$o(t,e,n,"hsv");jt.hsv=rO;function ed(t,e){let n=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map(o=>[o]));let r=e[0].length,i=e[0].map((o,a)=>e.map(c=>c[a])),s=t.map(o=>i.map(a=>Array.isArray(o)?o.reduce((c,u,l)=>c+u*(a[l]||0),0):a.reduce((c,u)=>c+u*o,0)));return n===1&&(s=s[0]),r===1?s.map(o=>o[0]):s}const Ag=(...t)=>{t=de(t,"lab");const[e,n,r,...i]=t,[s,o,a]=iO([e,n,r]),[c,u,l]=Bb(s,o,a);return[c,u,l,...i.length>0&&i[0]<1?[i[0]]:[]]};function iO(t){var e=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],n=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],r=ed(n,t);return ed(e,r.map(i=>i**3))}const Ig=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),s=jb(e,n,r);return[...sO(s),...i.length>0&&i[0]<1?[i[0]]:[]]};function sO(t){const e=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],n=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],r=ed(e,t);return ed(n,r.map(i=>Math.cbrt(i)))}V.prototype.oklab=function(){return Ig(this._rgb)};const oO=(...t)=>new V(...t,"oklab");Object.assign(De,{oklab:oO}),le.format.oklab=Ag,le.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"oklab"),ve(t)==="array"&&t.length===3)return"oklab"}});const aO=(t,e,n)=>{const r=t.oklab(),i=e.oklab();return new V(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),"oklab")};jt.oklab=aO;const cO=(t,e,n)=>$o(t,e,n,"oklch");jt.oklch=cO;const{pow:xg,sqrt:Pg,PI:Ng,cos:zb,sin:Hb,atan2:uO}=Math,lO=(t,e="lrgb",n=null)=>{const r=t.length;n||(n=Array.from(new Array(r)).map(()=>1));const i=r/n.reduce(function(d,f){return d+f});if(n.forEach((d,f)=>{n[f]*=i}),t=t.map(d=>new V(d)),e==="lrgb")return dO(t,n);const s=t.shift(),o=s.get(e),a=[];let c=0,u=0;for(let d=0;d<o.length;d++)if(o[d]=(o[d]||0)*n[0],a.push(isNaN(o[d])?0:n[0]),e.charAt(d)==="h"&&!isNaN(o[d])){const f=o[d]/180*Ng;c+=zb(f)*n[0],u+=Hb(f)*n[0]}let l=s.alpha()*n[0];t.forEach((d,f)=>{const h=d.get(e);l+=d.alpha()*n[f+1];for(let p=0;p<o.length;p++)if(!isNaN(h[p]))if(a[p]+=n[f+1],e.charAt(p)==="h"){const y=h[p]/180*Ng;c+=zb(y)*n[f+1],u+=Hb(y)*n[f+1]}else o[p]+=h[p]*n[f+1]});for(let d=0;d<o.length;d++)if(e.charAt(d)==="h"){let f=uO(u/a[d],c/a[d])/Ng*180;for(;f<0;)f+=360;for(;f>=360;)f-=360;o[d]=f}else o[d]=o[d]/a[d];return l/=r,new V(o,e).alpha(l>.99999?1:l,!0)},dO=(t,e)=>{const n=t.length,r=[0,0,0,0];for(let i=0;i<t.length;i++){const s=t[i],o=e[i]/n,a=s._rgb;r[0]+=xg(a[0],2)*o,r[1]+=xg(a[1],2)*o,r[2]+=xg(a[2],2)*o,r[3]+=a[3]*o}return r[0]=Pg(r[0]),r[1]=Pg(r[1]),r[2]=Pg(r[2]),r[3]>.9999999&&(r[3]=1),new V(vg(r))},{pow:fO}=Math;function td(t){let e="rgb",n=De("#ccc"),r=0,i=[0,1],s=[],o=[0,0],a=!1,c=[],u=!1,l=0,d=1,f=!1,h={},p=!0,y=1;const T=function(I){if(I=I||["#fff","#000"],I&&ve(I)==="string"&&De.brewer&&De.brewer[I.toLowerCase()]&&(I=De.brewer[I.toLowerCase()]),ve(I)==="array"){I.length===1&&(I=[I[0],I[0]]),I=I.slice(0);for(let G=0;G<I.length;G++)I[G]=De(I[G]);s.length=0;for(let G=0;G<I.length;G++)s.push(G/(I.length-1))}return P(),c=I},b=function(I){if(a!=null){const G=a.length-1;let U=0;for(;U<G&&I>=a[U];)U++;return U-1}return 0};let v=I=>I,D=I=>I;const k=function(I,G){let U,W;if(G==null&&(G=!1),isNaN(I)||I===null)return n;G?W=I:a&&a.length>2?W=b(I)/(a.length-2):d!==l?W=(I-l)/(d-l):W=1,W=D(W),G||(W=v(W)),y!==1&&(W=fO(W,y)),W=o[0]+W*(1-o[0]-o[1]),W=Ps(W,0,1);const A=Math.floor(W*1e4);if(p&&h[A])U=h[A];else{if(ve(c)==="array")for(let $=0;$<s.length;$++){const R=s[$];if(W<=R){U=c[$];break}if(W>=R&&$===s.length-1){U=c[$];break}if(W>R&&W<s[$+1]){W=(W-R)/(s[$+1]-R),U=De.interpolate(c[$],c[$+1],W,e);break}}else ve(c)==="function"&&(U=c(W));p&&(h[A]=U)}return U};var P=()=>h={};T(t);const M=function(I){const G=De(k(I));return u&&G[u]?G[u]():G};return M.classes=function(I){if(I!=null){if(ve(I)==="array")a=I,i=[I[0],I[I.length-1]];else{const G=De.analyze(i);I===0?a=[G.min,G.max]:a=De.limits(G,"e",I)}return M}return a},M.domain=function(I){if(!arguments.length)return i;l=I[0],d=I[I.length-1],s=[];const G=c.length;if(I.length===G&&l!==d)for(let U of Array.from(I))s.push((U-l)/(d-l));else{for(let U=0;U<G;U++)s.push(U/(G-1));if(I.length>2){const U=I.map((A,$)=>$/(I.length-1)),W=I.map(A=>(A-l)/(d-l));W.every((A,$)=>U[$]===A)||(D=A=>{if(A<=0||A>=1)return A;let $=0;for(;A>=W[$+1];)$++;const R=(A-W[$])/(W[$+1]-W[$]);return U[$]+R*(U[$+1]-U[$])})}}return i=[l,d],M},M.mode=function(I){return arguments.length?(e=I,P(),M):e},M.range=function(I,G){return T(I),M},M.out=function(I){return u=I,M},M.spread=function(I){return arguments.length?(r=I,M):r},M.correctLightness=function(I){return I==null&&(I=!0),f=I,P(),f?v=function(G){const U=k(0,!0).lab()[0],W=k(1,!0).lab()[0],A=U>W;let $=k(G,!0).lab()[0];const R=U+(W-U)*G;let L=$-R,q=0,j=1,z=20;for(;Math.abs(L)>.01&&z-- >0;)(function(){return A&&(L*=-1),L<0?(q=G,G+=(j-G)*.5):(j=G,G+=(q-G)*.5),$=k(G,!0).lab()[0],L=$-R})();return G}:v=G=>G,M},M.padding=function(I){return I!=null?(ve(I)==="number"&&(I=[I,I]),o=I,M):o},M.colors=function(I,G){arguments.length<2&&(G="hex");let U=[];if(arguments.length===0)U=c.slice(0);else if(I===1)U=[M(.5)];else if(I>1){const W=i[0],A=i[1]-W;U=hO(0,I).map($=>M(W+$/(I-1)*A))}else{t=[];let W=[];if(a&&a.length>2)for(let A=1,$=a.length,R=1<=$;R?A<$:A>$;R?A++:A--)W.push((a[A-1]+a[A])*.5);else W=i;U=W.map(A=>M(A))}return De[G]&&(U=U.map(W=>W[G]())),U},M.cache=function(I){return I!=null?(p=I,M):p},M.gamma=function(I){return I!=null?(y=I,M):y},M.nodata=function(I){return I!=null?(n=De(I),M):n},M}function hO(t,e,n){let r=[],i=t<e,s=e;for(let o=t;i?o<s:o>s;i?o++:o--)r.push(o);return r}const pO=function(t){let e=[1,1];for(let n=1;n<t;n++){let r=[1];for(let i=1;i<=e.length;i++)r[i]=(e[i]||0)+e[i-1];e=r}return e},gO=function(t){let e,n,r,i;if(t=t.map(s=>new V(s)),t.length===2)[n,r]=t.map(s=>s.lab()),e=function(s){const o=[0,1,2].map(a=>n[a]+s*(r[a]-n[a]));return new V(o,"lab")};else if(t.length===3)[n,r,i]=t.map(s=>s.lab()),e=function(s){const o=[0,1,2].map(a=>(1-s)*(1-s)*n[a]+2*(1-s)*s*r[a]+s*s*i[a]);return new V(o,"lab")};else if(t.length===4){let s;[n,r,i,s]=t.map(o=>o.lab()),e=function(o){const a=[0,1,2].map(c=>(1-o)*(1-o)*(1-o)*n[c]+3*(1-o)*(1-o)*o*r[c]+3*(1-o)*o*o*i[c]+o*o*o*s[c]);return new V(a,"lab")}}else if(t.length>=5){let s,o,a;s=t.map(c=>c.lab()),a=t.length-1,o=pO(a),e=function(c){const u=1-c,l=[0,1,2].map(d=>s.reduce((f,h,p)=>f+o[p]*u**(a-p)*c**p*h[d],0));return new V(l,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return e},mO=t=>{const e=gO(t);return e.scale=()=>td(e),e},{round:Kb}=Math;V.prototype.rgb=function(t=!0){return t===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Kb)},V.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map((e,n)=>n<3?t===!1?e:Kb(e):e)};const yO=(...t)=>new V(...t,"rgb");Object.assign(De,{rgb:yO}),le.format.rgb=(...t)=>{const e=de(t,"rgba");return e[3]===void 0&&(e[3]=1),e},le.autodetect.push({p:3,test:(...t)=>{if(t=de(t,"rgba"),ve(t)==="array"&&(t.length===3||t.length===4&&ve(t[3])=="number"&&t[3]>=0&&t[3]<=1))return"rgb"}});const Xn=(t,e,n)=>{if(!Xn[n])throw new Error("unknown blend mode "+n);return Xn[n](t,e)},xi=t=>(e,n)=>{const r=De(n).rgb(),i=De(e).rgb();return De.rgb(t(r,i))},Pi=t=>(e,n)=>{const r=[];return r[0]=t(e[0],n[0]),r[1]=t(e[1],n[1]),r[2]=t(e[2],n[2]),r},vO=t=>t,wO=(t,e)=>t*e/255,bO=(t,e)=>t>e?e:t,DO=(t,e)=>t>e?t:e,EO=(t,e)=>255*(1-(1-t/255)*(1-e/255)),TO=(t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255)),RO=(t,e)=>255*(1-(1-e/255)/(t/255)),SO=(t,e)=>t===255?255:(t=255*(e/255)/(1-t/255),t>255?255:t);Xn.normal=xi(Pi(vO)),Xn.multiply=xi(Pi(wO)),Xn.screen=xi(Pi(EO)),Xn.overlay=xi(Pi(TO)),Xn.darken=xi(Pi(bO)),Xn.lighten=xi(Pi(DO)),Xn.dodge=xi(Pi(SO)),Xn.burn=xi(Pi(RO));const{pow:$O,sin:kO,cos:CO}=Math;function _O(t=300,e=-1.5,n=1,r=1,i=[0,1]){let s=0,o;ve(i)==="array"?o=i[1]-i[0]:(o=0,i=[i,i]);const a=function(c){const u=Hr*((t+120)/360+e*c),l=$O(i[0]+o*c,r),d=(s!==0?n[0]+c*s:n)*l*(1-l)/2,f=CO(u),h=kO(u),p=l+d*(-.14861*f+1.78277*h),y=l+d*(-.29227*f-.90649*h),T=l+d*(1.97294*f);return De(vg([p*255,y*255,T*255,1]))};return a.start=function(c){return c==null?t:(t=c,a)},a.rotations=function(c){return c==null?e:(e=c,a)},a.gamma=function(c){return c==null?r:(r=c,a)},a.hue=function(c){return c==null?n:(n=c,ve(n)==="array"?(s=n[1]-n[0],s===0&&(n=n[1])):s=0,a)},a.lightness=function(c){return c==null?i:(ve(c)==="array"?(i=c,o=c[1]-c[0]):(i=[c,c],o=0),a)},a.scale=()=>De.scale(a),a.hue(n),a}const AO="0123456789abcdef",{floor:IO,random:xO}=Math,PO=()=>{let t="#";for(let e=0;e<6;e++)t+=AO.charAt(IO(xO()*16));return new V(t,"hex")},{log:Vb,pow:NO,floor:OO,abs:FO}=Math;function Yb(t,e=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return ve(t)==="object"&&(t=Object.values(t)),t.forEach(r=>{e&&ve(r)==="object"&&(r=r[e]),r!=null&&!isNaN(r)&&(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(r,i)=>Xb(n,r,i),n}function Xb(t,e="equal",n=7){ve(t)=="array"&&(t=Yb(t));const{min:r,max:i}=t,s=t.values.sort((a,c)=>a-c);if(n===1)return[r,i];const o=[];if(e.substr(0,1)==="c"&&(o.push(r),o.push(i)),e.substr(0,1)==="e"){o.push(r);for(let a=1;a<n;a++)o.push(r+a/n*(i-r));o.push(i)}else if(e.substr(0,1)==="l"){if(r<=0)throw new Error("Logarithmic scales are only possible for values > 0");const a=Math.LOG10E*Vb(r),c=Math.LOG10E*Vb(i);o.push(r);for(let u=1;u<n;u++)o.push(NO(10,a+u/n*(c-a)));o.push(i)}else if(e.substr(0,1)==="q"){o.push(r);for(let a=1;a<n;a++){const c=(s.length-1)*a/n,u=OO(c);if(u===c)o.push(s[u]);else{const l=c-u;o.push(s[u]*(1-l)+s[u+1]*l)}}o.push(i)}else if(e.substr(0,1)==="k"){let a;const c=s.length,u=new Array(c),l=new Array(n);let d=!0,f=0,h=null;h=[],h.push(r);for(let T=1;T<n;T++)h.push(r+T/n*(i-r));for(h.push(i);d;){for(let b=0;b<n;b++)l[b]=0;for(let b=0;b<c;b++){const v=s[b];let D=Number.MAX_VALUE,k;for(let P=0;P<n;P++){const M=FO(h[P]-v);M<D&&(D=M,k=P),l[k]++,u[b]=k}}const T=new Array(n);for(let b=0;b<n;b++)T[b]=null;for(let b=0;b<c;b++)a=u[b],T[a]===null?T[a]=s[b]:T[a]+=s[b];for(let b=0;b<n;b++)T[b]*=1/l[b];d=!1;for(let b=0;b<n;b++)if(T[b]!==h[b]){d=!0;break}h=T,f++,f>200&&(d=!1)}const p={};for(let T=0;T<n;T++)p[T]=[];for(let T=0;T<c;T++)a=u[T],p[a].push(s[T]);let y=[];for(let T=0;T<n;T++)y.push(p[T][0]),y.push(p[T][p[T].length-1]);y=y.sort((T,b)=>T-b),o.push(y[0]);for(let T=1;T<y.length;T+=2){const b=y[T];!isNaN(b)&&o.indexOf(b)===-1&&o.push(b)}}return o}const LO=(t,e)=>{t=new V(t),e=new V(e);const n=t.luminance(),r=e.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)},Jb=.027,MO=5e-4,BO=.1,Zb=1.14,nd=.022,Qb=1.414,jO=(t,e)=>{t=new V(t),e=new V(e),t.alpha()<1&&(t=Ro(e,t,t.alpha(),"rgb"));const n=eD(...t.rgb()),r=eD(...e.rgb()),i=n>=nd?n:n+Math.pow(nd-n,Qb),s=r>=nd?r:r+Math.pow(nd-r,Qb),o=Math.pow(s,.56)-Math.pow(i,.57),a=Math.pow(s,.65)-Math.pow(i,.62),c=Math.abs(s-i)<MO?0:i<s?o*Zb:a*Zb;return(Math.abs(c)<BO?0:c>0?c-Jb:c+Jb)*100};function eD(t,e,n){return .2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(e/255,2.4)+.072175*Math.pow(n/255,2.4)}const{sqrt:Vr,pow:Dt,min:UO,max:qO,atan2:tD,abs:nD,cos:rd,sin:rD,exp:WO,PI:iD}=Math;function GO(t,e,n=1,r=1,i=1){var s=function(Nt){return 360*Nt/(2*iD)},o=function(Nt){return 2*iD*Nt/360};t=new V(t),e=new V(e);const[a,c,u]=Array.from(t.lab()),[l,d,f]=Array.from(e.lab()),h=(a+l)/2,p=Vr(Dt(c,2)+Dt(u,2)),y=Vr(Dt(d,2)+Dt(f,2)),T=(p+y)/2,b=.5*(1-Vr(Dt(T,7)/(Dt(T,7)+Dt(25,7)))),v=c*(1+b),D=d*(1+b),k=Vr(Dt(v,2)+Dt(u,2)),P=Vr(Dt(D,2)+Dt(f,2)),M=(k+P)/2,I=s(tD(u,v)),G=s(tD(f,D)),U=I>=0?I:I+360,W=G>=0?G:G+360,A=nD(U-W)>180?(U+W+360)/2:(U+W)/2,$=1-.17*rd(o(A-30))+.24*rd(o(2*A))+.32*rd(o(3*A+6))-.2*rd(o(4*A-63));let R=W-U;R=nD(R)<=180?R:W<=U?R+360:R-360,R=2*Vr(k*P)*rD(o(R)/2);const L=l-a,q=P-k,j=1+.015*Dt(h-50,2)/Vr(20+Dt(h-50,2)),z=1+.045*M,Ne=1+.015*M*$,J=30*WO(-Dt((A-275)/25,2)),B=-(2*Vr(Dt(M,7)/(Dt(M,7)+Dt(25,7))))*rD(2*o(J)),me=Vr(Dt(L/(n*j),2)+Dt(q/(r*z),2)+Dt(R/(i*Ne),2)+B*(q/(r*z))*(R/(i*Ne)));return qO(0,UO(100,me))}function zO(t,e,n="lab"){t=new V(t),e=new V(e);const r=t.get(n),i=e.get(n);let s=0;for(let o in r){const a=(r[o]||0)-(i[o]||0);s+=a*a}return Math.sqrt(s)}const HO=(...t)=>{try{return new V(...t),!0}catch{return!1}},KO={cool(){return td([De.hsl(180,1,.9),De.hsl(250,.7,.4)])},hot(){return td(["#000","#f00","#ff0","#fff"]).mode("rgb")}},Og={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},sD=Object.keys(Og),oD=new Map(sD.map(t=>[t.toLowerCase(),t])),VO=typeof Proxy=="function"?new Proxy(Og,{get(t,e){const n=e.toLowerCase();if(oD.has(n))return t[oD.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(sD)}}):Og,YO=(...t)=>{t=de(t,"cmyk");const[e,n,r,i]=t,s=t.length>4?t[4]:1;return i===1?[0,0,0,s]:[e>=1?0:255*(1-e)*(1-i),n>=1?0:255*(1-n)*(1-i),r>=1?0:255*(1-r)*(1-i),s]},{max:aD}=Math,XO=(...t)=>{let[e,n,r]=de(t,"rgb");e=e/255,n=n/255,r=r/255;const i=1-aD(e,aD(n,r)),s=i<1?1/(1-i):0,o=(1-e-i)*s,a=(1-n-i)*s,c=(1-r-i)*s;return[o,a,c,i]};V.prototype.cmyk=function(){return XO(this._rgb)};const JO=(...t)=>new V(...t,"cmyk");Object.assign(De,{cmyk:JO}),le.format.cmyk=YO,le.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"cmyk"),ve(t)==="array"&&t.length===4)return"cmyk"}});const ZO=(...t)=>{const e=de(t,"hsla");let n=Eo(t)||"lsa";return e[0]=xn(e[0]||0)+"deg",e[1]=xn(e[1]*100)+"%",e[2]=xn(e[2]*100)+"%",n==="hsla"||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),n="hsla"):e.length=3,`${n.substr(0,3)}(${e.join(" ")})`},QO=(...t)=>{const e=de(t,"lab");let n=Eo(t)||"lab";return e[0]=xn(e[0])+"%",e[1]=xn(e[1]),e[2]=xn(e[2]),n==="laba"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lab(${e.join(" ")})`},eF=(...t)=>{const e=de(t,"lch");let n=Eo(t)||"lab";return e[0]=xn(e[0])+"%",e[1]=xn(e[1]),e[2]=isNaN(e[2])?"none":xn(e[2])+"deg",n==="lcha"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lch(${e.join(" ")})`},tF=(...t)=>{const e=de(t,"lab");return e[0]=xn(e[0]*100)+"%",e[1]=wg(e[1]),e[2]=wg(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`},cD=(...t)=>{const[e,n,r,...i]=de(t,"rgb"),[s,o,a]=Ig(e,n,r),[c,u,l]=qb(s,o,a);return[c,u,l,...i.length>0&&i[0]<1?[i[0]]:[]]},nF=(...t)=>{const e=de(t,"lch");return e[0]=xn(e[0]*100)+"%",e[1]=wg(e[1]),e[2]=isNaN(e[2])?"none":xn(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklch(${e.join(" ")})`},{round:Fg}=Math,rF=(...t)=>{const e=de(t,"rgba");let n=Eo(t)||"rgb";if(n.substr(0,3)==="hsl")return ZO(Gb(e),n);if(n.substr(0,3)==="lab"){const r=Ua();Kr("d50");const i=QO(Tg(e),n);return Kr(r),i}if(n.substr(0,3)==="lch"){const r=Ua();Kr("d50");const i=eF(kg(e),n);return Kr(r),i}return n.substr(0,5)==="oklab"?tF(Ig(e)):n.substr(0,5)==="oklch"?nF(cD(e)):(e[0]=Fg(e[0]),e[1]=Fg(e[1]),e[2]=Fg(e[2]),(n==="rgba"||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),n="rgba"),`${n.substr(0,3)}(${e.slice(0,n==="rgb"?3:4).join(" ")})`)},uD=(...t)=>{t=de(t,"lch");const[e,n,r,...i]=t,[s,o,a]=Ub(e,n,r),[c,u,l]=Ag(s,o,a);return[c,u,l,...i.length>0&&i[0]<1?[i[0]]:[]]},Yr=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,Jn=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,id=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,Pn=/\s*/.source,Co=/\s+/.source,Lg=/\s*,\s*/.source,sd=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,_o=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,lD=new RegExp("^rgba?\\("+Pn+[Yr,Yr,Yr].join(Co)+_o+"\\)$"),dD=new RegExp("^rgb\\("+Pn+[Yr,Yr,Yr].join(Lg)+Pn+"\\)$"),fD=new RegExp("^rgba\\("+Pn+[Yr,Yr,Yr,Jn].join(Lg)+Pn+"\\)$"),hD=new RegExp("^hsla?\\("+Pn+[sd,id,id].join(Co)+_o+"\\)$"),pD=new RegExp("^hsl?\\("+Pn+[sd,id,id].join(Lg)+Pn+"\\)$"),gD=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,mD=new RegExp("^lab\\("+Pn+[Jn,Jn,Jn].join(Co)+_o+"\\)$"),yD=new RegExp("^lch\\("+Pn+[Jn,Jn,sd].join(Co)+_o+"\\)$"),vD=new RegExp("^oklab\\("+Pn+[Jn,Jn,Jn].join(Co)+_o+"\\)$"),wD=new RegExp("^oklch\\("+Pn+[Jn,Jn,sd].join(Co)+_o+"\\)$"),{round:bD}=Math,Ao=t=>t.map((e,n)=>n<=2?Ps(bD(e),0,255):e),Et=(t,e=0,n=100,r=!1)=>(typeof t=="string"&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,r?t=e+(t+1)*.5*(n-e):t=e+t*(n-e)),+t),Yt=(t,e)=>t==="none"?e:t,Mg=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e;if(le.format.named)try{return le.format.named(t)}catch{}if((e=t.match(lD))||(e=t.match(dD))){let n=e.slice(1,4);for(let i=0;i<3;i++)n[i]=+Et(Yt(n[i],0),0,255);n=Ao(n);const r=e[4]!==void 0?+Et(e[4],0,1):1;return n[3]=r,n}if(e=t.match(fD)){const n=e.slice(1,5);for(let r=0;r<4;r++)n[r]=+Et(n[r],0,255);return n}if((e=t.match(hD))||(e=t.match(pD))){const n=e.slice(1,4);n[0]=+Yt(n[0].replace("deg",""),0),n[1]=+Et(Yt(n[1],0),0,100)*.01,n[2]=+Et(Yt(n[2],0),0,100)*.01;const r=Ao(_g(n)),i=e[4]!==void 0?+Et(e[4],0,1):1;return r[3]=i,r}if(e=t.match(gD)){const n=e.slice(1,4);n[1]*=.01,n[2]*=.01;const r=_g(n);for(let i=0;i<3;i++)r[i]=bD(r[i]);return r[3]=+e[4],r}if(e=t.match(mD)){const n=e.slice(1,4);n[0]=Et(Yt(n[0],0),0,100),n[1]=Et(Yt(n[1],0),-125,125,!0),n[2]=Et(Yt(n[2],0),-125,125,!0);const r=Ua();Kr("d50");const i=Ao(Dg(n));Kr(r);const s=e[4]!==void 0?+Et(e[4],0,1):1;return i[3]=s,i}if(e=t.match(yD)){const n=e.slice(1,4);n[0]=Et(n[0],0,100),n[1]=Et(Yt(n[1],0),0,150,!1),n[2]=+Yt(n[2].replace("deg",""),0);const r=Ua();Kr("d50");const i=Ao($g(n));Kr(r);const s=e[4]!==void 0?+Et(e[4],0,1):1;return i[3]=s,i}if(e=t.match(vD)){const n=e.slice(1,4);n[0]=Et(Yt(n[0],0),0,1),n[1]=Et(Yt(n[1],0),-.4,.4,!0),n[2]=Et(Yt(n[2],0),-.4,.4,!0);const r=Ao(Ag(n)),i=e[4]!==void 0?+Et(e[4],0,1):1;return r[3]=i,r}if(e=t.match(wD)){const n=e.slice(1,4);n[0]=Et(Yt(n[0],0),0,1),n[1]=Et(Yt(n[1],0),0,.4,!1),n[2]=+Yt(n[2].replace("deg",""),0);const r=Ao(uD(n)),i=e[4]!==void 0?+Et(e[4],0,1):1;return r[3]=i,r}};Mg.test=t=>lD.test(t)||hD.test(t)||mD.test(t)||yD.test(t)||vD.test(t)||wD.test(t)||dD.test(t)||fD.test(t)||pD.test(t)||gD.test(t)||t==="transparent",V.prototype.css=function(t){return rF(this._rgb,t)};const iF=(...t)=>new V(...t,"css");De.css=iF,le.format.css=Mg,le.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&ve(t)==="string"&&Mg.test(t))return"css"}}),le.format.gl=(...t)=>{const e=de(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};const sF=(...t)=>new V(...t,"gl");De.gl=sF,V.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]},V.prototype.hex=function(t){return Mb(this._rgb,t)};const oF=(...t)=>new V(...t,"hex");De.hex=oF,le.format.hex=Lb,le.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&ve(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:od}=Math,DD=t=>{const e=t/100;let n,r,i;return e<66?(n=255,r=e<6?0:-155.25485562709179-.44596950469579133*(r=e-2)+104.49216199393888*od(r),i=e<20?0:-254.76935184120902+.8274096064007395*(i=e-10)+115.67994401066147*od(i)):(n=351.97690566805693+.114206453784165*(n=e-55)-40.25366309332127*od(n),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*od(r),i=255),[n,r,i,1]},{round:aF}=Math,cF=(...t)=>{const e=de(t,"rgb"),n=e[0],r=e[2];let i=1e3,s=4e4;const o=.4;let a;for(;s-i>o;){a=(s+i)*.5;const c=DD(a);c[2]/c[0]>=r/n?s=a:i=a}return aF(a)};V.prototype.temp=V.prototype.kelvin=V.prototype.temperature=function(){return cF(this._rgb)};const Bg=(...t)=>new V(...t,"temp");Object.assign(De,{temp:Bg,kelvin:Bg,temperature:Bg}),le.format.temp=le.format.kelvin=le.format.temperature=DD,V.prototype.oklch=function(){return cD(this._rgb)};const uF=(...t)=>new V(...t,"oklch");Object.assign(De,{oklch:uF}),le.format.oklch=uD,le.autodetect.push({p:2,test:(...t)=>{if(t=de(t,"oklch"),ve(t)==="array"&&t.length===3)return"oklch"}}),Object.assign(De,{analyze:Yb,average:lO,bezier:mO,blend:Xn,brewer:VO,Color:V,colors:To,contrast:LO,contrastAPCA:jO,cubehelix:_O,deltaE:GO,distance:zO,input:le,interpolate:Ro,limits:Xb,mix:Ro,random:PO,scale:td,scales:KO,valid:HO});const jg=[.96,.907,.805,.697,.605,.547,.518,.445,.395,.34],ED=[.32,.16,.08,.04,0,0,.04,.08,.16,.32];function lF(t){const e=t.get("hsl.l");return jg.reduce((n,r)=>Math.abs(r-e)<Math.abs(n-e)?r:n)}function dF(t){const e=De(t),n=lF(e),r=jg.findIndex(s=>s===n),i=jg.map(s=>e.set("hsl.l",s)).map(s=>De(s)).map((s,o)=>{const a=ED[o]-ED[r];return a>=0?s.saturate(a):s.desaturate(a*-1)});return{baseColorIndex:r,colors:i}}function fF(t){return dF(t).colors.map(e=>e.hex())}const TD={fill:"#3b82f6",stroke:"#2563eb",hiContrast:"#eff6ff",loContrast:"#bfdbfe"},RD={fill:"#0284c7",stroke:"#0369a1",hiContrast:"#f0f9ff",loContrast:"#B6ECF7"},SD={fill:"#64748b",stroke:"#475569",hiContrast:"#f8fafc",loContrast:"#cbd5e1"},$D={primary:TD,blue:TD,secondary:RD,sky:RD,muted:SD,slate:SD,gray:{fill:"#737373",stroke:"#525252",hiContrast:"#fafafa",loContrast:"#d4d4d4"},red:{fill:"#AC4D39",stroke:"#853A2D",hiContrast:"#FBD3CB",loContrast:"#f5b2a3"},green:{fill:"#428a4f",stroke:"#2d5d39",hiContrast:"#f8fafc",loContrast:"#c2f0c2"},amber:{fill:"#A35829",stroke:"#7E451D",hiContrast:"#FFE0C2",loContrast:"#f9b27c"},indigo:{fill:"#6366f1",stroke:"#4f46e5",hiContrast:"#eef2ff",loContrast:"#c7d2fe"}},hF={lineColor:"#6E6E6E",labelBgColor:"#18191b",labelColor:"#C6C6C6"},kD={lineColor:"#64748b",labelBgColor:"#0f172a",labelColor:"#cbd5e1"},CD={lineColor:"#3b82f6",labelBgColor:"#172554",labelColor:"#60a5fa"},_D={lineColor:"#0ea5e9",labelBgColor:"#082f49",labelColor:"#38bdf8"},AD={amber:{lineColor:"#b45309",labelBgColor:"#78350f",labelColor:"#FFE0C2"},blue:CD,gray:hF,green:{lineColor:"#15803d",labelBgColor:"#052e16",labelColor:"#22c55e"},indigo:{lineColor:"#6366f1",labelBgColor:"#1e1b4b",labelColor:"#818cf8"},muted:kD,primary:CD,red:{lineColor:"#AC4D39",labelBgColor:"#b91c1c",labelColor:"#f5b2a3"},secondary:_D,sky:_D,slate:kD},Nn={elements:$D,relationships:AD,font:"Arial",shadow:"#0a0a0a"};function pF(t){if(t.match(/^#([0-9a-f]{3}){1,2}$/i)){const e=fF(t);return{elements:{fill:e[6],stroke:e[7],hiContrast:e[0],loContrast:e[1]},relationships:{lineColor:e[4],labelColor:e[3],labelBgColor:e[9]}}}else return{elements:Nn.elements.primary,relationships:Nn.relationships.primary}}function Io(...t){return Vl(Object.values,t)}function Ug(...t){return Vl(gF,t)}var gF=(t,e)=>t.length>=e;function mF(t,e){let n=Math.ceil(t),r=Math.floor(e);if(r<n)throw new RangeError(`randomInteger: The range [${t.toString()},${e.toString()}] contains no integer`);return Math.floor(Math.random()*(r-n+1)+n)}function qa(t){return typeof t=="string"}function ID(t){return!!t}function Je(t){return qa(t)?t:t.id}let Wa=class Y0{constructor(e,n){this.view=e,this.model=n;for(const r of e.nodes){const i=new Y0.Element(r,this);this._elements.set(r.id,i),Ii(r.parent)&&this._rootElements.add(i)}this._connections=new Map(e.edges.map(r=>[r.id,new Y0.Connection(r,this)]))}_rootElements=new Set;_elements=new Map;_connections;get isDynamic(){return this.view.__==="dynamic"}get id(){return this.view.id}get title(){return this.view.title}get viewOf(){if(Ii(this.view.__)||this.view.__==="element"){const e=this.view;return e.viewOf?this.model.element(e.viewOf):null}return null}get tags(){return this.view.tags??[]}roots(){return[...this._rootElements]}elements(){return[...this._elements.values()]}element(e){return Xe(this._elements.get(e),`LikeC4DiagramModel.Element ${e} in view ${this.view.id} not found`)}hasElement(e){return this._elements.has(e)}connections(){return[...this._connections.values()]}connection(e){return Xe(this._connections.get(e),`Connection ${e} in view ${this.view.id} not found`)}findConnections(e,n,r="direct"){const i=Je(e),s=Je(n);return this.connections().filter(o=>o.source.id===i&&o.target.id===s||r==="both"&&o.source.id===s&&o.target.id===i)}parent(e){const n=this.element(Je(e));return n.node.parent?this.element(n.node.parent):null}children(e){return this.element(Je(e)).node.children.map(n=>this.element(n))}siblings(e){const n=Je(e),r=this.parent(n);return(r?this.children(r):this.roots()).filter(i=>i.id!==n)}ancestors(e){let n=Je(e);const r=[];let i;for(;i=this.parent(n);)r.push(i),n=i.id;return r}descendants(e){return this.children(e).flatMap(n=>[n,...this.descendants(n.id)])}incoming(e,n="all"){const r=this.element(Je(e)),i=r.node.inEdges.map(s=>this.connection(s));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.target.id===r.id:s.target.id!==r.id)}incomers(e,n="all"){return this.incoming(e,n).map(r=>r.source)}outgoing(e,n="all"){const r=this.element(Je(e)),i=r.node.outEdges.map(s=>this.connection(s));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.source.id===r.id:s.source.id!==r.id)}outgoers(e,n="all"){return this.outgoing(e,n).map(r=>r.target)}};(t=>{class e{constructor(i,s){this.node=i,this.view=s}get id(){return this.node.id}get title(){return this.node.title}get kind(){return this.node.kind}get isRoot(){return Ii(this.node.parent)}get hasNested(){return this.node.children.length>0}get shape(){return this.node.shape}get color(){return this.node.color}get tags(){return this.node.tags??[]}get level(){return this.node.level}get depth(){return this.node.depth??0}model(){return this.view.model.element(this.id)}parent(){return this.node.parent?this.view.element(this.node.parent):null}metadata(i,s){return this.model().metadata(i)??s}hasMetadata(i){return this.model().hasMetadata(i)}ancestors(){return this.view.ancestors(this)}siblings(){return this.view.siblings(this)}descendants(){return this.view.descendants(this)}children(){return this.view.children(this)}incoming(i="all"){return this.view.incoming(this,i)}incomers(i="all"){return this.view.incomers(this,i)}outgoing(i="all"){return this.view.outgoing(this,i)}outgoers(i="all"){return this.view.outgoers(this,i)}connectionsTo(i){return this.view.findConnections(this,i)}}t.Element=e;class n{constructor(i,s){this.edge=i,this.view=s}get id(){return this.edge.id}get source(){return this.view.element(this.edge.source)}get target(){return this.view.element(this.edge.target)}get tags(){return this.edge.tags??[]}get color(){return this.edge.color??xs}relationships(){return this.edge.relations.map(i=>Xe(this.view.model.relationship(i)))}}t.Connection=n})(Wa||(Wa={}));function yF(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xD={exports:{}},PD=function(t,e){var n,r,i=1,s=0,o=0,a=String.alphabet;function c(u,l,d){if(d){for(n=l;d=c(u,n),d<76&&d>65;)++n;return+u.slice(l-1,n)}return d=a&&a.indexOf(u.charAt(l)),d>-1?d+76:(d=u.charCodeAt(l)||0,d<45||d>127?d:d<46?65:d<48?d-1:d<58?d+18:d<65?d-11:d<91?d+11:d<97?d-37:d<123?d+5:d-63)}if((t+="")!=(e+="")){for(;i;)if(r=c(t,s++),i=c(e,o++),r<76&&i<76&&r>66&&i>66&&(r=c(t,s,s),i=c(e,o,s=n),o=n),r!=i)return r<i?-1:1}return 0};try{xD.exports=PD}catch{String.naturalCompare=PD}var vF=xD.exports;const wF=yF(vF);function ad(t,e){return t===e?0:qa(t)?qa(e)?wF(t,e):1:qa(e)?-1:0}function cd(t){return t!=null&&typeof t=="string"}function Ns(t){return!!t&&Array.isArray(t)&&t.length>0}function Ga(t){const e=t.lastIndexOf(".");return e>0?t.slice(e+1):t}function yr(...t){const e=cd(t[0])?t[0]:t[0].id;return(cd(t[1])?t[1]:t[1].id).startsWith(e+".")}function ud(t,e){const n=cd(t)?t:t.id,r=cd(e)?e:e.id;return n===r||r.startsWith(n+".")||n.startsWith(r+".")}function bF(t){const e=t.flatMap(n=>[r=>r.id===n.id,r=>yr(n,r)]);return n=>e.some(r=>r(n))}function Os(t,e){const n=Tt(t),r=Tt(e);if(n===r)return n;if(!n||!r)return null;const i=t.split("."),s=e.split(".");let o=null;for(;i.length>1&&s.length>1&&i[0]&&i[0]===s[0];)o=o?`${o}.${i[0]}`:i[0],i.shift(),s.shift();return o}function Tt(t){const e=t.lastIndexOf(".");return e>0?t.slice(0,e):null}function ND(t){const e=t+".";return n=>!!n.parent&&(n.parent===t||n.parent.startsWith(e))}function Zn(t){const e=t.split(".");return e.pop(),e.length===0?[]:e.reduce((n,r,i)=>i===0?(n.push(r),n):(n.unshift(`${n[0]}.${r}`),n),[])}function xo(t,e){const n=t.split(".").length,r=e.split(".").length;switch(!0){case n>r:return 1;case n<r:return-1;default:return 0}}function qg(t,e){return xo(t.id,e.id)}function DF(t){return t.map(e=>({item:e,fqn:e.id.split(".")})).sort((e,n)=>e.fqn.length-n.fqn.length).map(({item:e})=>e)}let ld=class X0{constructor(e,n){this.view=e,this.model=n;for(const r of e.nodes){const i=new X0.Element(r,this);this._elements.set(r.id,i),Ii(r.parent)&&this._rootElements.add(i)}this._connections=new Map(e.edges.map(r=>[r.id,new X0.Connection(r,this)]))}_rootElements=new Set;_elements=new Map;_connections;get id(){return this.view.id}get title(){return this.view.title}get viewOf(){return this.view.__!=="dynamic"&&this.view.viewOf?this.model.element(this.view.viewOf):null}get tags(){return this.view.tags??[]}roots(){return[...this._rootElements]}elements(){return[...this._elements.values()]}element(e){return Xe(this._elements.get(e),`LikeC4ViewModel.Element ${e} in view ${this.id} not found`)}hasElement(e){return this._elements.has(e)}connections(){return[...this._connections.values()]}connection(e){return Xe(this._connections.get(e),`Connection ${e} in view ${this.id} not found`)}findConnections(e,n,r="direct"){const i=Je(e),s=Je(n);return this.connections().filter(o=>o.source.id===i&&o.target.id===s||r==="both"&&o.source.id===s&&o.target.id===i)}parent(e){const n=this.element(Je(e));return n.node.parent?this.element(n.node.parent):null}children(e){return this.element(Je(e)).node.children.map(n=>this.element(n))}siblings(e){const n=Je(e),r=this.parent(n);return(r?this.children(r):this.roots()).filter(i=>i.id!==n)}ancestors(e){let n=Je(e);const r=[];let i;for(;i=this.parent(n);)r.push(i),n=i.id;return r}descendants(e){return this.children(e).flatMap(n=>[n,...this.descendants(n.id)])}incoming(e,n="all"){const r=this.element(Je(e)),i=r.node.inEdges.map(s=>Xe(this._connections.get(s),`Edge ${s} not found`));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.target.id===r.id:s.target.id!==r.id)}incomers(e,n="all"){return this.incoming(e,n).map(r=>r.source)}outgoing(e,n="all"){const r=this.element(Je(e)),i=r.node.outEdges.map(s=>Xe(this._connections.get(s),`Edge ${s} not found`));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.source.id===r.id:s.source.id!==r.id)}outgoers(e,n="all"){return this.outgoing(e,n).map(r=>r.target)}};(t=>{class e{constructor(i,s){this.node=i,this.viewmodel=s}get id(){return this.node.id}get title(){return this.node.title}get kind(){return this.node.kind}get isRoot(){return Ii(this.node.parent)}get hasNested(){return this.node.children.length>0}get shape(){return this.node.shape}get color(){return this.node.color}get tags(){return this.node.tags??[]}model(){return this.viewmodel.model.element(this.id)}parent(){return this.node.parent?this.viewmodel.element(this.node.parent):null}metadata(i,s){return this.model().metadata(i)??s}hasMetadata(i){return this.model().hasMetadata(i)}ancestors(){return this.viewmodel.ancestors(this)}siblings(){return this.viewmodel.siblings(this)}descendants(){return this.viewmodel.descendants(this)}children(){return this.viewmodel.children(this)}incoming(i="all"){return this.viewmodel.incoming(this,i)}incomers(i="all"){return this.viewmodel.incomers(this,i)}outgoing(i="all"){return this.viewmodel.outgoing(this,i)}outgoers(i="all"){return this.viewmodel.outgoers(this,i)}connectionsTo(i){return this.viewmodel.findConnections(this,i)}}t.Element=e;class n{constructor(i,s){this.edge=i,this.viewmodel=s}get id(){return this.edge.id}get source(){return this.viewmodel.element(this.edge.source)}get target(){return this.viewmodel.element(this.edge.target)}get tags(){return this.edge.tags??[]}relationships(){return this.edge.relations.map(i=>Xe(this.viewmodel.model.relationship(i)))}}t.Connection=n})(ld||(ld={}));let za=class yo{constructor(e,n,r,i){this.type=e,this.sourcemodel=n;for(const s of r)this.addElement(s);for(const s of i)this.addRelation(s)}_elements=new Map;_parents=new Map;_children=new Map;_rootElements=new Set;_relations=new Map;_incoming=new Map;_outgoing=new Map;_internal=new Map;_cacheAscendingSiblings=new Map;_views=new Map;static create(e){return e.__==="layouted"?yo.layouted(e):yo.computed(e)}static computed(e){const n=new yo("computed",e,Io(e.elements),Io(e.relations));for(const r of Io(e.views))n._views.set(r.id,new ld(r,n));return n}static layouted(e){const n=new yo("layouted",e,Io(e.elements),Io(e.relations));for(const r of Io(e.views))n._views.set(r.id,new Wa(r,n));return n}roots(){return[...this._rootElements]}elements(){return[...this._elements.values()]}element(e){return Xe(this._elements.get(e),`Element ${e} not found`)}relationships(){return[...this._relations.values()]}relationship(e){return Xe(this._relations.get(e),`Relation ${e} not found`)}views(){return[...this._views.values()]}view(e){return Xe(this._views.get(e),`View ${e} not found`)}parent(e){const n=Je(e);return this._parents.get(n)||null}children(e){const n=Je(e);return this._childrenOf(n)}siblings(e){const n=Je(e),r=this._parents.get(n);return(r?this._childrenOf(r.id):this.roots()).filter(i=>i.id!==n)}ancestors(e){let n=qa(e)?e:e.id;const r=[];let i;for(;i=this._parents.get(n);)r.push(i),n=i.id;return r}descendants(e){const n=Je(e);return this._childrenOf(n).flatMap(r=>[r,...this.descendants(r.id)])}incoming(e,n="all"){const r=Je(e),i=Array.from(this._incomingTo(r));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.target.id===r:s.target.id!==r)}incomers(e,n="all"){return this.incoming(e,n).map(r=>r.source)}outgoing(e,n="all"){const r=Je(e),i=Array.from(this._outgoingFrom(r));return n==="all"||i.length===0?i:i.filter(s=>n==="direct"?s.source.id===r:s.source.id!==r)}outgoers(e,n="all"){return this.outgoing(e,n).map(r=>r.target)}internal(e){const n=Je(e);return Array.from(this._internalOf(n))}ascendingSiblings(e){const n=Je(e);let r=this._cacheAscendingSiblings.get(n);return r||(r=[...this.siblings(n),...this.ancestors(n).flatMap(i=>this.siblings(i.id))],this._cacheAscendingSiblings.set(n,r)),r.slice()}viewsWithElement(e){const n=Je(e);return[...this._views.values()].filter(r=>r.hasElement(n))}addElement(e){if(this._elements.has(e.id))throw new Error(`Element ${e.id} already exists`);const n=new yo.ElementModel(e,this);this._elements.set(n.id,n);const r=Tt(n.id);r?(this._parents.set(n.id,this.element(r)),this._childrenOf(r).push(n)):this._rootElements.add(n)}addRelation(e){if(this._relations.has(e.id))throw new Error(`Relation ${e.id} already exists`);const n=new yo.Relationship(e,this);this._relations.set(n.id,n),this._incomingTo(e.target).add(n),this._outgoingFrom(e.source).add(n);const r=Os(e.source,e.target);if(r)for(const i of[r,...Zn(r)])this._internalOf(i).add(n);for(const i of Zn(e.source)){if(i===r)break;this._outgoingFrom(i).add(n)}for(const i of Zn(e.target)){if(i===r)break;this._incomingTo(i).add(n)}}_childrenOf(e){let n=this._children.get(e);return n||(n=[],this._children.set(e,n)),n}_incomingTo(e){let n=this._incoming.get(e);return n||(n=new Set,this._incoming.set(e,n)),n}_outgoingFrom(e){let n=this._outgoing.get(e);return n||(n=new Set,this._outgoing.set(e,n)),n}_internalOf(e){let n=this._internal.get(e);return n||(n=new Set,this._internal.set(e,n)),n}};(t=>{function e(s){return s instanceof t}t.isModel=e,(s=>{function o(a){return a instanceof Wa}s.isLayouted=o})(t.ViewModel||(t.ViewModel={}));function n(s){return s.type==="layouted"}t.isLayouted=n;class r{constructor(o,a){this.relationship=o,this.model=a}get id(){return this.relationship.id}get title(){return this.relationship.title}get kind(){return this.relationship.kind??null}get tags(){return this.relationship.tags??[]}get source(){return this.model.element(this.relationship.source)}get target(){return this.model.element(this.relationship.target)}metadata(o,a){return this.relationship.metadata?.[o]??a}hasMetadata(o){return ID(this.relationship.metadata?.[o])}}t.Relationship=r;class i{constructor(o,a){this.element=o,this.model=a}get id(){return this.element.id}get title(){return this.element.title}get kind(){return this.element.kind}get isRoot(){return Tt(this.element.id)===null}get hasNested(){return this.model.children(this).length>0}get shape(){return this.element.shape??pb}get color(){return this.element.color??Yl}get tags(){return this.element.tags??[]}parent(){return this.model.parent(this)}metadata(o,a){return this.element.metadata?.[o]??a}hasMetadata(o){return ID(this.element.metadata?.[o])}ancestors(){return this.model.ancestors(this)}siblings(){return this.model.siblings(this)}descendants(){return this.model.descendants(this)}children(){return this.model.children(this)}views(){return this.model.viewsWithElement(this)}incoming(o){return this.model.incoming(this,o)}incomers(o){return this.model.incomers(this,o)}outgoing(o){return this.model.outgoing(this,o)}outgoers(o){return this.model.outgoers(this,o)}internal(){return this.model.internal(this)}}t.ElementModel=i})(za||(za={}));const EF="LIKEC4_DELAY";function OD(...t){let e=100;return t.length===2?e=mF(t[0],t[1]):t.length===1&&(e=t[0]),new Promise(n=>{setTimeout(()=>{n(EF)},e??100)})}const Ha=(t,e)=>{const n=Os(t.source,t.target),r=Os(e.source,e.target);if(n&&!r)return 1;if(!n&&r)return-1;const i=n&&r?xo(n,r):0;if(i!==0)return i;const s=xo(t.source,e.source);return s!==0?s:xo(t.target,e.target)};function Wg(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function Gg(t,e,n=".",r){if(!Wg(e))return Gg(t,{},n,r);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const o=t[s];o!=null&&(r&&r(i,s,o,n)||(Array.isArray(o)&&Array.isArray(i[s])?i[s]=[...o,...i[s]]:Wg(o)&&Wg(i[s])?i[s]=Gg(o,i[s],(n?`${n}.`:"")+s.toString(),r):i[s]=o))}return i}function TF(t){return(...e)=>e.reduce((n,r)=>Gg(n,r,"",t),{})}const zg=TF();function lt(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function On(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function RF(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function dd(t){return typeof t=="object"&&t!==null&&lt(t.container)&&On(t.reference)&&typeof t.message=="string"}class FD{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return lt(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,n);return r[n]=s,s}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function Xr(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Fs(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function LD(t){return Xr(t)&&typeof t.fullText=="string"}class kt{constructor(e,n){this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new kt(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return Ut})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=SF(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new kt(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?Ut:{done:!1,value:e(i)}})}filter(e){return new kt(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return Ut})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new kt(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){const s=e(i);if(fd(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return Ut})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new kt(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const o=r.iterator.next();if(o.done)r.iterator=void 0;else return o}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(fd(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return Ut})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new kt(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new kt(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?Ut:this.nextFn(n.state)))}distinct(e){return new kt(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){const i=e?e(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return Ut})}exclude(e,n){const r=new Set;for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function SF(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function fd(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Po=new kt(()=>{},()=>Ut),Ut=Object.freeze({done:!0,value:void 0});function je(...t){if(t.length===1){const e=t[0];if(e instanceof kt)return e;if(fd(e))return new kt(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new kt(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:Ut)}return t.length>1?new kt(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){const n=t[e.collIndex++];fd(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return Ut}):Po}class No extends kt{constructor(e,n,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const o=i.iterators[i.iterators.length-1].next();if(o.done)i.iterators.pop();else return i.iterators.push(n(o.value)[Symbol.iterator]()),o}return Ut})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Hg;(function(t){function e(s){return s.reduce((o,a)=>o+a,0)}t.sum=e;function n(s){return s.reduce((o,a)=>o*a,0)}t.product=n;function r(s){return s.reduce((o,a)=>Math.min(o,a))}t.min=r;function i(s){return s.reduce((o,a)=>Math.max(o,a))}t.max=i})(Hg||(Hg={}));function Ka(t){return new No(t,e=>Xr(e)?e.content:[],{includeRoot:!0})}function MD(t){return Ka(t).filter(Fs)}function BD(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function hd(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Va(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var vr;(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"})(vr||(vr={}));function jD(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return vr.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return vr.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return n&&r?vr.Inside:n?vr.OverlapBack:r?vr.OverlapFront:vr.Outside}function Kg(t,e){return jD(t,e)>vr.After}const Vg=/^[\w\p{L}]$/u;function Ni(t,e,n=Vg){if(t){if(e>0){const r=e-t.offset,i=t.text.charAt(r);n.test(i)||e--}return Xg(t,e)}}function pd(t,e){if(t){const n=qD(t,!0);if(n&&Yg(n,e))return n;if(LD(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Yg(s,e))return s}}}}function Yg(t,e){return Fs(t)&&e.includes(t.tokenType.name)}function Xg(t,e){if(Fs(t))return t;if(Xr(t)){const n=UD(t,e,!1);if(n)return Xg(n,e)}}function gd(t,e){if(Fs(t))return t;if(Xr(t)){const n=UD(t,e,!0);if(n)return gd(n,e)}}function UD(t,e,n){let r=0,i=t.content.length-1,s;for(;r<=i;){const o=Math.floor((r+i)/2),a=t.content[o];if(a.offset<=e&&a.end>e)return a;a.end<=e?(s=n?a:void 0,r=o+1):i=o-1}return s}function qD(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}function WD(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);const i=n.content.length-1;for(;r<i;){r++;const s=n.content[r];if(e||!s.hidden)return s}t=n}}function $F(t){if(t.range.start.character===0)return t;const e=t.range.start.line;let n=t,r;for(;t.container;){const i=t.container,s=r??i.content.indexOf(t);if(s===0?(t=i,r=void 0):(r=s-1,t=i.content[r]),t.range.start.line!==e)break;n=t}return n}function GD(t,e){const n=kF(t,e);return n?n.parent.content.slice(n.a+1,n.b):[]}function kF(t,e){const n=zD(t),r=zD(e);let i;for(let s=0;s<n.length&&s<r.length;s++){const o=n[s],a=r[s];if(o.parent===a.parent)i={parent:o.parent,a:o.index,b:a.index};else break}return i}function zD(t){const e=[];for(;t.container;){const n=t.container,r=n.content.indexOf(t);e.push({parent:n,index:r}),t=n}return e.reverse()}const CF={__proto__:null,DefaultNameRegexp:Vg,get RangeComparison(){return vr},compareRange:jD,findCommentNode:pd,findDeclarationNodeAtOffset:Ni,findLeafNodeAtOffset:Xg,findLeafNodeBeforeOffset:gd,flattenCst:MD,getInteriorNodes:GD,getNextNode:WD,getPreviousNode:qD,getStartlineNode:$F,inRange:Kg,isChildNode:BD,isCommentNode:Yg,streamCst:Ka,toDocumentSegment:Va,tokenToRange:hd};class HD extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function md(t){throw new Error("Error! The input value was not handled.")}const yd="AbstractRule",vd="AbstractType",Jg="Condition",KD="TypeDefinition",Zg="ValueLiteral",Ya="AbstractElement";function Qg(t){return ke.isInstance(t,Ya)}const wd="ArrayLiteral",Xa="ArrayType";function _F(t){return ke.isInstance(t,Xa)}const Ja="BooleanLiteral";function AF(t){return ke.isInstance(t,Ja)}const Za="Conjunction";function IF(t){return ke.isInstance(t,Za)}const Qa="Disjunction";function xF(t){return ke.isInstance(t,Qa)}const bd="Grammar",em="GrammarImport",ec="InferredType";function VD(t){return ke.isInstance(t,ec)}const tc="Interface";function YD(t){return ke.isInstance(t,tc)}const tm="NamedArgument",nc="Negation";function PF(t){return ke.isInstance(t,nc)}const Dd="NumberLiteral",Ed="Parameter",rc="ParameterReference";function NF(t){return ke.isInstance(t,rc)}const ic="ParserRule";function qt(t){return ke.isInstance(t,ic)}const sc="ReferenceType";function OF(t){return ke.isInstance(t,sc)}const Td="ReturnType";function FF(t){return ke.isInstance(t,Td)}const oc="SimpleType";function XD(t){return ke.isInstance(t,oc)}const Rd="StringLiteral",Oo="TerminalRule";function Jr(t){return ke.isInstance(t,Oo)}const ac="Type";function nm(t){return ke.isInstance(t,ac)}const rm="TypeAttribute",cc="UnionType";function LF(t){return ke.isInstance(t,cc)}const uc="Action";function Ls(t){return ke.isInstance(t,uc)}const lc="Alternatives";function im(t){return ke.isInstance(t,lc)}const dc="Assignment";function wr(t){return ke.isInstance(t,dc)}const fc="CharacterRange";function MF(t){return ke.isInstance(t,fc)}const hc="CrossReference";function pc(t){return ke.isInstance(t,hc)}const gc="EndOfFile";function BF(t){return ke.isInstance(t,gc)}const mc="Group";function Oi(t){return ke.isInstance(t,mc)}const yc="Keyword";function br(t){return ke.isInstance(t,yc)}const vc="NegatedToken";function jF(t){return ke.isInstance(t,vc)}const wc="RegexToken";function UF(t){return ke.isInstance(t,wc)}const bc="RuleCall";function Zr(t){return ke.isInstance(t,bc)}const Dc="TerminalAlternatives";function qF(t){return ke.isInstance(t,Dc)}const Ec="TerminalGroup";function WF(t){return ke.isInstance(t,Ec)}const Tc="TerminalRuleCall";function JD(t){return ke.isInstance(t,Tc)}const Rc="UnorderedGroup";function sm(t){return ke.isInstance(t,Rc)}const Sc="UntilToken";function GF(t){return ke.isInstance(t,Sc)}const $c="Wildcard";function zF(t){return ke.isInstance(t,$c)}class ZD extends FD{getAllTypes(){return[Ya,yd,vd,uc,lc,wd,Xa,dc,Ja,fc,Jg,Za,hc,Qa,gc,bd,em,mc,ec,tc,yc,tm,vc,nc,Dd,Ed,rc,ic,sc,wc,Td,bc,oc,Rd,Dc,Ec,Oo,Tc,ac,rm,KD,cc,Rc,Sc,Zg,$c]}computeIsSubtype(e,n){switch(e){case uc:case lc:case dc:case fc:case hc:case gc:case mc:case yc:case vc:case wc:case bc:case Dc:case Ec:case Tc:case Rc:case Sc:case $c:return this.isSubtype(Ya,n);case wd:case Dd:case Rd:return this.isSubtype(Zg,n);case Xa:case sc:case oc:case cc:return this.isSubtype(KD,n);case Ja:return this.isSubtype(Jg,n)||this.isSubtype(Zg,n);case Za:case Qa:case nc:case rc:return this.isSubtype(Jg,n);case ec:case tc:case ac:return this.isSubtype(vd,n);case ic:return this.isSubtype(yd,n)||this.isSubtype(vd,n);case Oo:return this.isSubtype(yd,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return vd;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return yd;case"Grammar:usedGrammars":return bd;case"NamedArgument:parameter":case"ParameterReference:parameter":return Ed;case"TerminalRuleCall:rule":return Oo;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Ya:return{name:Ya,properties:[{name:"cardinality"},{name:"lookahead"}]};case wd:return{name:wd,properties:[{name:"elements",defaultValue:[]}]};case Xa:return{name:Xa,properties:[{name:"elementType"}]};case Ja:return{name:Ja,properties:[{name:"true",defaultValue:!1}]};case Za:return{name:Za,properties:[{name:"left"},{name:"right"}]};case Qa:return{name:Qa,properties:[{name:"left"},{name:"right"}]};case bd:return{name:bd,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 em:return{name:em,properties:[{name:"path"}]};case ec:return{name:ec,properties:[{name:"name"}]};case tc:return{name:tc,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case tm:return{name:tm,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case nc:return{name:nc,properties:[{name:"value"}]};case Dd:return{name:Dd,properties:[{name:"value"}]};case Ed:return{name:Ed,properties:[{name:"name"}]};case rc:return{name:rc,properties:[{name:"parameter"}]};case ic:return{name:ic,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 sc:return{name:sc,properties:[{name:"referenceType"}]};case Td:return{name:Td,properties:[{name:"name"}]};case oc:return{name:oc,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case Rd:return{name:Rd,properties:[{name:"value"}]};case Oo:return{name:Oo,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case ac:return{name:ac,properties:[{name:"name"},{name:"type"}]};case rm:return{name:rm,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case cc:return{name:cc,properties:[{name:"types",defaultValue:[]}]};case uc:return{name:uc,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case lc:return{name:lc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case dc:return{name:dc,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case fc:return{name:fc,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case hc:return{name:hc,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case gc:return{name:gc,properties:[{name:"cardinality"},{name:"lookahead"}]};case mc:return{name:mc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case yc:return{name:yc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case vc:return{name:vc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case wc:return{name:wc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case bc:return{name:bc,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Dc:return{name:Dc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Ec:return{name:Ec,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Tc:return{name:Tc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Rc:return{name:Rc,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Sc:return{name:Sc,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case $c:return{name:$c,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const ke=new ZD;function om(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{lt(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):lt(n)&&(n.$container=t,n.$containerProperty=e))}function un(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function am(t,e){let n=t;for(;n;){if(e(n))return!0;n=n.$container}return!1}function Xt(t){const n=Sd(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Sd(t){for(;t.$container;)t=t.$container;return t}function kc(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new kt(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(lt(s)){if(r.keyIndex++,cm(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const o=r.arrayIndex++,a=s[o];if(lt(a)&&cm(a,n))return{done:!1,value:a}}r.arrayIndex=0}}r.keyIndex++}return Ut})}function Dr(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new No(t,n=>kc(n,e))}function Qr(t,e){if(t){if(e?.range&&!cm(t,e.range))return new No(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new No(t,n=>kc(n,e),{includeRoot:!0})}function cm(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?Kg(r,e):!1}function $d(t){return new kt(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const n=e.keys[e.keyIndex];if(!n.startsWith("$")){const r=t[n];if(On(r))return e.keyIndex++,{done:!1,value:{reference:r,container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(On(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Ut})}function HF(t,e=Xt(t).parseResult.value){const n=[];return Qr(e).forEach(r=>{$d(r).forEach(i=>{i.reference.ref===t&&n.push(i.reference)})}),je(n)}function um(t,e){const n=t.getTypeMetaData(e.$type),r=e;for(const i of n.properties)i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=QD(i.defaultValue))}function QD(t){return Array.isArray(t)?[...t.map(QD)]:t}function lm(t,e){const n={$type:t.$type};for(const[r,i]of Object.entries(t))if(!r.startsWith("$"))if(lt(i))n[r]=lm(i,e);else if(On(i))n[r]=e(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){const s=[];for(const o of i)lt(o)?s.push(lm(o,e)):On(o)?s.push(e(n,r,o.$refNode,o.$refText)):s.push(o);n[r]=s}else n[r]=i;return om(n),n}const kd={__proto__:null,assignMandatoryProperties:um,copyAstNode:lm,findLocalReferences:HF,findRootNode:Sd,getContainerOfType:un,getDocument:Xt,hasContainerOfType:am,linkContentToContainer:om,streamAllContents:Dr,streamAst:Qr,streamContents:kc,streamReferences:$d};function ae(t){return t.charCodeAt(0)}function dm(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function Cc(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function Fo(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function KF(){throw Error("Internal Error - Should never get here!")}function eE(t){return t.type==="Character"}const Cd=[];for(let t=ae("0");t<=ae("9");t++)Cd.push(t);const _d=[ae("_")].concat(Cd);for(let t=ae("a");t<=ae("z");t++)_d.push(t);for(let t=ae("A");t<=ae("Z");t++)_d.push(t);const tE=[ae(" "),ae("\f"),ae(`
2
- `),ae("\r"),ae(" "),ae("\v"),ae(" "),ae("\xA0"),ae("\u1680"),ae("\u2000"),ae("\u2001"),ae("\u2002"),ae("\u2003"),ae("\u2004"),ae("\u2005"),ae("\u2006"),ae("\u2007"),ae("\u2008"),ae("\u2009"),ae("\u200A"),ae("\u2028"),ae("\u2029"),ae("\u202F"),ae("\u205F"),ae("\u3000"),ae("\uFEFF")],VF=/[0-9a-fA-F]/,Ad=/[0-9]/,YF=/[1-9]/;class nE{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Cc(r,"global");break;case"i":Cc(r,"ignoreCase");break;case"m":Cc(r,"multiLine");break;case"u":Cc(r,"unicode");break;case"y":Cc(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break}Fo(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return KF()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;Fo(n);break}if(!(e===!0&&n===void 0)&&Fo(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Fo(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[ae(`
3
- `),ae("\r"),ae("\u2028"),ae("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,n=!1;switch(this.popChar()){case"d":e=Cd;break;case"D":e=Cd,n=!0;break;case"s":e=tE;break;case"S":e=tE,n=!0;break;case"w":e=_d;break;case"W":e=_d,n=!0;break}if(Fo(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=ae("\f");break;case"n":e=ae(`
4
- `);break;case"r":e=ae("\r");break;case"t":e=ae(" ");break;case"v":e=ae("\v");break}if(Fo(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:ae("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:ae(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
- `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:ae(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,eE(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,eE(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else dm(r.value,e),e.push(ae("-")),dm(i.value,e)}else dm(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
6
- `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:ae("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(YF.test(e)===!1)throw Error("Expecting a positive integer");for(;Ad.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Ad.test(e)===!1)throw Error("Expecting an integer");for(;Ad.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
7
- `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:ae(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Ad.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
8
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
9
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let n="";for(let i=0;i<e;i++){const s=this.popChar();if(VF.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class Id{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const rE=/\r?\n/gm,XF=new nE;class JF extends Id{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n===`
10
- `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=xd(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!!`
11
- `.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const fm=new JF;function ZF(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),fm.reset(t),fm.visit(XF.pattern(t)),fm.multiline}catch{return!1}}const QF=`\f
12
- \r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function hm(t){const e=typeof t=="string"?new RegExp(t):t;return QF.some(n=>e.test(n))}function xd(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eL(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:xd(e)).join("")}function tL(t,e){const n=nL(t),r=e.match(n);return!!r&&r[0].length>0}function nL(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",o;function a(u){s+=n.substr(r,u),r+=u}function c(u){s+="(?:"+n.substr(r,u)+"|$)",r+=u}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?n[r+2]==="{"?c(n.indexOf("}",r)-r+1):c(6):c(2);break;case"p":case"P":e.unicode?c(n.indexOf("}",r)-r+1):c(2);break;case"k":c(n.indexOf(">",r)-r+1);break;default:c(2);break}break;case"[":o=/\[(?:\\.|.)*?\]/g,o.lastIndex=r,o=o.exec(n)||[],c(o[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":a(1);break;case"{":o=/\{\d+,?\d*\}/g,o.lastIndex=r,o=o.exec(n),o?a(o[0].length):c(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":o=r,r+=3,i(),s+=n.substr(o,r-o);break;case"<":switch(n[r+3]){case"=":case"!":o=r,r+=4,i(),s+=n.substr(o,r-o);break;default:a(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else a(1),s+=i()+"|$)";break;case")":return++r,s;default:c(1);break}return s}return new RegExp(i(),t.flags)}function Pd(t){return t.rules.find(e=>qt(e)&&e.entry)}function iE(t){return t.rules.filter(e=>Jr(e)&&e.hidden)}function pm(t,e){const n=new Set,r=Pd(t);if(!r)return new Set(t.rules);const i=[r].concat(iE(t));for(const o of i)sE(o,n,e);const s=new Set;for(const o of t.rules)(n.has(o.name)||Jr(o)&&o.hidden)&&s.add(o);return s}function sE(t,e,n){e.add(t.name),Dr(t).forEach(r=>{if(Zr(r)||n&&JD(r)){const i=r.rule.ref;i&&!e.has(i.name)&&sE(i,e,n)}})}function gm(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=wm(t.type.ref);return e?.terminal}}function oE(t){return t.hidden&&!hm(Ic(t))}function Lo(t,e){return!t||!e?[]:mm(t,e,t.astNode,!0)}function En(t,e,n){if(!t||!e)return;const r=mm(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function mm(t,e,n,r){if(!r){const i=un(t.grammarSource,wr);if(i&&i.feature===e)return[t]}return Xr(t)&&t.astNode===n?t.content.flatMap(i=>mm(i,e,n,!1)):[]}function ym(t,e){return t?vm(t,e,t?.astNode):[]}function _c(t,e,n){if(!t)return;const r=vm(t,e,t?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function vm(t,e,n){if(t.astNode!==n)return[];if(br(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=Ka(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const o=i.value;o.astNode===n?br(o.grammarSource)&&o.grammarSource.value===e&&s.push(o):r.prune()}while(!i.done);return s}function aE(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=un(t.grammarSource,wr);if(r)return r;t=t.container}}function wm(t){let e=t;return VD(e)&&(Ls(e.$container)?e=e.$container.$container:qt(e.$container)?e=e.$container:md(e.$container)),cE(t,e,new Map)}function cE(t,e,n){var r;function i(s,o){let a;return un(s,wr)||(a=cE(o,o,n)),n.set(t,a),a}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of Dr(e)){if(wr(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Zr(s)&&qt(s.rule.ref))return i(s,s.rule.ref);if(XD(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function uE(t){const e=t.$container;if(Oi(e)){const n=e.elements,r=n.indexOf(t);for(let i=r-1;i>=0;i--){const s=n[i];if(Ls(s))return s;{const o=Dr(n[i]).find(Ls);if(o)return o}}}if(Qg(e))return uE(e)}function Mo(t,e){return t==="?"||t==="*"||Oi(e)&&!!e.guardCondition}function lE(t){return t==="*"||t==="+"}function rL(t){return t==="+="}function Nd(t){return dE(t,new Set)}function dE(t,e){if(e.has(t))return!0;e.add(t);for(const n of Dr(t))if(Zr(n)){if(!n.rule.ref||qt(n.rule.ref)&&!dE(n.rule.ref,e))return!1}else{if(wr(n))return!1;if(Ls(n))return!1}return!!t.definition}function iL(t){return bm(t.type,new Set)}function bm(t,e){if(e.has(t))return!0;if(e.add(t),_F(t))return!1;if(OF(t))return!1;if(LF(t))return t.types.every(n=>bm(n,e));if(XD(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){const n=t.typeRef.ref;return nm(n)?bm(n.type,e):!1}else return!1}else return!1}function Ms(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e){if(qt(e))return e.name;if(YD(e)||nm(e))return e.name}}}function Ac(t){var e;if(qt(t))return Nd(t)?t.name:(e=Ms(t))!==null&&e!==void 0?e:t.name;if(YD(t)||nm(t)||FF(t))return t.name;if(Ls(t)){const n=fE(t);if(n)return n}else if(VD(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function fE(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return Ac(t.type.ref)}function sL(t){var e,n,r;return Jr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":Nd(t)?t.name:(r=Ms(t))!==null&&r!==void 0?r:t.name}function hE(t){var e,n,r;return Jr(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":(r=Ms(t))!==null&&r!==void 0?r:t.name}function Ic(t){const e={s:!1,i:!1,u:!1},n=Bo(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const Dm=/[\s\S]/.source;function Bo(t,e){if(qF(t))return oL(t);if(WF(t))return aL(t);if(MF(t))return lL(t);if(JD(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return ei(Bo(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(jF(t))return uL(t);if(GF(t))return cL(t);if(UF(t)){const n=t.regex.lastIndexOf("/"),r=t.regex.substring(1,n),i=t.regex.substring(n+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),ei(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(zF(t))return ei(Dm,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function oL(t){return ei(t.elements.map(e=>Bo(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function aL(t){return ei(t.elements.map(e=>Bo(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function cL(t){return ei(`${Dm}*?${Bo(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function uL(t){return ei(`(?!${Bo(t.terminal)})${Dm}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function lL(t){return t.right?ei(`[${Em(t.left)}-${Em(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):ei(Em(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function Em(t){return xd(t.value)}function ei(t,e){var n;return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}const Od={__proto__:null,findAssignment:aE,findNameAssignment:wm,findNodeForKeyword:_c,findNodeForProperty:En,findNodesForKeyword:ym,findNodesForKeywordInternal:vm,findNodesForProperty:Lo,getActionAtElement:uE,getActionType:fE,getAllReachableRules:pm,getCrossReferenceTerminal:gm,getEntryRule:Pd,getExplicitRuleType:Ms,getHiddenRules:iE,getRuleType:hE,getRuleTypeName:sL,getTypeName:Ac,isArrayCardinality:lE,isArrayOperator:rL,isCommentTerminal:oE,isDataType:iL,isDataTypeRule:Nd,isOptionalCardinality:Mo,terminalRegex:Ic};function dL(t){const e=[],n=t.Grammar;for(const r of n.rules)Jr(r)&&oE(r)&&ZF(Ic(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:Vg}}var pE=typeof global=="object"&&global&&global.Object===Object&&global,fL=typeof self=="object"&&self&&self.Object===Object&&self,Er=pE||fL||Function("return this")(),Fn=Er.Symbol,gE=Object.prototype,hL=gE.hasOwnProperty,pL=gE.toString,xc=Fn?Fn.toStringTag:void 0;function gL(t){var e=hL.call(t,xc),n=t[xc];try{t[xc]=void 0;var r=!0}catch{}var i=pL.call(t);return r&&(e?t[xc]=n:delete t[xc]),i}var mL=Object.prototype,yL=mL.toString;function vL(t){return yL.call(t)}var wL="[object Null]",bL="[object Undefined]",mE=Fn?Fn.toStringTag:void 0;function Fi(t){return t==null?t===void 0?bL:wL:mE&&mE in Object(t)?gL(t):vL(t)}function Qn(t){return t!=null&&typeof t=="object"}var DL="[object Symbol]";function Pc(t){return typeof t=="symbol"||Qn(t)&&Fi(t)==DL}function Fd(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var Ce=Array.isArray,EL=1/0,yE=Fn?Fn.prototype:void 0,vE=yE?yE.toString:void 0;function wE(t){if(typeof t=="string")return t;if(Ce(t))return Fd(t,wE)+"";if(Pc(t))return vE?vE.call(t):"";var e=t+"";return e=="0"&&1/t==-EL?"-0":e}var TL=/\s/;function RL(t){for(var e=t.length;e--&&TL.test(t.charAt(e)););return e}var SL=/^\s+/;function $L(t){return t&&t.slice(0,RL(t)+1).replace(SL,"")}function Ln(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var bE=NaN,kL=/^[-+]0x[0-9a-f]+$/i,CL=/^0b[01]+$/i,_L=/^0o[0-7]+$/i,AL=parseInt;function IL(t){if(typeof t=="number")return t;if(Pc(t))return bE;if(Ln(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ln(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=$L(t);var n=CL.test(t);return n||_L.test(t)?AL(t.slice(2),n?2:8):kL.test(t)?bE:+t}var DE=1/0,xL=17976931348623157e292;function PL(t){if(!t)return t===0?t:0;if(t=IL(t),t===DE||t===-DE){var e=t<0?-1:1;return e*xL}return t===t?t:0}function Ld(t){var e=PL(t),n=e%1;return e===e?n?e-n:e:0}function Bs(t){return t}var NL="[object AsyncFunction]",OL="[object Function]",FL="[object GeneratorFunction]",LL="[object Proxy]";function ti(t){if(!Ln(t))return!1;var e=Fi(t);return e==OL||e==FL||e==NL||e==LL}var Tm=Er["__core-js_shared__"],EE=function(){var t=/[^.]+$/.exec(Tm&&Tm.keys&&Tm.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function ML(t){return!!EE&&EE in t}var BL=Function.prototype,jL=BL.toString;function js(t){if(t!=null){try{return jL.call(t)}catch{}try{return t+""}catch{}}return""}var UL=/[\\^$.*+?()[\]{}|]/g,qL=/^\[object .+?Constructor\]$/,WL=Function.prototype,GL=Object.prototype,zL=WL.toString,HL=GL.hasOwnProperty,KL=RegExp("^"+zL.call(HL).replace(UL,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function VL(t){if(!Ln(t)||ML(t))return!1;var e=ti(t)?KL:qL;return e.test(js(t))}function YL(t,e){return t?.[e]}function Us(t,e){var n=YL(t,e);return VL(n)?n:void 0}var Rm=Us(Er,"WeakMap"),TE=Object.create,XL=function(){function t(){}return function(e){if(!Ln(e))return{};if(TE)return TE(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function JL(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function _t(){}function ZL(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var QL=800,eM=16,tM=Date.now;function nM(t){var e=0,n=0;return function(){var r=tM(),i=eM-(r-n);if(n=r,i>0){if(++e>=QL)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function rM(t){return function(){return t}}var Md=function(){try{var t=Us(Object,"defineProperty");return t({},"",{}),t}catch{}}(),iM=Md?function(t,e){return Md(t,"toString",{configurable:!0,enumerable:!1,value:rM(e),writable:!0})}:Bs,sM=nM(iM);function RE(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function SE(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function oM(t){return t!==t}function aM(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function Sm(t,e,n){return e===e?aM(t,e,n):SE(t,oM,n)}function $E(t,e){var n=t==null?0:t.length;return!!n&&Sm(t,e,0)>-1}var cM=9007199254740991,uM=/^(?:0|[1-9]\d*)$/;function Bd(t,e){var n=typeof t;return e=e??cM,!!e&&(n=="number"||n!="symbol"&&uM.test(t))&&t>-1&&t%1==0&&t<e}function $m(t,e,n){e=="__proto__"&&Md?Md(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Nc(t,e){return t===e||t!==t&&e!==e}var lM=Object.prototype,dM=lM.hasOwnProperty;function jd(t,e,n){var r=t[e];(!(dM.call(t,e)&&Nc(r,n))||n===void 0&&!(e in t))&&$m(t,e,n)}function km(t,e,n,r){var i=!n;n||(n={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=void 0;c===void 0&&(c=t[a]),i?$m(n,a,c):jd(n,a,c)}return n}var kE=Math.max;function fM(t,e,n){return e=kE(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=kE(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(o),JL(t,this,a)}}function Cm(t,e){return sM(fM(t,e,Bs),t+"")}var hM=9007199254740991;function _m(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=hM}function Tr(t){return t!=null&&_m(t.length)&&!ti(t)}function CE(t,e,n){if(!Ln(n))return!1;var r=typeof e;return(r=="number"?Tr(n)&&Bd(e,n.length):r=="string"&&e in n)?Nc(n[e],t):!1}function pM(t){return Cm(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,o&&CE(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var a=n[r];a&&t(e,a,r,s)}return e})}var gM=Object.prototype;function Oc(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||gM;return t===n}function mM(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var yM="[object Arguments]";function _E(t){return Qn(t)&&Fi(t)==yM}var AE=Object.prototype,vM=AE.hasOwnProperty,wM=AE.propertyIsEnumerable,Ud=_E(function(){return arguments}())?_E:function(t){return Qn(t)&&vM.call(t,"callee")&&!wM.call(t,"callee")},mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ni(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}function bM(){return!1}var IE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xE=IE&&typeof module=="object"&&module&&!module.nodeType&&module,DM=xE&&xE.exports===IE,PE=DM?Er.Buffer:void 0,EM=PE?PE.isBuffer:void 0,Fc=EM||bM,TM="[object Arguments]",RM="[object Array]",SM="[object Boolean]",$M="[object Date]",kM="[object Error]",CM="[object Function]",_M="[object Map]",AM="[object Number]",IM="[object Object]",xM="[object RegExp]",PM="[object Set]",NM="[object String]",OM="[object WeakMap]",FM="[object ArrayBuffer]",LM="[object DataView]",MM="[object Float32Array]",BM="[object Float64Array]",jM="[object Int8Array]",UM="[object Int16Array]",qM="[object Int32Array]",WM="[object Uint8Array]",GM="[object Uint8ClampedArray]",zM="[object Uint16Array]",HM="[object Uint32Array]",Ze={};Ze[MM]=Ze[BM]=Ze[jM]=Ze[UM]=Ze[qM]=Ze[WM]=Ze[GM]=Ze[zM]=Ze[HM]=!0,Ze[TM]=Ze[RM]=Ze[FM]=Ze[SM]=Ze[LM]=Ze[$M]=Ze[kM]=Ze[CM]=Ze[_M]=Ze[AM]=Ze[IM]=Ze[xM]=Ze[PM]=Ze[NM]=Ze[OM]=!1;function KM(t){return Qn(t)&&_m(t.length)&&!!Ze[Fi(t)]}function qd(t){return function(e){return t(e)}}var NE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Lc=NE&&typeof module=="object"&&module&&!module.nodeType&&module,VM=Lc&&Lc.exports===NE,Am=VM&&pE.process,Li=function(){try{var t=Lc&&Lc.require&&Lc.require("util").types;return t||Am&&Am.binding&&Am.binding("util")}catch{}}(),OE=Li&&Li.isTypedArray,Im=OE?qd(OE):KM,YM=Object.prototype,XM=YM.hasOwnProperty;function FE(t,e){var n=Ce(t),r=!n&&Ud(t),i=!n&&!r&&Fc(t),s=!n&&!r&&!i&&Im(t),o=n||r||i||s,a=o?mM(t.length,String):[],c=a.length;for(var u in t)(e||XM.call(t,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Bd(u,c)))&&a.push(u);return a}function LE(t,e){return function(n){return t(e(n))}}var JM=LE(Object.keys,Object),ZM=Object.prototype,QM=ZM.hasOwnProperty;function ME(t){if(!Oc(t))return JM(t);var e=[];for(var n in Object(t))QM.call(t,n)&&n!="constructor"&&e.push(n);return e}function Mn(t){return Tr(t)?FE(t):ME(t)}var e3=Object.prototype,t3=e3.hasOwnProperty,Tn=pM(function(t,e){if(Oc(e)||Tr(e)){km(e,Mn(e),t);return}for(var n in e)t3.call(e,n)&&jd(t,n,e[n])});function n3(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var r3=Object.prototype,i3=r3.hasOwnProperty;function s3(t){if(!Ln(t))return n3(t);var e=Oc(t),n=[];for(var r in t)r=="constructor"&&(e||!i3.call(t,r))||n.push(r);return n}function BE(t){return Tr(t)?FE(t,!0):s3(t)}var o3=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a3=/^\w*$/;function xm(t,e){if(Ce(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Pc(t)?!0:a3.test(t)||!o3.test(t)||e!=null&&t in Object(e)}var Mc=Us(Object,"create");function c3(){this.__data__=Mc?Mc(null):{},this.size=0}function u3(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var l3="__lodash_hash_undefined__",d3=Object.prototype,f3=d3.hasOwnProperty;function h3(t){var e=this.__data__;if(Mc){var n=e[t];return n===l3?void 0:n}return f3.call(e,t)?e[t]:void 0}var p3=Object.prototype,g3=p3.hasOwnProperty;function m3(t){var e=this.__data__;return Mc?e[t]!==void 0:g3.call(e,t)}var y3="__lodash_hash_undefined__";function v3(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Mc&&e===void 0?y3:e,this}function qs(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}qs.prototype.clear=c3,qs.prototype.delete=u3,qs.prototype.get=h3,qs.prototype.has=m3,qs.prototype.set=v3;function w3(){this.__data__=[],this.size=0}function Wd(t,e){for(var n=t.length;n--;)if(Nc(t[n][0],e))return n;return-1}var b3=Array.prototype,D3=b3.splice;function E3(t){var e=this.__data__,n=Wd(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():D3.call(e,n,1),--this.size,!0}function T3(t){var e=this.__data__,n=Wd(e,t);return n<0?void 0:e[n][1]}function R3(t){return Wd(this.__data__,t)>-1}function S3(t,e){var n=this.__data__,r=Wd(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function ri(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ri.prototype.clear=w3,ri.prototype.delete=E3,ri.prototype.get=T3,ri.prototype.has=R3,ri.prototype.set=S3;var Bc=Us(Er,"Map");function $3(){this.size=0,this.__data__={hash:new qs,map:new(Bc||ri),string:new qs}}function k3(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Gd(t,e){var n=t.__data__;return k3(e)?n[typeof e=="string"?"string":"hash"]:n.map}function C3(t){var e=Gd(this,t).delete(t);return this.size-=e?1:0,e}function _3(t){return Gd(this,t).get(t)}function A3(t){return Gd(this,t).has(t)}function I3(t,e){var n=Gd(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function ii(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ii.prototype.clear=$3,ii.prototype.delete=C3,ii.prototype.get=_3,ii.prototype.has=A3,ii.prototype.set=I3;var x3="Expected a function";function Pm(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(x3);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=t.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(Pm.Cache||ii),n}Pm.Cache=ii;var P3=500;function N3(t){var e=Pm(t,function(r){return n.size===P3&&n.clear(),r}),n=e.cache;return e}var O3=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,F3=/\\(\\)?/g,L3=N3(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(O3,function(n,r,i,s){e.push(i?s.replace(F3,"$1"):r||n)}),e});function M3(t){return t==null?"":wE(t)}function zd(t,e){return Ce(t)?t:xm(t,e)?[t]:L3(M3(t))}var B3=1/0;function jc(t){if(typeof t=="string"||Pc(t))return t;var e=t+"";return e=="0"&&1/t==-B3?"-0":e}function Nm(t,e){e=zd(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[jc(e[n++])];return n&&n==r?t:void 0}function j3(t,e,n){var r=t==null?void 0:Nm(t,e);return r===void 0?n:r}function Om(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var jE=Fn?Fn.isConcatSpreadable:void 0;function U3(t){return Ce(t)||Ud(t)||!!(jE&&t&&t[jE])}function Fm(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=U3),i||(i=[]);++s<o;){var a=t[s];n(a)?Om(i,a):r||(i[i.length]=a)}return i}function Bn(t){var e=t==null?0:t.length;return e?Fm(t):[]}var UE=LE(Object.getPrototypeOf,Object);function qE(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function q3(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function W3(){this.__data__=new ri,this.size=0}function G3(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function z3(t){return this.__data__.get(t)}function H3(t){return this.__data__.has(t)}var K3=200;function V3(t,e){var n=this.__data__;if(n instanceof ri){var r=n.__data__;if(!Bc||r.length<K3-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ii(r)}return n.set(t,e),this.size=n.size,this}function Rr(t){var e=this.__data__=new ri(t);this.size=e.size}Rr.prototype.clear=W3,Rr.prototype.delete=G3,Rr.prototype.get=z3,Rr.prototype.has=H3,Rr.prototype.set=V3;function Y3(t,e){return t&&km(e,Mn(e),t)}var WE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,GE=WE&&typeof module=="object"&&module&&!module.nodeType&&module,X3=GE&&GE.exports===WE,zE=X3?Er.Buffer:void 0,HE=zE?zE.allocUnsafe:void 0;function J3(t,e){var n=t.length,r=HE?HE(n):new t.constructor(n);return t.copy(r),r}function Lm(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}function KE(){return[]}var Z3=Object.prototype,Q3=Z3.propertyIsEnumerable,VE=Object.getOwnPropertySymbols,Mm=VE?function(t){return t==null?[]:(t=Object(t),Lm(VE(t),function(e){return Q3.call(t,e)}))}:KE;function e8(t,e){return km(t,Mm(t),e)}var t8=Object.getOwnPropertySymbols,n8=t8?function(t){for(var e=[];t;)Om(e,Mm(t)),t=UE(t);return e}:KE;function YE(t,e,n){var r=e(t);return Ce(t)?r:Om(r,n(t))}function Bm(t){return YE(t,Mn,Mm)}function r8(t){return YE(t,BE,n8)}var jm=Us(Er,"DataView"),Um=Us(Er,"Promise"),jo=Us(Er,"Set"),XE="[object Map]",i8="[object Object]",JE="[object Promise]",ZE="[object Set]",QE="[object WeakMap]",eT="[object DataView]",s8=js(jm),o8=js(Bc),a8=js(Um),c8=js(jo),u8=js(Rm),jn=Fi;(jm&&jn(new jm(new ArrayBuffer(1)))!=eT||Bc&&jn(new Bc)!=XE||Um&&jn(Um.resolve())!=JE||jo&&jn(new jo)!=ZE||Rm&&jn(new Rm)!=QE)&&(jn=function(t){var e=Fi(t),n=e==i8?t.constructor:void 0,r=n?js(n):"";if(r)switch(r){case s8:return eT;case o8:return XE;case a8:return JE;case c8:return ZE;case u8:return QE}return e});var l8=Object.prototype,d8=l8.hasOwnProperty;function f8(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&d8.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Hd=Er.Uint8Array;function h8(t){var e=new t.constructor(t.byteLength);return new Hd(e).set(new Hd(t)),e}function p8(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var g8=/\w*$/;function m8(t){var e=new t.constructor(t.source,g8.exec(t));return e.lastIndex=t.lastIndex,e}var tT=Fn?Fn.prototype:void 0,nT=tT?tT.valueOf:void 0;function y8(t){return nT?Object(nT.call(t)):{}}function v8(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var w8="[object Boolean]",b8="[object Date]",D8="[object Map]",E8="[object Number]",T8="[object RegExp]",R8="[object Set]",S8="[object String]",$8="[object Symbol]",k8="[object ArrayBuffer]",C8="[object DataView]",_8="[object Float32Array]",A8="[object Float64Array]",I8="[object Int8Array]",x8="[object Int16Array]",P8="[object Int32Array]",N8="[object Uint8Array]",O8="[object Uint8ClampedArray]",F8="[object Uint16Array]",L8="[object Uint32Array]";function M8(t,e,n){var r=t.constructor;switch(e){case k8:return h8(t);case w8:case b8:return new r(+t);case C8:return p8(t);case _8:case A8:case I8:case x8:case P8:case N8:case O8:case F8:case L8:return v8(t);case D8:return new r;case E8:case S8:return new r(t);case T8:return m8(t);case R8:return new r;case $8:return y8(t)}}function B8(t){return typeof t.constructor=="function"&&!Oc(t)?XL(UE(t)):{}}var j8="[object Map]";function U8(t){return Qn(t)&&jn(t)==j8}var rT=Li&&Li.isMap,q8=rT?qd(rT):U8,W8="[object Set]";function G8(t){return Qn(t)&&jn(t)==W8}var iT=Li&&Li.isSet,z8=iT?qd(iT):G8,sT="[object Arguments]",H8="[object Array]",K8="[object Boolean]",V8="[object Date]",Y8="[object Error]",oT="[object Function]",X8="[object GeneratorFunction]",J8="[object Map]",Z8="[object Number]",aT="[object Object]",Q8="[object RegExp]",e4="[object Set]",t4="[object String]",n4="[object Symbol]",r4="[object WeakMap]",i4="[object ArrayBuffer]",s4="[object DataView]",o4="[object Float32Array]",a4="[object Float64Array]",c4="[object Int8Array]",u4="[object Int16Array]",l4="[object Int32Array]",d4="[object Uint8Array]",f4="[object Uint8ClampedArray]",h4="[object Uint16Array]",p4="[object Uint32Array]",Ke={};Ke[sT]=Ke[H8]=Ke[i4]=Ke[s4]=Ke[K8]=Ke[V8]=Ke[o4]=Ke[a4]=Ke[c4]=Ke[u4]=Ke[l4]=Ke[J8]=Ke[Z8]=Ke[aT]=Ke[Q8]=Ke[e4]=Ke[t4]=Ke[n4]=Ke[d4]=Ke[f4]=Ke[h4]=Ke[p4]=!0,Ke[Y8]=Ke[oT]=Ke[r4]=!1;function Kd(t,e,n,r,i,s){var o;if(o!==void 0)return o;if(!Ln(t))return t;var a=Ce(t);if(a)return o=f8(t),ZL(t,o);var c=jn(t),u=c==oT||c==X8;if(Fc(t))return J3(t);if(c==aT||c==sT||u&&!i)return o=u?{}:B8(t),e8(t,Y3(o,t));if(!Ke[c])return i?t:{};o=M8(t,c),s||(s=new Rr);var l=s.get(t);if(l)return l;s.set(t,o),z8(t)?t.forEach(function(h){o.add(Kd(h,e,n,h,t,s))}):q8(t)&&t.forEach(function(h,p){o.set(p,Kd(h,e,n,p,t,s))});var d=Bm,f=a?void 0:d(t);return RE(f||t,function(h,p){f&&(p=h,h=t[p]),jd(o,p,Kd(h,e,n,p,t,s))}),o}var g4=4;function Ft(t){return Kd(t,g4)}function Uc(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}var m4="__lodash_hash_undefined__";function y4(t){return this.__data__.set(t,m4),this}function v4(t){return this.__data__.has(t)}function Uo(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new ii;++e<n;)this.add(t[e])}Uo.prototype.add=Uo.prototype.push=y4,Uo.prototype.has=v4;function cT(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function qm(t,e){return t.has(e)}var w4=1,b4=2;function uT(t,e,n,r,i,s){var o=n&w4,a=t.length,c=e.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(t),l=s.get(e);if(u&&l)return u==e&&l==t;var d=-1,f=!0,h=n&b4?new Uo:void 0;for(s.set(t,e),s.set(e,t);++d<a;){var p=t[d],y=e[d];if(r)var T=o?r(y,p,d,e,t,s):r(p,y,d,t,e,s);if(T!==void 0){if(T)continue;f=!1;break}if(h){if(!cT(e,function(b,v){if(!qm(h,v)&&(p===b||i(p,b,n,r,s)))return h.push(v)})){f=!1;break}}else if(!(p===y||i(p,y,n,r,s))){f=!1;break}}return s.delete(t),s.delete(e),f}function D4(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Wm(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var E4=1,T4=2,R4="[object Boolean]",S4="[object Date]",$4="[object Error]",k4="[object Map]",C4="[object Number]",_4="[object RegExp]",A4="[object Set]",I4="[object String]",x4="[object Symbol]",P4="[object ArrayBuffer]",N4="[object DataView]",lT=Fn?Fn.prototype:void 0,Gm=lT?lT.valueOf:void 0;function O4(t,e,n,r,i,s,o){switch(n){case N4:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case P4:return!(t.byteLength!=e.byteLength||!s(new Hd(t),new Hd(e)));case R4:case S4:case C4:return Nc(+t,+e);case $4:return t.name==e.name&&t.message==e.message;case _4:case I4:return t==e+"";case k4:var a=D4;case A4:var c=r&E4;if(a||(a=Wm),t.size!=e.size&&!c)return!1;var u=o.get(t);if(u)return u==e;r|=T4,o.set(t,e);var l=uT(a(t),a(e),r,i,s,o);return o.delete(t),l;case x4:if(Gm)return Gm.call(t)==Gm.call(e)}return!1}var F4=1,L4=Object.prototype,M4=L4.hasOwnProperty;function B4(t,e,n,r,i,s){var o=n&F4,a=Bm(t),c=a.length,u=Bm(e),l=u.length;if(c!=l&&!o)return!1;for(var d=c;d--;){var f=a[d];if(!(o?f in e:M4.call(e,f)))return!1}var h=s.get(t),p=s.get(e);if(h&&p)return h==e&&p==t;var y=!0;s.set(t,e),s.set(e,t);for(var T=o;++d<c;){f=a[d];var b=t[f],v=e[f];if(r)var D=o?r(v,b,f,e,t,s):r(b,v,f,t,e,s);if(!(D===void 0?b===v||i(b,v,n,r,s):D)){y=!1;break}T||(T=f=="constructor")}if(y&&!T){var k=t.constructor,P=e.constructor;k!=P&&"constructor"in t&&"constructor"in e&&!(typeof k=="function"&&k instanceof k&&typeof P=="function"&&P instanceof P)&&(y=!1)}return s.delete(t),s.delete(e),y}var j4=1,dT="[object Arguments]",fT="[object Array]",Vd="[object Object]",U4=Object.prototype,hT=U4.hasOwnProperty;function q4(t,e,n,r,i,s){var o=Ce(t),a=Ce(e),c=o?fT:jn(t),u=a?fT:jn(e);c=c==dT?Vd:c,u=u==dT?Vd:u;var l=c==Vd,d=u==Vd,f=c==u;if(f&&Fc(t)){if(!Fc(e))return!1;o=!0,l=!1}if(f&&!l)return s||(s=new Rr),o||Im(t)?uT(t,e,n,r,i,s):O4(t,e,c,n,r,i,s);if(!(n&j4)){var h=l&&hT.call(t,"__wrapped__"),p=d&&hT.call(e,"__wrapped__");if(h||p){var y=h?t.value():t,T=p?e.value():e;return s||(s=new Rr),i(y,T,n,r,s)}}return f?(s||(s=new Rr),B4(t,e,n,r,i,s)):!1}function zm(t,e,n,r,i){return t===e?!0:t==null||e==null||!Qn(t)&&!Qn(e)?t!==t&&e!==e:q4(t,e,n,r,zm,i)}var W4=1,G4=2;function z4(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var o=n[i];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++i<s;){o=n[i];var a=o[0],c=t[a],u=o[1];if(o[2]){if(c===void 0&&!(a in t))return!1}else{var l=new Rr,d;if(!(d===void 0?zm(u,c,W4|G4,r,l):d))return!1}}return!0}function pT(t){return t===t&&!Ln(t)}function H4(t){for(var e=Mn(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,pT(i)]}return e}function gT(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function K4(t){var e=H4(t);return e.length==1&&e[0][2]?gT(e[0][0],e[0][1]):function(n){return n===t||z4(n,t,e)}}function V4(t,e){return t!=null&&e in Object(t)}function mT(t,e,n){e=zd(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=jc(e[r]);if(!(s=t!=null&&n(t,o)))break;t=t[o]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&_m(i)&&Bd(o,i)&&(Ce(t)||Ud(t)))}function Y4(t,e){return t!=null&&mT(t,e,V4)}var X4=1,J4=2;function Z4(t,e){return xm(t)&&pT(e)?gT(jc(t),e):function(n){var r=j3(n,t);return r===void 0&&r===e?Y4(n,t):zm(e,r,X4|J4)}}function Q4(t){return function(e){return e?.[t]}}function e6(t){return function(e){return Nm(e,t)}}function t6(t){return xm(t)?Q4(jc(t)):e6(t)}function er(t){return typeof t=="function"?t:t==null?Bs:typeof t=="object"?Ce(t)?Z4(t[0],t[1]):K4(t):t6(t)}function n6(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var o=t[i];e(r,o,n(o),t)}return r}function r6(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var c=o[++i];if(n(s[c],c,s)===!1)break}return e}}var i6=r6();function s6(t,e){return t&&i6(t,e,Mn)}function o6(t,e){return function(n,r){if(n==null)return n;if(!Tr(n))return t(n,r);for(var i=n.length,s=-1,o=Object(n);++s<i&&r(o[s],s,o)!==!1;);return n}}var Ws=o6(s6);function a6(t,e,n,r){return Ws(t,function(i,s,o){e(r,i,n(i),o)}),r}function c6(t,e){return function(n,r){var i=Ce(n)?n6:a6,s=e?e():{};return i(n,t,er(r),s)}}var yT=Object.prototype,u6=yT.hasOwnProperty,Hm=Cm(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&CE(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],o=BE(s),a=-1,c=o.length;++a<c;){var u=o[a],l=t[u];(l===void 0||Nc(l,yT[u])&&!u6.call(t,u))&&(t[u]=s[u])}return t});function vT(t){return Qn(t)&&Tr(t)}var l6=200;function d6(t,e,n,r){var i=-1,s=$E,o=!0,a=t.length,c=[],u=e.length;if(!a)return c;e.length>=l6&&(s=qm,o=!1,e=new Uo(e));e:for(;++i<a;){var l=t[i],d=l;if(l=l!==0?l:0,o&&d===d){for(var f=u;f--;)if(e[f]===d)continue e;c.push(l)}else s(e,d,r)||c.push(l)}return c}var Yd=Cm(function(t,e){return vT(t)?d6(t,Fm(e,1,vT,!0)):[]});function qo(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function Lt(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:Ld(e),qE(t,e<0?0:e,r)):[]}function qc(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:Ld(e),e=r-e,qE(t,0,e<0?0:e)):[]}function f6(t){return typeof t=="function"?t:Bs}function se(t,e){var n=Ce(t)?RE:Ws;return n(t,f6(e))}function h6(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function p6(t,e){var n=!0;return Ws(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function tr(t,e,n){var r=Ce(t)?h6:p6;return r(t,er(e))}function wT(t,e){var n=[];return Ws(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function Rn(t,e){var n=Ce(t)?Lm:wT;return n(t,er(e))}function g6(t){return function(e,n,r){var i=Object(e);if(!Tr(e)){var s=er(n);e=Mn(e),n=function(a){return s(i[a],a,i)}}var o=t(e,n,r);return o>-1?i[s?e[o]:o]:void 0}}var m6=Math.max;function y6(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:Ld(n);return i<0&&(i=m6(r+i,0)),SE(t,er(e),i)}var Wo=g6(y6);function nr(t){return t&&t.length?t[0]:void 0}function v6(t,e){var n=-1,r=Tr(t)?Array(t.length):[];return Ws(t,function(i,s,o){r[++n]=e(i,s,o)}),r}function Q(t,e){var n=Ce(t)?Fd:v6;return n(t,er(e))}function Sn(t,e){return Fm(Q(t,e))}var w6=Object.prototype,b6=w6.hasOwnProperty,D6=c6(function(t,e,n){b6.call(t,n)?t[n].push(e):$m(t,n,[e])}),E6=Object.prototype,T6=E6.hasOwnProperty;function R6(t,e){return t!=null&&T6.call(t,e)}function oe(t,e){return t!=null&&mT(t,e,R6)}var S6="[object String]";function ln(t){return typeof t=="string"||!Ce(t)&&Qn(t)&&Fi(t)==S6}function $6(t,e){return Fd(e,function(n){return t[n]})}function At(t){return t==null?[]:$6(t,Mn(t))}var k6=Math.max;function Jt(t,e,n,r){t=Tr(t)?t:At(t),n=n&&!r?Ld(n):0;var i=t.length;return n<0&&(n=k6(i+n,0)),ln(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Sm(t,e,n)>-1}function bT(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return Sm(t,e,i)}var C6="[object Map]",_6="[object Set]",A6=Object.prototype,I6=A6.hasOwnProperty;function Ge(t){if(t==null)return!0;if(Tr(t)&&(Ce(t)||typeof t=="string"||typeof t.splice=="function"||Fc(t)||Im(t)||Ud(t)))return!t.length;var e=jn(t);if(e==C6||e==_6)return!t.size;if(Oc(t))return!ME(t).length;for(var n in t)if(I6.call(t,n))return!1;return!0}var x6="[object RegExp]";function P6(t){return Qn(t)&&Fi(t)==x6}var DT=Li&&Li.isRegExp,si=DT?qd(DT):P6;function oi(t){return t===void 0}function N6(t,e){return t<e}function O6(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],o=e(s);if(o!=null&&(a===void 0?o===o&&!Pc(o):n(o,a)))var a=o,c=s}return c}function F6(t){return t&&t.length?O6(t,Bs,N6):void 0}var L6="Expected a function";function M6(t){if(typeof t!="function")throw new TypeError(L6);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function B6(t,e,n,r){if(!Ln(t))return t;e=zd(e,t);for(var i=-1,s=e.length,o=s-1,a=t;a!=null&&++i<s;){var c=jc(e[i]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=o){var l=a[c];u=void 0,u===void 0&&(u=Ln(l)?l:Bd(e[i+1])?[]:{})}jd(a,c,u),a=a[c]}return t}function j6(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=Nm(t,o);n(a,o)&&B6(s,zd(o,t),a)}return s}function rr(t,e){if(t==null)return{};var n=Fd(r8(t),function(r){return[r]});return e=er(e),j6(t,n,function(r,i){return e(r,i[0])})}function U6(t,e,n,r,i){return i(t,function(s,o,a){n=r?(r=!1,s):e(n,s,o,a)}),n}function Zt(t,e,n){var r=Ce(t)?q3:U6,i=arguments.length<3;return r(t,er(e),n,i,Ws)}function Xd(t,e){var n=Ce(t)?Lm:wT;return n(t,M6(er(e)))}function q6(t,e){var n;return Ws(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function ET(t,e,n){var r=Ce(t)?cT:q6;return r(t,er(e))}var W6=1/0,G6=jo&&1/Wm(new jo([,-0]))[1]==W6?function(t){return new jo(t)}:_t,z6=200;function TT(t,e,n){var r=-1,i=$E,s=t.length,o=!0,a=[],c=a;if(s>=z6){var u=e?null:G6(t);if(u)return Wm(u);o=!1,i=qm,c=new Uo}else c=e?[]:a;e:for(;++r<s;){var l=t[r],d=e?e(l):l;if(l=l!==0?l:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;e&&c.push(d),a.push(l)}else i(c,d,n)||(c!==a&&c.push(d),a.push(l))}return a}function Km(t){return t&&t.length?TT(t):[]}function H6(t,e){return t&&t.length?TT(t,er(e)):[]}function Vm(t){console&&console.error&&console.error(`Error: ${t}`)}function RT(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function ST(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function $T(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function K6(t){return V6(t)?t.LABEL:t.name}function V6(t){return ln(t.LABEL)&&t.LABEL!==""}class Sr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),se(this.definition,n=>{n.accept(e)})}}class Qt extends Sr{constructor(e){super([]),this.idx=1,Tn(this,rr(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Go extends Sr{constructor(e){super(e.definition),this.orgText="",Tn(this,rr(e,n=>n!==void 0))}}class dn extends Sr{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Tn(this,rr(e,n=>n!==void 0))}}class Mt extends Sr{constructor(e){super(e.definition),this.idx=1,Tn(this,rr(e,n=>n!==void 0))}}class $n extends Sr{constructor(e){super(e.definition),this.idx=1,Tn(this,rr(e,n=>n!==void 0))}}class kn extends Sr{constructor(e){super(e.definition),this.idx=1,Tn(this,rr(e,n=>n!==void 0))}}class dt extends Sr{constructor(e){super(e.definition),this.idx=1,Tn(this,rr(e,n=>n!==void 0))}}class fn extends Sr{constructor(e){super(e.definition),this.idx=1,Tn(this,rr(e,n=>n!==void 0))}}class hn extends Sr{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Tn(this,rr(e,n=>n!==void 0))}}class Qe{constructor(e){this.idx=1,Tn(this,rr(e,n=>n!==void 0))}accept(e){e.visit(this)}}function Y6(t){return Q(t,Jd)}function Jd(t){function e(n){return Q(n,Jd)}if(t instanceof Qt){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ln(t.label)&&(n.label=t.label),n}else{if(t instanceof dn)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Mt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof $n)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof kn)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Jd(new Qe({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof fn)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Jd(new Qe({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof dt)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof hn)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof Qe){const n={type:"Terminal",name:t.terminalType.name,label:K6(t.terminalType),idx:t.idx};ln(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=si(r)?r.source:r),n}else{if(t instanceof Go)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class zo{visit(e){const n=e;switch(n.constructor){case Qt:return this.visitNonTerminal(n);case dn:return this.visitAlternative(n);case Mt:return this.visitOption(n);case $n:return this.visitRepetitionMandatory(n);case kn:return this.visitRepetitionMandatoryWithSeparator(n);case fn:return this.visitRepetitionWithSeparator(n);case dt:return this.visitRepetition(n);case hn:return this.visitAlternation(n);case Qe:return this.visitTerminal(n);case Go:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function X6(t){return t instanceof dn||t instanceof Mt||t instanceof dt||t instanceof $n||t instanceof kn||t instanceof fn||t instanceof Qe||t instanceof Go}function Zd(t,e=[]){return t instanceof Mt||t instanceof dt||t instanceof fn?!0:t instanceof hn?ET(t.definition,r=>Zd(r,e)):t instanceof Qt&&Jt(e,t)?!1:t instanceof Sr?(t instanceof Qt&&e.push(t),tr(t.definition,r=>Zd(r,e))):!1}function J6(t){return t instanceof hn}function $r(t){if(t instanceof Qt)return"SUBRULE";if(t instanceof Mt)return"OPTION";if(t instanceof hn)return"OR";if(t instanceof $n)return"AT_LEAST_ONE";if(t instanceof kn)return"AT_LEAST_ONE_SEP";if(t instanceof fn)return"MANY_SEP";if(t instanceof dt)return"MANY";if(t instanceof Qe)return"CONSUME";throw Error("non exhaustive match")}class Qd{walk(e,n=[]){se(e.definition,(r,i)=>{const s=Lt(e.definition,i+1);if(r instanceof Qt)this.walkProdRef(r,s,n);else if(r instanceof Qe)this.walkTerminal(r,s,n);else if(r instanceof dn)this.walkFlat(r,s,n);else if(r instanceof Mt)this.walkOption(r,s,n);else if(r instanceof $n)this.walkAtLeastOne(r,s,n);else if(r instanceof kn)this.walkAtLeastOneSep(r,s,n);else if(r instanceof fn)this.walkManySep(r,s,n);else if(r instanceof dt)this.walkMany(r,s,n);else if(r instanceof hn)this.walkOr(r,s,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new Mt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=kT(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new Mt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=kT(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);se(e.definition,s=>{const o=new dn({definition:[s]});this.walk(o,i)})}}function kT(t,e,n){return[new Mt({definition:[new Qe({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function Wc(t){if(t instanceof Qt)return Wc(t.referencedRule);if(t instanceof Qe)return eB(t);if(X6(t))return Z6(t);if(J6(t))return Q6(t);throw Error("non exhaustive match")}function Z6(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,o=!0;for(;i&&o;)s=n[r],o=Zd(s),e=e.concat(Wc(s)),r=r+1,i=n.length>r;return Km(e)}function Q6(t){const e=Q(t.definition,n=>Wc(n));return Km(Bn(e))}function eB(t){return[t.terminalType]}const CT="_~IN~_";class tB extends Qd{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=rB(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),o=new dn({definition:s}),a=Wc(o);this.follows[i]=a}}function nB(t){const e={};return se(t,n=>{const r=new tB(n).startWalking();Tn(e,r)}),e}function rB(t,e){return t.name+e+CT}let ef={};const iB=new nE;function tf(t){const e=t.toString();if(ef.hasOwnProperty(e))return ef[e];{const n=iB.pattern(e);return ef[e]=n,n}}function sB(){ef={}}const _T="Complement Sets are not supported for first char optimization",nf=`Unable to use "first char" lexer optimizations:
13
- `;function oB(t,e=!1){try{const n=tf(t);return Ym(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===_T)e&&RT(`${nf} Unable to optimize: < ${t.toString()} >
14
- Complement Sets cannot be automatically optimized.
15
- This will disable the lexer's first char optimizations.
16
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
17
- This will disable the lexer's first char optimizations.
18
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Vm(`${nf}
19
- Failed parsing: < ${t.toString()} >
20
- Using the @chevrotain/regexp-to-ast library
21
- Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Ym(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Ym(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const o=s;switch(o.type){case"Character":rf(o.value,e,n);break;case"Set":if(o.complement===!0)throw Error(_T);se(o.value,c=>{if(typeof c=="number")rf(c,e,n);else{const u=c;if(n===!0)for(let l=u.from;l<=u.to;l++)rf(l,e,n);else{for(let l=u.from;l<=u.to&&l<zc;l++)rf(l,e,n);if(u.to>=zc){const l=u.from>=zc?u.from:zc,d=u.to,f=Mi(l),h=Mi(d);for(let p=f;p<=h;p++)e[p]=p}}}});break;case"Group":Ym(o.value,e,n);break;default:throw Error("Non Exhaustive Match")}const a=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&Xm(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return At(e)}function rf(t,e,n){const r=Mi(t);e[r]=r,n===!0&&aB(t,e)}function aB(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=Mi(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=Mi(i.charCodeAt(0));e[s]=s}}}function AT(t,e){return Wo(t.value,n=>{if(typeof n=="number")return Jt(e,n);{const r=n;return Wo(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Xm(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?Ce(t.value)?tr(t.value,Xm):Xm(t.value):!1}class cB extends Id{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Jt(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?AT(e,this.targetCharCodes)===void 0&&(this.found=!0):AT(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Jm(t,e){if(e instanceof RegExp){const n=tf(e),r=new cB(t);return r.visit(n),r.found}else return Wo(e,n=>Jt(t,n.charCodeAt(0)))!==void 0}const Gs="PATTERN",Gc="defaultMode",sf="modes";let IT=typeof new RegExp("(?:)").sticky=="boolean";function uB(t,e){e=Hm(e,{useSticky:IT,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
22
- `],tracer:(v,D)=>D()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{xB()});let r;n("Reject Lexer.NA",()=>{r=Xd(t,v=>v[Gs]===pn.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=Q(r,v=>{const D=v[Gs];if(si(D)){const k=D.source;return k.length===1&&k!=="^"&&k!=="$"&&k!=="."&&!D.ignoreCase?k:k.length===2&&k[0]==="\\"&&!Jt(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],k[1])?k[1]:e.useSticky?PT(D):xT(D)}else{if(ti(D))return i=!0,{exec:D};if(typeof D=="object")return i=!0,D;if(typeof D=="string"){if(D.length===1)return D;{const k=D.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),P=new RegExp(k);return e.useSticky?PT(P):xT(P)}}else throw Error("non exhaustive match")}})});let o,a,c,u,l;n("misc mapping",()=>{o=Q(r,v=>v.tokenTypeIdx),a=Q(r,v=>{const D=v.GROUP;if(D!==pn.SKIPPED){if(ln(D))return D;if(oi(D))return!1;throw Error("non exhaustive match")}}),c=Q(r,v=>{const D=v.LONGER_ALT;if(D)return Ce(D)?Q(D,P=>bT(r,P)):[bT(r,D)]}),u=Q(r,v=>v.PUSH_MODE),l=Q(r,v=>oe(v,"POP_MODE"))});let d;n("Line Terminator Handling",()=>{const v=FT(e.lineTerminatorCharacters);d=Q(r,D=>!1),e.positionTracking!=="onlyOffset"&&(d=Q(r,D=>oe(D,"LINE_BREAKS")?!!D.LINE_BREAKS:OT(D,v)===!1&&Jm(v,D.PATTERN)))});let f,h,p,y;n("Misc Mapping #2",()=>{f=Q(r,NT),h=Q(s,_B),p=Zt(r,(v,D)=>{const k=D.GROUP;return ln(k)&&k!==pn.SKIPPED&&(v[k]=[]),v},{}),y=Q(s,(v,D)=>({pattern:s[D],longerAlt:c[D],canLineTerminator:d[D],isCustom:f[D],short:h[D],group:a[D],push:u[D],pop:l[D],tokenTypeIdx:o[D],tokenType:r[D]}))});let T=!0,b=[];return e.safeMode||n("First Char Optimization",()=>{b=Zt(r,(v,D,k)=>{if(typeof D.PATTERN=="string"){const P=D.PATTERN.charCodeAt(0),M=Mi(P);Zm(v,M,y[k])}else if(Ce(D.START_CHARS_HINT)){let P;se(D.START_CHARS_HINT,M=>{const I=typeof M=="string"?M.charCodeAt(0):M,G=Mi(I);P!==G&&(P=G,Zm(v,G,y[k]))})}else if(si(D.PATTERN))if(D.PATTERN.unicode)T=!1,e.ensureOptimizations&&Vm(`${nf} Unable to analyze < ${D.PATTERN.toString()} > pattern.
23
- The regexp unicode flag is not currently supported by the regexp-to-ast library.
24
- This will disable the lexer's first char optimizations.
25
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const P=oB(D.PATTERN,e.ensureOptimizations);Ge(P)&&(T=!1),se(P,M=>{Zm(v,M,y[k])})}else e.ensureOptimizations&&Vm(`${nf} TokenType: <${D.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
26
- This will disable the lexer's first char optimizations.
27
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),T=!1;return v},[])}),{emptyGroups:p,patternIdxToConfig:y,charCodeToPatternIdxToConfig:b,hasCustom:i,canBeOptimized:T}}function lB(t,e){let n=[];const r=fB(t);n=n.concat(r.errors);const i=hB(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(dB(s)),n=n.concat(DB(s)),n=n.concat(EB(s,e)),n=n.concat(TB(s)),n}function dB(t){let e=[];const n=Rn(t,r=>si(r[Gs]));return e=e.concat(gB(n)),e=e.concat(vB(n)),e=e.concat(wB(n)),e=e.concat(bB(n)),e=e.concat(mB(n)),e}function fB(t){const e=Rn(t,i=>!oe(i,Gs)),n=Q(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:ft.MISSING_PATTERN,tokenTypes:[i]})),r=Yd(t,e);return{errors:n,valid:r}}function hB(t){const e=Rn(t,i=>{const s=i[Gs];return!si(s)&&!ti(s)&&!oe(s,"exec")&&!ln(s)}),n=Q(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:ft.INVALID_PATTERN,tokenTypes:[i]})),r=Yd(t,e);return{errors:n,valid:r}}const pB=/[^\\][$]/;function gB(t){class e extends Id{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=Rn(t,i=>{const s=i.PATTERN;try{const o=tf(s),a=new e;return a.visit(o),a.found}catch{return pB.test(s.source)}});return Q(n,i=>({message:`Unexpected RegExp Anchor Error:
28
- Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
29
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ft.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function mB(t){const e=Rn(t,r=>r.PATTERN.test(""));return Q(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:ft.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const yB=/[^\\[][\^]|^\^/;function vB(t){class e extends Id{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=Rn(t,i=>{const s=i.PATTERN;try{const o=tf(s),a=new e;return a.visit(o),a.found}catch{return yB.test(s.source)}});return Q(n,i=>({message:`Unexpected RegExp Anchor Error:
30
- Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
31
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ft.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function wB(t){const e=Rn(t,r=>{const i=r[Gs];return i instanceof RegExp&&(i.multiline||i.global)});return Q(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ft.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function bB(t){const e=[];let n=Q(t,s=>Zt(t,(o,a)=>(s.PATTERN.source===a.PATTERN.source&&!Jt(e,a)&&a.PATTERN!==pn.NA&&(e.push(a),o.push(a)),o),[]));n=Uc(n);const r=Rn(n,s=>s.length>1);return Q(r,s=>{const o=Q(s,c=>c.name);return{message:`The same RegExp pattern ->${nr(s).PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:ft.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function DB(t){const e=Rn(t,r=>{if(!oe(r,"GROUP"))return!1;const i=r.GROUP;return i!==pn.SKIPPED&&i!==pn.NA&&!ln(i)});return Q(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ft.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function EB(t,e){const n=Rn(t,i=>i.PUSH_MODE!==void 0&&!Jt(e,i.PUSH_MODE));return Q(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:ft.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function TB(t){const e=[],n=Zt(t,(r,i,s)=>{const o=i.PATTERN;return o===pn.NA||(ln(o)?r.push({str:o,idx:s,tokenType:i}):si(o)&&SB(o)&&r.push({str:o.source,idx:s,tokenType:i})),r},[]);return se(t,(r,i)=>{se(n,({str:s,idx:o,tokenType:a})=>{if(i<o&&RB(s,r.PATTERN)){const c=`Token: ->${a.name}<- can never be matched.
32
- Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
33
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:ft.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),e}function RB(t,e){if(si(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(ti(e))return e(t,0,[],{});if(oe(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function SB(t){return Wo([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function xT(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function PT(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function $B(t,e,n){const r=[];return oe(t,Gc)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Gc+`> property in its definition
34
- `,type:ft.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),oe(t,sf)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+sf+`> property in its definition
35
- `,type:ft.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),oe(t,sf)&&oe(t,Gc)&&!oe(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Gc}: <${t.defaultMode}>which does not exist
36
- `,type:ft.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),oe(t,sf)&&se(t.modes,(i,s)=>{se(i,(o,a)=>{if(oi(o))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${a}>
37
- `,type:ft.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(oe(o,"LONGER_ALT")){const c=Ce(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];se(c,u=>{!oi(u)&&!Jt(i,u)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${o.name}> outside of mode <${s}>
38
- `,type:ft.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function kB(t,e,n){const r=[];let i=!1;const s=Uc(Bn(At(t.modes))),o=Xd(s,c=>c[Gs]===pn.NA),a=FT(n);return e&&se(o,c=>{const u=OT(c,a);if(u!==!1){const d={message:IB(c,u),type:u.issue,tokenType:c};r.push(d)}else oe(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Jm(a,c.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
39
- This Lexer has been defined to track line and column information,
40
- But none of the Token Types can be identified as matching a line terminator.
41
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
42
- for details.`,type:ft.NO_LINE_BREAKS_FLAGS}),r}function CB(t){const e={},n=Mn(t);return se(n,r=>{const i=t[r];if(Ce(i))e[r]=[];else throw Error("non exhaustive match")}),e}function NT(t){const e=t.PATTERN;if(si(e))return!1;if(ti(e))return!0;if(oe(e,"exec"))return!0;if(ln(e))return!1;throw Error("non exhaustive match")}function _B(t){return ln(t)&&t.length===1?t.charCodeAt(0):!1}const AB={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function OT(t,e){if(oe(t,"LINE_BREAKS"))return!1;if(si(t.PATTERN)){try{Jm(e,t.PATTERN)}catch(n){return{issue:ft.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(ln(t.PATTERN))return!1;if(NT(t))return{issue:ft.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function IB(t,e){if(e.issue===ft.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
43
- The problem is in the <${t.name}> Token Type
44
- Root cause: ${e.errMsg}.
45
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===ft.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
46
- The problem is in the <${t.name}> Token Type
47
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function FT(t){return Q(t,n=>ln(n)?n.charCodeAt(0):n)}function Zm(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const zc=256;let of=[];function Mi(t){return t<zc?t:of[t]}function xB(){if(Ge(of)){of=new Array(65536);for(let t=0;t<65536;t++)of[t]=t>255?255+~~(t/255):t}}function Hc(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function af(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let LT=1;const MT={};function Kc(t){const e=PB(t);NB(e),FB(e),OB(e),se(e,n=>{n.isParent=n.categoryMatches.length>0})}function PB(t){let e=Ft(t),n=t,r=!0;for(;r;){n=Uc(Bn(Q(n,s=>s.CATEGORIES)));const i=Yd(n,e);e=e.concat(i),Ge(i)?r=!1:n=i}return e}function NB(t){se(t,e=>{jT(e)||(MT[LT]=e,e.tokenTypeIdx=LT++),UT(e)&&!Ce(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),UT(e)||(e.CATEGORIES=[]),LB(e)||(e.categoryMatches=[]),MB(e)||(e.categoryMatchesMap={})})}function OB(t){se(t,e=>{e.categoryMatches=[],se(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(MT[r].tokenTypeIdx)})})}function FB(t){se(t,e=>{BT([],e)})}function BT(t,e){se(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),se(e.CATEGORIES,n=>{const r=t.concat(e);Jt(r,n)||BT(r,n)})}function jT(t){return oe(t,"tokenTypeIdx")}function UT(t){return oe(t,"CATEGORIES")}function LB(t){return oe(t,"categoryMatches")}function MB(t){return oe(t,"categoryMatchesMap")}function BB(t){return oe(t,"tokenTypeIdx")}const jB={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var ft;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(ft||(ft={}));const Vc={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
48
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:jB,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Vc);class pn{constructor(e,n=Vc){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${o}--> <${i}>`);const{time:a,value:c}=ST(s),u=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${o}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
49
- a boolean 2nd argument is no longer supported`);this.config=Tn({},Vc,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Vc.lineTerminatorsPattern)this.config.lineTerminatorsPattern=AB;else if(this.config.lineTerminatorCharacters===Vc.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
50
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Ce(e)?i={modes:{defaultMode:Ft(e)},defaultMode:Gc}:(s=!1,i=Ft(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat($B(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(kB(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},se(i.modes,(a,c)=>{i.modes[c]=Xd(a,u=>oi(u))});const o=Mn(i.modes);if(se(i.modes,(a,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(lB(a,o))}),Ge(this.lexerDefinitionErrors)){Kc(a);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=uB(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=Tn({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Ge(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=Q(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
51
- `);throw new Error(`Errors detected in definition of Lexer:
52
- `+c)}se(this.lexerDefinitionWarning,a=>{RT(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(IT?(this.chopInput=Bs,this.match=this.matchWithTest):(this.updateLastIndex=_t,this.match=this.matchWithExec),s&&(this.handleModes=_t),this.trackStartLines===!1&&(this.computeNewColumn=Bs),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=_t),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const a=Zt(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(n.ensureOptimizations&&!Ge(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
53
- Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
54
- Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{sB()}),this.TRACE_INIT("toFastProperties",()=>{$T(this)})})}tokenize(e,n=this.defaultMode){if(!Ge(this.lexerDefinitionErrors)){const i=Q(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
55
- `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
56
- `+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,o,a,c,u,l,d,f,h,p,y,T,b;const v=e,D=v.length;let k=0,P=0;const M=this.hasCustom?0:Math.floor(e.length/10),I=new Array(M),G=[];let U=this.trackStartLines?1:void 0,W=this.trackStartLines?1:void 0;const A=CB(this.emptyGroups),$=this.trackStartLines,R=this.config.lineTerminatorsPattern;let L=0,q=[],j=[];const z=[],Ne=[];Object.freeze(Ne);let J;function B(){return q}function me(qe){const ut=Mi(qe),wt=j[ut];return wt===void 0?Ne:wt}const Nt=qe=>{if(z.length===1&&qe.tokenType.PUSH_MODE===void 0){const ut=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(qe);G.push({offset:qe.startOffset,line:qe.startLine,column:qe.startColumn,length:qe.image.length,message:ut})}else{z.pop();const ut=qo(z);q=this.patternIdxToConfig[ut],j=this.charCodeToPatternIdxToConfig[ut],L=q.length;const wt=this.canModeBeOptimized[ut]&&this.config.safeMode===!1;j&&wt?J=me:J=B}};function sn(qe){z.push(qe),j=this.charCodeToPatternIdxToConfig[qe],q=this.patternIdxToConfig[qe],L=q.length,L=q.length;const ut=this.canModeBeOptimized[qe]&&this.config.safeMode===!1;j&&ut?J=me:J=B}sn.call(this,n);let He;const Dn=this.config.recoveryEnabled;for(;k<D;){c=null;const qe=v.charCodeAt(k),ut=J(qe),wt=ut.length;for(r=0;r<wt;r++){He=ut[r];const We=He.pattern;u=null;const bt=He.short;if(bt!==!1?qe===bt&&(c=We):He.isCustom===!0?(b=We.exec(v,k,I,A),b!==null?(c=b[0],b.payload!==void 0&&(u=b.payload)):c=null):(this.updateLastIndex(We,k),c=this.match(We,e,k)),c!==null){if(a=He.longerAlt,a!==void 0){const tt=a.length;for(s=0;s<tt;s++){const fe=q[a[s]],st=fe.pattern;if(l=null,fe.isCustom===!0?(b=st.exec(v,k,I,A),b!==null?(o=b[0],b.payload!==void 0&&(l=b.payload)):o=null):(this.updateLastIndex(st,k),o=this.match(st,e,k)),o&&o.length>c.length){c=o,u=l,He=fe;break}}}break}}if(c!==null){if(d=c.length,f=He.group,f!==void 0&&(h=He.tokenTypeIdx,p=this.createTokenInstance(c,k,h,He.tokenType,U,W,d),this.handlePayload(p,u),f===!1?P=this.addToken(I,P,p):A[f].push(p)),e=this.chopInput(e,d),k=k+d,W=this.computeNewColumn(W,d),$===!0&&He.canLineTerminator===!0){let We=0,bt,tt;R.lastIndex=0;do bt=R.test(c),bt===!0&&(tt=R.lastIndex-1,We++);while(bt===!0);We!==0&&(U=U+We,W=d-tt,this.updateTokenEndLineColumnLocation(p,f,tt,We,U,W,d))}this.handleModes(He,Nt,sn,p)}else{const We=k,bt=U,tt=W;let fe=Dn===!1;for(;fe===!1&&k<D;)for(e=this.chopInput(e,1),k++,i=0;i<L;i++){const st=q[i],Me=st.pattern,Ot=st.short;if(Ot!==!1?v.charCodeAt(k)===Ot&&(fe=!0):st.isCustom===!0?fe=Me.exec(v,k,I,A)!==null:(this.updateLastIndex(Me,k),fe=Me.exec(e)!==null),fe===!0)break}if(y=k-We,W=this.computeNewColumn(W,y),T=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(v,We,y,bt,tt),G.push({offset:We,line:bt,column:tt,length:y,message:T}),Dn===!1)break}}return this.hasCustom||(I.length=P),{tokens:I,groups:A,errors:G}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=n}updateTokenEndLineColumnLocation(e,n,r,i,s,o,a){let c,u;n!==void 0&&(c=r===a-1,u=c?-1:0,i===1&&c===!0||(e.endLine=s+u,e.endColumn=o-1+-u))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,o){return{image:e,startOffset:n,startLine:s,startColumn:o,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,o,a){return{image:e,startOffset:n,endOffset:n+a-1,startLine:s,endLine:s,startColumn:o,endColumn:o+a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}pn.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",pn.NA=/NOT_APPLICABLE/;function Ho(t){return qT(t)?t.LABEL:t.name}function qT(t){return ln(t.LABEL)&&t.LABEL!==""}const UB="parent",WT="categories",GT="label",zT="group",HT="push_mode",KT="pop_mode",VT="longer_alt",YT="line_breaks",XT="start_chars_hint";function JT(t){return qB(t)}function qB(t){const e=t.pattern,n={};if(n.name=t.name,oi(e)||(n.PATTERN=e),oe(t,UB))throw`The parent property is no longer supported.
57
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return oe(t,WT)&&(n.CATEGORIES=t[WT]),Kc([n]),oe(t,GT)&&(n.LABEL=t[GT]),oe(t,zT)&&(n.GROUP=t[zT]),oe(t,KT)&&(n.POP_MODE=t[KT]),oe(t,HT)&&(n.PUSH_MODE=t[HT]),oe(t,VT)&&(n.LONGER_ALT=t[VT]),oe(t,YT)&&(n.LINE_BREAKS=t[YT]),oe(t,XT)&&(n.START_CHARS_HINT=t[XT]),n}const Bi=JT({name:"EOF",pattern:pn.NA});Kc([Bi]);function Qm(t,e,n,r,i,s,o,a){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function ZT(t,e){return Hc(t,e)}const Ko={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${qT(t)?`--> ${Ho(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",a=`
58
- but found: '`+nr(e).image+"'";if(r)return s+r+a;{const c=Zt(t,(f,h)=>f.concat(h),[]),u=Q(c,f=>`[${Q(f,h=>Ho(h)).join(", ")}]`),d=`one of these possible Token sequences:
59
- ${Q(u,(f,h)=>` ${h+1}. ${f}`).join(`
60
- `)}`;return s+d+a}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",o=`
61
- but found: '`+nr(e).image+"'";if(n)return i+n+o;{const c=`expecting at least one iteration which starts with one of these possible Token sequences::
62
- <${Q(t,u=>`[${Q(u,l=>Ho(l)).join(",")}]`).join(" ,")}>`;return i+c+o}}};Object.freeze(Ko);const WB={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
63
- inside top level rule: ->`+t.name+"<-"}},zs={buildDuplicateFoundError(t,e){function n(l){return l instanceof Qe?l.terminalType.name:l instanceof Qt?l.nonTerminalName:""}const r=t.name,i=nr(e),s=i.idx,o=$r(i),a=n(i),c=s>0;let u=`->${o}${c?s:""}<- ${a?`with argument: ->${a}<-`:""}
64
- appears more than once (${e.length} times) in the top level rule: ->${r}<-.
65
- For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
66
- `;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,`
67
- `),u},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
68
- The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
69
- To resolve this make sure each Terminal and Non-Terminal names are unique
70
- This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
71
- and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=Q(t.prefixPath,i=>Ho(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
72
- in <OR${n}> inside <${t.topLevelRule.name}> Rule,
73
- <${e}> may appears as a prefix path in all these alternatives.
74
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
75
- For Further details.`},buildAlternationAmbiguityError(t){const e=Q(t.prefixPath,i=>Ho(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
76
- <${e}> may appears as a prefix path in all these alternatives.
77
- `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
78
- For Further details.`,r},buildEmptyRepetitionError(t){let e=$r(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
79
- This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
80
- Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
81
- <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
82
- has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=Q(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
83
- rule: <${e}> can be invoked from itself (directly or indirectly)
84
- without consuming any Tokens. The grammar path that causes this is:
85
- ${r}
86
- To fix this refactor your grammar to remove the left recursion.
87
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Go?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function GB(t,e){const n=new zB(t,e);return n.resolveRefs(),n.errors}class zB extends zo{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){se(At(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:en.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class HB extends Qd{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=Ft(this.path.ruleStack).reverse(),this.occurrenceStack=Ft(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){Ge(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class KB extends HB{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new dn({definition:i});this.possibleTokTypes=Wc(s),this.found=!0}}}class cf extends Qd{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class VB extends cf{walkMany(e,n,r){if(e.idx===this.occurrence){const i=nr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Qe&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class QT extends cf{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=nr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Qe&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class YB extends cf{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=nr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Qe&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class eR extends cf{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=nr(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Qe&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function ey(t,e,n=[]){n=Ft(n);let r=[],i=0;function s(a){return a.concat(Lt(t,i+1))}function o(a){const c=ey(s(a),e,n);return r.concat(c)}for(;n.length<e&&i<t.length;){const a=t[i];if(a instanceof dn)return o(a.definition);if(a instanceof Qt)return o(a.definition);if(a instanceof Mt)r=o(a.definition);else if(a instanceof $n){const c=a.definition.concat([new dt({definition:a.definition})]);return o(c)}else if(a instanceof kn){const c=[new dn({definition:a.definition}),new dt({definition:[new Qe({terminalType:a.separator})].concat(a.definition)})];return o(c)}else if(a instanceof fn){const c=a.definition.concat([new dt({definition:[new Qe({terminalType:a.separator})].concat(a.definition)})]);r=o(c)}else if(a instanceof dt){const c=a.definition.concat([new dt({definition:a.definition})]);r=o(c)}else{if(a instanceof hn)return se(a.definition,c=>{Ge(c.definition)===!1&&(r=o(c.definition))}),r;if(a instanceof Qe)n.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:Lt(t,i)}),r}function tR(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let a=!1;const c=e.length,u=c-r-1,l=[],d=[];for(d.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Ge(d);){const f=d.pop();if(f===o){a&&qo(d).idx<=u&&d.pop();continue}const h=f.def,p=f.idx,y=f.ruleStack,T=f.occurrenceStack;if(Ge(h))continue;const b=h[0];if(b===i){const v={idx:p,def:Lt(h),ruleStack:qc(y),occurrenceStack:qc(T)};d.push(v)}else if(b instanceof Qe)if(p<c-1){const v=p+1,D=e[v];if(n(D,b.terminalType)){const k={idx:v,def:Lt(h),ruleStack:y,occurrenceStack:T};d.push(k)}}else if(p===c-1)l.push({nextTokenType:b.terminalType,nextTokenOccurrence:b.idx,ruleStack:y,occurrenceStack:T}),a=!0;else throw Error("non exhaustive match");else if(b instanceof Qt){const v=Ft(y);v.push(b.nonTerminalName);const D=Ft(T);D.push(b.idx);const k={idx:p,def:b.definition.concat(s,Lt(h)),ruleStack:v,occurrenceStack:D};d.push(k)}else if(b instanceof Mt){const v={idx:p,def:Lt(h),ruleStack:y,occurrenceStack:T};d.push(v),d.push(o);const D={idx:p,def:b.definition.concat(Lt(h)),ruleStack:y,occurrenceStack:T};d.push(D)}else if(b instanceof $n){const v=new dt({definition:b.definition,idx:b.idx}),D=b.definition.concat([v],Lt(h)),k={idx:p,def:D,ruleStack:y,occurrenceStack:T};d.push(k)}else if(b instanceof kn){const v=new Qe({terminalType:b.separator}),D=new dt({definition:[v].concat(b.definition),idx:b.idx}),k=b.definition.concat([D],Lt(h)),P={idx:p,def:k,ruleStack:y,occurrenceStack:T};d.push(P)}else if(b instanceof fn){const v={idx:p,def:Lt(h),ruleStack:y,occurrenceStack:T};d.push(v),d.push(o);const D=new Qe({terminalType:b.separator}),k=new dt({definition:[D].concat(b.definition),idx:b.idx}),P=b.definition.concat([k],Lt(h)),M={idx:p,def:P,ruleStack:y,occurrenceStack:T};d.push(M)}else if(b instanceof dt){const v={idx:p,def:Lt(h),ruleStack:y,occurrenceStack:T};d.push(v),d.push(o);const D=new dt({definition:b.definition,idx:b.idx}),k=b.definition.concat([D],Lt(h)),P={idx:p,def:k,ruleStack:y,occurrenceStack:T};d.push(P)}else if(b instanceof hn)for(let v=b.definition.length-1;v>=0;v--){const D=b.definition[v],k={idx:p,def:D.definition.concat(Lt(h)),ruleStack:y,occurrenceStack:T};d.push(k),d.push(o)}else if(b instanceof dn)d.push({idx:p,def:b.definition.concat(Lt(h)),ruleStack:y,occurrenceStack:T});else if(b instanceof Go)d.push(XB(b,p,y,T));else throw Error("non exhaustive match")}return l}function XB(t,e,n,r){const i=Ft(n);i.push(t.name);const s=Ft(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var ot;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(ot||(ot={}));function ty(t){if(t instanceof Mt||t==="Option")return ot.OPTION;if(t instanceof dt||t==="Repetition")return ot.REPETITION;if(t instanceof $n||t==="RepetitionMandatory")return ot.REPETITION_MANDATORY;if(t instanceof kn||t==="RepetitionMandatoryWithSeparator")return ot.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof fn||t==="RepetitionWithSeparator")return ot.REPETITION_WITH_SEPARATOR;if(t instanceof hn||t==="Alternation")return ot.ALTERNATION;throw Error("non exhaustive match")}function nR(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=ty(r);return s===ot.ALTERNATION?uf(e,n,i):lf(e,n,s,i)}function JB(t,e,n,r,i,s){const o=uf(t,e,n),a=oR(o)?af:Hc;return s(o,r,a,i)}function ZB(t,e,n,r,i,s){const o=lf(t,e,i,n),a=oR(o)?af:Hc;return s(o[0],a,r)}function QB(t,e,n,r){const i=t.length,s=tr(t,o=>tr(o,a=>a.length===1));if(e)return function(o){const a=Q(o,c=>c.GATE);for(let c=0;c<i;c++){const u=t[c],l=u.length,d=a[c];if(!(d!==void 0&&d.call(this)===!1))e:for(let f=0;f<l;f++){const h=u[f],p=h.length;for(let y=0;y<p;y++){const T=this.LA(y+1);if(n(T,h[y])===!1)continue e}return c}}};if(s&&!r){const o=Q(t,c=>Bn(c)),a=Zt(o,(c,u,l)=>(se(u,d=>{oe(c,d.tokenTypeIdx)||(c[d.tokenTypeIdx]=l),se(d.categoryMatches,f=>{oe(c,f)||(c[f]=l)})}),c),{});return function(){const c=this.LA(1);return a[c.tokenTypeIdx]}}else return function(){for(let o=0;o<i;o++){const a=t[o],c=a.length;e:for(let u=0;u<c;u++){const l=a[u],d=l.length;for(let f=0;f<d;f++){const h=this.LA(f+1);if(n(h,l[f])===!1)continue e}return o}}}}function e5(t,e,n){const r=tr(t,s=>s.length===1),i=t.length;if(r&&!n){const s=Bn(t);if(s.length===1&&Ge(s[0].categoryMatches)){const a=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===a}}else{const o=Zt(s,(a,c,u)=>(a[c.tokenTypeIdx]=!0,se(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){const a=this.LA(1);return o[a.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const o=t[s],a=o.length;for(let c=0;c<a;c++){const u=this.LA(c+1);if(e(u,o[c])===!1)continue e}return!0}return!1}}class t5 extends Qd{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(e,n,r){this.checkIsTarget(e,ot.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,ot.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,ot.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,ot.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,ot.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class rR extends zo{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,ot.OPTION)}visitRepetition(e){this.checkIsTarget(e,ot.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,ot.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,ot.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,ot.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,ot.ALTERNATION)}}function iR(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function ny(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let s=0;s<e.length;s++){const o=e[s];i.push(o+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){const c="_"+r.categoryMatches[a];i.push(o+c)}}e=i}return e}function n5(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let s=0;s<e.length;s++){const o=e[s];if(i[o]===!0)return!1}}return!0}function sR(t,e){const n=Q(t,o=>ey([o],1)),r=iR(n.length),i=Q(n,o=>{const a={};return se(o,c=>{const u=ny(c.partialPath);se(u,l=>{a[l]=!0})}),a});let s=n;for(let o=1;o<=e;o++){const a=s;s=iR(a.length);for(let c=0;c<a.length;c++){const u=a[c];for(let l=0;l<u.length;l++){const d=u[l].partialPath,f=u[l].suffixDef,h=ny(d);if(n5(i,h,c)||Ge(f)||d.length===e){const y=r[c];if(ry(y,d)===!1){y.push(d);for(let T=0;T<h.length;T++){const b=h[T];i[c][b]=!0}}}else{const y=ey(f,o+1,d);s[c]=s[c].concat(y),se(y,T=>{const b=ny(T.partialPath);se(b,v=>{i[c][v]=!0})})}}}}return r}function uf(t,e,n,r){const i=new rR(t,ot.ALTERNATION,r);return e.accept(i),sR(i.result,n)}function lf(t,e,n,r){const i=new rR(t,n);e.accept(i);const s=i.result,a=new t5(e,t,n).startWalking(),c=new dn({definition:s}),u=new dn({definition:a});return sR([c,u],r)}function ry(t,e){e:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const s=e[i],o=r[i];if((s===o||o.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function r5(t,e){return t.length<e.length&&tr(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function oR(t){return tr(t,e=>tr(e,n=>tr(n,r=>Ge(r.categoryMatches))))}function i5(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return Q(e,n=>Object.assign({type:en.CUSTOM_LOOKAHEAD_VALIDATION},n))}function s5(t,e,n,r){const i=Sn(t,c=>o5(c,n)),s=v5(t,e,n),o=Sn(t,c=>p5(c,n)),a=Sn(t,c=>u5(c,t,r,n));return i.concat(s,o,a)}function o5(t,e){const n=new c5;t.accept(n);const r=n.allProductions,i=D6(r,a5),s=rr(i,a=>a.length>1);return Q(At(s),a=>{const c=nr(a),u=e.buildDuplicateFoundError(t,a),l=$r(c),d={message:u,type:en.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},f=aR(c);return f&&(d.parameter=f),d})}function a5(t){return`${$r(t)}_#_${t.idx}_#_${aR(t)}`}function aR(t){return t instanceof Qe?t.terminalType.name:t instanceof Qt?t.nonTerminalName:""}class c5 extends zo{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function u5(t,e,n,r){const i=[];if(Zt(e,(o,a)=>a.name===t.name?o+1:o,0)>1){const o=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:o,type:en.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function l5(t,e,n){const r=[];let i;return Jt(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:en.INVALID_RULE_OVERRIDE,ruleName:t})),r}function cR(t,e,n,r=[]){const i=[],s=df(e.definition);if(Ge(s))return[];{const o=t.name;Jt(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:en.LEFT_RECURSION,ruleName:o});const c=Yd(s,r.concat([t])),u=Sn(c,l=>{const d=Ft(r);return d.push(l),cR(t,l,n,d)});return i.concat(u)}}function df(t){let e=[];if(Ge(t))return e;const n=nr(t);if(n instanceof Qt)e.push(n.referencedRule);else if(n instanceof dn||n instanceof Mt||n instanceof $n||n instanceof kn||n instanceof fn||n instanceof dt)e=e.concat(df(n.definition));else if(n instanceof hn)e=Bn(Q(n.definition,s=>df(s.definition)));else if(!(n instanceof Qe))throw Error("non exhaustive match");const r=Zd(n),i=t.length>1;if(r&&i){const s=Lt(t);return e.concat(df(s))}else return e}class iy extends zo{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function d5(t,e){const n=new iy;t.accept(n);const r=n.alternations;return Sn(r,s=>{const o=qc(s.definition);return Sn(o,(a,c)=>{const u=tR([a],[],Hc,1);return Ge(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:c}),type:en.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:c+1}]:[]})})}function f5(t,e,n){const r=new iy;t.accept(r);let i=r.alternations;return i=Xd(i,o=>o.ignoreAmbiguities===!0),Sn(i,o=>{const a=o.idx,c=o.maxLookahead||e,u=uf(a,t,c,o),l=m5(u,o,t,n),d=y5(u,o,t,n);return l.concat(d)})}class h5 extends zo{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function p5(t,e){const n=new iy;t.accept(n);const r=n.alternations;return Sn(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:en.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function g5(t,e,n){const r=[];return se(t,i=>{const s=new h5;i.accept(s);const o=s.allProductions;se(o,a=>{const c=ty(a),u=a.maxLookahead||e,l=a.idx,f=lf(l,i,c,u)[0];if(Ge(Bn(f))){const h=n.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:h,type:en.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function m5(t,e,n,r){const i=[],s=Zt(t,(a,c,u)=>(e.definition[u].ignoreAmbiguities===!0||se(c,l=>{const d=[u];se(t,(f,h)=>{u!==h&&ry(f,l)&&e.definition[h].ignoreAmbiguities!==!0&&d.push(h)}),d.length>1&&!ry(i,l)&&(i.push(l),a.push({alts:d,path:l}))}),a),[]);return Q(s,a=>{const c=Q(a.alts,l=>l+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:en.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:a.alts}})}function y5(t,e,n,r){const i=Zt(t,(o,a,c)=>{const u=Q(a,l=>({idx:c,path:l}));return o.concat(u)},[]);return Uc(Sn(i,o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];const c=o.idx,u=o.path,l=Rn(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<c&&r5(f.path,u));return Q(l,f=>{const h=[f.idx+1,c+1],p=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:h,prefixPath:f.path}),type:en.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:p,alternatives:h}})}))}function v5(t,e,n){const r=[],i=Q(e,s=>s.name);return se(t,s=>{const o=s.name;if(Jt(i,o)){const a=n.buildNamespaceConflictError(s);r.push({message:a,type:en.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),r}function w5(t){const e=Hm(t,{errMsgProvider:WB}),n={};return se(t.rules,r=>{n[r.name]=r}),GB(n,e.errMsgProvider)}function b5(t){return t=Hm(t,{errMsgProvider:zs}),s5(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const uR="MismatchedTokenException",lR="NoViableAltException",dR="EarlyExitException",fR="NotAllInputParsedException",hR=[uR,lR,dR,fR];Object.freeze(hR);function ff(t){return Jt(hR,t.name)}class hf extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class pR extends hf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=uR}}class D5 extends hf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=lR}}class E5 extends hf{constructor(e,n){super(e,n),this.name=fR}}class T5 extends hf{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=dR}}const sy={},gR="InRuleRecoveryException";class R5 extends Error{constructor(e){super(e),this.name=gR}}class S5{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=oe(e,"recoveryEnabled")?e.recoveryEnabled:ai.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=$5)}getTokenToInsert(e){const n=Qm(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,n,r,i){const s=this.findReSyncTokenType(),o=this.exportLexerState(),a=[];let c=!1;const u=this.LA(1);let l=this.LA(1);const d=()=>{const f=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:f,ruleName:this.getCurrRuleFullName()}),p=new pR(h,u,this.LA(0));p.resyncedTokens=qc(a),this.SAVE_ERROR(p)};for(;!c;)if(this.tokenMatcher(l,i)){d();return}else if(r.call(this)){d(),e.apply(this,n);return}else this.tokenMatcher(l,s)?c=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,a));this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,n,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const r=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new R5("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||Ge(n))return!1;const r=this.LA(1);return Wo(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return Jt(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=Wo(e,s=>ZT(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return sy;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return Q(e,(r,i)=>i===0?sy:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=Q(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Bn(e)}getFollowSetFromFollowKey(e){if(e===sy)return[Bi];const n=e.ruleName+e.idxInCallingRule+CT+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,Bi)||n.push(e),n}reSyncTo(e){const n=[];let r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return qc(n)}attemptInRepetitionRecovery(e,n,r,i,s,o,a){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=Ft(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return Q(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function $5(t,e,n,r,i,s,o){const a=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[a];if(c===void 0){const f=this.getCurrRuleFullName(),h=this.getGAstProductions()[f];c=new s(h,i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence;const d=c.isEndOfRule;this.RULE_STACK.length===1&&d&&u===void 0&&(u=Bi,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,o)&&this.tryInRepetitionRecovery(t,e,n,u)}const k5=4,ji=8,mR=1<<ji,yR=2<<ji,oy=3<<ji,ay=4<<ji,cy=5<<ji,pf=6<<ji;function uy(t,e,n){return n|e|t}class ly{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:ai.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(Ge(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...s]}return n}validateNoLeftRecursion(e){return Sn(e,n=>cR(n,n,zs))}validateEmptyOrAlternatives(e){return Sn(e,n=>d5(n,zs))}validateAmbiguousAlternationAlternatives(e,n){return Sn(e,r=>f5(r,n,zs))}validateSomeNonEmptyLookaheadPath(e,n){return g5(e,n,zs)}buildLookaheadForAlternation(e){return JB(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,QB)}buildLookaheadForOptional(e){return ZB(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,ty(e.prodType),e5)}}class C5{initLooksAhead(e){this.dynamicTokensEnabled=oe(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ai.dynamicTokensEnabled,this.maxLookahead=oe(e,"maxLookahead")?e.maxLookahead:ai.maxLookahead,this.lookaheadStrategy=oe(e,"lookaheadStrategy")?e.lookaheadStrategy:new ly({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){se(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=A5(n);se(r,u=>{const l=u.idx===0?"":u.idx;this.TRACE_INIT(`${$r(u)}${l}`,()=>{const d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:n,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=uy(this.fullRuleNameToShort[n.name],mR,u.idx);this.setLaFuncCache(f,d)})}),se(i,u=>{this.computeLookaheadFunc(n,u.idx,oy,"Repetition",u.maxLookahead,$r(u))}),se(s,u=>{this.computeLookaheadFunc(n,u.idx,yR,"Option",u.maxLookahead,$r(u))}),se(o,u=>{this.computeLookaheadFunc(n,u.idx,ay,"RepetitionMandatory",u.maxLookahead,$r(u))}),se(a,u=>{this.computeLookaheadFunc(n,u.idx,pf,"RepetitionMandatoryWithSeparator",u.maxLookahead,$r(u))}),se(c,u=>{this.computeLookaheadFunc(n,u.idx,cy,"RepetitionWithSeparator",u.maxLookahead,$r(u))})})})}computeLookaheadFunc(e,n,r,i,s,o){this.TRACE_INIT(`${o}${n===0?"":n}`,()=>{const a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=uy(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(c,a)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return uy(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class _5 extends zo{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const gf=new _5;function A5(t){gf.reset(),t.accept(gf);const e=gf.dslMethods;return gf.reset(),e}function vR(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function wR(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function I5(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function x5(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const P5="name";function bR(t,e){Object.defineProperty(t,P5,{enumerable:!1,configurable:!0,writable:!1,value:e})}function N5(t,e){const n=Mn(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],o=t[s],a=o.length;for(let c=0;c<a;c++){const u=o[c];u.tokenTypeIdx===void 0&&this[u.name](u.children,e)}}}function O5(t,e){const n=function(){};bR(n,t+"BaseSemantics");const r={visit:function(i,s){if(Ce(i)&&(i=i[0]),!oi(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=L5(this,e);if(!Ge(i)){const s=Q(i,o=>o.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
88
- ${s.join(`
89
-
90
- `).replace(/\n/g,`
91
- `)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function F5(t,e,n){const r=function(){};bR(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return se(e,s=>{i[s]=N5}),r.prototype=i,r.prototype.constructor=r,r}var dy;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(dy||(dy={}));function L5(t,e){return M5(t,e)}function M5(t,e){const n=Rn(e,i=>ti(t[i])===!1),r=Q(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:dy.MISSING_METHOD,methodName:i}));return Uc(r)}class B5{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=oe(e,"nodeLocationTracking")?e.nodeLocationTracking:ai.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=_t,this.cstFinallyStateUpdate=_t,this.cstPostTerminal=_t,this.cstPostNonTerminal=_t,this.cstPostRule=_t;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=wR,this.setNodeLocationFromNode=wR,this.cstPostRule=_t,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=_t,this.setNodeLocationFromNode=_t,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=vR,this.setNodeLocationFromNode=vR,this.cstPostRule=_t,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=_t,this.setNodeLocationFromNode=_t,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=_t,this.setNodeLocationFromNode=_t,this.cstPostRule=_t,this.setInitialNodeLocation=_t;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];I5(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];x5(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(oi(this.baseCstVisitorConstructor)){const e=O5(this.className,Mn(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(oi(this.baseCstVisitorWithDefaultsConstructor)){const e=F5(this.className,Mn(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class j5{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):vf}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?vf:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class U5{ACTION(e){return e.call(this)}consume(e,n,r){return this.consumeInternal(n,e,r)}subrule(e,n,r){return this.subruleInternal(n,e,r)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,n,r=wf){if(Jt(this.definedRulesNames,e)){const o={message:zs.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:en.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=wf){const i=l5(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,n,r);return this[e]=s,s}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,n),!0}catch(i){if(ff(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Y6(At(this.gastProductionsCache))}}class q5{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=af,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},oe(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
92
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
93
- For Further details.`);if(Ce(e)){if(Ge(e))throw Error(`A Token Vocabulary cannot be empty.
94
- Note that the first argument for the parser constructor
95
- is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
96
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
97
- For Further details.`)}if(Ce(e))this.tokensMap=Zt(e,(s,o)=>(s[o.name]=o,s),{});else if(oe(e,"modes")&&tr(Bn(At(e.modes)),BB)){const s=Bn(At(e.modes)),o=Km(s);this.tokensMap=Zt(o,(a,c)=>(a[c.name]=c,a),{})}else if(Ln(e))this.tokensMap=Ft(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Bi;const r=oe(e,"modes")?Bn(At(e.modes)):At(e),i=tr(r,s=>Ge(s.categoryMatches));this.tokenMatcher=i?af:Hc,Kc(At(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
98
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=oe(r,"resyncEnabled")?r.resyncEnabled:wf.resyncEnabled,s=oe(r,"recoveryValueFunc")?r.recoveryValueFunc:wf.recoveryValueFunc,o=this.ruleShortNameIdx<<k5+ji;this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let a;return this.outputCst===!0?a=function(...l){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,l);const d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}}:a=function(...l){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),n.apply(this,l)}catch(d){return this.invokeRuleCatch(d,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(a,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(ff(e)){const o=e;if(s){const a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(o.resyncedTokens=this.reSyncTo(a),this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return r(e);else{if(this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,o.partialCstResult=c}throw o}}else{if(i)return this.moveToTerminatedState(),r(e);throw o}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(yR,n);return this.optionInternalLogic(e,n,r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const o=e.GATE;if(o!==void 0){const a=i;i=()=>o.call(this)&&a.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(ay,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const a=i;i=()=>o.call(this)&&a.call(this)}}else s=n;if(i.call(this)===!0){let o=this.doSingleRepetition(s);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,ot.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,ay,e,YB)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(pf,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const a=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,eR],a,pf,e,eR)}else throw this.raiseEarlyExitException(e,ot.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(oy,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const c=i;i=()=>a.call(this)&&c.call(this)}}else s=n;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,oy,e,VB,o)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(cy,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const a=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,QT],a,cy,e,QT)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,pf,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(mR,n),i=Ce(e)?e:e.DEF,o=this.getLaFuncFromCache(r).call(this,i);if(o!==void 0)return i[o].ALT.call(this);this.raiseNoAltException(n,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new E5(n,e))}}subruleInternal(e,n,r){let i;try{const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,n,r){throw ff(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,n,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,n,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,n,r){let i;const s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new pR(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===gR?r:s}}else throw r}saveRecogState(){const e=this.errors,n=Ft(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Bi)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class W5{initErrorHandler(e){this._errors=[],this.errorMessageProvider=oe(e,"errorMessageProvider")?e.errorMessageProvider:ai.errorMessageProvider}SAVE_ERROR(e){if(ff(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Ft(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return Ft(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],a=lf(e,s,n,this.maxLookahead)[0],c=[];for(let l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));const u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:c,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new T5(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=uf(e,i,this.maxLookahead),o=[];for(let u=1;u<=this.maxLookahead;u++)o.push(this.LA(u));const a=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:a,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new D5(c,this.LA(1),a))}}class G5{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(oi(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return tR([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=nr(e.ruleStack),i=this.getGAstProductions()[n];return new KB(i,e).startWalking()}}const mf={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(mf);const DR=!0,ER=Math.pow(2,ji)-1,TR=JT({name:"RECORDING_PHASE_TOKEN",pattern:pn.NA});Kc([TR]);const RR=Qm(TR,`This IToken indicates the Parser is in Recording Phase
99
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(RR);const z5={name:`This CSTNode indicates the Parser is in Recording Phase
100
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class H5{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return vf}topLevelRuleRecord(e,n){try{const r=new Go({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
101
- This error was thrown during the "grammar recording phase" For more info see:
102
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return Yc.call(this,Mt,e,n)}atLeastOneInternalRecord(e,n){Yc.call(this,$n,n,e)}atLeastOneSepFirstInternalRecord(e,n){Yc.call(this,kn,n,e,DR)}manyInternalRecord(e,n){Yc.call(this,dt,n,e)}manySepFirstInternalRecord(e,n){Yc.call(this,fn,n,e,DR)}orInternalRecord(e,n){return K5.call(this,e,n)}subruleInternalRecord(e,n,r){if(yf(n),!e||oe(e,"ruleName")===!1){const a=new Error(`<SUBRULE${SR(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
103
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=qo(this.recordingProdStack),s=e.ruleName,o=new Qt({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?z5:mf}consumeInternalRecord(e,n,r){if(yf(n),!jT(e)){const o=new Error(`<CONSUME${SR(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
104
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=qo(this.recordingProdStack),s=new Qe({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),RR}}function Yc(t,e,n,r=!1){yf(n);const i=qo(this.recordingProdStack),s=ti(e)?e:e.DEF,o=new t({definition:[],idx:n});return r&&(o.separator=e.SEP),oe(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),mf}function K5(t,e){yf(e);const n=qo(this.recordingProdStack),r=Ce(t)===!1,i=r===!1?t:t.DEF,s=new hn({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});oe(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const o=ET(i,a=>ti(a.GATE));return s.hasPredicates=o,n.definition.push(s),se(i,a=>{const c=new dn({definition:[]});s.definition.push(c),oe(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:oe(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),mf}function SR(t){return t===0?"":`${t}`}function yf(t){if(t<0||t>ER){const e=new Error(`Invalid DSL Method idx value: <${t}>
105
- Idx value must be a none negative value smaller than ${ER+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class V5{initPerformanceTracer(e){if(oe(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=ai.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=ST(n),o=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function Y5(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const vf=Qm(Bi,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(vf);const ai=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Ko,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),wf=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var en;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(en||(en={}));function $R(t=void 0){return function(){return t}}class Wl{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{$T(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),se(this.definedRulesNames,i=>{const o=this[i].originalGrammarAction;let a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=w5({rules:At(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(Ge(r)&&this.skipValidations===!1){const i=b5({rules:At(this.gastProductionsCache),tokenTypes:At(this.tokensMap),errMsgProvider:zs,grammarName:n}),s=i5({lookaheadStrategy:this.lookaheadStrategy,rules:At(this.gastProductionsCache),tokenTypes:At(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),Ge(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=nB(At(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:At(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(At(this.gastProductionsCache))})),!Wl.DEFER_DEFINITION_ERRORS_HANDLING&&!Ge(this.definitionErrors))throw e=Q(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
106
- ${e.join(`
107
- -------------------------------
108
- `)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),oe(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
109
- Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
110
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
111
- For further details.`);this.skipValidations=oe(n,"skipValidations")?n.skipValidations:ai.skipValidations}}Wl.DEFER_DEFINITION_ERRORS_HANDLING=!1,Y5(Wl,[S5,C5,B5,j5,q5,U5,W5,G5,H5,V5]);class X5 extends Wl{constructor(e,n=ai){const r=Ft(n);r.outputCst=!1,super(e,r)}}function Vo(t,e,n){return`${t.name}_${e}_${n}`}const Ui=1,J5=2,kR=4,CR=5,Xc=7,Z5=8,Q5=9,ej=10,tj=11,_R=12;class fy{constructor(e){this.target=e}isEpsilon(){return!1}}class hy extends fy{constructor(e,n){super(e),this.tokenType=n}}class AR extends fy{constructor(e){super(e)}isEpsilon(){return!0}}class py extends fy{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function nj(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};rj(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Hs(e,i,i);s!==void 0&&pj(e,i,s)}return e}function rj(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=xt(t,i,void 0,{type:J5}),o=xt(t,i,void 0,{type:Xc});s.stop=o,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,o)}}function IR(t,e,n){return n instanceof Qe?gy(t,e,n.terminalType,n):n instanceof Qt?hj(t,e,n):n instanceof hn?cj(t,e,n):n instanceof Mt?uj(t,e,n):n instanceof dt?ij(t,e,n):n instanceof fn?sj(t,e,n):n instanceof $n?oj(t,e,n):n instanceof kn?aj(t,e,n):Hs(t,e,n)}function ij(t,e,n){const r=xt(t,e,n,{type:CR});qi(t,r);const i=Yo(t,e,r,n,Hs(t,e,n));return PR(t,e,n,i)}function sj(t,e,n){const r=xt(t,e,n,{type:CR});qi(t,r);const i=Yo(t,e,r,n,Hs(t,e,n)),s=gy(t,e,n.separator,n);return PR(t,e,n,i,s)}function oj(t,e,n){const r=xt(t,e,n,{type:kR});qi(t,r);const i=Yo(t,e,r,n,Hs(t,e,n));return xR(t,e,n,i)}function aj(t,e,n){const r=xt(t,e,n,{type:kR});qi(t,r);const i=Yo(t,e,r,n,Hs(t,e,n)),s=gy(t,e,n.separator,n);return xR(t,e,n,i,s)}function cj(t,e,n){const r=xt(t,e,n,{type:Ui});qi(t,r);const i=Q(n.definition,o=>IR(t,e,o));return Yo(t,e,r,n,...i)}function uj(t,e,n){const r=xt(t,e,n,{type:Ui});qi(t,r);const i=Yo(t,e,r,n,Hs(t,e,n));return lj(t,e,n,i)}function Hs(t,e,n){const r=Rn(Q(n.definition,i=>IR(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:fj(t,r)}function xR(t,e,n,r,i){const s=r.left,o=r.right,a=xt(t,e,n,{type:tj});qi(t,a);const c=xt(t,e,n,{type:_R});return s.loopback=a,c.loopback=a,t.decisionMap[Vo(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=a,Rt(o,a),i===void 0?(Rt(a,s),Rt(a,c)):(Rt(a,c),Rt(a,i.left),Rt(i.right,s)),{left:s,right:c}}function PR(t,e,n,r,i){const s=r.left,o=r.right,a=xt(t,e,n,{type:ej});qi(t,a);const c=xt(t,e,n,{type:_R}),u=xt(t,e,n,{type:Q5});return a.loopback=u,c.loopback=u,Rt(a,s),Rt(a,c),Rt(o,u),i!==void 0?(Rt(u,c),Rt(u,i.left),Rt(i.right,s)):Rt(u,a),t.decisionMap[Vo(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=a,{left:a,right:c}}function lj(t,e,n,r){const i=r.left,s=r.right;return Rt(i,s),t.decisionMap[Vo(e,"Option",n.idx)]=i,r}function qi(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function Yo(t,e,n,r,...i){const s=xt(t,e,r,{type:Z5,start:n});n.end=s;for(const a of i)a!==void 0?(Rt(n,a.left),Rt(a.right,s)):Rt(n,s);const o={left:n,right:s};return t.decisionMap[Vo(e,dj(r),r.idx)]=n,o}function dj(t){if(t instanceof hn)return"Alternation";if(t instanceof Mt)return"Option";if(t instanceof dt)return"Repetition";if(t instanceof fn)return"RepetitionWithSeparator";if(t instanceof $n)return"RepetitionMandatory";if(t instanceof kn)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function fj(t,e){const n=e.length;for(let s=0;s<n-1;s++){const o=e[s];let a;o.left.transitions.length===1&&(a=o.left.transitions[0]);const c=a instanceof py,u=a,l=e[s+1].left;o.left.type===Ui&&o.right.type===Ui&&a!==void 0&&(c&&u.followState===o.right||a.target===o.right)?(c?u.followState=l:a.target=l,gj(t,o.right)):Rt(o.right,l)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function gy(t,e,n,r){const i=xt(t,e,r,{type:Ui}),s=xt(t,e,r,{type:Ui});return my(i,new hy(s,n)),{left:i,right:s}}function hj(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.get(r),s=xt(t,e,n,{type:Ui}),o=xt(t,e,n,{type:Ui}),a=new py(i,r,o);return my(s,a),{left:s,right:o}}function pj(t,e,n){const r=t.ruleToStartState.get(e);Rt(r,n.left);const i=t.ruleToStopState.get(e);return Rt(n.right,i),{left:r,right:i}}function Rt(t,e){const n=new AR(e);my(t,n)}function xt(t,e,n,r){const i=Object.assign({atn:t,production:n,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},r);return t.states.push(i),i}function my(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function gj(t,e){t.states.splice(t.states.indexOf(e),1)}const bf={};class yy{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=NR(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return Q(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function NR(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function mj(t,e){const n={};return r=>{const i=r.toString();let s=n[i];return s!==void 0||(s={atnStartState:t,decision:e,states:{}},n[i]=s),s}}class OR{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,n){this.predicates[e]=n}toString(){let e="";const n=this.predicates.length;for(let r=0;r<n;r++)e+=this.predicates[r]===!0?"1":"0";return e}}const FR=new OR;class yj extends ly{constructor(e){var n;super(),this.logging=(n=e?.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=nj(e.rules),this.dfas=vj(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,c=Vo(r,"Alternation",n),l=this.atn.decisionMap[c].decision,d=Q(nR({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),f=>Q(f,h=>h[0]));if(LR(d,!1)&&!s){const f=Zt(d,(h,p,y)=>(se(p,T=>{T&&(h[T.tokenTypeIdx]=y,se(T.categoryMatches,b=>{h[b]=y}))}),h),{});return i?function(h){var p;const y=this.LA(1),T=f[y.tokenTypeIdx];if(h!==void 0&&T!==void 0){const b=(p=h[T])===null||p===void 0?void 0:p.GATE;if(b!==void 0&&b.call(this)===!1)return}return T}:function(){const h=this.LA(1);return f[h.tokenTypeIdx]}}else return i?function(f){const h=new OR,p=f===void 0?0:f.length;for(let T=0;T<p;T++){const b=f?.[T].GATE;h.set(T,b===void 0||b.call(this))}const y=vy.call(this,o,l,h,a);return typeof y=="number"?y:void 0}:function(){const f=vy.call(this,o,l,FR,a);return typeof f=="number"?f:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:s}=e,o=this.dfas,a=this.logging,c=Vo(r,i,n),l=this.atn.decisionMap[c].decision,d=Q(nR({maxLookahead:1,occurrence:n,prodType:i,rule:r}),f=>Q(f,h=>h[0]));if(LR(d)&&d[0][0]&&!s){const f=d[0],h=Bn(f);if(h.length===1&&Ge(h[0].categoryMatches)){const y=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===y}}else{const p=Zt(h,(y,T)=>(T!==void 0&&(y[T.tokenTypeIdx]=!0,se(T.categoryMatches,b=>{y[b]=!0})),y),{});return function(){const y=this.LA(1);return p[y.tokenTypeIdx]===!0}}}return function(){const f=vy.call(this,o,l,FR,a);return typeof f=="object"?!1:f===0}}}function LR(t,e=!0){const n=new Set;for(const r of t){const i=new Set;for(const s of r){if(s===void 0){if(e)break;return!1}const o=[s.tokenTypeIdx].concat(s.categoryMatches);for(const a of o)if(n.has(a)){if(!i.has(a))return!1}else n.add(a),i.add(a)}}return!0}function vj(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=mj(t.decisionStates[r],r);return n}function vy(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const a=_j(i.atnStartState);s=jR(i,MR(a)),i.start=s}return wj.apply(this,[i,s,n,r])}function wj(t,e,n,r){let i=e,s=1;const o=[];let a=this.LA(s++);for(;;){let c=Sj(i,a);if(c===void 0&&(c=bj.apply(this,[t,i,a,s,n,r])),c===bf)return Rj(o,i,a);if(c.isAcceptState===!0)return c.prediction;i=c,o.push(a),a=this.LA(s++)}}function bj(t,e,n,r,i,s){const o=$j(e.configs,n,i);if(o.size===0)return BR(t,e,n,bf),bf;let a=MR(o);const c=Cj(o,i);if(c!==void 0)a.isAcceptState=!0,a.prediction=c,a.configs.uniqueAlt=c;else if(Pj(o)){const u=F6(o.alts);a.isAcceptState=!0,a.prediction=u,a.configs.uniqueAlt=u,Dj.apply(this,[t,r,o.alts,s])}return a=BR(t,e,n,a),a}function Dj(t,e,n,r){const i=[];for(let u=1;u<=e;u++)i.push(this.LA(u).tokenType);const s=t.atnStartState,o=s.rule,a=s.production,c=Ej({topLevelRule:o,ambiguityIndices:n,production:a,prefixPath:i});r(c)}function Ej(t){const e=Q(t.prefixPath,i=>Ho(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${Tj(t.production)}${n}> inside <${t.topLevelRule.name}> Rule,
112
- <${e}> may appears as a prefix path in all these alternatives.
113
- `;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
114
- For Further details.`,r}function Tj(t){if(t instanceof Qt)return"SUBRULE";if(t instanceof Mt)return"OPTION";if(t instanceof hn)return"OR";if(t instanceof $n)return"AT_LEAST_ONE";if(t instanceof kn)return"AT_LEAST_ONE_SEP";if(t instanceof fn)return"MANY_SEP";if(t instanceof dt)return"MANY";if(t instanceof Qe)return"CONSUME";throw Error("non exhaustive match")}function Rj(t,e,n){const r=Sn(e.configs.elements,s=>s.state.transitions),i=H6(r.filter(s=>s instanceof hy).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function Sj(t,e){return t.edges[e.tokenTypeIdx]}function $j(t,e,n){const r=new yy,i=[];for(const o of t.elements){if(n.is(o.alt)===!1)continue;if(o.state.type===Xc){i.push(o);continue}const a=o.state.transitions.length;for(let c=0;c<a;c++){const u=o.state.transitions[c],l=kj(u,e);l!==void 0&&r.add({state:l,alt:o.alt,stack:o.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new yy;for(const o of r.elements)Df(o,s)}if(i.length>0&&!Ij(s))for(const o of i)s.add(o);return s}function kj(t,e){if(t instanceof hy&&ZT(e,t.tokenType))return t.target}function Cj(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function MR(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function BR(t,e,n,r){return r=jR(t,r),e.edges[n.tokenTypeIdx]=r,r}function jR(t,e){if(e===bf)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function _j(t){const e=new yy,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};Df(s,e)}return e}function Df(t,e){const n=t.state;if(n.type===Xc){if(t.stack.length>0){const i=[...t.stack],o={state:i.pop(),alt:t.alt,stack:i};Df(o,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i<r;i++){const s=n.transitions[i],o=Aj(t,s);o!==void 0&&Df(o,e)}}function Aj(t,e){if(e instanceof AR)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof py){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function Ij(t){for(const e of t.elements)if(e.state.type===Xc)return!0;return!1}function xj(t){for(const e of t.elements)if(e.state.type!==Xc)return!1;return!0}function Pj(t){if(xj(t))return!0;const e=Nj(t.elements);return Oj(e)&&!Fj(e)}function Nj(t){const e=new Map;for(const n of t){const r=NR(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function Oj(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function Fj(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var UR;(function(t){function e(n){return typeof n=="string"}t.is=e})(UR||(UR={}));var wy;(function(t){function e(n){return typeof n=="string"}t.is=e})(wy||(wy={}));var qR;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(qR||(qR={}));var Ef;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Ef||(Ef={}));var Oe;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Ef.MAX_VALUE),i===Number.MAX_VALUE&&(i=Ef.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return N.objectLiteral(i)&&N.uinteger(i.line)&&N.uinteger(i.character)}t.is=n})(Oe||(Oe={}));var Se;(function(t){function e(r,i,s,o){if(N.uinteger(r)&&N.uinteger(i)&&N.uinteger(s)&&N.uinteger(o))return{start:Oe.create(r,i),end:Oe.create(s,o)};if(Oe.is(r)&&Oe.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${o}]`)}t.create=e;function n(r){let i=r;return N.objectLiteral(i)&&Oe.is(i.start)&&Oe.is(i.end)}t.is=n})(Se||(Se={}));var Tf;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return N.objectLiteral(i)&&Se.is(i.range)&&(N.string(i.uri)||N.undefined(i.uri))}t.is=n})(Tf||(Tf={}));var WR;(function(t){function e(r,i,s,o){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function n(r){let i=r;return N.objectLiteral(i)&&Se.is(i.targetRange)&&N.string(i.targetUri)&&Se.is(i.targetSelectionRange)&&(Se.is(i.originSelectionRange)||N.undefined(i.originSelectionRange))}t.is=n})(WR||(WR={}));var by;(function(t){function e(r,i,s,o){return{red:r,green:i,blue:s,alpha:o}}t.create=e;function n(r){const i=r;return N.objectLiteral(i)&&N.numberRange(i.red,0,1)&&N.numberRange(i.green,0,1)&&N.numberRange(i.blue,0,1)&&N.numberRange(i.alpha,0,1)}t.is=n})(by||(by={}));var GR;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return N.objectLiteral(i)&&Se.is(i.range)&&by.is(i.color)}t.is=n})(GR||(GR={}));var zR;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return N.objectLiteral(i)&&N.string(i.label)&&(N.undefined(i.textEdit)||tn.is(i))&&(N.undefined(i.additionalTextEdits)||N.typedArray(i.additionalTextEdits,tn.is))}t.is=n})(zR||(zR={}));var HR;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(HR||(HR={}));var KR;(function(t){function e(r,i,s,o,a,c){const u={startLine:r,endLine:i};return N.defined(s)&&(u.startCharacter=s),N.defined(o)&&(u.endCharacter=o),N.defined(a)&&(u.kind=a),N.defined(c)&&(u.collapsedText=c),u}t.create=e;function n(r){const i=r;return N.objectLiteral(i)&&N.uinteger(i.startLine)&&N.uinteger(i.startLine)&&(N.undefined(i.startCharacter)||N.uinteger(i.startCharacter))&&(N.undefined(i.endCharacter)||N.uinteger(i.endCharacter))&&(N.undefined(i.kind)||N.string(i.kind))}t.is=n})(KR||(KR={}));var Dy;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return N.defined(i)&&Tf.is(i.location)&&N.string(i.message)}t.is=n})(Dy||(Dy={}));var Jc;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Jc||(Jc={}));var VR;(function(t){t.Unnecessary=1,t.Deprecated=2})(VR||(VR={}));var YR;(function(t){function e(n){const r=n;return N.objectLiteral(r)&&N.string(r.href)}t.is=e})(YR||(YR={}));var Rf;(function(t){function e(r,i,s,o,a,c){let u={range:r,message:i};return N.defined(s)&&(u.severity=s),N.defined(o)&&(u.code=o),N.defined(a)&&(u.source=a),N.defined(c)&&(u.relatedInformation=c),u}t.create=e;function n(r){var i;let s=r;return N.defined(s)&&Se.is(s.range)&&N.string(s.message)&&(N.number(s.severity)||N.undefined(s.severity))&&(N.integer(s.code)||N.string(s.code)||N.undefined(s.code))&&(N.undefined(s.codeDescription)||N.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(N.string(s.source)||N.undefined(s.source))&&(N.undefined(s.relatedInformation)||N.typedArray(s.relatedInformation,Dy.is))}t.is=n})(Rf||(Rf={}));var Xo;(function(t){function e(r,i,...s){let o={title:r,command:i};return N.defined(s)&&s.length>0&&(o.arguments=s),o}t.create=e;function n(r){let i=r;return N.defined(i)&&N.string(i.title)&&N.string(i.command)}t.is=n})(Xo||(Xo={}));var tn;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function n(s,o){return{range:{start:s,end:s},newText:o}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const o=s;return N.objectLiteral(o)&&N.string(o.newText)&&Se.is(o.range)}t.is=i})(tn||(tn={}));var Ey;(function(t){function e(r,i,s){const o={label:r};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function n(r){const i=r;return N.objectLiteral(i)&&N.string(i.label)&&(N.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(N.string(i.description)||i.description===void 0)}t.is=n})(Ey||(Ey={}));var Jo;(function(t){function e(n){const r=n;return N.string(r)}t.is=e})(Jo||(Jo={}));var XR;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function n(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=n;function r(s,o){return{range:s,newText:"",annotationId:o}}t.del=r;function i(s){const o=s;return tn.is(o)&&(Ey.is(o.annotationId)||Jo.is(o.annotationId))}t.is=i})(XR||(XR={}));var Ty;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return N.defined(i)&&Cy.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(Ty||(Ty={}));var Ry;(function(t){function e(r,i,s){let o={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;return i&&i.kind==="create"&&N.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||N.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||N.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Jo.is(i.annotationId))}t.is=n})(Ry||(Ry={}));var Sy;(function(t){function e(r,i,s,o){let a={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function n(r){let i=r;return i&&i.kind==="rename"&&N.string(i.oldUri)&&N.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||N.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||N.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Jo.is(i.annotationId))}t.is=n})(Sy||(Sy={}));var $y;(function(t){function e(r,i,s){let o={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function n(r){let i=r;return i&&i.kind==="delete"&&N.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||N.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||N.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Jo.is(i.annotationId))}t.is=n})($y||($y={}));var ky;(function(t){function e(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>N.string(i.kind)?Ry.is(i)||Sy.is(i)||$y.is(i):Ty.is(i)))}t.is=e})(ky||(ky={}));var JR;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)}t.is=n})(JR||(JR={}));var ZR;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)&&N.integer(i.version)}t.is=n})(ZR||(ZR={}));var Cy;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)&&(i.version===null||N.integer(i.version))}t.is=n})(Cy||(Cy={}));var QR;(function(t){function e(r,i,s,o){return{uri:r,languageId:i,version:s,text:o}}t.create=e;function n(r){let i=r;return N.defined(i)&&N.string(i.uri)&&N.string(i.languageId)&&N.integer(i.version)&&N.string(i.text)}t.is=n})(QR||(QR={}));var _y;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(_y||(_y={}));var Zc;(function(t){function e(n){const r=n;return N.objectLiteral(n)&&_y.is(r.kind)&&N.string(r.value)}t.is=e})(Zc||(Zc={}));var kr;(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})(kr||(kr={}));var eS;(function(t){t.PlainText=1,t.Snippet=2})(eS||(eS={}));var tS;(function(t){t.Deprecated=1})(tS||(tS={}));var nS;(function(t){function e(r,i,s){return{newText:r,insert:i,replace:s}}t.create=e;function n(r){const i=r;return i&&N.string(i.newText)&&Se.is(i.insert)&&Se.is(i.replace)}t.is=n})(nS||(nS={}));var rS;(function(t){t.asIs=1,t.adjustIndentation=2})(rS||(rS={}));var iS;(function(t){function e(n){const r=n;return r&&(N.string(r.detail)||r.detail===void 0)&&(N.string(r.description)||r.description===void 0)}t.is=e})(iS||(iS={}));var sS;(function(t){function e(n){return{label:n}}t.create=e})(sS||(sS={}));var oS;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(oS||(oS={}));var Sf;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return N.string(i)||N.objectLiteral(i)&&N.string(i.language)&&N.string(i.value)}t.is=n})(Sf||(Sf={}));var aS;(function(t){function e(n){let r=n;return!!r&&N.objectLiteral(r)&&(Zc.is(r.contents)||Sf.is(r.contents)||N.typedArray(r.contents,Sf.is))&&(n.range===void 0||Se.is(n.range))}t.is=e})(aS||(aS={}));var cS;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(cS||(cS={}));var uS;(function(t){function e(n,r,...i){let s={label:n};return N.defined(r)&&(s.documentation=r),N.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(uS||(uS={}));var lS;(function(t){t.Text=1,t.Read=2,t.Write=3})(lS||(lS={}));var dS;(function(t){function e(n,r){let i={range:n};return N.number(r)&&(i.kind=r),i}t.create=e})(dS||(dS={}));var ir;(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})(ir||(ir={}));var fS;(function(t){t.Deprecated=1})(fS||(fS={}));var hS;(function(t){function e(n,r,i,s,o){let a={name:n,kind:r,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(hS||(hS={}));var pS;(function(t){function e(n,r,i,s){return s!==void 0?{name:n,kind:r,location:{uri:i,range:s}}:{name:n,kind:r,location:{uri:i}}}t.create=e})(pS||(pS={}));var gS;(function(t){function e(r,i,s,o,a,c){let u={name:r,detail:i,kind:s,range:o,selectionRange:a};return c!==void 0&&(u.children=c),u}t.create=e;function n(r){let i=r;return i&&N.string(i.name)&&N.number(i.kind)&&Se.is(i.range)&&Se.is(i.selectionRange)&&(i.detail===void 0||N.string(i.detail))&&(i.deprecated===void 0||N.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(gS||(gS={}));var mS;(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"})(mS||(mS={}));var $f;(function(t){t.Invoked=1,t.Automatic=2})($f||($f={}));var yS;(function(t){function e(r,i,s){let o={diagnostics:r};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function n(r){let i=r;return N.defined(i)&&N.typedArray(i.diagnostics,Rf.is)&&(i.only===void 0||N.typedArray(i.only,N.string))&&(i.triggerKind===void 0||i.triggerKind===$f.Invoked||i.triggerKind===$f.Automatic)}t.is=n})(yS||(yS={}));var vS;(function(t){function e(r,i,s){let o={title:r},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Xo.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function n(r){let i=r;return i&&N.string(i.title)&&(i.diagnostics===void 0||N.typedArray(i.diagnostics,Rf.is))&&(i.kind===void 0||N.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Xo.is(i.command))&&(i.isPreferred===void 0||N.boolean(i.isPreferred))&&(i.edit===void 0||ky.is(i.edit))}t.is=n})(vS||(vS={}));var wS;(function(t){function e(r,i){let s={range:r};return N.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return N.defined(i)&&Se.is(i.range)&&(N.undefined(i.command)||Xo.is(i.command))}t.is=n})(wS||(wS={}));var bS;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return N.defined(i)&&N.uinteger(i.tabSize)&&N.boolean(i.insertSpaces)}t.is=n})(bS||(bS={}));var DS;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return N.defined(i)&&Se.is(i.range)&&(N.undefined(i.target)||N.string(i.target))}t.is=n})(DS||(DS={}));var ES;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return N.objectLiteral(i)&&Se.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(ES||(ES={}));var Pe;(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"})(Pe||(Pe={}));var at;(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"})(at||(at={}));var TS;(function(t){function e(n){const r=n;return N.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}t.is=e})(TS||(TS={}));var RS;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&Se.is(i.range)&&N.string(i.text)}t.is=n})(RS||(RS={}));var SS;(function(t){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}t.create=e;function n(r){const i=r;return i!=null&&Se.is(i.range)&&N.boolean(i.caseSensitiveLookup)&&(N.string(i.variableName)||i.variableName===void 0)}t.is=n})(SS||(SS={}));var $S;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&Se.is(i.range)&&(N.string(i.expression)||i.expression===void 0)}t.is=n})($S||($S={}));var kS;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return N.defined(i)&&Se.is(r.stoppedLocation)}t.is=n})(kS||(kS={}));var Ay;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(Ay||(Ay={}));var Iy;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return N.objectLiteral(i)&&(i.tooltip===void 0||N.string(i.tooltip)||Zc.is(i.tooltip))&&(i.location===void 0||Tf.is(i.location))&&(i.command===void 0||Xo.is(i.command))}t.is=n})(Iy||(Iy={}));var CS;(function(t){function e(r,i,s){const o={position:r,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function n(r){const i=r;return N.objectLiteral(i)&&Oe.is(i.position)&&(N.string(i.label)||N.typedArray(i.label,Iy.is))&&(i.kind===void 0||Ay.is(i.kind))&&i.textEdits===void 0||N.typedArray(i.textEdits,tn.is)&&(i.tooltip===void 0||N.string(i.tooltip)||Zc.is(i.tooltip))&&(i.paddingLeft===void 0||N.boolean(i.paddingLeft))&&(i.paddingRight===void 0||N.boolean(i.paddingRight))}t.is=n})(CS||(CS={}));var _S;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(_S||(_S={}));var AS;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(AS||(AS={}));var IS;(function(t){function e(n){return{items:n}}t.create=e})(IS||(IS={}));var xS;(function(t){t.Invoked=0,t.Automatic=1})(xS||(xS={}));var PS;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(PS||(PS={}));var NS;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(NS||(NS={}));var OS;(function(t){function e(n){const r=n;return N.objectLiteral(r)&&wy.is(r.uri)&&N.string(r.name)}t.is=e})(OS||(OS={}));var FS;(function(t){function e(s,o,a,c){return new Lj(s,o,a,c)}t.create=e;function n(s){let o=s;return!!(N.defined(o)&&N.string(o.uri)&&(N.undefined(o.languageId)||N.string(o.languageId))&&N.uinteger(o.lineCount)&&N.func(o.getText)&&N.func(o.positionAt)&&N.func(o.offsetAt))}t.is=n;function r(s,o){let a=s.getText(),c=i(o,(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),u=a.length;for(let l=c.length-1;l>=0;l--){let d=c[l],f=s.offsetAt(d.range.start),h=s.offsetAt(d.range.end);if(h<=u)a=a.substring(0,f)+d.newText+a.substring(h,a.length);else throw new Error("Overlapping edit");u=f}return a}t.applyEdits=r;function i(s,o){if(s.length<=1)return s;const a=s.length/2|0,c=s.slice(0,a),u=s.slice(a);i(c,o),i(u,o);let l=0,d=0,f=0;for(;l<c.length&&d<u.length;)o(c[l],u[d])<=0?s[f++]=c[l++]:s[f++]=u[d++];for(;l<c.length;)s[f++]=c[l++];for(;d<u.length;)s[f++]=u[d++];return s}})(FS||(FS={}));let Lj=class{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(i);r=s==="\r"||s===`
115
- `,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
116
- `&&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return Oe.create(0,e);for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return Oe.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var N;(function(t){const e=Object.prototype.toString;function n(h){return typeof h<"u"}t.defined=n;function r(h){return typeof h>"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function o(h){return e.call(h)==="[object Number]"}t.number=o;function a(h,p,y){return e.call(h)==="[object Number]"&&p<=h&&h<=y}t.numberRange=a;function c(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=c;function u(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=u;function l(h){return e.call(h)==="[object Function]"}t.func=l;function d(h){return h!==null&&typeof h=="object"}t.objectLiteral=d;function f(h,p){return Array.isArray(h)&&h.every(p)}t.typedArray=f})(N||(N={}));class Mj{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new MS(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new Py;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new xy(e.startOffset,e.image.length,hd(e),e.tokenType,!1);return r.grammarSource=n,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const n=e.container;if(n){const r=n.content.indexOf(e);r>=0&&n.content.splice(r,1)}}construct(e){const n=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=n;const r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}addHiddenTokens(e){for(const n of e){const r=new xy(n.startOffset,n.image.length,hd(n),n.tokenType,!0);r.root=this.rootNode,this.addHiddenToken(this.rootNode,r)}}addHiddenToken(e,n){const{offset:r,end:i}=n;for(let s=0;s<e.content.length;s++){const o=e.content[s],{offset:a,end:c}=o;if(Xr(o)&&r>a&&i<c){this.addHiddenToken(o,n);return}else if(i<=a){e.content.splice(s,0,n);return}}e.content.push(n)}}class LS{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,n;const r=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(n=this.container)===null||n===void 0?void 0:n.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class xy extends LS{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,n,r,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=n,this._range=r}}class Py extends LS{constructor(){super(...arguments),this.content=new J0(this)}get children(){return this.content}get offset(){var e,n;return(n=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&n!==void 0?n:0}get length(){return this.end-this.offset}get end(){var e,n;return(n=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:0}get range(){const e=this.firstNonHiddenNode,n=this.lastNonHiddenNode;if(e&&n){if(this._rangeCache===void 0){const{range:r}=e,{range:i}=n;this._rangeCache={start:r.start,end:i.end.line<r.start.line?r.start:i.end}}return this._rangeCache}else return{start:Oe.create(0,0),end:Oe.create(0,0)}}get firstNonHiddenNode(){for(const e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){const n=this.content[e];if(!n.hidden)return n}return this.content[this.content.length-1]}}class J0 extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,J0.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,n,...r){return this.addParents(r),super.splice(e,n,...r)}addParents(e){for(const n of e)n.container=this.parent}}class MS extends Py{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const Ny=Symbol("Datatype");function Oy(t){return t.$type===Ny}const BS="\u200B",jS=t=>t.endsWith(BS)?t:t+BS;class US{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition;this.wrapper=new Wj(n,Object.assign(Object.assign({},e.parser.ParserConfig),{errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,n){this.wrapper.wrapOr(e,n)}optional(e,n){this.wrapper.wrapOption(e,n)}many(e,n){this.wrapper.wrapMany(e,n)}atLeastOne(e,n){this.wrapper.wrapAtLeastOne(e,n)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class Bj extends US{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Mj,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,n){const r=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(jS(e.name),this.startImplementation(r,n).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(Nd(e))return Ny;{const n=Ms(e);return n??e.name}}}parse(e,n={}){this.nodeBuilder.buildRootNode(e);const r=this.lexer.tokenize(e);this.wrapper.input=r.tokens;const i=n.rule?this.allRules.get(n.rule):this.mainRule;if(!i)throw new Error(n.rule?`No rule found with name '${n.rule}'`:"No main rule available.");const s=i.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(r.hidden),this.unorderedGroups.clear(),{value:s,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{if(!this.isRecording()){const s={$type:e};this.stack.push(s),e===Ny&&(s.value="")}let i;try{i=n(r)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.nodeBuilder.buildLeafNode(i,r),{assignment:o,isCrossRef:a}=this.getAssignment(r),c=this.current;if(o){const u=br(r)?i.image:this.converter.convert(i.image,s);this.assign(o.operator,o.feature,u,s,a)}else if(Oy(c)){let u=i.image;br(r)||(u=this.converter.convert(u,s).toString()),c.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i){let s;this.isRecording()||(s=this.nodeBuilder.buildCompositeNode(r));const o=this.wrapper.wrapSubrule(e,n,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(o,r,s)}performSubruleAssignment(e,n,r){const{assignment:i,isCrossRef:s}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,e,r,s);else if(!i){const o=this.current;if(Oy(o))o.value+=e.toString();else if(typeof e=="object"&&e){const a=e.$type,c=this.assignWithoutOverride(e,o);a&&(c.$type=a);const u=c;this.stack.pop(),this.stack.push(u)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.operator){r=this.construct(),this.nodeBuilder.buildCompositeNode(n).content.push(r.$cstNode);const s={$type:e};this.stack.push(s),this.assign(n.operator,n.feature,r,r.$cstNode,!1)}else r.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return om(e),this.nodeBuilder.construct(e),this.stack.pop(),Oy(e)?this.converter.convert(e.value,e.$cstNode):(um(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=un(e,wr);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?pc(n.terminal):!1})}return this.assignmentMap.get(e)}assign(e,n,r,i,s){const o=this.current;let a;switch(s&&typeof r=="string"?a=this.linker.buildReference(o,n,i,r):a=r,e){case"=":{o[n]=a;break}case"?=":{o[n]=!0;break}case"+=":Array.isArray(o[n])||(o[n]=[]),o[n].push(a)}}assignWithoutOverride(e,n){for(const[i,s]of Object.entries(n)){const o=e[i];o===void 0?e[i]=s:Array.isArray(o)&&Array.isArray(s)&&(s.push(...o),e[i]=s)}const r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class jj{buildMismatchTokenMessage(e){return Ko.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Ko.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Ko.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Ko.buildEarlyExitMessage(e)}}class qS extends jj{buildMismatchTokenMessage({expected:e,actual:n}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class Uj extends US{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const n=this.lexer.tokenize(e,{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(e,n){const r=this.wrapper.DEFINE_RULE(jS(e.name),this.startImplementation(n).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return n=>{const r=this.keepStackSize();try{e(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,n,r){this.wrapper.wrapConsume(e,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,n,r,i){this.before(r),this.wrapper.wrapSubrule(e,n,i),this.after(r)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){const n=this.elementStack.lastIndexOf(e);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}}const qj={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new qS};class Wj extends X5{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},qj),{lookaheadStrategy:r?new ly({maxLookahead:n.maxLookahead}):new yj}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n){return this.RULE(e,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n)}wrapSubrule(e,n,r){return this.subrule(e,n,{ARGS:[r]})}wrapOr(e,n){this.or(e,n)}wrapOption(e,n){this.option(e,n)}wrapMany(e,n){this.many(e,n)}wrapAtLeastOne(e,n){this.atLeastOne(e,n)}}function WS(t,e,n){return Gj({parser:e,tokens:n,ruleNames:new Map},t),e}function Gj(t,e){const n=pm(e,!1),r=je(e.rules).filter(qt).filter(i=>n.has(i));for(const i of r){const s=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,Ks(s,i.definition))}}function Ks(t,e,n=!1){let r;if(br(e))r=Jj(t,e);else if(Ls(e))r=zj(t,e);else if(wr(e))r=Ks(t,e.terminal);else if(pc(e))r=GS(t,e);else if(Zr(e))r=Hj(t,e);else if(im(e))r=Vj(t,e);else if(sm(e))r=Yj(t,e);else if(Oi(e))r=Xj(t,e);else if(BF(e)){const i=t.consume++;r=()=>t.parser.consume(i,Bi,e)}else throw new HD(e.$cstNode,`Unexpected element type: ${e.$type}`);return zS(t,n?void 0:kf(e),r,e.cardinality)}function zj(t,e){const n=Ac(e);return()=>t.parser.action(n,e)}function Hj(t,e){const n=e.rule.ref;if(qt(n)){const r=t.subrule++,i=e.arguments.length>0?Kj(n,e.arguments):()=>({});return s=>t.parser.subrule(r,HS(t,n),e,i(s))}else if(Jr(n)){const r=t.consume++,i=Fy(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)md();else throw new HD(e.$cstNode,`Undefined rule type: ${e.$type}`)}function Kj(t,e){const n=e.map(r=>ci(r.value));return r=>{const i={};for(let s=0;s<n.length;s++){const o=t.parameters[s],a=n[s];i[o.name]=a(r)}return i}}function ci(t){if(xF(t)){const e=ci(t.left),n=ci(t.right);return r=>e(r)||n(r)}else if(IF(t)){const e=ci(t.left),n=ci(t.right);return r=>e(r)&&n(r)}else if(PF(t)){const e=ci(t.value);return n=>!e(n)}else if(NF(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(AF(t)){const e=!!t.true;return()=>e}md()}function Vj(t,e){if(e.elements.length===1)return Ks(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:Ks(t,i,!0)},o=kf(i);o&&(s.GATE=ci(o)),n.push(s)}const r=t.or++;return i=>t.parser.alternatives(r,n.map(s=>{const o={ALT:()=>s.ALT(i)},a=s.GATE;return a&&(o.GATE=()=>a(i)),o}))}}function Yj(t,e){if(e.elements.length===1)return Ks(t,e.elements[0]);const n=[];for(const a of e.elements){const c={ALT:Ks(t,a,!0)},u=kf(a);u&&(c.GATE=ci(u)),n.push(c)}const r=t.or++,i=(a,c)=>{const u=c.getRuleStack().join("-");return`uGroup_${a}_${u}`},s=a=>t.parser.alternatives(r,n.map((c,u)=>{const l={ALT:()=>!0},d=t.parser;l.ALT=()=>{if(c.ALT(a),!d.isRecording()){const h=i(r,d);d.unorderedGroups.get(h)||d.unorderedGroups.set(h,[]);const p=d.unorderedGroups.get(h);typeof p?.[u]>"u"&&(p[u]=!0)}};const f=c.GATE;return f?l.GATE=()=>f(a):l.GATE=()=>{const h=d.unorderedGroups.get(i(r,d));return!h?.[u]},l})),o=zS(t,kf(e),s,"*");return a=>{o(a),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function Xj(t,e){const n=e.elements.map(r=>Ks(t,r));return r=>n.forEach(i=>i(r))}function kf(t){if(Oi(t))return t.guardCondition}function GS(t,e,n=e.terminal){if(n)if(Zr(n)&&qt(n.rule.ref)){const r=t.subrule++;return i=>t.parser.subrule(r,HS(t,n.rule.ref),e,i)}else if(Zr(n)&&Jr(n.rule.ref)){const r=t.consume++,i=Fy(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(br(n)){const r=t.consume++,i=Fy(t,n.value);return()=>t.parser.consume(r,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=wm(e.type.ref),i=r?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Ac(e.type.ref));return GS(t,e,i)}}function Jj(t,e){const n=t.consume++,r=t.tokens[e.value];if(!r)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(n,r,e)}function zS(t,e,n,r){const i=e&&ci(e);if(!r)if(i){const s=t.or++;return o=>t.parser.alternatives(s,[{ALT:()=>n(o),GATE:()=>i(o)},{ALT:$R(),GATE:()=>!i(o)}])}else return n;if(r==="*"){const s=t.many++;return o=>t.parser.many(s,{DEF:()=>n(o),GATE:i?()=>i(o):void 0})}else if(r==="+"){const s=t.many++;if(i){const o=t.or++;return a=>t.parser.alternatives(o,[{ALT:()=>t.parser.atLeastOne(s,{DEF:()=>n(a)}),GATE:()=>i(a)},{ALT:$R(),GATE:()=>!i(a)}])}else return o=>t.parser.atLeastOne(s,{DEF:()=>n(o)})}else if(r==="?"){const s=t.optional++;return o=>t.parser.optional(s,{DEF:()=>n(o),GATE:i?()=>i(o):void 0})}else md()}function HS(t,e){const n=Zj(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function Zj(t,e){if(qt(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!qt(r);)(Oi(r)||im(r)||sm(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,t.ruleNames.set(e,i),i}}function Fy(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function Qj(t){const e=t.Grammar,n=t.parser.Lexer,r=new Uj(t);return WS(e,r,n.definition),r.finalize(),r}function e9(t){const e=t9(t);return e.finalize(),e}function t9(t){const e=t.Grammar,n=t.parser.Lexer,r=new Bj(t);return WS(e,r,n.definition)}class n9{constructor(){this.diagnostics=[]}buildTokens(e,n){const r=je(pm(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return i.forEach(o=>{const a=o.PATTERN;typeof a=="object"&&a&&"test"in a&&hm(a)?s.unshift(o):s.push(o)}),s}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Jr).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=Ic(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=hm(n)?pn.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){const n=new RegExp(e,e.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(e,n,r){return e.filter(qt).flatMap(i=>Dr(i).filter(br)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!r?.caseInsensitive))}buildKeywordToken(e,n,r){return{name:e.value,PATTERN:this.buildKeywordPattern(e,r),LONGER_ALT:this.findLongerAlt(e,n)}}buildKeywordPattern(e,n){return n?new RegExp(eL(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&tL("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class r9{convert(e,n){let r=n.grammarSource;if(pc(r)&&(r=gm(r)),Zr(r)){const i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,n)}return e}runConverter(e,n,r){var i;switch(e.name.toUpperCase()){case"INT":return ui.convertInt(n);case"STRING":return ui.convertString(n);case"ID":return ui.convertID(n)}switch((i=hE(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return ui.convertNumber(n);case"boolean":return ui.convertBoolean(n);case"bigint":return ui.convertBigint(n);case"date":return ui.convertDate(n);default:return n}}}var ui;(function(t){function e(u){let l="";for(let d=1;d<u.length-1;d++){const f=u.charAt(d);if(f==="\\"){const h=u.charAt(++d);l+=n(h)}else l+=f}return l}t.convertString=e;function n(u){switch(u){case"b":return"\b";case"f":return"\f";case"n":return`
117
- `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function r(u){return u.charAt(0)==="^"?u.substring(1):u}t.convertID=r;function i(u){return parseInt(u)}t.convertInt=i;function s(u){return BigInt(u)}t.convertBigint=s;function o(u){return new Date(u)}t.convertDate=o;function a(u){return Number(u)}t.convertNumber=a;function c(u){return u.toLowerCase()==="true"}t.convertBoolean=c})(ui||(ui={}));var Wi={},li={};Object.defineProperty(li,"__esModule",{value:!0});let Ly;function My(){if(Ly===void 0)throw new Error("No runtime abstraction layer installed");return Ly}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");Ly=n}t.install=e})(My||(My={})),li.default=My;var St={};Object.defineProperty(St,"__esModule",{value:!0}),St.stringArray=St.array=St.func=St.error=St.number=St.string=St.boolean=void 0;function i9(t){return t===!0||t===!1}St.boolean=i9;function KS(t){return typeof t=="string"||t instanceof String}St.string=KS;function s9(t){return typeof t=="number"||t instanceof Number}St.number=s9;function o9(t){return t instanceof Error}St.error=o9;function a9(t){return typeof t=="function"}St.func=a9;function VS(t){return Array.isArray(t)}St.array=VS;function c9(t){return VS(t)&&t.every(e=>KS(e))}St.stringArray=c9;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});var YS=Cr.Emitter=Cr.Event=void 0;const u9=li;var XS;(function(t){const e={dispose(){}};t.None=function(){return e}})(XS||(Cr.Event=XS={}));class l9{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,o=r.length;s<o;s++)try{n.push(r[s].apply(i[s],e))}catch(a){(0,u9.default)().console.error(a)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}let JS=class nN{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new l9),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=nN._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};YS=Cr.Emitter=JS,JS._noop=function(){};var nt;Object.defineProperty(Wi,"__esModule",{value:!0});var By=Wi.CancellationTokenSource=nt=Wi.CancellationToken=void 0;const d9=li,f9=St,jy=Cr;var Cf;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:jy.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:jy.Event.None});function e(n){const r=n;return r&&(r===t.None||r===t.Cancelled||f9.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(Cf||(nt=Wi.CancellationToken=Cf={}));const h9=Object.freeze(function(t,e){const n=(0,d9.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}});class ZS{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?h9:(this._emitter||(this._emitter=new jy.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class p9{get token(){return this._token||(this._token=new ZS),this._token}cancel(){this._token?this._token.cancel():this._token=Cf.Cancelled}dispose(){this._token?this._token instanceof ZS&&this._token.dispose():this._token=Cf.None}}By=Wi.CancellationTokenSource=p9;function g9(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let QS=0,m9=10;const _f=Symbol("OperationCancelled");function Af(t){return t===_f}async function Pt(t){if(t===nt.None)return;const e=Date.now();if(e-QS>=m9&&(QS=e,await g9()),t.isCancellationRequested)throw _f}class Uy{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class Gl{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(Gl.isIncremental(r)){const i=t1(r.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(o,this._content.length);const a=Math.max(i.start.line,0),c=Math.max(i.end.line,0);let u=this._lineOffsets;const l=e1(r.text,!1,s);if(c-a===l.length)for(let f=0,h=l.length;f<h;f++)u[f+a+1]=l[f];else l.length<1e4?u.splice(a+1,c-a,...l):this._lineOffsets=u=u.slice(0,a+1).concat(l,u.slice(c+1));const d=r.text.length-(o-s);if(d!==0)for(let f=a+1+l.length,h=u.length;f<h;f++)u[f]=u[f]+d}else if(Gl.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=e1(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let o=Math.floor((r+i)/2);n[o]>e?i=o:r=o+1}let s=r-1;return{line:s,character:e-n[s]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var If;(function(t){function e(i,s,o,a){return new Gl(i,s,o,a)}t.create=e;function n(i,s,o){if(i instanceof Gl)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){let o=i.getText(),a=qy(s.map(y9),(l,d)=>{let f=l.range.start.line-d.range.start.line;return f===0?l.range.start.character-d.range.start.character:f}),c=0;const u=[];for(const l of a){let d=i.offsetAt(l.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&u.push(o.substring(c,d)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(o.substr(c)),u.join("")}t.applyEdits=r})(If||(If={}));function qy(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);qy(r,e),qy(i,e);let s=0,o=0,a=0;for(;s<r.length&&o<i.length;)e(r[s],i[o])<=0?t[a++]=r[s++]:t[a++]=i[o++];for(;s<r.length;)t[a++]=r[s++];for(;o<i.length;)t[a++]=i[o++];return t}function e1(t,e,n=0){const r=e?[n]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function t1(t){const e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function y9(t){const e=t1(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var n1;(()=>{var t={470:i=>{function s(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function o(c,u){for(var l,d="",f=0,h=-1,p=0,y=0;y<=c.length;++y){if(y<c.length)l=c.charCodeAt(y);else{if(l===47)break;l=47}if(l===47){if(!(h===y-1||p===1))if(h!==y-1&&p===2){if(d.length<2||f!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var T=d.lastIndexOf("/");if(T!==d.length-1){T===-1?(d="",f=0):f=(d=d.slice(0,T)).length-1-d.lastIndexOf("/"),h=y,p=0;continue}}else if(d.length===2||d.length===1){d="",f=0,h=y,p=0;continue}}u&&(d.length>0?d+="/..":d="..",f=2)}else d.length>0?d+="/"+c.slice(h+1,y):d=c.slice(h+1,y),f=y-h-1;h=y,p=0}else l===46&&p!==-1?++p:p=-1}return d}var a={resolve:function(){for(var c,u="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var f;d>=0?f=arguments[d]:(c===void 0&&(c=process.cwd()),f=c),s(f),f.length!==0&&(u=f+"/"+u,l=f.charCodeAt(0)===47)}return u=o(u,!l),l?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(c){if(s(c),c.length===0)return".";var u=c.charCodeAt(0)===47,l=c.charCodeAt(c.length-1)===47;return(c=o(c,!u)).length!==0||u||(c="."),c.length>0&&l&&(c+="/"),u?"/"+c:c},isAbsolute:function(c){return s(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,u=0;u<arguments.length;++u){var l=arguments[u];s(l),l.length>0&&(c===void 0?c=l:c+="/"+l)}return c===void 0?".":a.normalize(c)},relative:function(c,u){if(s(c),s(u),c===u||(c=a.resolve(c))===(u=a.resolve(u)))return"";for(var l=1;l<c.length&&c.charCodeAt(l)===47;++l);for(var d=c.length,f=d-l,h=1;h<u.length&&u.charCodeAt(h)===47;++h);for(var p=u.length-h,y=f<p?f:p,T=-1,b=0;b<=y;++b){if(b===y){if(p>y){if(u.charCodeAt(h+b)===47)return u.slice(h+b+1);if(b===0)return u.slice(h+b)}else f>y&&(c.charCodeAt(l+b)===47?T=b:b===0&&(T=0));break}var v=c.charCodeAt(l+b);if(v!==u.charCodeAt(h+b))break;v===47&&(T=b)}var D="";for(b=l+T+1;b<=d;++b)b!==d&&c.charCodeAt(b)!==47||(D.length===0?D+="..":D+="/..");return D.length>0?D+u.slice(h+T):(h+=T,u.charCodeAt(h)===47&&++h,u.slice(h))},_makeLong:function(c){return c},dirname:function(c){if(s(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,d=-1,f=!0,h=c.length-1;h>=1;--h)if((u=c.charCodeAt(h))===47){if(!f){d=h;break}}else f=!1;return d===-1?l?"/":".":l&&d===1?"//":c.slice(0,d)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');s(c);var l,d=0,f=-1,h=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var p=u.length-1,y=-1;for(l=c.length-1;l>=0;--l){var T=c.charCodeAt(l);if(T===47){if(!h){d=l+1;break}}else y===-1&&(h=!1,y=l+1),p>=0&&(T===u.charCodeAt(p)?--p==-1&&(f=l):(p=-1,f=y))}return d===f?f=y:f===-1&&(f=c.length),c.slice(d,f)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!h){d=l+1;break}}else f===-1&&(h=!1,f=l+1);return f===-1?"":c.slice(d,f)},extname:function(c){s(c);for(var u=-1,l=0,d=-1,f=!0,h=0,p=c.length-1;p>=0;--p){var y=c.charCodeAt(p);if(y!==47)d===-1&&(f=!1,d=p+1),y===46?u===-1?u=p:h!==1&&(h=1):u!==-1&&(h=-1);else if(!f){l=p+1;break}}return u===-1||d===-1||h===0||h===1&&u===d-1&&u===l+1?"":c.slice(u,d)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return function(u,l){var d=l.dir||l.root,f=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+f:d+"/"+f:f}(0,c)},parse:function(c){s(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,d=c.charCodeAt(0),f=d===47;f?(u.root="/",l=1):l=0;for(var h=-1,p=0,y=-1,T=!0,b=c.length-1,v=0;b>=l;--b)if((d=c.charCodeAt(b))!==47)y===-1&&(T=!1,y=b+1),d===46?h===-1?h=b:v!==1&&(v=1):h!==-1&&(v=-1);else if(!T){p=b+1;break}return h===-1||y===-1||v===0||v===1&&h===y-1&&h===p+1?y!==-1&&(u.base=u.name=p===0&&f?c.slice(1,y):c.slice(p,y)):(p===0&&f?(u.name=c.slice(1,h),u.base=c.slice(1,y)):(u.name=c.slice(p,h),u.base=c.slice(p,y)),u.ext=c.slice(h,y)),p>0?u.dir=c.slice(0,p-1):f&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,i.exports=a}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}n.d=(i,s)=>{for(var o in s)n.o(s,o)&&!n.o(i,o)&&Object.defineProperty(i,o,{enumerable:!0,get:s[o]})},n.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),n.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var r={};(()=>{let i;n.r(r),n.d(r,{URI:()=>f,Utils:()=>W}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,o=/^\//,a=/^\/\//;function c(A,$){if(!A.scheme&&$)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${A.authority}", path: "${A.path}", query: "${A.query}", fragment: "${A.fragment}"}`);if(A.scheme&&!s.test(A.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(A.path){if(A.authority){if(!o.test(A.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(A.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const u="",l="/",d=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri($){return $ instanceof f||!!$&&typeof $.authority=="string"&&typeof $.fragment=="string"&&typeof $.path=="string"&&typeof $.query=="string"&&typeof $.scheme=="string"&&typeof $.fsPath=="string"&&typeof $.with=="function"&&typeof $.toString=="function"}scheme;authority;path;query;fragment;constructor($,R,L,q,j,z=!1){typeof $=="object"?(this.scheme=$.scheme||u,this.authority=$.authority||u,this.path=$.path||u,this.query=$.query||u,this.fragment=$.fragment||u):(this.scheme=function(Ne,J){return Ne||J?Ne:"file"}($,z),this.authority=R||u,this.path=function(Ne,J){switch(Ne){case"https":case"http":case"file":J?J[0]!==l&&(J=l+J):J=l}return J}(this.scheme,L||u),this.query=q||u,this.fragment=j||u,c(this,z))}get fsPath(){return v(this)}with($){if(!$)return this;let{scheme:R,authority:L,path:q,query:j,fragment:z}=$;return R===void 0?R=this.scheme:R===null&&(R=u),L===void 0?L=this.authority:L===null&&(L=u),q===void 0?q=this.path:q===null&&(q=u),j===void 0?j=this.query:j===null&&(j=u),z===void 0?z=this.fragment:z===null&&(z=u),R===this.scheme&&L===this.authority&&q===this.path&&j===this.query&&z===this.fragment?this:new p(R,L,q,j,z)}static parse($,R=!1){const L=d.exec($);return L?new p(L[2]||u,M(L[4]||u),M(L[5]||u),M(L[7]||u),M(L[9]||u),R):new p(u,u,u,u,u)}static file($){let R=u;if(i&&($=$.replace(/\\/g,l)),$[0]===l&&$[1]===l){const L=$.indexOf(l,2);L===-1?(R=$.substring(2),$=l):(R=$.substring(2,L),$=$.substring(L)||l)}return new p("file",R,$,u,u)}static from($){const R=new p($.scheme,$.authority,$.path,$.query,$.fragment);return c(R,!0),R}toString($=!1){return D(this,$)}toJSON(){return this}static revive($){if($){if($ instanceof f)return $;{const R=new p($);return R._formatted=$.external,R._fsPath=$._sep===h?$.fsPath:null,R}}return $}}const h=i?1:void 0;class p extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=v(this)),this._fsPath}toString($=!1){return $?D(this,!0):(this._formatted||(this._formatted=D(this,!1)),this._formatted)}toJSON(){const $={$mid:1};return this._fsPath&&($.fsPath=this._fsPath,$._sep=h),this._formatted&&($.external=this._formatted),this.path&&($.path=this.path),this.scheme&&($.scheme=this.scheme),this.authority&&($.authority=this.authority),this.query&&($.query=this.query),this.fragment&&($.fragment=this.fragment),$}}const y={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 T(A,$,R){let L,q=-1;for(let j=0;j<A.length;j++){const z=A.charCodeAt(j);if(z>=97&&z<=122||z>=65&&z<=90||z>=48&&z<=57||z===45||z===46||z===95||z===126||$&&z===47||R&&z===91||R&&z===93||R&&z===58)q!==-1&&(L+=encodeURIComponent(A.substring(q,j)),q=-1),L!==void 0&&(L+=A.charAt(j));else{L===void 0&&(L=A.substr(0,j));const Ne=y[z];Ne!==void 0?(q!==-1&&(L+=encodeURIComponent(A.substring(q,j)),q=-1),L+=Ne):q===-1&&(q=j)}}return q!==-1&&(L+=encodeURIComponent(A.substring(q))),L!==void 0?L:A}function b(A){let $;for(let R=0;R<A.length;R++){const L=A.charCodeAt(R);L===35||L===63?($===void 0&&($=A.substr(0,R)),$+=y[L]):$!==void 0&&($+=A[R])}return $!==void 0?$:A}function v(A,$){let R;return R=A.authority&&A.path.length>1&&A.scheme==="file"?`//${A.authority}${A.path}`:A.path.charCodeAt(0)===47&&(A.path.charCodeAt(1)>=65&&A.path.charCodeAt(1)<=90||A.path.charCodeAt(1)>=97&&A.path.charCodeAt(1)<=122)&&A.path.charCodeAt(2)===58?A.path[1].toLowerCase()+A.path.substr(2):A.path,i&&(R=R.replace(/\//g,"\\")),R}function D(A,$){const R=$?b:T;let L="",{scheme:q,authority:j,path:z,query:Ne,fragment:J}=A;if(q&&(L+=q,L+=":"),(j||q==="file")&&(L+=l,L+=l),j){let B=j.indexOf("@");if(B!==-1){const me=j.substr(0,B);j=j.substr(B+1),B=me.lastIndexOf(":"),B===-1?L+=R(me,!1,!1):(L+=R(me.substr(0,B),!1,!1),L+=":",L+=R(me.substr(B+1),!1,!0)),L+="@"}j=j.toLowerCase(),B=j.lastIndexOf(":"),B===-1?L+=R(j,!1,!0):(L+=R(j.substr(0,B),!1,!0),L+=j.substr(B))}if(z){if(z.length>=3&&z.charCodeAt(0)===47&&z.charCodeAt(2)===58){const B=z.charCodeAt(1);B>=65&&B<=90&&(z=`/${String.fromCharCode(B+32)}:${z.substr(3)}`)}else if(z.length>=2&&z.charCodeAt(1)===58){const B=z.charCodeAt(0);B>=65&&B<=90&&(z=`${String.fromCharCode(B+32)}:${z.substr(2)}`)}L+=R(z,!0,!1)}return Ne&&(L+="?",L+=R(Ne,!1,!1)),J&&(L+="#",L+=$?J:T(J,!1,!1)),L}function k(A){try{return decodeURIComponent(A)}catch{return A.length>3?A.substr(0,3)+k(A.substr(3)):A}}const P=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function M(A){return A.match(P)?A.replace(P,$=>k($)):A}var I=n(470);const G=I.posix||I,U="/";var W;(function(A){A.joinPath=function($,...R){return $.with({path:G.join($.path,...R)})},A.resolvePath=function($,...R){let L=$.path,q=!1;L[0]!==U&&(L=U+L,q=!0);let j=G.resolve(L,...R);return q&&j[0]===U&&!$.authority&&(j=j.substring(1)),$.with({path:j})},A.dirname=function($){if($.path.length===0||$.path===U)return $;let R=G.dirname($.path);return R.length===1&&R.charCodeAt(0)===46&&(R=""),$.with({path:R})},A.basename=function($){return G.basename($.path)},A.extname=function($){return G.extname($.path)}})(W||(W={}))})(),n1=r})();const{URI:Wt,Utils:Qc}=n1;var yt;(function(t){t.basename=Qc.basename,t.dirname=Qc.dirname,t.extname=Qc.extname,t.joinPath=Qc.joinPath,t.resolvePath=Qc.resolvePath;function e(i,s){return i?.toString()===s?.toString()}t.equals=e;function n(i,s){const o=typeof i=="string"?i:i.path,a=typeof s=="string"?s:s.path,c=o.split("/").filter(h=>h.length>0),u=a.split("/").filter(h=>h.length>0);let l=0;for(;l<c.length&&c[l]===u[l];l++);const d="../".repeat(c.length-l),f=u.slice(l).join("/");return d+f}t.relative=n;function r(i){return Wt.parse(i.toString()).toString()}t.normalize=r})(yt||(yt={}));var Fe;(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"})(Fe||(Fe={}));class v9{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=nt.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??Wt.parse(e.uri),nt.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromString(e,n,r){return nt.is(r)?this.createAsync(n,e,r):this.create(n,e,r)}fromModel(e,n){return this.create(n,{$model:e})}create(e,n,r){if(typeof n=="string"){const i=this.parse(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else if("$model"in n){const i={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{const i=this.parse(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}async createAsync(e,n,r){if(typeof n=="string"){const i=await this.parseAsync(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else{const i=await this.parseAsync(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}createLangiumDocument(e,n,r,i){let s;if(r)s={parseResult:e,uri:n,state:Fe.Parsed,references:[],textDocument:r};else{const o=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:Fe.Parsed,references:[],get textDocument(){return o()}}}return e.value.$document=s,s}async update(e,n){var r,i;const s=(r=e.parseResult.value.$cstNode)===null||r===void 0?void 0:r.root.fullText,o=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),a=o?o.getText():await this.fileSystemProvider.readFile(e.uri);if(o)Object.defineProperty(e,"textDocument",{value:o});else{const c=this.createTextDocumentGetter(e.uri,a);Object.defineProperty(e,"textDocument",{get:c})}return s!==a&&(e.parseResult=await this.parseAsync(e.uri,a,n),e.parseResult.value.$document=e),e.state=Fe.Parsed,e}parse(e,n,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(n,r)}parseAsync(e,n,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(n,r)}createTextDocumentGetter(e,n){const r=this.serviceRegistry;let i;return()=>i??(i=If.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class w9{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return je(this.documentMap.values())}addDocument(e){const n=e.uri.toString();if(this.documentMap.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentMap.set(n,e)}getDocument(e){const n=e.toString();return this.documentMap.get(n)}async getOrCreateDocument(e,n){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,n),this.addDocument(r),r)}createDocument(e,n,r){if(r)return this.langiumDocumentFactory.fromString(n,e,r).then(i=>(this.addDocument(i),i));{const i=this.langiumDocumentFactory.fromString(n,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(this.serviceRegistry.getServices(e).references.Linker.unlink(r),r.state=Fe.Changed,r.precomputedScopes=void 0,r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=Fe.Changed,this.documentMap.delete(n)),r}}const Wy=Symbol("ref_resolving");class b9{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,n=nt.None){for(const r of Qr(e.parseResult.value))await Pt(n),$d(r).forEach(i=>this.doLink(i,e))}doLink(e,n){var r;const i=e.reference;if(i._ref===void 0){i._ref=Wy;try{const s=this.getCandidate(e);if(dd(s))i._ref=s;else if(i._nodeDescription=s,this.langiumDocuments().hasDocument(s.documentUri)){const o=this.loadAstNode(s);i._ref=o??this.createLinkingError(e,s)}else i._ref=void 0}catch(s){console.error(`An error occurred while resolving reference to '${i.$refText}':`,s);const o=(r=s.message)!==null&&r!==void 0?r:String(s);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${o}`})}n.references.push(i)}}unlink(e){for(const n of e.references)delete n._ref,delete n._nodeDescription;e.references=[]}getCandidate(e){const r=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return r??this.createLinkingError(e)}buildReference(e,n,r,i){const s=this,o={$refNode:r,$refText:i,get ref(){var a;if(lt(this._ref))return this._ref;if(RF(this._nodeDescription)){const c=s.loadAstNode(this._nodeDescription);this._ref=c??s.createLinkingError({reference:o,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=Wy;const c=Sd(e).$document,u=s.getLinkedNode({reference:o,container:e,property:n});if(u.error&&c&&c.state<Fe.ComputedScopes)return this._ref=void 0;this._ref=(a=u.node)!==null&&a!==void 0?a:u.error,this._nodeDescription=u.descr,c?.references.push(this)}else if(this._ref===Wy)throw new Error(`Cyclic reference resolution detected: ${s.astNodeLocator.getAstNodePath(e)}/${n} (symbol '${i}')`);return lt(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return dd(this._ref)?this._ref:void 0}};return o}getLinkedNode(e){var n;try{const r=this.getCandidate(e);if(dd(r))return{error:r};const i=this.loadAstNode(r);return i?{node:i,descr:r}:{descr:r,error:this.createLinkingError(e,r)}}catch(r){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,r);const i=(n=r.message)!==null&&n!==void 0?n:String(r);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${i}`})}}}loadAstNode(e){if(e.node)return e.node;const n=this.langiumDocuments().getDocument(e.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,e.path)}createLinkingError(e,n){const r=Sd(e.container).$document;r&&r.state<Fe.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);const i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:n})}}function r1(t){return typeof t.name=="string"}class D9{getName(e){if(r1(e))return e.name}getNameNode(e){return En(e.$cstNode,"name")}}class E9{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const n=aE(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(On(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(On(s)&&s.$refNode&&s.$refNode.offset<=e.offset&&s.$refNode.end>=e.end)return s.ref}}if(r){const i=this.nameProvider.getNameNode(r);if(i&&(i===e||BD(e,i)))return r}}}findDeclarationNode(e){const n=this.findDeclaration(e);if(n?.$cstNode){const r=this.nameProvider.getNameNode(n);return r??n.$cstNode}}findReferences(e,n){const r=[];if(n.includeDeclaration){const s=this.getReferenceToSelf(e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>yt.equals(s.sourceUri,n.documentUri))),r.push(...i),je(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=Xt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:Va(n),local:!0}}}}class _r{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return Hg.sum(je(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,n){if(n===void 0)return this.map.delete(e);{const r=this.map.get(e);if(r){const i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(e):r.splice(i,1),!0}return!1}}get(e){var n;return(n=this.map.get(e))!==null&&n!==void 0?n:[]}has(e,n){if(n===void 0)return this.map.has(e);{const r=this.map.get(e);return r?r.indexOf(n)>=0:!1}}add(e,n){return this.map.has(e)?this.map.get(e).push(n):this.map.set(e,[n]),this}addAll(e,n){return this.map.has(e)?this.map.get(e).push(...n):this.map.set(e,Array.from(n)),this}forEach(e){this.map.forEach((n,r)=>n.forEach(i=>e(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return je(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return je(this.map.keys())}values(){return je(this.map.values()).flat()}entriesGroupedByKey(){return je(this.map.entries())}}class i1{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[n,r]of e)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,n){return this.map.set(e,n),this.inverse.set(n,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const n=this.map.get(e);return n!==void 0?(this.map.delete(e),this.inverse.delete(n),!0):!1}}class s1{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=nt.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=kc,i=nt.None){const s=[];this.exportNode(e,s,n);for(const o of r(e))await Pt(i),this.exportNode(o,s,n);return s}exportNode(e,n,r){const i=this.nameProvider.getName(e);i&&n.push(this.descriptions.createDescription(e,i,r))}async computeLocalScopes(e,n=nt.None){const r=e.parseResult.value,i=new _r;for(const s of Dr(r))await Pt(n),this.processNode(s,e,i);return i}processNode(e,n,r){const i=e.$container;if(i){const s=this.nameProvider.getName(e);s&&r.add(i,this.descriptions.createDescription(e,s,n))}}}class eu{constructor(e,n,r){var i;this.elements=e,this.outerScope=n,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const n=this.caseInsensitive?this.elements.find(r=>r.name.toLowerCase()===e.toLowerCase()):this.elements.find(r=>r.name===e);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}}class o1{constructor(e,n,r){var i;this.elements=new Map,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1;for(const s of e){const o=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(o,s)}this.outerScope=n}getElement(e){const n=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(n);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=je(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}const a1={getElement(){},getAllElements(){return Po}};class c1{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class T9 extends c1{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,n){this.throwIfDisposed(),this.cache.set(e,n)}get(e,n){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(n){const r=n();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class R9 extends c1{constructor(e){super(),this.cache=new Map,this.converter=e??(n=>n)}has(e,n){return this.throwIfDisposed(),this.cacheForContext(e).has(n)}set(e,n,r){this.throwIfDisposed(),this.cacheForContext(e).set(n,r)}get(e,n,r){this.throwIfDisposed();const i=this.cacheForContext(e);if(i.has(n))return i.get(n);if(r){const s=r();return i.set(n,s),s}else return}delete(e,n){return this.throwIfDisposed(),this.cacheForContext(e).delete(n)}clear(e){if(this.throwIfDisposed(),e){const n=this.converter(e);this.cache.delete(n)}else this.cache.clear()}cacheForContext(e){const n=this.converter(e);let r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}}class u1 extends T9{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class l1{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new u1(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=Xt(e.container).precomputedScopes;if(i){let o=e.container;do{const a=i.get(o);a.length>0&&n.push(je(a).filter(c=>this.reflection.isSubtype(c.type,r))),o=o.$container}while(o)}let s=this.getGlobalScope(r,e);for(let o=n.length-1;o>=0;o--)s=this.createScope(n[o],s);return s}createScope(e,n,r){return new eu(je(e),n,r)}createScopeForNodes(e,n,r){const i=je(e).map(s=>{const o=this.nameProvider.getName(s);if(o)return this.descriptions.createDescription(s,o)}).nonNullable();return new eu(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new o1(this.indexManager.allElements(e)))}}function S9(t){return typeof t.$comment=="string"}function d1(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class $9{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,n){const r=n??{},i=n?.replacer,s=(a,c)=>this.replacer(a,c,r),o=i?(a,c)=>i(a,c,s):s;try{return this.currentDocument=Xt(e),JSON.stringify(e,o,n?.space)}finally{this.currentDocument=void 0}}deserialize(e,n){const r=n??{},i=JSON.parse(e);return this.linkNode(i,i,r),i}replacer(e,n,{refText:r,sourceText:i,textRegions:s,comments:o,uriConverter:a}){var c,u,l,d;if(!this.ignoreProperties.has(e))if(On(n)){const f=n.ref,h=r?n.$refText:void 0;if(f){const p=Xt(f);let y="";this.currentDocument&&this.currentDocument!==p&&(a?y=a(p.uri,n):y=p.uri.toString());const T=this.astNodeLocator.getAstNodePath(f);return{$ref:`${y}#${T}`,$refText:h}}else return{$error:(u=(c=n.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:h}}else if(lt(n)){let f;if(s&&(f=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&f?.$textRegion&&(f.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(f??(f=Object.assign({},n)),f.$sourceText=(d=n.$cstNode)===null||d===void 0?void 0:d.text),o){f??(f=Object.assign({},n));const h=this.commentProvider.getComment(n);h&&(f.$comment=h.replace(/\r/g,""))}return f??n}else return n}addAstNodeRegionWithAssignmentsTo(e){const n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(e.$cstNode){const r=e.$textRegion=n(e.$cstNode),i=r.assignments={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const o=Lo(e.$cstNode,s).map(n);o.length!==0&&(i[s]=o)}),e}}linkNode(e,n,r,i,s,o){for(const[c,u]of Object.entries(e))if(Array.isArray(u))for(let l=0;l<u.length;l++){const d=u[l];d1(d)?u[l]=this.reviveReference(e,c,n,d,r):lt(d)&&this.linkNode(d,n,r,e,c,l)}else d1(u)?e[c]=this.reviveReference(e,c,n,u,r):lt(u)&&this.linkNode(u,n,r,e,c);const a=e;a.$container=i,a.$containerProperty=s,a.$containerIndex=o}reviveReference(e,n,r,i,s){let o=i.$refText,a=i.$error;if(i.$ref){const c=this.getRefNode(r,i.$ref,s.uriConverter);if(lt(c))return o||(o=this.nameProvider.getName(c)),{$refText:o??"",ref:c};a=c}if(a){const c={$refText:o??""};return c.error={container:e,property:n,message:a,reference:c},c}else return}getRefNode(e,n,r){try{const i=n.indexOf("#");if(i===0){const c=this.astNodeLocator.getAstNode(e,n.substring(1));return c||"Could not resolve path: "+n}if(i<0){const c=r?r(n):Wt.parse(n),u=this.langiumDocuments.getDocument(c);return u?u.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):Wt.parse(n.substring(0,i)),o=this.langiumDocuments.getDocument(s);if(!o)return"Could not find document for URI: "+n;if(i===n.length-1)return o.parseResult.value;const a=this.astNodeLocator.getAstNode(o.parseResult.value,n.substring(i+1));return a||"Could not resolve URI: "+n}catch(i){return String(i)}}}class k9{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){const n=e.LanguageMetaData;for(const r of n.fileExtensions)this.fileExtensionMap.has(r)&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${n.languageId}'.`),this.fileExtensionMap.set(r,e);this.languageIdMap.set(n.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){var n,r;if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const i=(r=(n=this.textDocuments)===null||n===void 0?void 0:n.get(e))===null||r===void 0?void 0:r.languageId;if(i!==void 0){const a=this.languageIdMap.get(i);if(a)return a}const s=yt.extname(e),o=this.fileExtensionMap.get(s);if(!o)throw i?new Error(`The service registry contains no services for the extension '${s}' for language '${i}'.`):new Error(`The service registry contains no services for the extension '${s}'.`);return o}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}}function tu(t){return{code:t}}var xf;(function(t){t.all=["fast","slow","built-in"]})(xf||(xf={}));class C9{constructor(e){this.entries=new _r,this.reflection=e.shared.AstReflection}register(e,n=this,r="fast"){if(r==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[i,s]of Object.entries(e)){const o=s;if(Array.isArray(o))for(const a of o){const c={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,c)}else if(typeof o=="function"){const a={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,a)}}}wrapValidationException(e,n){return async(r,i,s)=>{try{await e.call(n,r,i,s)}catch(o){if(Af(o))throw o;console.error("An error occurred during validation:",o);const a=o instanceof Error?o.message:String(o);o instanceof Error&&o.stack&&console.error(o.stack),i("error","An error occurred during validation: "+a,{node:r})}}}addEntry(e,n){if(e==="AstNode"){this.entries.add("AstNode",n);return}for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,n)}getChecks(e,n){let r=je(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}}class _9{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=nt.None){const i=e.parseResult,s=[];if(await Pt(r),(!n.categories||n.categories.includes("built-in"))&&(this.processLexingErrors(i,s,n),n.stopAfterLexingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===sr.LexingError})||(this.processParsingErrors(i,s,n),n.stopAfterParsingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===sr.ParsingError}))||(this.processLinkingErrors(e,s,n),n.stopAfterLinkingErrors&&s.some(o=>{var a;return((a=o.data)===null||a===void 0?void 0:a.code)===sr.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(o){if(Af(o))throw o;console.error("An error occurred during validation:",o)}return await Pt(r),s}processLexingErrors(e,n,r){var i,s,o;const a=[...e.lexerErrors,...(s=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&s!==void 0?s:[]];for(const c of a){const u=(o=c.severity)!==null&&o!==void 0?o:"error",l={severity:Gy(u),range:{start:{line:c.line-1,character:c.column-1},end:{line:c.line-1,character:c.column+c.length-1}},message:c.message,data:I9(u),source:this.getSource()};n.push(l)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const o=i.previousToken;if(isNaN(o.startOffset)){const a={line:0,character:0};s={start:a,end:a}}else{const a={line:o.endLine-1,character:o.endColumn};s={start:a,end:a}}}}else s=hd(i.token);if(s){const o={severity:Gy("error"),range:s,message:i.message,data:tu(sr.ParsingError),source:this.getSource()};n.push(o)}}}processLinkingErrors(e,n,r){for(const i of e.references){const s=i.error;if(s){const o={node:s.container,property:s.property,index:s.index,data:{code:sr.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,o))}}}async validateAst(e,n,r=nt.None){const i=[],s=(o,a,c)=>{i.push(this.toDiagnostic(o,a,c))};return await Promise.all(Qr(e).map(async o=>{await Pt(r);const a=this.validationRegistry.getChecks(o.$type,n.categories);for(const c of a)await c(o,s,r)})),i}toDiagnostic(e,n,r){return{message:n,range:A9(r),severity:Gy(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function A9(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=En(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=_c(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Gy(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function I9(t){switch(t){case"error":return tu(sr.LexingError);case"warning":return tu(sr.LexingWarning);case"info":return tu(sr.LexingInfo);case"hint":return tu(sr.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var sr;(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"})(sr||(sr={}));class x9{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r){const i=r??Xt(e);n??(n=this.nameProvider.getName(e));const s=this.astNodeLocator.getAstNodePath(e);if(!n)throw new Error(`Node at path ${s} has no name.`);let o;const a=()=>{var c;return o??(o=Va((c=this.nameProvider.getNameNode(e))!==null&&c!==void 0?c:e.$cstNode))};return{node:e,name:n,get nameSegment(){return a()},selectionSegment:Va(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class P9{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=nt.None){const r=[],i=e.parseResult.value;for(const s of Qr(i))await Pt(n),$d(s).filter(o=>!dd(o)).forEach(o=>{const a=this.createDescription(o);a&&r.push(a)});return r}createDescription(e){const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=Xt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:Va(r),local:yt.equals(n.documentUri,i)}}}class N9{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const n=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return n+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:n}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?e+this.indexSeparator+n:e}getAstNode(e,n){return n.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;const o=s.indexOf(this.indexSeparator);if(o>0){const a=s.substring(0,o),c=parseInt(s.substring(o+1)),u=i[a];return u?.[c]}return i[s]},e)}}class O9{constructor(e){this._ready=new Uy,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new YS,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var n,r;this.workspaceConfig=(r=(n=e.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&r!==void 0?r:!1}async initialized(e){if(this.workspaceConfig){if(e.register){const n=this.serviceRegistry.all;e.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){const n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(n);n.forEach((i,s)=>{this.updateSectionConfiguration(i.section,r[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(n=>{const r=e.settings[n];this.updateSectionConfiguration(n,r),this.onConfigurationSectionUpdateEmitter.fire({section:n,configuration:r})})}updateSectionConfiguration(e,n){this.settings[e]=n}async getConfiguration(e,n){await this.ready;const r=this.toSectionName(e);if(this.settings[r])return this.settings[r][n]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var Vs;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(Vs||(Vs={}));class F9{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new _r,this.documentPhaseListeners=new _r,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Fe.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,n={},r=nt.None){var i,s;for(const o of e){const a=o.uri.toString();if(o.state===Fe.Validated){if(typeof n.validation=="boolean"&&n.validation)o.state=Fe.IndexedReferences,o.diagnostics=void 0,this.buildState.delete(a);else if(typeof n.validation=="object"){const c=this.buildState.get(a),u=(i=c?.result)===null||i===void 0?void 0:i.validationChecks;if(u){const d=((s=n.validation.categories)!==null&&s!==void 0?s:xf.all).filter(f=>!u.includes(f));d.length>0&&(this.buildState.set(a,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:d})},result:c.result}),o.state=Fe.IndexedReferences)}}}else this.buildState.delete(a)}this.currentState=Fe.Changed,await this.emitUpdate(e.map(o=>o.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=nt.None){this.currentState=Fe.Changed;for(const o of n)this.langiumDocuments.deleteDocument(o),this.buildState.delete(o.toString()),this.indexManager.remove(o);for(const o of e){if(!this.langiumDocuments.invalidateDocument(o)){const c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},o);c.state=Fe.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(o.toString())}const i=je(e).concat(n).map(o=>o.toString()).toSet();this.langiumDocuments.all.filter(o=>!i.has(o.uri.toString())&&this.shouldRelink(o,i)).forEach(o=>{this.serviceRegistry.getServices(o.uri).references.Linker.unlink(o),o.state=Math.min(o.state,Fe.ComputedScopes),o.diagnostics=void 0}),await this.emitUpdate(e,n),await Pt(r);const s=this.sortDocuments(this.langiumDocuments.all.filter(o=>{var a;return o.state<Fe.Linked||!(!((a=this.buildState.get(o.uri.toString()))===null||a===void 0)&&a.completed)}).toArray());await this.buildDocuments(s,this.updateBuildOptions,r)}async emitUpdate(e,n){await Promise.all(this.updateListeners.map(r=>r(e,n)))}sortDocuments(e){let n=0,r=e.length-1;for(;n<r;){for(;n<e.length&&this.hasTextDocument(e[n]);)n++;for(;r>=0&&!this.hasTextDocument(e[r]);)r--;n<r&&([e[n],e[r]]=[e[r],e[n]])}return e}hasTextDocument(e){var n;return!!(!((n=this.textDocuments)===null||n===void 0)&&n.get(e.uri))}shouldRelink(e,n){return e.references.some(r=>r.error!==void 0)?!0:this.indexManager.isAffected(e,n)}onUpdate(e){return this.updateListeners.push(e),Vs.create(()=>{const n=this.updateListeners.indexOf(e);n>=0&&this.updateListeners.splice(n,1)})}async buildDocuments(e,n,r){this.prepareBuild(e,n),await this.runCancelable(e,Fe.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,Fe.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,Fe.ComputedScopes,r,async s=>{const o=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await o.computeLocalScopes(s,r)}),await this.runCancelable(e,Fe.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,Fe.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,Fe.Validated,r,s=>this.validate(s,r));for(const s of e){const o=this.buildState.get(s.uri.toString());o&&(o.completed=!0)}}prepareBuild(e,n){for(const r of e){const i=r.uri.toString(),s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:n,result:s?.result})}}async runCancelable(e,n,r,i){const s=e.filter(a=>a.state<n);for(const a of s)await Pt(r),await i(a),a.state=n,await this.notifyDocumentPhase(a,n,r);const o=e.filter(a=>a.state===n);await this.notifyBuildPhase(o,n,r),this.currentState=n}onBuildPhase(e,n){return this.buildPhaseListeners.add(e,n),Vs.create(()=>{this.buildPhaseListeners.delete(e,n)})}onDocumentPhase(e,n){return this.documentPhaseListeners.add(e,n),Vs.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=nt.None),i){const s=this.langiumDocuments.getDocument(i);if(s&&s.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):r.isCancellationRequested?Promise.reject(_f):new Promise((s,o)=>{const a=this.onBuildPhase(e,()=>{if(a.dispose(),c.dispose(),i){const u=this.langiumDocuments.getDocument(i);s(u?.uri)}else s(void 0)}),c=r.onCancellationRequested(()=>{a.dispose(),c.dispose(),o(_f)})})}async notifyDocumentPhase(e,n,r){const i=this.documentPhaseListeners.get(n);for(const s of i)try{await s(e,r)}catch(o){if(!Af(o))throw o}}async notifyBuildPhase(e,n,r){if(e.length===0)return;const i=this.buildPhaseListeners.get(n);for(const s of i)await Pt(r),await s(e,r)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,n){var r,i;const s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,o=this.getBuildOptions(e).validation,a=typeof o=="object"?o:void 0,c=await s.validateDocument(e,a,n);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;const u=this.buildState.get(e.uri.toString());if(u){(r=u.result)!==null&&r!==void 0||(u.result={});const l=(i=a?.categories)!==null&&i!==void 0?i:xf.all;u.result.validationChecks?u.result.validationChecks.push(...l):u.result.validationChecks=[...l]}}getBuildOptions(e){var n,r;return(r=(n=this.buildState.get(e.uri.toString()))===null||n===void 0?void 0:n.options)!==null&&r!==void 0?r:{}}}class L9{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new R9,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=Xt(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(o=>{yt.equals(o.targetUri,r)&&o.targetPath===n&&i.push(o)})}),je(i)}allElements(e,n){let r=je(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,n){var r;return n?this.symbolByTypeIndex.get(e,n,()=>{var s;return((s=this.symbolIndex.get(e))!==null&&s!==void 0?s:[]).filter(a=>this.astReflection.isSubtype(a.type,n))}):(r=this.symbolIndex.get(e))!==null&&r!==void 0?r:[]}remove(e){const n=e.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n),this.referenceIndex.delete(n)}async updateContent(e,n=nt.None){const i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,n),s=e.uri.toString();this.symbolIndex.set(s,i),this.symbolByTypeIndex.clear(s)}async updateReferences(e,n=nt.None){const i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,n);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,n){const r=this.referenceIndex.get(e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class f1{constructor(e){this.initialBuildOptions={},this._ready=new Uy,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}initialize(e){var n;this.folders=(n=e.workspaceFolders)!==null&&n!==void 0?n:void 0}initialized(e){return this.mutex.write(n=>{var r;return this.initializeWorkspace((r=this.folders)!==null&&r!==void 0?r:[],n)})}async initializeWorkspace(e,n=nt.None){const r=await this.performStartup(e);await Pt(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(e){const n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),r=[],i=s=>{r.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,i))),this._ready.resolve(),r}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return Wt.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.readDirectory(n);await Promise.all(s.map(async o=>{if(this.includeEntry(e,o,r)){if(o.isDirectory)await this.traverseFolder(e,o.uri,r,i);else if(o.isFile){const a=await this.langiumDocuments.getOrCreateDocument(o.uri);i(a)}}}))}includeEntry(e,n,r){const i=yt.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=yt.extname(n.uri);return r.includes(s)}return!1}}const M9={mode:"full"};class B9{constructor(e){this.tokenBuilder=e.parser.TokenBuilder;const n=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=p1(n)?Object.values(n):n;this.chevrotainLexer=new pn(r,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e,n=M9){var r,i,s;const o=this.chevrotainLexer.tokenize(e);return{tokens:o.tokens,errors:o.errors,hidden:(r=o.groups.hidden)!==null&&r!==void 0?r:[],report:(s=(i=this.tokenBuilder).flushLexingReport)===null||s===void 0?void 0:s.call(i,e)}}toTokenTypeDictionary(e){if(p1(e))return e;const n=h1(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function j9(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function h1(t){return t&&"modes"in t&&"defaultMode"in t}function p1(t){return!j9(t)&&!h1(t)}function U9(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=Oe.create(0,0));const s=g1(t),o=Hy(r),a=G9({lines:s,position:i,options:o});return Y9({index:0,tokens:a,position:i})}function q9(t,e){const n=Hy(e),r=g1(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],o=n.start,a=n.end;return!!o?.exec(i)&&!!a?.exec(s)}function g1(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(rE)}const m1=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,W9=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function G9(t){var e,n,r;const i=[];let s=t.position.line,o=t.position.character;for(let a=0;a<t.lines.length;a++){const c=a===0,u=a===t.lines.length-1;let l=t.lines[a],d=0;if(c&&t.options.start){const h=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);h&&(d=h.index+h[0].length)}else{const h=(n=t.options.line)===null||n===void 0?void 0:n.exec(l);h&&(d=h.index+h[0].length)}if(u){const h=(r=t.options.end)===null||r===void 0?void 0:r.exec(l);h&&(l=l.substring(0,h.index))}if(l=l.substring(0,V9(l)),zy(l,d)>=l.length){if(i.length>0){const h=Oe.create(s,o);i.push({type:"break",content:"",range:Se.create(h,h)})}}else{m1.lastIndex=d;const h=m1.exec(l);if(h){const p=h[0],y=h[1],T=Oe.create(s,o+d),b=Oe.create(s,o+d+p.length);i.push({type:"tag",content:y,range:Se.create(T,b)}),d+=p.length,d=zy(l,d)}if(d<l.length){const p=l.substring(d),y=Array.from(p.matchAll(W9));i.push(...z9(y,p,s,o+d))}}s++,o=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function z9(t,e,n,r){const i=[];if(t.length===0){const s=Oe.create(n,r),o=Oe.create(n,r+e.length);i.push({type:"text",content:e,range:Se.create(s,o)})}else{let s=0;for(const a of t){const c=a.index,u=e.substring(s,c);u.length>0&&i.push({type:"text",content:e.substring(s,c),range:Se.create(Oe.create(n,s+r),Oe.create(n,c+r))});let l=u.length+1;const d=a[1];if(i.push({type:"inline-tag",content:d,range:Se.create(Oe.create(n,s+l+r),Oe.create(n,s+l+d.length+r))}),l+=d.length,a.length===4){l+=a[2].length;const f=a[3];i.push({type:"text",content:f,range:Se.create(Oe.create(n,s+l+r),Oe.create(n,s+l+f.length+r))})}else i.push({type:"text",content:"",range:Se.create(Oe.create(n,s+l+r),Oe.create(n,s+l+r))});s=c+a[0].length}const o=e.substring(s);o.length>0&&i.push({type:"text",content:o,range:Se.create(Oe.create(n,s+r),Oe.create(n,s+r+o.length))})}return i}const H9=/\S/,K9=/\s*$/;function zy(t,e){const n=t.substring(e).match(H9);return n?e+n.index:t.length}function V9(t){const e=t.match(K9);if(e&&typeof e.index=="number")return e.index}function Y9(t){var e,n,r,i;const s=Oe.create(t.position.line,t.position.character);if(t.tokens.length===0)return new b1([],Se.create(s,s));const o=[];for(;t.index<t.tokens.length;){const u=X9(t,o[o.length-1]);u&&o.push(u)}const a=(n=(e=o[0])===null||e===void 0?void 0:e.range.start)!==null&&n!==void 0?n:s,c=(i=(r=o[o.length-1])===null||r===void 0?void 0:r.range.end)!==null&&i!==void 0?i:s;return new b1(o,Se.create(a,c))}function X9(t,e){const n=t.tokens[t.index];if(n.type==="tag")return v1(t,!1);if(n.type==="text"||n.type==="inline-tag")return y1(t);J9(n,e),t.index++}function J9(t,e){if(e){const n=new D1("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function y1(t){let e=t.tokens[t.index];const n=e;let r=e;const i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(Z9(t)),r=e,e=t.tokens[t.index];return new Yy(i,Se.create(n.range.start,r.range.end))}function Z9(t){return t.tokens[t.index].type==="inline-tag"?v1(t,!0):w1(t)}function v1(t,e){const n=t.tokens[t.index++],r=n.content.substring(1),i=t.tokens[t.index];if(i?.type==="text")if(e){const s=w1(t);return new Vy(r,new Yy([s],s.range),e,Se.create(n.range.start,s.range.end))}else{const s=y1(t);return new Vy(r,s,e,Se.create(n.range.start,s.range.end))}else{const s=n.range;return new Vy(r,new Yy([],s),e,s)}}function w1(t){const e=t.tokens[t.index++];return new D1(e.content,e.range)}function Hy(t){if(!t)return Hy({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:Ky(e,!0),end:Ky(n,!1),line:Ky(r,!0)}}function Ky(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?xd(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class b1{constructor(e,n){this.elements=e,this.range=n}getTag(e){return this.getAllTags().find(n=>n.name===e)}getTags(e){return this.getAllTags().filter(n=>n.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const n of this.elements)if(e.length===0)e=n.toString();else{const r=n.toString();e+=E1(e)+r}return e.trim()}toMarkdown(e){let n="";for(const r of this.elements)if(n.length===0)n=r.toMarkdown(e);else{const i=r.toMarkdown(e);n+=E1(n)+i}return n.trim()}}class Vy{constructor(e,n,r,i){this.name=e,this.content=n,this.inline=r,this.range=i}toString(){let e=`@${this.name}`;const n=this.content.toString();return this.content.inlines.length===1?e=`${e} ${n}`:this.content.inlines.length>1&&(e=`${e}
118
- ${n}`),this.inline?`{${e}}`:e}toMarkdown(e){var n,r;return(r=(n=e?.renderTag)===null||n===void 0?void 0:n.call(e,this))!==null&&r!==void 0?r:this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=Q9(this.name,n,e??{});if(typeof s=="string")return s}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} \u2014 ${n}`:this.content.inlines.length>1&&(i=`${i}
119
- ${n}`),this.inline?`{${i}}`:i}}function Q9(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let o=e;if(s>0){const c=zy(e,s);o=e.substring(c),e=e.substring(0,s)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(o=`\`${o}\``),(i=(r=n.renderLink)===null||r===void 0?void 0:r.call(n,e,o))!==null&&i!==void 0?i:eU(e,o)}}function eU(t,e){try{return Wt.parse(t,!0),`[${e}](${t})`}catch{return t}}class Yy{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];e+=r.toString(),i&&i.range.start.line>r.range.start.line&&(e+=`
120
- `)}return e}toMarkdown(e){let n="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];n+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(n+=`
121
- `)}return n}}class D1{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function E1(t){return t.endsWith(`
122
- `)?`
123
- `:`
124
-
125
- `}class tU{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&q9(n))return U9(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){var i;const s=(i=this.findNameInPrecomputedScopes(e,n))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,n);if(s&&s.nameSegment){const o=s.nameSegment.range.start.line+1,a=s.nameSegment.range.start.character+1,c=s.documentUri.with({fragment:`L${o},${a}`});return`[${r}](${c.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=Xt(e).precomputedScopes;if(!i)return;let s=e;do{const a=i.get(s).find(c=>c.name===n);if(a)return a;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class nU{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return S9(e)?e.$comment:(n=pd(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class rU{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class iU{constructor(){this.previousTokenSource=new By,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=new By;return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r=nt.None){const i=new Uy,s={action:n,deferred:i,cancellationToken:r};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){Af(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class sU{constructor(e){this.grammarElementIdMap=new i1,this.tokenTypeIdMap=new i1,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(n=>Object.assign(Object.assign({},n),{message:n.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of Qr(e))n.set(i,{});if(e.$cstNode)for(const i of Ka(e.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const o=[];r[i]=o;for(const a of s)lt(a)?o.push(this.dehydrateAstNode(a,n)):On(a)?o.push(this.dehydrateReference(a,n)):o.push(a)}else lt(s)?r[i]=this.dehydrateAstNode(s,n):On(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=n.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return LD(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),Xr(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):Fs(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of Qr(e))n.set(s,{});let i;if(e.$cstNode)for(const s of Ka(e.$cstNode)){let o;"fullText"in s?(o=new MS(s.fullText),i=o):"content"in s?o=new Py:"tokenType"in s&&(o=this.hydrateCstLeafNode(s)),o&&(r.set(s,o),o.root=i)}return{astNodes:n,cstNodes:r}}hydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=n.cstNodes.get(e.$cstNode));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const o=[];r[i]=o;for(const a of s)lt(a)?o.push(this.setParent(this.hydrateAstNode(a,n),r)):On(a)?o.push(this.hydrateReference(a,r,i,n)):o.push(a)}else lt(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):On(s)?r[i]=this.hydrateReference(s,r,i,n):s!==void 0&&(r[i]=s);return r}setParent(e,n){return e.$container=n,e}hydrateReference(e,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,n,r=0){const i=n.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=n.astNodes.get(e.astNode),Xr(i))for(const s of e.content){const o=this.hydrateCstNode(s,n,r++);i.content.push(o)}return i}hydrateCstLeafNode(e){const n=this.getTokenType(e.tokenType),r=e.offset,i=e.length,s=e.startLine,o=e.startColumn,a=e.endLine,c=e.endColumn,u=e.hidden;return new xy(r,i,{start:{line:s,character:o},end:{line:a,character:c}},n,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap();const n=this.grammarElementIdMap.getKey(e);if(n)return n;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(const n of Qr(this.grammar))Qg(n)&&this.grammarElementIdMap.set(n,e++)}}function T1(t){return{documentation:{CommentProvider:e=>new nU(e),DocumentationProvider:e=>new tU(e)},parser:{AsyncParser:e=>new rU(e),GrammarConfig:e=>dL(e),LangiumParser:e=>e9(e),CompletionParser:e=>Qj(e),ValueConverter:()=>new r9,TokenBuilder:()=>new n9,Lexer:e=>new B9(e),ParserErrorMessageProvider:()=>new qS},workspace:{AstNodeLocator:()=>new N9,AstNodeDescriptionProvider:e=>new x9(e),ReferenceDescriptionProvider:e=>new P9(e)},references:{Linker:e=>new b9(e),NameProvider:()=>new D9,ScopeProvider:e=>new l1(e),ScopeComputation:e=>new s1(e),References:e=>new E9(e)},serializer:{Hydrator:e=>new sU(e),JsonSerializer:e=>new $9(e)},validation:{DocumentValidator:e=>new _9(e),ValidationRegistry:e=>new C9(e)},shared:()=>t.shared}}function R1(t){return{ServiceRegistry:e=>new k9(e),workspace:{LangiumDocuments:e=>new w9(e),LangiumDocumentFactory:e=>new v9(e),DocumentBuilder:e=>new F9(e),IndexManager:e=>new L9(e),WorkspaceManager:e=>new f1(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new iU,ConfigurationProvider:e=>new O9(e)}}}var Pf;(function(t){t.merge=(e,n)=>Of(Of({},e),n)})(Pf||(Pf={}));function Nf(t,e,n,r,i,s,o,a,c){const u=[t,e,n,r,i,s,o,a,c].reduce(Of,{});return $1(u)}const S1=Symbol("isProxy");function Xy(t){if(t&&t[S1])for(const e of Object.values(t))Xy(e);return t}function $1(t,e){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===S1?!0:C1(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(C1(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return n}const k1=Symbol();function C1(t,e,n,r){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===k1)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in n){const i=n[e];t[e]=k1;try{t[e]=typeof i=="function"?i(r):$1(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function Of(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=Of(i,r):t[n]=r}}return t}class oU{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const _1={fileSystemProvider:()=>new oU},aU={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},cU={AstReflection:()=>new ZD};function uU(){const t=Nf(R1(_1),cU),e=Nf(T1({shared:t}),aU);return t.ServiceRegistry.register(e),e}function lU(t){var e;const n=uU(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Wt.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var dU={done:!0,hasNext:!1},Zo={done:!1,hasNext:!1},A1=()=>dU,fU=t=>({hasNext:!0,next:t,done:!1});function ze(t,...e){let n=t,r=e.map(s=>"lazy"in s?hU(s):void 0),i=0;for(;i<e.length;){if(r[i]===void 0||!pU(n)){let c=e[i];n=c(n),i+=1;continue}let s=[];for(let c=i;c<e.length;c++){let u=r[c];if(u===void 0||(s.push(u),u.isSingle))break}let o=[];for(let c of n)if(I1(c,o,s))break;let{isSingle:a}=s.at(-1);n=a?o[0]:o,i+=s.length}return n}function I1(t,e,n){if(n.length===0)return e.push(t),!1;let r=t,i=Zo,s=!1;for(let[o,a]of n.entries()){let{index:c,items:u}=a;if(u.push(r),i=a(r,c,u),a.index+=1,i.hasNext){if(i.hasMany??!1){for(let l of i.next)if(I1(l,e,n.slice(o+1)))return!0;return s}r=i.next}if(!i.hasNext)break;i.done&&(s=!0)}return i.hasNext&&e.push(r),s}function hU(t){let{lazy:e,lazyArgs:n}=t,r=e(...n);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}function pU(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}function Jy(t,e){let n=e.length-t.length;if(n===1){let[r,...i]=e;return ze(r,{lazy:t,lazyArgs:i})}if(n===0){let r={lazy:t,lazyArgs:e};return Object.assign(i=>ze(i,r),r)}throw new Error("Wrong number of arguments")}function gU(t,e,n){let r=i=>t(i,...e);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:e})}function Ue(t,e,n){let r=t.length-e.length;if(r===0)return t(...e);if(r===1)return gU(t,e,n);throw new Error("Wrong number of arguments")}function Ff(...t){return Ue(Object.values,t)}function Ar(...t){return Jy(mU,t)}function mU(){let t=new Set;return e=>t.has(e)?Zo:(t.add(e),{done:!1,hasNext:!0,next:e})}function yU(...t){return Ue(vU,t,wU)}var vU=(t,e)=>e<0?[]:t.slice(0,e);function wU(t){if(t<=0)return A1;let e=t;return n=>(e-=1,{done:e<=0,hasNext:!0,next:n})}function Ir(...t){return Ue(bU,t)}var bU=(t,e)=>t.length>=e,x1={asc:(t,e)=>t>e,desc:(t,e)=>t<e};function DU(t,e){let[n,...r]=e;if(!EU(n)){let s=Zy(...r);return t(n,s)}let i=Zy(n,...r);return s=>t(s,i)}function Zy(t,e,...n){let r=typeof t=="function"?t:t[0],i=typeof t=="function"?"asc":t[1],{[i]:s}=x1,o=e===void 0?void 0:Zy(e,...n);return(a,c)=>{let u=r(a),l=r(c);return s(u,l)?1:s(l,u)?-1:o?.(a,c)??0}}function EU(t){if(P1(t))return!0;if(typeof t!="object"||!Array.isArray(t))return!1;let[e,n,...r]=t;return P1(e)&&typeof n=="string"&&n in x1&&r.length===0}var P1=t=>typeof t=="function"&&t.length===1;function nu(...t){return Ue(TU,t)}function TU(t,e){let n=[...t];return n.sort(e),n}function RU(...t){return DU(SU,t)}var SU=(t,e)=>[...t].sort(e);function N1(...t){return Ue($U,t)}var $U=(t,e,n)=>t.reduce(e,n);function O1(...t){return Ue(kU,t)}function kU(t){return[...t].reverse()}function Qy(...t){return e=>ze(e,...t)}function xr(...t){return Ue(CU,t)}var CU=(t,e)=>t[e];function F1(...t){return Ue(_U,t)}function _U(t,e){let n={...t};for(let[r,i]of Object.entries(n))e(i,r,t)&&delete n[r];return n}function gn(...t){return Ue(AU,t)}var AU=t=>t.length===1?t[0]:void 0;function L1(...t){return Ue(IU,t)}function IU(t,e){let n={};for(let r of e)r in t&&(n[r]=t[r]);return n}function M1(...t){return Ue(xU,t)}function xU(t,e){if(!Ir(e,1))return{...t};if(!Ir(e,2)){let{[e[0]]:r,...i}=t;return i}let n={...t};for(let r of e)delete n[r];return n}function ru(...t){return Ue(PU,t)}var PU=t=>t.at(-1);function ct(...t){return Ue(NU,t,OU)}var NU=(t,e)=>t.map(e),OU=t=>(e,n,r)=>({done:!1,hasNext:!0,next:t(e,n,r)});function di(...t){return Ue(FU,t)}function FU(t,e){let n={};for(let[r,i]of t.entries()){let[s,o]=e(i,r,t);n[s]=o}return n}function Gi(...t){return Ue(LU,t)}function LU(t,e){let n={};for(let[r,i]of Object.entries(t)){let s=e(i,r,t);n[r]=s}return n}function zi(t){return typeof t=="string"}function Z(t){return!!t}function MU(t){return t!==null}function Pr(t){return t!=null}function $t(t){return t==null}function B1(t){return typeof t=="number"&&!Number.isNaN(t)}function j1(t){return Array.isArray(t)}function It(t){return t!==void 0}function Hi(t){return t===void 0?!0:typeof t=="string"||Array.isArray(t)?t.length===0:Object.keys(t).length===0}function ev(t){return t instanceof Error}function tv(...t){return Ue(BU,t)}function BU(t,e){let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);n[s]=i}return n}function jU(...t){return Jy(UU,t)}function UU(t){if(t.length===0)return A1;let e=new Map;for(let n of t)e.set(n,(e.get(n)??0)+1);return n=>{let r=e.get(n);return r===void 0||r===0?Zo:(r===1?e.delete(n):e.set(n,r-1),{hasNext:!0,next:n,done:e.size===0})}}function Ki(...t){return Ue(qU,t,WU)}var qU=(t,e)=>t.flatMap(e),WU=t=>(e,n,r)=>{let i=t(e,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function GU(...t){return Ue(zU,t,HU)}function zU(t,e){return t.forEach(e),t}var HU=t=>(e,n,r)=>(t(e,n,r),{done:!1,hasNext:!0,next:e});function Lf(...t){return Ue(KU,t)}var KU=(t,e)=>{let n={};for(let[r,i]of t.entries()){let s=e(i,r,t);if(s!==void 0){let{[s]:o}=n;o===void 0&&(o=[],n[s]=o),o.push(i)}}return n};function Ve(...t){return Ue(VU,t,YU)}var VU=(t,e)=>t.filter(e),YU=t=>(e,n,r)=>t(e,n,r)?{done:!1,hasNext:!0,next:e}:Zo,U1=t=>Object.assign(t,{single:!0});function q1(...t){return Ue(XU,t,U1(JU))}var XU=(t,e)=>t.find(e),JU=t=>(e,n,r)=>t(e,n,r)?{done:!0,hasNext:!0,next:e}:Zo;function ZU(...t){return Ue(QU,t)}var QU=(t,e)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(e(r,n,t))return r}};function iu(...t){return Ue(e7,t,U1(t7))}var e7=([t])=>t,t7=()=>n7,n7=t=>({hasNext:!0,next:t,done:!0});function Qo(...t){return Ue(Object.entries,t)}function r7(t,{waitMs:e,timing:n="trailing",maxWaitMs:r}){if(r!==void 0&&e!==void 0&&r<e)throw new Error(`debounce: maxWaitMs (${r.toString()}) cannot be less than waitMs (${e.toString()})`);let i,s,o,a,c=()=>{if(s!==void 0){let f=s;s=void 0,clearTimeout(f)}if(o===void 0)throw new Error("REMEDA[debounce]: latestCallArgs was unexpectedly undefined.");let d=o;o=void 0,a=t(...d)},u=()=>{if(i===void 0)return;let d=i;i=void 0,clearTimeout(d),o!==void 0&&c()},l=d=>{o=d,r!==void 0&&s===void 0&&(s=setTimeout(c,r))};return{call:(...d)=>{if(i===void 0)n==="trailing"?l(d):a=t(...d);else{n!=="leading"&&l(d);let f=i;i=void 0,clearTimeout(f)}return i=setTimeout(u,e??r??0),a},cancel:()=>{if(i!==void 0){let d=i;i=void 0,clearTimeout(d)}if(s!==void 0){let d=s;s=void 0,clearTimeout(d)}o=void 0},flush:()=>(u(),a),get isPending(){return i!==void 0},get cachedValue(){return a}}}function i7(...t){return Jy(s7,t)}function s7(t){if(t.length===0)return fU;let e=new Map;for(let n of t)e.set(n,(e.get(n)??0)+1);return n=>{let r=e.get(n);return r===void 0||r===0?{done:!1,hasNext:!0,next:n}:(e.set(n,r-1),Zo)}}function W1(...t){return Ue(o7,t)}var o7=(t,e)=>e.every(n=>n(t));function a7(...t){return Ue(c7,t)}var c7=(t,e)=>e.some(n=>n(t));function u7(...t){return Ue(l7,t)}function l7(t,e){if(e<1)throw new RangeError(`chunk: A chunk size of '${e.toString()}' would result in an infinite array`);if(t.length===0)return[];if(e>=t.length)return[[...t]];let n=Math.ceil(t.length/e),r=new Array(n);if(e===1)for(let[i,s]of t.entries())r[i]=[s];else for(let i=0;i<n;i+=1){let s=i*e;r[i]=t.slice(s,s+e)}return r}function G1(...t){return Ue(d7,t)}var d7=(t,{min:e,max:n})=>e!==void 0&&t<e?e:n!==void 0&&t>n?n:t,f7={reset:[0,0],bold:[1,22,"\x1B[22m\x1B[1m"],dim:[2,22,"\x1B[22m\x1B[2m"],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]},h7=Object.entries(f7);function nv(t){return String(t)}nv.open="",nv.close="";function p7(t=!1){let e=typeof process<"u"?process:void 0,n=e?.env||{},r=e?.argv||[];return!("NO_COLOR"in n||r.includes("--no-color"))&&("FORCE_COLOR"in n||r.includes("--color")||e?.platform==="win32"||t&&n.TERM!=="dumb"||"CI"in n)||typeof window<"u"&&!!window.chrome}function g7(t=!1){let e=p7(t),n=(o,a,c,u)=>{let l="",d=0;do l+=o.substring(d,u)+c,d=u+a.length,u=o.indexOf(a,d);while(~u);return l+o.substring(d)},r=(o,a,c=o)=>{let u=l=>{let d=String(l),f=d.indexOf(a,o.length);return~f?o+n(d,a,c,f)+a:o+d+a};return u.open=o,u.close=a,u},i={isColorSupported:e},s=o=>`\x1B[${o}m`;for(let[o,a]of h7)i[o]=e?r(s(a[0]),s(a[1]),a[2]):nv;return i}var rt=g7(pN(1)),te={};const m7=ni(gN);var ht={};Object.defineProperty(ht,"__esModule",{value:!0}),ht.thenable=ht.typedArray=ht.stringArray=ht.array=ht.func=ht.error=ht.number=ht.string=ht.boolean=void 0;function y7(t){return t===!0||t===!1}ht.boolean=y7;function z1(t){return typeof t=="string"||t instanceof String}ht.string=z1;function v7(t){return typeof t=="number"||t instanceof Number}ht.number=v7;function w7(t){return t instanceof Error}ht.error=w7;function H1(t){return typeof t=="function"}ht.func=H1;function K1(t){return Array.isArray(t)}ht.array=K1;function b7(t){return K1(t)&&t.every(e=>z1(e))}ht.stringArray=b7;function D7(t,e){return Array.isArray(t)&&t.every(e)}ht.typedArray=D7;function E7(t){return t&&H1(t.then)}ht.thenable=E7;var _e={},et={},mn={},rv={};const T7=ni(ON);var iv={},re={},V1;function Y1(){if(V1)return re;V1=1,Object.defineProperty(re,"__esModule",{value:!0}),re.Message=re.NotificationType9=re.NotificationType8=re.NotificationType7=re.NotificationType6=re.NotificationType5=re.NotificationType4=re.NotificationType3=re.NotificationType2=re.NotificationType1=re.NotificationType0=re.NotificationType=re.RequestType9=re.RequestType8=re.RequestType7=re.RequestType6=re.RequestType5=re.RequestType4=re.RequestType3=re.RequestType2=re.RequestType1=re.RequestType=re.RequestType0=re.AbstractMessageSignature=re.ParameterStructures=re.ResponseError=re.ErrorCodes=void 0;const t=St;var e;(function($){$.ParseError=-32700,$.InvalidRequest=-32600,$.MethodNotFound=-32601,$.InvalidParams=-32602,$.InternalError=-32603,$.jsonrpcReservedErrorRangeStart=-32099,$.serverErrorStart=-32099,$.MessageWriteError=-32099,$.MessageReadError=-32098,$.PendingResponseRejected=-32097,$.ConnectionInactive=-32096,$.ServerNotInitialized=-32002,$.UnknownErrorCode=-32001,$.jsonrpcReservedErrorRangeEnd=-32e3,$.serverErrorEnd=-32e3})(e||(re.ErrorCodes=e={}));class n extends Error{constructor(R,L,q){super(L),this.code=t.number(R)?R:e.UnknownErrorCode,this.data=q,Object.setPrototypeOf(this,n.prototype)}toJson(){const R={code:this.code,message:this.message};return this.data!==void 0&&(R.data=this.data),R}}re.ResponseError=n;class r{constructor(R){this.kind=R}static is(R){return R===r.auto||R===r.byName||R===r.byPosition}toString(){return this.kind}}re.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class i{constructor(R,L){this.method=R,this.numberOfParams=L}get parameterStructures(){return r.auto}}re.AbstractMessageSignature=i;class s extends i{constructor(R){super(R,0)}}re.RequestType0=s;class o extends i{constructor(R,L=r.auto){super(R,1),this._parameterStructures=L}get parameterStructures(){return this._parameterStructures}}re.RequestType=o;class a extends i{constructor(R,L=r.auto){super(R,1),this._parameterStructures=L}get parameterStructures(){return this._parameterStructures}}re.RequestType1=a;class c extends i{constructor(R){super(R,2)}}re.RequestType2=c;class u extends i{constructor(R){super(R,3)}}re.RequestType3=u;class l extends i{constructor(R){super(R,4)}}re.RequestType4=l;class d extends i{constructor(R){super(R,5)}}re.RequestType5=d;class f extends i{constructor(R){super(R,6)}}re.RequestType6=f;class h extends i{constructor(R){super(R,7)}}re.RequestType7=h;class p extends i{constructor(R){super(R,8)}}re.RequestType8=p;class y extends i{constructor(R){super(R,9)}}re.RequestType9=y;class T extends i{constructor(R,L=r.auto){super(R,1),this._parameterStructures=L}get parameterStructures(){return this._parameterStructures}}re.NotificationType=T;class b extends i{constructor(R){super(R,0)}}re.NotificationType0=b;class v extends i{constructor(R,L=r.auto){super(R,1),this._parameterStructures=L}get parameterStructures(){return this._parameterStructures}}re.NotificationType1=v;class D extends i{constructor(R){super(R,2)}}re.NotificationType2=D;class k extends i{constructor(R){super(R,3)}}re.NotificationType3=k;class P extends i{constructor(R){super(R,4)}}re.NotificationType4=P;class M extends i{constructor(R){super(R,5)}}re.NotificationType5=M;class I extends i{constructor(R){super(R,6)}}re.NotificationType6=I;class G extends i{constructor(R){super(R,7)}}re.NotificationType7=G;class U extends i{constructor(R){super(R,8)}}re.NotificationType8=U;class W extends i{constructor(R){super(R,9)}}re.NotificationType9=W;var A;return function($){function R(j){const z=j;return z&&t.string(z.method)&&(t.string(z.id)||t.number(z.id))}$.isRequest=R;function L(j){const z=j;return z&&t.string(z.method)&&j.id===void 0}$.isNotification=L;function q(j){const z=j;return z&&(z.result!==void 0||!!z.error)&&(t.string(z.id)||t.number(z.id)||z.id===null)}$.isResponse=q}(A||(re.Message=A={})),re}var fi={},X1;function J1(){if(X1)return fi;X1=1;var t;Object.defineProperty(fi,"__esModule",{value:!0}),fi.LRUCache=fi.LinkedMap=fi.Touch=void 0;var e;(function(i){i.None=0,i.First=1,i.AsOld=i.First,i.Last=2,i.AsNew=i.Last})(e||(fi.Touch=e={}));class n{constructor(){this[t]="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(s){return this._map.has(s)}get(s,o=e.None){const a=this._map.get(s);if(a)return o!==e.None&&this.touch(a,o),a.value}set(s,o,a=e.None){let c=this._map.get(s);if(c)c.value=o,a!==e.None&&this.touch(c,a);else{switch(c={key:s,value:o,next:void 0,previous:void 0},a){case e.None:this.addItemLast(c);break;case e.First:this.addItemFirst(c);break;case e.Last:this.addItemLast(c);break;default:this.addItemLast(c);break}this._map.set(s,c),this._size++}return this}delete(s){return!!this.remove(s)}remove(s){const o=this._map.get(s);if(o)return this._map.delete(s),this.removeItem(o),this._size--,o.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const s=this._head;return this._map.delete(s.key),this.removeItem(s),this._size--,s.value}forEach(s,o){const a=this._state;let c=this._head;for(;c;){if(o?s.bind(o)(c.value,c.key,this):s(c.value,c.key,this),this._state!==a)throw new Error("LinkedMap got modified during iteration.");c=c.next}}keys(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const c={value:o.key,done:!1};return o=o.next,c}else return{value:void 0,done:!0}}};return a}values(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const c={value:o.value,done:!1};return o=o.next,c}else return{value:void 0,done:!0}}};return a}entries(){const s=this._state;let o=this._head;const a={[Symbol.iterator]:()=>a,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(o){const c={value:[o.key,o.value],done:!1};return o=o.next,c}else return{value:void 0,done:!0}}};return a}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(s){if(s>=this.size)return;if(s===0){this.clear();return}let o=this._head,a=this.size;for(;o&&a>s;)this._map.delete(o.key),o=o.next,a--;this._head=o,this._size=a,o&&(o.previous=void 0),this._state++}addItemFirst(s){if(!this._head&&!this._tail)this._tail=s;else if(this._head)s.next=this._head,this._head.previous=s;else throw new Error("Invalid list");this._head=s,this._state++}addItemLast(s){if(!this._head&&!this._tail)this._head=s;else if(this._tail)s.previous=this._tail,this._tail.next=s;else throw new Error("Invalid list");this._tail=s,this._state++}removeItem(s){if(s===this._head&&s===this._tail)this._head=void 0,this._tail=void 0;else if(s===this._head){if(!s.next)throw new Error("Invalid list");s.next.previous=void 0,this._head=s.next}else if(s===this._tail){if(!s.previous)throw new Error("Invalid list");s.previous.next=void 0,this._tail=s.previous}else{const o=s.next,a=s.previous;if(!o||!a)throw new Error("Invalid list");o.previous=a,a.next=o}s.next=void 0,s.previous=void 0,this._state++}touch(s,o){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(o!==e.First&&o!==e.Last)){if(o===e.First){if(s===this._head)return;const a=s.next,c=s.previous;s===this._tail?(c.next=void 0,this._tail=c):(a.previous=c,c.next=a),s.previous=void 0,s.next=this._head,this._head.previous=s,this._head=s,this._state++}else if(o===e.Last){if(s===this._tail)return;const a=s.next,c=s.previous;s===this._head?(a.previous=void 0,this._head=a):(a.previous=c,c.next=a),s.next=void 0,s.previous=this._tail,this._tail.next=s,this._tail=s,this._state++}}}toJSON(){const s=[];return this.forEach((o,a)=>{s.push([a,o])}),s}fromJSON(s){this.clear();for(const[o,a]of s)this.set(o,a)}}fi.LinkedMap=n;class r extends n{constructor(s,o=1){super(),this._limit=s,this._ratio=Math.min(Math.max(0,o),1)}get limit(){return this._limit}set limit(s){this._limit=s,this.checkTrim()}get ratio(){return this._ratio}set ratio(s){this._ratio=Math.min(Math.max(0,s),1),this.checkTrim()}get(s,o=e.AsNew){return super.get(s,o)}peek(s){return super.get(s,e.None)}set(s,o){return super.set(s,o,e.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}return fi.LRUCache=r,fi}var su={},Z1;function R7(){if(Z1)return su;Z1=1,Object.defineProperty(su,"__esModule",{value:!0}),su.Disposable=void 0;var t;return function(e){function n(r){return{dispose:r}}e.create=n}(t||(su.Disposable=t={})),su}var Ys={},Q1;function S7(){if(Q1)return Ys;Q1=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.SharedArrayReceiverStrategy=Ys.SharedArraySenderStrategy=void 0;const t=Wi;var e;(function(o){o.Continue=0,o.Cancelled=1})(e||(e={}));class n{constructor(){this.buffers=new Map}enableCancellation(a){if(a.id===null)return;const c=new SharedArrayBuffer(4),u=new Int32Array(c,0,1);u[0]=e.Continue,this.buffers.set(a.id,c),a.$cancellationData=c}async sendCancellation(a,c){const u=this.buffers.get(c);if(u===void 0)return;const l=new Int32Array(u,0,1);Atomics.store(l,0,e.Cancelled)}cleanup(a){this.buffers.delete(a)}dispose(){this.buffers.clear()}}Ys.SharedArraySenderStrategy=n;class r{constructor(a){this.data=new Int32Array(a,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===e.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class i{constructor(a){this.token=new r(a)}cancel(){}dispose(){}}class s{constructor(){this.kind="request"}createCancellationTokenSource(a){const c=a.$cancellationData;return c===void 0?new t.CancellationTokenSource:new i(c)}}return Ys.SharedArrayReceiverStrategy=s,Ys}var hi={},ou={},e$;function t$(){if(e$)return ou;e$=1,Object.defineProperty(ou,"__esModule",{value:!0}),ou.Semaphore=void 0;const t=li;class e{constructor(r=1){if(r<=0)throw new Error("Capacity must be greater than 0");this._capacity=r,this._active=0,this._waiting=[]}lock(r){return new Promise((i,s)=>{this._waiting.push({thunk:r,resolve:i,reject:s}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const r=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const i=r.thunk();i instanceof Promise?i.then(s=>{this._active--,r.resolve(s),this.runNext()},s=>{this._active--,r.reject(s),this.runNext()}):(this._active--,r.resolve(i),this.runNext())}catch(i){this._active--,r.reject(i),this.runNext()}}}return ou.Semaphore=e,ou}var n$;function $7(){if(n$)return hi;n$=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.ReadableStreamMessageReader=hi.AbstractMessageReader=hi.MessageReader=void 0;const t=li,e=St,n=Cr,r=t$();var i;(function(c){function u(l){let d=l;return d&&e.func(d.listen)&&e.func(d.dispose)&&e.func(d.onError)&&e.func(d.onClose)&&e.func(d.onPartialMessage)}c.is=u})(i||(hi.MessageReader=i={}));class s{constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter,this.partialMessageEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(u){this.errorEmitter.fire(this.asError(u))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(u){this.partialMessageEmitter.fire(u)}asError(u){return u instanceof Error?u:new Error(`Reader received error. Reason: ${e.string(u.message)?u.message:"unknown"}`)}}hi.AbstractMessageReader=s;var o;(function(c){function u(l){let d,f;const h=new Map;let p;const y=new Map;if(l===void 0||typeof l=="string")d=l??"utf-8";else{if(d=l.charset??"utf-8",l.contentDecoder!==void 0&&(f=l.contentDecoder,h.set(f.name,f)),l.contentDecoders!==void 0)for(const T of l.contentDecoders)h.set(T.name,T);if(l.contentTypeDecoder!==void 0&&(p=l.contentTypeDecoder,y.set(p.name,p)),l.contentTypeDecoders!==void 0)for(const T of l.contentTypeDecoders)y.set(T.name,T)}return p===void 0&&(p=(0,t.default)().applicationJson.decoder,y.set(p.name,p)),{charset:d,contentDecoder:f,contentDecoders:h,contentTypeDecoder:p,contentTypeDecoders:y}}c.fromOptions=u})(o||(o={}));class a extends s{constructor(u,l){super(),this.readable=u,this.options=o.fromOptions(l),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new r.Semaphore(1)}set partialMessageTimeout(u){this._partialMessageTimeout=u}get partialMessageTimeout(){return this._partialMessageTimeout}listen(u){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=u;const l=this.readable.onData(d=>{this.onData(d)});return this.readable.onError(d=>this.fireError(d)),this.readable.onClose(()=>this.fireClose()),l}onData(u){try{for(this.buffer.append(u);;){if(this.nextMessageLength===-1){const d=this.buffer.tryReadHeaders(!0);if(!d)return;const f=d.get("content-length");if(!f){this.fireError(new Error(`Header must provide a Content-Length property.
126
- ${JSON.stringify(Object.fromEntries(d))}`));return}const h=parseInt(f);if(isNaN(h)){this.fireError(new Error(`Content-Length value must be a number. Got ${f}`));return}this.nextMessageLength=h}const l=this.buffer.tryReadBody(this.nextMessageLength);if(l===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const d=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(l):l,f=await this.options.contentTypeDecoder.decode(d,this.options);this.callback(f)}).catch(d=>{this.fireError(d)})}}catch(l){this.fireError(l)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((u,l)=>{this.partialMessageTimer=void 0,u===this.messageToken&&(this.firePartialMessage({messageToken:u,waitingTime:l}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return hi.ReadableStreamMessageReader=a,hi}var pi={},r$;function k7(){if(r$)return pi;r$=1,Object.defineProperty(pi,"__esModule",{value:!0}),pi.WriteableStreamMessageWriter=pi.AbstractMessageWriter=pi.MessageWriter=void 0;const t=li,e=St,n=t$(),r=Cr,i="Content-Length: ",s=`\r
127
- `;var o;(function(l){function d(f){let h=f;return h&&e.func(h.dispose)&&e.func(h.onClose)&&e.func(h.onError)&&e.func(h.write)}l.is=d})(o||(pi.MessageWriter=o={}));class a{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(d,f,h){this.errorEmitter.fire([this.asError(d),f,h])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(d){return d instanceof Error?d:new Error(`Writer received error. Reason: ${e.string(d.message)?d.message:"unknown"}`)}}pi.AbstractMessageWriter=a;var c;(function(l){function d(f){return f===void 0||typeof f=="string"?{charset:f??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:f.charset??"utf-8",contentEncoder:f.contentEncoder,contentTypeEncoder:f.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}l.fromOptions=d})(c||(c={}));class u extends a{constructor(d,f){super(),this.writable=d,this.options=c.fromOptions(f),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(h=>this.fireError(h)),this.writable.onClose(()=>this.fireClose())}async write(d){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(d,this.options).then(h=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(h):h).then(h=>{const p=[];return p.push(i,h.byteLength.toString(),s),p.push(s),this.doWrite(d,p,h)},h=>{throw this.fireError(h),h}))}async doWrite(d,f,h){try{return await this.writable.write(f.join(""),"ascii"),this.writable.write(h)}catch(p){return this.handleError(p,d),Promise.reject(p)}}handleError(d,f){this.errorCount++,this.fireError(d,f,this.errorCount)}end(){this.writable.end()}}return pi.WriteableStreamMessageWriter=u,pi}var au={},i$;function C7(){if(i$)return au;i$=1,Object.defineProperty(au,"__esModule",{value:!0}),au.AbstractMessageBuffer=void 0;const t=13,e=10,n=`\r
128
- `;class r{constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){const o=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(o),this._totalLength+=o.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let o=0,a=0,c=0,u=0;e:for(;a<this._chunks.length;){const h=this._chunks[a];for(c=0;c<h.length;){switch(h[c]){case t:switch(o){case 0:o=1;break;case 2:o=3;break;default:o=0}break;case e:switch(o){case 1:o=2;break;case 3:o=4,c++;break e;default:o=0}break;default:o=0}c++}u+=h.byteLength,a++}if(o!==4)return;const l=this._read(u+c),d=new Map,f=this.toString(l,"ascii").split(n);if(f.length<2)return d;for(let h=0;h<f.length-2;h++){const p=f[h],y=p.indexOf(":");if(y===-1)throw new Error(`Message header must separate key and value using ':'
129
- ${p}`);const T=p.substr(0,y),b=p.substr(y+1).trim();d.set(s?T.toLowerCase():T,b)}return d}tryReadBody(s){if(!(this._totalLength<s))return this._read(s)}get numberOfBytes(){return this._totalLength}_read(s){if(s===0)return this.emptyBuffer();if(s>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===s){const u=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(u)}if(this._chunks[0].byteLength>s){const u=this._chunks[0],l=this.asNative(u,s);return this._chunks[0]=u.slice(s),this._totalLength-=s,l}const o=this.allocNative(s);let a=0,c=0;for(;s>0;){const u=this._chunks[c];if(u.byteLength>s){const l=u.slice(0,s);o.set(l,a),a+=s,this._chunks[c]=u.slice(s),this._totalLength-=s,s-=s}else o.set(u,a),a+=u.byteLength,this._chunks.shift(),this._totalLength-=u.byteLength,s-=u.byteLength}return o}}return au.AbstractMessageBuffer=r,au}var sv={},s$;function _7(){return s$||(s$=1,function(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;const e=li,n=St,r=Y1(),i=J1(),s=Cr,o=Wi;var a;(function(R){R.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var c;(function(R){function L(q){return typeof q=="string"||typeof q=="number"}R.is=L})(c||(t.ProgressToken=c={}));var u;(function(R){R.type=new r.NotificationType("$/progress")})(u||(u={}));class l{constructor(){}}t.ProgressType=l;var d;(function(R){function L(q){return n.func(q)}R.is=L})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function(R){R[R.Off=0]="Off",R[R.Messages=1]="Messages",R[R.Compact=2]="Compact",R[R.Verbose=3]="Verbose"})(f||(t.Trace=f={}));var h;(function(R){R.Off="off",R.Messages="messages",R.Compact="compact",R.Verbose="verbose"})(h||(t.TraceValues=h={})),function(R){function L(j){if(!n.string(j))return R.Off;switch(j=j.toLowerCase(),j){case"off":return R.Off;case"messages":return R.Messages;case"compact":return R.Compact;case"verbose":return R.Verbose;default:return R.Off}}R.fromString=L;function q(j){switch(j){case R.Off:return"off";case R.Messages:return"messages";case R.Compact:return"compact";case R.Verbose:return"verbose";default:return"off"}}R.toString=q}(f||(t.Trace=f={}));var p;(function(R){R.Text="text",R.JSON="json"})(p||(t.TraceFormat=p={})),function(R){function L(q){return n.string(q)?(q=q.toLowerCase(),q==="json"?R.JSON:R.Text):R.Text}R.fromString=L}(p||(t.TraceFormat=p={}));var y;(function(R){R.type=new r.NotificationType("$/setTrace")})(y||(t.SetTraceNotification=y={}));var T;(function(R){R.type=new r.NotificationType("$/logTrace")})(T||(t.LogTraceNotification=T={}));var b;(function(R){R[R.Closed=1]="Closed",R[R.Disposed=2]="Disposed",R[R.AlreadyListening=3]="AlreadyListening"})(b||(t.ConnectionErrors=b={}));class v extends Error{constructor(L,q){super(q),this.code=L,Object.setPrototypeOf(this,v.prototype)}}t.ConnectionError=v;var D;(function(R){function L(q){const j=q;return j&&n.func(j.cancelUndispatched)}R.is=L})(D||(t.ConnectionStrategy=D={}));var k;(function(R){function L(q){const j=q;return j&&(j.kind===void 0||j.kind==="id")&&n.func(j.createCancellationTokenSource)&&(j.dispose===void 0||n.func(j.dispose))}R.is=L})(k||(t.IdCancellationReceiverStrategy=k={}));var P;(function(R){function L(q){const j=q;return j&&j.kind==="request"&&n.func(j.createCancellationTokenSource)&&(j.dispose===void 0||n.func(j.dispose))}R.is=L})(P||(t.RequestCancellationReceiverStrategy=P={}));var M;(function(R){R.Message=Object.freeze({createCancellationTokenSource(q){return new o.CancellationTokenSource}});function L(q){return k.is(q)||P.is(q)}R.is=L})(M||(t.CancellationReceiverStrategy=M={}));var I;(function(R){R.Message=Object.freeze({sendCancellation(q,j){return q.sendNotification(a.type,{id:j})},cleanup(q){}});function L(q){const j=q;return j&&n.func(j.sendCancellation)&&n.func(j.cleanup)}R.is=L})(I||(t.CancellationSenderStrategy=I={}));var G;(function(R){R.Message=Object.freeze({receiver:M.Message,sender:I.Message});function L(q){const j=q;return j&&M.is(j.receiver)&&I.is(j.sender)}R.is=L})(G||(t.CancellationStrategy=G={}));var U;(function(R){function L(q){const j=q;return j&&n.func(j.handleMessage)}R.is=L})(U||(t.MessageStrategy=U={}));var W;(function(R){function L(q){const j=q;return j&&(G.is(j.cancellationStrategy)||D.is(j.connectionStrategy)||U.is(j.messageStrategy))}R.is=L})(W||(t.ConnectionOptions=W={}));var A;(function(R){R[R.New=1]="New",R[R.Listening=2]="Listening",R[R.Closed=3]="Closed",R[R.Disposed=4]="Disposed"})(A||(A={}));function $(R,L,q,j){const z=q!==void 0?q:t.NullLogger;let Ne=0,J=0,B=0;const me="2.0";let Nt;const sn=new Map;let He;const Dn=new Map,qe=new Map;let ut,wt=new i.LinkedMap,We=new Map,bt=new Set,tt=new Map,fe=f.Off,st=p.Text,Me,Ot=A.New;const qr=new s.Emitter,vi=new s.Emitter,wi=new s.Emitter,bi=new s.Emitter,Di=new s.Emitter,on=j&&j.cancellationStrategy?j.cancellationStrategy:G.Message;function Ei(E){if(E===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+E.toString()}function ys(E){return E===null?"res-unknown-"+(++B).toString():"res-"+E.toString()}function vs(){return"not-"+(++J).toString()}function Wr(E,F){r.Message.isRequest(F)?E.set(Ei(F.id),F):r.Message.isResponse(F)?E.set(ys(F.id),F):E.set(vs(),F)}function ws(E){}function Ti(){return Ot===A.Listening}function Ri(){return Ot===A.Closed}function An(){return Ot===A.Disposed}function Si(){(Ot===A.New||Ot===A.Listening)&&(Ot=A.Closed,vi.fire(void 0))}function bs(E){qr.fire([E,void 0,void 0])}function Ds(E){qr.fire(E)}R.onClose(Si),R.onError(bs),L.onClose(Si),L.onError(Ds);function $i(){ut||wt.size===0||(ut=(0,e.default)().timer.setImmediate(()=>{ut=void 0,Es()}))}function ki(E){r.Message.isRequest(E)?Rs(E):r.Message.isNotification(E)?Ci(E):r.Message.isResponse(E)?Ss(E):_i(E)}function Es(){if(wt.size===0)return;const E=wt.shift();try{const F=j?.messageStrategy;U.is(F)?F.handleMessage(E,ki):ki(E)}finally{$i()}}const Ts=E=>{try{if(r.Message.isNotification(E)&&E.method===a.type.method){const F=E.params.id,H=Ei(F),Y=wt.get(H);if(r.Message.isRequest(Y)){const ye=j?.connectionStrategy,Ae=ye&&ye.cancelUndispatched?ye.cancelUndispatched(Y,ws):void 0;if(Ae&&(Ae.error!==void 0||Ae.result!==void 0)){wt.delete(H),tt.delete(F),Ae.id=Y.id,pr(Ae,E.method,Date.now()),L.write(Ae).catch(()=>z.error("Sending response for canceled message failed."));return}}const be=tt.get(F);if(be!==void 0){be.cancel(),Gr(E);return}else bt.add(F)}Wr(wt,E)}finally{$i()}};function Rs(E){if(An())return;function F(pe,Be,Ie){const Ct={jsonrpc:me,id:E.id};pe instanceof r.ResponseError?Ct.error=pe.toJson():Ct.result=pe===void 0?null:pe,pr(Ct,Be,Ie),L.write(Ct).catch(()=>z.error("Sending response failed."))}function H(pe,Be,Ie){const Ct={jsonrpc:me,id:E.id,error:pe.toJson()};pr(Ct,Be,Ie),L.write(Ct).catch(()=>z.error("Sending response failed."))}function Y(pe,Be,Ie){pe===void 0&&(pe=null);const Ct={jsonrpc:me,id:E.id,result:pe};pr(Ct,Be,Ie),L.write(Ct).catch(()=>z.error("Sending response failed."))}Cs(E);const be=sn.get(E.method);let ye,Ae;be&&(ye=be.type,Ae=be.handler);const ne=Date.now();if(Ae||Nt){const pe=E.id??String(Date.now()),Be=k.is(on.receiver)?on.receiver.createCancellationTokenSource(pe):on.receiver.createCancellationTokenSource(E);E.id!==null&&bt.has(E.id)&&Be.cancel(),E.id!==null&&tt.set(pe,Be);try{let Ie;if(Ae)if(E.params===void 0){if(ye!==void 0&&ye.numberOfParams!==0){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines ${ye.numberOfParams} params but received none.`),E.method,ne);return}Ie=Ae(Be.token)}else if(Array.isArray(E.params)){if(ye!==void 0&&ye.parameterStructures===r.ParameterStructures.byName){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by name but received parameters by position`),E.method,ne);return}Ie=Ae(...E.params,Be.token)}else{if(ye!==void 0&&ye.parameterStructures===r.ParameterStructures.byPosition){H(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${E.method} defines parameters by position but received parameters by name`),E.method,ne);return}Ie=Ae(E.params,Be.token)}else Nt&&(Ie=Nt(E.method,E.params,Be.token));const Ct=Ie;Ie?Ct.then?Ct.then(Vt=>{tt.delete(pe),F(Vt,E.method,ne)},Vt=>{tt.delete(pe),Vt instanceof r.ResponseError?H(Vt,E.method,ne):Vt&&n.string(Vt.message)?H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${Vt.message}`),E.method,ne):H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,ne)}):(tt.delete(pe),F(Ie,E.method,ne)):(tt.delete(pe),Y(Ie,E.method,ne))}catch(Ie){tt.delete(pe),Ie instanceof r.ResponseError?F(Ie,E.method,ne):Ie&&n.string(Ie.message)?H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed with message: ${Ie.message}`),E.method,ne):H(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${E.method} failed unexpectedly without providing any details.`),E.method,ne)}}else H(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${E.method}`),E.method,ne)}function Ss(E){if(!An())if(E.id===null)E.error?z.error(`Received response message without id: Error is:
130
- ${JSON.stringify(E.error,void 0,4)}`):z.error("Received response message without id. No further error information provided.");else{const F=E.id,H=We.get(F);if(_s(E,H),H!==void 0){We.delete(F);try{if(E.error){const Y=E.error;H.reject(new r.ResponseError(Y.code,Y.message,Y.data))}else if(E.result!==void 0)H.resolve(E.result);else throw new Error("Should never happen.")}catch(Y){Y.message?z.error(`Response handler '${H.method}' failed with message: ${Y.message}`):z.error(`Response handler '${H.method}' failed unexpectedly.`)}}}}function Ci(E){if(An())return;let F,H;if(E.method===a.type.method){const Y=E.params.id;bt.delete(Y),Gr(E);return}else{const Y=Dn.get(E.method);Y&&(H=Y.handler,F=Y.type)}if(H||He)try{if(Gr(E),H)if(E.params===void 0)F!==void 0&&F.numberOfParams!==0&&F.parameterStructures!==r.ParameterStructures.byName&&z.error(`Notification ${E.method} defines ${F.numberOfParams} params but received none.`),H();else if(Array.isArray(E.params)){const Y=E.params;E.method===u.type.method&&Y.length===2&&c.is(Y[0])?H({token:Y[0],value:Y[1]}):(F!==void 0&&(F.parameterStructures===r.ParameterStructures.byName&&z.error(`Notification ${E.method} defines parameters by name but received parameters by position`),F.numberOfParams!==E.params.length&&z.error(`Notification ${E.method} defines ${F.numberOfParams} params but received ${Y.length} arguments`)),H(...Y))}else F!==void 0&&F.parameterStructures===r.ParameterStructures.byPosition&&z.error(`Notification ${E.method} defines parameters by position but received parameters by name`),H(E.params);else He&&He(E.method,E.params)}catch(Y){Y.message?z.error(`Notification handler '${E.method}' failed with message: ${Y.message}`):z.error(`Notification handler '${E.method}' failed unexpectedly.`)}else wi.fire(E)}function _i(E){if(!E){z.error("Received empty message.");return}z.error(`Received message which is neither a response nor a notification message:
131
- ${JSON.stringify(E,null,4)}`);const F=E;if(n.string(F.id)||n.number(F.id)){const H=F.id,Y=We.get(H);Y&&Y.reject(new Error("The received response has neither a result nor an error property."))}}function an(E){if(E!=null)switch(fe){case f.Verbose:return JSON.stringify(E,null,4);case f.Compact:return JSON.stringify(E);default:return}}function $s(E){if(!(fe===f.Off||!Me))if(st===p.Text){let F;(fe===f.Verbose||fe===f.Compact)&&E.params&&(F=`Params: ${an(E.params)}
132
-
133
- `),Me.log(`Sending request '${E.method} - (${E.id})'.`,F)}else In("send-request",E)}function ks(E){if(!(fe===f.Off||!Me))if(st===p.Text){let F;(fe===f.Verbose||fe===f.Compact)&&(E.params?F=`Params: ${an(E.params)}
134
-
135
- `:F=`No parameters provided.
136
-
137
- `),Me.log(`Sending notification '${E.method}'.`,F)}else In("send-notification",E)}function pr(E,F,H){if(!(fe===f.Off||!Me))if(st===p.Text){let Y;(fe===f.Verbose||fe===f.Compact)&&(E.error&&E.error.data?Y=`Error data: ${an(E.error.data)}
138
-
139
- `:E.result?Y=`Result: ${an(E.result)}
140
-
141
- `:E.error===void 0&&(Y=`No result returned.
142
-
143
- `)),Me.log(`Sending response '${F} - (${E.id})'. Processing request took ${Date.now()-H}ms`,Y)}else In("send-response",E)}function Cs(E){if(!(fe===f.Off||!Me))if(st===p.Text){let F;(fe===f.Verbose||fe===f.Compact)&&E.params&&(F=`Params: ${an(E.params)}
144
-
145
- `),Me.log(`Received request '${E.method} - (${E.id})'.`,F)}else In("receive-request",E)}function Gr(E){if(!(fe===f.Off||!Me||E.method===T.type.method))if(st===p.Text){let F;(fe===f.Verbose||fe===f.Compact)&&(E.params?F=`Params: ${an(E.params)}
146
-
147
- `:F=`No parameters provided.
148
-
149
- `),Me.log(`Received notification '${E.method}'.`,F)}else In("receive-notification",E)}function _s(E,F){if(!(fe===f.Off||!Me))if(st===p.Text){let H;if((fe===f.Verbose||fe===f.Compact)&&(E.error&&E.error.data?H=`Error data: ${an(E.error.data)}
150
-
151
- `:E.result?H=`Result: ${an(E.result)}
152
-
153
- `:E.error===void 0&&(H=`No result returned.
154
-
155
- `)),F){const Y=E.error?` Request failed: ${E.error.message} (${E.error.code}).`:"";Me.log(`Received response '${F.method} - (${E.id})' in ${Date.now()-F.timerStart}ms.${Y}`,H)}else Me.log(`Received response ${E.id} without active response promise.`,H)}else In("receive-response",E)}function In(E,F){if(!Me||fe===f.Off)return;const H={isLSPMessage:!0,type:E,message:F,timestamp:Date.now()};Me.log(H)}function Yn(){if(Ri())throw new v(b.Closed,"Connection is closed.");if(An())throw new v(b.Disposed,"Connection is disposed.")}function vo(){if(Ti())throw new v(b.AlreadyListening,"Connection is already listening")}function x(){if(!Ti())throw new Error("Call listen() first.")}function w(E){return E===void 0?null:E}function C(E){if(E!==null)return E}function g(E){return E!=null&&!Array.isArray(E)&&typeof E=="object"}function S(E,F){switch(E){case r.ParameterStructures.auto:return g(F)?C(F):[w(F)];case r.ParameterStructures.byName:if(!g(F))throw new Error("Received parameters by name but param is not an object literal.");return C(F);case r.ParameterStructures.byPosition:return[w(F)];default:throw new Error(`Unknown parameter structure ${E.toString()}`)}}function m(E,F){let H;const Y=E.numberOfParams;switch(Y){case 0:H=void 0;break;case 1:H=S(E.parameterStructures,F[0]);break;default:H=[];for(let be=0;be<F.length&&be<Y;be++)H.push(w(F[be]));if(F.length<Y)for(let be=F.length;be<Y;be++)H.push(null);break}return H}const _={sendNotification:(E,...F)=>{Yn();let H,Y;if(n.string(E)){H=E;const ye=F[0];let Ae=0,ne=r.ParameterStructures.auto;r.ParameterStructures.is(ye)&&(Ae=1,ne=ye);let pe=F.length;const Be=pe-Ae;switch(Be){case 0:Y=void 0;break;case 1:Y=S(ne,F[Ae]);break;default:if(ne===r.ParameterStructures.byName)throw new Error(`Received ${Be} parameters for 'by Name' notification parameter structure.`);Y=F.slice(Ae,pe).map(Ie=>w(Ie));break}}else{const ye=F;H=E.method,Y=m(E,ye)}const be={jsonrpc:me,method:H,params:Y};return ks(be),L.write(be).catch(ye=>{throw z.error("Sending notification failed."),ye})},onNotification:(E,F)=>{Yn();let H;return n.func(E)?He=E:F&&(n.string(E)?(H=E,Dn.set(E,{type:void 0,handler:F})):(H=E.method,Dn.set(E.method,{type:E,handler:F}))),{dispose:()=>{H!==void 0?Dn.delete(H):He=void 0}}},onProgress:(E,F,H)=>{if(qe.has(F))throw new Error(`Progress handler for token ${F} already registered`);return qe.set(F,H),{dispose:()=>{qe.delete(F)}}},sendProgress:(E,F,H)=>_.sendNotification(u.type,{token:F,value:H}),onUnhandledProgress:bi.event,sendRequest:(E,...F)=>{Yn(),x();let H,Y,be;if(n.string(E)){H=E;const pe=F[0],Be=F[F.length-1];let Ie=0,Ct=r.ParameterStructures.auto;r.ParameterStructures.is(pe)&&(Ie=1,Ct=pe);let Vt=F.length;o.CancellationToken.is(Be)&&(Vt=Vt-1,be=Be);const gr=Vt-Ie;switch(gr){case 0:Y=void 0;break;case 1:Y=S(Ct,F[Ie]);break;default:if(Ct===r.ParameterStructures.byName)throw new Error(`Received ${gr} parameters for 'by Name' request parameter structure.`);Y=F.slice(Ie,Vt).map(oN=>w(oN));break}}else{const pe=F;H=E.method,Y=m(E,pe);const Be=E.numberOfParams;be=o.CancellationToken.is(pe[Be])?pe[Be]:void 0}const ye=Ne++;let Ae;be&&(Ae=be.onCancellationRequested(()=>{const pe=on.sender.sendCancellation(_,ye);return pe===void 0?(z.log(`Received no promise from cancellation strategy when cancelling id ${ye}`),Promise.resolve()):pe.catch(()=>{z.log(`Sending cancellation messages for id ${ye} failed`)})}));const ne={jsonrpc:me,id:ye,method:H,params:Y};return $s(ne),typeof on.sender.enableCancellation=="function"&&on.sender.enableCancellation(ne),new Promise(async(pe,Be)=>{const Ie=gr=>{pe(gr),on.sender.cleanup(ye),Ae?.dispose()},Ct=gr=>{Be(gr),on.sender.cleanup(ye),Ae?.dispose()},Vt={method:H,timerStart:Date.now(),resolve:Ie,reject:Ct};try{await L.write(ne),We.set(ye,Vt)}catch(gr){throw z.error("Sending request failed."),Vt.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,gr.message?gr.message:"Unknown reason")),gr}})},onRequest:(E,F)=>{Yn();let H=null;return d.is(E)?(H=void 0,Nt=E):n.string(E)?(H=null,F!==void 0&&(H=E,sn.set(E,{handler:F,type:void 0}))):F!==void 0&&(H=E.method,sn.set(E.method,{type:E,handler:F})),{dispose:()=>{H!==null&&(H!==void 0?sn.delete(H):Nt=void 0)}}},hasPendingResponse:()=>We.size>0,trace:async(E,F,H)=>{let Y=!1,be=p.Text;H!==void 0&&(n.boolean(H)?Y=H:(Y=H.sendNotification||!1,be=H.traceFormat||p.Text)),fe=E,st=be,fe===f.Off?Me=void 0:Me=F,Y&&!Ri()&&!An()&&await _.sendNotification(y.type,{value:f.toString(E)})},onError:qr.event,onClose:vi.event,onUnhandledNotification:wi.event,onDispose:Di.event,end:()=>{L.end()},dispose:()=>{if(An())return;Ot=A.Disposed,Di.fire(void 0);const E=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const F of We.values())F.reject(E);We=new Map,tt=new Map,bt=new Set,wt=new i.LinkedMap,n.func(L.dispose)&&L.dispose(),n.func(R.dispose)&&R.dispose()},listen:()=>{Yn(),vo(),Ot=A.Listening,R.listen(Ts)},inspect:()=>{(0,e.default)().console.log("inspect")}};return _.onNotification(T.type,E=>{if(fe===f.Off||!Me)return;const F=fe===f.Verbose||fe===f.Compact;Me.log(E.message,F?E.verbose:void 0)}),_.onNotification(u.type,E=>{const F=qe.get(E.token);F?F(E.value):bi.fire(E)}),_}t.createMessageConnection=$}(sv)),sv}var o$;function ov(){return o$||(o$=1,function(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;const e=Y1();Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return e.Message}}),Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return e.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return e.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return e.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return e.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,get:function(){return e.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return e.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return e.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return e.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return e.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return e.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return e.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return e.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return e.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return e.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return e.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return e.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return e.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return e.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return e.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return e.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return e.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return e.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return e.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return e.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return e.ParameterStructures}});const n=J1();Object.defineProperty(t,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(t,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(t,"Touch",{enumerable:!0,get:function(){return n.Touch}});const r=R7();Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const i=Cr;Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return i.Emitter}});const s=Wi;Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const o=S7();Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});const a=$7();Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const c=k7();Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});const u=C7();Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u.AbstractMessageBuffer}});const l=_7();Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return l.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return l.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return l.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return l.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return l.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return l.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return l.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return l.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return l.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return l.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return l.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return l.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return l.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return l.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return l.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return l.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",{enumerable:!0,get:function(){return l.MessageStrategy}});const d=li;t.RAL=d.default}(iv)),iv}Object.defineProperty(rv,"__esModule",{value:!0});const a$=T7,gi=ov();class ig extends gi.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return ig.emptyBuffer}fromString(e,n){return Buffer.from(e,n)}toString(e,n){return e instanceof Buffer?e.toString(n):new a$.TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,n):Buffer.from(e,0,n)}allocNative(e){return Buffer.allocUnsafe(e)}}ig.emptyBuffer=Buffer.allocUnsafe(0);class A7{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),gi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),gi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),gi.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),gi.Disposable.create(()=>this.stream.off("data",e))}}class I7{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),gi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),gi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),gi.Disposable.create(()=>this.stream.off("end",e))}write(e,n){return new Promise((r,i)=>{const s=o=>{o==null?r():i(o)};typeof e=="string"?this.stream.write(e,n,s):this.stream.write(e,s)})}end(){this.stream.end()}}const c$=Object.freeze({messageBuffer:Object.freeze({create:t=>new ig(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(n){return Promise.reject(n)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new a$.TextDecoder(e.charset).decode(t)))}catch(n){return Promise.reject(n)}}})}),stream:Object.freeze({asReadableStream:t=>new A7(t),asWritableStream:t=>new I7(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){const r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){const n=setImmediate(t,...e);return{dispose:()=>clearImmediate(n)}},setInterval(t,e,...n){const r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function av(){return c$}(function(t){function e(){gi.RAL.install(c$)}t.install=e})(av||(av={})),rv.default=av;const cu=ni(kN),x7=ni(FN),u$=ni(LN),P7=ni(MN);(function(t){var e=mt&&mt.__createBinding||(Object.create?function(A,$,R,L){L===void 0&&(L=R);var q=Object.getOwnPropertyDescriptor($,R);(!q||("get"in q?!$.__esModule:q.writable||q.configurable))&&(q={enumerable:!0,get:function(){return $[R]}}),Object.defineProperty(A,L,q)}:function(A,$,R,L){L===void 0&&(L=R),A[L]=$[R]}),n=mt&&mt.__exportStar||function(A,$){for(var R in A)R!=="default"&&!Object.prototype.hasOwnProperty.call($,R)&&e($,A,R)};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;const r=rv;r.default.install();const i=cu,s=x7,o=u$,a=P7,c=ov();n(ov(),t);class u extends c.AbstractMessageReader{constructor($){super(),this.process=$;let R=this.process;R.on("error",L=>this.fireError(L)),R.on("close",()=>this.fireClose())}listen($){return this.process.on("message",$),c.Disposable.create(()=>this.process.off("message",$))}}t.IPCMessageReader=u;class l extends c.AbstractMessageWriter{constructor($){super(),this.process=$,this.errorCount=0;const R=this.process;R.on("error",L=>this.fireError(L)),R.on("close",()=>this.fireClose)}write($){try{return typeof this.process.send=="function"&&this.process.send($,void 0,void 0,R=>{R?(this.errorCount++,this.handleError(R,$)):this.errorCount=0}),Promise.resolve()}catch(R){return this.handleError(R,$),Promise.reject(R)}}handleError($,R){this.errorCount++,this.fireError($,R,this.errorCount)}end(){}}t.IPCMessageWriter=l;class d extends c.AbstractMessageReader{constructor($){super(),this.onData=new c.Emitter,$.on("close",()=>this.fireClose),$.on("error",R=>this.fireError(R)),$.on("message",R=>{this.onData.fire(R)})}listen($){return this.onData.event($)}}t.PortMessageReader=d;class f extends c.AbstractMessageWriter{constructor($){super(),this.port=$,this.errorCount=0,$.on("close",()=>this.fireClose()),$.on("error",R=>this.fireError(R))}write($){try{return this.port.postMessage($),Promise.resolve()}catch(R){return this.handleError(R,$),Promise.reject(R)}}handleError($,R){this.errorCount++,this.fireError($,R,this.errorCount)}end(){}}t.PortMessageWriter=f;class h extends c.ReadableStreamMessageReader{constructor($,R="utf-8"){super((0,r.default)().stream.asReadableStream($),R)}}t.SocketMessageReader=h;class p extends c.WriteableStreamMessageWriter{constructor($,R){super((0,r.default)().stream.asWritableStream($),R),this.socket=$}dispose(){super.dispose(),this.socket.destroy()}}t.SocketMessageWriter=p;class y extends c.ReadableStreamMessageReader{constructor($,R){super((0,r.default)().stream.asReadableStream($),R)}}t.StreamMessageReader=y;class T extends c.WriteableStreamMessageWriter{constructor($,R){super((0,r.default)().stream.asWritableStream($),R)}}t.StreamMessageWriter=T;const b=process.env.XDG_RUNTIME_DIR,v=new Map([["linux",107],["darwin",103]]);function D(){const A=(0,o.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${A}-sock`;let $;b?$=i.join(b,`vscode-ipc-${A}.sock`):$=i.join(s.tmpdir(),`vscode-${A}.sock`);const R=v.get(process.platform);return R!==void 0&&$.length>R&&(0,r.default)().console.warn(`WARNING: IPC handle "${$}" is longer than ${R} characters.`),$}t.generateRandomPipeName=D;function k(A,$="utf-8"){let R;const L=new Promise((q,j)=>{R=q});return new Promise((q,j)=>{let z=(0,a.createServer)(Ne=>{z.close(),R([new h(Ne,$),new p(Ne,$)])});z.on("error",j),z.listen(A,()=>{z.removeListener("error",j),q({onConnected:()=>L})})})}t.createClientPipeTransport=k;function P(A,$="utf-8"){const R=(0,a.createConnection)(A);return[new h(R,$),new p(R,$)]}t.createServerPipeTransport=P;function M(A,$="utf-8"){let R;const L=new Promise((q,j)=>{R=q});return new Promise((q,j)=>{const z=(0,a.createServer)(Ne=>{z.close(),R([new h(Ne,$),new p(Ne,$)])});z.on("error",j),z.listen(A,"127.0.0.1",()=>{z.removeListener("error",j),q({onConnected:()=>L})})})}t.createClientSocketTransport=M;function I(A,$="utf-8"){const R=(0,a.createConnection)(A,"127.0.0.1");return[new h(R,$),new p(R,$)]}t.createServerSocketTransport=I;function G(A){const $=A;return $.read!==void 0&&$.addListener!==void 0}function U(A){const $=A;return $.write!==void 0&&$.addListener!==void 0}function W(A,$,R,L){R||(R=c.NullLogger);const q=G(A)?new y(A):A,j=U($)?new T($):$;return c.ConnectionStrategy.is(L)&&(L={connectionStrategy:L}),(0,c.createMessageConnection)(q,j,R,L)}t.createMessageConnection=W})(mn);var l$=mn,d$={};function f$(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var cv={exports:{}};(function(t,e){(function(n){{var r=n(f$,e);r!==void 0&&(t.exports=r)}})(function(n,r){Object.defineProperty(r,"__esModule",{value:!0}),r.TextDocument=r.EOL=r.WorkspaceFolder=r.InlineCompletionContext=r.SelectedCompletionInfo=r.InlineCompletionTriggerKind=r.InlineCompletionList=r.InlineCompletionItem=r.StringValue=r.InlayHint=r.InlayHintLabelPart=r.InlayHintKind=r.InlineValueContext=r.InlineValueEvaluatableExpression=r.InlineValueVariableLookup=r.InlineValueText=r.SemanticTokens=r.SemanticTokenModifiers=r.SemanticTokenTypes=r.SelectionRange=r.DocumentLink=r.FormattingOptions=r.CodeLens=r.CodeAction=r.CodeActionContext=r.CodeActionTriggerKind=r.CodeActionKind=r.DocumentSymbol=r.WorkspaceSymbol=r.SymbolInformation=r.SymbolTag=r.SymbolKind=r.DocumentHighlight=r.DocumentHighlightKind=r.SignatureInformation=r.ParameterInformation=r.Hover=r.MarkedString=r.CompletionList=r.CompletionItem=r.CompletionItemLabelDetails=r.InsertTextMode=r.InsertReplaceEdit=r.CompletionItemTag=r.InsertTextFormat=r.CompletionItemKind=r.MarkupContent=r.MarkupKind=r.TextDocumentItem=r.OptionalVersionedTextDocumentIdentifier=r.VersionedTextDocumentIdentifier=r.TextDocumentIdentifier=r.WorkspaceChange=r.WorkspaceEdit=r.DeleteFile=r.RenameFile=r.CreateFile=r.TextDocumentEdit=r.AnnotatedTextEdit=r.ChangeAnnotationIdentifier=r.ChangeAnnotation=r.TextEdit=r.Command=r.Diagnostic=r.CodeDescription=r.DiagnosticTag=r.DiagnosticSeverity=r.DiagnosticRelatedInformation=r.FoldingRange=r.FoldingRangeKind=r.ColorPresentation=r.ColorInformation=r.Color=r.LocationLink=r.Location=r.Range=r.Position=r.uinteger=r.integer=r.URI=r.DocumentUri=void 0;var i;(function(w){function C(g){return typeof g=="string"}w.is=C})(i||(r.DocumentUri=i={}));var s;(function(w){function C(g){return typeof g=="string"}w.is=C})(s||(r.URI=s={}));var o;(function(w){w.MIN_VALUE=-2147483648,w.MAX_VALUE=2147483647;function C(g){return typeof g=="number"&&w.MIN_VALUE<=g&&g<=w.MAX_VALUE}w.is=C})(o||(r.integer=o={}));var a;(function(w){w.MIN_VALUE=0,w.MAX_VALUE=2147483647;function C(g){return typeof g=="number"&&w.MIN_VALUE<=g&&g<=w.MAX_VALUE}w.is=C})(a||(r.uinteger=a={}));var c;(function(w){function C(S,m){return S===Number.MAX_VALUE&&(S=a.MAX_VALUE),m===Number.MAX_VALUE&&(m=a.MAX_VALUE),{line:S,character:m}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&x.uinteger(m.line)&&x.uinteger(m.character)}w.is=g})(c||(r.Position=c={}));var u;(function(w){function C(S,m,_,E){if(x.uinteger(S)&&x.uinteger(m)&&x.uinteger(_)&&x.uinteger(E))return{start:c.create(S,m),end:c.create(_,E)};if(c.is(S)&&c.is(m))return{start:S,end:m};throw new Error("Range#create called with invalid arguments[".concat(S,", ").concat(m,", ").concat(_,", ").concat(E,"]"))}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&c.is(m.start)&&c.is(m.end)}w.is=g})(u||(r.Range=u={}));var l;(function(w){function C(S,m){return{uri:S,range:m}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&u.is(m.range)&&(x.string(m.uri)||x.undefined(m.uri))}w.is=g})(l||(r.Location=l={}));var d;(function(w){function C(S,m,_,E){return{targetUri:S,targetRange:m,targetSelectionRange:_,originSelectionRange:E}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&u.is(m.targetRange)&&x.string(m.targetUri)&&u.is(m.targetSelectionRange)&&(u.is(m.originSelectionRange)||x.undefined(m.originSelectionRange))}w.is=g})(d||(r.LocationLink=d={}));var f;(function(w){function C(S,m,_,E){return{red:S,green:m,blue:_,alpha:E}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&x.numberRange(m.red,0,1)&&x.numberRange(m.green,0,1)&&x.numberRange(m.blue,0,1)&&x.numberRange(m.alpha,0,1)}w.is=g})(f||(r.Color=f={}));var h;(function(w){function C(S,m){return{range:S,color:m}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&u.is(m.range)&&f.is(m.color)}w.is=g})(h||(r.ColorInformation=h={}));var p;(function(w){function C(S,m,_){return{label:S,textEdit:m,additionalTextEdits:_}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&x.string(m.label)&&(x.undefined(m.textEdit)||I.is(m))&&(x.undefined(m.additionalTextEdits)||x.typedArray(m.additionalTextEdits,I.is))}w.is=g})(p||(r.ColorPresentation=p={}));var y;(function(w){w.Comment="comment",w.Imports="imports",w.Region="region"})(y||(r.FoldingRangeKind=y={}));var T;(function(w){function C(S,m,_,E,F,H){var Y={startLine:S,endLine:m};return x.defined(_)&&(Y.startCharacter=_),x.defined(E)&&(Y.endCharacter=E),x.defined(F)&&(Y.kind=F),x.defined(H)&&(Y.collapsedText=H),Y}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&x.uinteger(m.startLine)&&x.uinteger(m.startLine)&&(x.undefined(m.startCharacter)||x.uinteger(m.startCharacter))&&(x.undefined(m.endCharacter)||x.uinteger(m.endCharacter))&&(x.undefined(m.kind)||x.string(m.kind))}w.is=g})(T||(r.FoldingRange=T={}));var b;(function(w){function C(S,m){return{location:S,message:m}}w.create=C;function g(S){var m=S;return x.defined(m)&&l.is(m.location)&&x.string(m.message)}w.is=g})(b||(r.DiagnosticRelatedInformation=b={}));var v;(function(w){w.Error=1,w.Warning=2,w.Information=3,w.Hint=4})(v||(r.DiagnosticSeverity=v={}));var D;(function(w){w.Unnecessary=1,w.Deprecated=2})(D||(r.DiagnosticTag=D={}));var k;(function(w){function C(g){var S=g;return x.objectLiteral(S)&&x.string(S.href)}w.is=C})(k||(r.CodeDescription=k={}));var P;(function(w){function C(S,m,_,E,F,H){var Y={range:S,message:m};return x.defined(_)&&(Y.severity=_),x.defined(E)&&(Y.code=E),x.defined(F)&&(Y.source=F),x.defined(H)&&(Y.relatedInformation=H),Y}w.create=C;function g(S){var m,_=S;return x.defined(_)&&u.is(_.range)&&x.string(_.message)&&(x.number(_.severity)||x.undefined(_.severity))&&(x.integer(_.code)||x.string(_.code)||x.undefined(_.code))&&(x.undefined(_.codeDescription)||x.string((m=_.codeDescription)===null||m===void 0?void 0:m.href))&&(x.string(_.source)||x.undefined(_.source))&&(x.undefined(_.relatedInformation)||x.typedArray(_.relatedInformation,b.is))}w.is=g})(P||(r.Diagnostic=P={}));var M;(function(w){function C(S,m){for(var _=[],E=2;E<arguments.length;E++)_[E-2]=arguments[E];var F={title:S,command:m};return x.defined(_)&&_.length>0&&(F.arguments=_),F}w.create=C;function g(S){var m=S;return x.defined(m)&&x.string(m.title)&&x.string(m.command)}w.is=g})(M||(r.Command=M={}));var I;(function(w){function C(_,E){return{range:_,newText:E}}w.replace=C;function g(_,E){return{range:{start:_,end:_},newText:E}}w.insert=g;function S(_){return{range:_,newText:""}}w.del=S;function m(_){var E=_;return x.objectLiteral(E)&&x.string(E.newText)&&u.is(E.range)}w.is=m})(I||(r.TextEdit=I={}));var G;(function(w){function C(S,m,_){var E={label:S};return m!==void 0&&(E.needsConfirmation=m),_!==void 0&&(E.description=_),E}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&x.string(m.label)&&(x.boolean(m.needsConfirmation)||m.needsConfirmation===void 0)&&(x.string(m.description)||m.description===void 0)}w.is=g})(G||(r.ChangeAnnotation=G={}));var U;(function(w){function C(g){var S=g;return x.string(S)}w.is=C})(U||(r.ChangeAnnotationIdentifier=U={}));var W;(function(w){function C(_,E,F){return{range:_,newText:E,annotationId:F}}w.replace=C;function g(_,E,F){return{range:{start:_,end:_},newText:E,annotationId:F}}w.insert=g;function S(_,E){return{range:_,newText:"",annotationId:E}}w.del=S;function m(_){var E=_;return I.is(E)&&(G.is(E.annotationId)||U.is(E.annotationId))}w.is=m})(W||(r.AnnotatedTextEdit=W={}));var A;(function(w){function C(S,m){return{textDocument:S,edits:m}}w.create=C;function g(S){var m=S;return x.defined(m)&&me.is(m.textDocument)&&Array.isArray(m.edits)}w.is=g})(A||(r.TextDocumentEdit=A={}));var $;(function(w){function C(S,m,_){var E={kind:"create",uri:S};return m!==void 0&&(m.overwrite!==void 0||m.ignoreIfExists!==void 0)&&(E.options=m),_!==void 0&&(E.annotationId=_),E}w.create=C;function g(S){var m=S;return m&&m.kind==="create"&&x.string(m.uri)&&(m.options===void 0||(m.options.overwrite===void 0||x.boolean(m.options.overwrite))&&(m.options.ignoreIfExists===void 0||x.boolean(m.options.ignoreIfExists)))&&(m.annotationId===void 0||U.is(m.annotationId))}w.is=g})($||(r.CreateFile=$={}));var R;(function(w){function C(S,m,_,E){var F={kind:"rename",oldUri:S,newUri:m};return _!==void 0&&(_.overwrite!==void 0||_.ignoreIfExists!==void 0)&&(F.options=_),E!==void 0&&(F.annotationId=E),F}w.create=C;function g(S){var m=S;return m&&m.kind==="rename"&&x.string(m.oldUri)&&x.string(m.newUri)&&(m.options===void 0||(m.options.overwrite===void 0||x.boolean(m.options.overwrite))&&(m.options.ignoreIfExists===void 0||x.boolean(m.options.ignoreIfExists)))&&(m.annotationId===void 0||U.is(m.annotationId))}w.is=g})(R||(r.RenameFile=R={}));var L;(function(w){function C(S,m,_){var E={kind:"delete",uri:S};return m!==void 0&&(m.recursive!==void 0||m.ignoreIfNotExists!==void 0)&&(E.options=m),_!==void 0&&(E.annotationId=_),E}w.create=C;function g(S){var m=S;return m&&m.kind==="delete"&&x.string(m.uri)&&(m.options===void 0||(m.options.recursive===void 0||x.boolean(m.options.recursive))&&(m.options.ignoreIfNotExists===void 0||x.boolean(m.options.ignoreIfNotExists)))&&(m.annotationId===void 0||U.is(m.annotationId))}w.is=g})(L||(r.DeleteFile=L={}));var q;(function(w){function C(g){var S=g;return S&&(S.changes!==void 0||S.documentChanges!==void 0)&&(S.documentChanges===void 0||S.documentChanges.every(function(m){return x.string(m.kind)?$.is(m)||R.is(m)||L.is(m):A.is(m)}))}w.is=C})(q||(r.WorkspaceEdit=q={}));var j=function(){function w(C,g){this.edits=C,this.changeAnnotations=g}return w.prototype.insert=function(C,g,S){var m,_;if(S===void 0?m=I.insert(C,g):U.is(S)?(_=S,m=W.insert(C,g,S)):(this.assertChangeAnnotations(this.changeAnnotations),_=this.changeAnnotations.manage(S),m=W.insert(C,g,_)),this.edits.push(m),_!==void 0)return _},w.prototype.replace=function(C,g,S){var m,_;if(S===void 0?m=I.replace(C,g):U.is(S)?(_=S,m=W.replace(C,g,S)):(this.assertChangeAnnotations(this.changeAnnotations),_=this.changeAnnotations.manage(S),m=W.replace(C,g,_)),this.edits.push(m),_!==void 0)return _},w.prototype.delete=function(C,g){var S,m;if(g===void 0?S=I.del(C):U.is(g)?(m=g,S=W.del(C,g)):(this.assertChangeAnnotations(this.changeAnnotations),m=this.changeAnnotations.manage(g),S=W.del(C,m)),this.edits.push(S),m!==void 0)return m},w.prototype.add=function(C){this.edits.push(C)},w.prototype.all=function(){return this.edits},w.prototype.clear=function(){this.edits.splice(0,this.edits.length)},w.prototype.assertChangeAnnotations=function(C){if(C===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},w}(),z=function(){function w(C){this._annotations=C===void 0?Object.create(null):C,this._counter=0,this._size=0}return w.prototype.all=function(){return this._annotations},Object.defineProperty(w.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),w.prototype.manage=function(C,g){var S;if(U.is(C)?S=C:(S=this.nextId(),g=C),this._annotations[S]!==void 0)throw new Error("Id ".concat(S," is already in use."));if(g===void 0)throw new Error("No annotation provided for id ".concat(S));return this._annotations[S]=g,this._size++,S},w.prototype.nextId=function(){return this._counter++,this._counter.toString()},w}(),Ne=function(){function w(C){var g=this;this._textEditChanges=Object.create(null),C!==void 0?(this._workspaceEdit=C,C.documentChanges?(this._changeAnnotations=new z(C.changeAnnotations),C.changeAnnotations=this._changeAnnotations.all(),C.documentChanges.forEach(function(S){if(A.is(S)){var m=new j(S.edits,g._changeAnnotations);g._textEditChanges[S.textDocument.uri]=m}})):C.changes&&Object.keys(C.changes).forEach(function(S){var m=new j(C.changes[S]);g._textEditChanges[S]=m})):this._workspaceEdit={}}return Object.defineProperty(w.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),w.prototype.getTextEditChange=function(C){if(me.is(C)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g={uri:C.uri,version:C.version},S=this._textEditChanges[g.uri];if(!S){var m=[],_={textDocument:g,edits:m};this._workspaceEdit.documentChanges.push(_),S=new j(m,this._changeAnnotations),this._textEditChanges[g.uri]=S}return S}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var S=this._textEditChanges[C];if(!S){var m=[];this._workspaceEdit.changes[C]=m,S=new j(m),this._textEditChanges[C]=S}return S}},w.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new z,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},w.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},w.prototype.createFile=function(C,g,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var m;G.is(g)||U.is(g)?m=g:S=g;var _,E;if(m===void 0?_=$.create(C,S):(E=U.is(m)?m:this._changeAnnotations.manage(m),_=$.create(C,S,E)),this._workspaceEdit.documentChanges.push(_),E!==void 0)return E},w.prototype.renameFile=function(C,g,S,m){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var _;G.is(S)||U.is(S)?_=S:m=S;var E,F;if(_===void 0?E=R.create(C,g,m):(F=U.is(_)?_:this._changeAnnotations.manage(_),E=R.create(C,g,m,F)),this._workspaceEdit.documentChanges.push(E),F!==void 0)return F},w.prototype.deleteFile=function(C,g,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var m;G.is(g)||U.is(g)?m=g:S=g;var _,E;if(m===void 0?_=L.create(C,S):(E=U.is(m)?m:this._changeAnnotations.manage(m),_=L.create(C,S,E)),this._workspaceEdit.documentChanges.push(_),E!==void 0)return E},w}();r.WorkspaceChange=Ne;var J;(function(w){function C(S){return{uri:S}}w.create=C;function g(S){var m=S;return x.defined(m)&&x.string(m.uri)}w.is=g})(J||(r.TextDocumentIdentifier=J={}));var B;(function(w){function C(S,m){return{uri:S,version:m}}w.create=C;function g(S){var m=S;return x.defined(m)&&x.string(m.uri)&&x.integer(m.version)}w.is=g})(B||(r.VersionedTextDocumentIdentifier=B={}));var me;(function(w){function C(S,m){return{uri:S,version:m}}w.create=C;function g(S){var m=S;return x.defined(m)&&x.string(m.uri)&&(m.version===null||x.integer(m.version))}w.is=g})(me||(r.OptionalVersionedTextDocumentIdentifier=me={}));var Nt;(function(w){function C(S,m,_,E){return{uri:S,languageId:m,version:_,text:E}}w.create=C;function g(S){var m=S;return x.defined(m)&&x.string(m.uri)&&x.string(m.languageId)&&x.integer(m.version)&&x.string(m.text)}w.is=g})(Nt||(r.TextDocumentItem=Nt={}));var sn;(function(w){w.PlainText="plaintext",w.Markdown="markdown";function C(g){var S=g;return S===w.PlainText||S===w.Markdown}w.is=C})(sn||(r.MarkupKind=sn={}));var He;(function(w){function C(g){var S=g;return x.objectLiteral(g)&&sn.is(S.kind)&&x.string(S.value)}w.is=C})(He||(r.MarkupContent=He={}));var Dn;(function(w){w.Text=1,w.Method=2,w.Function=3,w.Constructor=4,w.Field=5,w.Variable=6,w.Class=7,w.Interface=8,w.Module=9,w.Property=10,w.Unit=11,w.Value=12,w.Enum=13,w.Keyword=14,w.Snippet=15,w.Color=16,w.File=17,w.Reference=18,w.Folder=19,w.EnumMember=20,w.Constant=21,w.Struct=22,w.Event=23,w.Operator=24,w.TypeParameter=25})(Dn||(r.CompletionItemKind=Dn={}));var qe;(function(w){w.PlainText=1,w.Snippet=2})(qe||(r.InsertTextFormat=qe={}));var ut;(function(w){w.Deprecated=1})(ut||(r.CompletionItemTag=ut={}));var wt;(function(w){function C(S,m,_){return{newText:S,insert:m,replace:_}}w.create=C;function g(S){var m=S;return m&&x.string(m.newText)&&u.is(m.insert)&&u.is(m.replace)}w.is=g})(wt||(r.InsertReplaceEdit=wt={}));var We;(function(w){w.asIs=1,w.adjustIndentation=2})(We||(r.InsertTextMode=We={}));var bt;(function(w){function C(g){var S=g;return S&&(x.string(S.detail)||S.detail===void 0)&&(x.string(S.description)||S.description===void 0)}w.is=C})(bt||(r.CompletionItemLabelDetails=bt={}));var tt;(function(w){function C(g){return{label:g}}w.create=C})(tt||(r.CompletionItem=tt={}));var fe;(function(w){function C(g,S){return{items:g||[],isIncomplete:!!S}}w.create=C})(fe||(r.CompletionList=fe={}));var st;(function(w){function C(S){return S.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}w.fromPlainText=C;function g(S){var m=S;return x.string(m)||x.objectLiteral(m)&&x.string(m.language)&&x.string(m.value)}w.is=g})(st||(r.MarkedString=st={}));var Me;(function(w){function C(g){var S=g;return!!S&&x.objectLiteral(S)&&(He.is(S.contents)||st.is(S.contents)||x.typedArray(S.contents,st.is))&&(g.range===void 0||u.is(g.range))}w.is=C})(Me||(r.Hover=Me={}));var Ot;(function(w){function C(g,S){return S?{label:g,documentation:S}:{label:g}}w.create=C})(Ot||(r.ParameterInformation=Ot={}));var qr;(function(w){function C(g,S){for(var m=[],_=2;_<arguments.length;_++)m[_-2]=arguments[_];var E={label:g};return x.defined(S)&&(E.documentation=S),x.defined(m)?E.parameters=m:E.parameters=[],E}w.create=C})(qr||(r.SignatureInformation=qr={}));var vi;(function(w){w.Text=1,w.Read=2,w.Write=3})(vi||(r.DocumentHighlightKind=vi={}));var wi;(function(w){function C(g,S){var m={range:g};return x.number(S)&&(m.kind=S),m}w.create=C})(wi||(r.DocumentHighlight=wi={}));var bi;(function(w){w.File=1,w.Module=2,w.Namespace=3,w.Package=4,w.Class=5,w.Method=6,w.Property=7,w.Field=8,w.Constructor=9,w.Enum=10,w.Interface=11,w.Function=12,w.Variable=13,w.Constant=14,w.String=15,w.Number=16,w.Boolean=17,w.Array=18,w.Object=19,w.Key=20,w.Null=21,w.EnumMember=22,w.Struct=23,w.Event=24,w.Operator=25,w.TypeParameter=26})(bi||(r.SymbolKind=bi={}));var Di;(function(w){w.Deprecated=1})(Di||(r.SymbolTag=Di={}));var on;(function(w){function C(g,S,m,_,E){var F={name:g,kind:S,location:{uri:_,range:m}};return E&&(F.containerName=E),F}w.create=C})(on||(r.SymbolInformation=on={}));var Ei;(function(w){function C(g,S,m,_){return _!==void 0?{name:g,kind:S,location:{uri:m,range:_}}:{name:g,kind:S,location:{uri:m}}}w.create=C})(Ei||(r.WorkspaceSymbol=Ei={}));var ys;(function(w){function C(S,m,_,E,F,H){var Y={name:S,detail:m,kind:_,range:E,selectionRange:F};return H!==void 0&&(Y.children=H),Y}w.create=C;function g(S){var m=S;return m&&x.string(m.name)&&x.number(m.kind)&&u.is(m.range)&&u.is(m.selectionRange)&&(m.detail===void 0||x.string(m.detail))&&(m.deprecated===void 0||x.boolean(m.deprecated))&&(m.children===void 0||Array.isArray(m.children))&&(m.tags===void 0||Array.isArray(m.tags))}w.is=g})(ys||(r.DocumentSymbol=ys={}));var vs;(function(w){w.Empty="",w.QuickFix="quickfix",w.Refactor="refactor",w.RefactorExtract="refactor.extract",w.RefactorInline="refactor.inline",w.RefactorRewrite="refactor.rewrite",w.Source="source",w.SourceOrganizeImports="source.organizeImports",w.SourceFixAll="source.fixAll"})(vs||(r.CodeActionKind=vs={}));var Wr;(function(w){w.Invoked=1,w.Automatic=2})(Wr||(r.CodeActionTriggerKind=Wr={}));var ws;(function(w){function C(S,m,_){var E={diagnostics:S};return m!=null&&(E.only=m),_!=null&&(E.triggerKind=_),E}w.create=C;function g(S){var m=S;return x.defined(m)&&x.typedArray(m.diagnostics,P.is)&&(m.only===void 0||x.typedArray(m.only,x.string))&&(m.triggerKind===void 0||m.triggerKind===Wr.Invoked||m.triggerKind===Wr.Automatic)}w.is=g})(ws||(r.CodeActionContext=ws={}));var Ti;(function(w){function C(S,m,_){var E={title:S},F=!0;return typeof m=="string"?(F=!1,E.kind=m):M.is(m)?E.command=m:E.edit=m,F&&_!==void 0&&(E.kind=_),E}w.create=C;function g(S){var m=S;return m&&x.string(m.title)&&(m.diagnostics===void 0||x.typedArray(m.diagnostics,P.is))&&(m.kind===void 0||x.string(m.kind))&&(m.edit!==void 0||m.command!==void 0)&&(m.command===void 0||M.is(m.command))&&(m.isPreferred===void 0||x.boolean(m.isPreferred))&&(m.edit===void 0||q.is(m.edit))}w.is=g})(Ti||(r.CodeAction=Ti={}));var Ri;(function(w){function C(S,m){var _={range:S};return x.defined(m)&&(_.data=m),_}w.create=C;function g(S){var m=S;return x.defined(m)&&u.is(m.range)&&(x.undefined(m.command)||M.is(m.command))}w.is=g})(Ri||(r.CodeLens=Ri={}));var An;(function(w){function C(S,m){return{tabSize:S,insertSpaces:m}}w.create=C;function g(S){var m=S;return x.defined(m)&&x.uinteger(m.tabSize)&&x.boolean(m.insertSpaces)}w.is=g})(An||(r.FormattingOptions=An={}));var Si;(function(w){function C(S,m,_){return{range:S,target:m,data:_}}w.create=C;function g(S){var m=S;return x.defined(m)&&u.is(m.range)&&(x.undefined(m.target)||x.string(m.target))}w.is=g})(Si||(r.DocumentLink=Si={}));var bs;(function(w){function C(S,m){return{range:S,parent:m}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&u.is(m.range)&&(m.parent===void 0||w.is(m.parent))}w.is=g})(bs||(r.SelectionRange=bs={}));var Ds;(function(w){w.namespace="namespace",w.type="type",w.class="class",w.enum="enum",w.interface="interface",w.struct="struct",w.typeParameter="typeParameter",w.parameter="parameter",w.variable="variable",w.property="property",w.enumMember="enumMember",w.event="event",w.function="function",w.method="method",w.macro="macro",w.keyword="keyword",w.modifier="modifier",w.comment="comment",w.string="string",w.number="number",w.regexp="regexp",w.operator="operator",w.decorator="decorator"})(Ds||(r.SemanticTokenTypes=Ds={}));var $i;(function(w){w.declaration="declaration",w.definition="definition",w.readonly="readonly",w.static="static",w.deprecated="deprecated",w.abstract="abstract",w.async="async",w.modification="modification",w.documentation="documentation",w.defaultLibrary="defaultLibrary"})($i||(r.SemanticTokenModifiers=$i={}));var ki;(function(w){function C(g){var S=g;return x.objectLiteral(S)&&(S.resultId===void 0||typeof S.resultId=="string")&&Array.isArray(S.data)&&(S.data.length===0||typeof S.data[0]=="number")}w.is=C})(ki||(r.SemanticTokens=ki={}));var Es;(function(w){function C(S,m){return{range:S,text:m}}w.create=C;function g(S){var m=S;return m!=null&&u.is(m.range)&&x.string(m.text)}w.is=g})(Es||(r.InlineValueText=Es={}));var Ts;(function(w){function C(S,m,_){return{range:S,variableName:m,caseSensitiveLookup:_}}w.create=C;function g(S){var m=S;return m!=null&&u.is(m.range)&&x.boolean(m.caseSensitiveLookup)&&(x.string(m.variableName)||m.variableName===void 0)}w.is=g})(Ts||(r.InlineValueVariableLookup=Ts={}));var Rs;(function(w){function C(S,m){return{range:S,expression:m}}w.create=C;function g(S){var m=S;return m!=null&&u.is(m.range)&&(x.string(m.expression)||m.expression===void 0)}w.is=g})(Rs||(r.InlineValueEvaluatableExpression=Rs={}));var Ss;(function(w){function C(S,m){return{frameId:S,stoppedLocation:m}}w.create=C;function g(S){var m=S;return x.defined(m)&&u.is(S.stoppedLocation)}w.is=g})(Ss||(r.InlineValueContext=Ss={}));var Ci;(function(w){w.Type=1,w.Parameter=2;function C(g){return g===1||g===2}w.is=C})(Ci||(r.InlayHintKind=Ci={}));var _i;(function(w){function C(S){return{value:S}}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&(m.tooltip===void 0||x.string(m.tooltip)||He.is(m.tooltip))&&(m.location===void 0||l.is(m.location))&&(m.command===void 0||M.is(m.command))}w.is=g})(_i||(r.InlayHintLabelPart=_i={}));var an;(function(w){function C(S,m,_){var E={position:S,label:m};return _!==void 0&&(E.kind=_),E}w.create=C;function g(S){var m=S;return x.objectLiteral(m)&&c.is(m.position)&&(x.string(m.label)||x.typedArray(m.label,_i.is))&&(m.kind===void 0||Ci.is(m.kind))&&m.textEdits===void 0||x.typedArray(m.textEdits,I.is)&&(m.tooltip===void 0||x.string(m.tooltip)||He.is(m.tooltip))&&(m.paddingLeft===void 0||x.boolean(m.paddingLeft))&&(m.paddingRight===void 0||x.boolean(m.paddingRight))}w.is=g})(an||(r.InlayHint=an={}));var $s;(function(w){function C(g){return{kind:"snippet",value:g}}w.createSnippet=C})($s||(r.StringValue=$s={}));var ks;(function(w){function C(g,S,m,_){return{insertText:g,filterText:S,range:m,command:_}}w.create=C})(ks||(r.InlineCompletionItem=ks={}));var pr;(function(w){function C(g){return{items:g}}w.create=C})(pr||(r.InlineCompletionList=pr={}));var Cs;(function(w){w.Invoked=0,w.Automatic=1})(Cs||(r.InlineCompletionTriggerKind=Cs={}));var Gr;(function(w){function C(g,S){return{range:g,text:S}}w.create=C})(Gr||(r.SelectedCompletionInfo=Gr={}));var _s;(function(w){function C(g,S){return{triggerKind:g,selectedCompletionInfo:S}}w.create=C})(_s||(r.InlineCompletionContext=_s={}));var In;(function(w){function C(g){var S=g;return x.objectLiteral(S)&&s.is(S.uri)&&x.string(S.name)}w.is=C})(In||(r.WorkspaceFolder=In={})),r.EOL=[`
156
- `,`\r
157
- `,"\r"];var Yn;(function(w){function C(_,E,F,H){return new vo(_,E,F,H)}w.create=C;function g(_){var E=_;return!!(x.defined(E)&&x.string(E.uri)&&(x.undefined(E.languageId)||x.string(E.languageId))&&x.uinteger(E.lineCount)&&x.func(E.getText)&&x.func(E.positionAt)&&x.func(E.offsetAt))}w.is=g;function S(_,E){for(var F=_.getText(),H=m(E,function(pe,Be){var Ie=pe.range.start.line-Be.range.start.line;return Ie===0?pe.range.start.character-Be.range.start.character:Ie}),Y=F.length,be=H.length-1;be>=0;be--){var ye=H[be],Ae=_.offsetAt(ye.range.start),ne=_.offsetAt(ye.range.end);if(ne<=Y)F=F.substring(0,Ae)+ye.newText+F.substring(ne,F.length);else throw new Error("Overlapping edit");Y=Ae}return F}w.applyEdits=S;function m(_,E){if(_.length<=1)return _;var F=_.length/2|0,H=_.slice(0,F),Y=_.slice(F);m(H,E),m(Y,E);for(var be=0,ye=0,Ae=0;be<H.length&&ye<Y.length;){var ne=E(H[be],Y[ye]);ne<=0?_[Ae++]=H[be++]:_[Ae++]=Y[ye++]}for(;be<H.length;)_[Ae++]=H[be++];for(;ye<Y.length;)_[Ae++]=Y[ye++];return _}})(Yn||(r.TextDocument=Yn={}));var vo=function(){function w(C,g,S,m){this._uri=C,this._languageId=g,this._version=S,this._content=m,this._lineOffsets=void 0}return Object.defineProperty(w.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),w.prototype.getText=function(C){if(C){var g=this.offsetAt(C.start),S=this.offsetAt(C.end);return this._content.substring(g,S)}return this._content},w.prototype.update=function(C,g){this._content=C.text,this._version=g,this._lineOffsets=void 0},w.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var C=[],g=this._content,S=!0,m=0;m<g.length;m++){S&&(C.push(m),S=!1);var _=g.charAt(m);S=_==="\r"||_===`
158
- `,_==="\r"&&m+1<g.length&&g.charAt(m+1)===`
159
- `&&m++}S&&g.length>0&&C.push(g.length),this._lineOffsets=C}return this._lineOffsets},w.prototype.positionAt=function(C){C=Math.max(Math.min(C,this._content.length),0);var g=this.getLineOffsets(),S=0,m=g.length;if(m===0)return c.create(0,C);for(;S<m;){var _=Math.floor((S+m)/2);g[_]>C?m=_:S=_+1}var E=S-1;return c.create(E,C-g[E])},w.prototype.offsetAt=function(C){var g=this.getLineOffsets();if(C.line>=g.length)return this._content.length;if(C.line<0)return 0;var S=g[C.line],m=C.line+1<g.length?g[C.line+1]:this._content.length;return Math.max(Math.min(S+C.character,m),S)},Object.defineProperty(w.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),w}(),x;(function(w){var C=Object.prototype.toString;function g(ne){return typeof ne<"u"}w.defined=g;function S(ne){return typeof ne>"u"}w.undefined=S;function m(ne){return ne===!0||ne===!1}w.boolean=m;function _(ne){return C.call(ne)==="[object String]"}w.string=_;function E(ne){return C.call(ne)==="[object Number]"}w.number=E;function F(ne,pe,Be){return C.call(ne)==="[object Number]"&&pe<=ne&&ne<=Be}w.numberRange=F;function H(ne){return C.call(ne)==="[object Number]"&&-2147483648<=ne&&ne<=2147483647}w.integer=H;function Y(ne){return C.call(ne)==="[object Number]"&&0<=ne&&ne<=2147483647}w.uinteger=Y;function be(ne){return C.call(ne)==="[object Function]"}w.func=be;function ye(ne){return ne!==null&&typeof ne=="object"}w.objectLiteral=ye;function Ae(ne,pe){return Array.isArray(ne)&&ne.every(pe)}w.typedArray=Ae})(x||(x={}))})})(cv,cv.exports);var uv=cv.exports,Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.ProtocolNotificationType=Te.ProtocolNotificationType0=Te.ProtocolRequestType=Te.ProtocolRequestType0=Te.RegistrationType=Te.MessageDirection=void 0;const ea=mn;var h$;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(h$||(Te.MessageDirection=h$={}));class N7{constructor(e){this.method=e}}Te.RegistrationType=N7;class O7 extends ea.RequestType0{constructor(e){super(e)}}Te.ProtocolRequestType0=O7;class F7 extends ea.RequestType{constructor(e){super(e,ea.ParameterStructures.byName)}}Te.ProtocolRequestType=F7;class L7 extends ea.NotificationType0{constructor(e){super(e)}}Te.ProtocolNotificationType0=L7;class M7 extends ea.NotificationType{constructor(e){super(e,ea.ParameterStructures.byName)}}Te.ProtocolNotificationType=M7;var p$={},pt={};Object.defineProperty(pt,"__esModule",{value:!0}),pt.objectLiteral=pt.typedArray=pt.stringArray=pt.array=pt.func=pt.error=pt.number=pt.string=pt.boolean=void 0;function B7(t){return t===!0||t===!1}pt.boolean=B7;function g$(t){return typeof t=="string"||t instanceof String}pt.string=g$;function j7(t){return typeof t=="number"||t instanceof Number}pt.number=j7;function U7(t){return t instanceof Error}pt.error=U7;function q7(t){return typeof t=="function"}pt.func=q7;function m$(t){return Array.isArray(t)}pt.array=m$;function W7(t){return m$(t)&&t.every(e=>g$(e))}pt.stringArray=W7;function G7(t,e){return Array.isArray(t)&&t.every(e)}pt.typedArray=G7;function z7(t){return t!==null&&typeof t=="object"}pt.objectLiteral=z7;var Mf={};Object.defineProperty(Mf,"__esModule",{value:!0}),Mf.ImplementationRequest=void 0;const y$=Te;var v$;(function(t){t.method="textDocument/implementation",t.messageDirection=y$.MessageDirection.clientToServer,t.type=new y$.ProtocolRequestType(t.method)})(v$||(Mf.ImplementationRequest=v$={}));var Bf={};Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.TypeDefinitionRequest=void 0;const w$=Te;var b$;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=w$.MessageDirection.clientToServer,t.type=new w$.ProtocolRequestType(t.method)})(b$||(Bf.TypeDefinitionRequest=b$={}));var ta={};Object.defineProperty(ta,"__esModule",{value:!0}),ta.DidChangeWorkspaceFoldersNotification=ta.WorkspaceFoldersRequest=void 0;const jf=Te;var D$;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=jf.MessageDirection.serverToClient,t.type=new jf.ProtocolRequestType0(t.method)})(D$||(ta.WorkspaceFoldersRequest=D$={}));var E$;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=jf.MessageDirection.clientToServer,t.type=new jf.ProtocolNotificationType(t.method)})(E$||(ta.DidChangeWorkspaceFoldersNotification=E$={}));var Uf={};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.ConfigurationRequest=void 0;const T$=Te;var R$;(function(t){t.method="workspace/configuration",t.messageDirection=T$.MessageDirection.serverToClient,t.type=new T$.ProtocolRequestType(t.method)})(R$||(Uf.ConfigurationRequest=R$={}));var na={};Object.defineProperty(na,"__esModule",{value:!0}),na.ColorPresentationRequest=na.DocumentColorRequest=void 0;const qf=Te;var S$;(function(t){t.method="textDocument/documentColor",t.messageDirection=qf.MessageDirection.clientToServer,t.type=new qf.ProtocolRequestType(t.method)})(S$||(na.DocumentColorRequest=S$={}));var $$;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=qf.MessageDirection.clientToServer,t.type=new qf.ProtocolRequestType(t.method)})($$||(na.ColorPresentationRequest=$$={}));var ra={};Object.defineProperty(ra,"__esModule",{value:!0}),ra.FoldingRangeRefreshRequest=ra.FoldingRangeRequest=void 0;const Wf=Te;var k$;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Wf.MessageDirection.clientToServer,t.type=new Wf.ProtocolRequestType(t.method)})(k$||(ra.FoldingRangeRequest=k$={}));var C$;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Wf.MessageDirection.serverToClient,t.type=new Wf.ProtocolRequestType0(t.method)})(C$||(ra.FoldingRangeRefreshRequest=C$={}));var Gf={};Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.DeclarationRequest=void 0;const _$=Te;var A$;(function(t){t.method="textDocument/declaration",t.messageDirection=_$.MessageDirection.clientToServer,t.type=new _$.ProtocolRequestType(t.method)})(A$||(Gf.DeclarationRequest=A$={}));var zf={};Object.defineProperty(zf,"__esModule",{value:!0}),zf.SelectionRangeRequest=void 0;const I$=Te;var x$;(function(t){t.method="textDocument/selectionRange",t.messageDirection=I$.MessageDirection.clientToServer,t.type=new I$.ProtocolRequestType(t.method)})(x$||(zf.SelectionRangeRequest=x$={}));var Vi={};Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.WorkDoneProgressCancelNotification=Vi.WorkDoneProgressCreateRequest=Vi.WorkDoneProgress=void 0;const H7=mn,Hf=Te;var P$;(function(t){t.type=new H7.ProgressType;function e(n){return n===t.type}t.is=e})(P$||(Vi.WorkDoneProgress=P$={}));var N$;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Hf.MessageDirection.serverToClient,t.type=new Hf.ProtocolRequestType(t.method)})(N$||(Vi.WorkDoneProgressCreateRequest=N$={}));var O$;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Hf.MessageDirection.clientToServer,t.type=new Hf.ProtocolNotificationType(t.method)})(O$||(Vi.WorkDoneProgressCancelNotification=O$={}));var Yi={};Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.CallHierarchyOutgoingCallsRequest=Yi.CallHierarchyIncomingCallsRequest=Yi.CallHierarchyPrepareRequest=void 0;const ia=Te;var F$;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(F$||(Yi.CallHierarchyPrepareRequest=F$={}));var L$;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(L$||(Yi.CallHierarchyIncomingCallsRequest=L$={}));var M$;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=ia.MessageDirection.clientToServer,t.type=new ia.ProtocolRequestType(t.method)})(M$||(Yi.CallHierarchyOutgoingCallsRequest=M$={}));var yn={};Object.defineProperty(yn,"__esModule",{value:!0}),yn.SemanticTokensRefreshRequest=yn.SemanticTokensRangeRequest=yn.SemanticTokensDeltaRequest=yn.SemanticTokensRequest=yn.SemanticTokensRegistrationType=yn.TokenFormat=void 0;const mi=Te;var B$;(function(t){t.Relative="relative"})(B$||(yn.TokenFormat=B$={}));var uu;(function(t){t.method="textDocument/semanticTokens",t.type=new mi.RegistrationType(t.method)})(uu||(yn.SemanticTokensRegistrationType=uu={}));var j$;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=mi.MessageDirection.clientToServer,t.type=new mi.ProtocolRequestType(t.method),t.registrationMethod=uu.method})(j$||(yn.SemanticTokensRequest=j$={}));var U$;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=mi.MessageDirection.clientToServer,t.type=new mi.ProtocolRequestType(t.method),t.registrationMethod=uu.method})(U$||(yn.SemanticTokensDeltaRequest=U$={}));var q$;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=mi.MessageDirection.clientToServer,t.type=new mi.ProtocolRequestType(t.method),t.registrationMethod=uu.method})(q$||(yn.SemanticTokensRangeRequest=q$={}));var W$;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=mi.MessageDirection.serverToClient,t.type=new mi.ProtocolRequestType0(t.method)})(W$||(yn.SemanticTokensRefreshRequest=W$={}));var Kf={};Object.defineProperty(Kf,"__esModule",{value:!0}),Kf.ShowDocumentRequest=void 0;const G$=Te;var z$;(function(t){t.method="window/showDocument",t.messageDirection=G$.MessageDirection.serverToClient,t.type=new G$.ProtocolRequestType(t.method)})(z$||(Kf.ShowDocumentRequest=z$={}));var Vf={};Object.defineProperty(Vf,"__esModule",{value:!0}),Vf.LinkedEditingRangeRequest=void 0;const H$=Te;var K$;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=H$.MessageDirection.clientToServer,t.type=new H$.ProtocolRequestType(t.method)})(K$||(Vf.LinkedEditingRangeRequest=K$={}));var Gt={};Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.WillDeleteFilesRequest=Gt.DidDeleteFilesNotification=Gt.DidRenameFilesNotification=Gt.WillRenameFilesRequest=Gt.DidCreateFilesNotification=Gt.WillCreateFilesRequest=Gt.FileOperationPatternKind=void 0;const Un=Te;var V$;(function(t){t.file="file",t.folder="folder"})(V$||(Gt.FileOperationPatternKind=V$={}));var Y$;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=Un.MessageDirection.clientToServer,t.type=new Un.ProtocolRequestType(t.method)})(Y$||(Gt.WillCreateFilesRequest=Y$={}));var X$;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=Un.MessageDirection.clientToServer,t.type=new Un.ProtocolNotificationType(t.method)})(X$||(Gt.DidCreateFilesNotification=X$={}));var J$;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=Un.MessageDirection.clientToServer,t.type=new Un.ProtocolRequestType(t.method)})(J$||(Gt.WillRenameFilesRequest=J$={}));var Z$;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=Un.MessageDirection.clientToServer,t.type=new Un.ProtocolNotificationType(t.method)})(Z$||(Gt.DidRenameFilesNotification=Z$={}));var Q$;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=Un.MessageDirection.clientToServer,t.type=new Un.ProtocolNotificationType(t.method)})(Q$||(Gt.DidDeleteFilesNotification=Q$={}));var ek;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=Un.MessageDirection.clientToServer,t.type=new Un.ProtocolRequestType(t.method)})(ek||(Gt.WillDeleteFilesRequest=ek={}));var Xi={};Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.MonikerRequest=Xi.MonikerKind=Xi.UniquenessLevel=void 0;const tk=Te;var nk;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(nk||(Xi.UniquenessLevel=nk={}));var rk;(function(t){t.$import="import",t.$export="export",t.local="local"})(rk||(Xi.MonikerKind=rk={}));var ik;(function(t){t.method="textDocument/moniker",t.messageDirection=tk.MessageDirection.clientToServer,t.type=new tk.ProtocolRequestType(t.method)})(ik||(Xi.MonikerRequest=ik={}));var Ji={};Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.TypeHierarchySubtypesRequest=Ji.TypeHierarchySupertypesRequest=Ji.TypeHierarchyPrepareRequest=void 0;const sa=Te;var sk;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=sa.MessageDirection.clientToServer,t.type=new sa.ProtocolRequestType(t.method)})(sk||(Ji.TypeHierarchyPrepareRequest=sk={}));var ok;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=sa.MessageDirection.clientToServer,t.type=new sa.ProtocolRequestType(t.method)})(ok||(Ji.TypeHierarchySupertypesRequest=ok={}));var ak;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=sa.MessageDirection.clientToServer,t.type=new sa.ProtocolRequestType(t.method)})(ak||(Ji.TypeHierarchySubtypesRequest=ak={}));var oa={};Object.defineProperty(oa,"__esModule",{value:!0}),oa.InlineValueRefreshRequest=oa.InlineValueRequest=void 0;const Yf=Te;var ck;(function(t){t.method="textDocument/inlineValue",t.messageDirection=Yf.MessageDirection.clientToServer,t.type=new Yf.ProtocolRequestType(t.method)})(ck||(oa.InlineValueRequest=ck={}));var uk;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=Yf.MessageDirection.serverToClient,t.type=new Yf.ProtocolRequestType0(t.method)})(uk||(oa.InlineValueRefreshRequest=uk={}));var Zi={};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.InlayHintRefreshRequest=Zi.InlayHintResolveRequest=Zi.InlayHintRequest=void 0;const aa=Te;var lk;(function(t){t.method="textDocument/inlayHint",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(lk||(Zi.InlayHintRequest=lk={}));var dk;(function(t){t.method="inlayHint/resolve",t.messageDirection=aa.MessageDirection.clientToServer,t.type=new aa.ProtocolRequestType(t.method)})(dk||(Zi.InlayHintResolveRequest=dk={}));var fk;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=aa.MessageDirection.serverToClient,t.type=new aa.ProtocolRequestType0(t.method)})(fk||(Zi.InlayHintRefreshRequest=fk={}));var qn={};Object.defineProperty(qn,"__esModule",{value:!0}),qn.DiagnosticRefreshRequest=qn.WorkspaceDiagnosticRequest=qn.DocumentDiagnosticRequest=qn.DocumentDiagnosticReportKind=qn.DiagnosticServerCancellationData=void 0;const hk=mn,K7=pt,ca=Te;var pk;(function(t){function e(n){const r=n;return r&&K7.boolean(r.retriggerRequest)}t.is=e})(pk||(qn.DiagnosticServerCancellationData=pk={}));var gk;(function(t){t.Full="full",t.Unchanged="unchanged"})(gk||(qn.DocumentDiagnosticReportKind=gk={}));var mk;(function(t){t.method="textDocument/diagnostic",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method),t.partialResult=new hk.ProgressType})(mk||(qn.DocumentDiagnosticRequest=mk={}));var yk;(function(t){t.method="workspace/diagnostic",t.messageDirection=ca.MessageDirection.clientToServer,t.type=new ca.ProtocolRequestType(t.method),t.partialResult=new hk.ProgressType})(yk||(qn.WorkspaceDiagnosticRequest=yk={}));var vk;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=ca.MessageDirection.serverToClient,t.type=new ca.ProtocolRequestType0(t.method)})(vk||(qn.DiagnosticRefreshRequest=vk={}));var gt={};Object.defineProperty(gt,"__esModule",{value:!0}),gt.DidCloseNotebookDocumentNotification=gt.DidSaveNotebookDocumentNotification=gt.DidChangeNotebookDocumentNotification=gt.NotebookCellArrayChange=gt.DidOpenNotebookDocumentNotification=gt.NotebookDocumentSyncRegistrationType=gt.NotebookDocument=gt.NotebookCell=gt.ExecutionSummary=gt.NotebookCellKind=void 0;const lu=uv,or=pt,Nr=Te;var lv;(function(t){t.Markup=1,t.Code=2;function e(n){return n===1||n===2}t.is=e})(lv||(gt.NotebookCellKind=lv={}));var dv;(function(t){function e(i,s){const o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function n(i){const s=i;return or.objectLiteral(s)&&lu.uinteger.is(s.executionOrder)&&(s.success===void 0||or.boolean(s.success))}t.is=n;function r(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=r})(dv||(gt.ExecutionSummary=dv={}));var Xf;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function n(s){const o=s;return or.objectLiteral(o)&&lv.is(o.kind)&&lu.DocumentUri.is(o.document)&&(o.metadata===void 0||or.objectLiteral(o.metadata))}t.is=n;function r(s,o){const a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!dv.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=r;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;const a=Array.isArray(s),c=Array.isArray(o);if(a!==c)return!1;if(a&&c){if(s.length!==o.length)return!1;for(let u=0;u<s.length;u++)if(!i(s[u],o[u]))return!1}if(or.objectLiteral(s)&&or.objectLiteral(o)){const u=Object.keys(s),l=Object.keys(o);if(u.length!==l.length||(u.sort(),l.sort(),!i(u,l)))return!1;for(let d=0;d<u.length;d++){const f=u[d];if(!i(s[f],o[f]))return!1}}return!0}})(Xf||(gt.NotebookCell=Xf={}));var wk;(function(t){function e(r,i,s,o){return{uri:r,notebookType:i,version:s,cells:o}}t.create=e;function n(r){const i=r;return or.objectLiteral(i)&&or.string(i.uri)&&lu.integer.is(i.version)&&or.typedArray(i.cells,Xf.is)}t.is=n})(wk||(gt.NotebookDocument=wk={}));var ua;(function(t){t.method="notebookDocument/sync",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.RegistrationType(t.method)})(ua||(gt.NotebookDocumentSyncRegistrationType=ua={}));var bk;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(bk||(gt.DidOpenNotebookDocumentNotification=bk={}));var Dk;(function(t){function e(r){const i=r;return or.objectLiteral(i)&&lu.uinteger.is(i.start)&&lu.uinteger.is(i.deleteCount)&&(i.cells===void 0||or.typedArray(i.cells,Xf.is))}t.is=e;function n(r,i,s){const o={start:r,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=n})(Dk||(gt.NotebookCellArrayChange=Dk={}));var Ek;(function(t){t.method="notebookDocument/didChange",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(Ek||(gt.DidChangeNotebookDocumentNotification=Ek={}));var Tk;(function(t){t.method="notebookDocument/didSave",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(Tk||(gt.DidSaveNotebookDocumentNotification=Tk={}));var Rk;(function(t){t.method="notebookDocument/didClose",t.messageDirection=Nr.MessageDirection.clientToServer,t.type=new Nr.ProtocolNotificationType(t.method),t.registrationMethod=ua.method})(Rk||(gt.DidCloseNotebookDocumentNotification=Rk={}));var Jf={};Object.defineProperty(Jf,"__esModule",{value:!0}),Jf.InlineCompletionRequest=void 0;const Sk=Te;var $k;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=Sk.MessageDirection.clientToServer,t.type=new Sk.ProtocolRequestType(t.method)})($k||(Jf.InlineCompletionRequest=$k={})),function(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;const e=Te,n=uv,r=pt,i=Mf;Object.defineProperty(t,"ImplementationRequest",{enumerable:!0,get:function(){return i.ImplementationRequest}});const s=Bf;Object.defineProperty(t,"TypeDefinitionRequest",{enumerable:!0,get:function(){return s.TypeDefinitionRequest}});const o=ta;Object.defineProperty(t,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return o.WorkspaceFoldersRequest}}),Object.defineProperty(t,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return o.DidChangeWorkspaceFoldersNotification}});const a=Uf;Object.defineProperty(t,"ConfigurationRequest",{enumerable:!0,get:function(){return a.ConfigurationRequest}});const c=na;Object.defineProperty(t,"DocumentColorRequest",{enumerable:!0,get:function(){return c.DocumentColorRequest}}),Object.defineProperty(t,"ColorPresentationRequest",{enumerable:!0,get:function(){return c.ColorPresentationRequest}});const u=ra;Object.defineProperty(t,"FoldingRangeRequest",{enumerable:!0,get:function(){return u.FoldingRangeRequest}}),Object.defineProperty(t,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return u.FoldingRangeRefreshRequest}});const l=Gf;Object.defineProperty(t,"DeclarationRequest",{enumerable:!0,get:function(){return l.DeclarationRequest}});const d=zf;Object.defineProperty(t,"SelectionRangeRequest",{enumerable:!0,get:function(){return d.SelectionRangeRequest}});const f=Vi;Object.defineProperty(t,"WorkDoneProgress",{enumerable:!0,get:function(){return f.WorkDoneProgress}}),Object.defineProperty(t,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return f.WorkDoneProgressCreateRequest}}),Object.defineProperty(t,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return f.WorkDoneProgressCancelNotification}});const h=Yi;Object.defineProperty(t,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(t,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return h.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(t,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return h.CallHierarchyPrepareRequest}});const p=yn;Object.defineProperty(t,"TokenFormat",{enumerable:!0,get:function(){return p.TokenFormat}}),Object.defineProperty(t,"SemanticTokensRequest",{enumerable:!0,get:function(){return p.SemanticTokensRequest}}),Object.defineProperty(t,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return p.SemanticTokensDeltaRequest}}),Object.defineProperty(t,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return p.SemanticTokensRangeRequest}}),Object.defineProperty(t,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return p.SemanticTokensRefreshRequest}}),Object.defineProperty(t,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return p.SemanticTokensRegistrationType}});const y=Kf;Object.defineProperty(t,"ShowDocumentRequest",{enumerable:!0,get:function(){return y.ShowDocumentRequest}});const T=Vf;Object.defineProperty(t,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return T.LinkedEditingRangeRequest}});const b=Gt;Object.defineProperty(t,"FileOperationPatternKind",{enumerable:!0,get:function(){return b.FileOperationPatternKind}}),Object.defineProperty(t,"DidCreateFilesNotification",{enumerable:!0,get:function(){return b.DidCreateFilesNotification}}),Object.defineProperty(t,"WillCreateFilesRequest",{enumerable:!0,get:function(){return b.WillCreateFilesRequest}}),Object.defineProperty(t,"DidRenameFilesNotification",{enumerable:!0,get:function(){return b.DidRenameFilesNotification}}),Object.defineProperty(t,"WillRenameFilesRequest",{enumerable:!0,get:function(){return b.WillRenameFilesRequest}}),Object.defineProperty(t,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return b.DidDeleteFilesNotification}}),Object.defineProperty(t,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return b.WillDeleteFilesRequest}});const v=Xi;Object.defineProperty(t,"UniquenessLevel",{enumerable:!0,get:function(){return v.UniquenessLevel}}),Object.defineProperty(t,"MonikerKind",{enumerable:!0,get:function(){return v.MonikerKind}}),Object.defineProperty(t,"MonikerRequest",{enumerable:!0,get:function(){return v.MonikerRequest}});const D=Ji;Object.defineProperty(t,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return D.TypeHierarchyPrepareRequest}}),Object.defineProperty(t,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return D.TypeHierarchySubtypesRequest}}),Object.defineProperty(t,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return D.TypeHierarchySupertypesRequest}});const k=oa;Object.defineProperty(t,"InlineValueRequest",{enumerable:!0,get:function(){return k.InlineValueRequest}}),Object.defineProperty(t,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return k.InlineValueRefreshRequest}});const P=Zi;Object.defineProperty(t,"InlayHintRequest",{enumerable:!0,get:function(){return P.InlayHintRequest}}),Object.defineProperty(t,"InlayHintResolveRequest",{enumerable:!0,get:function(){return P.InlayHintResolveRequest}}),Object.defineProperty(t,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return P.InlayHintRefreshRequest}});const M=qn;Object.defineProperty(t,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return M.DiagnosticServerCancellationData}}),Object.defineProperty(t,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return M.DocumentDiagnosticReportKind}}),Object.defineProperty(t,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return M.DocumentDiagnosticRequest}}),Object.defineProperty(t,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return M.WorkspaceDiagnosticRequest}}),Object.defineProperty(t,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return M.DiagnosticRefreshRequest}});const I=gt;Object.defineProperty(t,"NotebookCellKind",{enumerable:!0,get:function(){return I.NotebookCellKind}}),Object.defineProperty(t,"ExecutionSummary",{enumerable:!0,get:function(){return I.ExecutionSummary}}),Object.defineProperty(t,"NotebookCell",{enumerable:!0,get:function(){return I.NotebookCell}}),Object.defineProperty(t,"NotebookDocument",{enumerable:!0,get:function(){return I.NotebookDocument}}),Object.defineProperty(t,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return I.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(t,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return I.DidOpenNotebookDocumentNotification}}),Object.defineProperty(t,"NotebookCellArrayChange",{enumerable:!0,get:function(){return I.NotebookCellArrayChange}}),Object.defineProperty(t,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return I.DidChangeNotebookDocumentNotification}}),Object.defineProperty(t,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return I.DidSaveNotebookDocumentNotification}}),Object.defineProperty(t,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return I.DidCloseNotebookDocumentNotification}});const G=Jf;Object.defineProperty(t,"InlineCompletionRequest",{enumerable:!0,get:function(){return G.InlineCompletionRequest}});var U;(function(g){function S(m){const _=m;return r.string(_)||r.string(_.language)||r.string(_.scheme)||r.string(_.pattern)}g.is=S})(U||(t.TextDocumentFilter=U={}));var W;(function(g){function S(m){const _=m;return r.objectLiteral(_)&&(r.string(_.notebookType)||r.string(_.scheme)||r.string(_.pattern))}g.is=S})(W||(t.NotebookDocumentFilter=W={}));var A;(function(g){function S(m){const _=m;return r.objectLiteral(_)&&(r.string(_.notebook)||W.is(_.notebook))&&(_.language===void 0||r.string(_.language))}g.is=S})(A||(t.NotebookCellTextDocumentFilter=A={}));var $;(function(g){function S(m){if(!Array.isArray(m))return!1;for(let _ of m)if(!r.string(_)&&!U.is(_)&&!A.is(_))return!1;return!0}g.is=S})($||(t.DocumentSelector=$={}));var R;(function(g){g.method="client/registerCapability",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(R||(t.RegistrationRequest=R={}));var L;(function(g){g.method="client/unregisterCapability",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(L||(t.UnregistrationRequest=L={}));var q;(function(g){g.Create="create",g.Rename="rename",g.Delete="delete"})(q||(t.ResourceOperationKind=q={}));var j;(function(g){g.Abort="abort",g.Transactional="transactional",g.TextOnlyTransactional="textOnlyTransactional",g.Undo="undo"})(j||(t.FailureHandlingKind=j={}));var z;(function(g){g.UTF8="utf-8",g.UTF16="utf-16",g.UTF32="utf-32"})(z||(t.PositionEncodingKind=z={}));var Ne;(function(g){function S(m){const _=m;return _&&r.string(_.id)&&_.id.length>0}g.hasId=S})(Ne||(t.StaticRegistrationOptions=Ne={}));var J;(function(g){function S(m){const _=m;return _&&(_.documentSelector===null||$.is(_.documentSelector))}g.is=S})(J||(t.TextDocumentRegistrationOptions=J={}));var B;(function(g){function S(_){const E=_;return r.objectLiteral(E)&&(E.workDoneProgress===void 0||r.boolean(E.workDoneProgress))}g.is=S;function m(_){const E=_;return E&&r.boolean(E.workDoneProgress)}g.hasWorkDoneProgress=m})(B||(t.WorkDoneProgressOptions=B={}));var me;(function(g){g.method="initialize",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(me||(t.InitializeRequest=me={}));var Nt;(function(g){g.unknownProtocolVersion=1})(Nt||(t.InitializeErrorCodes=Nt={}));var sn;(function(g){g.method="initialized",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(sn||(t.InitializedNotification=sn={}));var He;(function(g){g.method="shutdown",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType0(g.method)})(He||(t.ShutdownRequest=He={}));var Dn;(function(g){g.method="exit",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType0(g.method)})(Dn||(t.ExitNotification=Dn={}));var qe;(function(g){g.method="workspace/didChangeConfiguration",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(qe||(t.DidChangeConfigurationNotification=qe={}));var ut;(function(g){g.Error=1,g.Warning=2,g.Info=3,g.Log=4,g.Debug=5})(ut||(t.MessageType=ut={}));var wt;(function(g){g.method="window/showMessage",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(wt||(t.ShowMessageNotification=wt={}));var We;(function(g){g.method="window/showMessageRequest",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType(g.method)})(We||(t.ShowMessageRequest=We={}));var bt;(function(g){g.method="window/logMessage",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(bt||(t.LogMessageNotification=bt={}));var tt;(function(g){g.method="telemetry/event",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(tt||(t.TelemetryEventNotification=tt={}));var fe;(function(g){g.None=0,g.Full=1,g.Incremental=2})(fe||(t.TextDocumentSyncKind=fe={}));var st;(function(g){g.method="textDocument/didOpen",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(st||(t.DidOpenTextDocumentNotification=st={}));var Me;(function(g){function S(_){let E=_;return E!=null&&typeof E.text=="string"&&E.range!==void 0&&(E.rangeLength===void 0||typeof E.rangeLength=="number")}g.isIncremental=S;function m(_){let E=_;return E!=null&&typeof E.text=="string"&&E.range===void 0&&E.rangeLength===void 0}g.isFull=m})(Me||(t.TextDocumentContentChangeEvent=Me={}));var Ot;(function(g){g.method="textDocument/didChange",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(Ot||(t.DidChangeTextDocumentNotification=Ot={}));var qr;(function(g){g.method="textDocument/didClose",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(qr||(t.DidCloseTextDocumentNotification=qr={}));var vi;(function(g){g.method="textDocument/didSave",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(vi||(t.DidSaveTextDocumentNotification=vi={}));var wi;(function(g){g.Manual=1,g.AfterDelay=2,g.FocusOut=3})(wi||(t.TextDocumentSaveReason=wi={}));var bi;(function(g){g.method="textDocument/willSave",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(bi||(t.WillSaveTextDocumentNotification=bi={}));var Di;(function(g){g.method="textDocument/willSaveWaitUntil",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Di||(t.WillSaveTextDocumentWaitUntilRequest=Di={}));var on;(function(g){g.method="workspace/didChangeWatchedFiles",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolNotificationType(g.method)})(on||(t.DidChangeWatchedFilesNotification=on={}));var Ei;(function(g){g.Created=1,g.Changed=2,g.Deleted=3})(Ei||(t.FileChangeType=Ei={}));var ys;(function(g){function S(m){const _=m;return r.objectLiteral(_)&&(n.URI.is(_.baseUri)||n.WorkspaceFolder.is(_.baseUri))&&r.string(_.pattern)}g.is=S})(ys||(t.RelativePattern=ys={}));var vs;(function(g){g.Create=1,g.Change=2,g.Delete=4})(vs||(t.WatchKind=vs={}));var Wr;(function(g){g.method="textDocument/publishDiagnostics",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolNotificationType(g.method)})(Wr||(t.PublishDiagnosticsNotification=Wr={}));var ws;(function(g){g.Invoked=1,g.TriggerCharacter=2,g.TriggerForIncompleteCompletions=3})(ws||(t.CompletionTriggerKind=ws={}));var Ti;(function(g){g.method="textDocument/completion",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ti||(t.CompletionRequest=Ti={}));var Ri;(function(g){g.method="completionItem/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ri||(t.CompletionResolveRequest=Ri={}));var An;(function(g){g.method="textDocument/hover",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(An||(t.HoverRequest=An={}));var Si;(function(g){g.Invoked=1,g.TriggerCharacter=2,g.ContentChange=3})(Si||(t.SignatureHelpTriggerKind=Si={}));var bs;(function(g){g.method="textDocument/signatureHelp",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(bs||(t.SignatureHelpRequest=bs={}));var Ds;(function(g){g.method="textDocument/definition",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ds||(t.DefinitionRequest=Ds={}));var $i;(function(g){g.method="textDocument/references",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})($i||(t.ReferencesRequest=$i={}));var ki;(function(g){g.method="textDocument/documentHighlight",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ki||(t.DocumentHighlightRequest=ki={}));var Es;(function(g){g.method="textDocument/documentSymbol",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Es||(t.DocumentSymbolRequest=Es={}));var Ts;(function(g){g.method="textDocument/codeAction",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ts||(t.CodeActionRequest=Ts={}));var Rs;(function(g){g.method="codeAction/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Rs||(t.CodeActionResolveRequest=Rs={}));var Ss;(function(g){g.method="workspace/symbol",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ss||(t.WorkspaceSymbolRequest=Ss={}));var Ci;(function(g){g.method="workspaceSymbol/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Ci||(t.WorkspaceSymbolResolveRequest=Ci={}));var _i;(function(g){g.method="textDocument/codeLens",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(_i||(t.CodeLensRequest=_i={}));var an;(function(g){g.method="codeLens/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(an||(t.CodeLensResolveRequest=an={}));var $s;(function(g){g.method="workspace/codeLens/refresh",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType0(g.method)})($s||(t.CodeLensRefreshRequest=$s={}));var ks;(function(g){g.method="textDocument/documentLink",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(ks||(t.DocumentLinkRequest=ks={}));var pr;(function(g){g.method="documentLink/resolve",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(pr||(t.DocumentLinkResolveRequest=pr={}));var Cs;(function(g){g.method="textDocument/formatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Cs||(t.DocumentFormattingRequest=Cs={}));var Gr;(function(g){g.method="textDocument/rangeFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(Gr||(t.DocumentRangeFormattingRequest=Gr={}));var _s;(function(g){g.method="textDocument/rangesFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(_s||(t.DocumentRangesFormattingRequest=_s={}));var In;(function(g){g.method="textDocument/onTypeFormatting",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(In||(t.DocumentOnTypeFormattingRequest=In={}));var Yn;(function(g){g.Identifier=1})(Yn||(t.PrepareSupportDefaultBehavior=Yn={}));var vo;(function(g){g.method="textDocument/rename",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(vo||(t.RenameRequest=vo={}));var x;(function(g){g.method="textDocument/prepareRename",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(x||(t.PrepareRenameRequest=x={}));var w;(function(g){g.method="workspace/executeCommand",g.messageDirection=e.MessageDirection.clientToServer,g.type=new e.ProtocolRequestType(g.method)})(w||(t.ExecuteCommandRequest=w={}));var C;(function(g){g.method="workspace/applyEdit",g.messageDirection=e.MessageDirection.serverToClient,g.type=new e.ProtocolRequestType("workspace/applyEdit")})(C||(t.ApplyWorkspaceEditRequest=C={}))}(p$);var Zf={};Object.defineProperty(Zf,"__esModule",{value:!0}),Zf.createProtocolConnection=void 0;const kk=mn;function V7(t,e,n,r){return kk.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,kk.createMessageConnection)(t,e,n,r)}Zf.createProtocolConnection=V7,function(t){var e=mt&&mt.__createBinding||(Object.create?function(s,o,a,c){c===void 0&&(c=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,c,u)}:function(s,o,a,c){c===void 0&&(c=a),s[c]=o[a]}),n=mt&&mt.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.LSPErrorCodes=t.createProtocolConnection=void 0,n(mn,t),n(uv,t),n(Te,t),n(p$,t);var r=Zf;Object.defineProperty(t,"createProtocolConnection",{enumerable:!0,get:function(){return r.createProtocolConnection}});var i;(function(s){s.lspReservedErrorRangeStart=-32899,s.RequestFailed=-32803,s.ServerCancelled=-32802,s.ContentModified=-32801,s.RequestCancelled=-32800,s.lspReservedErrorRangeEnd=-32800})(i||(t.LSPErrorCodes=i={}))}(d$),function(t){var e=mt&&mt.__createBinding||(Object.create?function(s,o,a,c){c===void 0&&(c=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,c,u)}:function(s,o,a,c){c===void 0&&(c=a),s[c]=o[a]}),n=mt&&mt.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&e(o,s,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.createProtocolConnection=void 0;const r=l$;n(l$,t),n(d$,t);function i(s,o,a,c){return(0,r.createMessageConnection)(s,o,a,c)}t.createProtocolConnection=i}(et);var Cn={};Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.generateUuid=Cn.parse=Cn.isUUID=Cn.v4=Cn.empty=void 0;class fv{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}}class we extends fv{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return we._oneOf(we._chars)}constructor(){super([we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),"-",we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),"-","4",we._randomHex(),we._randomHex(),we._randomHex(),"-",we._oneOf(we._timeHighBits),we._randomHex(),we._randomHex(),we._randomHex(),"-",we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex(),we._randomHex()].join(""))}}we._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"],we._timeHighBits=["8","9","a","b"],Cn.empty=new fv("00000000-0000-0000-0000-000000000000");function Ck(){return new we}Cn.v4=Ck;const Y7=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function _k(t){return Y7.test(t)}Cn.isUUID=_k;function X7(t){if(!_k(t))throw new Error("invalid uuid");return new fv(t)}Cn.parse=X7;function J7(){return Ck().asHex()}Cn.generateUuid=J7;var Qi={};Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.attachPartialResult=Qi.ProgressFeature=Qi.attachWorkDone=void 0;const es=et,Z7=Cn;class ms{constructor(e,n){this._connection=e,this._token=n,ms.Instances.set(this._token,this)}begin(e,n,r,i){let s={kind:"begin",title:e,percentage:n,message:r,cancellable:i};this._connection.sendProgress(es.WorkDoneProgress.type,this._token,s)}report(e,n){let r={kind:"report"};typeof e=="number"?(r.percentage=e,n!==void 0&&(r.message=n)):r.message=e,this._connection.sendProgress(es.WorkDoneProgress.type,this._token,r)}done(){ms.Instances.delete(this._token),this._connection.sendProgress(es.WorkDoneProgress.type,this._token,{kind:"end"})}}ms.Instances=new Map;class Ak extends ms{constructor(e,n){super(e,n),this._source=new es.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}}class hv{constructor(){}begin(){}report(){}done(){}}class Ik extends hv{constructor(){super(),this._source=new es.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}}function Q7(t,e){if(e===void 0||e.workDoneToken===void 0)return new hv;const n=e.workDoneToken;return delete e.workDoneToken,new ms(t,n)}Qi.attachWorkDone=Q7;const eq=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(es.WorkDoneProgressCancelNotification.type,n=>{let r=ms.Instances.get(n.token);(r instanceof Ak||r instanceof Ik)&&r.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new hv:new ms(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){const e=(0,Z7.generateUuid)();return this.connection.sendRequest(es.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Ak(this.connection,e))}else return Promise.resolve(new Ik)}};Qi.ProgressFeature=eq;var pv;(function(t){t.type=new es.ProgressType})(pv||(pv={}));class tq{constructor(e,n){this._connection=e,this._token=n}report(e){this._connection.sendProgress(pv.type,this._token,e)}}function nq(t,e){if(e===void 0||e.partialResultToken===void 0)return;const n=e.partialResultToken;return delete e.partialResultToken,new tq(t,n)}Qi.attachPartialResult=nq;var Qf={};Object.defineProperty(Qf,"__esModule",{value:!0}),Qf.ConfigurationFeature=void 0;const rq=et,iq=ht,sq=t=>class extends t{getConfiguration(e){return e?iq.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let n={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(rq.ConfigurationRequest.type,n).then(r=>Array.isArray(r)?Array.isArray(e)?r:r[0]:Array.isArray(e)?[]:null)}};Qf.ConfigurationFeature=sq;var eh={};Object.defineProperty(eh,"__esModule",{value:!0}),eh.WorkspaceFoldersFeature=void 0;const th=et,oq=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let n=e.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new th.Emitter,this.connection.onNotification(th.DidChangeWorkspaceFoldersNotification.type,r=>{this._onDidChangeWorkspaceFolders.fire(r.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);const n=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=n===!0||typeof n=="string"}getWorkspaceFolders(){return this.connection.sendRequest(th.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(th.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};eh.WorkspaceFoldersFeature=oq;var nh={};Object.defineProperty(nh,"__esModule",{value:!0}),nh.CallHierarchyFeature=void 0;const gv=et,aq=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(gv.CallHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onIncomingCalls:e=>{const n=gv.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onOutgoingCalls:e=>{const n=gv.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};nh.CallHierarchyFeature=aq;var yi={};Object.defineProperty(yi,"__esModule",{value:!0}),yi.SemanticTokensBuilder=yi.SemanticTokensDiff=yi.SemanticTokensFeature=void 0;const rh=et,cq=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(rh.SemanticTokensRefreshRequest.type),on:e=>{const n=rh.SemanticTokensRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onDelta:e=>{const n=rh.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onRange:e=>{const n=rh.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};yi.SemanticTokensFeature=cq;class xk{constructor(e,n){this.originalSequence=e,this.modifiedSequence=n}computeDiff(){const e=this.originalSequence.length,n=this.modifiedSequence.length;let r=0;for(;r<n&&r<e&&this.originalSequence[r]===this.modifiedSequence[r];)r++;if(r<n&&r<e){let i=e-1,s=n-1;for(;i>=r&&s>=r&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<r||s<r)&&(i++,s++);const o=i-r+1,a=this.modifiedSequence.slice(r,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:r,deleteCount:o-1}]:[{start:r,deleteCount:o,data:a}]}else return r<n?[{start:r,deleteCount:0,data:this.modifiedSequence.slice(r)}]:r<e?[{start:r,deleteCount:e-r}]:[]}}yi.SemanticTokensDiff=xk;let uq=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(e,n,r,i,s){let o=e,a=n;this._dataLen>0&&(o-=this._prevLine,o===0&&(a-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=a,this._data[this._dataLen++]=r,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,this._prevLine=e,this._prevChar=n}get id(){return this._id.toString()}previousResult(e){this.id===e&&(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?{resultId:this.id,edits:new xk(this._prevData,this._data).computeDiff()}:this.build()}};yi.SemanticTokensBuilder=uq;var ih={};Object.defineProperty(ih,"__esModule",{value:!0}),ih.ShowDocumentFeature=void 0;const lq=et,dq=t=>class extends t{showDocument(e){return this.connection.sendRequest(lq.ShowDocumentRequest.type,e)}};ih.ShowDocumentFeature=dq;var sh={};Object.defineProperty(sh,"__esModule",{value:!0}),sh.FileOperationsFeature=void 0;const la=et,fq=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(la.DidCreateFilesNotification.type,n=>{e(n)})}onDidRenameFiles(e){return this.connection.onNotification(la.DidRenameFilesNotification.type,n=>{e(n)})}onDidDeleteFiles(e){return this.connection.onNotification(la.DidDeleteFilesNotification.type,n=>{e(n)})}onWillCreateFiles(e){return this.connection.onRequest(la.WillCreateFilesRequest.type,(n,r)=>e(n,r))}onWillRenameFiles(e){return this.connection.onRequest(la.WillRenameFilesRequest.type,(n,r)=>e(n,r))}onWillDeleteFiles(e){return this.connection.onRequest(la.WillDeleteFilesRequest.type,(n,r)=>e(n,r))}};sh.FileOperationsFeature=fq;var oh={};Object.defineProperty(oh,"__esModule",{value:!0}),oh.LinkedEditingRangeFeature=void 0;const hq=et,pq=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(hq.LinkedEditingRangeRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0))}};oh.LinkedEditingRangeFeature=pq;var ah={};Object.defineProperty(ah,"__esModule",{value:!0}),ah.TypeHierarchyFeature=void 0;const mv=et,gq=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(mv.TypeHierarchyPrepareRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),void 0)),onSupertypes:e=>{const n=mv.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))},onSubtypes:e=>{const n=mv.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};ah.TypeHierarchyFeature=gq;var ch={};Object.defineProperty(ch,"__esModule",{value:!0}),ch.InlineValueFeature=void 0;const Pk=et,mq=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(Pk.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(Pk.InlineValueRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};ch.InlineValueFeature=mq;var uh={};Object.defineProperty(uh,"__esModule",{value:!0}),uh.FoldingRangeFeature=void 0;const Nk=et,yq=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(Nk.FoldingRangeRefreshRequest.type),on:e=>{const n=Nk.FoldingRangeRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};uh.FoldingRangeFeature=yq;var lh={};Object.defineProperty(lh,"__esModule",{value:!0}),lh.InlayHintFeature=void 0;const yv=et,vq=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(yv.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(yv.InlayHintRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n))),resolve:e=>this.connection.onRequest(yv.InlayHintResolveRequest.type,(n,r)=>e(n,r))}}};lh.InlayHintFeature=vq;var dh={};Object.defineProperty(dh,"__esModule",{value:!0}),dh.DiagnosticFeature=void 0;const du=et,wq=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(du.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(du.DocumentDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(du.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:e=>this.connection.onRequest(du.WorkspaceDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(du.WorkspaceDiagnosticRequest.partialResult,n)))}}};dh.DiagnosticFeature=wq;var Xs={},fu={};Object.defineProperty(fu,"__esModule",{value:!0}),fu.TextDocuments=void 0;const Js=et;class bq{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Js.Emitter,this._onDidOpen=new Js.Emitter,this._onDidClose=new Js.Emitter,this._onDidSave=new Js.Emitter,this._onWillSave=new Js.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Js.TextDocumentSyncKind.Incremental;const n=[];return n.push(e.onDidOpenTextDocument(r=>{const i=r.textDocument,s=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,s);const o=Object.freeze({document:s});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),n.push(e.onDidChangeTextDocument(r=>{const i=r.textDocument,s=r.contentChanges;if(s.length===0)return;const{version:o}=i;if(o==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,s,o),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),n.push(e.onDidCloseTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(r.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),n.push(e.onWillSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{let s=this._syncedDocuments.get(r.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{let i=this._syncedDocuments.get(r.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Js.Disposable.create(()=>{n.forEach(r=>r.dispose())})}}fu.TextDocuments=bq,Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.NotebookDocuments=Xs.NotebookSyncFeature=void 0;const Wn=et,Ok=fu,Dq=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Wn.DidOpenNotebookDocumentNotification.type,n=>{e(n)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Wn.DidChangeNotebookDocumentNotification.type,n=>{e(n)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Wn.DidSaveNotebookDocumentNotification.type,n=>{e(n)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Wn.DidCloseNotebookDocumentNotification.type,n=>{e(n)})}}};Xs.NotebookSyncFeature=Dq;class ja{onDidOpenTextDocument(e){return this.openHandler=e,Wn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Wn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Wn.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return ja.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return ja.NULL_DISPOSE}onDidSaveTextDocument(){return ja.NULL_DISPOSE}}ja.NULL_DISPOSE=Object.freeze({dispose:()=>{}});class Eq{constructor(e){e instanceof Ok.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new Ok.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Wn.Emitter,this._onDidChange=new Wn.Emitter,this._onDidSave=new Wn.Emitter,this._onDidClose=new Wn.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){const n=this.notebookCellMap.get(e);return n&&n[0]}findNotebookDocumentForCell(e){const n=typeof e=="string"?e:e.document,r=this.notebookCellMap.get(n);return r&&r[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(e){const n=new ja,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(const s of i.cellTextDocuments)n.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),r.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);if(s===void 0)return;s.version=i.notebookDocument.version;const o=s.metadata;let a=!1;const c=i.change;c.metadata!==void 0&&(a=!0,s.metadata=c.metadata);const u=[],l=[],d=[],f=[];if(c.cells!==void 0){const b=c.cells;if(b.structure!==void 0){const v=b.structure.array;if(s.cells.splice(v.start,v.deleteCount,...v.cells!==void 0?v.cells:[]),b.structure.didOpen!==void 0)for(const D of b.structure.didOpen)n.openTextDocument({textDocument:D}),u.push(D.uri);if(b.structure.didClose)for(const D of b.structure.didClose)n.closeTextDocument({textDocument:D}),l.push(D.uri)}if(b.data!==void 0){const v=new Map(b.data.map(D=>[D.document,D]));for(let D=0;D<=s.cells.length;D++){const k=v.get(s.cells[D].document);if(k!==void 0){const P=s.cells.splice(D,1,k);if(d.push({old:P[0],new:k}),v.delete(k.document),v.size===0)break}}}if(b.textContent!==void 0)for(const v of b.textContent)n.changeTextDocument({textDocument:v.document,contentChanges:v.changes}),f.push(v.document.uri)}this.updateCellMap(s);const h={notebookDocument:s};a&&(h.metadata={old:o,new:s.metadata});const p=[];for(const b of u)p.push(this.getNotebookCell(b));const y=[];for(const b of l)y.push(this.getNotebookCell(b));const T=[];for(const b of f)T.push(this.getNotebookCell(b));(p.length>0||y.length>0||d.length>0||T.length>0)&&(h.cells={added:p,removed:y,changed:{data:d,textContent:T}}),(h.metadata!==void 0||h.cells!==void 0)&&this._onDidChange.fire(h)})),r.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),r.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{const s=this.notebookDocuments.get(i.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(const o of i.cellTextDocuments)n.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(const o of s.cells)this.notebookCellMap.delete(o.document)}})),Wn.Disposable.create(()=>{r.forEach(i=>i.dispose())})}updateCellMap(e){for(const n of e.cells)this.notebookCellMap.set(n.document,[n,e])}}Xs.NotebookDocuments=Eq;var fh={};Object.defineProperty(fh,"__esModule",{value:!0}),fh.MonikerFeature=void 0;const Tq=et,Rq=t=>class extends t{get moniker(){return{on:e=>{const n=Tq.MonikerRequest.type;return this.connection.onRequest(n,(r,i)=>e(r,i,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(n,r)))}}}};fh.MonikerFeature=Rq,Object.defineProperty(_e,"__esModule",{value:!0}),_e.createConnection=_e.combineFeatures=_e.combineNotebooksFeatures=_e.combineLanguagesFeatures=_e.combineWorkspaceFeatures=_e.combineWindowFeatures=_e.combineClientFeatures=_e.combineTracerFeatures=_e.combineTelemetryFeatures=_e.combineConsoleFeatures=_e._NotebooksImpl=_e._LanguagesImpl=_e.BulkUnregistration=_e.BulkRegistration=_e.ErrorMessageTracker=void 0;const X=et,Gn=ht,vv=Cn,ue=Qi,Sq=Qf,$q=eh,kq=nh,Cq=yi,_q=ih,Aq=sh,Iq=oh,xq=ah,Pq=ch,Nq=uh,Oq=lh,Fq=dh,Lq=Xs,Mq=fh;function wv(t){if(t!==null)return t}class Bq{constructor(){this._messages=Object.create(null)}add(e){let n=this._messages[e];n||(n=0),n++,this._messages[e]=n}sendErrors(e){Object.keys(this._messages).forEach(n=>{e.window.showErrorMessage(n)})}}_e.ErrorMessageTracker=Bq;class Fk{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(X.MessageType.Error,e)}warn(e){this.send(X.MessageType.Warning,e)}info(e){this.send(X.MessageType.Info,e)}log(e){this.send(X.MessageType.Log,e)}debug(e){this.send(X.MessageType.Debug,e)}send(e,n){this._rawConnection&&this._rawConnection.sendNotification(X.LogMessageNotification.type,{type:e,message:n}).catch(()=>{(0,X.RAL)().console.error("Sending log message failed")})}}class jq{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...n){let r={type:X.MessageType.Error,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(wv)}showWarningMessage(e,...n){let r={type:X.MessageType.Warning,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(wv)}showInformationMessage(e,...n){let r={type:X.MessageType.Info,message:e,actions:n};return this.connection.sendRequest(X.ShowMessageRequest.type,r).then(wv)}}const Lk=(0,_q.ShowDocumentFeature)((0,ue.ProgressFeature)(jq));var Mk;(function(t){function e(){return new Bk}t.create=e})(Mk||(_e.BulkRegistration=Mk={}));class Bk{constructor(){this._registrations=[],this._registered=new Set}add(e,n){const r=Gn.string(e)?e:e.method;if(this._registered.has(r))throw new Error(`${r} is already added to this registration`);const i=vv.generateUuid();this._registrations.push({id:i,method:r,registerOptions:n||{}}),this._registered.add(r)}asRegistrationParams(){return{registrations:this._registrations}}}var jk;(function(t){function e(){return new bv(void 0,[])}t.create=e})(jk||(_e.BulkUnregistration=jk={}));class bv{constructor(e,n){this._connection=e,this._unregistrations=new Map,n.forEach(r=>{this._unregistrations.set(r.method,r)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let r of this._unregistrations.values())e.push(r);let n={unregisterations:e};this._connection.sendRequest(X.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){const n=Gn.string(e)?e:e.method,r=this._unregistrations.get(n);if(!r)return!1;let i={unregisterations:[r]};return this._connection.sendRequest(X.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(n)},s=>{this._connection.console.info(`Un-registering request handler for ${r.id} failed.`)}),!0}}class Uk{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,n,r){return e instanceof Bk?this.registerMany(e):e instanceof bv?this.registerSingle1(e,n,r):this.registerSingle2(e,n)}registerSingle1(e,n,r){const i=Gn.string(n)?n:n.method,s=vv.generateUuid();let o={registrations:[{id:s,method:i,registerOptions:r||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(X.RegistrationRequest.type,o).then(a=>(e.add({id:s,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,n){const r=Gn.string(e)?e:e.method,i=vv.generateUuid();let s={registrations:[{id:i,method:r,registerOptions:n||{}}]};return this.connection.sendRequest(X.RegistrationRequest.type,s).then(o=>X.Disposable.create(()=>{this.unregisterSingle(i,r).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${r} failed.`),Promise.reject(o)))}unregisterSingle(e,n){let r={unregisterations:[{id:e,method:n}]};return this.connection.sendRequest(X.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let n=e.asRegistrationParams();return this.connection.sendRequest(X.RegistrationRequest.type,n).then(()=>new bv(this._connection,n.registrations.map(r=>({id:r.id,method:r.method}))),r=>(this.connection.console.info("Bulk registration failed."),Promise.reject(r)))}}class Uq{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function n(i){return i&&!!i.edit}let r=n(e)?e:{edit:e};return this.connection.sendRequest(X.ApplyWorkspaceEditRequest.type,r)}}const qk=(0,Aq.FileOperationsFeature)((0,$q.WorkspaceFoldersFeature)((0,Sq.ConfigurationFeature)(Uq)));class Wk{constructor(){this._trace=X.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,n){this._trace!==X.Trace.Off&&this.connection.sendNotification(X.LogTraceNotification.type,{message:e,verbose:this._trace===X.Trace.Verbose?n:void 0}).catch(()=>{})}}class Gk{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(X.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}}class zk{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ue.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ue.attachPartialResult)(this.connection,n)}}_e._LanguagesImpl=zk;const Hk=(0,Nq.FoldingRangeFeature)((0,Mq.MonikerFeature)((0,Fq.DiagnosticFeature)((0,Oq.InlayHintFeature)((0,Pq.InlineValueFeature)((0,xq.TypeHierarchyFeature)((0,Iq.LinkedEditingRangeFeature)((0,Cq.SemanticTokensFeature)((0,kq.CallHierarchyFeature)(zk)))))))));class Kk{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,ue.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,n){return(0,ue.attachPartialResult)(this.connection,n)}}_e._NotebooksImpl=Kk;const Vk=(0,Lq.NotebookSyncFeature)(Kk);function Yk(t,e){return function(n){return e(t(n))}}_e.combineConsoleFeatures=Yk;function Xk(t,e){return function(n){return e(t(n))}}_e.combineTelemetryFeatures=Xk;function Jk(t,e){return function(n){return e(t(n))}}_e.combineTracerFeatures=Jk;function Zk(t,e){return function(n){return e(t(n))}}_e.combineClientFeatures=Zk;function Qk(t,e){return function(n){return e(t(n))}}_e.combineWindowFeatures=Qk;function eC(t,e){return function(n){return e(t(n))}}_e.combineWorkspaceFeatures=eC;function tC(t,e){return function(n){return e(t(n))}}_e.combineLanguagesFeatures=tC;function nC(t,e){return function(n){return e(t(n))}}_e.combineNotebooksFeatures=nC;function qq(t,e){function n(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:n(t.console,e.console,Yk),tracer:n(t.tracer,e.tracer,Jk),telemetry:n(t.telemetry,e.telemetry,Xk),client:n(t.client,e.client,Zk),window:n(t.window,e.window,Qk),workspace:n(t.workspace,e.workspace,eC),languages:n(t.languages,e.languages,tC),notebooks:n(t.notebooks,e.notebooks,nC)}}_e.combineFeatures=qq;function Wq(t,e,n){const r=n&&n.console?new(n.console(Fk)):new Fk,i=t(r);r.rawAttach(i);const s=n&&n.tracer?new(n.tracer(Wk)):new Wk,o=n&&n.telemetry?new(n.telemetry(Gk)):new Gk,a=n&&n.client?new(n.client(Uk)):new Uk,c=n&&n.window?new(n.window(Lk)):new Lk,u=n&&n.workspace?new(n.workspace(qk)):new qk,l=n&&n.languages?new(n.languages(Hk)):new Hk,d=n&&n.notebooks?new(n.notebooks(Vk)):new Vk,f=[r,s,o,a,c,u,l,d];function h(v){return v instanceof Promise?v:Gn.thenable(v)?new Promise((D,k)=>{v.then(P=>D(P),P=>k(P))}):Promise.resolve(v)}let p,y,T,b={listen:()=>i.listen(),sendRequest:(v,...D)=>i.sendRequest(Gn.string(v)?v:v.method,...D),onRequest:(v,D)=>i.onRequest(v,D),sendNotification:(v,D)=>{const k=Gn.string(v)?v:v.method;return i.sendNotification(k,D)},onNotification:(v,D)=>i.onNotification(v,D),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:v=>(y=v,{dispose:()=>{y=void 0}}),onInitialized:v=>i.onNotification(X.InitializedNotification.type,v),onShutdown:v=>(p=v,{dispose:()=>{p=void 0}}),onExit:v=>(T=v,{dispose:()=>{T=void 0}}),get console(){return r},get telemetry(){return o},get tracer(){return s},get client(){return a},get window(){return c},get workspace(){return u},get languages(){return l},get notebooks(){return d},onDidChangeConfiguration:v=>i.onNotification(X.DidChangeConfigurationNotification.type,v),onDidChangeWatchedFiles:v=>i.onNotification(X.DidChangeWatchedFilesNotification.type,v),__textDocumentSync:void 0,onDidOpenTextDocument:v=>i.onNotification(X.DidOpenTextDocumentNotification.type,v),onDidChangeTextDocument:v=>i.onNotification(X.DidChangeTextDocumentNotification.type,v),onDidCloseTextDocument:v=>i.onNotification(X.DidCloseTextDocumentNotification.type,v),onWillSaveTextDocument:v=>i.onNotification(X.WillSaveTextDocumentNotification.type,v),onWillSaveTextDocumentWaitUntil:v=>i.onRequest(X.WillSaveTextDocumentWaitUntilRequest.type,v),onDidSaveTextDocument:v=>i.onNotification(X.DidSaveTextDocumentNotification.type,v),sendDiagnostics:v=>i.sendNotification(X.PublishDiagnosticsNotification.type,v),onHover:v=>i.onRequest(X.HoverRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),void 0)),onCompletion:v=>i.onRequest(X.CompletionRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onCompletionResolve:v=>i.onRequest(X.CompletionResolveRequest.type,v),onSignatureHelp:v=>i.onRequest(X.SignatureHelpRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),void 0)),onDeclaration:v=>i.onRequest(X.DeclarationRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onDefinition:v=>i.onRequest(X.DefinitionRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onTypeDefinition:v=>i.onRequest(X.TypeDefinitionRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onImplementation:v=>i.onRequest(X.ImplementationRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onReferences:v=>i.onRequest(X.ReferencesRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onDocumentHighlight:v=>i.onRequest(X.DocumentHighlightRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onDocumentSymbol:v=>i.onRequest(X.DocumentSymbolRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onWorkspaceSymbol:v=>i.onRequest(X.WorkspaceSymbolRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onWorkspaceSymbolResolve:v=>i.onRequest(X.WorkspaceSymbolResolveRequest.type,v),onCodeAction:v=>i.onRequest(X.CodeActionRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onCodeActionResolve:v=>i.onRequest(X.CodeActionResolveRequest.type,(D,k)=>v(D,k)),onCodeLens:v=>i.onRequest(X.CodeLensRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onCodeLensResolve:v=>i.onRequest(X.CodeLensResolveRequest.type,(D,k)=>v(D,k)),onDocumentFormatting:v=>i.onRequest(X.DocumentFormattingRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),void 0)),onDocumentRangeFormatting:v=>i.onRequest(X.DocumentRangeFormattingRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),void 0)),onDocumentOnTypeFormatting:v=>i.onRequest(X.DocumentOnTypeFormattingRequest.type,(D,k)=>v(D,k)),onRenameRequest:v=>i.onRequest(X.RenameRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),void 0)),onPrepareRename:v=>i.onRequest(X.PrepareRenameRequest.type,(D,k)=>v(D,k)),onDocumentLinks:v=>i.onRequest(X.DocumentLinkRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onDocumentLinkResolve:v=>i.onRequest(X.DocumentLinkResolveRequest.type,(D,k)=>v(D,k)),onDocumentColor:v=>i.onRequest(X.DocumentColorRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onColorPresentation:v=>i.onRequest(X.ColorPresentationRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onFoldingRanges:v=>i.onRequest(X.FoldingRangeRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onSelectionRanges:v=>i.onRequest(X.SelectionRangeRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),(0,ue.attachPartialResult)(i,D))),onExecuteCommand:v=>i.onRequest(X.ExecuteCommandRequest.type,(D,k)=>v(D,k,(0,ue.attachWorkDone)(i,D),void 0)),dispose:()=>i.dispose()};for(let v of f)v.attach(b);return i.onRequest(X.InitializeRequest.type,v=>{e.initialize(v),Gn.string(v.trace)&&(s.trace=X.Trace.fromString(v.trace));for(let D of f)D.initialize(v.capabilities);if(y){let D=y(v,new X.CancellationTokenSource().token,(0,ue.attachWorkDone)(i,v),void 0);return h(D).then(k=>{if(k instanceof X.ResponseError)return k;let P=k;P||(P={capabilities:{}});let M=P.capabilities;M||(M={},P.capabilities=M),M.textDocumentSync===void 0||M.textDocumentSync===null?M.textDocumentSync=Gn.number(b.__textDocumentSync)?b.__textDocumentSync:X.TextDocumentSyncKind.None:!Gn.number(M.textDocumentSync)&&!Gn.number(M.textDocumentSync.change)&&(M.textDocumentSync.change=Gn.number(b.__textDocumentSync)?b.__textDocumentSync:X.TextDocumentSyncKind.None);for(let I of f)I.fillServerCapabilities(M);return P})}else{let D={capabilities:{textDocumentSync:X.TextDocumentSyncKind.None}};for(let k of f)k.fillServerCapabilities(D.capabilities);return D}}),i.onRequest(X.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,p)return p(new X.CancellationTokenSource().token)}),i.onNotification(X.ExitNotification.type,()=>{try{T&&T()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(X.SetTraceNotification.type,v=>{s.trace=X.Trace.fromString(v.value)}),b}_e.createConnection=Wq;var vn={};const Gq=ni(BN),hh=ni(CN),rC=ni($N);Object.defineProperty(vn,"__esModule",{value:!0}),vn.resolveModulePath=vn.FileSystem=vn.resolveGlobalYarnPath=vn.resolveGlobalNodePath=vn.resolve=vn.uriToFilePath=void 0;const zq=Gq,ar=cu,Dv=hh,Ev=rC;function Hq(t){let e=zq.parse(t);if(e.protocol!=="file:"||!e.path)return;let n=e.path.split("/");for(var r=0,i=n.length;r<i;r++)n[r]=decodeURIComponent(n[r]);if(process.platform==="win32"&&n.length>1){let s=n[0],o=n[1];s.length===0&&o.length>1&&o[1]===":"&&n.shift()}return ar.normalize(n.join("/"))}vn.uriToFilePath=Hq;function Tv(){return process.platform==="win32"}function ph(t,e,n,r){const i="NODE_PATH",s=["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((o,a)=>{let c=process.env,u=Object.create(null);Object.keys(c).forEach(l=>u[l]=c[l]),e&&Dv.existsSync(e)&&(u[i]?u[i]=e+ar.delimiter+u[i]:u[i]=e,r&&r(`NODE_PATH value is: ${u[i]}`)),u.ELECTRON_RUN_AS_NODE="1";try{let l=(0,Ev.fork)("",[],{cwd:n,env:u,execArgv:["-e",s]});if(l.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}l.on("error",f=>{a(f)}),l.on("message",f=>{f.c==="r"&&(l.send({c:"e"}),f.s?o(f.r):a(new Error(`Failed to resolve module: ${t}`)))});let d={c:"rs",a:t};l.send(d)}catch(l){a(l)}})}vn.resolve=ph;function Rv(t){let e="npm";const n=Object.create(null);Object.keys(process.env).forEach(s=>n[s]=process.env[s]),n.NO_UPDATE_NOTIFIER="true";const r={encoding:"utf8",env:n};Tv()&&(e="npm.cmd",r.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,Ev.spawnSync)(e,["config","get","prefix"],r).stdout;if(!s){t&&t("'npm config get prefix' didn't return a value.");return}let o=s.trim();return t&&t(`'npm config get prefix' value is: ${o}`),o.length>0?Tv()?ar.join(o,"node_modules"):ar.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}vn.resolveGlobalNodePath=Rv;function Kq(t){let e="yarn",n={encoding:"utf8"};Tv()&&(e="yarn.cmd",n.shell=!0);let r=()=>{};try{process.on("SIGPIPE",r);let i=(0,Ev.spawnSync)(e,["global","dir","--json"],n),s=i.stdout;if(!s){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let o=s.trim().split(/\r?\n/);for(let a of o)try{let c=JSON.parse(a);if(c.type==="log")return ar.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",r)}}vn.resolveGlobalYarnPath=Kq;var Sv;(function(t){let e;function n(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Dv.existsSync(__filename.toUpperCase())||!Dv.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=n;function r(i,s){return n()?ar.normalize(s).indexOf(ar.normalize(i))===0:ar.normalize(s).toLowerCase().indexOf(ar.normalize(i).toLowerCase())===0}t.isParent=r})(Sv||(vn.FileSystem=Sv={}));function Vq(t,e,n,r){return n?(ar.isAbsolute(n)||(n=ar.join(t,n)),ph(e,n,n,r).then(i=>Sv.isParent(n,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>ph(e,Rv(r),t,r))):ph(e,Rv(r),t,r)}vn.resolveModulePath=Vq;var iC=et,sC={},gh={};Object.defineProperty(gh,"__esModule",{value:!0}),gh.InlineCompletionFeature=void 0;const Yq=et,Xq=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(Yq.InlineCompletionRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n)))}}};gh.InlineCompletionFeature=Xq,function(t){var e=mt&&mt.__createBinding||(Object.create?function(c,u,l,d){d===void 0&&(d=l);var f=Object.getOwnPropertyDescriptor(u,l);(!f||("get"in f?!u.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return u[l]}}),Object.defineProperty(c,d,f)}:function(c,u,l,d){d===void 0&&(d=l),c[d]=u[l]}),n=mt&&mt.__exportStar||function(c,u){for(var l in c)l!=="default"&&!Object.prototype.hasOwnProperty.call(u,l)&&e(u,c,l)};Object.defineProperty(t,"__esModule",{value:!0}),t.ProposedFeatures=t.NotebookDocuments=t.TextDocuments=t.SemanticTokensBuilder=void 0;const r=yi;Object.defineProperty(t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});const i=gh;n(et,t);const s=fu;Object.defineProperty(t,"TextDocuments",{enumerable:!0,get:function(){return s.TextDocuments}});const o=Xs;Object.defineProperty(t,"NotebookDocuments",{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(_e,t);var a;(function(c){c.all={__brand:"features",languages:i.InlineCompletionFeature}})(a||(t.ProposedFeatures=a={}))}(sC),function(t){var e=mt&&mt.__createBinding||(Object.create?function(b,v,D,k){k===void 0&&(k=D);var P=Object.getOwnPropertyDescriptor(v,D);(!P||("get"in P?!v.__esModule:P.writable||P.configurable))&&(P={enumerable:!0,get:function(){return v[D]}}),Object.defineProperty(b,k,P)}:function(b,v,D,k){k===void 0&&(k=D),b[k]=v[D]}),n=mt&&mt.__exportStar||function(b,v){for(var D in b)D!=="default"&&!Object.prototype.hasOwnProperty.call(v,D)&&e(v,b,D)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=t.Files=void 0;const r=m7,i=ht,s=_e,o=vn,a=iC;n(iC,t),n(sC,t);var c;(function(b){b.uriToFilePath=o.uriToFilePath,b.resolveGlobalNodePath=o.resolveGlobalNodePath,b.resolveGlobalYarnPath=o.resolveGlobalYarnPath,b.resolve=o.resolve,b.resolveModulePath=o.resolveModulePath})(c||(t.Files=c={}));function u(){}let l=!1,d;function f(){const b="--clientProcessId";function v(D){try{let k=parseInt(D);isNaN(k)||(d=setInterval(()=>{try{process.kill(k,0)}catch{process.exit(l?0:1)}},3e3))}catch{}}for(let D=2;D<process.argv.length;D++){let k=process.argv[D];if(k===b&&D+1<process.argv.length){v(process.argv[D+1]);return}else{let P=k.split("=");P[0]===b&&v(P[1])}}}f();const h={initialize:b=>{const v=b.processId;i.number(v)&&d===void 0&&setInterval(()=>{try{process.kill(v,0)}catch{process.exit(l?0:1)}},3e3)},get shutdownReceived(){return l},set shutdownReceived(b){l=b},exit:b=>{process.exit(b)}};function p(b,v,D,k){let P,M,I,G;return b!==void 0&&b.__brand==="features"&&(P=b,b=v,v=D,D=k),a.ConnectionStrategy.is(b)||a.ConnectionOptions.is(b)?G=b:(M=b,I=v,G=D),y(M,I,G,P)}t.createConnection=p;function y(b,v,D,k){let P=!1;if(!b&&!v&&process.argv.length>2){let U,W,A=process.argv.slice(2);for(let $=0;$<A.length;$++){let R=A[$];if(R==="--node-ipc"){b=new a.IPCMessageReader(process),v=new a.IPCMessageWriter(process);break}else if(R==="--stdio"){P=!0,b=process.stdin,v=process.stdout;break}else if(R==="--socket"){U=parseInt(A[$+1]);break}else if(R==="--pipe"){W=A[$+1];break}else{var M=R.split("=");if(M[0]==="--socket"){U=parseInt(M[1]);break}else if(M[0]==="--pipe"){W=M[1];break}}}if(U){let $=(0,a.createServerSocketTransport)(U);b=$[0],v=$[1]}else if(W){let $=(0,a.createServerPipeTransport)(W);b=$[0],v=$[1]}}var I="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!b)throw new Error("Connection input stream is not set. "+I);if(!v)throw new Error("Connection output stream is not set. "+I);if(i.func(b.read)&&i.func(b.on)){let U=b;U.on("end",()=>{process.exit(l?0:1)}),U.on("close",()=>{process.exit(l?0:1)})}const G=U=>{const W=(0,a.createProtocolConnection)(b,v,U,D);return P&&T(U),W};return(0,s.createConnection)(G,h,k)}function T(b){function v(k){return k.map(P=>typeof P=="string"?P:(0,r.inspect)(P)).join(" ")}const D=new Map;console.assert=function(P,...M){if(!P)if(M.length===0)b.error("Assertion failed");else{const[I,...G]=M;b.error(`Assertion failed: ${I} ${v(G)}`)}},console.count=function(P="default"){const M=String(P);let I=D.get(M)??0;I+=1,D.set(M,I),b.log(`${M}: ${M}`)},console.countReset=function(P){P===void 0?D.clear():D.delete(String(P))},console.debug=function(...P){b.log(v(P))},console.dir=function(P,M){b.log((0,r.inspect)(P,M))},console.log=function(...P){b.log(v(P))},console.error=function(...P){b.error(v(P))},console.trace=function(...P){const M=new Error().stack.replace(/(.+\n){2}/,"");let I="Trace";P.length!==0&&(I+=`: ${v(P)}`),b.log(`${I}
160
- ${M}`)},console.warn=function(...P){b.warn(v(P))}}}(te);function oC(t,e){const n={stacks:t,tokens:e};return Jq(n),n.stacks.flat().forEach(i=>{i.property=void 0}),cC(n.stacks).map(i=>i[i.length-1])}function $v(t){const{next:e,cardinalities:n,visited:r,plus:i}=t,s=[],o=e.feature;if(r.has(o))return[];r.add(o);let a,c=o;for(;c.$container;)if(Oi(c.$container)){a=c.$container;break}else if(Qg(c.$container))c=c.$container;else break;if(lE(c.cardinality)){const u=da({next:{feature:c,type:e.type},cardinalities:n,visited:r,plus:i});for(const l of u)i.add(l.feature);s.push(...u)}if(a){const u=a.elements.indexOf(c);u!==void 0&&u<a.elements.length-1&&s.push(...aC({feature:a,type:e.type},u+1,n,r,i)),s.every(l=>Mo(l.feature.cardinality,l.feature)||Mo(n.get(l.feature))||i.has(l.feature))&&s.push(...$v({next:{feature:a,type:e.type},cardinalities:n,visited:r,plus:i}))}return s}function kv(t){return lt(t)&&(t={feature:t}),da({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function da(t){var e,n,r;const{next:i,cardinalities:s,visited:o,plus:a}=t;if(i===void 0)return[];const{feature:c,type:u}=i;if(Oi(c)){if(o.has(c))return[];o.add(c)}if(Oi(c))return aC(i,0,s,o,a).map(l=>mh(l,c.cardinality,s));if(im(c)||sm(c))return c.elements.flatMap(l=>da({next:{feature:l,type:u,property:i.property},cardinalities:s,visited:o,plus:a})).map(l=>mh(l,c.cardinality,s));if(wr(c)){const l={feature:c.terminal,type:u,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return da({next:l,cardinalities:s,visited:o,plus:a}).map(d=>mh(d,c.cardinality,s))}else{if(Ls(c))return $v({next:{feature:c,type:Ac(c),property:(n=i.property)!==null&&n!==void 0?n:c.feature},cardinalities:s,visited:o,plus:a});if(Zr(c)&&qt(c.rule.ref)){const l=c.rule.ref,d={feature:l.definition,type:l.fragment||l.dataType?void 0:(r=Ms(l))!==null&&r!==void 0?r:l.name,property:i.property};return da({next:d,cardinalities:s,visited:o,plus:a}).map(f=>mh(f,c.cardinality,s))}else return[i]}}function mh(t,e,n){return n.set(t.feature,e),t}function aC(t,e,n,r,i){var s;const o=[];let a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],type:t.type},o.push(...da({next:a,cardinalities:n,visited:r,plus:i})),!!Mo((s=a.feature.cardinality)!==null&&s!==void 0?s:n.get(a.feature),a.feature)););return o}function Jq(t){for(const e of t.tokens){const n=cC(t.stacks,e);t.stacks=n}}function cC(t,e){const n=[];for(const r of t)n.push(...Zq(r,e));return n}function Zq(t,e){const n=new Map,r=new Set(t.map(s=>s.feature).filter(Qq)),i=[];for(;t.length>0;){const s=t.pop(),o=$v({next:s,cardinalities:n,plus:r,visited:new Set}).filter(a=>e?Cv(a.feature,e):!0);for(const a of o)i.push([...t,a]);if(!o.every(a=>Mo(a.feature.cardinality,a.feature)||Mo(n.get(a.feature))))break}return i}function Qq(t){if(t.cardinality==="+")return!0;const e=un(t,wr);return!!(e&&e.cardinality==="+")}function Cv(t,e){if(br(t))return t.value===e.image;if(Zr(t))return eW(t.rule.ref,e);if(pc(t)){const n=gm(t);if(n)return Cv(n,e)}return!1}function eW(t,e){return qt(t)?kv(t.definition).some(r=>Cv(r.feature,e)):Jr(t)?Ic(t).test(e.image):!1}function tW(t){const e=Array.from(new Set(t.flatMap(r=>{var i;return(i=r?.triggerCharacters)!==null&&i!==void 0?i:[]}))),n=Array.from(new Set(t.flatMap(r=>{var i;return(i=r?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:n.length>0?n:void 0}}class uC{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig,this.astReflection=e.shared.AstReflection,this.documentationProvider=e.documentation.DocumentationProvider}async getCompletion(e,n,r){const i=[],s=this.buildContexts(e,n.position),o=(u,l)=>{const d=this.fillCompletionItem(u,l);d&&i.push(d)},a=u=>br(u.feature)?u.feature.value:u.feature,c=[];for(const u of s)if(await Promise.all(je(u.features).distinct(a).exclude(c).map(l=>this.completionFor(u,l,o))),c.push(...u.features),!this.continueCompletion(i))break;return te.CompletionList.create(this.deduplicateItems(i),!0)}deduplicateItems(e){return je(e).distinct(n=>`${n.kind}_${n.label}_${n.detail}`).toArray()}findFeaturesAt(e,n){const r=e.getText({start:te.Position.create(0,0),end:e.positionAt(n)}),i=this.completionParser.parse(r),s=i.tokens;if(i.tokenIndex===0){const c=Pd(this.grammar),u=kv({feature:c.definition,type:Ms(c)});return s.length>0?(s.shift(),oC(u.map(l=>[l]),s)):u}const o=[...s].splice(i.tokenIndex);return oC([i.elementStack.map(c=>({feature:c}))],o)}*buildContexts(e,n){var r,i;const s=e.parseResult.value.$cstNode;if(!s)return;const o=e.textDocument,a=o.getText(),c=o.offsetAt(n),u={document:e,textDocument:o,offset:c,position:n},l=this.findDataTypeRuleStart(s,c);if(l){const[v,D]=l,k=(r=gd(s,v))===null||r===void 0?void 0:r.astNode;yield Object.assign(Object.assign({},u),{node:k,tokenOffset:v,tokenEndOffset:D,features:this.findFeaturesAt(o,v)})}const{nextTokenStart:d,nextTokenEnd:f,previousTokenStart:h,previousTokenEnd:p}=this.backtrackToAnyToken(a,c);let y=d;c<=d&&h!==void 0&&(y=h);const T=(i=gd(s,y))===null||i===void 0?void 0:i.astNode;let b=!0;if(h!==void 0&&p!==void 0&&p===c&&(yield Object.assign(Object.assign({},u),{node:T,tokenOffset:h,tokenEndOffset:p,features:this.findFeaturesAt(o,h)}),b=this.performNextTokenCompletion(e,a.substring(h,p),h,p),b&&(yield Object.assign(Object.assign({},u),{node:T,tokenOffset:p,tokenEndOffset:p,features:this.findFeaturesAt(o,p)}))),T)b&&(yield Object.assign(Object.assign({},u),{node:T,tokenOffset:d,tokenEndOffset:f,features:this.findFeaturesAt(o,d)}));else{const v=Pd(this.grammar);if(!v)throw new Error("Missing entry parser rule");yield Object.assign(Object.assign({},u),{tokenOffset:d,tokenEndOffset:f,features:kv(v.definition)})}}performNextTokenCompletion(e,n,r,i){return new RegExp("\\P{L}$","u").test(n)}findDataTypeRuleStart(e,n){var r,i;let s=Ni(e,n,this.grammarConfig.nameRegexp),o=!!(!((r=un(s?.grammarSource,qt))===null||r===void 0)&&r.dataType);if(o){for(;o;)s=s?.container,o=!!(!((i=un(s?.grammarSource,qt))===null||i===void 0)&&i.dataType);if(s)return[s.offset,s.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,n){const r=this.lexer.tokenize(e).tokens;if(r.length===0)return{nextTokenStart:n,nextTokenEnd:n};let i;for(const s of r){if(s.startOffset>=n)return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(s.endOffset>=n)return{nextTokenStart:s.startOffset,nextTokenEnd:s.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=s}return{nextTokenStart:n,nextTokenEnd:n,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}completionFor(e,n,r){if(br(n.feature))return this.completionForKeyword(e,n.feature,r);if(pc(n.feature)&&e.node)return this.completionForCrossReference(e,n,r)}completionForCrossReference(e,n,r){const i=un(n.feature,wr);let s=e.node;if(i&&s){n.type&&(s={$type:n.type,$container:s,$containerProperty:n.property},um(this.astReflection,s));const o={reference:{$refText:""},container:s,property:i.feature};try{for(const a of this.getReferenceCandidates(o,e))r(e,this.createReferenceCompletionItem(a))}catch(a){console.error(a)}}}getReferenceCandidates(e,n){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){const n=this.nodeKindProvider.getCompletionItemKind(e),r=this.getReferenceDocumentation(e);return{nodeDescription:e,kind:n,documentation:r,detail:e.type,sortText:"0"}}getReferenceDocumentation(e){if(!e.node)return;const n=this.documentationProvider.getDocumentation(e.node);if(n)return{kind:"markdown",value:n}}completionForKeyword(e,n,r){this.filterKeyword(e,n)&&r(e,{label:n.value,kind:this.getKeywordCompletionItemKind(n),detail:"Keyword",sortText:"1"})}getKeywordCompletionItemKind(e){return te.CompletionItemKind.Keyword}filterKeyword(e,n){return new RegExp("\\p{L}","u").test(n.value)}fillCompletionItem(e,n){var r,i;let s;if(typeof n.label=="string")s=n.label;else if("node"in n){const u=this.nameProvider.getName(n.node);if(!u)return;s=u}else if("nodeDescription"in n)s=n.nodeDescription.name;else return;let o;typeof((r=n.textEdit)===null||r===void 0?void 0:r.newText)=="string"?o=n.textEdit.newText:typeof n.insertText=="string"?o=n.insertText:o=s;const a=(i=n.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,s,o);return a?{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:a,label:s}:void 0}buildCompletionTextEdit(e,n,r){const s=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(s,n)){const o=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:r,range:{start:o,end:a}}}else return}}class nW{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,n,r){const i=e.parseResult.value;if(i.$cstNode){const s=i.$cstNode,o=Ni(s,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,n)}}collectLocationLinks(e,n){var r;const i=this.findLink(e);if(i)return[te.LocationLink.create(i.targetDocument.textDocument.uri,((r=i.target.astNode.$cstNode)!==null&&r!==void 0?r:i.target).range,i.target.range,i.source.range)]}findLink(e){const n=this.references.findDeclarationNode(e);if(n?.astNode){const r=Xt(n.astNode);if(n&&r)return{source:e,target:n,targetDocument:r}}}}class lC{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,n,r){const i=e.parseResult.value.$cstNode;if(!i)return;const s=Ni(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);if(!s)return;const o=this.references.findDeclaration(s);if(o){const a=yt.equals(Xt(o).uri,e.uri),c={documentUri:e.uri,includeDeclaration:a};return this.references.findReferences(o,c).map(l=>this.createDocumentHighlight(l)).toArray()}}createDocumentHighlight(e){return te.DocumentHighlight.create(e.segment.range)}}class rW{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,n,r){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,n){const r=n.$cstNode,i=this.nameProvider.getNameNode(n);if(i&&r){const s=this.nameProvider.getName(n);return[{kind:this.nodeKindProvider.getSymbolKind(n),name:s||i.text,range:r.range,selectionRange:i.range,children:this.getChildSymbols(e,n)}]}else return this.getChildSymbols(e,n)||[]}getChildSymbols(e,n){const r=[];for(const i of kc(n)){const s=this.getSymbol(e,i);r.push(...s)}if(r.length>0)return r}}class iW{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let n=!1;e.lsp.LanguageServer.onInitialize(r=>{var i,s;n=!!(!((s=(i=r.capabilities.workspace)===null||i===void 0?void 0:i.didChangeWatchedFiles)===null||s===void 0)&&s.dynamicRegistration)}),e.lsp.LanguageServer.onInitialized(r=>{n&&this.registerFileWatcher(e)})}registerFileWatcher(e){const n=je(e.ServiceRegistry.all).flatMap(r=>r.LanguageMetaData.fileExtensions).map(r=>r.startsWith(".")?r.substring(1):r).distinct().toArray();if(n.length>0){const r=e.lsp.Connection,i={watchers:[{globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(",")}}`}]};r?.client.register(te.DidChangeWatchedFilesNotification.type,i)}}fireDocumentUpdate(e,n){e=e.filter(r=>this.serviceRegistry.hasServices(r)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(r=>this.documentBuilder.update(e,n,r))}).catch(r=>{console.error("Workspace initialization failed. Could not perform document update.",r)})}didChangeContent(e){this.fireDocumentUpdate([Wt.parse(e.document.uri)],[])}didChangeWatchedFiles(e){const n=je(e.changes).filter(i=>i.type!==te.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Wt.parse(i.uri)).toArray(),r=je(e.changes).filter(i=>i.type===te.FileChangeType.Deleted).distinct(i=>i.uri).map(i=>Wt.parse(i.uri)).toArray();this.fireDocumentUpdate(n,r)}}class sW{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,n,r){const i=[],s=o=>i.push(o);return this.collectFolding(e,s),i}collectFolding(e,n){var r;const i=(r=e.parseResult)===null||r===void 0?void 0:r.value;if(i){if(this.shouldProcessContent(i)){const s=Dr(i).iterator();let o;do if(o=s.next(),!o.done){const a=o.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,n),this.shouldProcessContent(a)||s.prune()}while(!o.done)}this.collectCommentFolding(e,i,n)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,n,r){const i=n.$cstNode;if(i){const s=this.toFoldingRange(e,i);s&&r(s)}}collectCommentFolding(e,n,r){const i=n.$cstNode;if(i){for(const s of MD(i))if(this.commentNames.includes(s.tokenType.name)){const o=this.toFoldingRange(e,s,te.FoldingRangeKind.Comment);o&&r(o)}}}toFoldingRange(e,n,r){const i=n.range,s=i.start;let o=i.end;if(!(o.line-s.line<2))return this.includeLastFoldingLine(n,r)||(o=e.textDocument.positionAt(e.textDocument.offsetAt({line:o.line,character:0})-1)),te.FoldingRange.create(s.line,o.line,s.character,o.character,r)}includeLastFoldingLine(e,n){if(n===te.FoldingRangeKind.Comment)return!1;const r=e.text,i=r.charAt(r.length-1);return!(i==="}"||i===")"||i==="]")}}class oW{match(e,n){if(e.length===0)return!0;let r=!1,i,s=0;const o=n.length;for(let a=0;a<o;a++){const c=n.charCodeAt(a),u=e.charCodeAt(s);if((c===u||this.toUpperCharCode(c)===this.toUpperCharCode(u))&&(r||(r=i===void 0||this.isWordTransition(i,c)),r&&s++,s===e.length))return!0;i=c}return!1}isWordTransition(e,n){return dC<=e&&e<=fC&&aW<=n&&n<=cW||e===hC&&n!==hC}toUpperCharCode(e){return dC<=e&&e<=fC?e-32:e}}const dC=97,fC=122,aW=65,cW=90,hC=95;class pC{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,n){var r,i;const s=(i=(r=e.parseResult)===null||r===void 0?void 0:r.value)===null||i===void 0?void 0:i.$cstNode;if(s){const o=e.textDocument.offsetAt(n.position),a=Ni(s,o,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>o){const c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c)}}}}class uW extends pC{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){const n=this.documentationProvider.getDocumentation(e);if(n)return{contents:{kind:"markdown",value:n}}}}const lW={[te.SemanticTokenTypes.class]:0,[te.SemanticTokenTypes.comment]:1,[te.SemanticTokenTypes.enum]:2,[te.SemanticTokenTypes.enumMember]:3,[te.SemanticTokenTypes.event]:4,[te.SemanticTokenTypes.function]:5,[te.SemanticTokenTypes.interface]:6,[te.SemanticTokenTypes.keyword]:7,[te.SemanticTokenTypes.macro]:8,[te.SemanticTokenTypes.method]:9,[te.SemanticTokenTypes.modifier]:10,[te.SemanticTokenTypes.namespace]:11,[te.SemanticTokenTypes.number]:12,[te.SemanticTokenTypes.operator]:13,[te.SemanticTokenTypes.parameter]:14,[te.SemanticTokenTypes.property]:15,[te.SemanticTokenTypes.regexp]:16,[te.SemanticTokenTypes.string]:17,[te.SemanticTokenTypes.struct]:18,[te.SemanticTokenTypes.type]:19,[te.SemanticTokenTypes.typeParameter]:20,[te.SemanticTokenTypes.variable]:21,[te.SemanticTokenTypes.decorator]:22},dW={[te.SemanticTokenModifiers.abstract]:1,[te.SemanticTokenModifiers.async]:2,[te.SemanticTokenModifiers.declaration]:4,[te.SemanticTokenModifiers.defaultLibrary]:8,[te.SemanticTokenModifiers.definition]:16,[te.SemanticTokenModifiers.deprecated]:32,[te.SemanticTokenModifiers.documentation]:64,[te.SemanticTokenModifiers.modification]:128,[te.SemanticTokenModifiers.readonly]:256,[te.SemanticTokenModifiers.static]:512};function fW(t){const e=[],n=[];let r=!0,i=!0,s=!0;for(const o of t)o&&(o.legend.tokenTypes.forEach((a,c)=>{const u=e[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token types. They use the same index ${c}.`);e[c]=a}),o.legend.tokenModifiers.forEach((a,c)=>{const u=n[c];if(u&&u!==a)throw new Error(`Cannot merge '${u}' and '${a}' token modifier. They use the same index ${c}.`);n[c]=a}),o.full?typeof o.full=="object"&&!o.full.delta&&(i=!1):r=!1,o.range||(s=!1));return{legend:{tokenTypes:e,tokenModifiers:n},full:r&&{delta:i},range:s}}class hW extends te.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,n,r,i,s){this._tokens.push({line:e,char:n,length:r,tokenType:i,tokenModifiers:s})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}flush(){this.previousResult(this.id)}applyTokens(){for(const e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,n){return e.line===n.line?e.char-n.char:e.line-n.line}}class pW{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(n=>{this.tokensBuilders.delete(n.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(n=>{var r;this.initialize((r=n.capabilities.textDocument)===null||r===void 0?void 0:r.semanticTokens)})}initialize(e){this.clientCapabilities=e}get tokenTypes(){return lW}get tokenModifiers(){return dW}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,n,r=nt.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightRange(e,n,r=nt.None){return this.currentRange=n.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,n,r=nt.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(n.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),r),this.currentTokensBuilder.buildEdits()}createAcceptor(){return n=>{"line"in n?this.highlightToken({range:{start:{line:n.line,character:n.char},end:{line:n.line,character:n.char+n.length}},type:n.type,modifier:n.modifier}):"range"in n?this.highlightToken(n):"keyword"in n?this.highlightKeyword(n):"property"in n?this.highlightProperty(n):this.highlightNode({node:n.cst,type:n.type,modifier:n.modifier})}}getDocumentTokensBuilder(e){const n=this.tokensBuilders.get(e.uri.toString());if(n)return n;const r=new hW;return this.tokensBuilders.set(e.uri.toString(),r),r}async computeHighlighting(e,n,r){const i=e.parseResult.value,s=Qr(i,{range:this.currentRange}).iterator();let o;do if(o=s.next(),!o.done){await Pt(r);const a=o.value;this.highlightElement(a,n)==="prune"&&s.prune()}while(!o.done)}highlightToken(e){var n;const{range:r,type:i}=e;let s=e.modifier;if(this.currentRange&&!Kg(r,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;const o=this.tokenTypes[i];let a=0;if(s!==void 0){typeof s=="string"&&(s=[s]);for(const l of s){const d=this.tokenModifiers[l];a|=d}}const c=r.start.line,u=r.end.line;if(c===u){const l=r.start.character,d=r.end.character-l;this.currentTokensBuilder.push(c,l,d,o,a)}else if(!((n=this.clientCapabilities)===null||n===void 0)&&n.multilineTokenSupport){const l=r.start.character,d=this.currentDocument.textDocument.offsetAt(r.start),f=this.currentDocument.textDocument.offsetAt(r.end);this.currentTokensBuilder.push(c,l,f-d,o,a)}else{const l=r.start;let d=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(l.line,l.character,d-l.character-1,o,a);for(let f=c+1;f<u;f++){const h=d;d=this.currentDocument.textDocument.offsetAt({line:f+1,character:0}),this.currentTokensBuilder.push(f,0,d-h-1,o,a)}this.currentTokensBuilder.push(u,0,r.end.character,o,a)}}highlightProperty(e){const n=[];if(typeof e.index=="number"){const s=En(e.node.$cstNode,e.property,e.index);s&&n.push(s)}else n.push(...Lo(e.node.$cstNode,e.property));const{type:r,modifier:i}=e;for(const s of n)this.highlightNode({node:s,type:r,modifier:i})}highlightKeyword(e){const{node:n,keyword:r,type:i,index:s,modifier:o}=e,a=[];if(typeof s=="number"){const c=_c(n.$cstNode,r,s);c&&a.push(c)}else a.push(...ym(n.$cstNode,r));for(const c of a)this.highlightNode({node:c,type:i,modifier:o})}highlightNode(e){const{node:n,type:r,modifier:i}=e,s=n.range;this.highlightToken({range:s,type:r,modifier:i})}}var gC;(function(t){function e(r,i,s){const o=new Map;Object.entries(i).forEach(([u,l])=>o.set(l,u));let a=0,c=0;return n(r.data,5).map(u=>{a+=u[0],u[0]!==0&&(c=0),c+=u[1];const l=u[2];return{offset:s.textDocument.offsetAt({line:a,character:c}),tokenType:o.get(u[3]),tokenModifiers:u[4],text:s.textDocument.getText({start:{line:a,character:c},end:{line:a,character:c+l}})}})}t.decode=e;function n(r,i){const s=[];for(let o=0;o<r.length;o+=i){const a=r.slice(o,o+i);s.push(a)}return s}})(gC||(gC={}));function gW(t){const e=[],n=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&n.push(...i.retriggerCharacters)});const r={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:n.length>0?Array.from(new Set(n)).sort():void 0};return r.triggerCharacters?r:void 0}class mW{constructor(e){this.onInitializeEmitter=new et.Emitter,this.onInitializedEmitter=new et.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){Xy(this.services),this.services.ServiceRegistry.all.forEach(e=>Xy(e))}hasService(e){return this.services.ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var n,r,i,s;const o=this.services.lsp.DocumentUpdateHandler,a=(n=this.services.lsp.FileOperationHandler)===null||n===void 0?void 0:n.fileOperationOptions,c=this.services.ServiceRegistry.all,u=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.Formatter}),l=c.map(J=>{var B,me;return(me=(B=J.lsp)===null||B===void 0?void 0:B.Formatter)===null||me===void 0?void 0:me.formatOnTypeOptions}).find(J=>!!J),d=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.CodeActionProvider}),f=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.SemanticTokenProvider}),h=fW(c.map(J=>{var B,me;return(me=(B=J.lsp)===null||B===void 0?void 0:B.SemanticTokenProvider)===null||me===void 0?void 0:me.semanticTokensOptions})),p=(i=(r=this.services.lsp)===null||r===void 0?void 0:r.ExecuteCommandHandler)===null||i===void 0?void 0:i.commands,y=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.DocumentLinkProvider}),T=gW(c.map(J=>{var B,me;return(me=(B=J.lsp)===null||B===void 0?void 0:B.SignatureHelp)===null||me===void 0?void 0:me.signatureHelpOptions})),b=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.TypeProvider}),v=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.ImplementationProvider}),D=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.CompletionProvider}),k=tW(c.map(J=>{var B,me;return(me=(B=J.lsp)===null||B===void 0?void 0:B.CompletionProvider)===null||me===void 0?void 0:me.completionOptions})),P=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.ReferencesProvider}),M=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.DocumentSymbolProvider}),I=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.DefinitionProvider}),G=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.DocumentHighlightProvider}),U=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.FoldingRangeProvider}),W=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.HoverProvider}),A=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.RenameProvider}),$=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.CallHierarchyProvider}),R=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.TypeHierarchyProvider}),L=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.CodeLensProvider}),q=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.DeclarationProvider}),j=this.hasService(J=>{var B;return(B=J.lsp)===null||B===void 0?void 0:B.InlayHintProvider}),z=(s=this.services.lsp)===null||s===void 0?void 0:s.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:a},executeCommandProvider:p&&{commands:p},textDocumentSync:{change:et.TextDocumentSyncKind.Incremental,openClose:!0,save:!!o.didSaveDocument,willSave:!!o.willSaveDocument,willSaveWaitUntil:!!o.willSaveDocumentWaitUntil},completionProvider:D?k:void 0,referencesProvider:P,documentSymbolProvider:M,definitionProvider:I,typeDefinitionProvider:b,documentHighlightProvider:G,codeActionProvider:d,documentFormattingProvider:u,documentRangeFormattingProvider:u,documentOnTypeFormattingProvider:l,foldingRangeProvider:U,hoverProvider:W,renameProvider:A?{prepareProvider:!0}:void 0,semanticTokensProvider:f?h:void 0,signatureHelpProvider:T,implementationProvider:v,callHierarchyProvider:$?{}:void 0,typeHierarchyProvider:R?{}:void 0,documentLinkProvider:y?{resolveProvider:!1}:void 0,codeLensProvider:L?{resolveProvider:!1}:void 0,declarationProvider:q,inlayHintProvider:j?{resolveProvider:!1}:void 0,workspaceSymbolProvider:z?{resolveProvider:!!z.resolveSymbol}:void 0}}}initialized(e){this.fireInitializedOnDefaultServices(e),this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(e){this.services.workspace.ConfigurationProvider.initialize(e),this.services.workspace.WorkspaceManager.initialize(e)}fireInitializedOnDefaultServices(e){const n=this.services.lsp.Connection,r=n?Object.assign(Object.assign({},e),{register:i=>n.client.register(et.DidChangeConfigurationNotification.type,i),fetchConfiguration:i=>n.workspace.getConfiguration(i)}):e;this.services.workspace.ConfigurationProvider.initialized(r).catch(i=>console.error("Error in ConfigurationProvider initialization:",i)),this.services.workspace.WorkspaceManager.initialized(e).catch(i=>console.error("Error in WorkspaceManager initialization:",i))}}class yW{getSymbolKind(e){return te.SymbolKind.Field}getCompletionItemKind(e){return te.CompletionItemKind.Reference}}class vW{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,n,r){const i=e.parseResult.value.$cstNode;if(!i)return[];const s=Ni(i,e.textDocument.offsetAt(n.position),this.grammarConfig.nameRegexp);return s?this.getReferences(s,n,e):[]}getReferences(e,n,r){const i=[],s=this.references.findDeclaration(e);if(s){const o={includeDeclaration:n.context.includeDeclaration};this.references.findReferences(s,o).forEach(a=>{i.push(te.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}}class wW{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,n,r){const i={},s=e.parseResult.value.$cstNode;if(!s)return;const o=e.textDocument.offsetAt(n.position),a=Ni(s,o,this.grammarConfig.nameRegexp);if(!a)return;const c=this.references.findDeclaration(a);if(!c)return;const u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(c,u).forEach(d=>{const f=tn.replace(d.segment.range,n.newName),h=d.sourceUri.toString();i[h]?i[h].push(f):i[h]=[f]}),{changes:i}}prepareRename(e,n,r){return this.renameNodeRange(e,n.position)}renameNodeRange(e,n){const r=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(n);if(r&&i){const s=Ni(r,i,this.grammarConfig.nameRegexp);if(!s)return;if(this.references.findDeclaration(s)||this.isNameNode(s))return s.range}}isNameNode(e){return e?.astNode&&r1(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}}class mC{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,n=nt.None){const r=[],i=e.query.toLowerCase();for(const s of this.indexManager.allElements())if(await Pt(n),this.fuzzyMatcher.match(i,s.name)){const o=this.getWorkspaceSymbol(s);o&&r.push(o)}return r}getWorkspaceSymbol(e){const n=e.nameSegment;if(n)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:n.range,uri:e.documentUri.toString()}}}}class bW{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new te.Emitter,this._onDidOpen=new te.Emitter,this._onDidClose=new te.Emitter,this._onDidSave=new te.Emitter,this._onWillSave=new te.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(yt.normalize(e))}set(e){const n=yt.normalize(e.uri);let r=!0;this._syncedDocuments.has(n)&&(r=!1),this._syncedDocuments.set(n,e);const i=Object.freeze({document:e});return this._onDidOpen.fire(i),this._onDidChangeContent.fire(i),r}delete(e){const n=yt.normalize(typeof e=="object"&&"uri"in e?e.uri:e),r=this._syncedDocuments.get(n);r!==void 0&&(this._syncedDocuments.delete(n),this._onDidClose.fire(Object.freeze({document:r})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=te.TextDocumentSyncKind.Incremental;const n=[];return n.push(e.onDidOpenTextDocument(r=>{const i=r.textDocument,s=yt.normalize(i.uri),o=this._configuration.create(s,i.languageId,i.version,i.text);this._syncedDocuments.set(s,o);const a=Object.freeze({document:o});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),n.push(e.onDidChangeTextDocument(r=>{const i=r.textDocument,s=r.contentChanges;if(s.length===0)return;const{version:o}=i;if(o==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);const a=yt.normalize(i.uri);let c=this._syncedDocuments.get(a);c!==void 0&&(c=this._configuration.update(c,s,o),this._syncedDocuments.set(a,c),this._onDidChangeContent.fire(Object.freeze({document:c})))})),n.push(e.onDidCloseTextDocument(r=>{const i=yt.normalize(r.textDocument.uri),s=this._syncedDocuments.get(i);s!==void 0&&(this._syncedDocuments.delete(i),this._onDidClose.fire(Object.freeze({document:s})))})),n.push(e.onWillSaveTextDocument(r=>{const i=this._syncedDocuments.get(yt.normalize(r.textDocument.uri));i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:r.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((r,i)=>{const s=this._syncedDocuments.get(yt.normalize(r.textDocument.uri));return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:r.reason}),i):[]})),n.push(e.onDidSaveTextDocument(r=>{const i=this._syncedDocuments.get(yt.normalize(r.textDocument.uri));i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),te.Disposable.create(()=>{n.forEach(r=>r.dispose())})}}function DW(t){return Pf.merge(T1(t),EW(t))}function EW(t){return{lsp:{CompletionProvider:e=>new uC(e),DocumentSymbolProvider:e=>new rW(e),HoverProvider:e=>new uW(e),FoldingRangeProvider:e=>new sW(e),ReferencesProvider:e=>new vW(e),DefinitionProvider:e=>new nW(e),DocumentHighlightProvider:e=>new lC(e),RenameProvider:e=>new wW(e)},shared:()=>t.shared}}function TW(t){return Pf.merge(R1(t),RW(t))}function RW(t){return{lsp:{Connection:()=>t.connection,LanguageServer:e=>new mW(e),DocumentUpdateHandler:e=>new iW(e),WorkspaceSymbolProvider:e=>new mC(e),NodeKindProvider:()=>new yW,FuzzyMatcher:()=>new oW},workspace:{TextDocuments:()=>new bW(If)}}}class SW{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new $W(e,this.collector)}formatDocument(e,n){const r=e.parseResult;return r.lexerErrors.length===0&&r.parserErrors.length===0?this.doDocumentFormat(e,n.options):[]}isFormatRangeErrorFree(e,n){const r=e.parseResult;return r.lexerErrors.length||r.parserErrors.length?Math.min(...r.lexerErrors.map(s=>{var o;return(o=s.line)!==null&&o!==void 0?o:Number.MAX_VALUE}),...r.parserErrors.map(s=>{var o;return(o=s.token.startLine)!==null&&o!==void 0?o:Number.MAX_VALUE}))>n.end.line:!0}formatDocumentRange(e,n){return this.isFormatRangeErrorFree(e,n.range)?this.doDocumentFormat(e,n.options,n.range):[]}formatDocumentOnType(e,n){const r={start:{character:0,line:n.position.line},end:n.position};return this.isFormatRangeErrorFree(e,r)?this.doDocumentFormat(e,n.options,r):[]}get formatOnTypeOptions(){}doDocumentFormat(e,n,r){const i=new Map,s=(a,c,u)=>{var l,d;const f=this.nodeModeToKey(a,c),h=i.get(f),p=(l=u.options.priority)!==null&&l!==void 0?l:0,y=(d=h?.options.priority)!==null&&d!==void 0?d:0;(!h||y<=p)&&i.set(f,u)};this.collector=s,this.iterateAstFormatting(e,r);const o=this.iterateCstFormatting(e,i,n,r);return this.avoidOverlappingEdits(e.textDocument,o)}avoidOverlappingEdits(e,n){const r=[];for(const i of n){let s=r[r.length-1];for(;s;){const o=e.offsetAt(i.range.start),a=e.offsetAt(s.range.end);if(o<a)r.pop(),s=r[r.length-1];else break}r.push(i)}return r.filter(i=>this.isNecessary(i,e))}iterateAstFormatting(e,n){const r=e.parseResult.value;this.format(r);const i=Dr(r).iterator();let s;do if(s=i.next(),!s.done){const o=s.value;this.insideRange(o.$cstNode.range,n)?this.format(o):i.prune()}while(!s.done)}nodeModeToKey(e,n){return`${e.offset}:${e.end}:${n}`}insideRange(e,n){return!n||e.start.line<=n.start.line&&e.end.line>=n.end.line||e.start.line>=n.start.line&&e.end.line<=n.end.line||e.start.line<=n.end.line&&e.end.line>=n.end.line}isNecessary(e,n){return e.newText!==n.getText(e.range).replace(/\r/g,"")}iterateCstFormatting(e,n,r,i){const s={indentation:0,options:r,document:e.textDocument},o=[],c=this.iterateCstTree(e,s).iterator();let u,l;do if(l=c.next(),!l.done){const d=l.value,f=Fs(d),h=this.nodeModeToKey(d,"prepend"),p=n.get(h);if(n.delete(h),p){const b=this.createTextEdit(u,d,p,s);for(const v of b)v&&this.insideRange(v.range,i)&&o.push(v)}const y=this.nodeModeToKey(d,"append"),T=n.get(y);if(n.delete(y),T){const b=WD(d);if(b){const v=this.createTextEdit(d,b,T,s);for(const D of v)D&&this.insideRange(D.range,i)&&o.push(D)}}if(!p&&d.hidden){const b=this.createHiddenTextEdits(u,d,void 0,s);for(const v of b)v&&this.insideRange(v.range,i)&&o.push(v)}f&&(u=d)}while(!l.done);return o}createHiddenTextEdits(e,n,r,i){var s;const o=n.range.start.line;if(e&&e.range.end.line===o)return[];const a=[],c={start:{character:0,line:o},end:n.range.start},u=i.document.getText(c),l=this.findFittingMove(c,(s=r?.moves)!==null&&s!==void 0?s:[],i),d=this.getExistingIndentationCharacterCount(u,i),h=this.getIndentationCharacterCount(i,l)-d;if(h===0)return[];let p="";h>0&&(p=(i.options.insertSpaces?" ":" ").repeat(h));const y=n.text.split(`
161
- `);y[0]=u+y[0];for(let T=0;T<y.length;T++){const b=o+T,v={character:0,line:b};if(h>0)a.push({newText:p,range:{start:v,end:v}});else{const D=y[T];let k=0;for(;k<D.length;k++){const P=D.charAt(k);if(P!==" "&&P!==" ")break}a.push({newText:"",range:{start:v,end:{line:b,character:Math.min(k,Math.abs(h))}}})}}return a}getExistingIndentationCharacterCount(e,n){const r=" ".repeat(n.options.tabSize);return(n.options.insertSpaces?e.replaceAll(" ",r):e.replaceAll(r," ")).length}getIndentationCharacterCount(e,n){let r=e.indentation;return n&&n.tabs&&(r+=n.tabs),(e.options.insertSpaces?e.options.tabSize:1)*r}createTextEdit(e,n,r,i){var s;if(n.hidden)return this.createHiddenTextEdits(e,n,r,i);if(e&&(e.range.end.line>n.range.start.line||e.range.end.line===n.range.start.line&&e.range.end.character>n.range.start.character))return[];const o={start:(s=e?.range.end)!==null&&s!==void 0?s:{character:0,line:0},end:n.range.start},a=this.findFittingMove(o,r.moves,i);if(!a)return[];const c=a.characters,u=a.lines,l=a.tabs,d=i.indentation;i.indentation+=l??0;const f=[];return c!==void 0?e?.hidden||f.push(this.createSpaceTextEdit(o,c,r.options)):u!==void 0?f.push(this.createLineTextEdit(o,u,i,r.options)):l!==void 0&&f.push(this.createTabTextEdit(o,!!e,i)),Fs(n)&&(i.indentation=d),f}createSpaceTextEdit(e,n,r){if(e.start.line===e.end.line){const s=e.end.character-e.start.character;n=this.fitIntoOptions(n,s,r)}return{newText:" ".repeat(n),range:e}}createLineTextEdit(e,n,r,i){const s=e.end.line-e.start.line;n=this.fitIntoOptions(n,s,i);const a=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation);return{newText:`${`
162
- `.repeat(n)}${a}`,range:e}}createTabTextEdit(e,n,r){const s=(r.options.insertSpaces?" ".repeat(r.options.tabSize):" ").repeat(r.indentation),o=n?1:0,a=Math.max(e.end.line-e.start.line,o);return{newText:`${`
163
- `.repeat(a)}${s}`,range:e}}fitIntoOptions(e,n,r){return r.allowMore?e=Math.max(n,e):r.allowLess&&(e=Math.min(n,e)),e}findFittingMove(e,n,r){if(n.length===0)return;if(n.length===1)return n[0];const i=e.end.line-e.start.line;for(const s of n){if(s.lines!==void 0&&i<=s.lines)return s;if(s.lines===void 0&&i===0)return s}return n[n.length-1]}iterateCstTree(e,n){const i=e.parseResult.value.$cstNode;return i?new No(i,s=>this.iterateCst(s,n)):Po}iterateCst(e,n){if(!Xr(e))return Po;const r=n.indentation;return new kt(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(n.indentation=r,Ut))}}class $W{constructor(e,n){this.astNode=e,this.collector=n}node(e){return new hr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){const n=[];for(const r of e)r.$cstNode&&n.push(r.$cstNode);return new hr(n,this.collector)}property(e,n){const r=En(this.astNode.$cstNode,e,n);return new hr(r?[r]:[],this.collector)}properties(...e){const n=[];for(const r of e){const i=Lo(this.astNode.$cstNode,r);n.push(...i)}return new hr(n,this.collector)}keyword(e,n){const r=_c(this.astNode.$cstNode,e,n);return new hr(r?[r]:[],this.collector)}keywords(...e){const n=[];for(const r of e){const i=ym(this.astNode.$cstNode,r);n.push(...i)}return new hr(n,this.collector)}cst(e){return new hr([...e],this.collector)}interior(e,n){const r=e.nodes,i=n.nodes;if(r.length!==1||i.length!==1)return new hr([],this.collector);let s=r[0],o=i[0];if(s.offset>o.offset){const a=s;s=o,o=a}return new hr(GD(s,o),this.collector)}}class hr{constructor(e,n){this.nodes=e,this.collector=n}prepend(e){for(const n of this.nodes)this.collector(n,"prepend",e);return this}append(e){for(const n of this.nodes)this.collector(n,"append",e);return this}surround(e){for(const n of this.nodes)this.collector(n,"prepend",e),this.collector(n,"append",e);return this}slice(e,n){return new hr(this.nodes.slice(e,n),this.collector)}}var ts;(function(t){function e(...l){return{options:{},moves:l.flatMap(d=>d.moves).sort(u)}}t.fit=e;function n(l){return i(0,l)}t.noSpace=n;function r(l){return i(1,l)}t.oneSpace=r;function i(l,d){return{options:d??{},moves:[{characters:l}]}}t.spaces=i;function s(l){return o(1,l)}t.newLine=s;function o(l,d){return{options:d??{},moves:[{lines:l}]}}t.newLines=o;function a(l){return{options:l??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function c(l){return{options:l??{},moves:[{tabs:0}]}}t.noIndent=c;function u(l,d){var f,h,p,y,T,b;const v=(f=l.lines)!==null&&f!==void 0?f:0,D=(h=d.lines)!==null&&h!==void 0?h:0,k=(p=l.tabs)!==null&&p!==void 0?p:0,P=(y=d.tabs)!==null&&y!==void 0?y:0,M=(T=l.characters)!==null&&T!==void 0?T:0,I=(b=d.characters)!==null&&b!==void 0?b:0;return v<D?-1:v>D?1:k<P?-1:k>P?1:M<I?-1:M>I?1:0}})(ts||(ts={}));class kW{constructor(){this.encoding="utf-8"}readFile(e){return tb.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await tb.promises.readdir(e.fsPath,{withFileTypes:!0})).map(r=>({dirent:r,isFile:r.isFile(),isDirectory:r.isDirectory(),uri:yt.joinPath(e,r.name)}))}}const CW={fileSystemProvider:()=>new kW},Le={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},yC={silent:{level:-1},fatal:{level:Le.fatal},error:{level:Le.error},warn:{level:Le.warn},log:{level:Le.log},info:{level:Le.info},success:{level:Le.success},fail:{level:Le.fail},ready:{level:Le.info},start:{level:Le.info},box:{level:Le.info},debug:{level:Le.debug},trace:{level:Le.trace},verbose:{level:Le.verbose}};function _v(t){return t!==null&&typeof t=="object"}function Av(t,e,n=".",r){if(!_v(e))return Av(t,{},n);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const o=t[s];o!=null&&(Array.isArray(o)&&Array.isArray(i[s])?i[s]=[...o,...i[s]]:_v(o)&&_v(i[s])?i[s]=Av(o,i[s],(n?`${n}.`:"")+s.toString()):i[s]=o)}return i}function _W(t){return(...e)=>e.reduce((n,r)=>Av(n,r,""),{})}const AW=_W();function IW(t){return Object.prototype.toString.call(t)==="[object Object]"}function xW(t){return!(!IW(t)||!t.message&&!t.args||t.stack)}let Iv=!1;const vC=[];let nn=class rN{constructor(e={}){const n=e.types||yC;this.options=AW({...e,defaults:{...e.defaults},level:xv(e.level,n),reporters:[...e.reporters||[]]},{types:yC,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(const r in n){const i={type:r,...this.options.defaults,...n[r]};this[r]=this._wrapLogFn(i),this[r].raw=this._wrapLogFn(i,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=xv(e,this.options.types,this.options.level)}prompt(e,n){if(!this.options.prompt)throw new Error("prompt is not supported!");return this.options.prompt(e,n)}create(e){const n=new rN({...this.options,...e});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){const n=this.options.reporters.indexOf(e);if(n>=0)return this.options.reporters.splice(n,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(const e in this.options.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(const e in this.options.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(e,n){e&&(e.__write||(e.__write=e.write),e.write=r=>{this[n].raw(String(r).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){Iv=!0}resumeLogs(){Iv=!1;const e=vC.splice(0);for(const n of e)n[0]._logFn(n[1],n[2])}mockTypes(e){const n=e||this.options.mockFn;if(this._mockFn=n,typeof n=="function")for(const r in this.options.types)this[r]=n(r,this.options.types[r])||this[r],this[r].raw=this[r]}_wrapLogFn(e,n){return(...r)=>{if(Iv){vC.push([this,e,r,n]);return}return this._logFn(e,r,n)}}_logFn(e,n,r){if((e.level||0)>this.level)return!1;const i={date:new Date,args:[],...e,level:xv(e.level,this.options.types)};!r&&n.length===1&&xW(n[0])?Object.assign(i,n[0]):i.args=[...n],i.message&&(i.args.unshift(i.message),delete i.message),i.additional&&(Array.isArray(i.additional)||(i.additional=i.additional.split(`
164
- `)),i.args.push(`
165
- `+i.additional.join(`
166
- `)),delete i.additional),i.type=typeof i.type=="string"?i.type.toLowerCase():"log",i.tag=typeof i.tag=="string"?i.tag:"";const s=(a=!1)=>{const c=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&c>0){const u=[...this._lastLog.object.args];c>1&&u.push(`(repeated ${c} times)`),this._log({...this._lastLog.object,args:u}),this._lastLog.count=1}a&&(this._lastLog.object=i,this._log(i))};clearTimeout(this._lastLog.timeout);const o=this._lastLog.time&&i.date?i.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=i.date,o<this.options.throttle)try{const a=JSON.stringify([i.type,i.tag,i.args]),c=this._lastLog.serialized===a;if(this._lastLog.serialized=a,c&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(s,this.options.throttle);return}}catch{}s(!0)}_log(e){for(const n of this.options.reporters)n.log(e,{options:this.options})}};function xv(t,e={},n=3){return t===void 0?n:typeof t=="number"?t:e[t]&&e[t].level!==void 0?e[t].level:n}nn.prototype.add=nn.prototype.addReporter,nn.prototype.remove=nn.prototype.removeReporter,nn.prototype.clear=nn.prototype.removeReporter,nn.prototype.withScope=nn.prototype.withTag,nn.prototype.mock=nn.prototype.mockTypes,nn.prototype.pause=nn.prototype.pauseLogs,nn.prototype.resume=nn.prototype.resumeLogs;function PW(t={}){return new nn(t)}function wC(t){const e=process.cwd()+lN;return t.split(`
167
- `).splice(1).map(n=>n.trim().replace("file://","").replace(e,""))}function NW(t,e){return(e.__write||e.write).call(e,t)}const Pv=t=>t?`[${t}]`:"";let bC=class{formatStack(e,n){return" "+wC(e).join(`
168
- `)}formatArgs(e,n){const r=e.map(i=>i&&typeof i.stack=="string"?i.message+`
169
- `+this.formatStack(i.stack,n):i);return mN(n,...r)}formatDate(e,n){return n.date?e.toLocaleTimeString():""}filterAndJoin(e){return e.filter(Boolean).join(" ")}formatLogObj(e,n){const r=this.formatArgs(e.args,n);return e.type==="box"?`
170
- `+[Pv(e.tag),e.title&&e.title,...r.split(`
171
- `)].filter(Boolean).map(i=>" > "+i).join(`
172
- `)+`
173
- `:this.filterAndJoin([Pv(e.type),Pv(e.tag),r])}log(e,n){const r=this.formatLogObj(e,{columns:n.options.stdout.columns||0,...n.options.formatOptions});return NW(r+`
174
- `,e.level<2?n.options.stderr||process.stderr:n.options.stdout||process.stdout)}};const{env:ns={},argv:DC=[],platform:OW=""}=typeof process>"u"?{}:process,FW="NO_COLOR"in ns||DC.includes("--no-color"),LW="FORCE_COLOR"in ns||DC.includes("--color"),MW=OW==="win32",EC=ns.TERM==="dumb",BW=cg&&cg.isatty&&cg.isatty(1)&&ns.TERM&&!EC,jW="CI"in ns&&("GITHUB_ACTIONS"in ns||"GITLAB_CI"in ns||"CIRCLECI"in ns),UW=!FW&&(LW||MW&&!EC||BW||jW);function TC(t,e,n,r,i=e.slice(0,Math.max(0,t))+r,s=e.slice(Math.max(0,t+n.length)),o=s.indexOf(n)){return i+(o<0?s:TC(o,s,n,r))}function qW(t,e,n,r,i){return t<0?n+e+r:n+TC(t,e,r,i)+r}function WW(t,e,n=t,r=t.length+1){return i=>i||!(i===""||i===void 0)?qW((""+i).indexOf(e,r),i,t,e,n):""}function he(t,e,n){return WW(`\x1B[${t}m`,`\x1B[${e}m`,n)}const RC={reset:he(0,0),bold:he(1,22,"\x1B[22m\x1B[1m"),dim:he(2,22,"\x1B[22m\x1B[2m"),italic:he(3,23),underline:he(4,24),inverse:he(7,27),hidden:he(8,28),strikethrough:he(9,29),black:he(30,39),red:he(31,39),green:he(32,39),yellow:he(33,39),blue:he(34,39),magenta:he(35,39),cyan:he(36,39),white:he(37,39),gray:he(90,39),bgBlack:he(40,49),bgRed:he(41,49),bgGreen:he(42,49),bgYellow:he(43,49),bgBlue:he(44,49),bgMagenta:he(45,49),bgCyan:he(46,49),bgWhite:he(47,49),blackBright:he(90,39),redBright:he(91,39),greenBright:he(92,39),yellowBright:he(93,39),blueBright:he(94,39),magentaBright:he(95,39),cyanBright:he(96,39),whiteBright:he(97,39),bgBlackBright:he(100,49),bgRedBright:he(101,49),bgGreenBright:he(102,49),bgYellowBright:he(103,49),bgBlueBright:he(104,49),bgMagentaBright:he(105,49),bgCyanBright:he(106,49),bgWhiteBright:he(107,49)};function GW(t=UW){return t?RC:Object.fromEntries(Object.keys(RC).map(e=>[e,String]))}const rn=GW();function zW(t,e="reset"){return rn[t]||rn[e]}const HW=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");function hu(t){return t.replace(new RegExp(HW,"g"),"")}const SC={solid:{tl:"\u250C",tr:"\u2510",bl:"\u2514",br:"\u2518",h:"\u2500",v:"\u2502"},double:{tl:"\u2554",tr:"\u2557",bl:"\u255A",br:"\u255D",h:"\u2550",v:"\u2551"},doubleSingle:{tl:"\u2553",tr:"\u2556",bl:"\u2559",br:"\u255C",h:"\u2500",v:"\u2551"},doubleSingleRounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2500",v:"\u2551"},singleThick:{tl:"\u250F",tr:"\u2513",bl:"\u2517",br:"\u251B",h:"\u2501",v:"\u2503"},singleDouble:{tl:"\u2552",tr:"\u2555",bl:"\u2558",br:"\u255B",h:"\u2550",v:"\u2502"},singleDoubleRounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2550",v:"\u2502"},rounded:{tl:"\u256D",tr:"\u256E",bl:"\u2570",br:"\u256F",h:"\u2500",v:"\u2502"}},KW={borderColor:"white",borderStyle:"rounded",valign:"center",padding:2,marginLeft:1,marginTop:1,marginBottom:1};function VW(t,e={}){const n={...e,style:{...KW,...e.style}},r=t.split(`
175
- `),i=[],s=zW(n.style.borderColor),o={...typeof n.style.borderStyle=="string"?SC[n.style.borderStyle]||SC.solid:n.style.borderStyle};if(s)for(const h in o)o[h]=s(o[h]);const a=n.style.padding%2===0?n.style.padding:n.style.padding+1,c=r.length+a,u=Math.max(...r.map(h=>h.length))+a,l=u+a,d=n.style.marginLeft>0?" ".repeat(n.style.marginLeft):"";if(n.style.marginTop>0&&i.push("".repeat(n.style.marginTop)),n.title){const h=o.h.repeat(Math.floor((u-hu(n.title).length)/2)),p=o.h.repeat(u-hu(n.title).length-hu(h).length+a);i.push(`${d}${o.tl}${h}${n.title}${p}${o.tr}`)}else i.push(`${d}${o.tl}${o.h.repeat(l)}${o.tr}`);const f=n.style.valign==="center"?Math.floor((c-r.length)/2):n.style.valign==="top"?c-r.length-a:c-r.length;for(let h=0;h<c;h++)if(h<f||h>=f+r.length)i.push(`${d}${o.v}${" ".repeat(l)}${o.v}`);else{const p=r[h-f],y=" ".repeat(a),T=" ".repeat(u-hu(p).length);i.push(`${d}${o.v}${y}${p}${T}${o.v}`)}return i.push(`${d}${o.bl}${o.h.repeat(l)}${o.br}`),n.style.marginBottom>0&&i.push("".repeat(n.style.marginBottom)),i.join(`
176
- `)}const YW=[["APPVEYOR"],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"]];function XW(t){for(const e of YW){const n=e[1]||e[0];if(t[n])return{name:e[0].toLowerCase(),...e[2]}}return t.SHELL&&t.SHELL==="/bin/jsh"?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const yh=typeof process<"u"?process:{},pu=yh.env||{},$C=XW(pu),JW=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";yh.platform,$C.name;const ZW=gu(pu.CI)||$C.ci!==!1;gu(yh.stdout&&yh.stdout.isTTY);const QW=gu(pu.DEBUG),kC=JW==="test"||gu(pu.TEST);gu(pu.MINIMAL);function gu(t){return t?t!=="false":!1}function eG({onlyFirst:t=!1}={}){const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}const tG=eG();function nG(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(tG,"")}function CC(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _C={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(r){var i=r.charCodeAt(0),s=r.length==2?r.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,o=i<<10|s,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(r){var i=this.eastAsianWidth(r);return i=="F"||i=="W"||i=="A"?2:1};function n(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(r){for(var i=n(r),s=0,o=0;o<i.length;o++)s=s+this.characterLength(i[o]);return s},e.slice=function(r,i,s){textLen=e.length(r),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var o="",a=0,c=n(r),u=0;u<c.length;u++){var l=c[u],d=e.length(l);if(a>=i-(d==2?1:0))if(a+d<=s)o+=l;else break;a+=d}return o}})(_C);var rG=_C.exports;const iG=CC(rG),sG=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function oG(t,e){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,countAnsiEscapeCodes:!1,...e},e.countAnsiEscapeCodes||(t=nG(t)),t.length===0))return 0;const n=e.ambiguousIsNarrow?1:2;let r=0;for(const{segment:i}of new Intl.Segmenter().segment(t)){const s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879)){if(sG().test(i)){r+=2;continue}switch(iG.eastAsianWidth(i)){case"F":case"W":{r+=2;break}case"A":{r+=n;break}default:r+=1}}}return r}function AC(){return Ee.platform!=="win32"?Ee.env.TERM!=="linux":!!Ee.env.CI||!!Ee.env.WT_SESSION||!!Ee.env.TERMINUS_SUBLIME||Ee.env.ConEmuTask==="{cmd::Cmder}"||Ee.env.TERM_PROGRAM==="Terminus-Sublime"||Ee.env.TERM_PROGRAM==="vscode"||Ee.env.TERM==="xterm-256color"||Ee.env.TERM==="alacritty"||Ee.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const aG={info:"cyan",fail:"red",success:"green",ready:"green",start:"magenta"},cG={0:"red",1:"yellow"},uG=AC(),Or=(t,e)=>uG?t:e,IC={error:Or("\u2716","\xD7"),fatal:Or("\u2716","\xD7"),ready:Or("\u2714","\u221A"),warn:Or("\u26A0","\u203C"),info:Or("\u2139","i"),success:Or("\u2714","\u221A"),debug:Or("\u2699","D"),trace:Or("\u2192","\u2192"),fail:Or("\u2716","\xD7"),start:Or("\u25D0","o"),log:""};function xC(t){return Intl.Segmenter?oG(t):hu(t).length}class lG extends bC{formatStack(e){return`
177
- `+wC(e).map(n=>" "+n.replace(/^at +/,r=>rn.gray(r)).replace(/\((.+)\)/,(r,i)=>`(${rn.cyan(i)})`)).join(`
178
- `)}formatType(e,n,r){const i=aG[e.type]||cG[e.level]||"gray";if(n)return fG(i)(rn.black(` ${e.type.toUpperCase()} `));const s=typeof IC[e.type]=="string"?IC[e.type]:e.icon||e.type;return s?dG(i)(s):""}formatLogObj(e,n){const[r,...i]=this.formatArgs(e.args,n).split(`
179
- `);if(e.type==="box")return VW(vh(r+(i.length>0?`
180
- `+i.join(`
181
- `):"")),{title:e.title?vh(e.title):void 0,style:e.style});const s=this.formatDate(e.date,n),o=s&&rn.gray(s),a=e.badge??e.level<2,c=this.formatType(e,a,n),u=e.tag?rn.gray(e.tag):"";let l;const d=this.filterAndJoin([c,vh(r)]),f=this.filterAndJoin(n.columns?[u,o]:[u]),h=(n.columns||0)-xC(d)-xC(f)-2;if(l=h>0&&(n.columns||0)>=80?d+" ".repeat(h)+f:(f?`${rn.gray(`[${f}]`)} `:"")+d,l+=vh(i.length>0?`
182
- `+i.join(`
183
- `):""),e.type==="trace"){const p=new Error("Trace: "+e.message);l+=this.formatStack(p.stack||"")}return a?`
184
- `+l+`
185
- `:l}}function vh(t){return t.replace(/`([^`]+)`/gm,(e,n)=>rn.cyan(n)).replace(/\s+_([^_]+)_\s+/gm,(e,n)=>` ${rn.underline(n)} `)}function dG(t="white"){return rn[t]||rn.white}function fG(t="bgWhite"){return rn[`bg${t[0].toUpperCase()}${t.slice(1)}`]||rn.bgWhite}function PC(t={}){let e=hG();return process.env.CONSOLA_LEVEL&&(e=Number.parseInt(process.env.CONSOLA_LEVEL)??e),PW({level:e,defaults:{level:e},stdout:process.stdout,stderr:process.stderr,prompt:(...n)=>import("../chunks/prompt.mjs").then(r=>r.prompt(...n)),reporters:t.reporters||[t.fancy??!(ZW||kC)?new lG:new bC],...t})}function hG(){return QW?Le.debug:kC?Le.warn:Le.info}PC();function pG(){return Le.debug}const NC=pG(),Ye=PC({level:NC,defaults:{level:NC},formatOptions:{colors:!0,compact:!1,date:!1}});function gG(t,e=1,n={}){const{indent:r=" ",includeEmptyLines:i=!1}=n;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===0)return t;const s=i?/^/gm:/^(?!\s*$)/gm;return t.replace(s,r.repeat(e))}function mG(t){for(var e=t.length,n=0,r=0;r<e;){var i=t.charCodeAt(r++);if(i&4294967168)if(!(i&4294965248))n+=2;else{if(i>=55296&&i<=56319&&r<e){var s=t.charCodeAt(r);(s&64512)===56320&&(++r,i=((i&1023)<<10)+(s&1023)+65536)}i&4294901760?n+=4:n+=3}else{n++;continue}}return n}function yG(t,e,n){for(var r=t.length,i=n,s=0;s<r;){var o=t.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){var a=t.charCodeAt(s);(a&64512)===56320&&(++s,o=((o&1023)<<10)+(a&1023)+65536)}o&4294901760?(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128):(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128)}else{e[i++]=o;continue}e[i++]=o&63|128}}var vG=new TextEncoder,wG=50;function bG(t,e,n){vG.encodeInto(t,e.subarray(n))}function DG(t,e,n){t.length>wG?bG(t,e,n):yG(t,e,n)}var EG=4096;function OC(t,e,n){for(var r=e,i=r+n,s=[],o="";r<i;){var a=t[r++];if(!(a&128))s.push(a);else if((a&224)===192){var c=t[r++]&63;s.push((a&31)<<6|c)}else if((a&240)===224){var c=t[r++]&63,u=t[r++]&63;s.push((a&31)<<12|c<<6|u)}else if((a&248)===240){var c=t[r++]&63,u=t[r++]&63,l=t[r++]&63,d=(a&7)<<18|c<<12|u<<6|l;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(a);s.length>=EG&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var TG=new TextDecoder,RG=200;function SG(t,e,n){var r=t.subarray(e,e+n);return TG.decode(r)}function $G(t,e,n){return n>RG?SG(t,e,n):OC(t,e,n)}var wh=function(){function t(e,n){this.type=e,this.data=n}return t}(),kG=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fr=function(t){kG(e,t);function e(n){var r=t.call(this,n)||this,i=Object.create(e.prototype);return Object.setPrototypeOf(r,i),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:e.name}),r}return e}(Error),mu=4294967295;function CG(t,e,n){var r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function FC(t,e,n){var r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function LC(t,e){var n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function _G(t,e){var n=t.getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}var AG=-1,IG=4294967296-1,xG=17179869184-1;function PG(t){var e=t.sec,n=t.nsec;if(e>=0&&n>=0&&e<=xG)if(n===0&&e<=IG){var r=new Uint8Array(4),i=new DataView(r.buffer);return i.setUint32(0,e),r}else{var s=e/4294967296,o=e&4294967295,r=new Uint8Array(8),i=new DataView(r.buffer);return i.setUint32(0,n<<2|s&3),i.setUint32(4,o),r}else{var r=new Uint8Array(12),i=new DataView(r.buffer);return i.setUint32(0,n),FC(i,4,e),r}}function NG(t){var e=t.getTime(),n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,i=Math.floor(r/1e9);return{sec:n+i,nsec:r-i*1e9}}function OG(t){if(t instanceof Date){var e=NG(t);return PG(e)}else return null}function FG(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:{var n=e.getUint32(0),r=0;return{sec:n,nsec:r}}case 8:{var i=e.getUint32(0),s=e.getUint32(4),n=(i&3)*4294967296+s,r=i>>>2;return{sec:n,nsec:r}}case 12:{var n=LC(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new Fr("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(t.length))}}function LG(t){var e=FG(t);return new Date(e.sec*1e3+e.nsec/1e6)}var MG={type:AG,encode:OG,decode:LG},MC=function(){function t(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(MG)}return t.prototype.register=function(e){var n=e.type,r=e.encode,i=e.decode;if(n>=0)this.encoders[n]=r,this.decoders[n]=i;else{var s=1+n;this.builtInEncoders[s]=r,this.builtInDecoders[s]=i}},t.prototype.tryToEncode=function(e,n){for(var r=0;r<this.builtInEncoders.length;r++){var i=this.builtInEncoders[r];if(i!=null){var s=i(e,n);if(s!=null){var o=-1-r;return new wh(o,s)}}}for(var r=0;r<this.encoders.length;r++){var i=this.encoders[r];if(i!=null){var s=i(e,n);if(s!=null){var o=r;return new wh(o,s)}}}return e instanceof wh?e:null},t.prototype.decode=function(e,n,r){var i=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return i?i(e,n,r):new wh(n,e)},t.defaultCodec=new t,t}();function bh(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}function BG(t){if(t instanceof ArrayBuffer)return new DataView(t);var e=bh(t);return new DataView(e.buffer,e.byteOffset,e.byteLength)}var jG=100,UG=2048,qG=function(){function t(e){var n,r,i,s,o,a,c,u;this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:MC.defaultCodec,this.context=e?.context,this.useBigInt64=(r=e?.useBigInt64)!==null&&r!==void 0?r:!1,this.maxDepth=(i=e?.maxDepth)!==null&&i!==void 0?i:jG,this.initialBufferSize=(s=e?.initialBufferSize)!==null&&s!==void 0?s:UG,this.sortKeys=(o=e?.sortKeys)!==null&&o!==void 0?o:!1,this.forceFloat32=(a=e?.forceFloat32)!==null&&a!==void 0?a:!1,this.ignoreUndefined=(c=e?.ignoreUndefined)!==null&&c!==void 0?c:!1,this.forceIntegerToFloat=(u=e?.forceIntegerToFloat)!==null&&u!==void 0?u:!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return t.prototype.reinitializeState=function(){this.pos=0},t.prototype.encodeSharedRef=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)},t.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)},t.prototype.doEncode=function(e,n){if(n>this.maxDepth)throw new Error("Too deep objects in depth ".concat(n));e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)},t.prototype.ensureBufferSizeToWrite=function(e){var n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)},t.prototype.resizeBuffer=function(e){var n=new ArrayBuffer(e),r=new Uint8Array(n),i=new DataView(n);r.set(this.bytes),this.view=i,this.bytes=r},t.prototype.encodeNil=function(){this.writeU8(192)},t.prototype.encodeBoolean=function(e){e===!1?this.writeU8(194):this.writeU8(195)},t.prototype.encodeNumber=function(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)},t.prototype.encodeNumberAsFloat=function(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},t.prototype.encodeBigInt64=function(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))},t.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error("Too long string: ".concat(e," bytes in UTF-8"))},t.prototype.encodeString=function(e){var n=5,r=mG(e);this.ensureBufferSizeToWrite(n+r),this.writeStringHeader(r),DG(e,this.bytes,this.pos),this.pos+=r},t.prototype.encodeObject=function(e,n){var r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)))},t.prototype.encodeBinary=function(e){var n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error("Too large binary: ".concat(n));var r=bh(e);this.writeU8a(r)},t.prototype.encodeArray=function(e,n){var r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error("Too large array: ".concat(r));for(var i=0,s=e;i<s.length;i++){var o=s[i];this.doEncode(o,n+1)}},t.prototype.countWithoutUndefined=function(e,n){for(var r=0,i=0,s=n;i<s.length;i++){var o=s[i];e[o]!==void 0&&r++}return r},t.prototype.encodeMap=function(e,n){var r=Object.keys(e);this.sortKeys&&r.sort();var i=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error("Too large map object: ".concat(i));for(var s=0,o=r;s<o.length;s++){var a=o[s],c=e[a];this.ignoreUndefined&&c===void 0||(this.encodeString(a),this.doEncode(c,n+1))}},t.prototype.encodeExtension=function(e){var n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error("Too large extension object: ".concat(n));this.writeI8(e.type),this.writeU8a(e.data)},t.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},t.prototype.writeU8a=function(e){var n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n},t.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},t.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},t.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},t.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},t.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},t.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},t.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},t.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),CG(this.view,this.pos,e),this.pos+=8},t.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),FC(this.view,this.pos,e),this.pos+=8},t.prototype.writeBigUint64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8},t.prototype.writeBigInt64=function(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8},t}();function WG(t,e){var n=new qG(e);return n.encodeSharedRef(t)}function Nv(t){return"".concat(t<0?"-":"","0x").concat(Math.abs(t).toString(16).padStart(2,"0"))}var GG=16,zG=16,HG=function(){function t(e,n){e===void 0&&(e=GG),n===void 0&&(n=zG),this.maxKeyLength=e,this.maxLengthPerKey=n,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return t.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},t.prototype.find=function(e,n,r){var i=this.caches[r-1];e:for(var s=0,o=i;s<o.length;s++){for(var a=o[s],c=a.bytes,u=0;u<r;u++)if(c[u]!==e[n+u])continue e;return a.str}return null},t.prototype.store=function(e,n){var r=this.caches[e.length-1],i={bytes:e,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)},t.prototype.decode=function(e,n,r){var i=this.find(e,n,r);if(i!=null)return this.hit++,i;this.miss++;var s=OC(e,n,r),o=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(o,s),s},t}(),KG=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(l){try{u(r.next(l))}catch(d){o(d)}}function c(l){try{u(r.throw(l))}catch(d){o(d)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((r=r.apply(t,e||[])).next())})},Ov=function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(l){u=[6,l],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},BC=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}},fa=function(t){return this instanceof fa?(this.v=t,this):new fa(t)},VG=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(f){r[f]&&(i[f]=function(h){return new Promise(function(p,y){s.push([f,h,p,y])>1||a(f,h)})})}function a(f,h){try{c(r[f](h))}catch(p){d(s[0][3],p)}}function c(f){f.value instanceof fa?Promise.resolve(f.value.v).then(u,l):d(s[0][2],f)}function u(f){a("next",f)}function l(f){a("throw",f)}function d(f,h){f(h),s.shift(),s.length&&a(s[0][0],s[0][1])}},jC="array",Dh="map_key",YG="map_value",XG=function(t){return typeof t=="string"||typeof t=="number"},yu=-1,Fv=new DataView(new ArrayBuffer(0)),JG=new Uint8Array(Fv.buffer);try{Fv.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var Lv=RangeError,UC=new Lv("Insufficient data"),ZG=new HG,QG=function(){function t(e){var n,r,i,s,o,a,c;this.totalPos=0,this.pos=0,this.view=Fv,this.bytes=JG,this.headByte=yu,this.stack=[],this.extensionCodec=(n=e?.extensionCodec)!==null&&n!==void 0?n:MC.defaultCodec,this.context=e?.context,this.useBigInt64=(r=e?.useBigInt64)!==null&&r!==void 0?r:!1,this.maxStrLength=(i=e?.maxStrLength)!==null&&i!==void 0?i:mu,this.maxBinLength=(s=e?.maxBinLength)!==null&&s!==void 0?s:mu,this.maxArrayLength=(o=e?.maxArrayLength)!==null&&o!==void 0?o:mu,this.maxMapLength=(a=e?.maxMapLength)!==null&&a!==void 0?a:mu,this.maxExtLength=(c=e?.maxExtLength)!==null&&c!==void 0?c:mu,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:ZG}return t.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=yu,this.stack.length=0},t.prototype.setBuffer=function(e){this.bytes=bh(e),this.view=BG(this.bytes),this.pos=0},t.prototype.appendBuffer=function(e){if(this.headByte===yu&&!this.hasRemaining(1))this.setBuffer(e);else{var n=this.bytes.subarray(this.pos),r=bh(e),i=new Uint8Array(n.length+r.length);i.set(n),i.set(r,n.length),this.setBuffer(i)}},t.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},t.prototype.createExtraByteError=function(e){var n=this,r=n.view,i=n.pos;return new RangeError("Extra ".concat(r.byteLength-i," of ").concat(r.byteLength," byte(s) found at buffer[").concat(e,"]"))},t.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n},t.prototype.decodeMulti=function(e){return Ov(this,function(n){switch(n.label){case 0:this.reinitializeState(),this.setBuffer(e),n.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return n.sent(),[3,1];case 3:return[2]}})},t.prototype.decodeAsync=function(e){var n,r,i,s,o,a,c;return KG(this,void 0,void 0,function(){var u,l,d,f,h,p,y,T;return Ov(this,function(b){switch(b.label){case 0:u=!1,b.label=1;case 1:b.trys.push([1,6,7,12]),n=!0,r=BC(e),b.label=2;case 2:return[4,r.next()];case 3:if(i=b.sent(),s=i.done,!!s)return[3,5];c=i.value,n=!1;try{if(d=c,u)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d);try{l=this.doDecodeSync(),u=!0}catch(v){if(!(v instanceof Lv))throw v}this.totalPos+=this.pos}finally{n=!0}b.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return f=b.sent(),o={error:f},[3,12];case 7:return b.trys.push([7,,10,11]),!n&&!s&&(a=r.return)?[4,a.call(r)]:[3,9];case 8:b.sent(),b.label=9;case 9:return[3,11];case 10:if(o)throw o.error;return[7];case 11:return[7];case 12:if(u){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,l]}throw h=this,p=h.headByte,y=h.pos,T=h.totalPos,new RangeError("Insufficient data in parsing ".concat(Nv(p)," at ").concat(T," (").concat(y," in the current buffer)"))}})})},t.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},t.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},t.prototype.decodeMultiAsync=function(e,n){return VG(this,arguments,function(){var i,s,o,a,c,u,l,d,f,h,p,y;return Ov(this,function(T){switch(T.label){case 0:i=n,s=-1,T.label=1;case 1:T.trys.push([1,15,16,21]),o=!0,a=BC(e),T.label=2;case 2:return[4,fa(a.next())];case 3:if(c=T.sent(),f=c.done,!!f)return[3,14];y=c.value,o=!1,T.label=4;case 4:if(T.trys.push([4,,12,13]),u=y,n&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(u),i&&(s=this.readArraySize(),i=!1,this.complete()),T.label=5;case 5:T.trys.push([5,10,,11]),T.label=6;case 6:return[4,fa(this.doDecodeSync())];case 7:return[4,T.sent()];case 8:return T.sent(),--s===0?[3,9]:[3,6];case 9:return[3,11];case 10:if(l=T.sent(),!(l instanceof Lv))throw l;return[3,11];case 11:return this.totalPos+=this.pos,[3,13];case 12:return o=!0,[7];case 13:return[3,2];case 14:return[3,21];case 15:return d=T.sent(),h={error:d},[3,21];case 16:return T.trys.push([16,,19,20]),!o&&!f&&(p=a.return)?[4,fa(p.call(a))]:[3,18];case 17:T.sent(),T.label=18;case 18:return[3,20];case 19:if(h)throw h.error;return[7];case 20:return[7];case 21:return[2]}})})},t.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),n=void 0;if(e>=224)n=e-256;else if(e<192)if(e<128)n=e;else if(e<144){var r=e-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e<160){var r=e-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else{var i=e-160;n=this.decodeUtf8String(i,0)}else if(e===192)n=null;else if(e===194)n=!1;else if(e===195)n=!0;else if(e===202)n=this.readF32();else if(e===203)n=this.readF64();else if(e===204)n=this.readU8();else if(e===205)n=this.readU16();else if(e===206)n=this.readU32();else if(e===207)this.useBigInt64?n=this.readU64AsBigInt():n=this.readU64();else if(e===208)n=this.readI8();else if(e===209)n=this.readI16();else if(e===210)n=this.readI32();else if(e===211)this.useBigInt64?n=this.readI64AsBigInt():n=this.readI64();else if(e===217){var i=this.lookU8();n=this.decodeUtf8String(i,1)}else if(e===218){var i=this.lookU16();n=this.decodeUtf8String(i,2)}else if(e===219){var i=this.lookU32();n=this.decodeUtf8String(i,4)}else if(e===220){var r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else if(e===221){var r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else n=[]}else if(e===222){var r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e===223){var r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else n={}}else if(e===196){var r=this.lookU8();n=this.decodeBinary(r,1)}else if(e===197){var r=this.lookU16();n=this.decodeBinary(r,2)}else if(e===198){var r=this.lookU32();n=this.decodeBinary(r,4)}else if(e===212)n=this.decodeExtension(1,0);else if(e===213)n=this.decodeExtension(2,0);else if(e===214)n=this.decodeExtension(4,0);else if(e===215)n=this.decodeExtension(8,0);else if(e===216)n=this.decodeExtension(16,0);else if(e===199){var r=this.lookU8();n=this.decodeExtension(r,1)}else if(e===200){var r=this.lookU16();n=this.decodeExtension(r,2)}else if(e===201){var r=this.lookU32();n=this.decodeExtension(r,4)}else throw new Fr("Unrecognized type byte: ".concat(Nv(e)));this.complete();for(var s=this.stack;s.length>0;){var o=s[s.length-1];if(o.type===jC)if(o.array[o.position]=n,o.position++,o.position===o.size)s.pop(),n=o.array;else continue e;else if(o.type===Dh){if(!XG(n))throw new Fr("The type of key must be string or number but "+typeof n);if(n==="__proto__")throw new Fr("The key __proto__ is not allowed");o.key=n,o.type=YG;continue e}else if(o.map[o.key]=n,o.readCount++,o.readCount===o.size)s.pop(),n=o.map;else{o.key=null,o.type=Dh;continue e}}return n}},t.prototype.readHeadByte=function(){return this.headByte===yu&&(this.headByte=this.readU8()),this.headByte},t.prototype.complete=function(){this.headByte=yu},t.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new Fr("Unrecognized array type byte: ".concat(Nv(e)))}}},t.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Fr("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:Dh,size:e,key:null,readCount:0,map:{}})},t.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new Fr("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:jC,size:e,array:new Array(e),position:0})},t.prototype.decodeUtf8String=function(e,n){var r;if(e>this.maxStrLength)throw new Fr("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+n+e)throw UC;var i=this.pos+n,s;return this.stateIsMapKey()&&(!((r=this.keyDecoder)===null||r===void 0)&&r.canBeCached(e))?s=this.keyDecoder.decode(this.bytes,i,e):s=$G(this.bytes,i,e),this.pos+=n+e,s},t.prototype.stateIsMapKey=function(){if(this.stack.length>0){var e=this.stack[this.stack.length-1];return e.type===Dh}return!1},t.prototype.decodeBinary=function(e,n){if(e>this.maxBinLength)throw new Fr("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+n))throw UC;var r=this.pos+n,i=this.bytes.subarray(r,r+e);return this.pos+=n+e,i},t.prototype.decodeExtension=function(e,n){if(e>this.maxExtLength)throw new Fr("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var r=this.view.getInt8(this.pos+n),i=this.decodeBinary(e,n+1);return this.extensionCodec.decode(i,r,this.context)},t.prototype.lookU8=function(){return this.view.getUint8(this.pos)},t.prototype.lookU16=function(){return this.view.getUint16(this.pos)},t.prototype.lookU32=function(){return this.view.getUint32(this.pos)},t.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},t.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},t.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},t.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},t.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},t.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},t.prototype.readU64=function(){var e=_G(this.view,this.pos);return this.pos+=8,e},t.prototype.readI64=function(){var e=LC(this.view,this.pos);return this.pos+=8,e},t.prototype.readU64AsBigInt=function(){var e=this.view.getBigUint64(this.pos);return this.pos+=8,e},t.prototype.readI64AsBigInt=function(){var e=this.view.getBigInt64(this.pos);return this.pos+=8,e},t.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},t.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},t}();function ez(t,e){var n=new QG(e);return n.decode(t)}const tz=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",nz=(t,e=0,n=t.byteLength-e)=>{if(!tz(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return fg.from(t,e,n)},qC=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?fg.from(t,e):fg.from(t)},rz=/^[A-Za-z0-9+/]*={0,2}$/,iz=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!rz.exec(t))throw new TypeError("Invalid base64 string.");const e=qC(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},sz=t=>{const e=qC(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},oz=t=>{let e;if(typeof t=="string"?e=sz(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return nz(e.buffer,e.byteOffset,e.byteLength).toString("base64")},az=`likec4lib { icons {
186
- aws:activate
187
- aws:alexa-for-business
188
- aws:amplify
189
- aws:apache-mxnet-on-aws
190
- aws:api-gateway
191
- aws:app-config
192
- aws:app-flow
193
- aws:app-mesh
194
- aws:app-runner
195
- aws:app-stream
196
- aws:app-sync
197
- aws:application-auto-scaling
198
- aws:application-composer
199
- aws:application-cost-profiler
200
- aws:application-discovery-service
201
- aws:application-migration-service
202
- aws:artifact
203
- aws:athena
204
- aws:audit-manager
205
- aws:augmented-ai-a2i
206
- aws:aurora
207
- aws:auto-scaling
208
- aws:backint-agent
209
- aws:backup
210
- aws:batch
211
- aws:billing-conductor
212
- aws:bottlerocket
213
- aws:braket
214
- aws:budgets
215
- aws:certificate-manager
216
- aws:chatbot
217
- aws:chime
218
- aws:chime-sdk
219
- aws:chime-voice-connector
220
- aws:clean-rooms
221
- aws:client-vpn
222
- aws:cloud-control-api
223
- aws:cloud-development-kit
224
- aws:cloud-directory
225
- aws:cloud-formation
226
- aws:cloud-front
227
- aws:cloud-hsm
228
- aws:cloud-map
229
- aws:cloud-search
230
- aws:cloud-shell
231
- aws:cloud-trail
232
- aws:cloud-wan
233
- aws:cloud-watch
234
- aws:cloud9
235
- aws:code-artifact
236
- aws:code-build
237
- aws:code-catalyst
238
- aws:code-commit
239
- aws:code-deploy
240
- aws:code-guru
241
- aws:code-pipeline
242
- aws:code-star
243
- aws:code-whisperer
244
- aws:cognito
245
- aws:command-line-interface
246
- aws:comprehend
247
- aws:comprehend-medical
248
- aws:compute-optimizer
249
- aws:config
250
- aws:connect
251
- aws:console-mobile-application
252
- aws:control-tower
253
- aws:corretto
254
- aws:cost-and-usage-report
255
- aws:cost-explorer
256
- aws:data-exchange
257
- aws:data-pipeline
258
- aws:data-sync
259
- aws:data-zone
260
- aws:database-migration-service
261
- aws:deep-composer
262
- aws:deep-learning-amis
263
- aws:deep-learning-containers
264
- aws:deep-lens
265
- aws:deep-racer
266
- aws:detective
267
- aws:dev-ops-guru
268
- aws:device-farm
269
- aws:direct-connect
270
- aws:directory-service
271
- aws:distro-for-open-telemetry
272
- aws:document-db
273
- aws:dynamo-db
274
- aws:ec2
275
- aws:ec2-auto-scaling
276
- aws:ec2-image-builder
277
- aws:ecs-anywhere
278
- aws:efs
279
- aws:eks-anywhere
280
- aws:eks-cloud
281
- aws:eks-distro
282
- aws:elasti-cache
283
- aws:elastic-beanstalk
284
- aws:elastic-block-store
285
- aws:elastic-container-registry
286
- aws:elastic-container-service
287
- aws:elastic-disaster-recovery
288
- aws:elastic-fabric-adapter
289
- aws:elastic-inference
290
- aws:elastic-kubernetes-service
291
- aws:elastic-load-balancing
292
- aws:elastic-transcoder
293
- aws:elemental-appliances-software
294
- aws:elemental-conductor
295
- aws:elemental-delta
296
- aws:elemental-link
297
- aws:elemental-live
298
- aws:elemental-media-connect
299
- aws:elemental-media-convert
300
- aws:elemental-media-live
301
- aws:elemental-media-package
302
- aws:elemental-media-store
303
- aws:elemental-media-tailor
304
- aws:elemental-server
305
- aws:emr
306
- aws:event-bridge
307
- aws:express-workflows
308
- aws:fargate
309
- aws:fault-injection-simulator
310
- aws:file-cache
311
- aws:fin-space
312
- aws:firewall-manager
313
- aws:forecast
314
- aws:fraud-detector
315
- aws:free-rtos
316
- aws:fsx
317
- aws:fsx-for-lustre
318
- aws:fsx-for-net-app-ontap
319
- aws:fsx-for-open-zfs
320
- aws:fsx-for-wfs
321
- aws:game-kit
322
- aws:game-lift
323
- aws:game-sparks
324
- aws:genomics-cli
325
- aws:global-accelerator
326
- aws:glue
327
- aws:glue-data-brew
328
- aws:glue-elastic-views
329
- aws:ground-station
330
- aws:guard-duty
331
- aws:health-lake
332
- aws:honeycode
333
- aws:iam-identity-center
334
- aws:identity-and-access-management
335
- aws:inspector
336
- aws:interactive-video-service
337
- aws:io-t-1-click
338
- aws:io-t-analytics
339
- aws:io-t-button
340
- aws:io-t-core
341
- aws:io-t-device-defender
342
- aws:io-t-device-management
343
- aws:io-t-edu-kit
344
- aws:io-t-events
345
- aws:io-t-express-link
346
- aws:io-t-fleet-wise
347
- aws:io-t-greengrass
348
- aws:io-t-robo-runner
349
- aws:io-t-site-wise
350
- aws:io-t-things-graph
351
- aws:io-t-twin-maker
352
- aws:iq
353
- aws:kendra
354
- aws:key-management-service
355
- aws:keyspaces
356
- aws:kinesis
357
- aws:kinesis-data-analytics
358
- aws:kinesis-data-streams
359
- aws:kinesis-firehose
360
- aws:kinesis-video-streams
361
- aws:lake-formation
362
- aws:lambda
363
- aws:launch-wizard
364
- aws:lex
365
- aws:license-manager
366
- aws:lightsail
367
- aws:local-zones
368
- aws:location-service
369
- aws:lookout-for-equipment
370
- aws:lookout-for-metrics
371
- aws:lookout-for-vision
372
- aws:lumberyard
373
- aws:macie
374
- aws:mainframe-modernization
375
- aws:managed-blockchain
376
- aws:managed-grafana
377
- aws:managed-service-for-prometheus
378
- aws:managed-services
379
- aws:managed-streaming-for-apache-kafka
380
- aws:managed-workflows-for-apache-airflow
381
- aws:management-console
382
- aws:marketplace-dark
383
- aws:marketplace-light
384
- aws:memory-db-for-redis
385
- aws:migration-evaluator
386
- aws:migration-hub
387
- aws:monitron
388
- aws:mq
389
- aws:neptune
390
- aws:network-firewall
391
- aws:neuron
392
- aws:nice-dcv
393
- aws:nice-engin-frame
394
- aws:nimble-studio
395
- aws:nitro-enclaves
396
- aws:omics
397
- aws:open-3d-engine
398
- aws:open-search-service
399
- aws:ops-works
400
- aws:organizations
401
- aws:outposts-family
402
- aws:outposts-rack
403
- aws:outposts-servers
404
- aws:panorama
405
- aws:parallel-cluster
406
- aws:personal-health-dashboard
407
- aws:personalize
408
- aws:pinpoint
409
- aws:pinpoint-apis
410
- aws:polly
411
- aws:private-5g
412
- aws:private-certificate-authority
413
- aws:private-link
414
- aws:professional-services
415
- aws:proton
416
- aws:quantum-ledger-database
417
- aws:quick-sight
418
- aws:rds
419
- aws:rds-on-vmware
420
- aws:re-post
421
- aws:red-hat-open-shift-service-on-aws
422
- aws:redshift
423
- aws:rekognition
424
- aws:reserved-instance-reporting
425
- aws:resilience-hub
426
- aws:resource-access-manager
427
- aws:resource-explorer
428
- aws:robo-maker
429
- aws:route-53
430
- aws:s3-on-outposts
431
- aws:sage-maker
432
- aws:sage-maker-ground-truth
433
- aws:sage-maker-studio-lab
434
- aws:savings-plans
435
- aws:secrets-manager
436
- aws:security-hub
437
- aws:security-lake
438
- aws:server-migration-service
439
- aws:serverless-application-repository
440
- aws:service-catalog
441
- aws:service-management-connector
442
- aws:shield
443
- aws:signer
444
- aws:sim-space-weaver
445
- aws:simple-email-service
446
- aws:simple-notification-service
447
- aws:simple-queue-service
448
- aws:simple-storage-service
449
- aws:simple-storage-service-glacier
450
- aws:site-to-site-vpn
451
- aws:snowball
452
- aws:snowball-edge
453
- aws:snowcone
454
- aws:snowmobile
455
- aws:step-functions
456
- aws:storage-gateway
457
- aws:sumerian
458
- aws:supply-chain
459
- aws:support
460
- aws:systems-manager
461
- aws:tensor-flow-on-aws
462
- aws:textract
463
- aws:thinkbox-deadline
464
- aws:thinkbox-frost
465
- aws:thinkbox-krakatoa
466
- aws:thinkbox-sequoia
467
- aws:thinkbox-stoke
468
- aws:thinkbox-xmesh
469
- aws:timestream
470
- aws:tools-and-sdks
471
- aws:torch-serve
472
- aws:training-certification
473
- aws:transcribe
474
- aws:transfer-family
475
- aws:transit-gateway
476
- aws:translate
477
- aws:trusted-advisor
478
- aws:verified-access
479
- aws:verified-permissions
480
- aws:virtual-private-cloud
481
- aws:vmware-cloud-on-aws
482
- aws:vpc-lattice
483
- aws:waf
484
- aws:wavelength
485
- aws:well-architected-tool
486
- aws:wickr
487
- aws:work-docs
488
- aws:work-docs-sdk
489
- aws:work-link
490
- aws:work-mail
491
- aws:work-spaces-family
492
- aws:x-ray
493
- gcp:access-context-manager
494
- gcp:administration
495
- gcp:advanced-agent-modeling
496
- gcp:advanced-solutions-lab
497
- gcp:agent-assist
498
- gcp:ai-hub
499
- gcp:ai-platform
500
- gcp:ai-platform-unified
501
- gcp:analytics-hub
502
- gcp:anthos
503
- gcp:anthos-config-management
504
- gcp:anthos-service-mesh
505
- gcp:api
506
- gcp:api-analytics
507
- gcp:api-monetization
508
- gcp:apigee-api-platform
509
- gcp:apigee-sense
510
- gcp:app-engine
511
- gcp:artifact-registry
512
- gcp:asset-inventory
513
- gcp:assured-workloads
514
- gcp:auto-ml
515
- gcp:auto-ml-natural-language
516
- gcp:auto-ml-tables
517
- gcp:auto-ml-translation
518
- gcp:auto-ml-video-intelligence
519
- gcp:auto-ml-vision
520
- gcp:bare-metal-solutions
521
- gcp:batch
522
- gcp:beyondcorp
523
- gcp:big-query
524
- gcp:bigtable
525
- gcp:billing
526
- gcp:binary-authorization
527
- gcp:catalog
528
- gcp:certificate-authority-service
529
- gcp:certificate-manager
530
- gcp:cloud-api-gateway
531
- gcp:cloud-apis
532
- gcp:cloud-armor
533
- gcp:cloud-asset-inventory
534
- gcp:cloud-audit-logs
535
- gcp:cloud-build
536
- gcp:cloud-cdn
537
- gcp:cloud-code
538
- gcp:cloud-composer
539
- gcp:cloud-data-fusion
540
- gcp:cloud-deploy
541
- gcp:cloud-deployment-manager
542
- gcp:cloud-dns
543
- gcp:cloud-domains
544
- gcp:cloud-ekm
545
- gcp:cloud-endpoints
546
- gcp:cloud-external-ip-addresses
547
- gcp:cloud-firewall-rules
548
- gcp:cloud-for-marketing
549
- gcp:cloud-functions
550
- gcp:cloud-generic
551
- gcp:cloud-gpu
552
- gcp:cloud-healthcare-api
553
- gcp:cloud-healthcare-marketplace
554
- gcp:cloud-hsm
555
- gcp:cloud-ids
556
- gcp:cloud-inference-api
557
- gcp:cloud-interconnect
558
- gcp:cloud-jobs-api
559
- gcp:cloud-load-balancing
560
- gcp:cloud-logging
561
- gcp:cloud-media-edge
562
- gcp:cloud-monitoring
563
- gcp:cloud-nat
564
- gcp:cloud-natural-language-api
565
- gcp:cloud-network
566
- gcp:cloud-ops
567
- gcp:cloud-optimization-ai
568
- gcp:cloud-optimization-ai-fleet-routing-api
569
- gcp:cloud-router
570
- gcp:cloud-routes
571
- gcp:cloud-run
572
- gcp:cloud-run-for-anthos
573
- gcp:cloud-scheduler
574
- gcp:cloud-security-scanner
575
- gcp:cloud-shell
576
- gcp:cloud-spanner
577
- gcp:cloud-sql
578
- gcp:cloud-storage
579
- gcp:cloud-tasks
580
- gcp:cloud-test-lab
581
- gcp:cloud-tpu
582
- gcp:cloud-translation-api
583
- gcp:cloud-vision-api
584
- gcp:cloud-vpn
585
- gcp:compute-engine
586
- gcp:configuration-management
587
- gcp:connectivity-test
588
- gcp:connectors
589
- gcp:contact-center-ai
590
- gcp:container-optimized-os
591
- gcp:container-registry
592
- gcp:data-catalog
593
- gcp:data-labeling
594
- gcp:data-layers
595
- gcp:data-loss-prevention-api
596
- gcp:data-qn-a
597
- gcp:data-studio
598
- gcp:data-transfer
599
- gcp:database-migration-service
600
- gcp:dataflow
601
- gcp:datalab
602
- gcp:dataplex
603
- gcp:datapol
604
- gcp:dataprep
605
- gcp:dataproc
606
- gcp:dataproc-metastore
607
- gcp:datashare
608
- gcp:datastore
609
- gcp:datastream
610
- gcp:debugger
611
- gcp:developer-portal
612
- gcp:dialogflow
613
- gcp:dialogflow-cx
614
- gcp:dialogflow-insights
615
- gcp:document-ai
616
- gcp:early-access-center
617
- gcp:error-reporting
618
- gcp:eventarc
619
- gcp:filestore
620
- gcp:financial-services-marketplace
621
- gcp:firestore
622
- gcp:fleet-engine
623
- gcp:free-trial
624
- gcp:game-servers
625
- gcp:gce-systems-management
626
- gcp:genomics
627
- gcp:gke-on-prem
628
- gcp:google-cloud-marketplace
629
- gcp:google-kubernetes-engine
630
- gcp:google-maps-platform
631
- gcp:healthcare-nlp-api
632
- gcp:home
633
- gcp:identity-and-access-management
634
- gcp:identity-aware-proxy
635
- gcp:identity-platform
636
- gcp:iot-core
637
- gcp:iot-edge
638
- gcp:key-access-justifications
639
- gcp:key-management-service
640
- gcp:kuberun
641
- gcp:launcher
642
- gcp:local-ssd
643
- gcp:looker
644
- gcp:managed-service-for-microsoft-active-directory
645
- gcp:media-translation-api
646
- gcp:memorystore
647
- gcp:migrate-for-anthos
648
- gcp:migrate-for-compute-engine
649
- gcp:my-cloud
650
- gcp:network-connectivity-center
651
- gcp:network-intelligence-center
652
- gcp:network-security
653
- gcp:network-tiers
654
- gcp:network-topology
655
- gcp:onboarding
656
- gcp:os-configuration-management
657
- gcp:os-inventory-management
658
- gcp:os-patch-management
659
- gcp:partner-interconnect
660
- gcp:partner-portal
661
- gcp:performance-dashboard
662
- gcp:permissions
663
- gcp:persistent-disk
664
- gcp:phishing-protection
665
- gcp:policy-analyzer
666
- gcp:premium-network-tier
667
- gcp:private-connectivity
668
- gcp:private-service-connect
669
- gcp:producer-portal
670
- gcp:profiler
671
- gcp:project
672
- gcp:pub-sub
673
- gcp:quantum-engine
674
- gcp:quotas
675
- gcp:real-world-insights
676
- gcp:recommendations-ai
677
- gcp:release-notes
678
- gcp:retail-api
679
- gcp:risk-manager
680
- gcp:runtime-config
681
- gcp:secret-manager
682
- gcp:security
683
- gcp:security-command-center
684
- gcp:security-health-advisor
685
- gcp:security-key-enforcement
686
- gcp:service-discovery
687
- gcp:speech-to-text
688
- gcp:stackdriver
689
- gcp:standard-network-tier
690
- gcp:stream-suite
691
- gcp:support
692
- gcp:tensorflow-enterprise
693
- gcp:text-to-speech
694
- gcp:tools-for-powershell
695
- gcp:trace
696
- gcp:traffic-director
697
- gcp:transfer
698
- gcp:transfer-appliance
699
- gcp:user-preferences
700
- gcp:vertex-ai
701
- gcp:video-intelligence-api
702
- gcp:virtual-private-cloud
703
- gcp:visual-inspection
704
- gcp:vmware-engine
705
- gcp:web-risk
706
- gcp:web-security-scanner
707
- gcp:workflows
708
- gcp:workload-identity-pool
709
- tech:aarch64
710
- tech:adobe-illustrator
711
- tech:adobe-photoshop
712
- tech:adobe-premiere-pro
713
- tech:adobe-xd
714
- tech:adonis-js
715
- tech:after-effects
716
- tech:airflow
717
- tech:akka
718
- tech:algolia
719
- tech:alpine-js
720
- tech:amazon-web-services
721
- tech:anaconda
722
- tech:android
723
- tech:android-studio
724
- tech:angular
725
- tech:angular-js
726
- tech:ansible
727
- tech:ant-design
728
- tech:apache
729
- tech:apl
730
- tech:appcelerator
731
- tech:apple
732
- tech:apple-safari
733
- tech:appwrite
734
- tech:arch-linux
735
- tech:arduino
736
- tech:argo-cd
737
- tech:astro
738
- tech:atom
739
- tech:autodesk-maya
740
- tech:autodesk-shot-grid
741
- tech:awk
742
- tech:azios
743
- tech:azure
744
- tech:azure-devops
745
- tech:azure-sql-database
746
- tech:babel
747
- tech:backbone-js
748
- tech:ballerina
749
- tech:bamboo
750
- tech:bash
751
- tech:behance
752
- tech:bitbucket
753
- tech:blender
754
- tech:bootstrap
755
- tech:bower
756
- tech:browserstack
757
- tech:bulma
758
- tech:bun
759
- tech:c
760
- tech:cairo-graphics
761
- tech:cake-php
762
- tech:canva
763
- tech:capacitor
764
- tech:cassandra
765
- tech:cent-os
766
- tech:chrome
767
- tech:circle-ci
768
- tech:clarity
769
- tech:clion
770
- tech:clojure
771
- tech:clojure-script
772
- tech:cloudflare
773
- tech:cloudflare-workers
774
- tech:cmake
775
- tech:code-igniter
776
- tech:code-pen
777
- tech:codeac
778
- tech:codecov
779
- tech:coffee-script
780
- tech:composer
781
- tech:confluence
782
- tech:consul
783
- tech:contao
784
- tech:corejs
785
- tech:cosmosdb
786
- tech:couchdb
787
- tech:cplusplus
788
- tech:crystal
789
- tech:csharp
790
- tech:css3
791
- tech:cucumber
792
- tech:cypress
793
- tech:d3js
794
- tech:dart
795
- tech:data-grip
796
- tech:data-spell
797
- tech:dbeaver
798
- tech:debian
799
- tech:deno
800
- tech:devicon
801
- tech:digital-ocean
802
- tech:discord-js
803
- tech:django
804
- tech:django-rest
805
- tech:docker
806
- tech:doctrine
807
- tech:dropwizard
808
- tech:drupal
809
- tech:eclipse-ceylon
810
- tech:eclipse-ide
811
- tech:eclipse-vert-x
812
- tech:elasticbeats
813
- tech:elasticsearch
814
- tech:electron
815
- tech:eleventy-11ty
816
- tech:elixir
817
- tech:elm
818
- tech:embedded-c
819
- tech:ember-js
820
- tech:envoy
821
- tech:erlang
822
- tech:eslint
823
- tech:express
824
- tech:facebook
825
- tech:fast-api
826
- tech:fastify
827
- tech:fauna
828
- tech:feathers
829
- tech:fedora
830
- tech:figma
831
- tech:file-zilla
832
- tech:firebase
833
- tech:firefox
834
- tech:flask
835
- tech:flutter
836
- tech:fortran
837
- tech:foundation
838
- tech:fsharp
839
- tech:gatling
840
- tech:gatsby
841
- tech:gazebo
842
- tech:gcc
843
- tech:gentoo
844
- tech:ghost
845
- tech:gimp
846
- tech:git
847
- tech:gitbook
848
- tech:github
849
- tech:github-actions
850
- tech:github-codespaces
851
- tech:gitlab
852
- tech:gitpod
853
- tech:gitter
854
- tech:gnu-emacs
855
- tech:go
856
- tech:go-land
857
- tech:godot-engine
858
- tech:google
859
- tech:google-cloud
860
- tech:gradle
861
- tech:grafana
862
- tech:grails
863
- tech:graphql
864
- tech:groovy
865
- tech:grunt-js
866
- tech:gulp-js
867
- tech:hadoop
868
- tech:handlebars
869
- tech:hardhat
870
- tech:harvester
871
- tech:hashicorp-vault
872
- tech:haskell
873
- tech:haxe
874
- tech:helm
875
- tech:heroku
876
- tech:hibernate
877
- tech:homebrew
878
- tech:html5
879
- tech:hugo
880
- tech:ibm-spss-statistics
881
- tech:ie10
882
- tech:ifttt
883
- tech:influxdb
884
- tech:inkscape
885
- tech:insomnia
886
- tech:intellij-idea
887
- tech:ionic
888
- tech:jaeger
889
- tech:jamstack
890
- tech:jasmine
891
- tech:java
892
- tech:javascript
893
- tech:jeet
894
- tech:jekyll
895
- tech:jenkins
896
- tech:jest
897
- tech:jetbrains
898
- tech:jira
899
- tech:jira-align
900
- tech:jquery
901
- tech:json
902
- tech:jule
903
- tech:julia
904
- tech:junit
905
- tech:jupyter
906
- tech:k3os
907
- tech:k3s
908
- tech:kafka
909
- tech:kaggle
910
- tech:karate
911
- tech:karma
912
- tech:keras
913
- tech:kibana
914
- tech:knex-js
915
- tech:knockout
916
- tech:kotlin
917
- tech:krakenjs
918
- tech:ktor
919
- tech:kubernetes
920
- tech:labview
921
- tech:laravel
922
- tech:latex
923
- tech:less-js
924
- tech:linkedin
925
- tech:linux
926
- tech:liquibase
927
- tech:livewire
928
- tech:llvm
929
- tech:logstash
930
- tech:lua
931
- tech:lumen
932
- tech:magento
933
- tech:markdown
934
- tech:material-ui
935
- tech:materialize
936
- tech:matlab
937
- tech:matplotlib
938
- tech:maven
939
- tech:meteor-js
940
- tech:microsoft-sql-server
941
- tech:minitab
942
- tech:mob-x
943
- tech:mocha
944
- tech:modx
945
- tech:moleculer
946
- tech:mongodb
947
- tech:mongoose-js
948
- tech:moodle
949
- tech:ms-dos
950
- tech:mysql
951
- tech:nano
952
- tech:nerog
953
- tech:nestjs
954
- tech:net
955
- tech:net-core
956
- tech:network-x
957
- tech:new4j
958
- tech:nextjs
959
- tech:nginx
960
- tech:nhibernate
961
- tech:nim
962
- tech:nimble
963
- tech:nix
964
- tech:nodejs
965
- tech:nodemon
966
- tech:nodewebkit
967
- tech:npm
968
- tech:nuget
969
- tech:num-py
970
- tech:nuxt-js
971
- tech:objective-c
972
- tech:ocaml
973
- tech:oh-my-zsh
974
- tech:okta
975
- tech:open-al
976
- tech:open-api
977
- tech:open-cl
978
- tech:open-cv
979
- tech:open-gl
980
- tech:open-stack
981
- tech:open-suse
982
- tech:open-telemetry
983
- tech:opera
984
- tech:oracle
985
- tech:p5js
986
- tech:packer
987
- tech:pandas
988
- tech:perl
989
- tech:pf-sense
990
- tech:phalcon
991
- tech:phoenix-framework
992
- tech:photon-engine
993
- tech:php
994
- tech:php-storm
995
- tech:playwrite
996
- tech:ploty
997
- tech:podman
998
- tech:polygon
999
- tech:portainer
1000
- tech:postcss
1001
- tech:postgresql
1002
- tech:postman
1003
- tech:powershell
1004
- tech:processing
1005
- tech:prometheus
1006
- tech:protractor
1007
- tech:purescript
1008
- tech:putty
1009
- tech:pycharm
1010
- tech:pyscript
1011
- tech:pytest
1012
- tech:python
1013
- tech:python-poetry
1014
- tech:pytorch
1015
- tech:qodana
1016
- tech:qt
1017
- tech:quarkus
1018
- tech:quasar
1019
- tech:qwik
1020
- tech:r
1021
- tech:rabbitmq
1022
- tech:rancher
1023
- tech:raspberrypi
1024
- tech:reach
1025
- tech:react
1026
- tech:react-bootstrap
1027
- tech:realm
1028
- tech:red-cube-s-epic-compiler-thingy-programming-re-ct
1029
- tech:redhat
1030
- tech:redis
1031
- tech:redux
1032
- tech:ren-py
1033
- tech:rider
1034
- tech:robot-operating-system-ros
1035
- tech:rocksdb
1036
- tech:rollup-js
1037
- tech:rspec
1038
- tech:rstudio
1039
- tech:ruby
1040
- tech:ruby-mine
1041
- tech:ruby-on-rails
1042
- tech:rust
1043
- tech:salesforce
1044
- tech:sanity
1045
- tech:sass
1046
- tech:scala
1047
- tech:scalingo
1048
- tech:sdl
1049
- tech:selenium
1050
- tech:sema-software
1051
- tech:sequelize
1052
- tech:shopware
1053
- tech:sketch
1054
- tech:slack
1055
- tech:socket-io
1056
- tech:solid-js
1057
- tech:solidity
1058
- tech:sonarqube
1059
- tech:sourcetree
1060
- tech:spark
1061
- tech:splunk
1062
- tech:spring
1063
- tech:sql-developer
1064
- tech:sqlalchemy
1065
- tech:sqlite
1066
- tech:ssh
1067
- tech:stackoverflow
1068
- tech:stata
1069
- tech:storybook
1070
- tech:streamlit
1071
- tech:stylus
1072
- tech:subversion
1073
- tech:svelte
1074
- tech:swagger
1075
- tech:swift
1076
- tech:symfony
1077
- tech:tailwind-css
1078
- tech:tauri
1079
- tech:tensorflow
1080
- tech:terraform
1081
- tech:tex
1082
- tech:the-algorithms
1083
- tech:three-js
1084
- tech:titanium-sdk
1085
- tech:tomcat
1086
- tech:tortoise-git
1087
- tech:tower
1088
- tech:traefik-mesh
1089
- tech:traefik-proxy
1090
- tech:travis-ci
1091
- tech:trello
1092
- tech:twitter
1093
- tech:typescript
1094
- tech:typo3
1095
- tech:ubuntu
1096
- tech:uml
1097
- tech:unity
1098
- tech:unix
1099
- tech:unreal-engine
1100
- tech:uwsgi
1101
- tech:v8
1102
- tech:vagrant
1103
- tech:vala
1104
- tech:vercel
1105
- tech:veutify
1106
- tech:vim
1107
- tech:visualstudio
1108
- tech:vite
1109
- tech:vitejs
1110
- tech:vscode
1111
- tech:vsphere
1112
- tech:vue
1113
- tech:vue-storefront
1114
- tech:vyper
1115
- tech:webassembly
1116
- tech:webflow
1117
- tech:weblate
1118
- tech:webpack
1119
- tech:webstorm
1120
- tech:windows8
1121
- tech:windows11
1122
- tech:woo-commerce
1123
- tech:wordpress
1124
- tech:xamarin
1125
- tech:xcode
1126
- tech:xml
1127
- tech:yaml
1128
- tech:yarn
1129
- tech:yii-framework
1130
- tech:yuno-host
1131
- tech:zend-framework
1132
- tech:zig
1133
- }}`,WC="likec4builtin",cz=`${WC}:///likec4/lib/icons.c4`,uz=new mn.NotificationType("likec4/onDidChangeModel"),lz=new mn.RequestType0("likec4/fetchModel"),dz=new mn.RequestType("likec4/fetchComputedModel"),fz=new mn.RequestType("likec4/computeView"),hz=new mn.RequestType("likec4/build"),pz=new mn.RequestType("likec4/locate"),gz=new mn.RequestType("likec4/change-view");var mz=t=>{const e=t.match(/^[ \t]*(?=\S)/gm);return e?e.reduce((n,r)=>Math.min(n,r.length),1/0):0};function Mv(t){const e=mz(t);if(e===0)return t;const n=new RegExp(`^[ \\t]{${e}}`,"gm");return t.replace(n,"")}function yz(t){for(var e=5381,n=t.length;n;)e=e*33^t.charCodeAt(--n);return e>>>0}var vz=yz,wz=Object.getOwnPropertyNames,bz=Object.getOwnPropertySymbols,Dz=Object.prototype.hasOwnProperty;function GC(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Eh(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);var s=i.cache,o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);var c=t(n,r,i);return s.delete(n),s.delete(r),c}}function zC(t){return wz(t).concat(bz(t))}var HC=Object.hasOwn||function(t,e){return Dz.call(t,e)};function ha(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var KC="_owner",VC=Object.getOwnPropertyDescriptor,YC=Object.keys;function Ez(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function Tz(t,e){return ha(t.getTime(),e.getTime())}function XC(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),s=0,o,a;(o=i.next())&&!o.done;){for(var c=e.entries(),u=!1,l=0;(a=c.next())&&!a.done;){var d=o.value,f=d[0],h=d[1],p=a.value,y=p[0],T=p[1];!u&&!r[l]&&(u=n.equals(f,y,s,l,t,e,n)&&n.equals(h,T,f,y,t,e,n))&&(r[l]=!0),l++}if(!u)return!1;s++}return!0}function Rz(t,e,n){var r=YC(t),i=r.length;if(YC(e).length!==i)return!1;for(var s;i-- >0;)if(s=r[i],s===KC&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!HC(e,s)||!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function vu(t,e,n){var r=zC(t),i=r.length;if(zC(e).length!==i)return!1;for(var s,o,a;i-- >0;)if(s=r[i],s===KC&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!HC(e,s)||!n.equals(t[s],e[s],s,s,t,e,n)||(o=VC(t,s),a=VC(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Sz(t,e){return ha(t.valueOf(),e.valueOf())}function $z(t,e){return t.source===e.source&&t.flags===e.flags}function JC(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),s,o;(s=i.next())&&!s.done;){for(var a=e.values(),c=!1,u=0;(o=a.next())&&!o.done;)!c&&!r[u]&&(c=n.equals(s.value,o.value,s.value,o.value,t,e,n))&&(r[u]=!0),u++;if(!c)return!1}return!0}function kz(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var Cz="[object Arguments]",_z="[object Boolean]",Az="[object Date]",Iz="[object Map]",xz="[object Number]",Pz="[object Object]",Nz="[object RegExp]",Oz="[object Set]",Fz="[object String]",Lz=Array.isArray,ZC=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,QC=Object.assign,Mz=Object.prototype.toString.call.bind(Object.prototype.toString);function Bz(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,s=t.arePrimitiveWrappersEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,c=t.areTypedArraysEqual;return function(l,d,f){if(l===d)return!0;if(l==null||d==null||typeof l!="object"||typeof d!="object")return l!==l&&d!==d;var h=l.constructor;if(h!==d.constructor)return!1;if(h===Object)return i(l,d,f);if(Lz(l))return e(l,d,f);if(ZC!=null&&ZC(l))return c(l,d,f);if(h===Date)return n(l,d,f);if(h===RegExp)return o(l,d,f);if(h===Map)return r(l,d,f);if(h===Set)return a(l,d,f);var p=Mz(l);return p===Az?n(l,d,f):p===Nz?o(l,d,f):p===Iz?r(l,d,f):p===Oz?a(l,d,f):p===Pz?typeof l.then!="function"&&typeof d.then!="function"&&i(l,d,f):p===Cz?i(l,d,f):p===_z||p===xz||p===Fz?s(l,d,f):!1}}function jz(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?vu:Ez,areDatesEqual:Tz,areMapsEqual:r?GC(XC,vu):XC,areObjectsEqual:r?vu:Rz,arePrimitiveWrappersEqual:Sz,areRegExpsEqual:$z,areSetsEqual:r?GC(JC,vu):JC,areTypedArraysEqual:r?vu:kz};if(n&&(i=QC({},i,n(i))),e){var s=Eh(i.areArraysEqual),o=Eh(i.areMapsEqual),a=Eh(i.areObjectsEqual),c=Eh(i.areSetsEqual);i=QC({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:c})}return i}function Uz(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function qz(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,s=t.strict;if(r)return function(c,u){var l=r(),d=l.cache,f=d===void 0?e?new WeakMap:void 0:d,h=l.meta;return n(c,u,{cache:f,equals:i,meta:h,strict:s})};if(e)return function(c,u){return n(c,u,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var o={cache:void 0,equals:i,meta:void 0,strict:s};return function(c,u){return n(c,u,o)}}var e_=rs();rs({strict:!0}),rs({circular:!0}),rs({circular:!0,strict:!0}),rs({createInternalComparator:function(){return ha}}),rs({strict:!0,createInternalComparator:function(){return ha}}),rs({circular:!0,createInternalComparator:function(){return ha}}),rs({circular:!0,createInternalComparator:function(){return ha},strict:!0});function rs(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,s=t.strict,o=s===void 0?!1:s,a=jz(t),c=Bz(a),u=r?r(c):Uz(c);return qz({circular:n,comparator:c,createState:i,equals:u,strict:o})}var Wz="\0",Zs="\0",t_="";let Gz=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=Object.hasOwn(e,"directed")?e.directed:!0,this._isMultigraph=Object.hasOwn(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.hasOwn(e,"compound")?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Zs]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!="function"&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(n=>Object.keys(e._in[n]).length===0)}sinks(){var e=this;return this.nodes().filter(n=>Object.keys(e._out[n]).length===0)}setNodes(e,n){var r=arguments,i=this;return e.forEach(function(s){r.length>1?i.setNode(s,n):i.setNode(s)}),this}setNode(e,n){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=n),this):(this._nodes[e]=arguments.length>1?n:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=Zs,this._children[e]={},this._children[Zs][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var n=this;if(Object.hasOwn(this._nodes,e)){var r=i=>n.removeEdge(n._edgeObjs[i]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(i){n.setParent(i)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Zs;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===e)throw new Error("Setting "+n+" as parent of "+e+" would create a cycle");this.setNode(n)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=n,this._children[n][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var n=this._parent[e];if(n!==Zs)return n}}children(e=Zs){if(this._isCompound){var n=this._children[e];if(n)return Object.keys(n)}else{if(e===Zs)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var n=this._preds[e];if(n)return Object.keys(n)}successors(e){var n=this._sucs[e];if(n)return Object.keys(n)}neighbors(e){var n=this.predecessors(e);if(n){const i=new Set(n);for(var r of this.successors(e))i.add(r);return Array.from(i.values())}}isLeaf(e){var n;return this.isDirected()?n=this.successors(e):n=this.neighbors(e),n.length===0}filterNodes(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([o,a]){e(o)&&n.setNode(o,a)}),Object.values(this._edgeObjs).forEach(function(o){n.hasNode(o.v)&&n.hasNode(o.w)&&n.setEdge(o,r.edge(o))});var i={};function s(o){var a=r.parent(o);return a===void 0||n.hasNode(a)?(i[o]=a,a):a in i?i[a]:s(a)}return this._isCompound&&n.nodes().forEach(o=>n.setParent(o,s(o))),n}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!="function"&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,n){var r=this,i=arguments;return e.reduce(function(s,o){return i.length>1?r.setEdge(s,o,n):r.setEdge(s,o),o}),this}setEdge(){var e,n,r,i,s=!1,o=arguments[0];typeof o=="object"&&o!==null&&"v"in o?(e=o.v,n=o.w,r=o.name,arguments.length===2&&(i=arguments[1],s=!0)):(e=o,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),e=""+e,n=""+n,r!==void 0&&(r=""+r);var a=wu(this._isDirected,e,n,r);if(Object.hasOwn(this._edgeLabels,a))return s&&(this._edgeLabels[a]=i),this;if(r!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[a]=s?i:this._defaultEdgeLabelFn(e,n,r);var c=zz(this._isDirected,e,n,r);return e=c.v,n=c.w,Object.freeze(c),this._edgeObjs[a]=c,n_(this._preds[n],e),n_(this._sucs[e],n),this._in[n][a]=c,this._out[e][a]=c,this._edgeCount++,this}edge(e,n,r){var i=arguments.length===1?Bv(this._isDirected,arguments[0]):wu(this._isDirected,e,n,r);return this._edgeLabels[i]}edgeAsObj(){const e=this.edge(...arguments);return typeof e!="object"?{label:e}:e}hasEdge(e,n,r){var i=arguments.length===1?Bv(this._isDirected,arguments[0]):wu(this._isDirected,e,n,r);return Object.hasOwn(this._edgeLabels,i)}removeEdge(e,n,r){var i=arguments.length===1?Bv(this._isDirected,arguments[0]):wu(this._isDirected,e,n,r),s=this._edgeObjs[i];return s&&(e=s.v,n=s.w,delete this._edgeLabels[i],delete this._edgeObjs[i],r_(this._preds[n],e),r_(this._sucs[e],n),delete this._in[n][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,n){var r=this._in[e];if(r){var i=Object.values(r);return n?i.filter(s=>s.v===n):i}}outEdges(e,n){var r=this._out[e];if(r){var i=Object.values(r);return n?i.filter(s=>s.w===n):i}}nodeEdges(e,n){var r=this.inEdges(e,n);if(r)return r.concat(this.outEdges(e,n))}};function n_(t,e){t[e]?t[e]++:t[e]=1}function r_(t,e){--t[e]||delete t[e]}function wu(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}return i+t_+s+t_+(r===void 0?Wz:r)}function zz(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}var a={v:i,w:s};return r&&(a.name=r),a}function Bv(t,e){return wu(t,e.v,e.w,e.name)}var jv=Gz,Hz="2.2.4",Kz={Graph:jv,version:Hz},Vz=jv,Yz={write:Xz,read:Qz};function Xz(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:Jz(t),edges:Zz(t)};return t.graph()!==void 0&&(e.value=structuredClone(t.graph())),e}function Jz(t){return t.nodes().map(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function Zz(t){return t.edges().map(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return e.name!==void 0&&(r.name=e.name),n!==void 0&&(r.value=n),r})}function Qz(t){var e=new Vz(t.options).setGraph(t.value);return t.nodes.forEach(function(n){e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(function(n){e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}var eH=tH;function tH(t){var e={},n=[],r;function i(s){Object.hasOwn(e,s)||(e[s]=!0,r.push(s),t.successors(s).forEach(i),t.predecessors(s).forEach(i))}return t.nodes().forEach(function(s){r=[],i(s),r.length&&n.push(r)}),n}let nH=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var n=this._keyIndices[e];if(n!==void 0)return this._arr[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,n){var r=this._keyIndices;if(e=String(e),!Object.hasOwn(r,e)){var i=this._arr,s=i.length;return r[e]=s,i.push({key:e,priority:n}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,n){var r=this._keyIndices[e];if(n>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+n);this._arr[r].priority=n,this._decrease(r)}_heapify(e){var n=this._arr,r=2*e,i=r+1,s=e;r<n.length&&(s=n[r].priority<n[s].priority?r:s,i<n.length&&(s=n[i].priority<n[s].priority?i:s),s!==e&&(this._swap(e,s),this._heapify(s)))}_decrease(e){for(var n=this._arr,r=n[e].priority,i;e!==0&&(i=e>>1,!(n[i].priority<r));)this._swap(e,i),e=i}_swap(e,n){var r=this._arr,i=this._keyIndices,s=r[e],o=r[n];r[e]=o,r[n]=s,i[o.key]=e,i[s.key]=n}};var i_=nH,rH=i_,s_=sH,iH=()=>1;function sH(t,e,n,r){return oH(t,String(e),n||iH,r||function(i){return t.outEdges(i)})}function oH(t,e,n,r){var i={},s=new rH,o,a,c=function(u){var l=u.v!==o?u.v:u.w,d=i[l],f=n(u),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h<d.distance&&(d.distance=h,d.predecessor=o,s.decrease(l,h))};for(t.nodes().forEach(function(u){var l=u===e?0:Number.POSITIVE_INFINITY;i[u]={distance:l},s.add(u,l)});s.size()>0&&(o=s.removeMin(),a=i[o],a.distance!==Number.POSITIVE_INFINITY);)r(o).forEach(c);return i}var aH=s_,cH=uH;function uH(t,e,n){return t.nodes().reduce(function(r,i){return r[i]=aH(t,i,e,n),r},{})}var o_=lH;function lH(t){var e=0,n=[],r={},i=[];function s(o){var a=r[o]={onStack:!0,lowlink:e,index:e++};if(n.push(o),t.successors(o).forEach(function(l){Object.hasOwn(r,l)?r[l].onStack&&(a.lowlink=Math.min(a.lowlink,r[l].index)):(s(l),a.lowlink=Math.min(a.lowlink,r[l].lowlink))}),a.lowlink===a.index){var c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(o!==u);i.push(c)}}return t.nodes().forEach(function(o){Object.hasOwn(r,o)||s(o)}),i}var dH=o_,fH=hH;function hH(t){return dH(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}var pH=mH,gH=()=>1;function mH(t,e,n){return yH(t,e||gH,n||function(r){return t.outEdges(r)})}function yH(t,e,n){var r={},i=t.nodes();return i.forEach(function(s){r[s]={},r[s][s]={distance:0},i.forEach(function(o){s!==o&&(r[s][o]={distance:Number.POSITIVE_INFINITY})}),n(s).forEach(function(o){var a=o.v===s?o.w:o.v,c=e(o);r[s][a]={distance:c,predecessor:s}})}),i.forEach(function(s){var o=r[s];i.forEach(function(a){var c=r[a];i.forEach(function(u){var l=c[s],d=o[u],f=c[u],h=l.distance+d.distance;h<f.distance&&(f.distance=h,f.predecessor=d.predecessor)})})}),r}function a_(t){var e={},n={},r=[];function i(s){if(Object.hasOwn(n,s))throw new Uv;Object.hasOwn(e,s)||(n[s]=!0,e[s]=!0,t.predecessors(s).forEach(i),delete n[s],r.push(s))}if(t.sinks().forEach(i),Object.keys(e).length!==t.nodeCount())throw new Uv;return r}class Uv extends Error{constructor(){super(...arguments)}}var c_=a_;a_.CycleException=Uv;var u_=c_,vH=wH;function wH(t){try{u_(t)}catch(e){if(e instanceof u_.CycleException)return!1;throw e}return!0}var l_=bH;function bH(t,e,n){Array.isArray(e)||(e=[e]);var r=t.isDirected()?a=>t.successors(a):a=>t.neighbors(a),i=n==="post"?DH:EH,s=[],o={};return e.forEach(a=>{if(!t.hasNode(a))throw new Error("Graph does not have node: "+a);i(a,r,o,s)}),s}function DH(t,e,n,r){for(var i=[[t,!1]];i.length>0;){var s=i.pop();s[1]?r.push(s[0]):Object.hasOwn(n,s[0])||(n[s[0]]=!0,i.push([s[0],!0]),d_(e(s[0]),o=>i.push([o,!1])))}}function EH(t,e,n,r){for(var i=[t];i.length>0;){var s=i.pop();Object.hasOwn(n,s)||(n[s]=!0,r.push(s),d_(e(s),o=>i.push(o)))}}function d_(t,e){for(var n=t.length;n--;)e(t[n],n,t);return t}var TH=l_,RH=SH;function SH(t,e){return TH(t,e,"post")}var $H=l_,kH=CH;function CH(t,e){return $H(t,e,"pre")}var _H=jv,AH=i_,IH=xH;function xH(t,e){var n=new _H,r={},i=new AH,s;function o(c){var u=c.v===s?c.w:c.v,l=i.priority(u);if(l!==void 0){var d=e(c);d<l&&(r[u]=s,i.decrease(u,d))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(c){i.add(c,Number.POSITIVE_INFINITY),n.setNode(c)}),i.decrease(t.nodes()[0],0);for(var a=!1;i.size()>0;){if(s=i.removeMin(),Object.hasOwn(r,s))n.setEdge(s,r[s]);else{if(a)throw new Error("Input graph is not connected: "+t);a=!0}t.nodeEdges(s).forEach(o)}return n}var PH={components:eH,dijkstra:s_,dijkstraAll:cH,findCycles:fH,floydWarshall:pH,isAcyclic:vH,postorder:RH,preorder:kH,prim:IH,tarjan:o_,topsort:c_},f_=Kz,bu={Graph:f_.Graph,json:Yz,alg:PH,version:f_.version},qv={exports:{}};(function(t,e){var n=u$;e=t.exports=r;function r(d,f){return f=o(d,f),c(d,f)}e.sha1=function(d){return r(d)},e.keys=function(d){return r(d,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},e.MD5=function(d){return r(d,{algorithm:"md5",encoding:"hex"})},e.keysMD5=function(d){return r(d,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var i=n.getHashes?n.getHashes().slice():["sha1","md5"];i.push("passthrough");var s=["buffer","hex","binary","base64"];function o(d,f){f=f||{};var h={};if(h.algorithm=f.algorithm||"sha1",h.encoding=f.encoding||"hex",h.excludeValues=!!f.excludeValues,h.algorithm=h.algorithm.toLowerCase(),h.encoding=h.encoding.toLowerCase(),h.ignoreUnknown=f.ignoreUnknown===!0,h.respectType=f.respectType!==!1,h.respectFunctionNames=f.respectFunctionNames!==!1,h.respectFunctionProperties=f.respectFunctionProperties!==!1,h.unorderedArrays=f.unorderedArrays===!0,h.unorderedSets=f.unorderedSets!==!1,h.unorderedObjects=f.unorderedObjects!==!1,h.replacer=f.replacer||void 0,h.excludeKeys=f.excludeKeys||void 0,typeof d>"u")throw new Error("Object argument required.");for(var p=0;p<i.length;++p)i[p].toLowerCase()===h.algorithm.toLowerCase()&&(h.algorithm=i[p]);if(i.indexOf(h.algorithm)===-1)throw new Error('Algorithm "'+h.algorithm+'" not supported. supported values: '+i.join(", "));if(s.indexOf(h.encoding)===-1&&h.algorithm!=="passthrough")throw new Error('Encoding "'+h.encoding+'" not supported. supported values: '+s.join(", "));return h}function a(d){if(typeof d!="function")return!1;var f=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return f.exec(Function.prototype.toString.call(d))!=null}function c(d,f){var h;f.algorithm!=="passthrough"?h=n.createHash(f.algorithm):h=new l,typeof h.write>"u"&&(h.write=h.update,h.end=h.update);var p=u(f,h);if(p.dispatch(d),h.update||h.end(""),h.digest)return h.digest(f.encoding==="buffer"?void 0:f.encoding);var y=h.read();return f.encoding==="buffer"?y:y.toString(f.encoding)}e.writeToStream=function(d,f,h){return typeof h>"u"&&(h=f,f={}),f=o(d,f),u(f,h).dispatch(d)};function u(d,f,h){h=h||[];var p=function(y){return f.update?f.update(y,"utf8"):f.write(y,"utf8")};return{dispatch:function(y){d.replacer&&(y=d.replacer(y));var T=typeof y;return y===null&&(T="null"),this["_"+T](y)},_object:function(y){var T=/\[object (.*)\]/i,b=Object.prototype.toString.call(y),v=T.exec(b);v?v=v[1]:v="unknown:["+b+"]",v=v.toLowerCase();var D=null;if((D=h.indexOf(y))>=0)return this.dispatch("[CIRCULAR:"+D+"]");if(h.push(y),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(y))return p("buffer:"),p(y);if(v!=="object"&&v!=="function"&&v!=="asyncfunction")if(this["_"+v])this["_"+v](y);else{if(d.ignoreUnknown)return p("["+v+"]");throw new Error('Unknown object type "'+v+'"')}else{var k=Object.keys(y);d.unorderedObjects&&(k=k.sort()),d.respectType!==!1&&!a(y)&&k.splice(0,0,"prototype","__proto__","constructor"),d.excludeKeys&&(k=k.filter(function(M){return!d.excludeKeys(M)})),p("object:"+k.length+":");var P=this;return k.forEach(function(M){P.dispatch(M),p(":"),d.excludeValues||P.dispatch(y[M]),p(",")})}},_array:function(y,T){T=typeof T<"u"?T:d.unorderedArrays!==!1;var b=this;if(p("array:"+y.length+":"),!T||y.length<=1)return y.forEach(function(k){return b.dispatch(k)});var v=[],D=y.map(function(k){var P=new l,M=h.slice(),I=u(d,P,M);return I.dispatch(k),v=v.concat(M.slice(h.length)),P.read().toString()});return h=h.concat(v),D.sort(),this._array(D,!1)},_date:function(y){return p("date:"+y.toJSON())},_symbol:function(y){return p("symbol:"+y.toString())},_error:function(y){return p("error:"+y.toString())},_boolean:function(y){return p("bool:"+y.toString())},_string:function(y){p("string:"+y.length+":"),p(y.toString())},_function:function(y){p("fn:"),a(y)?this.dispatch("[native]"):this.dispatch(y.toString()),d.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(y.name)),d.respectFunctionProperties&&this._object(y)},_number:function(y){return p("number:"+y.toString())},_xml:function(y){return p("xml:"+y.toString())},_null:function(){return p("Null")},_undefined:function(){return p("Undefined")},_regexp:function(y){return p("regex:"+y.toString())},_uint8array:function(y){return p("uint8array:"),this.dispatch(Array.prototype.slice.call(y))},_uint8clampedarray:function(y){return p("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(y))},_int8array:function(y){return p("int8array:"),this.dispatch(Array.prototype.slice.call(y))},_uint16array:function(y){return p("uint16array:"),this.dispatch(Array.prototype.slice.call(y))},_int16array:function(y){return p("int16array:"),this.dispatch(Array.prototype.slice.call(y))},_uint32array:function(y){return p("uint32array:"),this.dispatch(Array.prototype.slice.call(y))},_int32array:function(y){return p("int32array:"),this.dispatch(Array.prototype.slice.call(y))},_float32array:function(y){return p("float32array:"),this.dispatch(Array.prototype.slice.call(y))},_float64array:function(y){return p("float64array:"),this.dispatch(Array.prototype.slice.call(y))},_arraybuffer:function(y){return p("arraybuffer:"),this.dispatch(new Uint8Array(y))},_url:function(y){return p("url:"+y.toString())},_map:function(y){p("map:");var T=Array.from(y);return this._array(T,d.unorderedSets!==!1)},_set:function(y){p("set:");var T=Array.from(y);return this._array(T,d.unorderedSets!==!1)},_file:function(y){return p("file:"),this.dispatch([y.name,y.size,y.type,y.lastModfied])},_blob:function(){if(d.ignoreUnknown)return p("[blob]");throw Error(`Hashing Blob objects is currently not supported
1134
- (see https://github.com/puleos/object-hash/issues/26)
1135
- Use "options.replacer" or "options.ignoreUnknown"
1136
- `)},_domwindow:function(){return p("domwindow")},_bigint:function(y){return p("bigint:"+y.toString())},_process:function(){return p("process")},_timer:function(){return p("timer")},_pipe:function(){return p("pipe")},_tcp:function(){return p("tcp")},_udp:function(){return p("udp")},_tty:function(){return p("tty")},_statwatcher:function(){return p("statwatcher")},_securecontext:function(){return p("securecontext")},_connection:function(){return p("connection")},_zlib:function(){return p("zlib")},_context:function(){return p("context")},_nodescript:function(){return p("nodescript")},_httpparser:function(){return p("httpparser")},_dataview:function(){return p("dataview")},_signal:function(){return p("signal")},_fsevent:function(){return p("fsevent")},_tlswrap:function(){return p("tlswrap")}}}function l(){return{buf:"",write:function(d){this.buf+=d},end:function(d){this.buf+=d},read:function(){return this.buf}}}})(qv,qv.exports);var NH=qv.exports;function h_(t){const e={id:t.id,__:t.__??"element",autoLayout:t.autoLayout,nodes:ze(t.nodes,ct(L1(["id","title","description","technology","shape","icon","children"])),di(({id:n,icon:r,...i})=>[n,{...i,icon:Z(r)?"Y":"N"}])),edges:ze(t.edges,ct(L1(["source","target","label","description","technology","dir","head","tail","line"])),di(({source:n,target:r,...i})=>[`${n}:${r}`,i]))};return t.hash=NH(e,{ignoreUnknown:!0,respectType:!1}),t}function wn(t){if(ie.isElementWhere(t)){const e=wn(t.where.expr),n=Do(t.where.condition);return r=>e(r)&&n(r)}if(ie.isWildcard(t))return()=>!0;if(ie.isElementKindExpr(t))return t.isEqual?e=>e.kind===t.elementKind:e=>e.kind!==t.elementKind;if(ie.isElementTagExpr(t))return t.isEqual?({tags:e})=>!!e&&e.includes(t.elementTag):({tags:e})=>$t(e)||!e.includes(t.elementTag);if(ie.isExpandedElementExpr(t))return e=>e.id===t.expanded||Tt(e.id)===t.expanded;if(ie.isElementRef(t)){const{element:e,isDescedants:n}=t;return n?r=>r.id.startsWith(e+"."):r=>r.id===e}if(ie.isCustomElement(t))return wn(t.custom.expr);$e(t)}function p_(t,e){const n=t.flatMap(i=>"include"in i?i.include.filter(ie.isCustomElement):[]);if(n.length===0)return e;const r=[...e];for(const{custom:{expr:i,...s}}of n){const{border:o,opacity:a,...c}=F1(s,$t),u=!Hi(c),l=wn(i);r.forEach((d,f)=>{if(!l(d))return;u&&(d={...d,isCustomized:!0,...c});let h;o!==void 0&&(h={border:o}),a!==void 0&&(h={...h,opacity:a}),h&&(d={...d,isCustomized:!0,style:{...d.style,...h}}),r[f]=d})}return r}function g_(t){switch(!0){case ie.isRelationWhere(t):return g_(t.where.expr);case ie.isRelation(t):{const e=wn(t.source),n=wn(t.target);return r=>e(r.source)&&n(r.target)||!!t.isBidirectional&&e(r.target)&&n(r.source)}case ie.isInOut(t):{const e=wn(t.inout);return n=>e(n.source)||e(n.target)}case ie.isIncoming(t):{const e=wn(t.incoming);return n=>e(n.target)}case ie.isOutgoing(t):{const e=wn(t.outgoing);return n=>e(n.source)}default:$e(t)}}function OH(t,e,n){const r=t.flatMap(s=>"include"in s?s.include.filter(ie.isCustomRelationExpr):[]),i=Array.from(n);if(r.length===0||i.length===0)return i;for(const{customRelation:{relation:s,title:o,...a}}of r){const c=F1(a,$t),u=g_(s);i.forEach((l,d)=>{const f=e.find(p=>p.id===l.source),h=e.find(p=>p.id===l.target);!f||!h||u({source:f,target:h})&&(i[d]={...l,label:o??l.label,isCustomized:!0,...c})})}return i}function m_(t,e){const n=t.filter(r2);if(n.length===0)return e;for(const r of n){const i=[];for(const s of r.targets){if(ie.isWildcard(s)){i.push(()=>!0);break}i.push(wn(s))}Ve(e,a7(i)).forEach(s=>{s.shape=r.style.shape??s.shape,s.color=r.style.color??s.color,It(r.style.icon)&&(s.icon=r.style.icon),It(r.notation)&&(s.notation=r.notation);let o;It(r.style.border)&&(o={border:r.style.border}),It(r.style.opacity)&&(o={...o,opacity:r.style.opacity}),o&&(s.style={...s.style,...o})})}return e}function FH(t,e){let n;for(;t.parent&&(n=e.get(t.parent));){const r=n.depth??1;if(n.depth=Math.max(r,(t.depth??0)+1),n.depth===r)break;t=n}}function y_(t){return Array.from(t).sort(qg).reduce((e,{id:n,color:r,shape:i,style:s,...o})=>{let a=Tt(n),c=0;for(;a;){const l=e.get(a);if(l){l.children.length==0&&(l.depth=1,FH(l,e)),l.children.push(n),c=l.level+1;break}a=Tt(a)}const u={...o,id:n,parent:a,level:c,color:r??Yl,shape:i??pb,children:[],inEdges:[],outEdges:[],style:{...s}};return e.set(n,u),e},new Map)}function v_(t){return ze(t,Lf(xr("notation")),Gi(Qy(Lf(xr("shape")),Gi(Qy(Lf(xr("color")),Gi(Qy(ct(xr("kind")),Ar())),Qo(),ct(([e,n])=>({kinds:n,color:e})))),Qo(),Ki(([e,n])=>n.map(({color:r,kinds:i})=>({shape:e,color:r,kinds:i}))))),Qo(),Ki(([e,n])=>n.map(({shape:r,color:i,kinds:s})=>({title:e,shape:r,color:i,kinds:s}))),RU(xr("shape"),xr("title"),[e=>e.kinds.length,"desc"]))}const w_=bu.alg.postorder,LH=bu.alg.findCycles,MH=bu.alg.isAcyclic;function BH(t){t.forEach(e=>{e.children.length>0&&(e.children=t.flatMap(n=>n.parent===e.id?n.id:[]))})}function jH({nodes:t,edges:e}){if(e.length===0)return t;const n=new bu.Graph({compound:!1,directed:!0,multigraph:!1}),r=a=>Xe(t.find(c=>c.id===a),"Edge not found"),i=a=>Xe(e.find(c=>c.id===a),"Edge not found");for(const a of[...e].sort(Ha))n.setEdge(a.source,a.target);for(const a of t)n.setNode(a.id),a.children.length>0&&a.inEdges.forEach(c=>{const u=i(c);u.target!==a.id&&r(u.source).children.length===0&&n.setEdge(u.source,a.id)}),a.parent&&n.setEdge(a.parent,a.id);let s=n.sources();s.length===0&&(s=ze(t,nu(qg),Ve(a=>a.inEdges.length===0||a.parent===null),ct(a=>a.id)));const o=w_(n,s).reverse().map(r);if(o.length<t.length){const a=i7(t,o);o.push(...a)}return ce(o.length===t.length,"Not all nodes were processed by graphlib"),BH(o),o}function UH(t){const e=ze(t,Ki(n=>n.tags??[]),Ar(),nu(ad));return Ug(e,1)?e:null}const cr=()=>!0,Wv=t=>t,Gv=t=>t===cr?Wv:Ve(t),qH=t=>t===cr?Wv:e=>t(e)?e:null;function WH(t,e=cr){const n=[...this.resolvedElements],r=Gv(e)(t.isDescedants===!0?this.graph.childrenOrElement(t.element):[this.graph.element(t.element)]);if(r.length!==0&&(this.addElement(...r),r.length>1&&this.addEdges(this.graph.edgesWithin(r)),n.length>0&&r.length>0))for(const i of r)this.addEdges(this.graph.anyEdgesBetween(i,n))}function GH(t,e=cr){const n=[...this.resolvedElements].filter(W1([wn(t),e]));this.excludeElement(...n)}function zH(t,e=cr){const n=this.root;if(!n){const u=this.graph.rootElements.filter(e);if(u.length<=0)return;const l=[...this.resolvedElements];if(this.addElement(...u),this.addEdges(this.graph.edgesWithin(u)),l.length>0)for(const d of u)this.addEdges(this.graph.anyEdgesBetween(d,l));return}const r=[...this.resolvedElements],i=qH(e)(this.graph.element(n));i&&this.addElement(i);const s=Gv(e),o=s(this.graph.children(n)),a=o.length>0;a?(this.addElement(...o),this.addEdges(this.graph.edgesWithin(o))):i&&o.push(i);const c=[...r,...s([...this.graph.siblings(n),...this.graph.ancestors(n).flatMap(u=>this.graph.siblings(u.id))])];for(const u of o)this.addEdges(this.graph.anyEdgesBetween(u,c));if(!a&&i&&this.graph.anyEdgesBetween(i,this.graph.siblings(n)).length===0){const u=Tt(n),l=u&&this.graph.element(u);l&&e(l)&&this.addElement(l)}}function HH(t,e=cr){if(e!==cr){const r=[...this.resolvedElements].filter(e);this.excludeElement(...r);return}const n=this.root;n?(this.excludeElement(this.graph.element(n),...this.graph.children(n)),this.excludeRelation(...this.graph.connectedRelations(n))):this.reset()}function KH(t,e=cr){const n=Gv(e),r=[...this.resolvedElements],i=this.graph.element(t.expanded);if(e(i)){this.addElement(i);const o=this.graph.anyEdgesBetween(i,r);this.addEdges(o)}const s=[];for(const o of n(this.graph.children(t.expanded))){this.addImplicit(o);const a=this.graph.anyEdgesBetween(o,r);a.length>0&&(this.addEdges(a),s.push(o))}s.length>1&&this.addEdges(this.graph.edgesWithin(s))}function VH(t,e=cr){const n=[...this.resolvedElements].filter(W1([wn(t),e]));this.excludeElement(...n)}const b_=t=>t.isEqual?ie.isElementKindExpr(t)?e=>e.kind===t.elementKind:({tags:e})=>!!e&&e.includes(t.elementTag):ie.isElementKindExpr(t)?e=>e.kind!==t.elementKind:({tags:e})=>$t(e)||e.length===0||!e.includes(t.elementTag);function YH(t,e=cr){const n=this.graph.elements.filter(b_(t)).filter(e);if(n.length>0){const r=[...this.resolvedElements];this.addElement(...n),this.addEdges(this.graph.edgesWithin(n));for(const i of n)this.addEdges(this.graph.anyEdgesBetween(i,r))}}function XH(t,e=cr){const n=[...this.resolvedElements].filter(b_(t)).filter(e);n.length>0&&this.excludeElement(...n)}function Du(t){return ie.isElementRef(t)?this.graph.ascendingSiblings(t.element):this.root?this.graph.ascendingSiblings(this.root):this.graph.rootElements}function Th(t){return ie.isWildcard(t)?this.root?[...this.graph.children(this.root),this.graph.element(this.root)]:this.graph.rootElements:ie.isElementKindExpr(t)?this.graph.elements.filter(e=>t.isEqual?e.kind===t.elementKind:e.kind!==t.elementKind):ie.isElementTagExpr(t)?this.graph.elements.filter(e=>{const n=e.tags;return t.isEqual?!!n&&n.includes(t.elementTag):$t(n)||n.length===0||!n.includes(t.elementTag)}):ie.isExpandedElementExpr(t)?[this.graph.element(t.expanded)]:ie.isElementRef(t)?this.root===t.element&&t.isDescedants!==!0?[...this.graph.children(this.root),this.graph.element(this.root)]:t.isDescedants?this.graph.childrenOrElement(t.element):[this.graph.element(t.element)]:$e(t)}function D_(t){if(ie.isWildcard(t)){if(!this.root)return[];const r=this.graph.ascendingSiblings(this.root),i=[...this.graph.children(this.root),this.graph.element(this.root)];return this.graph.edgesBetween(r,i)}const e=Th.call(this,t);if(e.length===0)return[];let n=[...this.resolvedElements];if(ie.isElementRef(t)||ie.isExpandedElementExpr(t)){const r=t.element??t.expanded,i=t.isDescedants??!1;n=n.filter(s=>!yr(r,s.id)||i&&Tt(s.id)===r)}return n.length===0&&(n=Du.call(this,t)),this.graph.edgesBetween(n,e)}const Eu=(t,e)=>e?ze(t,ct(n=>({...n,relations:n.relations.filter(e)})),Ve(n=>n.relations.length>0)):t,zv=(t,e)=>ze(t,Ki(n=>n.relations),e?Ve(e):Wv,Ar());function JH(t,e){const n=Eu(D_.call(this,t.incoming),e);n.length!==0&&(this.addEdges(n),this.addImplicit(...n.map(r=>r.target)))}function ZH(t,e){let n=zv(D_.call(this,t.incoming),e);this.excludeRelation(...n)}function E_(t){if(ie.isWildcard(t)){if(!this.root)return[];const r=this.graph.ascendingSiblings(this.root),i=[...this.graph.children(this.root),this.graph.element(this.root)];return this.graph.edgesBetween(i,r)}const e=Th.call(this,t);if(e.length===0)return[];let n=[...this.resolvedElements];if(ie.isElementRef(t)||ie.isExpandedElementExpr(t)){const r=t.element??t.expanded,i=t.isDescedants??!1;n=n.filter(s=>!yr(r,s.id)||i&&Tt(s.id)===r)}return n.length===0&&(n=Du.call(this,t)),this.graph.edgesBetween(e,n)}function QH(t,e){const n=Eu(E_.call(this,t.outgoing),e);n.length!==0&&(this.addEdges(n),this.addImplicit(...n.map(r=>r.source)))}function eK(t,e){const n=zv(E_.call(this,t.outgoing),e);this.excludeRelation(...n)}var Rh;(t=>{t.Empty={implicits:[],edges:[]}})(Rh||(Rh={}));function T_({inout:t},e){if(ie.isWildcard(t)){if(!this.root)return Rh.Empty;const i=this.graph.ascendingSiblings(this.root);return{edges:Eu(this.graph.anyEdgesBetween(this.graph.element(this.root),i),e),implicits:[]}}const n=Th.call(this,t);if(n.length===0)return Rh.Empty;let r=[...this.resolvedElements];if(ie.isElementRef(t)||ie.isExpandedElementExpr(t)){const i=t.element??t.expanded,s=t.isDescedants??!1;r=r.filter(o=>!yr(i,o.id)||s&&Tt(o.id)===i)}return r.length===0&&(r=Du.call(this,t)),n.reduce((i,s)=>{const o=Eu(this.graph.anyEdgesBetween(s,r),e);return o.length>0&&(i.implicits.push(s),i.edges.push(...o)),i},{implicits:[],edges:[]})}function tK(t,e){const{implicits:n,edges:r}=T_.call(this,t,e);this.addEdges(r),this.addImplicit(...n)}function nK(t,e){const{edges:n}=T_.call(this,t,e);this.excludeRelation(...n.flatMap(r=>r.relations))}function Sh(t){return ie.isElementRef(t)&&this.root===t.element&&t.isDescedants!==!0?[...this.graph.children(t.element),this.graph.element(t.element)]:ie.isExpandedElementExpr(t)&&this.root===t.expanded?[...this.graph.children(t.expanded),this.graph.element(t.expanded)]:Th.call(this,t)}function rK(t,e){let n,r;ie.isWildcard(t.source)&&!ie.isWildcard(t.target)?(n=Du.call(this,t.target),r=Sh.call(this,t.target)):!ie.isWildcard(t.source)&&ie.isWildcard(t.target)?(n=Sh.call(this,t.source),r=Du.call(this,t.source)):(n=Sh.call(this,t.source),r=Sh.call(this,t.target));const i=this.graph.edgesBetween(n,r);t.isBidirectional===!0&&i.push(...this.graph.edgesBetween(r,n)),this.addEdges(Eu(i,e))}function iK(t,e){const n=wn(t.source),r=wn(t.target),i=a=>{let c=n(a.source)&&r(a.target);return!c&&t.isBidirectional&&(c=n(a.target)&&r(a.source)),c},s=this.edges.filter(i),o=zv(s,e);this.excludeRelation(...o)}function sK(t,e){return Ha({source:t.source.id,target:t.target.id},{source:e.source.id,target:e.target.id})}let oK=class iN{constructor(e,n){this.view=e,this.graph=n}explicits=new Set;implicits=new Set;ctxEdges=[];static elementView(e,n){return new iN(e,n).compute()}compute(){this.reset();const{docUri:e,rules:n,...r}=this.view,i=n.filter(n2);this.root&&i.length==0&&this.addElement(this.graph.element(this.root)),this.processPredicates(i),this.removeRedundantImplicitEdges();const s=[...this.includedElements],o=y_(s),a=new Map,c=this.computeEdges();for(const p of c){a.set(p.id,p);const y=o.get(p.source),T=o.get(p.target);for(ce(y,`Source node ${p.source} not found`),ce(T,`Target node ${p.target} not found`);p.parent&&!o.has(p.parent);)p.parent=Tt(p.parent);y.outEdges.push(p.id),T.inEdges.push(p.id);for(const b of Zn(p.source)){if(b===p.parent)break;o.get(b)?.outEdges.push(p.id)}for(const b of Zn(p.target)){if(b===p.parent)break;o.get(b)?.inEdges.push(p.id)}}const u=s.flatMap(p=>o.get(p.id)??[]),l=p_(n,m_(n,jH({nodes:u,edges:c}))),d=new Set([...l.flatMap(p=>p.children.length===0?p.outEdges.flatMap(y=>a.get(y)??[]):[]),...c]),f=this.view.rules.findLast(Cb),h=v_(l);return h_({...r,autoLayout:f?.autoLayout??"TB",nodes:ct(l,M1(["notation"])),edges:OH(n,l,d),...h.length>0&&{notation:{elements:h}}})}get root(){return Ab(this.view)?this.view.viewOf:null}computeEdges(){return this.ctxEdges.map(e=>{ce(Ir(e.relations,1),"Edge must have at least one relation");const n=nu(e.relations,Ha),r=e.source.id,i=e.target.id,s={id:`${r}:${i}`,parent:Os(r,i),source:r,target:i,label:null,relations:n.map(c=>c.id)};let o;if(o=gn(n)??ze(n,Ve(c=>c.source===r&&c.target===i),gn()),!o){const c=ze(n,N1((u,l)=>(Z(l.title)&&!u.title.includes(l.title)&&u.title.push(l.title),Z(l.description)&&!u.description.includes(l.description)&&u.description.push(l.description),Z(l.technology)&&!u.technology.includes(l.technology)&&u.technology.push(l.technology),Z(l.kind)&&!u.kind.includes(l.kind)&&u.kind.push(l.kind),Z(l.color)&&!u.color.includes(l.color)&&u.color.push(l.color),Z(l.line)&&!u.line.includes(l.line)&&u.line.push(l.line),Z(l.head)&&!u.head.includes(l.head)&&u.head.push(l.head),Z(l.tail)&&!u.tail.includes(l.tail)&&u.tail.push(l.tail),Z(l.navigateTo)&&!u.navigateTo.includes(l.navigateTo)&&u.navigateTo.push(l.navigateTo),u),{title:[],description:[],technology:[],kind:[],head:[],tail:[],color:[],line:[],navigateTo:[]}));o={title:gn(c.title)??"[...]",description:gn(c.description),technology:gn(c.technology),kind:gn(c.kind),head:gn(c.head),tail:gn(c.tail),color:gn(c.color),line:gn(c.line),navigateTo:gn(c.navigateTo)}}const a=UH(n);return Object.assign(s,this.getEdgeLabel(o),Z(o.description)&&{description:o.description},Z(o.technology)&&{technology:o.technology},Z(o.kind)&&{kind:o.kind},o.color&&{color:o.color},o.line&&{line:o.line},o.head&&{head:o.head},o.tail&&{tail:o.tail},o.navigateTo&&{navigateTo:o.navigateTo},a&&{tags:a})})}get includedElements(){return new Set([...this.explicits,...this.ctxEdges.flatMap(e=>[e.source,e.target])])}get resolvedElements(){return new Set([...this.explicits,...this.implicits,...this.ctxEdges.flatMap(e=>[e.source,e.target])])}get edges(){return this.ctxEdges}addEdges(e){for(const n of e){if(!Ir(n.relations,1))continue;const r=this.ctxEdges.find(i=>i.source.id===n.source.id&&i.target.id===n.target.id);if(r){r.relations=Ar([...r.relations,...n.relations]);continue}this.ctxEdges.push(n)}}addElement(...e){for(const n of e)this.explicits.add(n),this.implicits.add(n)}addImplicit(...e){for(const n of e)this.implicits.add(n)}excludeElement(...e){for(const n of e)this.ctxEdges=this.ctxEdges.filter(r=>r.source.id!==n.id&&r.target.id!==n.id),this.explicits.delete(n),this.implicits.delete(n)}excludeRelation(...e){if(e.length===0)return;const n=new Set,r=ze(this.ctxEdges,ct(s=>{const o=s.relations.filter(a=>!e.includes(a));return o.length===0?(n.add(s.source),n.add(s.target),null):o.length!==s.relations.length?{...s,relations:o}:s}),Ve(MU));if(n.size===0)return;this.ctxEdges=r;const i=this.includedElements;if(i.size===0){this.implicits.clear();return}for(const s of n)i.has(s)||this.implicits.delete(s)}reset(){this.explicits.clear(),this.implicits.clear(),this.ctxEdges=[]}removeRedundantImplicitEdges(){const e=new Set,n=s=>s.reduce((o,a)=>(e.has(a)||(o.push(a),e.add(a)),o),[]),r=s=>{const{source:o,target:a}=s;return c=>{const u=o.id===c.source.id,l=a.id===c.target.id;if(u&&l)return!0;const d=yr(o.id,c.source.id),f=yr(a.id,c.target.id);return d&&f||u&&f||l&&d}},i=[...this.ctxEdges].sort(sK).reverse();this.ctxEdges=i.reduce((s,o)=>{const a=n(o.relations);return a.length===0||s.length>0&&s.some(r(o))||s.push({source:o.source,target:o.target,relations:a}),s},[])}processPredicates(e){for(const n of e){const r="include"in n,i=n.include??n.exclude;for(const s of i){if(ie.isElementPredicateExpr(s)){this.processElementPredicate(s,r);continue}if(ie.isRelationPredicateExpr(s)){this.processRelationPredicate(s,r);continue}$e(s)}}return this}processElementPredicate(e,n,r){if(ie.isCustomElement(e))return n&&this.processElementPredicate(e.custom.expr,n),this;if(ie.isElementWhere(e)){const i=Do(e.where.condition);return this.processElementPredicate(e.where.expr,n,i),this}if(ie.isExpandedElementExpr(e))return n?KH.call(this,e,r):VH.call(this,e,r),this;if(ie.isElementKindExpr(e)||ie.isElementTagExpr(e))return n?YH.call(this,e,r):XH.call(this,e,r),this;if(ie.isElementRef(e))return n?WH.call(this,e,r):GH.call(this,e,r),this;if(ie.isWildcard(e))return n?zH.call(this,e,r):HH.call(this,e,r),this;$e(e)}processRelationPredicate(e,n,r){if(ie.isCustomRelationExpr(e))return n&&this.processRelationPredicate(e.customRelation.relation,n),this;if(ie.isRelationWhere(e)){const i=Do(e.where.condition);return this.processRelationPredicate(e.where.expr,n,i),this}if(ie.isIncoming(e))return n?JH.call(this,e,r):ZH.call(this,e,r),this;if(ie.isOutgoing(e))return n?QH.call(this,e,r):eK.call(this,e,r),this;if(ie.isInOut(e))return n?tK.call(this,e,r):nK.call(this,e,r),this;if(ie.isRelation(e))return n?rK.call(this,e,r):iK.call(this,e,r),this;$e(e)}getEdgeLabel(e){const n=[];return Z(e.title)&&n.push(e.title),Z(e.technology)&&n.push(`[${e.technology}]`),n.length>0?{label:n.join(`
1137
- `)}:{}}};function aK(t,e){return oK.elementView(t,e)}function R_(t,e){try{return{isSuccess:!0,view:aK(t,e)}}catch(n){return{isSuccess:!1,error:n instanceof Error?n:new Error(`Unknown error: ${n}`),view:void 0}}}let cK=class sN{constructor(e,n){this.view=e,this.graph=n}explicits=new Set;steps=[];static compute(e,n){return new sN(e,n).compute()}addStep({source:e,target:n,title:r,isBackward:i,navigateTo:s,...o},a,c){const u=c?Ib(c,a):Ib(a),l=this.graph.element(e),d=this.graph.element(n);this.explicits.add(l),this.explicits.add(d);const{title:f,relations:h,tags:p,navigateTo:y}=this.findRelations(l,d),T=Z(s)&&s!==this.view.id?s:y;this.steps.push({id:u,...o,source:l,target:d,title:r??f,relations:h??[],isBackward:i??!1,...T?{navigateTo:T}:{},...p?{tags:p}:{}})}compute(){const{docUri:e,rules:n,steps:r,...i}=this.view;let s=1;for(const f of r){if(s2(f)){if(f.__parallel.length===0)continue;f.__parallel.length===1?this.addStep(f.__parallel[0],s):f.__parallel.forEach((h,p)=>this.addStep(h,p+1,s))}else this.addStep(f,s);s++}for(const f of n)if(i2(f))for(const h of f.include){const p=wn(h);this.graph.elements.filter(p).forEach(y=>this.explicits.add(y))}const o=[...this.explicits],a=y_(o),c=this.steps.map(({source:f,target:h,relations:p,title:y,isBackward:T,...b})=>{const v=Xe(a.get(f.id),`Source node ${f.id} not found`),D=Xe(a.get(h.id),`Target node ${h.id} not found`),k={parent:Os(f.id,h.id),source:f.id,target:h.id,label:y,relations:p,color:xs,line:hb,head:bo,...b};for(T&&(k.dir="back");k.parent&&!a.has(k.parent);)k.parent=Tt(k.parent);v.outEdges.push(k.id),D.inEdges.push(k.id);for(const P of Zn(k.source)){if(P===k.parent)break;a.get(P)?.outEdges.push(k.id)}for(const P of Zn(k.target)){if(P===k.parent)break;a.get(P)?.inEdges.push(k.id)}return k}),u=p_(n,m_(n,o.map(f=>Xe(a.get(f.id))))),l=n.findLast(Cb),d=v_(u);return h_({...i,autoLayout:l?.autoLayout??"LR",nodes:ct(u,M1(["notation"])),edges:c,...d.length>0&&{notation:{elements:d}}})}findRelations(e,n){const r=Ar(this.graph.edgesBetween(e,n).flatMap(l=>l.relations));if(r.length===0)return{title:null,tags:null,relations:null,navigateTo:null};const i=ze(r,Ki(l=>l.tags),Ve(Z),Ar()),s=Ir(i,1)?i:null,o=Ir(r,1)?ct(r,l=>l.id):null,a=gn(r)||r.find(l=>l.source===e.id&&l.target===n.id),c=Z(a?.title)?a.title:ze(r,ct(l=>l.title),Ve(Z),Ar(),gn()),u=a?.navigateTo&&a.navigateTo!==this.view.id?a.navigateTo:ze(r,ct(l=>l.navigateTo),Ve(Z),Ve(l=>l!==this.view.id),Ar(),gn());return{title:c??null,tags:s,relations:o,navigateTo:u??null}}};function S_(t,e){try{return{isSuccess:!0,view:cK.compute(t,e)}}catch(n){return{isSuccess:!1,error:n instanceof Error?n:new Error(`Unknown error: ${n}`),view:void 0}}}const Hv=Set,Kv=Map;function Vv(t,e){return t.size===0||e.size===0?new Set:new Set([...t].filter(n=>e.has(n)))}let $_=class{#e=new Map;#t=new Map;#n=new Map;#r=new Set;#s=new Map;#i=new Kv;#o=new Kv;#a=new Kv;#c=new Map;constructor({elements:e,relations:n}){for(const r of Object.values(e))this.addElement(r);for(const r of Object.values(n))this.addRelation(r)}get rootElements(){return[...this.#r]}get elements(){return[...this.#e.values()]}element(e){const n=this.#e.get(e);return ce(n,`Element ${e} not found`),n}connectedRelations(e){return[...this._incomingTo(e),...this._outgoingFrom(e),...this._internalOf(e)]}children(e){return this._childrenOf(e).slice()}childrenOrElement(e){const n=this.children(e);return n.length>0?n:[this.element(e)]}siblings(e){const n=zi(e)?e:e.id,r=Tt(n);return(r?this._childrenOf(r):this.rootElements).filter(i=>i.id!==n)}ancestors(e){let n=zi(e)?e:e.id;const r=[];let i;for(;i=this.#t.get(n);)r.push(i),n=i.id;return r}ascendingSiblings(e){const n=zi(e)?e:e.id;let r=this.#c.get(n);return r||(r=[...this.siblings(n),...this.ancestors(n).flatMap(i=>this.siblings(i.id))],this.#c.set(n,r)),r.slice()}anyEdgesBetween(e,n){if(n.length===0)return[];const r=zi(e)?this.element(e):e,i=this._incomingTo(r.id),s=this._outgoingFrom(r.id);if(i.size===0&&s.size===0)return[];const o=[];for(const a of n){const c=zi(a)?this.element(a):a;if(!ud(r,c)){if(s.size>0){const u=Vv(this._incomingTo(c.id),s);u.size>0&&o.push({source:r,target:c,relations:[...u]})}if(i.size>0){const u=Vv(this._outgoingFrom(c.id),i);u.size>0&&o.push({source:c,target:r,relations:[...u]})}}}return o}edgesWithin(e){return e.length<2?[]:e.reduce((n,r,i,s)=>(i===s.length-1||n.push(...this.anyEdgesBetween(r,s.slice(i+1))),n),[])}edgesBetween(e,n){const r=j1(e)?e:[e],i=j1(n)?n:[n];if(r.length===0||i.length===0)return[];const s=[];for(const o of r){const a=zi(o)?this.element(o):o,c=this._outgoingFrom(a.id);if(c.size!==0)for(const u of i){const l=zi(u)?this.element(u):u;if(ud(a,l))continue;const d=this._incomingTo(l.id),f=Vv(c,d);f.size>0&&s.push({source:a,target:l,relations:[...f]})}}return s}addElement(e){if(this.#e.has(e.id))throw new Error(`Element ${e.id} already exists`);this.#e.set(e.id,e);const n=Tt(e.id);n?(this.#t.set(e.id,this.element(n)),this._childrenOf(n).push(e)):this.#r.add(e)}addRelation(e){if(this.#s.has(e.id))throw new Error(`Relation ${e.id} already exists`);this.#s.set(e.id,e),this._incomingTo(e.target).add(e),this._outgoingFrom(e.source).add(e);const n=Os(e.source,e.target);if(n)for(const r of[n,...Zn(n)])this._internalOf(r).add(e);for(const r of Zn(e.source)){if(r===n)break;this._outgoingFrom(r).add(e)}for(const r of Zn(e.target)){if(r===n)break;this._incomingTo(r).add(e)}}_childrenOf(e){let n=this.#n.get(e);return n||(n=[],this.#n.set(e,n)),n}_incomingTo(e){let n=this.#i.get(e);return n||(n=new Hv,this.#i.set(e,n)),n}_outgoingFrom(e){let n=this.#o.get(e);return n||(n=new Hv,this.#o.set(e,n)),n}_internalOf(e){let n=this.#a.get(e);return n||(n=new Hv,this.#a.set(e,n)),n}};const uK=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,lK=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,dK=/^([/\\]\s*){2,}[^/\\]/;function k_(t){return["./","../"].some(e=>t.startsWith(e))}function Yv(t,e={}){return typeof e=="boolean"&&(e={acceptRelative:e}),e.strict?uK.test(t):lK.test(t)||(e.acceptRelative?dK.test(t):!1)}function fK(t="",e){return t.endsWith("/")}function hK(t="",e){return(fK(t)?t.slice(0,-1):t)||"/"}function pK(t="",e){return t.endsWith("/")?t:t+"/"}function $h(t=""){return t.startsWith("/")}function C_(t=""){return($h(t)?t.slice(1):t)||"/"}function gK(t=""){return $h(t)?t:"/"+t}function mK(t,e){if(yK(e))return t;const n=hK(e);if(!t.startsWith(n))return t;const r=t.slice(n.length);return r[0]==="/"?r:"/"+r}function yK(t){return!t||t==="/"}function kh(t=""){const[e="",n="",r=""]=(t.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:e,search:n,hash:r}}const Ch="DynamicViewRule";function Xv(t){return K.isInstance(t,Ch)}const _h="ElementExpression";function Jv(t){return K.isInstance(t,_h)}const Ah="ElementPredicate";function vK(t){return K.isInstance(t,Ah)}const Ih="ElementPredicateOrWhere";function wK(t){return K.isInstance(t,Ih)}const Qs="ElementProperty";function bK(t){return K.isInstance(t,Qs)}const eo="LikeC4View";function Zv(t){return K.isInstance(t,eo)}const xh="MetadataProperty";function __(t){return K.isInstance(t,xh)}const A_="Predicate",Ph="RelationExpression";function Qv(t){return K.isInstance(t,Ph)}const Nh="RelationPredicate";function DK(t){return K.isInstance(t,Nh)}const Oh="RelationPredicateOrWhere";function EK(t){return K.isInstance(t,Oh)}const pa="RelationProperty";function TK(t){return K.isInstance(t,pa)}const Fh="RelationshipStyleProperty";function RK(t){return K.isInstance(t,Fh)}const ga="StringProperty";function SK(t){return K.isInstance(t,ga)}const Tu="StyleProperty";function ew(t){return K.isInstance(t,Tu)}const Lh="ViewProperty";function $K(t){return K.isInstance(t,Lh)}const Mh="ViewRule";function kK(t){return K.isInstance(t,Mh)}const Bh="ViewRulePredicate";function tw(t){return K.isInstance(t,Bh)}const Ru="WhereElement";function I_(t){return K.isInstance(t,Ru)}const Su="WhereElementExpression";function CK(t){return K.isInstance(t,Su)}const x_="WhereExpression",jh="WhereKindEqual";function _K(t){return K.isInstance(t,jh)}const $u="WhereRelation";function P_(t){return K.isInstance(t,$u)}const ku="WhereRelationExpression";function AK(t){return K.isInstance(t,ku)}const Uh="WhereTagEqual";function IK(t){return K.isInstance(t,Uh)}const Cu="ArrowProperty";function _u(t){return K.isInstance(t,Cu)}const Au="BorderProperty";function qh(t){return K.isInstance(t,Au)}const Iu="ColorProperty";function to(t){return K.isInstance(t,Iu)}const no="CustomColor",Wh="CustomElementProperties";function xK(t){return K.isInstance(t,Wh)}const Gh="CustomRelationProperties";function PK(t){return K.isInstance(t,Gh)}const xu="DirectedRelationExpression";function nw(t){return K.isInstance(t,xu)}const ma="DynamicView";function NK(t){return K.isInstance(t,ma)}const zh="DynamicViewBody";function N_(t){return K.isInstance(t,zh)}const Pu="DynamicViewIncludePredicate";function OK(t){return K.isInstance(t,Pu)}const Hh="DynamicViewParallelSteps";function O_(t){return K.isInstance(t,Hh)}const Kh="DynamicViewPredicateIterator";function F_(t){return K.isInstance(t,Kh)}const rw="DynamicViewRef",Vh="DynamicViewStep";function iw(t){return K.isInstance(t,Vh)}const Lr="Element";function Mr(t){return K.isInstance(t,Lr)}const Yh="ElementBody";function ya(t){return K.isInstance(t,Yh)}const Nu="ElementDescedantsExpression";function sw(t){return K.isInstance(t,Nu)}const Xh="ElementExpressionsIterator";function FK(t){return K.isInstance(t,Xh)}const is="ElementKind";function LK(t){return K.isInstance(t,is)}const Ou="ElementKindExpression";function Jh(t){return K.isInstance(t,Ou)}const Fu="ElementPredicateWhere";function ow(t){return K.isInstance(t,Fu)}const Lu="ElementPredicateWith";function Zh(t){return K.isInstance(t,Lu)}const Mu="ElementRef";function Bu(t){return K.isInstance(t,Mu)}const ju="ElementStringProperty";function aw(t){return K.isInstance(t,ju)}const Uu="ElementStyleProperty";function qu(t){return K.isInstance(t,Uu)}const Wu="ElementTagExpression";function Qh(t){return K.isInstance(t,Wu)}const va="ElementView";function ep(t){return K.isInstance(t,va)}const tp="ElementViewBody";function cw(t){return K.isInstance(t,tp)}const uw="ElementViewRef",Gu="ExcludePredicate";function np(t){return K.isInstance(t,Gu)}const zu="ExpandElementExpression";function L_(t){return K.isInstance(t,zu)}const wa="ExtendElement";function ba(t){return K.isInstance(t,wa)}const rp="ExtendElementBody";function lw(t){return K.isInstance(t,rp)}const ip="FqnElementRef";function M_(t){return K.isInstance(t,ip)}const Hu="IconProperty";function ss(t){return K.isInstance(t,Hu)}const Ku="IncludePredicate";function dw(t){return K.isInstance(t,Ku)}const Vu="IncomingRelationExpression";function B_(t){return K.isInstance(t,Vu)}const Yu="InOutRelationExpression";function fw(t){return K.isInstance(t,Yu)}const ro="LibIcon";function MK(t){return K.isInstance(t,ro)}const hw="LikeC4Grammar",sp="LikeC4Lib";function j_(t){return K.isInstance(t,sp)}const Xu="LineProperty";function Ju(t){return K.isInstance(t,Xu)}const Zu="LinkProperty";function op(t){return K.isInstance(t,Zu)}const Qu="MetadataAttribute";function BK(t){return K.isInstance(t,Qu)}const el="MetadataBody";function jK(t){return K.isInstance(t,el)}const Da="Model";function pw(t){return K.isInstance(t,Da)}const Ea="ModelViews";function gw(t){return K.isInstance(t,Ea)}const ap="NavigateToProperty";function mw(t){return K.isInstance(t,ap)}const tl="NotationProperty";function Ta(t){return K.isInstance(t,tl)}const nl="NotesProperty";function U_(t){return K.isInstance(t,nl)}const rl="OpacityProperty";function cp(t){return K.isInstance(t,rl)}const il="OutgoingRelationExpression";function yw(t){return K.isInstance(t,il)}const up="Predicates";function q_(t){return K.isInstance(t,up)}const lp="Relation";function os(t){return K.isInstance(t,lp)}const dp="RelationBody";function W_(t){return K.isInstance(t,dp)}const sl="RelationNavigateToProperty";function fp(t){return K.isInstance(t,sl)}const ol="RelationPredicateWhere";function G_(t){return K.isInstance(t,ol)}const al="RelationPredicateWith";function vw(t){return K.isInstance(t,al)}const as="RelationshipKind";function UK(t){return K.isInstance(t,as)}const cl="RelationStringProperty";function hp(t){return K.isInstance(t,cl)}const ul="RelationStyleProperty";function ww(t){return K.isInstance(t,ul)}const ll="ShapeProperty";function pp(t){return K.isInstance(t,ll)}const gp="SpecificationColor";function mp(t){return K.isInstance(t,gp)}const Ra="SpecificationElementKind";function Sa(t){return K.isInstance(t,Ra)}const dl="SpecificationElementStringProperty";function z_(t){return K.isInstance(t,dl)}const $a="SpecificationRelationshipKind";function ka(t){return K.isInstance(t,$a)}const fl="SpecificationRelationshipStringProperty";function H_(t){return K.isInstance(t,fl)}const Ca="SpecificationRule";function bw(t){return K.isInstance(t,Ca)}const _a="SpecificationTag";function yp(t){return K.isInstance(t,_a)}const cs="Tag";function K_(t){return K.isInstance(t,cs)}const vp="Tags";function Dw(t){return K.isInstance(t,vp)}const Ew="ViewRef",hl="ViewRuleAutoLayout";function wp(t){return K.isInstance(t,hl)}const pl="ViewRuleStyle";function Aa(t){return K.isInstance(t,pl)}const gl="ViewStringProperty";function qK(t){return K.isInstance(t,gl)}const ml="WhereBinaryExpression";function WK(t){return K.isInstance(t,ml)}const yl="WhereElementKind";function GK(t){return K.isInstance(t,yl)}const vl="WhereElementNegation";function V_(t){return K.isInstance(t,vl)}const wl="WhereElementTag";function zK(t){return K.isInstance(t,wl)}const bl="WhereRelationKind";function Y_(t){return K.isInstance(t,bl)}const Dl="WhereRelationNegation";function X_(t){return K.isInstance(t,Dl)}const El="WhereRelationTag";function HK(t){return K.isInstance(t,El)}const Tl="WildcardExpression";function Ia(t){return K.isInstance(t,Tl)}class J_ extends FD{getAllTypes(){return[Cu,Au,Iu,no,Wh,Gh,xu,ma,zh,Pu,Hh,Kh,rw,Ch,Vh,Lr,Yh,Nu,_h,Xh,is,Ou,Ah,Ih,Fu,Lu,Qs,Mu,ju,Uu,Wu,va,tp,uw,Gu,zu,wa,rp,ip,Hu,Yu,Ku,Vu,ro,hw,sp,eo,Xu,Zu,Qu,el,xh,Da,Ea,ap,tl,nl,rl,il,A_,up,lp,dp,Ph,sl,Nh,Oh,ol,al,pa,cl,ul,as,Fh,ll,gp,Ra,dl,$a,fl,Ca,_a,ga,Tu,cs,vp,Lh,Ew,Mh,hl,Bh,pl,gl,ml,Ru,Su,yl,vl,wl,x_,jh,$u,ku,bl,Dl,El,Uh,Tl]}computeIsSubtype(e,n){switch(e){case Cu:case Xu:return this.isSubtype(Fh,n);case Au:case rl:case ll:return this.isSubtype(Tu,n);case Iu:return this.isSubtype(Fh,n)||this.isSubtype(Tu,n);case xu:case Vu:case Yu:case il:return this.isSubtype(Ph,n);case ma:case va:return this.isSubtype(eo,n);case Pu:return this.isSubtype(Ch,n);case Nu:case Ou:case Mu:case Wu:case zu:case Tl:return this.isSubtype(_h,n);case _h:case Fu:return this.isSubtype(Ih,n);case Ah:case Nh:return this.isSubtype(A_,n);case Ih:case Lu:return this.isSubtype(Ah,n);case ju:return this.isSubtype(Qs,n)||this.isSubtype(ga,n);case Uu:return this.isSubtype(Qs,n);case Gu:case Ku:return this.isSubtype(Bh,n);case Hu:return this.isSubtype(Qs,n)||this.isSubtype(Tu,n);case Zu:return this.isSubtype(Qs,n)||this.isSubtype(pa,n)||this.isSubtype(Lh,n);case Qu:case tl:case nl:case dl:case fl:return this.isSubtype(ga,n);case el:return this.isSubtype(xh,n);case xh:return this.isSubtype(Qs,n)||this.isSubtype(pa,n);case Ph:case ol:return this.isSubtype(Oh,n);case sl:case ul:return this.isSubtype(pa,n);case Oh:case al:return this.isSubtype(Nh,n);case cl:return this.isSubtype(pa,n)||this.isSubtype(ga,n);case hl:case pl:return this.isSubtype(Ch,n)||this.isSubtype(Mh,n);case Bh:return this.isSubtype(Mh,n);case gl:return this.isSubtype(ga,n)||this.isSubtype(Lh,n);case ml:return this.isSubtype(Su,n)||this.isSubtype(ku,n);case Ru:case vl:return this.isSubtype(Su,n);case Su:case ku:return this.isSubtype(x_,n);case yl:return this.isSubtype(Ru,n)||this.isSubtype(jh,n);case wl:return this.isSubtype(Ru,n)||this.isSubtype(Uh,n);case $u:case Dl:return this.isSubtype(ku,n);case bl:return this.isSubtype(jh,n)||this.isSubtype($u,n);case El:return this.isSubtype($u,n)||this.isSubtype(Uh,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"ColorProperty:customColor":return no;case"DynamicViewRef:view":return ma;case"DynamicViewStep:kind":case"OutgoingRelationExpression:kind":case"Relation:kind":case"WhereRelationKind:value":return as;case"Element:kind":case"ElementKindExpression:kind":case"WhereElementKind:value":return is;case"ElementRef:el":case"FqnElementRef:el":return Lr;case"ElementTagExpression:tag":case"Tags:values":case"WhereElementTag:value":case"WhereRelationTag:value":return cs;case"ElementViewRef:view":return va;case"IconProperty:libicon":return ro;case"ViewRef:view":return eo;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Cu:return{name:Cu,properties:[{name:"key"},{name:"value"}]};case Au:return{name:Au,properties:[{name:"key"},{name:"value"}]};case Iu:return{name:Iu,properties:[{name:"customColor"},{name:"key"},{name:"themeColor"}]};case no:return{name:no,properties:[{name:"name"}]};case Wh:return{name:Wh,properties:[{name:"props",defaultValue:[]}]};case Gh:return{name:Gh,properties:[{name:"props",defaultValue:[]}]};case xu:return{name:xu,properties:[{name:"source"},{name:"target"}]};case ma:return{name:ma,properties:[{name:"body"},{name:"name"}]};case zh:return{name:zh,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"steps",defaultValue:[]},{name:"tags"}]};case Pu:return{name:Pu,properties:[{name:"predicates"}]};case Hh:return{name:Hh,properties:[{name:"steps",defaultValue:[]}]};case Kh:return{name:Kh,properties:[{name:"prev"},{name:"value"}]};case rw:return{name:rw,properties:[{name:"view"}]};case Vh:return{name:Vh,properties:[{name:"custom"},{name:"isBackward",defaultValue:!1},{name:"kind"},{name:"source"},{name:"target"},{name:"title"}]};case Lr:return{name:Lr,properties:[{name:"body"},{name:"kind"},{name:"name"},{name:"props",defaultValue:[]}]};case Yh:return{name:Yh,properties:[{name:"elements",defaultValue:[]},{name:"props",defaultValue:[]},{name:"tags"}]};case Nu:return{name:Nu,properties:[{name:"parent"}]};case Xh:return{name:Xh,properties:[{name:"prev"},{name:"value"}]};case is:return{name:is,properties:[{name:"name"}]};case Ou:return{name:Ou,properties:[{name:"isEqual",defaultValue:!1},{name:"kind"}]};case Fu:return{name:Fu,properties:[{name:"subject"},{name:"where"}]};case Lu:return{name:Lu,properties:[{name:"custom"},{name:"subject"}]};case Mu:return{name:Mu,properties:[{name:"el"},{name:"parent"}]};case ju:return{name:ju,properties:[{name:"key"},{name:"value"}]};case Uu:return{name:Uu,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case Wu:return{name:Wu,properties:[{name:"isEqual",defaultValue:!1},{name:"tag"}]};case va:return{name:va,properties:[{name:"body"},{name:"extends"},{name:"name"},{name:"viewOf"}]};case tp:return{name:tp,properties:[{name:"props",defaultValue:[]},{name:"rules",defaultValue:[]},{name:"tags"}]};case uw:return{name:uw,properties:[{name:"view"}]};case Gu:return{name:Gu,properties:[{name:"predicates"}]};case zu:return{name:zu,properties:[{name:"expand"}]};case wa:return{name:wa,properties:[{name:"body"},{name:"element"}]};case rp:return{name:rp,properties:[{name:"elements",defaultValue:[]}]};case ip:return{name:ip,properties:[{name:"el"},{name:"parent"}]};case Hu:return{name:Hu,properties:[{name:"key"},{name:"libicon"},{name:"value"}]};case Ku:return{name:Ku,properties:[{name:"predicates"}]};case Vu:return{name:Vu,properties:[{name:"to"}]};case Yu:return{name:Yu,properties:[{name:"inout"}]};case ro:return{name:ro,properties:[{name:"name"}]};case hw:return{name:hw,properties:[{name:"likec4lib",defaultValue:[]},{name:"models",defaultValue:[]},{name:"specifications",defaultValue:[]},{name:"views",defaultValue:[]}]};case sp:return{name:sp,properties:[{name:"icons",defaultValue:[]}]};case Xu:return{name:Xu,properties:[{name:"key"},{name:"value"}]};case Zu:return{name:Zu,properties:[{name:"key"},{name:"title"},{name:"value"}]};case Qu:return{name:Qu,properties:[{name:"key"},{name:"value"}]};case el:return{name:el,properties:[{name:"props",defaultValue:[]}]};case Da:return{name:Da,properties:[{name:"elements",defaultValue:[]},{name:"name"}]};case Ea:return{name:Ea,properties:[{name:"name"},{name:"views",defaultValue:[]}]};case ap:return{name:ap,properties:[{name:"key"},{name:"value"}]};case tl:return{name:tl,properties:[{name:"key"},{name:"value"}]};case nl:return{name:nl,properties:[{name:"key"},{name:"value"}]};case rl:return{name:rl,properties:[{name:"key"},{name:"value"}]};case il:return{name:il,properties:[{name:"from"},{name:"isBidirectional",defaultValue:!1},{name:"kind"}]};case up:return{name:up,properties:[{name:"prev"},{name:"value"}]};case lp:return{name:lp,properties:[{name:"body"},{name:"kind"},{name:"source"},{name:"tags"},{name:"target"},{name:"technology"},{name:"title"}]};case dp:return{name:dp,properties:[{name:"props",defaultValue:[]},{name:"tags"}]};case sl:return{name:sl,properties:[{name:"key"},{name:"value"}]};case ol:return{name:ol,properties:[{name:"subject"},{name:"where"}]};case al:return{name:al,properties:[{name:"custom"},{name:"subject"}]};case as:return{name:as,properties:[{name:"name"}]};case cl:return{name:cl,properties:[{name:"key"},{name:"value"}]};case ul:return{name:ul,properties:[{name:"key"},{name:"props",defaultValue:[]}]};case ll:return{name:ll,properties:[{name:"key"},{name:"value"}]};case gp:return{name:gp,properties:[{name:"color"},{name:"name"}]};case Ra:return{name:Ra,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case dl:return{name:dl,properties:[{name:"key"},{name:"value"}]};case $a:return{name:$a,properties:[{name:"kind"},{name:"props",defaultValue:[]}]};case fl:return{name:fl,properties:[{name:"key"},{name:"value"}]};case Ca:return{name:Ca,properties:[{name:"colors",defaultValue:[]},{name:"elements",defaultValue:[]},{name:"name"},{name:"relationships",defaultValue:[]},{name:"tags",defaultValue:[]}]};case _a:return{name:_a,properties:[{name:"tag"}]};case cs:return{name:cs,properties:[{name:"name"}]};case vp:return{name:vp,properties:[{name:"prev"},{name:"values",defaultValue:[]}]};case Ew:return{name:Ew,properties:[{name:"view"}]};case hl:return{name:hl,properties:[{name:"direction"}]};case pl:return{name:pl,properties:[{name:"props",defaultValue:[]},{name:"target"}]};case gl:return{name:gl,properties:[{name:"key"},{name:"value"}]};case ml:return{name:ml,properties:[{name:"left"},{name:"operator"},{name:"right"}]};case yl:return{name:yl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case vl:return{name:vl,properties:[{name:"value"}]};case wl:return{name:wl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case bl:return{name:bl,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Dl:return{name:Dl,properties:[{name:"value"}]};case El:return{name:El,properties:[{name:"not",defaultValue:!1},{name:"operator"},{name:"value"}]};case Tl:return{name:Tl,properties:[{name:"isWildcard",defaultValue:!1}]};default:return{name:e,properties:[]}}}}const K=new J_;let Z_;const KK=()=>Z_??(Z_=lU(`{"$type":"Grammar","isDeclared":true,"name":"LikeC4","rules":[{"$type":"ParserRule","name":"LikeC4Grammar","entry":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"specifications","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"models","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]}},{"$type":"Assignment","feature":"likec4lib","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LikeC4Lib","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"likec4lib"},{"$type":"Keyword","value":"{"},{"$type":"Keyword","value":"icons"},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"icons","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LibIcon","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@105"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Tag","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationshipKind","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColor","definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@109"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRule","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"specification"}},{"$type":"Keyword","value":"{"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"relationships","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"colors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationElementKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"element"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationElementStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"notation"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationTag","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"tag"},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationColor","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"color"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"color","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@104"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRelationshipKind","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"relationship"},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@99"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"SpecificationRelationshipStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"notation"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Model","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"model"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Element","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false}}]}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":false},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@96"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExtendElement","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"extend"},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ExtendElementBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[{"$type":"NamedArgument","value":{"$type":"BooleanLiteral","true":true},"calledByName":false}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"FqnElementRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"FqnElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementRef","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementRef"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@123"},"arguments":[]},{"$type":"Assignment","feature":"el","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@15"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"deprecatedSyntax":false}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Tags","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"values","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"+"},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Tags"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"values","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"*"}],"cardinality":"*"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Relation","parameters":[{"$type":"Parameter","name":"isExplicit"}],"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","guardCondition":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@24/parameters@0"}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]},{"$type":"Group","guardCondition":{"$type":"Negation","value":{"$type":"ParameterReference","parameter":{"$ref":"#/rules@24/parameters@0"}}},"elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},"cardinality":"?"}]}]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Keyword","value":"->"}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Assignment","feature":"technology","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"wildcard":false},{"$type":"ParserRule","name":"RelationBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"technology"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationStyleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"style"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@99"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataProperty","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"metadata"},{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"MetadataAttribute","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@129"},"arguments":[]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ModelViews","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"views"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"views","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LikeC4ViewRule","returnType":{"$ref":"#/types@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"extends"},{"$type":"Assignment","feature":"extends","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"of"},{"$type":"Assignment","feature":"viewOf","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}]}],"cardinality":"?"},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicView","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"dynamic"},{"$type":"Keyword","value":"view"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}},{"$type":"Assignment","feature":"body","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@40"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/types@0"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@34"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRef","definition":{"$type":"Assignment","feature":"view","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@35"},"deprecatedSyntax":false}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewBody","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"tags","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]},"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]}]}},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@88"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewStringProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"title"},{"$type":"Keyword","value":"description"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewLayoutDirection","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"TopBottom"},{"$type":"Keyword","value":"LeftRight"},{"$type":"Keyword","value":"BottomTop"},{"$type":"Keyword","value":"RightLeft"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewRule","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@78"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@80"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@81"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewParallelSteps","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"parallel"},{"$type":"Keyword","value":"par"}]},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"steps","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@47"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewStep","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"source","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBackward","operator":"?=","terminal":{"$type":"Keyword","value":"<-"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@85"},"arguments":[]},"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRulePredicate","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"IncludePredicate"}},{"$type":"Keyword","value":"include"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExcludePredicate"}},{"$type":"Keyword","value":"exclude"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@49"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Predicates","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"Predicates"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Predicate","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@63"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicates","inferredType":{"$type":"InferredType","name":"ElementPredicate"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@53"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementPredicateWith"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@84"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementPredicateOrWhere","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementPredicateWhere"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@55"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementOr","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"or"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@56"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementAnd","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@57"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"and"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@57"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementPrimary","inferredType":{"$type":"InferredType","name":"WhereElementExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@58"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@59"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElementNegation","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"not"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@54"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereElement","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementTag"}},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereElementKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementExpression","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@61"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@62"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementSelectorExpression","inferredType":{"$type":"InferredType","name":"ElementExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WildcardExpression"}},{"$type":"Assignment","feature":"isWildcard","operator":"?=","terminal":{"$type":"Keyword","value":"*"}}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementTagExpression"}},{"$type":"Keyword","value":"element.tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@112"},"arguments":[]},{"$type":"Assignment","feature":"tag","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementKindExpression"}},{"$type":"Keyword","value":"element.kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@112"},"arguments":[]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@3"},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementDescedantsExpression","inferredType":{"$type":"InferredType","name":"ElementExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ExpandElementExpression"},"feature":"expand","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@120"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementDescedantsExpression"},"feature":"parent","operator":"="},{"$type":"RuleCall","rule":{"$ref":"#/rules@121"},"arguments":[]}]}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicate","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@64"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicates","inferredType":{"$type":"InferredType","name":"RelationPredicate"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@65"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWith"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"with"},{"$type":"Assignment","feature":"custom","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@85"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationPredicateOrWhere","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@72"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"RelationPredicateWhere"},"feature":"subject","operator":"="},{"$type":"Keyword","value":"where"},{"$type":"Assignment","feature":"where","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@66"},"arguments":[]},"cardinality":"?"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationExpression","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@67"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationOr","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@68"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"or"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@68"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationAnd","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@69"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereBinaryExpression"},"feature":"left","operator":"="},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"and"}},{"$type":"Assignment","feature":"right","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@69"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationPrimary","inferredType":{"$type":"InferredType","name":"WhereRelationExpression"},"definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"RuleCall","rule":{"$ref":"#/rules@66"},"arguments":[]},{"$type":"Keyword","value":")"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@70"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@71"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelationNegation","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"not"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@66"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"WhereRelation","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationTag"}},{"$type":"Keyword","value":"tag"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@4"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@107"},"arguments":[]},"deprecatedSyntax":false},"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"WhereRelationKind"}},{"$type":"Keyword","value":"kind"},{"$type":"RuleCall","rule":{"$ref":"#/rules@111"},"arguments":[]},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationExpression","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@73"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@75"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"InOutRelationExpressions","inferredType":{"$type":"InferredType","name":"RelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@74"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"InOutRelationExpression"},"feature":"inout","operator":"="},{"$type":"Keyword","value":"->"}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IncomingRelationExpression","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"->"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DirectedRelationExpressions","inferredType":{"$type":"InferredType","name":"RelationExpression"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@76"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DirectedRelationExpression"},"feature":"source","operator":"="},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OutgoingRelationExpression","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isBidirectional","operator":"?=","terminal":{"$type":"Keyword","value":"<->"}},{"$type":"Keyword","value":"->"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-["},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"deprecatedSyntax":false}},{"$type":"Keyword","value":"]->"}]},{"$type":"Assignment","feature":"kind","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@5"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@108"},"arguments":[]},"deprecatedSyntax":false}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementExpressionsIterator","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"ElementExpressionsIterator"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@60"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewIncludePredicate","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"include"},{"$type":"Assignment","feature":"predicates","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@79"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DynamicViewPredicateIterator","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Action","inferredType":{"$type":"InferredType","name":"DynamicViewPredicateIterator"},"feature":"prev","operator":"="},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},"cardinality":"?"}],"cardinality":"*"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleStyle","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"style"},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@77"},"arguments":[]}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ViewRuleAutoLayout","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"autoLayout"},{"$type":"Assignment","feature":"direction","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@43"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NotationProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"notation"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NotesProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"notes"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomElementProperties","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@86"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomRelationProperties","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@87"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@82"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@83"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@99"},"arguments":[]}]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NavigateToProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"navigateTo"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationNavigateToProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"navigateTo"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LinkProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"link"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@106"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@128"},"arguments":[]},"cardinality":"?"},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ColorProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"color"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"themeColor","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@102"},"arguments":[]}},{"$type":"Assignment","feature":"customColor","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@6"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@109"},"arguments":[]},"deprecatedSyntax":false}}]},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"OpacityProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"opacity"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@127"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"icon"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"libicon","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@105"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@106"},"arguments":[]}}]},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ShapeProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"shape"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BorderStyleValue","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]},{"$type":"Keyword","value":"none"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"BorderProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"border"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@93"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"StyleProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@92"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@94"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@90"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@91"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementStyleProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"style"}},{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"props","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@95"},"arguments":[]},"cardinality":"*"},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Keyword","value":"line"}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrowProperty","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"key","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"head"},{"$type":"Keyword","value":"tail"}]}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]}},{"$type":"Keyword","value":";","cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RelationshipStyleProperty","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@89"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@97"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@98"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LineOptions","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"solid"},{"$type":"Keyword","value":"dashed"},{"$type":"Keyword","value":"dotted"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ArrowType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"none"},{"$type":"Keyword","value":"normal"},{"$type":"Keyword","value":"onormal"},{"$type":"Keyword","value":"dot"},{"$type":"Keyword","value":"odot"},{"$type":"Keyword","value":"diamond"},{"$type":"Keyword","value":"odiamond"},{"$type":"Keyword","value":"crow"},{"$type":"Keyword","value":"open"},{"$type":"Keyword","value":"vee"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ThemeColor","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"primary"},{"$type":"Keyword","value":"secondary"},{"$type":"Keyword","value":"muted"},{"$type":"Keyword","value":"slate"},{"$type":"Keyword","value":"blue"},{"$type":"Keyword","value":"indigo"},{"$type":"Keyword","value":"sky"},{"$type":"Keyword","value":"red"},{"$type":"Keyword","value":"gray"},{"$type":"Keyword","value":"green"},{"$type":"Keyword","value":"amber"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ElementShape","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rectangle"},{"$type":"Keyword","value":"person"},{"$type":"Keyword","value":"browser"},{"$type":"Keyword","value":"mobile"},{"$type":"Keyword","value":"cylinder"},{"$type":"Keyword","value":"storage"},{"$type":"Keyword","value":"queue"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColorValue","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@122"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@130"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IconId","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@117"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Uri","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@118"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@119"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TagId","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@122"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DotId","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@124"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@110"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CustomColorId","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Id","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@129"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@103"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@102"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@101"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@100"},"arguments":[]},{"$type":"Keyword","value":"element"},{"$type":"Keyword","value":"model"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EqOperator","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"is"}},{"$type":"Assignment","feature":"not","operator":"?=","terminal":{"$type":"Keyword","value":"not"},"cardinality":"?"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"IsEqual","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"isEqual","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@126"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@125"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","hidden":true,"name":"BLOCK_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/[\\\\r\\\\n]+/"},"fragment":false},{"$type":"TerminalRule","name":"LIB_ICON","definition":{"$type":"RegexToken","regex":"/(aws|gcp|tech):[-\\\\w]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"URI_WITH_SCHEMA","definition":{"$type":"RegexToken","regex":"/\\\\w+:\\\\/\\\\/\\\\S+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"URI_RELATIVE","definition":{"$type":"RegexToken","regex":"/\\\\.{0,2}\\\\/[^\\\\/]\\\\S+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotUnderscore","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\._/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DotWildcard","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\.\\\\*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Hash","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"#"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"StickyDot","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\./"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Dot","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"."}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NotEqual","definition":{"$type":"RegexToken","regex":"/\\\\!\\\\={1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Eq","definition":{"$type":"RegexToken","regex":"/\\\\={1,2}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Percent","definition":{"$type":"RegexToken","regex":"/\\\\b\\\\d+%/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"String","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"IdTerminal","definition":{"$type":"RegexToken","regex":"/[_]*[a-zA-Z][-\\\\w]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"Hex","definition":{"$type":"RegexToken","regex":"/[a-zA-Z0-9]+/"},"fragment":false,"hidden":false}],"types":[{"$type":"Type","name":"LikeC4View","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@34"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@35"}}]}},{"$type":"Type","name":"StringProperty","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@18"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@42"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@27"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@31"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@13"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@82"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@83"}}]}},{"$type":"Type","name":"WhereTagEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@59/definition/elements@0/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@71/definition/elements@0/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereKindEqual","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@59/definition/elements@1/elements@0/inferredType"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@71/definition/elements@1/elements@0/inferredType"}}]}},{"$type":"Type","name":"WhereExpression","type":{"$type":"UnionType","types":[{"$type":"SimpleType","typeRef":{"$ref":"#/rules@54"}},{"$type":"SimpleType","typeRef":{"$ref":"#/rules@66"}}]}}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"interfaces":[],"usedGrammars":[]}`)),Q_={languageId:"likec4",fileExtensions:[".c4",".likec4",".like-c4"],caseInsensitive:!1},VK={skipValidations:!0,recoveryEnabled:!0,nodeLocationTracking:"full"},YK={AstReflection:()=>new J_},XK={Grammar:()=>KK(),LanguageMetaData:()=>Q_,parser:{ParserConfig:()=>VK}},Re=Ye.withTag("lsp");function zt(t){Re.error(t)}function vt(t){if(t instanceof Error){Re.warn(t.stack??t.message);return}Re.warn(t)}function JK(t){Re.level=Le[t]}function ZK(t){const e={log:({level:n,...r},i)=>{if(n!==Le.error&&n!==Le.fatal)return;const s=r.tag||"",o=r.args.map(c=>ev(c)?c.stack??c.message:typeof c=="string"?c:""+c);s&&o.unshift(`[${s}]`);const a=o.join(" ");t.telemetry.logEvent({eventName:"error",error:a})}};Ye.addReporter(e),Re.setReporters(Ye.options.reporters)}function QK(t){const e={log:({level:n,...r},i)=>{const s=r.tag||"",o=r.args.map(c=>ev(c)?c.stack??c.message:typeof c=="string"?c:""+c);s&&o.unshift(`[${s}]`);const a=o.join(" ");switch(!0){case n>=Le.debug:{t.console.debug(a);break}case n>=Le.log:{t.console.info(a);break}case n>=Le.warn:{t.console.warn(a);break}case n>=Le.fatal:{t.console.error(a);break}default:t.console.log(a)}}};Ye.setReporters([e]),Re.setReporters(Ye.options.reporters)}function bn(t){return t.el.ref}function bp(t){const e=[t.el.$refText];let n=t.parent;for(;n;)e.push(n.el.$refText),n=n.parent;return e.length===1?e[0]:e.reverse().join(".")}const Rl=Symbol.for("idattr"),Tw={writeId(t,e){return t[Rl]=e,t},readId(t){return t[Rl]}},eA={writeId(t,e){return $t(e)?t[Rl]=void 0:t[Rl]=e,t},readId(t){return t[Rl]}};function eV(t){return Object.assign(t,{c4Specification:{tags:new Set,elements:{},relationships:{},colors:{}},c4Elements:[],c4Relations:[],c4Views:[]})}function Dp(t){return t.textDocument.languageId===Q_.languageId}function tA(t){return Dp(t)&&t.state>=Fe.IndexedContent&&!!t.c4fqnIndex}function Sl(t){return Dp(t)&&t.state==Fe.Validated&&!!t.c4Specification&&!!t.c4Elements&&!!t.c4Relations&&!!t.c4Views&&!!t.c4fqnIndex}function tV(t){return e=>t.some(n=>n(e))}const nV=tV([F_,Zh,vw,Jv,Qv,O_,iw,$K,ew,Dw,kK,Xv,cw,N_,Zv,TK,W_,os,bK,ya,Mr,lw,ba,Sa,ka,yp,mp,bw,gw,pw]),rV=t=>{let e=t;for(;e;){if(nV(e))return e;e=e.$container}};function iV(t){const e=t.diagnostics?.filter(r=>r.severity===Jc.Error)??[],n=new WeakSet(e.flatMap(r=>rV(r.node)??[]));return{isValid:r=>!n.has(r),invalidNodes:n}}function*sV(t,e){const n=t.parseResult.value.models.flatMap(s=>s.elements),r=[];let i;for(;i=n.shift();)if(e(i)){if(os(i)){r.push(i);continue}if(ba(i)){i.body&&i.body.elements.length>0&&n.push(...i.body.elements);continue}i.body&&i.body.elements.length>0&&n.push(...i.body.elements),yield i}for(const s of r)yield s}function oV(t){const e=bn(t.target);if(!e)throw new Error("RelationRefError: Invalid reference to target");if(It(t.source)){const n=bn(t.source);if(!n)throw new Error("RelationRefError: Invalid reference to source");return{source:n,target:e}}if(!ya(t.$container))throw new Error("RelationRefError: Invalid container for sourceless relation");return{source:t.$container.$container,target:e}}function nA({value:t}){const e=parseFloat(t);return isNaN(e)?100:G1(e,{min:0,max:100})}function Ep(t,e){const n={};if(!t||t.length===0)return n;for(const r of t)if(e(r))switch(!0){case qh(r):{Z(r.value)&&(n.border=r.value);break}case to(r):{const i=$l(r);Z(i)&&(n.color=i);break}case pp(r):{Z(r.value)&&(n.shape=r.value);break}case ss(r):{const i=r.libicon?.ref?.name??r.value;Z(i)&&(n.icon=i);break}case cp(r):{n.opacity=nA(r);break}default:$e(r.$type)}return n}function aV(t){const e={};if(!t||t.length===0)return e;for(const n of t){if(to(n)){const r=$l(n);Z(r)&&(e.color=r);continue}if(Ju(n)){e.line=n.value;continue}if(_u(n)){switch(n.key){case"head":{e.head=n.value;break}case"tail":{e.tail=n.value;break}default:$e(n)}continue}$e(n)}return e}function rA(t){const{color:e,line:n,head:r,tail:i}=aV(t?.filter(RK));return{...e&&e!==xs?{color:e}:{},...n&&n!==hb?{line:n}:{},...r&&r!==bo?{head:r}:{},...i?{tail:i}:{}}}function $l(t){return t?.themeColor??t?.customColor?.$refText}function iA(t){switch(t){case"TopBottom":return"TB";case"BottomTop":return"BT";case"LeftRight":return"LR";case"RightLeft":return"RL";default:$e(t)}}function cV(t){switch(t){case"TB":return"TopBottom";case"BT":return"BottomTop";case"LR":return"LeftRight";case"RL":return"RightLeft";default:$e(t)}}function sA(t){if(Jv(t))return t;if(ow(t))return t.subject;if(Zh(t))return sA(t.subject);$e(t)}class uV{constructor(e){this.services=e}async provideCodeLens(e,n,r){return e.state!==Fe.Validated&&(Re.debug(`Waiting for document ${e.uri.path} to be validated`),await this.services.shared.workspace.DocumentBuilder.waitUntil(Fe.Validated,e.uri,r),Re.debug(`Document ${e.uri.path} is validated`)),Sl(e)?e.parseResult.value.views.flatMap(i=>i.views).flatMap(i=>{const s=Tw.readId(i),o=i.$cstNode?.range;return!o||!s?[]:{range:{start:o.start,end:{line:o.start.line,character:o.start.character+4}},command:{command:"likec4.open-preview",arguments:[s],title:"open preview"}}}):void 0}}class lV extends uC{completionOptions={triggerCharacters:["."]}}class dV extends lC{createDocumentHighlight(e){return te.DocumentHighlight.create(e.segment.range,te.DocumentHighlightKind.Read)}}class fV{constructor(e){this.services=e}getDocumentLinks(e,n){return Sl(e)?Dr(e.parseResult.value).filter(op).map(r=>{try{const i=En(r.$cstNode,"value")?.range,s=this.resolveLink(e,r.value);if(i&&Yv(s))return{range:i,target:s}}catch(i){vt(i)}return null}).nonNullable().toArray():[]}resolveLink(e,n){if(Yv(n)||$h(n))return n;const r=k_(n)?new URL(e.uri.toString(!0)):this.services.shared.workspace.WorkspaceManager.workspaceURL;return new URL(n,r).toString()}relativeLink(e,n){if($h(n))return C_(n);if(k_(n)){const r=new URL(e.uri.toString(!0)),i=new URL(n,r).toString();return C_(mK(i,this.services.shared.workspace.WorkspaceManager.workspaceURL.toString()))}return null}}class hV{constructor(e){this.services=e,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}nodeKindProvider;getSymbols({parseResult:{value:{specifications:e,models:n,views:r,likec4lib:i}}}){return[...i.map(s=>()=>this.getLikec4LibSymbol(s)),...e.map(s=>()=>this.getSpecSymbol(s)),...n.map(s=>()=>this.getModelSymbol(s)),...r.map(s=>()=>this.getModelViewsSymbol(s))].flatMap(s=>{try{return s()??[]}catch(o){return zt(o),[]}})}getLikec4LibSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.icons.map(i=>this.getLibIconSymbol(i)).filter(Z);return r.length===0?[]:[{kind:ir.Namespace,name:"icons",range:n.range,selectionRange:_c(n,"icons")?.range??n.range,children:r}]}getSpecSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=En(n,"name");if(!r)return[];const i=ze([...e.elements,...e.tags,...e.relationships],ct(s=>{try{if(Sa(s)||ka(s))return this.getKindSymbol(s);if(yp(s))return this.getTagSymbol(s)}catch(o){return zt(o),null}$e(s)}),Ve(Z));return i.length===0?[]:[{kind:ir.Namespace,name:e.name,range:n.range,selectionRange:r.range,children:i}]}getModelSymbol(e){const n=e.$cstNode;if(!n)return[];const r=En(n,"name");return r?[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.elements.flatMap(i=>this.getElementsSymbol(i))}]:[]}getElementsSymbol(e){try{if(ba(e))return this.getExtendElementSymbol(e);if(Mr(e))return this.getElementSymbol(e)}catch(n){zt(n)}return[]}getExtendElementSymbol(e){const n=e.$cstNode,r=e.element.$cstNode,i=e.body;return!n||!r?[]:[{kind:this.symbolKind(e),name:bp(e.element),range:n.range,selectionRange:r.range,children:i.elements.flatMap(s=>this.getElementsSymbol(s))}]}getElementSymbol(e){const n=e.$cstNode,r=En(n,"name");if(!r||!n)return[];const i=e.name,s=e.kind.$refText;return[{kind:this.symbolKind(e),name:i,range:n.range,selectionRange:r.range,detail:s,children:e.body?.elements.flatMap(o=>this.getElementsSymbol(o))??[]}]}getModelViewsSymbol(e){const n=e.$cstNode,r=En(n,"name");return!r||!n?[]:[{kind:this.symbolKind(e),name:e.name,range:n.range,selectionRange:r.range,children:e.views.flatMap(i=>this.getViewSymbol(i))}]}getKindSymbol(e){return!e.$cstNode||!e.kind.$cstNode||Hi(e.kind.name)?null:{kind:this.symbolKind(e),name:e.kind.name,range:e.$cstNode.range,selectionRange:e.kind.$cstNode.range}}getTagSymbol(e){return!e.$cstNode||!e.tag.$cstNode||Hi(e.tag.name)?null:{kind:this.symbolKind(e),name:"#"+e.tag.name,range:e.$cstNode.range,selectionRange:e.tag.$cstNode.range}}getLibIconSymbol(e){return!e.$cstNode||Hi(e.name)?null:{kind:this.symbolKind(e),name:e.name,range:e.$cstNode.range,selectionRange:e.$cstNode.range}}getViewSymbol(e){const n=e?.$cstNode;if(!n)return[];const r=e.name?En(n,"name"):null;return r?[{kind:this.symbolKind(e),name:r.text,range:n.range,selectionRange:r.range,children:[]}]:[]}symbolKind(e){return this.nodeKindProvider.getSymbolKind(e)}}class pV extends pC{locator;constructor(e){super(e),this.locator=e.likec4.ModelLocator}getAstNodeHoverContent(e){if(K_(e))return{contents:{kind:"markdown",value:Mv(`
1138
- tag: \`${e.name}\`
1139
- `)}};if(Mr(e)){const n=this.locator.getParsedElement(e);return n?{contents:{kind:"markdown",value:[n.id,`### ${n.title}`,"`"+n.kind+"` "].join(`
1140
- `)}}:void 0}}}class gV extends pW{highlightElement(e,n){if(UK(e))return n({node:e,property:"name",type:Pe.function});if(MK(e))return n({node:e,property:"name",type:Pe.type,modifier:[at.definition]}),"prune";if(yw(e)&&"kind"in e){n({node:e,property:"kind",type:Pe.function});return}if(os(e)&&"kind"in e&&n({node:e,property:"kind",type:Pe.function}),mw(e)||fp(e))return n({node:e,property:"key",type:Pe.property}),n({node:e,property:"value",type:Pe.variable,modifier:[at.definition,at.readonly]}),"prune";if((sw(e)||Ia(e))&&e.$cstNode){n({cst:e.$cstNode,type:Pe.variable,modifier:[at.definition,at.readonly]});return}if(Y_(e)&&Z(e.value)){n({node:e,property:"value",type:Pe.function});return}if((I_(e)||P_(e))&&Z(e.value)){n({node:e,property:"value",type:Pe.type,modifier:[at.definition,at.readonly]});return}if(Jh(e)&&Z(e.kind)&&n({node:e,property:"kind",type:Pe.type,modifier:[at.definition]}),Qh(e)&&Z(e.tag)&&n({node:e,property:"tag",type:Pe.type,modifier:[at.definition]}),Bu(e)||M_(e))return n({node:e,property:"el",type:e.parent?Pe.property:Pe.variable,modifier:[at.definition,at.readonly]}),e.parent?void 0:"prune";if(mp(e)){n({node:e,keyword:"color",type:Pe.keyword}),n({node:e,property:"name",type:Pe.type,modifier:[at.declaration,at.readonly]});return}if((Sa(e)||ka(e))&&n({node:e,property:"kind",type:Pe.type,modifier:[at.declaration,at.readonly]}),Dw(e))return n({node:e,property:"values",type:Pe.interface});if(K_(e))return n({node:e,property:"name",type:Pe.type,modifier:[at.definition]});if((ww(e)||qu(e)&&ya(e.$container))&&n({node:e,property:"key",type:Pe.property}),cp(e))return n({node:e,property:"key",type:Pe.property}),n({node:e,property:"value",type:Pe.number}),"prune";if(op(e)||ss(e)||SK(e))return n({node:e,property:"key",type:Pe.property}),"value"in e&&e.value&&n({node:e,property:"value",type:Pe.string}),ss(e)&&e.libicon&&n({node:e,property:"libicon",type:Pe.enum,modifier:[at.defaultLibrary]}),"prune";if(to(e)||pp(e)||_u(e)||Ju(e)||qh(e))return n({node:e,property:"key",type:Pe.property}),"value"in e&&n({node:e,property:"value",type:Pe.enum}),"prune";if(Mr(e))return this.highlightAstElement(e,n);if(Zv(e))return this.highlightView(e,n)}highlightAstElement(e,n){n({node:e,property:"name",type:Pe.variable,modifier:[at.declaration,at.readonly]}),n({node:e,property:"kind",type:Pe.keyword,modifier:[]})}highlightView(e,n){e.name&&n({node:e,property:"name",type:Pe.variable,modifier:[at.declaration,at.readonly,"local"]})}}const{findNodeForProperty:mV}=Od,{toDocumentSegment:oA}=CF;function yV(t,e,n){const r=mV(e.$cstNode,"name");return{documentUri:n.uri,name:e.name,...e.$cstNode&&{selectionSegment:oA(e.$cstNode)},...r&&{nameSegment:oA(r)},path:t.getAstNodePath(e),type:Lr}}function vV(t,e){const n=t.c4fqnIndex=new _r,r=t.parseResult.value.models.flatMap(a=>a.elements);if(r.length===0)return;const i=e.workspace.AstNodeLocator,s=r.map(a=>[a,null]);let o;for(;o=s.shift();)try{const[a,c]=o;if(os(a))continue;if(ba(a)){if(It(a.body)&&!Hi(a.body.elements)){const u=bp(a.element);for(const l of a.body.elements)s.push([l,u])}continue}if(Mr(a)){const u=KN(a.name,c);if(n.add(u,{...yV(i,a,t),fqn:u}),eA.writeId(a,u),It(a.body)&&!Hi(a.body.elements))for(const l of a.body.elements)s.push([l,u]);continue}$e(a)}catch(a){zt(a)}}class wV{constructor(e){this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments,e.shared.workspace.DocumentBuilder.onBuildPhase(Fe.IndexedContent,async(n,r)=>{for(const i of n)if(Dp(i)){delete i.c4fqnIndex,delete i.c4Elements,delete i.c4Specification,delete i.c4Relations,delete i.c4Views;try{vV(i,e)}catch(s){vt(s)}}return await Promise.resolve()}),Re.debug("[FqnIndex] Created")}langiumDocuments;get documents(){return this.langiumDocuments.all.filter(tA)}entries(e){return this.documents.flatMap(n=>n.c4fqnIndex.keys().filter(e).flatMap(r=>n.c4fqnIndex.get(r)))}getFqn(e){return eA.readId(e)??null}byFqn(e){return this.documents.flatMap(n=>n.c4fqnIndex.get(e))}directChildrenOf(e){return je([e]).flatMap(n=>{const r=this.entries(i=>Tt(i)===n).map(i=>[i.name,i]).toArray();return r.length===0?[]:new _r(r).entriesGroupedByKey().flatMap(([i,s])=>s.length===1?s:[]).iterator()})}uniqueDescedants(e){return new kt(()=>{const n=`${e}.`,r=new Set,i=[],s=new _r;if(this.entries(o=>o.startsWith(n)).forEach(o=>{const a=Ga(o.fqn),c={...o,name:a};Tt(o.fqn)===e?(r.add(a),s.add(a,c)):i.push(c)}),s.size+i.length===0)return null;for(const o of i)r.has(o.name)||s.add(o.name,o);return s.entriesGroupedByKey().flatMap(([o,a])=>a.length===1?a:[]).iterator()},n=>n?n.next():Ut)}}function bV(t){const e=new Map;for(const n of t)if(o2(n)&&n.viewOf&&$t(n.extends)){const r=e.get(n.viewOf)??[];r.push(n.id),e.set(n.viewOf,r)}for(const{id:n,nodes:r}of t)for(const i of r){if(i.navigateTo)continue;const s=q1(e.get(i.id)??[],o=>o!==n);s&&(i.navigateTo=s)}return t}function DV(t){const e=new bu.Graph({directed:!0,multigraph:!1,compound:!1});for(const n of Ff(t))e.setNode(n.id),_b(n)&&e.setEdge(n.id,n.extends);if(e.edgeCount()===0)return t;for(;!MH(e);){const n=iu(LH(e));if(!n)break;const r=ru(n);if(!r)break;e.removeNode(r)}return w_(e,e.sources()).reduce((n,r)=>{const i=t[r];if(!i)return n;if(_b(i)){const s=n[i.extends];return s?Object.assign(n,{[i.id]:{...s,...i,rules:[...s.rules,...i.rules]}}):(Ye.debug(`View "${i.id}" extends from "${i.extends}" which does not exist`),n)}return Object.assign(n,{[i.id]:i})},{})}function EV(t,e="/"){const n=ze(t,ct(c=>c.docUri),Ve(Z),Ar());if(n.length===0)return"";if(n.length===1){const c=kh(n[0]).pathname.split(e);return c.length<=1?e:(c.pop(),c.join(e)+e)}ce(Ir(n,2),"Expected at least 2 unique URIs");const[r,...i]=n,s=kh(r).pathname.split(e);let o=s.length;for(const c of i){if(c===r)continue;const u=kh(c).pathname.split(e);for(let l=0;l<o;l++)u[l]!==s[l]&&(o=l);if(o===0)return""}const a=s.slice(0,o).join(e);return a.endsWith(e)?a:a+e}function TV(t){const e="/",n=EV(t,e);return t.map(r=>{if(!r.docUri)return{view:r,parts:[]};let i=kh(r.docUri).pathname;return n.length>0?(ce(i.startsWith(n),`Expect path "${i}" to start with common prefix: "${n}"`),i=i.slice(n.length)):i=i.includes(e)?i.slice(i.lastIndexOf(e)+1):i,{view:r,parts:i.split(e)}}).sort((r,i)=>{if(r.parts.length!==i.parts.length)return r.parts.length-i.parts.length;for(let s=0;s<r.parts.length;s++){const o=ad(r.parts[s],i.parts[s]);if(o!==0)return o}return ad(r.view.title??r.view.id,i.view.title??i.view.id)}).map(({parts:r,view:i})=>({...i,relativePath:r.join(e)}))}function RV(t,e){const n={tags:new Set,elements:{},relationships:{},colors:{}};GU(ct(e,xr("c4Specification")),f=>{f.tags.forEach(h=>n.tags.add(h)),Object.assign(n.elements,f.elements),Object.assign(n.relationships,f.relationships),Object.assign(n.colors,f.colors)});function r(f,h){return ct(h,p=>{try{const y=t.lsp.DocumentLinkProvider.relativeLink(f,p.url);if(y&&y!==p.url)return{...p,relative:y}}catch(y){vt(y)}return p})}const i=Gi(n.colors,f=>pF(f.color));function s(f){return({tags:h,links:p,style:{color:y,shape:T,icon:b,opacity:v,border:D},id:k,kind:P,title:M,description:I,technology:G,metadata:U})=>{try{const W=n.elements[P];if(!W)return Re.warn(`No kind '${P}' found for ${k}`),null;const A=p?r(f,p):null;return y??=W.style.color,T??=W.style.shape,b??=W.style.icon,v??=W.style.opacity,D??=W.style.border,G??=W.technology,{...y&&{color:y},...T&&{shape:T},...b&&{icon:b},...U&&!Hi(U)&&{metadata:U},...W.notation&&{notation:W.notation},style:{...D&&{border:D},...B1(v)&&{opacity:v}},links:A,tags:h??null,technology:G??null,description:I??null,title:M,kind:P,id:k}}catch(W){vt(W)}return null}}const o=ze(e,Ki(f=>ct(f.c4Elements,s(f))),Ve(Z),DF,N1((f,h)=>{const p=Tt(h.id);return p&&$t(f[p])?(vt(`No parent found for ${h.id}`),f):(f[h.id]=h,f)},{}));function a(f){return({astPath:h,source:p,target:y,kind:T,links:b,id:v,...D})=>{if($t(o[p])||$t(o[y]))return Re.warn(`Invalid relation ${v}, source: ${p}(${!!o[p]}), target: ${y}(${!!o[y]})`),null;const k=b?r(f,b):null;return Pr(T)&&T in n.relationships?{...n.relationships[T],...D,...k&&{links:k},source:p,target:y,kind:T,id:v}:{...k&&{links:k},...D,source:p,target:y,id:v}}}const c=ze(e,Ki(f=>ct(f.c4Relations,a(f))),Ve(Z),nu(Ha),O1(),tv(xr("id")));function u(f){const h=f.uri.toString();return p=>{let{id:y,title:T,description:b,tags:v,links:D,astPath:k,...P}=p;p.__==="element"&&$t(T)&&"viewOf"in p&&(T=o[p.viewOf]?.title??null),$t(T)&&y==="index"&&(T="Landscape view");const M=D?r(f,D):null;return{...P,tags:v,links:M,docUri:h,description:b,title:T,id:y,customColorDefinitions:i}}}const l=e.flatMap(f=>ct(f.c4Views,u(f)));l.some(f=>f.id==="index")||l.unshift({__:"element",id:"index",title:"Landscape view",description:null,tags:null,links:null,customColorDefinitions:i,rules:[{include:[{wildcard:!0}]}]});const d=ze(l,TV,tv(xr("id")),DV);return{specification:{tags:Array.from(n.tags),elements:n.elements,relationships:n.relationships},elements:o,relations:c,views:d}}const Rw="ParsedLikeC4Model",Sw="ComputedLikeC4Model";class SV{constructor(e){this.services=e,this.langiumDocuments=e.shared.workspace.LangiumDocuments;const n=e.likec4.ModelParser;e.shared.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.notifyListeners(i)}),e.shared.workspace.DocumentBuilder.onBuildPhase(Fe.Validated,async(r,i)=>{let s=[];try{Re.debug(`[ModelBuilder] onValidated (${r.length} docs)`);for(const o of n.parse(r))s.push(o.uri)}catch(o){vt(o)}return s.length>0&&this.notifyListeners(s),await Promise.resolve()}),Re.debug("[ModelBuilder] Created")}langiumDocuments;listeners=[];unsafeSyncBuildModel(){return this.services.WorkspaceCache.get(Rw,()=>{const e=this.documents();return e.length===0?(Re.debug("[ModelBuilder] No documents to build model from"),null):(Re.debug(`[ModelBuilder] onValidated (${e.length} docs)`),RV(this.services,e))})}async buildModel(e){const n=this.services.WorkspaceCache;return n.has(Rw)?n.get(Rw):await this.services.shared.workspace.WorkspaceLock.read(async()=>(e&&await Pt(e),this.unsafeSyncBuildModel()))}previousViews={};unsafeSyncBuildComputedModel(e){const n=this.services.WorkspaceCache,r=this.services.WorkspaceCache;return n.get(Sw,()=>{const i=new $_(e),s=[];for(const a of Ff(e.views)){const c=Jl(a)?R_(a,i):S_(a,i);if(!c.isSuccess){vt(c.error);continue}s.push(c.view)}bV(s);const o=di(s,a=>{const c=this.previousViews[a.id],u=c&&e_(a,c)?c:a;return r.set(aA(a.id),u),[a.id,u]});return this.previousViews={...o},{specification:e.specification,elements:e.elements,relations:e.relations,views:o}})}async buildComputedModel(e){const n=this.services.WorkspaceCache;return n.has(Sw)?n.get(Sw):await this.services.shared.workspace.WorkspaceLock.read(async()=>{e&&await Pt(e);const r=this.unsafeSyncBuildModel();return r?this.unsafeSyncBuildComputedModel(r):null})}async computeView(e,n){const r=this.services.WorkspaceCache,i=aA(e);return r.has(i)?r.get(i):await this.services.shared.workspace.WorkspaceLock.read(async()=>(n&&await Pt(n),r.get(i,()=>{const s=this.unsafeSyncBuildModel(),o=s?.views[e];if(!o)return Re.warn(`[ModelBuilder] Cannot find view ${e}`),null;const a=new $_(s),c=Jl(o)?R_(o,a):S_(o,a);if(!c.isSuccess)return zt(c.error),null;let u=c.view;const l=ze(s.views,Ff(),Ve(Ab),Ve(f=>f.id!==e),Lf(f=>f.viewOf));for(const f of u.nodes)if(!f.navigateTo){const h=l[f.id];h&&(f.navigateTo=h[0].id)}const d=this.previousViews[e];return u=d&&e_(u,d)?d:u,this.previousViews[e]=u,u})))}onModelParsed(e){return this.listeners.push(e),Vs.create(()=>{const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)})}documents(){return this.langiumDocuments.all.filter(Sl).toArray()}notifyListeners(e){for(const n of this.listeners)try{n(e)}catch(r){zt(r)}}}function aA(t){return`computed-view-${t}`}const{findNodeForKeyword:$V,findNodeForProperty:Tp}=Od,{getDocument:kV}=kd;class CV{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,this.langiumDocuments=e.shared.workspace.LangiumDocuments}fqnIndex;langiumDocuments;documents(){return this.langiumDocuments.all.filter(Sl)}getParsedElement(e){const n=this.fqnIndex.getFqn(e);if(!n)return null;const r=kV(e);return Sl(r)?r.c4Elements.find(i=>i.id===n)??null:null}locateElement(e,n){const r=this.fqnIndex.byFqn(e).head(),i=r?.nameSegment??r?.selectionSegment;return!r||!i?null:{uri:r.documentUri.toString(),range:i.range}}locateRelation(e){for(const n of this.documents()){const r=n.c4Relations.find(o=>o.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(!os(i))continue;let s=i.title?Tp(i.$cstNode,"title"):void 0;if(s??=i.kind?Tp(i.$cstNode,"kind"):void 0,s??=Tp(i.$cstNode,"target"),s??=i.$cstNode,!!s)return{uri:n.uri.toString(),range:s.range}}return null}locateViewAst(e){for(const n of this.documents()){const r=n.c4Views.find(s=>s.id===e);if(!r)continue;const i=this.services.workspace.AstNodeLocator.getAstNode(n.parseResult.value,r.astPath);if(Zv(i))return{doc:n,view:r,viewAst:i}}return null}locateView(e){const n=this.locateViewAst(e);if(!n)return null;const r=n.viewAst;let i=r.name?Tp(r.$cstNode,"name"):void 0;return i??=$V(r.$cstNode,"view"),i??=r.$cstNode,i?{uri:n.doc.uri.toString(),range:i.range}:null}}function $w(...t){var e=t.length>1?t.join(":::"):t[0];return vz(e).toString(36)}function _V({nodes:t,edges:e,...n}){return{...n,nodes:Gi(t,({x:r,y:i,width:s,height:o,isCompound:a,...c})=>({...c,b:[r,i,s,o],c:a})),edges:Gi(e,({points:r,controlPoints:i,labelBBox:s,dotpos:o,...a})=>({...!!i&&{cp:i},...!!s&&{l:s},...!!o&&{dp:o},...a,p:r}))}}function AV({nodes:t,edges:e,...n}){return{...n,nodes:Gi(t,({b:r,c:i,...s})=>({x:r[0],y:r[1],width:r[2],height:r[3],isCompound:i,...s})),edges:Gi(e,({p:r,cp:i,l:s,dp:o,...a})=>({...!!i&&{controlPoints:i},...!!s&&{labelBBox:s},...!!o&&{dotpos:o},...a,points:r}))}}function IV(t){const e=WG(_V(t)),n=oz(e),r=[];let i=0;const s=200;for(;i<n.length;)r.push(" * "+n.slice(i,Math.min(i+s,n.length))),i+=s;return r.unshift("/**"," * @likec4-generated(v1)"),r.push(" */"),r.join(`
1141
- `)}function cA(t){return t.includes("@likec4-generated")}function xV(t){if(!cA(t))throw new Error(`Not a likec4-generated comment: ${t}`);const e=t.trim().split(`
1142
- `).filter(r=>!r.includes("**")&&!r.includes("@likec4-")&&!r.includes("*/")).map(r=>r.replaceAll("*","").trim()).join(""),n=iz(e);return AV(ez(n))}const uA=({operator:t,not:e},n)=>t.startsWith("!=")?{neq:n}:t.startsWith("=")?{eq:n}:e?{neq:n}:{eq:n};function kl(t){switch(!0){case IK(t):{const e=t.value?.ref?.name;return ce(e,"Expected tag name"),{tag:uA(t,e)}}case _K(t):{const e=t.value?.ref?.name;return ce(e,"Expected kind name"),{kind:uA(t,e)}}case(V_(t)||X_(t)):return{not:kl(t.value)};case WK(t):{const e=kl(t.left),n=kl(t.right),r=t.operator.toLowerCase();switch(r){case"and":{const i=[gg(e)?e.and:e,gg(n)?n.and:n].flat();return ce(Ns(i),"Expected non-empty array"),{and:i}}case"or":{const i=[mg(e)?e.or:e,mg(n)?n.or:n].flat();return ce(Ns(i),"Expected non-empty array"),{or:i}}default:$e(r)}}default:$e(t)}}const{getDocument:kw}=kd;function io(t){return Pr(t)?Bt(t).split(`
1143
- `).join(" "):void 0}function Bt(t){return Pr(t)?Mv(t).trim():void 0}class PV{constructor(e){this.services=e,this.fqnIndex=e.likec4.FqnIndex,Re.debug("[ModelParser] Created")}fqnIndex;parse(e){const n=Array.isArray(e)?e:[e],r=[];for(const i of n){if(!tA(i)){Re.warn(`Not a FqnIndexedDocument: ${i.uri.toString(!0)}`);continue}try{r.push(this.parseLikeC4Document(i))}catch(s){zt(new Error(`Error parsing document ${i.uri.toString()}`,{cause:s}))}}return r}parseLikeC4Document(e){const n=eV(e),{isValid:r}=iV(n);return this.parseSpecification(n,r),this.parseModel(n,r),this.parseViews(n,r),n}parseSpecification(e,n){const{parseResult:r,c4Specification:i}=e,s=r.value.specifications.filter(n),o=s.flatMap(l=>l.elements.filter(n));for(const{kind:l,props:d}of o)try{const f=l.name;if(!Z(f))continue;if(f in i.elements){Re.warn(`Element kind "${f}" is already defined`);continue}const h=d.find(qu),p=di(d.filter(z_).filter(y=>Pr(y.value))??[],y=>[y.key,Bt(y.value)]);i.elements[f]={...p,style:{...Ep(h?.props,n)}}}catch(f){vt(f)}const a=s.flatMap(l=>l.relationships.filter(n));for(const{kind:l,props:d}of a)try{const f=l.name;if(!Z(f))continue;if(f in i.relationships){Re.warn(`Relationship kind "${f}" is already defined`);continue}const h=di(d.filter(H_).filter(p=>Pr(p.value))??[],p=>[p.key,Bt(p.value)]);i.relationships[f]={...h,...rA(d)}}catch(f){vt(f)}const c=s.flatMap(l=>l.tags.filter(n));for(const l of c){const d=l.tag.name;Z(d)&&i.tags.add(d)}const u=s.flatMap(l=>l.colors.filter(n));for(const{name:l,color:d}of u)try{const f=l.name;if(f in i.colors){Re.warn(`Custom color "${f}" is already defined`);continue}i.colors[f]={color:d}}catch(f){vt(f)}}parseModel(e,n){for(const r of sV(e,n)){if(Mr(r)){try{e.c4Elements.push(this.parseElement(r,n))}catch(i){vt(i)}continue}if(os(r)){try{e.c4Relations.push(this.parseRelation(r))}catch(i){vt(i)}continue}$e(r)}}parseElement(e,n){const r=this.resolveFqn(e),i=e.kind.$refText,s=this.convertTags(e.body),o=e.body?.props.find(qu)?.props,a=Ep(o,n),c=this.getMetadata(e.body?.props.find(__)),u=this.getAstNodePath(e);let[l,d,f]=e.props??[];const h=di(e.body?.props.filter(aw)??[],T=>[T.key,T.value||void 0]);l=io(l??h.title),d=Bt(h.description??d),f=io(h.technology??f);const p=this.convertLinks(e.body),y=e.body?.props.find(ss);if(y){const T=y.libicon?.ref?.name??y.value;Z(T)&&(a.icon=T)}return{id:r,kind:i,astPath:u,title:l??e.name,...c&&{metadata:c},...s&&{tags:s},...p&&Ns(p)&&{links:p},...Z(f)&&{technology:f},...Z(d)&&{description:d},style:a}}parseRelation(e){const n=oV(e),r=this.resolveFqn(n.target),i=this.resolveFqn(n.source),s=this.convertTags(e)??this.convertTags(e.body),o=this.convertLinks(e.body),a=e.kind?.ref?.name,c=this.getMetadata(e.body?.props.find(__)),u=this.getAstNodePath(e),l=di(e.body?.props.filter(hp).filter(T=>Pr(T.value))??[],T=>[T.key,T.value]),d=ze(e.body?.props??[],Ve(fp),ct(T=>T.value.view.ref?.name),Ve(Z),iu()),f=Bt(e.title??l.title)??"",h=Bt(l.description),p=Bt(e.technology)??io(l.technology),y=e.body?.props.find(ww);return{id:$w(u,i,r),astPath:u,source:i,target:r,title:f,...c&&{metadata:c},...Z(p)&&{technology:p},...Z(h)&&{description:h},...a&&{kind:a},...s&&{tags:s},...Ns(o)&&{links:o},...rA(y?.props),...d&&{navigateTo:d}}}parseViews(e,n){const r=e.parseResult.value.views.flatMap(i=>n(i)?i.views:[]);for(const i of r)try{if(!n(i))continue;e.c4Views.push(ep(i)?this.parseElementView(i,n):this.parseDynamicElementView(i,n))}catch(s){vt(s)}}parseViewRulePredicate(e,n){const r=[];let i=e.predicates;for(;i;){try{Z(i.value)&&n(i.value)&&r.unshift(this.parsePredicate(i.value,n))}catch(s){vt(s)}i=i.prev}return dw(e)?{include:r}:{exclude:r}}parsePredicate(e,n){if(vK(e))return this.parseElementPredicate(e,n);if(DK(e))return this.parseRelationPredicate(e,n);$e(e)}parseElementExpressionsIterator(e){const n=[];let r=e;for(;r;){try{n.unshift(this.parseElementExpr(r.value))}catch(i){vt(i)}r=r.prev}return n}parseElementPredicate(e,n){if(Zh(e))return this.parseElementPredicateWith(e,n);if(ow(e))return this.parseElementPredicateWhere(e);if(Jv(e))return this.parseElementExpr(e);$e(e)}parseElementExpr(e){if(Ia(e))return{wildcard:!0};if(Jh(e))return ce(e.kind,"ElementKindExpr kind is not resolved: "+e.$cstNode?.text),{elementKind:e.kind.$refText,isEqual:e.isEqual};if(Qh(e)){ce(e.tag,"ElementTagExpr tag is not resolved: "+e.$cstNode?.text);let n=e.tag.$refText;return n.startsWith("#")&&(n=n.slice(1)),{elementTag:n,isEqual:e.isEqual}}if(L_(e)){const n=bn(e.expand);return ce(n,"Element not found "+e.expand.$cstNode?.text),{expanded:this.resolveFqn(n)}}if(sw(e)){const n=bn(e.parent);return ce(n,"Element not found "+e.parent.$cstNode?.text),{element:this.resolveFqn(n),isDescedants:!0}}if(Bu(e)){const n=bn(e);return ce(n,"Element not found "+e.$cstNode?.text),{element:this.resolveFqn(n)}}$e(e)}parseElementPredicateWith(e,n){const r=this.parseElementPredicate(e.subject,n);return(e.custom?.props??[]).reduce((i,s)=>{if(mw(s)){const o=s.value.view.$refText;return Z(o)&&(i.custom.navigateTo=o),i}if(aw(s)){if(It(s.value)){let o=s.key==="description"?Bt(s.value):io(s.value);i.custom[s.key]=o||""}return i}if(ss(s)){const o=s.libicon?.ref?.name??s.value;return It(o)&&(i.custom[s.key]=o),i}if(to(s)){const o=$l(s);return It(o)&&(i.custom[s.key]=o),i}if(pp(s)||qh(s))return It(s.value)&&(i.custom[s.key]=s.value),i;if(cp(s))return It(s.value)&&(i.custom[s.key]=nA(s)),i;if(Ta(s))return Z(s.value)&&(i.custom[s.key]=Bt(s.value)),i;$e(s)},{custom:{expr:r}})}parseElementPredicateWhere(e){return{where:{expr:this.parseElementExpr(e.subject),condition:e.where?kl(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicate(e,n){if(vw(e)){const r=G_(e.subject)?e.subject.subject:e.subject;return this.parseRelationPredicateWith(e,r)}if(G_(e))return this.parseRelationPredicateWhere(e);if(Qv(e))return this.parseRelationExpr(e);$e(e)}parseRelationPredicateWhere(e){return{where:{expr:this.parseRelationExpr(e.subject),condition:e.where?kl(e.where):{kind:{neq:"--always-true--"}}}}}parseRelationPredicateWith(e,n){const r=this.parseRelationExpr(n);return(e.custom?.props??[]).reduce((i,s)=>{if(hp(s)||Ta(s)||U_(s))return It(s.value)&&(i.customRelation[s.key]=Bt(s.value)??""),i;if(_u(s))return Z(s.value)&&(i.customRelation[s.key]=s.value),i;if(to(s)){const o=$l(s);return Z(o)&&(i.customRelation[s.key]=o),i}if(Ju(s))return Z(s.value)&&(i.customRelation[s.key]=s.value),i;if(fp(s)){const o=s.value.view.ref?.name;return Z(o)&&(i.customRelation.navigateTo=o),i}$e(s)},{customRelation:{relation:r}})}parseRelationExpr(e){if(nw(e))return{source:this.parseElementExpr(e.source.from),target:this.parseElementExpr(e.target),isBidirectional:e.source.isBidirectional};if(fw(e))return{inout:this.parseElementExpr(e.inout.to)};if(yw(e))return{outgoing:this.parseElementExpr(e.from)};if(B_(e))return{incoming:this.parseElementExpr(e.to)};$e(e)}parseViewRule(e,n){if(tw(e))return this.parseViewRulePredicate(e,n);if(Aa(e)){const r=Ep(e.props.filter(ew),n),i=Bt(e.props.find(Ta)?.value);return{targets:this.parseElementExpressionsIterator(e.target),...i&&{notation:i},style:{...r}}}if(wp(e))return{autoLayout:iA(e.direction)};$e(e)}parseViewManualLaout(e){const n=pd(e.$cstNode,["BLOCK_COMMENT"]);if(!(!n||!cA(n.text)))try{return xV(n.text)}catch(r){const i=kw(e);Re.warn(r),Re.warn(`Ignoring manual layout of "${e.name??"unnamed"}" at ${i.uri.fsPath}:${1+(n.range.start.line||0)}`);return}}parseDynamicParallelSteps(e){return{__parallel:e.steps.map(n=>this.parseDynamicStep(n))}}parseDynamicStep(e){const n=bn(e.source);if(!n)throw new Error("Invalid reference to source");const r=bn(e.target);if(!r)throw new Error("Invalid reference to target");let i=this.resolveFqn(n),s=this.resolveFqn(r);const o=Bt(e.title)??null;let a={source:i,target:s,title:o};if(e.isBackward&&(a={source:s,target:i,title:o,isBackward:!0}),Array.isArray(e.custom?.props))for(const c of e.custom.props)try{if(hp(c)||Ta(c)||U_(c)){It(c.value)&&(a[c.key]=Bt(c.value)??"");continue}if(_u(c)){It(c.value)&&(a[c.key]=c.value);continue}if(to(c)){const u=$l(c);It(u)&&(a[c.key]=u);continue}if(Ju(c)){It(c.value)&&(a[c.key]=c.value);continue}if(fp(c)){const u=c.value.view.ref?.name;Z(u)&&(a.navigateTo=u);continue}$e(c)}catch(u){vt(u)}return a}parseElementView(e,n){const r=e.body;ce(r,"ElementView body is not defined");const i=this.getAstNodePath(e);let s=null;if("viewOf"in e){const h=bn(e.viewOf),p=h&&this.resolveFqn(h);p?s=p:Re.warn("viewOf is not resolved: "+e.$cstNode?.text)}let o=e.name;o||(o="view_"+$w(kw(e).uri.toString(),i,s??""));const a=io(r.props.find(h=>h.key==="title")?.value)??null,c=Bt(r.props.find(h=>h.key==="description")?.value)??null,u=this.convertTags(r),l=this.convertLinks(r),d=this.parseViewManualLaout(e),f={__:"element",id:o,astPath:i,title:a,description:c,tags:u,links:Ns(l)?l:null,rules:r.rules.flatMap(h=>{try{return n(h)?this.parseViewRule(h,n):[]}catch(p){return vt(p),[]}}),...s&&{viewOf:s},...d&&{manualLayout:d}};if(Tw.writeId(e,f.id),"extends"in e){const h=e.extends.view.ref;return ce(h?.name,"view extends is not resolved: "+e.$cstNode?.text),Object.assign(f,{extends:h.name})}return f}parseDynamicElementView(e,n){const r=e.body;ce(r,"DynamicElementView body is not defined");const i=r.props.filter(n),s=this.getAstNodePath(e);let o=e.name;o||(o="dynamic_"+$w(kw(e).uri.toString(),s));const a=io(i.find(f=>f.key==="title")?.value)??null,c=Bt(i.find(f=>f.key==="description")?.value)??null,u=this.convertTags(r),l=this.convertLinks(r);Tw.writeId(e,o);const d=this.parseViewManualLaout(e);return{__:"dynamic",id:o,astPath:s,title:a,description:c,tags:u,links:Ns(l)?l:null,rules:r.rules.reduce((f,h)=>{if(!n(h))return f;try{if(OK(h)){const p=[];let y=h.predicates;for(;y;){try{if(n(y.value)){const T=this.parseElementPredicate(y.value,n);p.unshift(T)}}catch(T){vt(T)}y=y.prev}return p.length>0&&f.push({include:p}),f}if(Aa(h)){const p=Ep(h.props.filter(ew),n),y=Bt(h.props.find(Ta)?.value),T=this.parseElementExpressionsIterator(h.target);return T.length>0&&f.push({targets:T,...y&&{notation:y},style:{...p}}),f}if(wp(h))return f.push({autoLayout:iA(h.direction)}),f;$e(h)}catch(p){return vt(p),f}},[]),steps:r.steps.reduce((f,h)=>{try{n(h)&&(O_(h)?f.push(this.parseDynamicParallelSteps(h)):f.push(this.parseDynamicStep(h)))}catch(p){vt(p)}return f},[]),...d&&{manualLayout:d}}}resolveFqn(e){if(ba(e))return bp(e.element);const n=this.fqnIndex.getFqn(e);return ce(n,`Not indexed element: ${this.getAstNodePath(e)}`),n}getAstNodePath(e){return this.services.workspace.AstNodeLocator.getAstNodePath(e)}getMetadata(e){return e?.props!=null?di(e.props,n=>[n.key,Bt(n.value)]):void 0}convertTags(e){let n=e?.tags;if(!n)return null;const r=[];for(;n;){try{const i=n.values.map(s=>s.ref?.name).filter(Z);i.length>0&&r.unshift(...i)}catch{}n=n.prev}return Ns(r)?r:null}convertLinks(e){if(!(!e?.props||e.props.length===0))return ze(e.props,Ve(op),Ki(n=>{const r=n.value;if(Z(r)){const i=Z(n.title)?io(n.title):void 0;return i?{url:r,title:i}:{url:r}}return[]}))}}const{findNodeForKeyword:NV,findNodeForProperty:nae}=Od,OV=(t,e,n=0)=>{const r=n>0?" ".repeat(n):"";return[r+`style ${t} {`,...Qo(e).map(([i,s])=>r+` ${i} ${i==="opacity"?s.toString()+"%":s}`),r+"}"]},FV=(t,e)=>n=>{if(!Aa(n))return!1;const r=n.target.value;if(!r||Z(n.target.prev)||!Bu(r))return!1;const i=r.el.ref;return(i?e.getFqn(i):null)===t};function LV(t,{view:e,viewAst:n,targets:r,style:i}){ce(n.body,`View ${e.id} has no body`);const s=n.$cstNode;ce(s,"viewCstNode");const o=ru(n.body.rules)?.$cstNode?.range.end??n.body.$cstNode?.range.end;ce(o,"insertPos is not defined");const a=s.range.start.character+2,c=t.likec4.FqnIndex,u=Ve(n.body.rules,Aa),l=e.__==="element"?e.viewOf:null,d=[],f=[];r.forEach(T=>{const b=ZU(u,FV(T,c)),v=l&&yr(l,T)?T.substring(l.length+1):T;b?d.push({fqn:v,rule:b}):f.push({fqn:v})});const h={start:o,end:o},p=T=>{T.start.line<=h.start.line&&(T.start.line==h.start.line?h.start.character=Math.min(T.start.character,h.start.character):h.start=T.start),T.end.line>=h.end.line&&(T.end.line==h.end.line?h.end.character=Math.max(T.end.character,h.end.character):h.end=T.end)},y=[];if(f.length>0){const T=f.flatMap(({fqn:b})=>OV(b,i,a));y.push(tn.insert(o,`
1144
- `+T.join(`
1145
- `))),h.start={line:o.line+1,character:a},h.end={line:o.line+T.length,character:ru(T)?.length??0}}if(d.length>0)for(const{rule:T}of d){const b=T.$cstNode;ce(b,"RuleCstNode not found");for(const[v,D]of Qo(i)){const k=v==="opacity"?D.toString()+"%":D,P=T.props.find(U=>U.key===v);if(P&&P.$cstNode){const{range:{start:U,end:W}}=P.$cstNode;p({start:U,end:W}),y.push(tn.replace({start:U,end:W},v+" "+k));continue}const M=NV(b,"{")?.range.end;ce(M,"Opening brace not found");const I=" ".repeat(2+b.range.start.character),G=I+v+" "+k;y.push(tn.insert(M,`
1146
- `+G)),p({start:{line:M.line+1,character:I.length},end:{line:M.line+1,character:G.length}})}}return{modifiedRange:h,edits:y}}const{findNodeForProperty:MV,findNodeForKeyword:BV}=Od;function jV(t,{view:e,viewAst:n,layout:r}){ce(n.body,`View ${e.id} has no body`);const i=n.$cstNode;ce(i,"viewCstNode");const s=cV(r),o=n.body.rules.findLast(wp);if(o&&o.$cstNode){const u=MV(o.$cstNode,"direction");return u?tn.replace(u.range,s):tn.replace(o.$cstNode.range,`autoLayout ${s}`)}const a=BV(n.body.$cstNode,"}")?.range.start;ce(a,"Closing brace not found");const c=` autoLayout ${s}
1147
- `+" ".repeat(a.character);return tn.insert(a,c)}function UV(t,{viewAst:e,layout:n}){ce(e.$cstNode,"invalid view.$cstNode");const r=pd(e.$cstNode,["BLOCK_COMMENT"]);let i=IV(n);return e.$cstNode.range.start.character>0&&(i=gG(i,e.$cstNode.range.start.character)),r?tn.replace(r.range,i.trimStart()):tn.insert({line:e.$cstNode.range.start.line,character:0},i+`
1148
- `)}class qV{constructor(e){this.services=e,this.locator=e.likec4.ModelLocator}locator;async applyChange(e){const n=this.services.shared.lsp.Connection;ce(n,"LSP Connection not available");let r=null;try{await this.services.shared.workspace.WorkspaceLock.write(async()=>{const{doc:i,edits:s,modifiedRange:o}=this.convertToTextEdit(e),a={uri:i.textDocument.uri,version:i.textDocument.version};if(!s.length)return;const c=await n.workspace.applyEdit({label:`LikeC4 - change view ${e.viewId}`,edit:{changes:{[a.uri]:s}}});if(!c.applied){n.window.showErrorMessage(`Failed to apply changes ${c.failureReason}`);return}r={uri:a.uri,range:o}})}catch(i){Ye.error(`Failed to apply change ${e.change.op} ${e.viewId}`,i)}return r}convertToTextEdit({viewId:e,change:n}){const r=this.locator.locateViewAst(e);if(!r)throw new Error(`LikeC4ModelChanges: view not found: ${e}`);switch(n.op){case"change-element-style":return{doc:r.doc,...LV(this.services,{...r,targets:n.targets,style:n.style})};case"change-autolayout":{const s=jV(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:s.range,edits:[s]}}case"save-manual-layout":const i=UV(this.services,{...r,layout:n.layout});return{doc:r.doc,modifiedRange:i.range,edits:[i]};default:$e(n)}}}class WV extends s1{async computeExports(e,n){const r=[];try{const{specifications:i,models:s,views:o,likec4lib:a}=e.parseResult.value;this.exportLibrary(a,r,e),this.exportSpecification(i,r,e),this.exportModel(s,r,e),this.exportViews(o,r,e)}catch(i){zt(i)}return r}exportViews(e,n,r){if(!($t(e)||e.length===0))for(const i of e.flatMap(s=>s.views))try{Z(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){zt(s)}}exportModel(e,n,r){if(!($t(e)||e.length===0))for(const i of e.flatMap(s=>s.elements))try{Mr(i)&&Z(i.name)&&n.push(this.descriptions.createDescription(i,i.name,r))}catch(s){zt(s)}}exportLibrary(e,n,r){if(!$t(e))try{for(const i of e.flatMap(s=>s.icons))n.push(this.descriptions.createDescription(i,i.name,r))}catch(i){zt(i)}}exportSpecification(e,n,r){if(!($t(e)||e.length===0))for(const i of e.flatMap(s=>[...s.elements,...s.relationships,...s.tags,...s.colors]))try{switch(!0){case Sa(i):{Z(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r));continue}case yp(i):{Z(i.tag.name)&&n.push(this.descriptions.createDescription(i.tag,"#"+i.tag.name,r));continue}case ka(i):{Z(i.kind.name)&&n.push(this.descriptions.createDescription(i.kind,i.kind.name,r),this.descriptions.createDescription(i.kind,"."+i.kind.name,r));continue}case mp(i):{Z(i.name.name)&&n.push(this.descriptions.createDescription(i.name,i.name.name,r));continue}default:$e(i)}}catch(s){zt(s)}}computeLocalScopes(e,n){return new Promise(r=>{const i=e.parseResult.value,s=new _r;for(const o of i.models)try{const a=this.processContainer(o,s,e);s.addAll(i,a.values())}catch(a){zt(a)}r(s)})}processContainer(e,n,r){const i=new _r,s=new _r;for(const o of e.elements){if(os(o))continue;let a;if(Mr(o)?(Z(o.name)&&i.add(o.name,this.descriptions.createDescription(o,o.name,r)),a=o.body):ba(o)&&(a=o.body),a&&a.elements.length>0)try{const c=this.processContainer(a,n,r);for(const[u,l]of c)s.add(u,l)}catch(c){zt(c)}}if(s.size>0)for(const[o,a]of s.entriesGroupedByKey())!i.has(o)&&a.length===1&&i.add(o,a[0]);return n.addAll(e,i.values()),i}}const{getDocument:GV}=kd;class zV extends l1{fqnIndex;constructor(e){super(e),this.fqnIndex=e.likec4.FqnIndex}directChildrenOf(e){return this.fqnIndex.directChildrenOf(e)}uniqueDescedants(e){return new kt(()=>{const n=e(),r=n&&this.fqnIndex.getFqn(n);return r?this.fqnIndex.uniqueDescedants(r).iterator():null},n=>n?n.next():Ut)}scopeElementRef(e){return this.uniqueDescedants(()=>e.el.ref)}scopeExtendElement({element:e}){return je([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>bn(e)))}scopeElementView({viewOf:e,extends:n}){return e?je([e.el.$nodeDescription]).nonNullable().concat(this.uniqueDescedants(()=>bn(e))):n?je([n]).flatMap(r=>{const i=r.view.ref;return i?this.scopeElementView(i):Po}):Po}getScope(e){try{const n=this.reflection.getReferenceType(e);if(n!==Lr)return this.getGlobalScope(n);try{const r=e.container;if(M_(r)&&e.property==="el"){const i=r.parent;return i?new eu(this.directChildrenOf(bp(i))):this.getGlobalScope(n)}if(Bu(r)&&e.property==="el"){const i=r.parent;if(i)return new eu(this.scopeElementRef(i));if(e.reference.$refText==="this"||e.reference.$refText==="it"){const s=un(r,Mr);return s?new o1([this.descriptions.createDescription(s,e.reference.$refText)]):a1}}return this.computeScope(e)}catch(r){return Re.warn(r),this.getGlobalScope(n)}}catch(n){return Re.warn(n),a1}}computeScope(e){const n=this.reflection.getReferenceType(e);ce(n===Lr,"Invalid reference type");const r=[],i=GV(e.container).precomputedScopes;if(i){const s=a=>this.reflection.isSubtype(a.type,n);let o=e.container;for(;o;){const a=i.get(o).filter(s);a.length>0&&r.push(je(a)),lw(o)&&r.push(this.scopeExtendElement(o.$container)),cw(o)&&r.push(this.scopeElementView(o.$container)),o=o.$container}}return r.reduceRight((s,o)=>this.createScope(o,s),this.getGlobalScope(n))}getGlobalScope(e){return new eu(this.indexManager.allElements(e))}}class HV{constructor(e){this.services=e}disposables=[];init(){const e=this.services.likec4.ModelBuilder,n=this.services.likec4.ModelLocator,r=this.services.likec4.ModelChanges,i=this.services.shared.lsp.Connection;if(!i){Re.info("[ServerRpc] no connection, not initializing");return}Re.info("[ServerRpc] init");const s=this.services.shared.workspace.LangiumDocuments,o=this.services.shared.workspace.DocumentBuilder,a=r7(()=>{i.sendNotification(uz,"").catch(u=>(Re.error(`[ServerRpc] error sending onDidChangeModel: ${u}`),Promise.resolve()))},{timing:"both",waitMs:300,maxWaitMs:600});let c=!0;this.disposables.push(Vs.create(()=>{a.cancel()}),e.onModelParsed(()=>a.call()),i.onRequest(dz,async({cleanCaches:u},l)=>(u&&this.services.WorkspaceCache.clear(),{model:await e.buildComputedModel(l)})),i.onRequest(lz,async u=>({model:await e.buildModel(u)})),i.onRequest(fz,async({viewId:u},l)=>({view:await e.computeView(u,l)})),i.onRequest(hz,async({docs:u},l)=>{const d=u.map(p=>Wt.parse(p)),f=p=>d.every(y=>!yt.equals(y,p)),h=s.all.filter(p=>Dp(p)&&f(p.uri)&&p.uri.scheme!==WC).map(p=>p.uri).toArray();Re.debug(`[ServerRpc] received request to build:
1149
- changed (total ${d.length}):${u.map(p=>`
1150
- - `+p).join("")}
1151
- deleted (total ${h.length}):${h.map(p=>`
1152
- - `+p.toString()).join(`
1153
- `)}`),!c&&d.length+h.length>0&&(await Promise.allSettled([...d,...h].map(async p=>{const y=p.toString();Re.debug(`clear diagnostics for ${y}`);try{await i.sendDiagnostics({uri:y,diagnostics:[]})}catch(T){Re.warn(`error clearing diagnostics for ${y}: ${T}`)}})),await Pt(l)),c=!1,await o.update(d,h,l)}),i.onRequest(pz,u=>{if("element"in u)return n.locateElement(u.element,u.property??"name");if("relation"in u)return n.locateRelation(u.relation);if("view"in u)return n.locateView(u.view);$e(u)}),i.onRequest(gz,async(u,l)=>await r.applyChange(u)))}dispose(){let e;for(;e=this.disposables.pop();)try{e.dispose()}catch(n){zt(n)}}}class KV{constructor(e){this.services=e}getSymbolKind(e){const n=lt(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(Lr,wa):return ir.Constructor;case r(Da,Ea,Ca):return ir.Namespace;case r(eo):return ir.Class;case r(cs,ro,no,_a):return ir.EnumMember;case r(as,$a):return ir.Event;case r(is,Ra):return ir.TypeParameter}return ir.Field}getCompletionItemKind(e){const n=lt(e)?e.$type:e.type,r=(...i)=>i.some(s=>this.services.AstReflection.isSubtype(n,s));switch(!0){case r(no):return kr.Color;case r(Lr,wa):return kr.Constructor;case r(Da,Ea,Ca):return kr.Module;case r(eo):return kr.Class;case r(cs,ro,no,_a):return kr.EnumMember;case r(as,$a):return kr.Event;case r(is,Ra):return kr.TypeParameter;default:return kr.Reference}}}class VV extends f1{documentFactory;constructor(e){super(e),this.documentFactory=e.workspace.LangiumDocumentFactory}async loadAdditionalDocuments(e,n){n(this.documentFactory.fromString(az,Wt.parse(cz))),await super.loadAdditionalDocuments(e,n)}workspace(){return this.folders&&Ug(this.folders,1)?this.folders[0]:null}get workspaceUri(){const e=this.workspace();return ce(e,"Workspace not initialized"),Wt.parse(e.uri)}get workspaceURL(){const e=this.workspace();return ce(e,"Workspace not initialized"),new URL(e.uri)}}class YV extends mC{}const XV=t=>(e,n)=>{const r=sA(e.value);switch(!0){case Jh(r):case Qh(r):case Ia(r):{n("warning","Predicate is ignored, as not supported in dynamic views",{node:e});return}}},JV=t=>{const e=t.likec4.FqnIndex;return(n,r)=>{try{const i=bn(n.source),s=i&&e.getFqn(i);s||r("error","Source not found (not parsed/indexed yet)",{node:n,property:"source"});const o=bn(n.target),a=o&&e.getFqn(o);a||r("error","Target not found (not parsed/indexed yet)",{node:n,property:"target"}),s&&a&&(yr(s,a)||yr(a,s))&&r("error","Invalid parent-child relationship",{node:n})}catch(i){zt(i)}}},Rp=["this","it","self","super","likec4lib"];function Sp(t){return async(e,n,r)=>{r&&await Pt(r);try{await t(e,n,r)}catch(i){vt(i)}}}const{getDocument:ZV}=kd,QV=t=>{const e=t.likec4.FqnIndex,n=t.workspace.AstNodeLocator;return Sp((r,i)=>{const s=e.getFqn(r);if(!s){i("error","Not indexed element",{node:r,property:"name"});return}Rp.includes(r.name)&&i("error",`Reserved word: ${r.name}`,{node:r,property:"name"});const o=ZV(r).uri,a=n.getAstNodePath(r),c=e.byFqn(s).filter(u=>u.documentUri!==o||u.path!==a).head();if(c){const u=c.documentUri!==o;i("error",`Duplicate element name ${r.name!==s?r.name+" ("+s+")":r.name}`,{node:r,property:"name",...u&&{relatedInformation:[{location:{range:c.nameSegment?.range??c.selectionSegment?.range,uri:c.documentUri.toString()},message:"conflicting element"}]}})}})},eY=t=>(e,n)=>{const r=parseFloat(e.value);(isNaN(r)||r<0||r>100)&&n("warning","Value ignored, must be between 0% and 100%",{node:e,property:"value"})},tY=t=>(e,n)=>{const r=e.$container;r.props.some(i=>ss(i)&&i!==e)&&n("error","Icon must be defined once",{node:e}),qu(r)&&ya(r.$container)&&r.$container.props.some(i=>ss(i))&&n("warning","Redundant as icon defined on element",{node:e})},nY=t=>(e,n)=>{am(e,iw)||n("error","Notes can be defined only inside dynamic view",{node:e})},rY=t=>{const e=t.likec4.FqnIndex;return Sp((n,r)=>{const i=bn(n.target),s=i&&e.getFqn(i);s||r("error","Target not resolved",{node:n,property:"target"});let o;if(It(n.source)){if(o=bn(n.source),!o)return r("error","Source not resolved",{node:n,property:"source"})}else{if(!ya(n.$container))return r("error","Sourceless relation must be nested",{node:n});o=n.$container.$container}const a=e.getFqn(o);a||r("error","Source not resolved",{node:n}),a&&s&&ud(a,s)&&r("error","Invalid parent-child relationship",{node:n})})},iY=t=>Sp((e,n)=>{e.$container.tags?.values&&e.tags?.values&&n("error","Relation cannot have tags in both header and body",{node:e.tags})}),sY=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one specification per document",{node:e,property:"name"})},oY=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one model per document",{node:e,property:"name"})},aY=t=>(e,n)=>{e.$containerIndex&&e.$containerIndex>0&&n("warning","Prefer one views block per document",{node:e,property:"name"})},cY=t=>{const e=t.shared.workspace.IndexManager;return Sp((n,r)=>{Rp.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"});const i=e.allElements(is).filter(s=>s.name===n.name&&s.node!==n).head();if(i){const s=i.documentUri!==Xt(n).uri;r("error",`Duplicate element kind '${n.name}'`,{node:n,property:"name",...s&&{relatedInformation:[{location:{range:i.nameSegment.range,uri:i.documentUri.toString()},message:"conflicting definition"}]}})}})},uY=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{const i="#"+n.name,s=e.allElements(cs).filter(o=>o.name===i&&o.node!==n).head();if(s){const o=s.documentUri!==Xt(n).uri;r("error",`Duplicate tag '${n.name}'`,{node:n,property:"name",...o&&{relatedInformation:[{location:{range:s.nameSegment.range,uri:s.documentUri.toString()},message:"conflicting definition"}]}})}}},lY=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{Rp.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(as).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate RelationshipKind '${n.name}'`,{node:n,property:"name"})}},dY=t=>{const e=t.shared.workspace.IndexManager;return(n,r)=>{n.name&&(Rp.includes(n.name)&&r("error",`Reserved word: ${n.name}`,{node:n,property:"name"}),e.allElements(eo).filter(i=>i.name===n.name).limit(2).count()>1&&r("error",`Duplicate view '${n.name}'`,{node:n,property:"name"}))}},fY=t=>(e,n)=>{const r=un(e,tw);np(r)&&n("error",'Invalid usage inside "exclude"',{node:e});const i=ow(e.subject)?e.subject.subject:e.subject;switch(!0){case Bu(i):case sw(i):case L_(i):case Ia(i):return;case Jh(i):case Qh(i):n("error","Invalid target (expect reference to specific element)",{node:e,property:"subject"});return;default:$e(i)}},hY=t=>(e,n)=>{am(e,Qv)&&n("warning","Redundant usage, expand predicate resolves parent element only when used in relations",{node:e})},pY=t=>(e,n)=>{if(Ia(e.to)&&!fw(e.$container)){const r=un(e,ep);$t(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}},gY=t=>(e,n)=>{if(Ia(e.from)&&!nw(e.$container)){const r=un(e,ep);$t(r?.viewOf)&&n("warning","Predicate is ignored as it concerns all relationships",{node:e})}},mY=t=>(e,n)=>{const r=un(e,tw);np(r)&&n("error",'Invalid usage inside "exclude"',{node:e})};function yY(t){Re.info("registerValidationChecks"),t.validation.ValidationRegistry.register({NotesProperty:nY(),OpacityProperty:eY(),IconProperty:tY(),SpecificationRule:sY(),Model:oY(),ModelViews:aY(),DynamicViewStep:JV(t),LikeC4View:dY(t),Element:QV(t),ElementKind:cY(t),Relation:rY(t),RelationBody:iY(),Tag:uY(t),DynamicViewPredicateIterator:XV(),ElementPredicateWith:fY(),RelationPredicateWith:mY(),ExpandElementExpression:hY(),RelationshipKind:lY(t),IncomingRelationExpression:pY(),OutgoingRelationExpression:gY()});const e=t.shared.lsp.Connection;e&&t.shared.workspace.DocumentBuilder.onUpdate((n,r)=>{for(const i of r)Re.debug(`clear diagnostics for deleted ${i.path}`),e.sendDiagnostics({uri:i.toString(),diagnostics:[]})})}function vY(t,e){return[t,e]=lA(t,e)>0?[e,t]:[t,e],wY(t.range,e.range.start)}function lA(t,e){const n=t.range.start.line-e.range.start.line;return n!==0?n:t.range.start.character-e.range.start.character}function wY(t,e){return!(e.line<t.start.line||e.line>t.end.line||e.line==t.start.line&&e.character<t.start.character||e.line==t.end.line&&e.character>t.end.character)}function dA(t){return t.range.start.line!=t.range.end.line}const ee={newLine:ts.newLine({allowMore:!0}),oneSpace:ts.oneSpace(),noSpace:ts.noSpace(),indent:ts.indent({allowMore:!0}),noIndent:ts.noIndent()};class bY extends SW{format(e){this.removeIndentFromTopLevelStatements(e),this.indentContentInBraces(e),this.formatSpecificationRule(e),this.formatElementDeclaration(e),this.formatRelation(e),this.formatView(e),this.formatViewRuleStyle(e),this.formatIncludeExcludeExpressions(e),this.formatWhereExpression(e),this.formatWithPredicate(e),this.formatLeafProperty(e),this.formatMetadataProperty(e),this.formatAutolayoutProperty(e),this.formatLinkProperty(e),this.formatNavigateToProperty(e),this.formatTags(e)}formatTags(e){this.on(e,Dw,(n,r)=>{r.cst(Lo(n.$cstNode,"values").slice(1)).prepend(ee.oneSpace),r.keywords(",").prepend(ee.noSpace).append(ee.oneSpace)})}formatRelation(e){this.on(e,os,(n,r)=>{const i=n?.source?.$cstNode?[n?.source?.$cstNode]:[];r.cst(i).append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace),r.properties("target","title","technology","tags").prepend(ee.oneSpace)}),this.on(e,iw,(n,r)=>{r.properties("source").append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace),r.properties("target","title").prepend(ee.oneSpace)}),this.on(e,nw)?.property("target").prepend(ee.oneSpace),this.on(e,yw,(n,r)=>{r.property("from").append(ee.oneSpace),r.keywords("]->").prepend(ee.noSpace),r.keywords("-[").append(ee.noSpace)}),this.on(e,B_)?.keywords("->").append(ee.oneSpace),this.on(e,fw)?.keyword("->").prepend(ee.oneSpace)}removeIndentFromTopLevelStatements(e){(pw(e)||bw(e)||gw(e)||j_(e))&&this.getNodeFormatter(e).keywords("specification","model","views","likec4lib").prepend(ee.noIndent)}indentContentInBraces(e){if(j_(e)||bw(e)||Sa(e)||ka(e)||pw(e)||ya(e)||lw(e)||W_(e)||ww(e)||jK(e)||gw(e)||cw(e)||N_(e)||Aa(e)||xK(e)||PK(e)||qu(e)){const n=this.getNodeFormatter(e),r=n.keywords("{"),i=n.keywords("}"),s=n.interior(r,i);let o=null;for(const a of s.nodes)(!o||!vY(o,a))&&n.cst([a]).prepend(ee.indent),o=a;r.prepend(ee.noIndent).prepend(ee.oneSpace),i.prepend(ee.noIndent).prepend(ts.newLine({allowMore:!0}))}}appendKeywordsWithSpace(e){this.on(e,LK)?.keywords("element").append(ee.oneSpace)}formatView(e){this.on(e,ep,(n,r)=>{(n.extends||n.viewOf||n.name)&&r.keywords("view").append(ee.oneSpace),r.keywords("of","extends").surround(ee.oneSpace)}),this.on(e,NK)?.keywords("dynamic","view").append(ee.oneSpace)}formatLeafProperty(e){if(aw(e)||hp(e)||qK(e)||Ta(e)||z_(e)||H_(e)||to(e)||Ju(e)||_u(e)||ss(e)||pp(e)||qh(e)||cp(e)){const n=this.getNodeFormatter(e);n.keywords("title","description","technology","notation","color","line","head","tail","icon","shape","border","opacity").append(ee.oneSpace),n.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),n.keyword(";").prepend(ee.noSpace).append(ee.newLine)}}formatLinkProperty(e){this.on(e,op,(n,r)=>{r.keyword("link").append(ee.oneSpace),r.property("value").append(ee.oneSpace),r.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),r.keyword(";").prepend(ee.noSpace).append(ee.newLine)})}formatNavigateToProperty(e){this.on(e,mw)?.property("key").append(ee.oneSpace)}formatAutolayoutProperty(e){this.on(e,wp)?.keyword("autoLayout").append(ee.oneSpace)}formatMetadataProperty(e){this.on(e,BK,(n,r)=>{r.property("key").append(ee.oneSpace),r.keyword(":").prepend(ee.noSpace).append(ee.oneSpace),r.keyword(";").prepend(ee.noSpace).append(ee.newLine)})}formatElementDeclaration(e){this.on(e,Mr,(n,r)=>{const i=En(n.$cstNode,"kind"),s=En(n.$cstNode,"name");s&&i&&(lA(s,i)>0?r.cst([i]).append(ee.oneSpace):(r.cst([s]).append(ee.oneSpace),r.cst([i]).prepend(ee.oneSpace))),r.properties("props").prepend(ee.oneSpace)})}formatSpecificationRule(e){if((Sa(e)||ka(e)||yp(e))&&this.getNodeFormatter(e).keywords("element","relationship","tag").append(ee.oneSpace),mp(e)){const n=this.getNodeFormatter(e);n.keyword("color").append(ee.oneSpace),n.property("name").append(ee.oneSpace)}}formatWithPredicate(e){const n=this.getNodeFormatter(e);(Zh(e)||vw(e))&&n.keyword("with").prepend(ee.oneSpace)}formatViewRuleStyle(e){this.on(e,Aa)?.keyword("style").append(ee.oneSpace),this.on(e,FK)?.keyword(",").prepend(ee.noSpace).append(ee.oneSpace)}formatWhereExpression(e){if((EK(e)||wK(e))&&this.getNodeFormatter(e).keyword("where").append(ee.oneSpace),(AK(e)||CK(e))&&this.getNodeFormatter(e).property("operator").surround(ee.oneSpace),(V_(e)||X_(e))&&this.getNodeFormatter(e).keyword("not").append(ee.oneSpace),I_(e)||zK(e)||GK(e)||P_(e)||HK(e)||Y_(e)){const n=this.getNodeFormatter(e);n.property("operator").surround(ee.oneSpace),n.property("not").surround(ee.oneSpace)}}formatIncludeExcludeExpressions(e){if(Xv(e)||dw(e)||np(e)){const n=this.getNodeFormatter(e);(!e.$cstNode||!dA(e.$cstNode))&&n.keywords("include","exclude").append(ee.oneSpace)}if(F_(e)||q_(e)||q_(e)){const n=this.getNodeFormatter(e),r=this.findPredicateExpressionRoot(e),i=r?.$cstNode&&dA(r?.$cstNode);i&&n.property("value").prepend(ee.indent),n.keyword(",").prepend(ee.noSpace).append(i?ee.newLine:ee.oneSpace)}}findPredicateExpressionRoot(e){let n=e.$container;for(;;){if(!n||Xv(n)||dw(n)||np(n))return n;n=n.$container}}on(e,n,r){const i=n(e)?this.getNodeFormatter(e):void 0;return r&&i&&r(e,i),i}}const DY={lsp:{NodeKindProvider:t=>new KV(t),WorkspaceSymbolProvider:t=>new YV(t)},workspace:{WorkspaceManager:t=>new VV(t)}};function Ht(t){return e=>new t(e)}const EY={WorkspaceCache:t=>new u1(t.shared),Rpc:Ht(HV),likec4:{ModelChanges:Ht(qV),FqnIndex:Ht(wV),ModelParser:Ht(PV),ModelBuilder:Ht(SV),ModelLocator:Ht(CV)},lsp:{CompletionProvider:Ht(lV),DocumentHighlightProvider:Ht(dV),DocumentSymbolProvider:Ht(hV),SemanticTokenProvider:Ht(gV),HoverProvider:Ht(pV),CodeLensProvider:Ht(uV),DocumentLinkProvider:Ht(fV),Formatter:Ht(bY)},references:{ScopeComputation:Ht(WV),ScopeProvider:Ht(zV)}};function TY(t,e,n,r){const i=RY(t),s=[DW({shared:i}),XK,EY,e,n,r].reduce(fA,{}),o=Nf(s);return i.ServiceRegistry.register(o),yY(o),t.connection?o.Rpc.init():i.workspace.ConfigurationProvider.initialized({}),{shared:i,likec4:o}}function RY(t={}){const e={..._1,...t};return t.connection&&(QK(t.connection),ZK(t.connection)),Nf(TW(e),YK,DY)}function fA(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=fA(i,r):t[n]=r}}return t}function hA(t){return typeof t=="object"&&t!==null&&typeof t.id=="string"}function Cw(t){return typeof t=="object"&&t!==null&&t.$$type==="Node"&&typeof t.id=="string"}function pA(t){return Cw(t)||hA(t)}function Cl(t){return typeof t=="string"||pA(t)}function SY(t){return Array.isArray(t)&&t.every(Cl)}function $Y(t){return["n","ne","e","se","s","sw","w","nw","c"].includes(t)}function gA(t){if(pA(t))return t;const[e,n,r]=t.split(":");return $Y(r)?{id:e,port:n,compass:r}:{id:e,port:n}}function kY(t){if(t.length<2&&(Cl(t[0])&&Cl(t[1]))===!1)throw Error("EdgeTargets must have at least 2 elements.");return t.map(e=>gA(e))}const $p=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function CY(t){return Object.assign(Object.seal(Object.assign({},$p)),t)}function _Y(...t){const[e,...n]=t;return(...r)=>n.reduce((i,s)=>s(i),e(...r))}function zn(t,...e){return _Y(t,...e)}const AY=t=>(...e)=>n=>t(n,...e),IY=t=>({[Symbol.iterator]:t}),ur=AY((t,e)=>Array.from(IY(function*(){for(const n of t)yield e(n)})));class mA{options;getLocation(){return this.options?.locationFunction?.()??null}constructor(e){this.options=e}createElement(e,n,r=[]){return{location:this.getLocation(),...n,type:e,children:r}}}const xe=mA.prototype.createElement.bind(new mA),xY=/\r?\n/;function lr(t){return e=>e.join(t)}function PY(t){return e=>t+e+t}function us(t,e){return n=>t+n+e}function kp(t){return e=>t+e}const yA=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"'),Cp=t=>t.split(xY),_l=(t,e,n)=>zn(Cp,ur(kp(t==="space"?" ".repeat(e):`
1154
- `)),lr(n)),so=t=>{switch(t){case"crlf":return`\r
1155
- `;case"lf":return`
1156
- `}},NY={match(t){return t.type==="AttributeList"},print(t,e){if(e.children.length===0)return`${e.kind.toLocaleLowerCase()} [];`;const n=so(t.endOfLine);return zn(ur(t.print),lr(n),_l(t.indentStyle,t.indentSize,n),us(`${e.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(e.children)}},OY={match(t){return t.type==="Attribute"},print(t,e){return`${t.print(e.key)} = ${t.print(e.value)};`}},FY={match(t){return t.type==="Comment"},print(t,e){const n=so(t.endOfLine);switch(e.kind){case"Block":return zn(Cp,ur(kp(" * ")),lr(n),us(`/**${n}`,`${n} */`))(e.value);case"Macro":return zn(Cp,ur(kp("# ")),lr(n))(e.value);case"Slash":default:return zn(Cp,ur(kp("// ")),lr(n))(e.value)}}},LY={match(t){return t.type==="Dot"},print(t,e){return e.children.map(t.print).join(so(t.endOfLine))}},MY={match(t){return t.type==="Edge"},print(t,e){const n=zn(ur(t.print),lr(t.directed?" -> ":" -- "))(e.targets);if(e.children.length===0)return`${n};`;const r=so(t.endOfLine),i=zn(ur(t.print),lr(r),_l(t.indentStyle,t.indentSize,r),us(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},BY={match(t){return t.type==="Graph"},print(t,e){t.directed=e.directed;const n=[];if(e.strict&&n.push("strict"),n.push(e.directed?"digraph":"graph"),e.id&&n.push(t.print(e.id)),e.children.length===0)return`${n.join(" ")} {}`;const r=so(t.endOfLine),i=zn(ur(t.print),lr(r),_l(t.indentStyle,t.indentSize,r),us(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},jY=zn(yA,PY('"')),UY=us("<",">"),qY={match(t){return t.type==="Literal"},print(t,e){switch(e.quoted){case"html":return UY(e.value);case!0:return jY(e.value);case!1:default:return yA(e.value)}}},WY={match(t){return t.type==="Node"},print(t,e){const n=t.print(e.id);if(e.children.length===0)return`${n};`;const r=so(t.endOfLine),i=zn(ur(t.print),lr(r),_l(t.indentStyle,t.indentSize,r),us(`[${r}`,`${r}];`))(e.children);return`${n} ${i}`}},GY={match(t){return t.type==="NodeRefGroup"},print(t,e){return zn(ur(t.print),lr(" "),us("{","}"))(e.children)}},zY={match(t){return t.type==="NodeRef"},print(t,e){const n=[t.print(e.id)];return e.port&&n.push(t.print(e.port)),e.compass&&n.push(t.print(e.compass)),n.join(":")}},HY={match(t){return t.type==="Subgraph"},print(t,e){const n=["subgraph"];if(e.id&&n.push(t.print(e.id)),e.children.length===0)return`${n.join(" ")} {}`;const r=so(t.endOfLine),i=zn(ur(t.print),lr(r),_l(t.indentStyle,t.indentSize,r),us(`{${r}`,`${r}}`))(e.children);return`${n.join(" ")} ${i}`}},KY=[NY,OY,FY,LY,MY,BY,qY,WY,GY,zY,HY];class VY{options;#e=[...KY];constructor(e={}){this.options=e}print(e){const n=[...this.#e],{indentSize:r=2,indentStyle:i="space",endOfLine:s="lf"}=this.options,o={directed:!0,indentSize:r,indentStyle:i,endOfLine:s,print(a){for(const c of n)if(c.match(a))return c.print(o,a);throw Error()}};return o.print(e)}}function YY(t,e){const n=new VY(e).print(t);if(!n)throw new Error;return n}function _p(t,e){if(typeof e=="string"){const n=e.trim();return/^<.+>$/ms.test(n)?xe("Attribute",{key:xe("Literal",{value:t,quoted:!1},[]),value:xe("Literal",{value:n.slice(1,n.length-1),quoted:"html"},[])},[]):xe("Attribute",{key:xe("Literal",{value:t,quoted:!1},[]),value:xe("Literal",{value:e,quoted:!0},[])},[])}return xe("Attribute",{key:xe("Literal",{value:t,quoted:!1},[]),value:xe("Literal",{value:String(e),quoted:!1},[])},[])}function oo(t,e){return xe("Comment",{kind:e,value:t},[])}function vA(t,e){return Array.from(function*(){for(const[n,r]of e.values)yield _p(n,r);for(const n of Object.values(e.attributes))n.size>0&&(n.comment&&(yield oo(n.comment,t.commentKind)),yield t.convert(n));for(const n of e.nodes)n.comment&&(yield oo(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.subgraphs)n.comment&&(yield oo(n.comment,t.commentKind)),yield t.convert(n);for(const n of e.edges)n.comment&&(yield oo(n.comment,t.commentKind)),yield t.convert(n)}())}const XY={match(t){return t.$$type==="AttributeList"},convert(t,e){return xe("AttributeList",{kind:e.$$kind},e.values.map(([n,r])=>_p(n,r)))}},JY={match(t){return t.$$type==="Edge"},convert(t,e){return xe("Edge",{targets:e.targets.map(n=>Cw(n)?xe("NodeRef",{id:xe("Literal",{value:n.id,quoted:!0},[])},[]):hA(n)?xe("NodeRef",{id:xe("Literal",{value:n.id,quoted:!0},[]),port:n.port?xe("Literal",{value:n.port,quoted:!0},[]):void 0,compass:n.compass?xe("Literal",{value:n.compass,quoted:!0},[]):void 0},[]):xe("NodeRefGroup",{},n.map(r=>Cw(r)?xe("NodeRef",{id:xe("Literal",{value:r.id,quoted:!0},[])},[]):xe("NodeRef",{id:xe("Literal",{value:r.id,quoted:!0},[]),port:r.port?xe("Literal",{value:r.port,quoted:!0},[]):void 0,compass:r.compass?xe("Literal",{value:r.compass,quoted:!0},[]):void 0},[]))))},[...e.attributes.comment?[oo(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>_p(n,r))])}},ZY={match(t){return t.$$type==="Graph"},convert(t,e){return xe("Dot",{},[...e.comment?[oo(e.comment,t.commentKind)]:[],xe("Graph",{directed:e.directed,strict:e.strict,id:e.id?xe("Literal",{value:e.id,quoted:!0},[]):void 0},vA(t,e))])}},QY={match(t){return t.$$type==="Node"},convert(t,e){return xe("Node",{id:xe("Literal",{value:e.id,quoted:!0},[])},[...e.attributes.comment?[oo(e.attributes.comment,t.commentKind)]:[],...e.attributes.values.map(([n,r])=>_p(n,r))])}},eX={match(t){return t.$$type==="Subgraph"},convert(t,e){return xe("Subgraph",{id:e.id?xe("Literal",{value:e.id,quoted:!0},[]):void 0},vA(t,e))}},tX=[XY,JY,QY,ZY,eX];class nX{options;#e=[...tX];constructor(e={}){this.options=e}convert(e){const n=[...this.#e],{commentKind:r="Slash"}=this.options,i={commentKind:r,convert(s){for(const o of n)if(o.match(s))return o.convert(i,s);throw Error()}};return i.convert(e)}}function rX(t,e){return new nX(e).convert(t)}const O=new Proxy(Object.freeze({}),{get:(t,e)=>e});class _w{}class Aw extends _w{#e=new Map;constructor(e){super(),e!==void 0&&this.apply(e)}get values(){return Array.from(this.#e.entries())}get size(){return this.#e.size}get(e){return this.#e.get(e)}set(e,n){n!=null&&this.#e.set(e,n)}delete(e){this.#e.delete(e)}apply(e){const n=Array.isArray(e)?e:Object.entries(e);for(const[r,i]of n)this.set(r,i)}clear(){this.#e.clear()}}class Iw extends Aw{$$kind;get $$type(){return"AttributeList"}comment;constructor(e,n){super(n),this.$$kind=e}}class wA extends Aw{#e=$p;id;comment;attributes=Object.freeze({graph:new Iw("Graph"),edge:new Iw("Edge"),node:new Iw("Node")});get nodes(){return Array.from(this.#t.nodes.values())}get edges(){return Array.from(this.#t.edges.values())}get subgraphs(){return Array.from(this.#t.subgraphs.values())}#t={nodes:new Map,edges:new Set,subgraphs:new Set};with(e){this.#e=CY(e)}addNode(e){this.#t.nodes.set(e.id,e)}addEdge(e){this.#t.edges.add(e)}addSubgraph(e){this.#t.subgraphs.add(e)}existNode(e){return this.#t.nodes.has(e)}existEdge(e){return this.#t.edges.has(e)}existSubgraph(e){return this.#t.subgraphs.has(e)}createSubgraph(...e){const n=new this.#e.Subgraph(...e);return n.with(this.#e),this.addSubgraph(n),n}removeNode(e){this.#t.nodes.delete(typeof e=="string"?e:e.id)}removeEdge(e){this.#t.edges.delete(e)}removeSubgraph(e){this.#t.subgraphs.delete(e)}createNode(e,n){const r=new this.#e.Node(e,n);return this.addNode(r),r}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(n=>n.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,n){const r=e.map(s=>SY(s)?kY(s):gA(s)),i=new this.#e.Edge(r,n);return this.addEdge(i),i}subgraph(...e){const n=e.find(o=>typeof o=="string"),r=e.find(o=>typeof o=="object"&&o!==null),i=e.find(o=>typeof o=="function"),s=n?this.getSubgraph(n)??this.createSubgraph(n):this.createSubgraph();return r!==void 0&&s.apply(r),i!==void 0&&i(s),s}node(e,...n){if(typeof e=="string"){const r=e,i=n.find(a=>typeof a=="object"&&a!==null),s=n.find(a=>typeof a=="function"),o=this.getNode(r)??this.createNode(r);return i!==void 0&&o.attributes.apply(i),s!==void 0&&s(o),o}typeof e=="object"&&e!==null&&this.attributes.node.apply(e)}edge(e,...n){if(Array.isArray(e)){const r=e,i=n.find(a=>typeof a=="object"),s=n.find(a=>typeof a=="function"),o=this.createEdge(r,i);return s!==void 0&&s(o),o}typeof e=="object"&&e!==null&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}}class bA extends wA{get $$type(){return"Graph"}id;strict;constructor(...e){super(),this.id=e.find(r=>typeof r=="string"),this.strict=e.find(r=>typeof r=="boolean")??!1;const n=e.find(r=>typeof r=="object"&&r!==null);n!==void 0&&this.apply(n)}}class iX extends bA{get directed(){return!0}}class sX extends bA{get directed(){return!1}}class oX extends wA{get $$type(){return"Subgraph"}id;constructor(...e){super(),this.id=e.find(r=>typeof r=="string");const n=e.find(r=>typeof r=="object"&&r!==null);n!==void 0&&this.apply(n)}isSubgraphCluster(){return typeof this.id=="string"?this.id.startsWith("cluster"):!1}}class DA extends Aw{comment}let aX=class extends _w{id;get $$type(){return"Node"}comment;attributes;constructor(e,n){super(),this.id=e,this.attributes=new DA(n)}port(e){return typeof e=="string"?{id:this.id,port:e}:{id:this.id,...e}}};class cX extends _w{targets;get $$type(){return"Edge"}comment;attributes;constructor(e,n){if(super(),this.targets=e,e.length<2&&(Cl(e[0])&&Cl(e[1]))===!1)throw Error("The element of Edge target is missing or not satisfied as Edge target.");this.attributes=new DA(n)}}Object.assign($p,{Graph:sX,Digraph:iX,Subgraph:oX,Node:aX,Edge:cX});function EA(t,e){return(...n)=>{const r=t?this.Digraph:this.Graph,i=n.find(c=>typeof c=="string"),s=n.find(c=>typeof c=="object"),o=n.find(c=>typeof c=="function"),a=new r(i,e,s);return a.with(this),typeof o=="function"&&o(a),a}}function TA(t,e=$p){return Object.freeze({digraph:EA.call(e,!0,t),graph:EA.call(e,!1,t)})}const RA=TA(!1),uX=RA.digraph;RA.graph;const lX=TA(!0);function SA(t,e){const n=rX(t,e?.convert);return YY(n,e?.print)}function dX(t){let e=t.length-1,n=t[e];for(;n===" "||n===" ";)n=t[--e];return t.substring(0,e+1)}function fX(t){return t.split(`
1157
- `).map(r=>dX(r)).join(`
1158
- `)}var hX=function(t,e){if(e=e||{},t==null)return t;var n=e.width||50,r=typeof e.indent=="string"?e.indent:" ",i=e.newline||`
1159
- `+r,s=typeof e.escape=="function"?e.escape:pX,o=".{1,"+n+"}";e.cut!==!0&&(o+="([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)");var a=new RegExp(o,"g"),c=t.match(a)||[],u=r+c.map(function(l){return l.slice(-1)===`
1160
- `&&(l=l.slice(0,l.length-1)),s(l)}).join(i);return e.trim===!0&&(u=fX(u)),u};function pX(t){return t}const Ap={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return n*2.55;t/=360,e/=100,n/=100;const i=n<.5?n*(1+e):n+e-n*e,s=2*n-i;switch(r){case"r":return Ap.hue2rgb(s,i,t+1/3)*255;case"g":return Ap.hue2rgb(s,i,t)*255;case"b":return Ap.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),s=Math.min(t,e,n),o=(i+s)/2;if(r==="l")return o*100;if(i===s)return 0;const a=i-s,c=o>.5?a/(2-i-s):a/(i+s);if(r==="s")return c*100;switch(i){case t:return((e-n)/a+(e<n?6:0))*60;case e:return((n-t)/a+2)*60;case n:return((t-e)/a+4)*60;default:return-1}}},gX={clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},mX={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},ge={channel:Ap,lang:gX,unit:mX},ls={};for(let t=0;t<=255;t++)ls[t]=ge.unit.dec2hex(t);const Kt={ALL:0,RGB:1,HSL:2};class yX{constructor(){this.type=Kt.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=Kt.ALL}is(e){return this.type===e}}class vX{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new yX}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=Kt.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=ge.channel.rgb2hsl(e,"h")),r===void 0&&(e.s=ge.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=ge.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=ge.channel.hsl2rgb(e,"r")),r===void 0&&(e.g=ge.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=ge.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(Kt.HSL)&&n!==void 0?n:(this._ensureHSL(),ge.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(Kt.HSL)&&n!==void 0?n:(this._ensureHSL(),ge.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(Kt.HSL)&&n!==void 0?n:(this._ensureHSL(),ge.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(Kt.RGB)&&n!==void 0?n:(this._ensureRGB(),ge.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(Kt.RGB)&&n!==void 0?n:(this._ensureRGB(),ge.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(Kt.RGB)&&n!==void 0?n:(this._ensureRGB(),ge.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Kt.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Kt.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(Kt.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Kt.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Kt.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Kt.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const xw=new vX({r:0,g:0,b:0,a:0},"transparent"),xa={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(xa.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,s=i%4===0,o=i>4,a=o?1:17,c=o?8:4,u=s?0:-1,l=o?255:15;return xw.set({r:(r>>c*(u+3)&l)*a,g:(r>>c*(u+2)&l)*a,b:(r>>c*(u+1)&l)*a,a:s?(r&l)*a/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${ls[Math.round(e)]}${ls[Math.round(n)]}${ls[Math.round(r)]}${ls[Math.round(i*255)]}`:`#${ls[Math.round(e)]}${ls[Math.round(n)]}${ls[Math.round(r)]}`}},ao={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(ao.hueRe);if(e){const[,n,r]=e;switch(r){case"grad":return ge.channel.clamp.h(parseFloat(n)*.9);case"rad":return ge.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return ge.channel.clamp.h(parseFloat(n)*360)}}return ge.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(ao.re);if(!n)return;const[,r,i,s,o,a]=n;return xw.set({h:ao._hue2deg(r),s:ge.channel.clamp.s(parseFloat(i)),l:ge.channel.clamp.l(parseFloat(s)),a:o?ge.channel.clamp.a(a?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${ge.lang.round(e)}, ${ge.lang.round(n)}%, ${ge.lang.round(r)}%, ${i})`:`hsl(${ge.lang.round(e)}, ${ge.lang.round(n)}%, ${ge.lang.round(r)}%)`}},Al={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=Al.colors[t];if(e)return xa.parse(e)},stringify:t=>{const e=xa.stringify(t);for(const n in Al.colors)if(Al.colors[n]===e)return n}},Il={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const n=t.match(Il.re);if(!n)return;const[,r,i,s,o,a,c,u,l]=n;return xw.set({r:ge.channel.clamp.r(i?parseFloat(r)*2.55:parseFloat(r)),g:ge.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:ge.channel.clamp.b(c?parseFloat(a)*2.55:parseFloat(a)),a:u?ge.channel.clamp.a(l?parseFloat(u)/100:parseFloat(u)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${ge.lang.round(e)}, ${ge.lang.round(n)}, ${ge.lang.round(r)}, ${ge.lang.round(i)})`:`rgb(${ge.lang.round(e)}, ${ge.lang.round(n)}, ${ge.lang.round(r)})`}},ds={format:{keyword:Al,hex:xa,rgb:Il,rgba:Il,hsl:ao,hsla:ao},parse:t=>{if(typeof t!="string")return t;const e=xa.parse(t)||Il.parse(t)||ao.parse(t)||Al.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Kt.HSL)||t.data.r===void 0?ao.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?Il.stringify(t):xa.stringify(t)},wX=(t,e)=>{const n=ds.parse(t);for(const r in e)n[r]=ge.channel.clamp[r](e[r]);return ds.stringify(n)},$A=t=>ds.format.hex.stringify(ds.parse(t)),bX=(t,e,n)=>{const r=ds.parse(t),i=r[e],s=ge.channel.clamp[e](i+n);return i!==s&&(r[e]=s),ds.stringify(r)},DX=(t,e)=>bX(t,"a",-e),EX=(t,e)=>{const n=ds.parse(t),r={};for(const i in e)e[i]&&(r[i]=n[i]+e[i]);return wX(t,r)},TX=(t,e)=>{const n=ds.parse(t),r={},i=(s,o,a)=>o>0?(a-s)*o/100:s*o/100;for(const s in e)r[s]=i(n[s],e[s],ge.channel.max[s]);return EX(t,r)};class RX{value;next;constructor(e){this.value=e}}class SX{#e;#t;#n;constructor(){this.clear()}enqueue(e){const n=new RX(e);this.#e?(this.#t.next=n,this.#t=n):(this.#e=n,this.#t=n),this.#n++}dequeue(){const e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}}function Ip(t){kA(t);const e=new SX;let n=0;const r=()=>{n<t&&e.size>0&&(e.dequeue()(),n++)},i=()=>{n--,r()},s=async(c,u,l)=>{const d=(async()=>c(...l))();u(d);try{await d}catch{}i()},o=(c,u,l)=>{new Promise(d=>{e.enqueue(d)}).then(s.bind(void 0,c,u,l)),(async()=>(await Promise.resolve(),n<t&&r()))()},a=(c,...u)=>new Promise(l=>{o(c,l,u)});return Object.defineProperties(a,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(c){kA(c),t=c,queueMicrotask(()=>{for(;n<t&&e.size>0;)r()})}}}),a}function kA(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}function CA(t,e){const n=t.nodes.map(i=>{const s=e.nodes[i.id];if(!s)return i;const{x:o,y:a,width:c,height:u}=s;return{...i,width:c,height:u,position:[o,a]}}),r=t.edges.map(i=>{const s=e.edges[i.id];return s?{...i,...s}:i});return{...t,bounds:{x:e.x,y:e.y,width:e.width,height:e.height},nodes:n,edges:r}}const _A=(t,e)=>t.width>e.width+10||t.height>e.height+10;function $X(t,e){if(t.hash===e.hash)return{diagram:CA(t,e)};if(t.autoLayout===e.autoLayout&&t.nodes.every(r=>{const i=e.nodes[r.id];return!!i&&(r.children.length>0&&i.isCompound||r.children.length===0&&!i.isCompound)&&(i.isCompound||_A(r,i)===!1)})&&t.edges.every(r=>{const i=e.edges[r.id];return!!i&&(!r.labelBBox&&!i.labelBBox||!!r.labelBBox&&!!i.labelBBox&&r.labelBBox.width<=i.labelBBox.width&&r.labelBBox.height<=i.labelBBox.height)}))return{diagram:CA(t,e)};const n=t.nodes.reduce((r,i)=>{const s=e.nodes[i.id];if(i.children.length>0||!s)return r;const o={id:i.id,center:{x:Math.round(s.x+s.width/2),y:Math.round(s.y+s.height/2)}};return s.isCompound||_A(i,s)||(o.fixedsize={width:s.width,height:s.height}),r.push(o),r},[]);return{relayout:{x:e.x,y:e.y,height:e.height,nodes:n,edges:Qo(e.edges).flatMap(([r,i])=>i.dotpos?{id:r,dotpos:i.dotpos}:[])}}}function _n(t){return t.children.length>0}function Hn(t){switch(t){case"open":return"vee";default:return t}}function Br(t){return Array.isArray(t)?[Br(t[0]),Br(t[1])]:(ce(isFinite(t),`Invalid not finite point value ${t}`),Math.round(t))}const AA=t=>(ce(isFinite(t),`Invalid not finite inch value ${t}`),Math.floor(t*72)),it=t=>Math.ceil(t/72*1e3)/1e3,Kn=t=>Math.ceil(t);Kn(40).toString();function IA(t,e){return $A(TX(t,{l:-35-5*e,s:-15-5*e}))}function kX(t){return $A(DX(t,.3))}function CX(t){return t.trim().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Pw(t,e){return hX(t,{width:e,indent:"",escape:CX}).split(`
1161
- `)}function fs({text:t,maxchars:e,fontsize:n,bold:r,color:i}){let s=Pw(t,e).map(a=>Hi(a)?" ":a).join("<BR/>");r&&(s=`<B>${s}</B>`);const o=i?` COLOR="${i}"`:"";return`<FONT POINT-SIZE="${Kn(n)}"${o}>${s}</FONT>`}function _X(t,e){const n=Z(t.icon),r=[fs({text:t.title,fontsize:19,maxchars:35})];if(Z(t.technology)&&r.push(fs({text:t.technology,fontsize:12,maxchars:n?35:45,color:e.loContrast})),Z(t.description)&&r.push(fs({text:t.description,fontsize:14,maxchars:n?35:45,color:e.loContrast})),r.length===1&&!n)return`<${r[0]}>`;const i=n?(s,o,a)=>{let c=`<TD ALIGN="TEXT" BALIGN="LEFT">${s}</TD>`;if(o===0){const u=a.length>1?` ROWSPAN="${a.length}"`:"";let l=76;(t.shape==="queue"||t.shape==="mobile")&&(l+=20),c=`<TD${u} WIDTH="${l}" FIXEDSIZE="TRUE"> </TD>${c}`,c=`${c}<TD${u} WIDTH="16" FIXEDSIZE="TRUE"> </TD>`}return`<TR>${c}</TR>`}:s=>`<TR><TD>${s}</TD></TR>`;return`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="6">${r.map(i).join("")}</TABLE>>`}function AX(t,e){const n=fs({text:t.title.toUpperCase(),maxchars:50,fontsize:11,bold:!0,color:e});return n.includes("<BR/>")?`<<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="TEXT" BALIGN="LEFT">${n}</TD></TR></TABLE>>`:`<${n}>`}const Pa=35;function IX({label:t,description:e,technology:n}){const r=[];if(Z(t)&&r.push(fs({text:t,maxchars:Pa,fontsize:14,bold:t==="[...]"})),Z(e)&&r.push(fs({text:e,maxchars:Pa,fontsize:14})),Z(n)&&r.push(fs({text:n,fontsize:12,maxchars:Pa})),r.length===0)return null;const i=r.map(s=>`<TR><TD ALIGN="TEXT" BALIGN="LEFT">${s}</TD></TR>`).join("");return`<<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" ${Nw}>${i}</TABLE>>`}const Nw=`BGCOLOR="${Nn.relationships[xs].labelBgColor}A0"`;function xX(t,e){const n=`<TABLE BORDER="0" CELLPADDING="6" ${Nw}><TR><TD FIXEDSIZE="TRUE" WIDTH="20" HEIGHT="20"><FONT POINT-SIZE="${Kn(14)}"><B>${t}</B></FONT></TD></TR></TABLE>`;return Z(e)?`<${['<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">',"<TR>",`<TD>${n}</TD>`,`<TD ${Nw} CELLPADDING="2">`,fs({text:e,maxchars:Pa,fontsize:14}),"</TD>","</TR>","</TABLE>"].join("")}>`:`<${n}>`}const xA="dashed",Ow=Nn.font;class PA{constructor(e){this.view=e,this.compoundIds=new Set(e.nodes.filter(_n).map(r=>r.id)),this.edgesWithCompounds=new Set(this.compoundIds.size>0?e.edges.filter(r=>this.compoundIds.has(r.source)||this.compoundIds.has(r.target)).map(r=>r.id):[]);const n=this.graphvizModel=this.createGraph();this.applyNodeAttributes(n.attributes.node),this.applyEdgeAttributes(n.attributes.edge),this.buildGraphvizModel(n)}ids=new Set;subgraphs=new Map;nodes=new Map;edges=new Map;compoundIds;edgesWithCompounds;graphvizModel;get hasEdgesWithCompounds(){return this.edgesWithCompounds.size>0}buildGraphvizModel(e){const n=(i,s)=>{const o=this.nodeId(i),a=this.elementToSubgraph(i,s.subgraph(o));this.subgraphs.set(i.id,a);for(const c of this.view.nodes.filter(u=>_n(u)&&u.parent===i.id))n(c,a)},r=[];for(const i of this.view.nodes)_n(i)?$t(i.parent)&&n(i,e):r.push(i);for(const i of r){const s=i.parent?this.getSubgraph(i.parent):e;ce(s,"parent graph should be defined");const o=this.nodeId(i),a=this.elementToNode(i,s.node(o));this.nodes.set(i.id,a)}for(const i of this.view.edges){const s=this.addEdge(i,e);s&&this.edges.set(i.id,s)}}print(){return SA(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}createGraph(){this.view.autoLayout==="TB"||this.view.autoLayout;const e=uX({[O.bgcolor]:"transparent",[O.layout]:"dot",[O.compound]:!0,[O.rankdir]:this.view.autoLayout,[O.TBbalance]:"min",[O.splines]:"spline",[O.outputorder]:"nodesfirst",[O.nodesep]:it(110),[O.ranksep]:it(120),[O.pack]:Kn(120),[O.packmode]:"array_3",[O.pad]:it(15),[O.forcelabels]:!0,[O.fontname]:Ow});return e.attributes.graph.apply({[O.fontsize]:Kn(15),[O.labeljust]:this.view.autoLayout==="RL"?"r":"l",[O.labelloc]:this.view.autoLayout==="BT"?"b":"t",[O.margin]:50.1}),e}applyNodeAttributes(e){e.apply({[O.fontname]:Ow,[O.nojustify]:!0,[O.shape]:"rect",[O.width]:it(320),[O.height]:it(180),[O.style]:"filled",[O.penwidth]:0})}applyEdgeAttributes(e){e.apply({[O.nojustify]:!0,[O.arrowsize]:.75,[O.fontname]:Ow,[O.fontsize]:Kn(14),[O.penwidth]:Kn(2),[O.color]:Nn.relationships[xs].lineColor,[O.fontcolor]:Nn.relationships[xs].labelColor})}checkNodeId(e,n=!1){return n?e="cluster_"+e:e.toLowerCase().startsWith("cluster")&&(e="nd_"+e),this.ids.has(e)?null:(this.ids.add(e),e)}nodeId(e){const n=_n(e);let r=Ga(e.id).toLowerCase(),i=this.checkNodeId(r,n);if(i!==null)return i;let s=e.id,o;for(;o=Tt(s);){if(r=Ga(o).toLowerCase()+"_"+r,i=this.checkNodeId(r,n),i!==null)return i;s=o}r=Ga(e.id).toLowerCase();let a=1;do i=this.checkNodeId(r+"_"+a++,n);while(i===null);return i}elementToSubgraph(e,n){ce(_n(e),"node should be compound"),ce(B1(e.depth),"node.depth should be defined");const r=this.getElementColorValues(e.color),i=kX(r.loContrast);return n.apply({[O.likec4_id]:e.id,[O.likec4_level]:e.level,[O.likec4_depth]:e.depth,[O.fillcolor]:IA(r.fill,e.depth),[O.color]:IA(r.stroke,e.depth),[O.style]:"filled",[O.margin]:Kn(e.children.length>1?40:32),[O.label]:AX(e,i)}),n}elementToNode(e,n){ce(!_n(e),"node should not be compound");const r=Z(e.icon),i=this.getElementColorValues(e.color);switch(n.attributes.apply({[O.likec4_id]:e.id,[O.likec4_level]:e.level,[O.fillcolor]:i.fill,[O.fontcolor]:i.hiContrast,[O.color]:i.stroke,[O.margin]:`${it(r?10:26)},${it(26)}`}),e.shape){case"cylinder":case"storage":{n.attributes.apply({[O.margin]:`${it(r?10:26)},${it(0)}`,[O.penwidth]:Kn(2),[O.shape]:"cylinder"});break}case"browser":{n.attributes.apply({[O.margin]:`${it(r?10:30)},${it(32)}`});break}case"mobile":{n.attributes.apply({[O.margin]:`${it(r?10:30)},${it(26)}`});break}case"queue":{n.attributes.apply({[O.width]:it(320),[O.height]:it(165),[O.margin]:`${it(r?10:30)},${it(26)}`});break}}return n.attributes.set(O.label,_X(e,i)),n}leafElements(e){if(e===null)return this.view.nodes.filter(r=>!_n(r));const n=e+".";return this.view.nodes.filter(r=>!_n(r)&&r.id.startsWith(n))}viewElement(e){return Xe(this.view.nodes.find(n=>n.id===e),`Node ${e} not found`)}getGraphNode(e){return this.nodes.get(e)??null}getSubgraph(e){return this.subgraphs.get(e)??null}edgeEndpoint(e,n){let r=this.viewElement(e),i=this.getGraphNode(e),s;return i||(ce(_n(r),"endpoint node should be compound"),s=this.getSubgraph(e)?.id,ce(s,`subgraph ${e} not found`),r=Xe(n(this.leafElements(e)),`leaf element in ${e} not found`),i=Xe(this.getGraphNode(r.id),`source graphviz node ${r.id} not found`)),[r,i,s]}hasInternalEdges(e){return e===null?this.view.edges.length>0:this.view.edges.some(ND(e))}findInternalEdges(e){return e===null?this.view.edges.slice():this.view.edges.filter(ND(e))}withoutCompoundEdges(e){return this.edgesWithCompounds.size===0?e:{...e,inEdges:e.inEdges.filter(n=>!this.edgesWithCompounds.has(n)),outEdges:e.outEdges.filter(n=>!this.edgesWithCompounds.has(n))}}assignGroups(){const e=ze(this.view.nodes,Ve(_n),ct(r=>r.id),nu(xo),O1(),ct(r=>{const i=this.findInternalEdges(r).filter(s=>s.source!==s.target&&!this.compoundIds.has(s.source)&&!this.compoundIds.has(s.target));return{id:r,edges:i}}),Ve(({edges:r})=>r.length>1&&r.length<8),yU(4)),n=new Set;for(const r of e){const i=r.edges.filter(s=>!n.has(s.source)&&!n.has(s.target));for(const s of i)try{const o=Xe(this.getGraphNode(s.source),`Graphviz Node not found for ${s.source}`),a=Xe(this.getGraphNode(s.target),`Graphviz Node not found for ${s.target}`);n.add(s.source),n.add(s.target),o.attributes.set(O.group,r.id),a.attributes.set(O.group,r.id)}catch(o){Ye.error(o)}}}applyManualLayout({height:e,...n}){const r=n.x<0?-n.x:0,i=n.y<0?-n.y:0,s=r>0||i>0;for(const{id:o,...a}of n.nodes){const c=this.getGraphNode(o);if(!c)continue;const u=it(a.center.x)+r,l=it(e-a.center.y);a.fixedsize?c.attributes.apply({[O.pos]:`${u},${l}!`,[O.pin]:!0,[O.width]:it(a.fixedsize.width),[O.height]:it(a.fixedsize.height),[O.fixedsize]:!0}):c.attributes.set(O.pos,`${u},${l}`)}for(const[o,a]of this.edges.entries()){a.attributes.delete(O.weight),a.attributes.delete(O.minlen),a.attributes.delete(O.constraint);const c=n.edges.find(u=>u.id===o)?.dotpos;c&&!s&&a.attributes.set(O.pos,c)}return this.graphvizModel.apply({[O.layout]:"fdp",[O.overlap]:"vpsc",[O.sep]:"+50,50",[O.esep]:"+10,10",[O.start]:"random2",[O.splines]:"compound"}),this.graphvizModel.delete(O.compound),this.graphvizModel.delete(O.rankdir),this.graphvizModel.delete(O.nodesep),this.graphvizModel.delete(O.ranksep),this.graphvizModel.delete(O.pack),this.graphvizModel.delete(O.pad),this.graphvizModel.delete(O.packmode),this.graphvizModel.attributes.graph.delete(O.margin),this}getRelationshipColorValues(e){return kb(e)?Nn.relationships[e]:this.view.customColorDefinitions[e]?.relationships??Nn.relationships[Yl]}getElementColorValues(e){return kb(e)?Nn.elements[e]:this.view.customColorDefinitions[e]?.elements??Nn.elements[Yl]}}class Z0 extends PA{static toDot(e){return new Z0(e).print()}createGraph(){const e=super.createGraph();return e.set(O.TBbalance,"max"),e}addEdge(e,n){const{nodes:r}=this.view,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[o,a,c]=this.edgeEndpoint(i,D=>ru(D)),[u,l,d]=this.edgeEndpoint(s,iu),f=n.edge([a,l],{[O.likec4_id]:e.id,[O.style]:e.line??xA});if(d&&f.attributes.set(O.lhead,d),c&&f.attributes.set(O.ltail,c),e.color&&e.color!==xs){const D=this.getRelationshipColorValues(e.color);f.attributes.apply({[O.color]:D.lineColor,[O.fontcolor]:D.labelColor})}const h=Pr(d)||Pr(c),p=Pb(e.id),y=xX(p,e.label?.trim());if(f.attributes.set(O.label,y),!h){const D=new Set([...o.outEdges,...u.inEdges,...jU(u.outEdges,o.inEdges)].filter(k=>!this.edgesWithCompounds.has(k)));f.attributes.set(O.weight,D.size)}const T=r.findIndex(D=>D.id===i);r.findIndex(D=>D.id===s)<T&&e.dir!=="back"&&f.attributes.apply({[O.constraint]:!1});let[b,v]=[e.head??bo,e.tail??"none"];return e.dir==="back"?(f.attributes.apply({[O.arrowtail]:Hn(b),[O.minlen]:0,[O.dir]:"back"}),v!=="none"&&f.attributes.apply({[O.arrowhead]:Hn(v),[O.dir]:"both"}),f):b==="none"&&v==="none"||b!=="none"&&v!=="none"?(f.attributes.apply({[O.arrowhead]:Hn(b),[O.arrowtail]:Hn(v),[O.dir]:"both"}),f):b==="none"?(f.attributes.delete(O.arrowhead),f.attributes.apply({[O.arrowtail]:Hn(v),[O.minlen]:0,[O.dir]:"back"}),f):(b!==bo&&f.attributes.set(O.arrowhead,Hn(b)),f)}}class Q0 extends PA{static toDot(e){return new Q0(e).print()}buildGraphvizModel(e){super.buildGraphvizModel(e),this.assignGroups();const n=new Set,r=this.view.nodes.reduce((i,s)=>(_n(s)&&(n.add(s.id),i.push(s)),i),[]);for(const i of r){const s=ze(i.children,Ve(u=>!this.compoundIds.has(u)),ct(u=>this.viewElement(u)),Ve(u=>u.inEdges.length===0&&u.outEdges.length===0));if(s.length<=2)continue;let o=2;switch(!0){case s.length>11:o=4;break;case s.length>4:o=3;break}const a=Xe(this.getSubgraph(i.id),`Subgraph not found for ${i.id}`);let c=null;u7(s,o).forEach(u=>{const l=u.length>1?a.createSubgraph({[O.rank]:"same"}):null;u.forEach((d,f)=>{const h=this.getGraphNode(d.id);h&&(l?.node(h.id),f===0&&(c&&a.edge([c,h],{[O.style]:"invis"}),c=h))})})}}addEdge(e,n){const r=this.view.edges,[i,s]=e.dir==="back"?[e.target,e.source]:[e.source,e.target],[o,a,c]=this.edgeEndpoint(i,D=>ru(D)),[u,l,d]=this.edgeEndpoint(s,iu),f=e.parent,h=(f===null?n:Xe(this.getSubgraph(f),`Parent not found for edge ${e.id}`)).edge([a,l],{[O.likec4_id]:e.id,[O.style]:e.line??xA});d&&h.attributes.set(O.lhead,d),c&&h.attributes.set(O.ltail,c);const p=Pr(d)||Pr(c);if(!p){const D=new Set([...o.inEdges,...o.outEdges,...u.inEdges,...u.outEdges].filter(k=>!this.edgesWithCompounds.has(k)));h.attributes.set(O.weight,D.size)}const y=IX(e);if(y&&(p?h.attributes.set(O.xlabel,y):h.attributes.set(O.label,y)),e.color){const D=this.getRelationshipColorValues(e.color);h.attributes.apply({[O.color]:D.lineColor,[O.fontcolor]:D.labelColor})}let[T,b]=[e.head??bo,e.tail??"none"];if(e.dir==="back")return h.attributes.apply({[O.arrowtail]:Hn(T),[O.dir]:"back"}),b!=="none"&&h.attributes.apply({[O.arrowhead]:Hn(b),[O.dir]:"both",[O.minlen]:0}),h;if(T==="none"&&b==="none")return h.attributes.apply({[O.arrowtail]:"none",[O.arrowhead]:"none",[O.dir]:"none",[O.minlen]:0,[O.constraint]:!1}),h;if(T!=="none"&&b!=="none")return h.attributes.apply({[O.arrowhead]:Hn(T),[O.arrowtail]:Hn(b),[O.dir]:"both",[O.minlen]:0}),h;if(T!==bo&&h.attributes.set(O.arrowhead,Hn(T)),b!=="none"&&h.attributes.set(O.arrowtail,Hn(b)),r.length===1)return h;let v;return f===null&&o.parent==null&&u.parent==null?v=r.filter(D=>{if(D.id===e.id||D.parent!==null||D.source===e.source&&D.target===e.target||D.source===e.target&&D.target===e.source)return!1;const k=this.viewElement(D.source),P=this.viewElement(D.target);return _n(k)||_n(P)?!1:k.parent==null&&P.parent==null}):v=this.findInternalEdges(f).filter(D=>!(D.id===e.id||D.source===e.source&&D.target===e.target||D.source===e.target&&D.target===e.source)),v.length===0&&(f===null||this.leafElements(f).length<=3)&&h.attributes.set(O.minlen,0),h}}function xp(t){const[e,n,r,i]=t?t.split(",").map(a=>Br(+a)):[0,0,0,0],s=Math.round(r-e),o=Math.round(n-i);return{x:Math.round(e),y:Math.round(i),width:s,height:o}}function PX(t){try{const[e,n]=t.split(",");return{x:Br(parseFloat(e)),y:Br(parseFloat(n))}}catch(e){throw Ye.error(`failed on parsing pos: ${t}`,e),e}}function NA({pos:t,width:e,height:n}){const{x:r,y:i}=PX(t),s=AA(+e),o=AA(+n);return{x:r-Math.round(s/2),y:i-Math.round(o/2),width:s,height:o}}function OA(t,[e,n]=[0,0]){if(!t||t.length===0)return null;let r=1/0,i=1/0,s=-1/0,o=-1/0,a=13;try{for(const u of t){if(u.op==="F"){a=Br(u.size);continue}if(u.op==="T"){let l=Br(u.pt[0])-e,d=Br(u.width);switch(u.align){case"r":l-=d;break;case"c":l-=Math.round(d/2);break}r=Math.min(r,l),s=Math.max(s,l+d);let f=Br(u.pt[1])-n;i=Math.min(i,Math.round(f-a)),o=Math.max(o,f)}}}catch(u){return Ye.error(`Failed on parsing label draw ops: ${u}
1162
- ${JSON.stringify(t,null,2)}`),null}if(r===1/0)return null;const c=2;return{x:r-c,y:i-c,width:s-r+2*c,height:o-i+2*c}}function FA({_draw_:t,likec4_id:e="???"},n="<unknown view>"){try{const r=t.filter(s=>s.op.toLowerCase()==="b");ce(Ir(r,1),`view ${n} edge ${e} should have at least one bezier draw op`),r.length>1&&Ye.warn(`view ${n} edge ${e} has more than one bezier draw op, using the first one only`);const i=r[0].points.map(s=>Br(s));return ce(Ir(i,2),`view ${n} edge ${e} should have at least two points`),i}catch(r){throw Ye.error(`failed on parsing view ${n} edge ${e} _draw_:
1163
- ${JSON.stringify(t,null,2)}`),r}}function NX(t,{id:e,source:n,target:r,dir:i,label:s,description:o,...a},c){const u=OA(t._ldraw_??t._tldraw_??t._hldraw_),l=t.dir==="back"||i==="back";return s=s?Pw(s,Pa).join(`
1164
- `):null,o=o?Pw(o,Pa).join(`
1165
- `):void 0,{id:e,source:n,target:r,label:s,...Z(o)&&{description:o},...Z(t.pos)&&{dotpos:t.pos},points:FA(t,c),labelBBox:u,...l?{dir:"back"}:{},...a}}function LA(t,e){const n=JSON.parse(t),r=xp(n.bb),{nodes:i,edges:s,manualLayout:o,...a}=e,c={...a,bounds:r,nodes:[],edges:[]},u=n.objects??[];for(const d of i){const f=u.find(v=>v.likec4_id===d.id);ce(f,`View ${a.id} element ${d.id} not found in graphviz output`);const{x:h,y:p,width:y,height:T}="bb"in f?xp(f.bb):NA(f),b=[h,p];c.nodes.push({...d,position:b,width:y,height:T,labelBBox:Xe(OA(f._ldraw_,b),`View ${a.id} Node ${d.id} label bbox not found`)})}const l=n.edges??[];for(const d of s){const f=l.find(h=>h.likec4_id===d.id);if(!f){Ye.warn(`View ${a.id} edge ${d.id} not found in graphviz output, skipping`);continue}c.edges.push(NX(f,d,a.id))}return c}const Pp=t=>String(t+1).padStart(2,"0");function OX(t){const e=JSON.parse(t),n=xp(e.bb),r={nodes:[],edges:[],bounds:n},i=new Map,s=e.objects??[];for(const o of s){if(!o.likec4_type)continue;const a=Pp(o._gvid),c=o.likec4_path??"",u=i.get(o._gvid),{x:l,y:d,width:f,height:h}="bb"in o?xp(o.bb):NA(o),p={x:l,y:d};if(o.likec4_type==="view")ce(o.likec4_id,`View ${o} has no likec4_id`),r.nodes.push({id:a,type:"view",parentId:u?.id??null,height:h,width:f,position:p,label:o.label??"",viewId:o.likec4_id});else{const y={id:a,type:o.likec4_type,parentId:u?.id??null,height:h,width:f,position:p,path:c,label:o.label??""},T=[..."subgraphs"in o?o.subgraphs:[],..."nodes"in o?o.nodes:[]];for(const b of T)i.set(b,y);r.nodes.push(y)}}for(const o of e.edges??[])try{const a=Pp(o.tail),c=Pp(o.head);r.edges.push({id:`link${Pp(o._gvid)}`,source:a,target:c,points:FA(o)})}catch(a){Ye.warn(a)}return r}const MA=Nn.font,Np="/";class eb{static toDot(e){return new eb(e).print()}subgraphs=new Map;graphvizModel;constructor(e){const n=this.graphvizModel=lX.graph({[O.layout]:"osage",[O.pack]:Kn(100),[O.packmode]:"array_ltc",[O.pad]:it(15),[O.fontname]:MA,[O.splines]:"polyline",[O.esep]:"+20"});n.attributes.graph.apply({[O.fontsize]:Kn(20),[O.labeljust]:"l",[O.labelloc]:"t"}),n.attributes.node.apply({[O.fontname]:MA,[O.shape]:"rect",[O.width]:it(400),[O.height]:it(300),[O.fixedsize]:!0,[O.fontsize]:10}),n.attributes.edge.apply({[O.penwidth]:Kn(2)});const r=new Set(e.map(c=>c.relativePath??""));let i=0,s=[...e];const o=r.size>1;o&&s.sort((c,u)=>{const l=c.relativePath?.split(Np)??[""],d=u.relativePath?.split(Np)??[""];l.push(c.title??"Untitled"),d.push(u.title??"Untitled");const f=l.length,h=d.length;switch(i=Math.max(i,f,h),!0){case f>h:return-1;case f<h:return 1;default:{for(let p=0;p<f;p++){const y=l[p].localeCompare(d[p]);if(y!==0)return y}return 0}}});const a=new Map;s.forEach((c,u)=>{this.addView(o?c:{...c,relativePath:""},u+i);const l=c.nodes.reduce((d,f)=>(f.navigateTo&&d.add(f.navigateTo),d),new Set);l.size>0&&a.set(c.id,l)});for(const[c,u]of a)for(const l of u)n.edge([c,l])}getParentForPath(e){if(e==="")return this.graphvizModel;const n=e.toLowerCase();let r=this.subgraphs.get(n);if(!r){const i=n.endsWith(".c4")||n.endsWith(".likec4"),s=e.includes(Np)?e.slice(0,e.lastIndexOf(Np)):"";r=this.getParentForPath(s).subgraph("cluster"+String(this.subgraphs.size+1),{[O.likec4_type]:i?"file":"folder",[O.likec4_path]:e,[O.sortv]:this.subgraphs.size,[O.label]:Z(s)?e.slice(s.length+1):e}),this.subgraphs.set(n,r)}return r}addView(e,n=0){return this.getParentForPath(e.relativePath??"").node(e.id,{[O.likec4_type]:"view",[O.likec4_id]:e.id,[O.sortv]:n,[O.label]:e.title||"Untitled"})}print(){return SA(this.graphvizModel,{print:{indentStyle:"space",indentSize:2}})}}const BA=t=>yg(t)?new Z0(t):new Q0(t);class FX{constructor(e){this.graphviz=e}get port(){return this.graphviz}changePort(e){this.graphviz=e}async layout(e){let n=await this.dot(e);const r=await this.graphviz.layoutJson(n);let i=LA(r,e);if(e.manualLayout){const s=$X(i,e.manualLayout);if(s.diagram)i=s.diagram;else{if(s.relayout.nodes.length>0){const o=BA(e);if(o.hasEdgesWithCompounds)Ye.warn(`Manual layout for view ${e.id} is ignored, as edges with compounds are not supported`);else{o.applyManualLayout(s.relayout);const a=await this.graphviz.layoutJson(o.print());i=LA(a,e)}}i.hasLayoutDrift=!0}}return n=n.split(`
1166
- `).filter(s=>!(s.includes("margin")&&s.includes("50.1"))).join(`
1167
- `),{dot:n,diagram:i}}async svg(e){let n=await this.dot(e);return n=n.split(`
1168
- `).filter(r=>!(r.includes("margin")&&r.includes("50.1"))).join(`
1169
- `),{svg:await this.graphviz.svg(n),dot:n}}async dot(e){let n=BA(e).print();if(yg(e))return n;try{return await this.graphviz.unflatten(n)}catch(r){return Ye.warn(`Error during unflatten: ${e.id}`,r),n}}async layoutOverviewGraph(e){if(e.length===0)return Promise.resolve({nodes:[],edges:[],bounds:{x:0,y:0,width:10,height:10}});const n=eb.toDot(e),r=await this.graphviz.layoutJson(n);return OX(r)}}const LX=Ip(1);let MX=class rg{static _graphviz=null;graphviz(){return Promise.resolve().then(()=>rg._graphviz??=ag.load())}async attempt(e,n){return await LX(async()=>{const r=Ye.withTag("graphviz-wasm");try{return await n()}catch(i){r.error(`FAILED GraphvizWasmAdapter: ${e}`,i),ag.unload(),rg._graphviz=null}r.warn("Retrying..."),await OD(50,300);try{return await n()}finally{ag.unload(),rg._graphviz=null}})}async unflatten(e){return await this.attempt(`unflatten
1170
- ${e}`,async()=>(await this.graphviz()).unflatten(e,1,!1,3).replaceAll(/\t\[/g," [").replaceAll(/\t/g," "))}async acyclic(e){return await this.attempt(`acyclic
1171
- ${e}`,async()=>{const n=(await this.graphviz()).acyclic(e,!0);return n.acyclic&&n.outFile||e})}async layoutJson(e){return await this.attempt(`dot
1172
- ${e}`,async()=>(await this.graphviz()).layout(e,"json",void 0,{yInvert:!0}))}async svg(e){return await this.attempt(`svg
1173
- ${e}`,async()=>(await this.graphviz()).layout(e,"svg"))}};function Vn(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}const Fw=(t,e)=>{const n=jA(t);if(typeof n!="string")throw new TypeError(`${e} must be a string or a file URL: ${n}.`);return n},jA=t=>t instanceof URL?og(t):t,UA=(t,e=[],n={})=>{const r=Fw(t,"First argument"),[i,s]=Vn(e)?[[],e]:[e,n];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);const o=i.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Vn(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[r,o,s]},{toString:qA}=Object.prototype,BX=t=>qA.call(t)==="[object ArrayBuffer]",dr=t=>qA.call(t)==="[object Uint8Array]",xl=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),jX=new TextEncoder,WA=t=>jX.encode(t),UX=new TextDecoder,GA=t=>UX.decode(t),qX=(t,e)=>WX(t,e).join(""),WX=(t,e)=>{if(e==="utf8"&&t.every(s=>typeof s=="string"))return t;const n=new cb(e),r=t.map(s=>typeof s=="string"?WA(s):s).map(s=>n.write(s)),i=n.end();return i===""?r:[...r,i]},Lw=t=>t.length===1&&dr(t[0])?t[0]:zA(GX(t)),GX=t=>t.map(e=>typeof e=="string"?WA(e):e),zA=t=>{const e=new Uint8Array(zX(t));let n=0;for(const r of t)e.set(r,n),n+=r.length;return e},zX=t=>{let e=0;for(const n of t)e+=n.length;return e},HX=t=>Array.isArray(t)&&Array.isArray(t.raw),KX=(t,e)=>{let n=[];for(const[s,o]of t.entries())n=VX({templates:t,expressions:e,tokens:n,index:s,template:o});if(n.length===0)throw new TypeError("Template script must not be empty");const[r,...i]=n;return[r,i,{}]},VX=({templates:t,expressions:e,tokens:n,index:r,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[r]}`);const{nextTokens:s,leadingWhitespaces:o,trailingWhitespaces:a}=YX(i,t.raw[r]),c=KA(n,s,o);if(r===e.length)return c;const u=e[r],l=Array.isArray(u)?u.map(d=>VA(d)):[VA(u)];return KA(c,l,a)},YX=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};const n=[];let r=0;const i=HA.has(e[0]);for(let o=0,a=0;o<t.length;o+=1,a+=1){const c=e[a];if(HA.has(c))r!==o&&n.push(t.slice(r,o)),r=o+1;else if(c==="\\"){const u=e[a+1];u==="u"&&e[a+2]==="{"?a=e.indexOf("}",a+3):a+=XX[u]??1}}const s=r===t.length;return s||n.push(t.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:s}},HA=new Set([" "," ","\r",`
1174
- `]),XX={x:3,u:5},KA=(t,e,n)=>n||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],VA=t=>{const e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Vn(t)&&("stdout"in t||"isMaxBuffer"in t))return JX(t);throw t instanceof ab||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},JX=({stdout:t})=>{if(typeof t=="string")return t;if(dr(t))return GA(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)},co=t=>Mw.includes(t),Mw=[Ee.stdin,Ee.stdout,Ee.stderr],jr=["stdin","stdout","stderr"],YA=t=>jr[t]??`stdio[${t}]`,ZX=t=>{const e={...t};for(const n of QA)e[n]=XA(t,n);return e},XA=(t,e)=>{const n=Array.from({length:QX(t)+1}),r=eJ(t[e],n,e);return sJ(r,e)},QX=({stdio:t})=>Array.isArray(t)?Math.max(t.length,jr.length):jr.length,eJ=(t,e,n)=>Vn(t)?tJ(t,e,n):e.fill(t),tJ=(t,e,n)=>{for(const r of Object.keys(t).sort(nJ))for(const i of rJ(r,n,e))e[i]=t[r];return e},nJ=(t,e)=>JA(t)<JA(e)?1:-1,JA=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,rJ=(t,e,n)=>{if(t==="ipc")return[n.length-1];const r=ZA(t);if(r===void 0||r===0)throw new TypeError(`"${e}.${t}" is invalid.
1175
- It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(r>=n.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist.
1176
- Please set the "stdio" option to ensure that file descriptor exists.`);return r==="all"?[1,2]:[r]},ZA=t=>{if(t==="all")return t;if(jr.includes(t))return jr.indexOf(t);const e=iJ.exec(t);if(e!==null)return Number(e[1])},iJ=/^fd(\d+)$/,sJ=(t,e)=>t.map(n=>n===void 0?aJ[e]:n),oJ=yN("execa").enabled?"full":"none",aJ={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:oJ,stripFinalNewline:!0},QA=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Pl=(t,e)=>e==="ipc"?t.at(-1):t[e],Bw=({verbose:t},e)=>Uw(t,e)!=="none",jw=({verbose:t},e)=>!["none","short"].includes(Uw(t,e)),cJ=({verbose:t},e)=>{const n=Uw(t,e);return qw(n)?n:void 0},Uw=(t,e)=>e===void 0?uJ(t):Pl(t,e),uJ=t=>t.find(e=>qw(e))??Ww.findLast(e=>t.includes(e)),qw=t=>typeof t=="function",Ww=["none","short","full"],lJ=(t,e)=>{const n=[t,...e],r=n.join(" "),i=n.map(s=>mJ(eI(s))).join(" ");return{command:r,escapedCommand:i}},Gw=t=>vN(t).split(`
1177
- `).map(e=>eI(e)).join(`
1178
- `),eI=t=>t.replaceAll(hJ,e=>dJ(e)),dJ=t=>{const e=pJ[t];if(e!==void 0)return e;const n=t.codePointAt(0),r=n.toString(16);return n<=gJ?`\\u${r.padStart(4,"0")}`:`\\U${r}`},fJ=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},hJ=fJ(),pJ={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},gJ=65535,mJ=t=>yJ.test(t)?t:DN==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,yJ=/^[\w./-]+$/;function vJ(){return Ee.platform!=="win32"?Ee.env.TERM!=="linux":!!Ee.env.WT_SESSION||!!Ee.env.TERMINUS_SUBLIME||Ee.env.ConEmuTask==="{cmd::Cmder}"||Ee.env.TERM_PROGRAM==="Terminus-Sublime"||Ee.env.TERM_PROGRAM==="vscode"||Ee.env.TERM==="xterm-256color"||Ee.env.TERM==="alacritty"||Ee.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const tI={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},wJ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},bJ={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},DJ={...tI,...wJ},EJ={...tI,...bJ},TJ=vJ(),zw=TJ?DJ:EJ,RJ=ob.WriteStream.prototype.hasColors(),Op=(t,e)=>{if(!RJ)return i=>i;const n=`\x1B[${t}m`,r=`\x1B[${e}m`;return i=>{const s=i+"";let o=s.indexOf(r);if(o===-1)return n+s+r;let a=n,c=0;for(;o!==-1;)a+=s.slice(c,o)+n,c=o+r.length,o=s.indexOf(r,c);return a+=s.slice(c)+r,a}},SJ=Op(1,22),Hw=Op(90,39),$J=Op(91,39),kJ=Op(93,39),CJ=({type:t,message:e,timestamp:n,piped:r,commandId:i,result:{failed:s=!1}={},options:{reject:o=!0}})=>{const a=_J(n),c=AJ[t]({failed:s,reject:o,piped:r}),u=IJ[t]({reject:o});return`${Hw(`[${a}]`)} ${Hw(`[${i}]`)} ${u(c)} ${u(e)}`},_J=t=>`${Fp(t.getHours(),2)}:${Fp(t.getMinutes(),2)}:${Fp(t.getSeconds(),2)}.${Fp(t.getMilliseconds(),3)}`,Fp=(t,e)=>String(t).padStart(e,"0"),nI=({failed:t,reject:e})=>t?e?zw.cross:zw.warning:zw.tick,AJ={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:nI,duration:nI},rI=t=>t,IJ={command:()=>SJ,output:()=>rI,ipc:()=>rI,error:({reject:t})=>t?$J:kJ,duration:()=>Hw},xJ=(t,e,n)=>{const r=cJ(e,n);return t.map(({verboseLine:i,verboseObject:s})=>PJ(i,s,r)).filter(i=>i!==void 0).map(i=>NJ(i)).join("")},PJ=(t,e,n)=>{if(n===void 0)return t;const r=n(t,e);if(typeof r=="string")return r},NJ=t=>t.endsWith(`
1179
- `)?t:`${t}
1180
- `,Nl=({type:t,verboseMessage:e,fdNumber:n,verboseInfo:r,result:i})=>{const s=OJ({type:t,result:i,verboseInfo:r}),o=FJ(e,s),a=xJ(o,r,n);nb(MJ,a)},OJ=({type:t,result:e,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...s}}})=>({type:t,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:e,options:s}),FJ=(t,e)=>t.split(`
1181
- `).map(n=>LJ({...e,message:n})),LJ=t=>({verboseLine:CJ(t),verboseObject:t}),MJ=2,iI=t=>{const e=typeof t=="string"?t:sb(t);return Gw(e).replaceAll(" "," ".repeat(BJ))},BJ=2,jJ=(t,e)=>{Bw(e)&&Nl({type:"command",verboseMessage:t,verboseInfo:e})},UJ=(t,e,n)=>{GJ(t);const r=qJ(t);return{verbose:t,escapedCommand:e,commandId:r,rawOptions:n}},qJ=t=>Bw({verbose:t})?WJ++:void 0;let WJ=0n;const GJ=t=>{for(const e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Ww.includes(e)&&!qw(e)){const n=Ww.map(r=>`'${r}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${n} or a function.`)}}},sI=()=>zl.bigint(),oI=t=>Number(zl.bigint()-t)/1e6,aI=(t,e,n)=>{const r=sI(),{command:i,escapedCommand:s}=lJ(t,e),o=XA(n,"verbose"),a=UJ(o,s,{...n});return jJ(s,a),{command:i,escapedCommand:s,startTime:r,verboseInfo:a}};var Na={exports:{}},Kw,cI;function zJ(){if(cI)return Kw;cI=1,Kw=r,r.sync=i;var t=hh;function e(s,o){var a=o.pathExt!==void 0?o.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var c=0;c<a.length;c++){var u=a[c].toLowerCase();if(u&&s.substr(-u.length).toLowerCase()===u)return!0}return!1}function n(s,o,a){return!s.isSymbolicLink()&&!s.isFile()?!1:e(o,a)}function r(s,o,a){t.stat(s,function(c,u){a(c,c?!1:n(u,s,o))})}function i(s,o){return n(t.statSync(s),s,o)}return Kw}var Vw,uI;function HJ(){if(uI)return Vw;uI=1,Vw=e,e.sync=n;var t=hh;function e(s,o,a){t.stat(s,function(c,u){a(c,c?!1:r(u,o))})}function n(s,o){return r(t.statSync(s),o)}function r(s,o){return s.isFile()&&i(s,o)}function i(s,o){var a=s.mode,c=s.uid,u=s.gid,l=o.uid!==void 0?o.uid:process.getuid&&process.getuid(),d=o.gid!==void 0?o.gid:process.getgid&&process.getgid(),f=parseInt("100",8),h=parseInt("010",8),p=parseInt("001",8),y=f|h,T=a&p||a&h&&u===d||a&f&&c===l||a&y&&l===0;return T}return Vw}var Lp;process.platform==="win32"||mt.TESTING_WINDOWS?Lp=zJ():Lp=HJ();var KJ=Yw;Yw.sync=VJ;function Yw(t,e,n){if(typeof e=="function"&&(n=e,e={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,i){Yw(t,e||{},function(s,o){s?i(s):r(o)})})}Lp(t,e||{},function(r,i){r&&(r.code==="EACCES"||e&&e.ignoreErrors)&&(r=null,i=!1),n(r,i)})}function VJ(t,e){try{return Lp.sync(t,e||{})}catch(n){if(e&&e.ignoreErrors||n.code==="EACCES")return!1;throw n}}const Oa=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",lI=cu,YJ=Oa?";":":",dI=KJ,fI=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),hI=(t,e)=>{const n=e.colon||YJ,r=t.match(/\//)||Oa&&t.match(/\\/)?[""]:[...Oa?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(n)],i=Oa?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Oa?i.split(n):[""];return Oa&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:i}},pI=(t,e,n)=>{typeof e=="function"&&(n=e,e={}),e||(e={});const{pathEnv:r,pathExt:i,pathExtExe:s}=hI(t,e),o=[],a=u=>new Promise((l,d)=>{if(u===r.length)return e.all&&o.length?l(o):d(fI(t));const f=r[u],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=lI.join(h,t),y=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;l(c(y,u,0))}),c=(u,l,d)=>new Promise((f,h)=>{if(d===i.length)return f(a(l+1));const p=i[d];dI(u+p,{pathExt:s},(y,T)=>{if(!y&&T)if(e.all)o.push(u+p);else return f(u+p);return f(c(u,l,d+1))})});return n?a(0).then(u=>n(null,u),n):a(0)},XJ=(t,e)=>{e=e||{};const{pathEnv:n,pathExt:r,pathExtExe:i}=hI(t,e),s=[];for(let o=0;o<n.length;o++){const a=n[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=lI.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<r.length;d++){const f=l+r[d];try{if(dI.sync(f,{pathExt:i}))if(e.all)s.push(f);else return f}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw fI(t)};var JJ=pI;pI.sync=XJ;var Xw={exports:{}};const gI=(t={})=>{const e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Xw.exports=gI,Xw.exports.default=gI;var ZJ=Xw.exports;const mI=cu,QJ=JJ,eZ=ZJ;function yI(t,e){const n=t.options.env||process.env,r=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=QJ.sync(t.command,{path:n[eZ({env:n})],pathExt:e?mI.delimiter:void 0})}catch{}finally{s&&process.chdir(r)}return o&&(o=mI.resolve(i?t.options.cwd:"",o)),o}function tZ(t){return yI(t)||yI(t,!0)}var nZ=tZ,Jw={};const Zw=/([()\][%!^"`<>&|;, *?])/g;function rZ(t){return t=t.replace(Zw,"^$1"),t}function iZ(t,e){return t=`${t}`,t=t.replace(/(\\*)"/g,'$1$1\\"'),t=t.replace(/(\\*)$/,"$1$1"),t=`"${t}"`,t=t.replace(Zw,"^$1"),e&&(t=t.replace(Zw,"^$1")),t}Jw.command=rZ,Jw.argument=iZ;var sZ=/^#!(.*)/;const oZ=sZ;var aZ=(t="")=>{const e=t.match(oZ);if(!e)return null;const[n,r]=e[0].replace(/#! ?/,"").split(" "),i=n.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i};const Qw=hh,cZ=aZ;function uZ(t){const n=Buffer.alloc(150);let r;try{r=Qw.openSync(t,"r"),Qw.readSync(r,n,0,150,0),Qw.closeSync(r)}catch{}return cZ(n.toString())}var lZ=uZ;const dZ=cu,vI=nZ,wI=Jw,fZ=lZ,hZ=process.platform==="win32",pZ=/\.(?:com|exe)$/i,gZ=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function mZ(t){t.file=vI(t);const e=t.file&&fZ(t.file);return e?(t.args.unshift(t.file),t.command=e,vI(t)):t.file}function yZ(t){if(!hZ)return t;const e=mZ(t),n=!pZ.test(e);if(t.options.forceShell||n){const r=gZ.test(e);t.command=dZ.normalize(t.command),t.command=wI.command(t.command),t.args=t.args.map(s=>wI.argument(s,r));const i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function vZ(t,e,n){e&&!Array.isArray(e)&&(n=e,e=null),e=e?e.slice(0):[],n=Object.assign({},n);const r={command:t,args:e,options:n,file:void 0,original:{command:t,args:e}};return n.shell?r:yZ(r)}var wZ=vZ;const e0=process.platform==="win32";function t0(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function bZ(t,e){if(!e0)return;const n=t.emit;t.emit=function(r,i){if(r==="exit"){const s=bI(i,e);if(s)return n.call(t,"error",s)}return n.apply(t,arguments)}}function bI(t,e){return e0&&t===1&&!e.file?t0(e.original,"spawn"):null}function DZ(t,e){return e0&&t===1&&!e.file?t0(e.original,"spawnSync"):null}var EZ={hookChildProcess:bZ,verifyENOENT:bI,verifyENOENTSync:DZ,notFoundError:t0};const DI=rC,n0=wZ,r0=EZ;function EI(t,e,n){const r=n0(t,e,n),i=DI.spawn(r.command,r.args,r.options);return r0.hookChildProcess(i,r),i}function TZ(t,e,n){const r=n0(t,e,n),i=DI.spawnSync(r.command,r.args,r.options);return i.error=i.error||r0.verifyENOENTSync(i.status,r),i}Na.exports=EI,Na.exports.spawn=EI,Na.exports.sync=TZ,Na.exports._parse=n0,Na.exports._enoent=r0;var RZ=Na.exports;function TI(t={}){const{env:e=process.env,platform:n=process.platform}=t;return n!=="win32"?"PATH":Object.keys(e).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"}const SZ=({cwd:t=Ee.cwd(),path:e=Ee.env[TI()],preferLocal:n=!0,execPath:r=Ee.execPath,addExecPath:i=!0}={})=>{const s=t instanceof URL?og(t):t,o=zr.resolve(s),a=[];return n&&$Z(a,o),i&&kZ(a,r,o),[...a,e].join(zr.delimiter)},$Z=(t,e)=>{let n;for(;n!==e;)t.push(zr.join(e,"node_modules/.bin")),n=e,e=zr.resolve(e,"..")},kZ=(t,e,n)=>{const r=e instanceof URL?og(e):e;t.push(zr.resolve(n,r,".."))},CZ=({env:t=Ee.env,...e}={})=>{t={...t};const n=TI({env:t});return e.path=t[n],t[n]=SZ(e),t},_Z=(t,e,n)=>{const r=n?o0:s0,i=t instanceof Ol?{}:{cause:t};return new r(e,i)};class Ol extends Error{}const RI=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,SI,{value:!0,writable:!1,enumerable:!1,configurable:!1})},AZ=t=>i0(t)&&SI in t,SI=Symbol("isExecaError"),i0=t=>Object.prototype.toString.call(t)==="[object Error]";class s0 extends Error{}RI(s0,s0.name);class o0 extends Error{}RI(o0,o0.name);const IZ=()=>{const t=kI-$I+1;return Array.from({length:t},xZ)},xZ=(t,e)=>({name:`SIGRT${e+1}`,number:$I+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),$I=34,kI=64,PZ=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],CI=()=>{const t=IZ();return[...PZ,...t].map(NZ)},NZ=({name:t,number:e,description:n,action:r,forced:i=!1,standard:s})=>{const{signals:{[t]:o}}=As,a=o!==void 0;return{name:t,number:a?o:e,description:n,supported:a,action:r,forced:i,standard:s}},OZ=()=>{const t=CI();return Object.fromEntries(t.map(FZ))},FZ=({name:t,number:e,description:n,supported:r,action:i,forced:s,standard:o})=>[t,{name:t,number:e,description:n,supported:r,action:i,forced:s,standard:o}],LZ=OZ(),MZ=()=>{const t=CI(),e=kI+1,n=Array.from({length:e},(r,i)=>BZ(i,t));return Object.assign({},...n)},BZ=(t,e)=>{const n=jZ(t,e);if(n===void 0)return{};const{name:r,description:i,supported:s,action:o,forced:a,standard:c}=n;return{[t]:{name:r,number:t,description:i,supported:s,action:o,forced:a,standard:c}}},jZ=(t,e)=>{const n=e.find(({name:r})=>As.signals[r]===t);return n!==void 0?n:e.find(r=>r.number===t)};MZ();const UZ=t=>{const e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return _I(t,e)},qZ=t=>t===0?t:_I(t,"`subprocess.kill()`'s argument"),_I=(t,e)=>{if(Number.isInteger(t))return WZ(t,e);if(typeof t=="string")return zZ(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer.
1182
- ${a0()}`)},WZ=(t,e)=>{if(AI.has(t))return AI.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist.
1183
- ${a0()}`)},GZ=()=>new Map(Object.entries(As.signals).reverse().map(([t,e])=>[e,t])),AI=GZ(),zZ=(t,e)=>{if(t in As.signals)return t;throw t.toUpperCase()in As.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist.
1184
- ${a0()}`)},a0=()=>`Available signal names: ${HZ()}.
1185
- Available signal numbers: ${KZ()}.`,HZ=()=>Object.keys(As.signals).sort().map(t=>`'${t}'`).join(", "),KZ=()=>[...new Set(Object.values(As.signals).sort((t,e)=>t-e))].join(", "),II=t=>LZ[t].description,VZ=t=>{if(t===!1)return t;if(t===!0)return YZ;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},YZ=1e3*5,XZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:n},onInternalError:r,context:i,controller:s},o,a)=>{const{signal:c,error:u}=JZ(o,a,n);ZZ(u,r);const l=t(c);return QZ({kill:t,signal:c,forceKillAfterDelay:e,killSignal:n,killResult:l,context:i,controller:s}),l},JZ=(t,e,n)=>{const[r=n,i]=i0(t)?[void 0,t]:[t,e];if(typeof r!="string"&&!Number.isInteger(r))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!i0(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:qZ(r),error:i}},ZZ=(t,e)=>{t!==void 0&&e.reject(t)},QZ=async({kill:t,signal:e,forceKillAfterDelay:n,killSignal:r,killResult:i,context:s,controller:o})=>{e===r&&i&&xI({kill:t,forceKillAfterDelay:n,context:s,controllerSignal:o.signal})},xI=async({kill:t,forceKillAfterDelay:e,context:n,controllerSignal:r})=>{if(e!==!1)try{await ub(e,void 0,{signal:r}),t("SIGKILL")&&(n.isForcefullyTerminated??=!0)}catch{}},PI=async(t,e)=>{t.aborted||await cn(t,"abort",{signal:e})},eQ=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},tQ=({subprocess:t,cancelSignal:e,gracefulCancel:n,context:r,controller:i})=>e===void 0||n?[]:[nQ(t,e,r,i)],nQ=async(t,e,n,{signal:r})=>{throw await PI(e,r),n.terminationReason??="cancel",t.kill(),e.reason},c0=({methodName:t,isSubprocess:e,ipc:n,isConnected:r})=>{rQ(t,e,n),NI(t,e,r)},rQ=(t,e,n)=>{if(!n)throw new Error(`${fr(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},NI=(t,e,n)=>{if(!n)throw new Error(`${fr(t,e)} cannot be used: the ${hs(e)} has already exited or disconnected.`)},iQ=t=>{throw new Error(`${fr("getOneMessage",t)} could not complete: the ${hs(t)} exited or disconnected.`)},sQ=t=>{throw new Error(`${fr("sendMessage",t)} failed: the ${hs(t)} is sending a message too, instead of listening to incoming messages.
1186
- This can be fixed by both sending a message and listening to incoming messages at the same time:
1187
-
1188
- const [receivedMessage] = await Promise.all([
1189
- ${fr("getOneMessage",t)},
1190
- ${fr("sendMessage",t,"message, {strict: true}")},
1191
- ]);`)},OI=(t,e)=>new Error(`${fr("sendMessage",e)} failed when sending an acknowledgment response to the ${hs(e)}.`,{cause:t}),oQ=t=>{throw new Error(`${fr("sendMessage",t)} failed: the ${hs(t)} is not listening to incoming messages.`)},aQ=t=>{throw new Error(`${fr("sendMessage",t)} failed: the ${hs(t)} exited without listening to incoming messages.`)},cQ=()=>new Error(`\`cancelSignal\` aborted: the ${hs(!0)} disconnected.`),uQ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},lQ=({error:t,methodName:e,isSubprocess:n})=>{if(t.code==="EPIPE")throw new Error(`${fr(e,n)} cannot be used: the ${hs(n)} is disconnecting.`,{cause:t})},dQ=({error:t,methodName:e,isSubprocess:n,message:r})=>{if(fQ(t))throw new Error(`${fr(e,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:t})},fQ=({code:t,message:e})=>hQ.has(t)||pQ.some(n=>e.includes(n)),hQ=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),pQ=["could not be cloned","circular structure","call stack size exceeded"],fr=(t,e,n="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${gQ(e)}${t}(${n})`,gQ=t=>t?"":"subprocess.",hs=t=>t?"parent process":"subprocess",u0=t=>{t.connected&&t.disconnect()},Fl=()=>{const t={},e=new Promise((n,r)=>{Object.assign(t,{resolve:n,reject:r})});return Object.assign(e,t)},FI=(t,e="stdin")=>{const{options:r,fileDescriptors:i}=uo.get(t),s=LI(i,e,!0),o=t.stdio[s];if(o===null)throw new TypeError(MI(s,e,r,!0));return o},l0=(t,e="stdout")=>{const{options:r,fileDescriptors:i}=uo.get(t),s=LI(i,e,!1),o=s==="all"?t.all:t.stdio[s];if(o==null)throw new TypeError(MI(s,e,r,!1));return o},uo=new WeakMap,LI=(t,e,n)=>{const r=mQ(e,n);return yQ(r,e,n,t),r},mQ=(t,e)=>{const n=ZA(t);if(n!==void 0)return n;const{validOptions:r,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Ll(e)}" must not be "${t}".
1192
- It must be ${r} or "fd3", "fd4" (and so on).
1193
- It is optional and defaults to "${i}".`)},yQ=(t,e,n,r)=>{const i=r[BI(t)];if(i===void 0)throw new TypeError(`"${Ll(n)}" must not be ${e}. That file descriptor does not exist.
1194
- Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!n)throw new TypeError(`"${Ll(n)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&n)throw new TypeError(`"${Ll(n)}" must not be ${e}. It must be a writable stream, not readable.`)},MI=(t,e,n,r)=>{if(t==="all"&&!n.all)return`The "all" option must be true to use "from: 'all'".`;const{optionName:i,optionValue:s}=vQ(t,n);return`The "${i}: ${d0(s)}" option is incompatible with using "${Ll(r)}: ${d0(e)}".
1195
- Please set this option with "pipe" instead.`},vQ=(t,{stdin:e,stdout:n,stderr:r,stdio:i})=>{const s=BI(t);return s===0&&e!==void 0?{optionName:"stdin",optionValue:e}:s===1&&n!==void 0?{optionName:"stdout",optionValue:n}:s===2&&r!==void 0?{optionName:"stderr",optionValue:r}:{optionName:`stdio[${s}]`,optionValue:i[s]}},BI=t=>t==="all"?1:t,Ll=t=>t?"to":"from",d0=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream",Mp=(t,e,n)=>{const r=t.getMaxListeners();r===0||r===Number.POSITIVE_INFINITY||(t.setMaxListeners(r+e),db(n,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))},jI=(t,e)=>{e&&f0(t)},f0=t=>{t.refCounted()},UI=(t,e)=>{e&&h0(t)},h0=t=>{t.unrefCounted()},wQ=(t,e)=>{e&&(h0(t),h0(t))},bQ=(t,e)=>{e&&(f0(t),f0(t))},DQ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r},i)=>{if(CQ(i)||jQ(i))return;Bp.has(t)||Bp.set(t,[]);const s=Bp.get(t);if(s.push(i),!(s.length>1))for(;s.length>0;){await PQ(t,r,i),await lb.yield();const o=await kQ({wrappedMessage:s[0],anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r});s.shift(),r.emit("message",o),r.emit("message:done")}},EQ=async({anyProcess:t,channel:e,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{VI();const s=Bp.get(t);for(;s?.length>0;)await cn(r,"message:done");t.removeListener("message",i),bQ(e,n),r.connected=!1,r.emit("disconnect")},Bp=new WeakMap,jp=(t,e,n)=>{if(Up.has(t))return Up.get(t);const r=new AN;return r.connected=!0,Up.set(t,r),TQ({ipcEmitter:r,anyProcess:t,channel:e,isSubprocess:n}),r},Up=new WeakMap,TQ=({ipcEmitter:t,anyProcess:e,channel:n,isSubprocess:r})=>{const i=DQ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t});e.on("message",i),e.once("disconnect",EQ.bind(void 0,{anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:t,boundOnMessage:i})),wQ(n,r)},qI=t=>{const e=Up.get(t);return e===void 0?t.channel!==null:e.connected},RQ=({anyProcess:t,channel:e,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;const s=jp(t,e,n),o=p0(t,s);return{id:SQ++,type:Wp,message:r,hasListeners:o}};let SQ=0n;const $Q=(t,e)=>{if(!(e?.type!==Wp||e.hasListeners))for(const{id:n}of t)n!==void 0&&qp[n].resolve({isDeadlock:!0,hasListeners:!1})},kQ=async({wrappedMessage:t,anyProcess:e,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(t?.type!==Wp||!e.connected)return t;const{id:s,message:o}=t,a={id:s,type:WI,message:p0(e,i)};try{await GI({anyProcess:e,channel:n,isSubprocess:r,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return o},CQ=t=>{if(t?.type!==WI)return!1;const{id:e,message:n}=t;return qp[e]?.resolve({isDeadlock:!1,hasListeners:n}),!0},_Q=async(t,e,n)=>{if(t?.type!==Wp)return;const r=Fl();qp[t.id]=r;const i=new AbortController;try{const{isDeadlock:s,hasListeners:o}=await Promise.race([r,AQ(e,n,i)]);s&&sQ(n),o||oQ(n)}finally{i.abort(),delete qp[t.id]}},qp={},AQ=async(t,e,{signal:n})=>{Mp(t,1,n),await cn(t,"disconnect",{signal:n}),aQ(e)},Wp="execa:ipc:request",WI="execa:ipc:response",IQ=(t,e,n)=>{Ml.has(t)||Ml.set(t,new Set);const r=Ml.get(t),i=Fl(),s=n?e.id:void 0,o={onMessageSent:i,id:s};return r.add(o),{outgoingMessages:r,outgoingMessage:o}},xQ=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},PQ=async(t,e,n)=>{for(;!p0(t,e)&&Ml.get(t)?.size>0;){const r=[...Ml.get(t)];$Q(r,n),await Promise.all(r.map(({onMessageSent:i})=>i))}},Ml=new WeakMap,p0=(t,e)=>e.listenerCount("message")>NQ(t),NQ=t=>uo.has(t)&&!Pl(uo.get(t).options.buffer,"ipc")?1:0,GI=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},i,{strict:s=!1}={})=>{const o="sendMessage";return c0({methodName:o,isSubprocess:n,ipc:r,isConnected:t.connected}),OQ({anyProcess:t,channel:e,methodName:o,isSubprocess:n,message:i,strict:s})},OQ=async({anyProcess:t,channel:e,methodName:n,isSubprocess:r,message:i,strict:s})=>{const o=RQ({anyProcess:t,channel:e,isSubprocess:r,message:i,strict:s}),a=IQ(t,o,s);try{await zI({anyProcess:t,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(c){throw u0(t),c}finally{xQ(a)}},zI=async({anyProcess:t,methodName:e,isSubprocess:n,wrappedMessage:r,message:i})=>{const s=FQ(t);try{await Promise.all([_Q(r,t,n),s(r)])}catch(o){throw lQ({error:o,methodName:e,isSubprocess:n}),dQ({error:o,methodName:e,isSubprocess:n,message:i}),o}},FQ=t=>{if(g0.has(t))return g0.get(t);const e=wN(t.send.bind(t));return g0.set(t,e),e},g0=new WeakMap,LQ=(t,e)=>{const n="cancelSignal";return NI(n,!1,t.connected),zI({anyProcess:t,methodName:n,isSubprocess:!1,wrappedMessage:{type:KI,message:e},message:e})},MQ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>(await BQ({anyProcess:t,channel:e,isSubprocess:n,ipc:r}),m0.signal),BQ=async({anyProcess:t,channel:e,isSubprocess:n,ipc:r})=>{if(!HI){if(HI=!0,!r){uQ();return}if(e===null){VI();return}jp(t,e,n),await lb.yield()}};let HI=!1;const jQ=t=>t?.type!==KI?!1:(m0.abort(t.message),!0),KI="execa:ipc:cancel",VI=()=>{m0.abort(cQ())},m0=new AbortController,UQ=({gracefulCancel:t,cancelSignal:e,ipc:n,serialization:r})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},qQ=({subprocess:t,cancelSignal:e,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:s})=>n?[WQ({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:i,controller:s})]:[],WQ=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{await PI(e,i);const s=GQ(e);throw await LQ(t,s),xI({kill:t.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??="gracefulCancel",e.reason},GQ=({reason:t})=>{if(!(t instanceof DOMException))return t;const e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e},zQ=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},HQ=(t,e,n,r)=>e===0||e===void 0?[]:[KQ(t,e,n,r)],KQ=async(t,e,n,{signal:r})=>{throw await ub(e,void 0,{signal:r}),n.terminationReason??="timeout",t.kill(),new Ol},VQ=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},YQ=(t,e,{node:n=!1,nodePath:r=EN,nodeOptions:i=TN.filter(c=>!c.startsWith("--inspect")),cwd:s,execPath:o,...a})=>{if(o!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');const c=Fw(r,'The "nodePath" option'),u=zr.resolve(s,c),l={...a,nodePath:u,node:n,cwd:s};if(!n)return[t,e,l];if(zr.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[u,[...i,t,...e],{ipc:!0,...l,shell:!1}]},XQ=({ipcInput:t,ipc:e,serialization:n})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");QQ[n](t)}},JQ=t=>{try{xN(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ZQ=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},QQ={advanced:JQ,json:ZQ},eee=async(t,e)=>{e!==void 0&&await t.sendMessage(e)},tee=({encoding:t})=>{if(y0.has(t))return;const e=ree(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Gp(t)}\`.
1196
- Please rename it to ${Gp(e)}.`);const n=[...y0].map(r=>Gp(r)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Gp(t)}\`.
1197
- Please rename it to one of: ${n}.`)},nee=new Set(["utf8","utf16le"]),lo=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),y0=new Set([...nee,...lo]),ree=t=>{if(t===null)return"buffer";if(typeof t!="string")return;const e=t.toLowerCase();if(e in YI)return YI[e];if(y0.has(e))return e},YI={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Gp=t=>typeof t=="string"?`"${t}"`:String(t),iee=(t=XI())=>{const e=Fw(t,'The "cwd" option');return zr.resolve(e)},XI=()=>{try{return Ee.cwd()}catch(t){throw t.message=`The current directory does not exist.
1198
- ${t.message}`,t}},see=(t,e)=>{if(e===XI())return t;let n;try{n=aN(e)}catch(r){return`The "cwd" option is invalid: ${e}.
1199
- ${r.message}
1200
- ${t}`}return n.isDirectory()?t:`The "cwd" option is not a directory: ${e}.
1201
- ${t}`},JI=(t,e,n)=>{n.cwd=iee(n.cwd);const[r,i,s]=YQ(t,e,n),{command:o,args:a,options:c}=RZ._parse(r,i,s),u=ZX(c),l=oee(u);return zQ(l),tee(l),XQ(l),eQ(l),UQ(l),l.shell=jA(l.shell),l.env=aee(l),l.killSignal=UZ(l.killSignal),l.forceKillAfterDelay=VZ(l.forceKillAfterDelay),l.lines=l.lines.map((d,f)=>d&&!lo.has(l.encoding)&&l.buffer[f]),Ee.platform==="win32"&&zr.basename(o,".exe")==="cmd"&&a.unshift("/q"),{file:o,commandArguments:a,options:l}},oee=({extendEnv:t=!0,preferLocal:e=!1,cwd:n,localDir:r=n,encoding:i="utf8",reject:s=!0,cleanup:o=!0,all:a=!1,windowsHide:c=!0,killSignal:u="SIGTERM",forceKillAfterDelay:l=!0,gracefulCancel:d=!1,ipcInput:f,ipc:h=f!==void 0||d,serialization:p="advanced",...y})=>({...y,extendEnv:t,preferLocal:e,cwd:n,localDirectory:r,encoding:i,reject:s,cleanup:o,all:a,windowsHide:c,killSignal:u,forceKillAfterDelay:l,gracefulCancel:d,ipcInput:f,ipc:h,serialization:p}),aee=({env:t,extendEnv:e,preferLocal:n,node:r,localDirectory:i,nodePath:s})=>{const o=e?{...Ee.env,...t}:t;return n||r?CZ({env:o,cwd:i,execPath:s,preferLocal:n,addExecPath:r}):o};function v0(t){if(typeof t=="string")return cee(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return uee(t)}const cee=t=>t.at(-1)===ZI?t.slice(0,t.at(-2)===QI?-2:-1):t,uee=t=>t.at(-1)===lee?t.subarray(0,t.at(-2)===dee?-2:-1):t,ZI=`
1202
- `,lee=ZI.codePointAt(0),QI="\r",dee=QI.codePointAt(0);function fo(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function ex(t,{checkOpen:e=!0}={}){return fo(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function zp(t,{checkOpen:e=!0}={}){return fo(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function tx(t,e){return ex(t,e)&&zp(t,e)}const fee=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);let hee=class{#e;#t;#n=!1;#r=void 0;constructor(e,n){this.#e=e,this.#t=n}next(){const e=()=>this.#s();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){const n=()=>this.#i(e);return this.#r?this.#r.then(n,n):n()}async#s(){if(this.#n)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(n){throw this.#r=void 0,this.#n=!0,this.#e.releaseLock(),n}return e.done&&(this.#r=void 0,this.#n=!0,this.#e.releaseLock()),e}async#i(e){if(this.#n)return{done:!0,value:e};if(this.#n=!0,!this.#t){const n=this.#e.cancel(e);return this.#e.releaseLock(),await n,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}};const w0=Symbol();function nx(){return this[w0].next()}Object.defineProperty(nx,"name",{value:"next"});function rx(t){return this[w0].return(t)}Object.defineProperty(rx,"name",{value:"return"});const pee=Object.create(fee,{next:{enumerable:!0,configurable:!0,writable:!0,value:nx},return:{enumerable:!0,configurable:!0,writable:!0,value:rx}});function gee({preventCancel:t=!1}={}){const e=this.getReader(),n=new hee(e,t),r=Object.create(pee);return r[w0]=n,r}const mee=t=>{if(zp(t,{checkOpen:!1})&&b0.on!==void 0)return vee(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(yee.call(t)==="[object ReadableStream]")return gee.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:yee}=Object.prototype,vee=async function*(t){const e=new AbortController,n={};wee(t,e,n);try{for await(const[r]of b0.on(t,"data",{signal:e.signal}))yield r}catch(r){if(n.error!==void 0)throw n.error;if(!e.signal.aborted)throw r}finally{t.destroy()}},wee=async(t,e,n)=>{try{await b0.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(r){n.error=r}finally{e.abort()}},b0={},D0=async(t,{init:e,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{const u=mee(t),l=e();l.length=0;try{for await(const d of u){const f=Dee(d),h=n[f](d,l);ix({convertedChunk:h,state:l,getSize:r,truncateChunk:i,addChunk:s,maxBuffer:c})}return bee({state:l,convertChunk:n,getSize:r,truncateChunk:i,addChunk:s,getFinalChunk:o,maxBuffer:c}),a(l)}catch(d){const f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(l),f}},bee=({state:t,getSize:e,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:s})=>{const o=i(t);o!==void 0&&ix({convertedChunk:o,state:t,getSize:e,truncateChunk:n,addChunk:r,maxBuffer:s})},ix=({convertedChunk:t,state:e,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:s})=>{const o=n(t),a=e.length+o;if(a<=s){sx(t,e,i,a);return}const c=r(t,s-e.length);throw c!==void 0&&sx(c,e,i,s),new Hp},sx=(t,e,n,r)=>{e.contents=n(t,e,r),e.length=r},Dee=t=>{const e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";const n=ox.call(t);return n==="[object ArrayBuffer]"?"arrayBuffer":n==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&ox.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:ox}=Object.prototype;class Hp extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}const ho=t=>t,E0=()=>{},ax=({contents:t})=>t,cx=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ux=t=>t.length;async function Eee(t,e){return D0(t,$ee,e)}const Tee=()=>({contents:[]}),Ree=()=>1,See=(t,{contents:e})=>(e.push(t),e),$ee={init:Tee,convertChunk:{string:ho,buffer:ho,arrayBuffer:ho,dataView:ho,typedArray:ho,others:ho},getSize:Ree,truncateChunk:E0,addChunk:See,getFinalChunk:E0,finalize:ax};async function kee(t,e){return D0(t,Fee,e)}const Cee=()=>({contents:new ArrayBuffer(0)}),_ee=t=>Aee.encode(t),Aee=new TextEncoder,lx=t=>new Uint8Array(t),dx=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Iee=(t,e)=>t.slice(0,e),xee=(t,{contents:e,length:n},r)=>{const i=px()?Nee(e,r):Pee(e,r);return new Uint8Array(i).set(t,n),i},Pee=(t,e)=>{if(e<=t.byteLength)return t;const n=new ArrayBuffer(fx(e));return new Uint8Array(n).set(new Uint8Array(t),0),n},Nee=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;const n=new ArrayBuffer(e,{maxByteLength:fx(e)});return new Uint8Array(n).set(new Uint8Array(t),0),n},fx=t=>hx**Math.ceil(Math.log(t)/Math.log(hx)),hx=2,Oee=({contents:t,length:e})=>px()?t:t.slice(0,e),px=()=>"resize"in ArrayBuffer.prototype,Fee={init:Cee,convertChunk:{string:_ee,buffer:lx,arrayBuffer:lx,dataView:dx,typedArray:dx,others:cx},getSize:ux,truncateChunk:Iee,addChunk:xee,getFinalChunk:E0,finalize:Oee};async function Lee(t,e){return D0(t,qee,e)}const Mee=()=>({contents:"",textDecoder:new TextDecoder}),Kp=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Bee=(t,{contents:e})=>e+t,jee=(t,e)=>t.slice(0,e),Uee=({textDecoder:t})=>{const e=t.decode();return e===""?void 0:e},qee={init:Mee,convertChunk:{string:ho,buffer:Kp,arrayBuffer:Kp,dataView:Kp,typedArray:Kp,others:cx},getSize:ux,truncateChunk:jee,addChunk:Bee,getFinalChunk:Uee,finalize:ax},Wee=({error:t,stream:e,readableObjectMode:n,lines:r,encoding:i,fdNumber:s})=>{if(!(t instanceof Hp))throw t;if(s==="all")return t;const o=Gee(n,r,i);throw t.maxBufferInfo={fdNumber:s,unit:o},e.destroy(),t},Gee=(t,e,n)=>t?"objects":e?"lines":n==="buffer"?"bytes":"characters",zee=(t,e,n)=>{if(e.length!==n)return;const r=new Hp;throw r.maxBufferInfo={fdNumber:"ipc"},r},Hee=(t,e)=>{const{streamName:n,threshold:r,unit:i}=Kee(t,e);return`Command's ${n} was larger than ${r} ${i}`},Kee=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};const{maxBufferInfo:{fdNumber:n,unit:r}}=t;delete t.maxBufferInfo;const i=Pl(e,n);return n==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:YA(n),threshold:i,unit:r}},Vee=(t,e,n)=>t?.code==="ENOBUFS"&&e!==null&&e.some(r=>r!==null&&r.length>T0(n)),Yee=(t,e,n)=>{if(!e)return t;const r=T0(n);return t.length>r?t.slice(0,r):t},T0=([,t])=>t,Xee=({stdio:t,all:e,ipcOutput:n,originalError:r,signal:i,signalDescription:s,exitCode:o,escapedCommand:a,timedOut:c,isCanceled:u,isGracefullyCanceled:l,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:p,maxBuffer:y,timeout:T,cwd:b})=>{const v=r?.code,D=Jee({originalError:r,timedOut:c,timeout:T,isMaxBuffer:d,maxBuffer:y,errorCode:v,signal:i,signalDescription:s,exitCode:o,isCanceled:u,isGracefullyCanceled:l,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:p}),k=Qee(r,b),P=k===void 0?"":`
1203
- ${k}`,M=`${D}: ${a}${P}`,I=e===void 0?[t[2],t[1]]:[e],G=[M,...I,...t.slice(3),n.map(U=>ete(U)).join(`
1204
- `)].map(U=>Gw(v0(tte(U)))).filter(Boolean).join(`
1205
-
1206
- `);return{originalMessage:k,shortMessage:M,message:G}},Jee=({originalError:t,timedOut:e,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:s,signal:o,signalDescription:a,exitCode:c,isCanceled:u,isGracefullyCanceled:l,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:h})=>{const p=Zee(d,f);return e?`Command timed out after ${n} milliseconds${p}`:l?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${p}`:`Command was gracefully canceled with ${o} (${a})`:u?`Command was canceled${p}`:r?`${Hee(t,i)}${p}`:s!==void 0?`Command failed with ${s}${p}`:d?`Command was killed with ${h} (${II(h)})${p}`:o!==void 0?`Command was killed with ${o} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Zee=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Qee=(t,e)=>{if(t instanceof Ol)return;const n=AZ(t)?t.originalMessage:String(t?.message??t),r=Gw(see(n,e));return r===""?void 0:r},ete=t=>typeof t=="string"?t:sb(t),tte=t=>Array.isArray(t)?t.map(e=>v0(gx(e))).filter(Boolean).join(`
1207
- `):gx(t),gx=t=>typeof t=="string"?t:dr(t)?GA(t):"",mx=({command:t,escapedCommand:e,stdio:n,all:r,ipcOutput:i,options:{cwd:s},startTime:o})=>yx({command:t,escapedCommand:e,cwd:s,durationMs:oI(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),R0=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:o})=>S0({error:t,command:e,escapedCommand:n,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:o}),S0=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:u,signal:l,stdio:d,all:f,ipcOutput:h,options:{timeoutDuration:p,timeout:y=p,forceKillAfterDelay:T,killSignal:b,cwd:v,maxBuffer:D},isSync:k})=>{const{exitCode:P,signal:M,signalDescription:I}=rte(u,l),{originalMessage:G,shortMessage:U,message:W}=Xee({stdio:d,all:f,ipcOutput:h,originalError:t,signal:M,signalDescription:I,exitCode:P,escapedCommand:n,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:T,killSignal:b,maxBuffer:D,timeout:y,cwd:v}),A=_Z(t,W,k);return Object.assign(A,nte({error:A,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:P,signal:M,signalDescription:I,stdio:d,all:f,ipcOutput:h,cwd:v,originalMessage:G,shortMessage:U})),A},nte=({error:t,command:e,escapedCommand:n,startTime:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:u,signal:l,signalDescription:d,stdio:f,all:h,ipcOutput:p,cwd:y,originalMessage:T,shortMessage:b})=>yx({shortMessage:b,originalMessage:T,command:e,escapedCommand:n,cwd:y,durationMs:oI(r),failed:!0,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isTerminated:l!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:u,signal:l,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:h,stdio:f,ipcOutput:p,pipedFrom:[]}),yx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),rte=(t,e)=>{const n=t===null?void 0:t,r=e===null?void 0:e,i=r===void 0?void 0:II(e);return{exitCode:n,signal:r,signalDescription:i}},vx=t=>Number.isFinite(t)?t:0;function ite(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(vx(t*1e3)%1e3),nanoseconds:Math.trunc(vx(t*1e6)%1e3)}}function ste(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function ote(t){switch(typeof t){case"number":{if(Number.isFinite(t))return ite(t);break}case"bigint":return ste(t)}throw new TypeError("Expected a finite number or bigint")}const ate=t=>t===0||t===0n,cte=(t,e)=>e===1||e===1n?t:`${t}s`,ute=1e-7,lte=24n*60n*60n*1000n;function wx(t,e){const n=typeof t=="bigint";if(!n&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};const r=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[];const s=(l,d)=>{const f=Math.floor(l*10**d+ute);return(Math.round(f)/10**d).toFixed(d)},o=(l,d,f,h)=>{if(!((i.length===0||!e.colonNotation)&&ate(l)&&!(e.colonNotation&&f==="m"))){if(h??=String(l),e.colonNotation){const p=h.includes(".")?h.split(".")[0].length:h.length,y=i.length>0?2:1;h="0".repeat(Math.max(0,y-p))+h}else h+=e.verbose?" "+cte(d,l):f;i.push(h)}},a=ote(t),c=BigInt(a.days);if(o(c/365n,"year","y"),o(c%365n,"day","d"),o(Number(a.hours),"hour","h"),o(Number(a.minutes),"minute","m"),e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3){const l=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),h=Number(a.nanoseconds);if(o(l,"second","s"),e.formatSubMilliseconds)o(d,"millisecond","ms"),o(f,"microsecond","\xB5s"),o(h,"nanosecond","ns");else{const p=d+f/1e3+h/1e6,y=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,T=p>=1?Math.round(p):Math.ceil(p),b=y?p.toFixed(y):T;o(Number.parseFloat(b),"millisecond","ms",b)}}else{const l=(n?Number(t%lte):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=s(l,d),h=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");o(Number.parseFloat(h),"second","s",h)}if(i.length===0)return r+"0"+(e.verbose?" milliseconds":"ms");const u=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),r+i.join(u)}const dte=(t,e)=>{t.failed&&Nl({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})},fte=(t,e)=>{Bw(e)&&(dte(t,e),hte(t,e))},hte=(t,e)=>{const n=`(done in ${wx(t.durationMs)})`;Nl({type:"duration",verboseMessage:n,verboseInfo:e,result:t})},$0=(t,e,{reject:n})=>{if(fte(t,e),t.failed&&n)throw t;return t},pte=(t,e)=>Fa(t)?"asyncGenerator":Rx(t)?"generator":C0(t)?"fileUrl":bte(t)?"filePath":Tte(t)?"webStream":fo(t,{checkOpen:!1})?"native":dr(t)?"uint8Array":Rte(t)?"asyncIterable":Ste(t)?"iterable":A0(t)?bx({transform:t},e):vte(t)?gte(t,e):"native",gte=(t,e)=>tx(t.transform,{checkOpen:!1})?mte(t,e):A0(t.transform)?bx(t,e):yte(t,e),mte=(t,e)=>(Dx(t,e,"Duplex stream"),"duplex"),bx=(t,e)=>(Dx(t,e,"web TransformStream"),"webTransform"),Dx=({final:t,binary:e,objectMode:n},r,i)=>{Ex(t,`${r}.final`,i),Ex(e,`${r}.binary`,i),k0(n,`${r}.objectMode`)},Ex=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${n}.`)},yte=({transform:t,final:e,binary:n,objectMode:r},i)=>{if(t!==void 0&&!Tx(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(tx(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(A0(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!Tx(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return k0(n,`${i}.binary`),k0(r,`${i}.objectMode`),Fa(t)||Fa(e)?"asyncGenerator":"generator"},k0=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},Tx=t=>Fa(t)||Rx(t),Fa=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",Rx=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",vte=t=>Vn(t)&&(t.transform!==void 0||t.final!==void 0),C0=t=>Object.prototype.toString.call(t)==="[object URL]",wte=t=>C0(t)&&t.protocol!=="file:",bte=t=>Vn(t)&&Object.keys(t).length===1&&Sx(t.file),Sx=t=>typeof t=="string",Dte=(t,e)=>t==="native"&&typeof e=="string"&&!Ete.has(e),Ete=new Set(["ipc","ignore","inherit","overlapped","pipe"]),$x=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",_0=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Tte=t=>$x(t)||_0(t),A0=t=>$x(t?.readable)&&_0(t?.writable),Rte=t=>kx(t)&&typeof t[Symbol.asyncIterator]=="function",Ste=t=>kx(t)&&typeof t[Symbol.iterator]=="function",kx=t=>typeof t=="object"&&t!==null,po=new Set(["generator","asyncGenerator","duplex","webTransform"]),Cx=new Set(["fileUrl","filePath","fileNumber"]),_x=new Set(["fileUrl","filePath"]),$te=new Set([..._x,"webStream","nodeStream"]),kte=new Set(["webTransform","duplex"]),Vp={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"},Ax=(t,e,n,r)=>r==="output"?Cte(t,e,n):_te(t,e,n),Cte=(t,e,n)=>{const r=e!==0&&n[e-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t??r}},_te=(t,e,n)=>{const r=e===0?t===!0:n[e-1].value.readableObjectMode,i=e!==n.length-1&&(t??r);return{writableObjectMode:r,readableObjectMode:i}},Ate=(t,e)=>{const n=t.findLast(({type:r})=>po.has(r));return n===void 0?!1:e==="input"?n.value.writableObjectMode:n.value.readableObjectMode},Ite=(t,e,n,r)=>[...t.filter(({type:i})=>!po.has(i)),...xte(t,e,n,r)],xte=(t,e,n,{encoding:r})=>{const i=t.filter(({type:o})=>po.has(o)),s=Array.from({length:i.length});for(const[o,a]of Object.entries(i))s[o]=Pte({stdioItem:a,index:Number(o),newTransforms:s,optionName:e,direction:n,encoding:r});return Lte(s,n)},Pte=({stdioItem:t,stdioItem:{type:e},index:n,newTransforms:r,optionName:i,direction:s,encoding:o})=>e==="duplex"?Nte({stdioItem:t,optionName:i}):e==="webTransform"?Ote({stdioItem:t,index:n,newTransforms:r,direction:s}):Fte({stdioItem:t,index:n,newTransforms:r,direction:s,encoding:o}),Nte=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:n,readableObjectMode:r},objectMode:i=r}},optionName:s})=>{if(i&&!r)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&r)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:n,readableObjectMode:r}}},Ote=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i})=>{const{transform:s,objectMode:o}=Vn(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=Ax(o,n,r,i);return{...t,value:{transform:s,writableObjectMode:a,readableObjectMode:c}}},Fte=({stdioItem:t,stdioItem:{value:e},index:n,newTransforms:r,direction:i,encoding:s})=>{const{transform:o,final:a,binary:c=!1,preserveNewlines:u=!1,objectMode:l}=Vn(e)?e:{transform:e},d=c||lo.has(s),{writableObjectMode:f,readableObjectMode:h}=Ax(l,n,r,i);return{...t,value:{transform:o,final:a,binary:d,preserveNewlines:u,writableObjectMode:f,readableObjectMode:h}}},Lte=(t,e)=>e==="input"?t.reverse():t,Mte=(t,e,n)=>{const r=t.map(i=>Bte(i,e));if(r.includes("input")&&r.includes("output"))throw new TypeError(`The \`${n}\` option must not be an array of both readable and writable values.`);return r.find(Boolean)??qte},Bte=({type:t,value:e},n)=>jte[n]??Ix[t](e),jte=["input","output","output"],La=()=>{},I0=()=>"input",Ix={generator:La,asyncGenerator:La,fileUrl:La,filePath:La,iterable:I0,asyncIterable:I0,uint8Array:I0,webStream:t=>_0(t)?"output":"input",nodeStream(t){return zp(t,{checkOpen:!1})?ex(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:La,duplex:La,native(t){const e=Ute(t);if(e!==void 0)return e;if(fo(t,{checkOpen:!1}))return Ix.nodeStream(t)}},Ute=t=>{if([0,Ee.stdin].includes(t))return"input";if([1,2,Ee.stdout,Ee.stderr].includes(t))return"output"},qte="output",Wte=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t,Gte=({stdio:t,ipc:e,buffer:n,...r},i,s)=>{const o=zte(t,r).map((a,c)=>xx(a,c));return s?Kte(o,n,i):Wte(o,e)},zte=(t,e)=>{if(t===void 0)return jr.map(r=>e[r]);if(Hte(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${jr.map(r=>`\`${r}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const n=Math.max(t.length,jr.length);return Array.from({length:n},(r,i)=>t[i])},Hte=t=>jr.some(e=>t[e]!==void 0),xx=(t,e)=>Array.isArray(t)?t.map(n=>xx(n,e)):t??(e>=jr.length?"ignore":"pipe"),Kte=(t,e,n)=>t.map((r,i)=>!e[i]&&i!==0&&!jw(n,i)&&Vte(r)?"ignore":r),Vte=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe"),Yte=({stdioItem:t,stdioItem:{type:e},isStdioArray:n,fdNumber:r,direction:i,isSync:s})=>!n||e!=="native"?t:s?Xte({stdioItem:t,fdNumber:r,direction:i}):Qte({stdioItem:t,fdNumber:r}),Xte=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r,direction:i})=>{const s=Jte({value:e,optionName:n,fdNumber:r,direction:i});if(s!==void 0)return s;if(fo(e,{checkOpen:!1}))throw new TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Jte=({value:t,optionName:e,fdNumber:n,direction:r})=>{const i=Zte(t,n);if(i!==void 0){if(r==="output")return{type:"fileNumber",value:i,optionName:e};if(ob.isatty(i))throw new TypeError(`The \`${e}: ${d0(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:xl(sg(i)),optionName:e}}},Zte=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;const n=Mw.indexOf(t);if(n!==-1)return n},Qte=({stdioItem:t,stdioItem:{value:e,optionName:n},fdNumber:r})=>e==="inherit"?{type:"nodeStream",value:Px(r,e,n),optionName:n}:typeof e=="number"?{type:"nodeStream",value:Px(e,e,n),optionName:n}:fo(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:n}:t,Px=(t,e,n)=>{const r=Mw[t];if(r===void 0)throw new TypeError(`The \`${n}: ${e}\` option is invalid: no such standard stream.`);return r},ene=({input:t,inputFile:e},n)=>n===0?[...tne(t),...rne(e)]:[],tne=t=>t===void 0?[]:[{type:nne(t),value:t,optionName:"input"}],nne=t=>{if(zp(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(dr(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},rne=t=>t===void 0?[]:[{...ine(t),optionName:"inputFile"}],ine=t=>{if(C0(t))return{type:"fileUrl",value:t};if(Sx(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")},sne=t=>t.filter((e,n)=>t.every((r,i)=>e.value!==r.value||n>=i||e.type==="generator"||e.type==="asyncGenerator")),one=({stdioItem:{type:t,value:e,optionName:n},direction:r,fileDescriptors:i,isSync:s})=>{const o=ane(i,t);if(o.length!==0){if(s){cne({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});return}if($te.has(t))return Nx({otherStdioItems:o,type:t,value:e,optionName:n,direction:r});kte.has(t)&&lne({otherStdioItems:o,type:t,value:e,optionName:n})}},ane=(t,e)=>t.flatMap(({direction:n,stdioItems:r})=>r.filter(i=>i.type===e).map(i=>({...i,direction:n}))),cne=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{_x.has(e)&&Nx({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})},Nx=({otherStdioItems:t,type:e,value:n,optionName:r,direction:i})=>{const s=t.filter(a=>une(a,n));if(s.length===0)return;const o=s.find(a=>a.direction!==i);return Ox(o,r,e),i==="output"?s[0].stream:void 0},une=({type:t,value:e},n)=>t==="filePath"?e.file===n.file:t==="fileUrl"?e.href===n.href:e===n,lne=({otherStdioItems:t,type:e,value:n,optionName:r})=>{const i=t.find(({value:{transform:s}})=>s===n.transform);Ox(i,r,e)},Ox=(t,e,n)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${Vp[n]} that is the same.`)},Fx=(t,e,n,r)=>{const s=Gte(e,n,r).map((a,c)=>dne({stdioOption:a,fdNumber:c,options:e,isSync:r})),o=wne({initialFileDescriptors:s,addProperties:t,options:e,isSync:r});return e.stdio=o.map(({stdioItems:a})=>Ene(a)),o},dne=({stdioOption:t,fdNumber:e,options:n,isSync:r})=>{const i=YA(e),{stdioItems:s,isStdioArray:o}=fne({stdioOption:t,fdNumber:e,options:n,optionName:i}),a=Mte(s,e,i),c=s.map(d=>Yte({stdioItem:d,isStdioArray:o,fdNumber:e,direction:a,isSync:r})),u=Ite(c,i,a,n),l=Ate(u,a);return vne(u,l),{direction:a,objectMode:l,stdioItems:u}},fne=({stdioOption:t,fdNumber:e,options:n,optionName:r})=>{const s=[...(Array.isArray(t)?t:[t]).map(c=>hne(c,r)),...ene(n,e)],o=sne(s),a=o.length>1;return pne(o,a,r),mne(o),{stdioItems:o,isStdioArray:a}},hne=(t,e)=>({type:pte(t,e),value:t,optionName:e}),pne=(t,e,n)=>{if(t.length===0)throw new TypeError(`The \`${n}\` option must not be an empty array.`);if(e){for(const{value:r,optionName:i}of t)if(gne.has(r))throw new Error(`The \`${i}\` option must not include \`${r}\`.`)}},gne=new Set(["ignore","ipc"]),mne=t=>{for(const e of t)yne(e)},yne=({type:t,value:e,optionName:n})=>{if(wte(e))throw new TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
1208
- For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Dte(t,e))throw new TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},vne=(t,e)=>{if(!e)return;const n=t.find(({type:r})=>Cx.has(r));if(n!==void 0)throw new TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},wne=({initialFileDescriptors:t,addProperties:e,options:n,isSync:r})=>{const i=[];try{for(const s of t)i.push(bne({fileDescriptor:s,fileDescriptors:i,addProperties:e,options:n,isSync:r}));return i}catch(s){throw Lx(i),s}},bne=({fileDescriptor:{direction:t,objectMode:e,stdioItems:n},fileDescriptors:r,addProperties:i,options:s,isSync:o})=>{const a=n.map(c=>Dne({stdioItem:c,addProperties:i,direction:t,options:s,fileDescriptors:r,isSync:o}));return{direction:t,objectMode:e,stdioItems:a}},Dne=({stdioItem:t,addProperties:e,direction:n,options:r,fileDescriptors:i,isSync:s})=>{const o=one({stdioItem:t,direction:n,fileDescriptors:i,isSync:s});return o!==void 0?{...t,stream:o}:{...t,...e[n][t.type](t,r)}},Lx=t=>{for(const{stdioItems:e}of t)for(const{stream:n}of e)n!==void 0&&!co(n)&&n.destroy()},Ene=t=>{if(t.length>1)return t.some(({value:r})=>r==="overlapped")?"overlapped":"pipe";const[{type:e,value:n}]=t;return e==="native"?n:"pipe"},Tne=(t,e)=>Fx(Sne,t,e,!0),Ur=({type:t,optionName:e})=>{Mx(e,Vp[t])},Rne=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&Mx(t,`"${e}"`),{}),Mx=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},Bx={generator(){},asyncGenerator:Ur,webStream:Ur,nodeStream:Ur,webTransform:Ur,duplex:Ur,asyncIterable:Ur,native:Rne},Sne={input:{...Bx,fileUrl:({value:t})=>({contents:[xl(sg(t))]}),filePath:({value:{file:t}})=>({contents:[xl(sg(t))]}),fileNumber:Ur,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...Bx,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t}})=>({path:t}),fileNumber:({value:t})=>({path:t}),iterable:Ur,string:Ur,uint8Array:Ur}},Ma=(t,{stripFinalNewline:e},n)=>jx(e,n)&&t!==void 0&&!Array.isArray(t)?v0(t):t,jx=(t,e)=>e==="all"?t[1]||t[2]:t[e],Ux=(t,e,n,r)=>t||n?void 0:Gx(e,r),qx=(t,e,n)=>n?t.flatMap(r=>Wx(r,e)):Wx(t,e),Wx=(t,e)=>{const{transform:n,final:r}=Gx(e,{});return[...n(t),...r()]},Gx=(t,e)=>(e.previousChunks="",{transform:$ne.bind(void 0,e,t),final:Cne.bind(void 0,e)}),$ne=function*(t,e,n){if(typeof n!="string"){yield n;return}let{previousChunks:r}=t,i=-1;for(let s=0;s<n.length;s+=1)if(n[s]===`
1209
- `){const o=kne(n,s,e,t);let a=n.slice(i+1,s+1-o);r.length>0&&(a=x0(r,a),r=""),yield a,i=s}i!==n.length-1&&(r=x0(r,n.slice(i+1))),t.previousChunks=r},kne=(t,e,n,r)=>n?0:(r.isWindowsNewline=e!==0&&t[e-1]==="\r",r.isWindowsNewline?2:1),Cne=function*({previousChunks:t}){t.length>0&&(yield t)},_ne=({binary:t,preserveNewlines:e,readableObjectMode:n,state:r})=>t||e||n?void 0:{transform:Ane.bind(void 0,r)},Ane=function*({isWindowsNewline:t=!1},e){const{unixNewline:n,windowsNewline:r,LF:i,concatBytes:s}=typeof e=="string"?Ine:Pne;if(e.at(-1)===i){yield e;return}yield s(e,t?r:n)},x0=(t,e)=>`${t}${e}`,Ine={windowsNewline:`\r
1210
- `,unixNewline:`
1211
- `,LF:`
1212
- `,concatBytes:x0},xne=(t,e)=>{const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n},Pne={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:xne},Nne=(t,e)=>t?void 0:One.bind(void 0,e),One=function*(t,e){if(typeof e!="string"&&!dr(e)&&!dg.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Fne=(t,e)=>t?Lne.bind(void 0,e):Mne.bind(void 0,e),Lne=function*(t,e){zx(t,e),yield e},Mne=function*(t,e){if(zx(t,e),typeof e!="string"&&!dr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},zx=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
1213
- Instead, \`yield\` should either be called with a value, or not be called at all. For example:
1214
- if (condition) { yield value; }`)},Hx=(t,e,n)=>{if(n)return;if(t)return{transform:Bne.bind(void 0,new TextEncoder)};const r=new cb(e);return{transform:jne.bind(void 0,r),final:Une.bind(void 0,r)}},Bne=function*(t,e){dg.isBuffer(e)?yield xl(e):typeof e=="string"?yield t.encode(e):yield e},jne=function*(t,e){yield dr(e)?t.write(e):e},Une=function*(t){const e=t.end();e!==""&&(yield e)},Kx=wo(async(t,e,n,r)=>{e.currentIterable=t(...n);try{for await(const i of e.currentIterable)r.push(i)}finally{delete e.currentIterable}}),P0=async function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=zne}=e[n];for await(const i of r(t))yield*P0(i,e,n+1)},qne=async function*(t){for(const[e,{final:n}]of Object.entries(t))yield*Wne(n,Number(e),t)},Wne=async function*(t,e,n){if(t!==void 0)for await(const r of t())yield*P0(r,n,e+1)},Gne=wo(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),zne=function*(t){yield t},Vx=(t,e,n,r)=>{try{for(const i of t(...e))n.push(i);r()}catch(i){r(i)}},Hne=(t,e)=>[...e.flatMap(n=>[...Bl(n,t,0)]),...N0(t)],Bl=function*(t,e,n){if(n===e.length){yield t;return}const{transform:r=Vne}=e[n];for(const i of r(t))yield*Bl(i,e,n+1)},N0=function*(t){for(const[e,{final:n}]of Object.entries(t))yield*Kne(n,Number(e),t)},Kne=function*(t,e,n){if(t!==void 0)for(const r of t())yield*Bl(r,n,e+1)},Vne=function*(t){yield t},Yx=({value:t,value:{transform:e,final:n,writableObjectMode:r,readableObjectMode:i},optionName:s},{encoding:o})=>{const a={},c=Jx(t,o,s),u=Fa(e),l=Fa(n),d=u?Kx.bind(void 0,P0,a):Vx.bind(void 0,Bl),f=u||l?Kx.bind(void 0,qne,a):Vx.bind(void 0,N0),h=u||l?Gne.bind(void 0,a):void 0;return{stream:new PN({writableObjectMode:r,writableHighWaterMark:Kl(r),readableObjectMode:i,readableHighWaterMark:Kl(i),transform(y,T,b){d([y,c,0],this,b)},flush(y){f([c],this,y)},destroy:h})}},Xx=(t,e,n,r)=>{const i=e.filter(({type:o})=>o==="generator"),s=r?i.reverse():i;for(const{value:o,optionName:a}of s){const c=Jx(o,n,a);t=Hne(c,t)}return t},Jx=({transform:t,final:e,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:s},o,a)=>{const c={};return[{transform:Nne(r,a)},Hx(n,o,r),Ux(n,s,r,c),{transform:t,final:e},{transform:Fne(i,a)},_ne({binary:n,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)},Yne=(t,e)=>{for(const n of Xne(t))Jne(t,n,e)},Xne=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Jne=(t,e,n)=>{const{stdioItems:r}=t[e],i=r.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){const[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Vp[a]} with synchronous methods.`)}const o=i.map(({contents:a})=>a).map(a=>Zne(a,r));n.input=Lw(o)},Zne=(t,e)=>{const n=Xx(t,e,"utf8",!0);return Qne(n),Lw(n)},Qne=t=>{const e=t.find(n=>typeof n!="string"&&!dr(n));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)},Zx=({stdioItems:t,encoding:e,verboseInfo:n,fdNumber:r})=>r!=="all"&&jw(n,r)&&!lo.has(e)&&ere(r)&&(t.some(({type:i,value:s})=>i==="native"&&tre.has(s))||t.every(({type:i})=>po.has(i))),ere=t=>t===1||t===2,tre=new Set(["pipe","overlapped"]),nre=async(t,e,n,r)=>{for await(const i of t)ire(e)||Qx(i,n,r)},rre=(t,e,n)=>{for(const r of t)Qx(r,e,n)},ire=t=>t._readableState.pipes.length>0,Qx=(t,e,n)=>{const r=iI(t);Nl({type:"output",verboseMessage:r,fdNumber:e,verboseInfo:n})},sre=({fileDescriptors:t,syncResult:{output:e},options:n,isMaxBuffer:r,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};const s={},o=new Set([]);return{output:e.map((c,u)=>ore({result:c,fileDescriptors:t,fdNumber:u,state:s,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...s}},ore=({result:t,fileDescriptors:e,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:u,stripFinalNewline:l,maxBuffer:d})=>{if(t===null)return;const f=Yee(t,s,d),h=xl(f),{stdioItems:p,objectMode:y}=e[n],T=are([h],p,c,r),{serializedResult:b,finalResult:v=b}=cre({chunks:T,objectMode:y,encoding:c,lines:u,stripFinalNewline:l,fdNumber:n});ure({serializedResult:b,fdNumber:n,state:r,verboseInfo:o,encoding:c,stdioItems:p,objectMode:y});const D=a[n]?v:void 0;try{return r.error===void 0&&lre(b,p,i),D}catch(k){return r.error=k,D}},are=(t,e,n,r)=>{try{return Xx(t,e,n,!1)}catch(i){return r.error=i,t}},cre=({chunks:t,objectMode:e,encoding:n,lines:r,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(n==="buffer")return{serializedResult:Lw(t)};const o=qX(t,n);return r[s]?{serializedResult:o,finalResult:qx(o,!i[s],e)}:{serializedResult:o}},ure=({serializedResult:t,fdNumber:e,state:n,verboseInfo:r,encoding:i,stdioItems:s,objectMode:o})=>{if(!Zx({stdioItems:s,encoding:i,verboseInfo:r,fdNumber:e}))return;const a=qx(t,!1,o);try{rre(a,e,r)}catch(c){n.error??=c}},lre=(t,e,n)=>{for(const{path:r}of e.filter(({type:i})=>Cx.has(i))){const i=typeof r=="string"?r:r.toString();n.has(i)?cN(r,t):(n.add(i),nb(r,t))}},dre=([,t,e],n)=>{if(n.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Ma(e,n,"all")]:Array.isArray(e)?[Ma(t,n,"all"),...e]:dr(t)&&dr(e)?zA([t,e]):`${t}${e}`},fre=async(t,e)=>{const[n,r]=await hre(t);return e.isForcefullyTerminated??=!1,[n,r]},hre=async t=>{const[e,n]=await Promise.allSettled([cn(t,"spawn"),cn(t,"exit")]);return e.status==="rejected"?[]:n.status==="rejected"?eP(t):n.value},eP=async t=>{try{return await cn(t,"exit")}catch{return eP(t)}},pre=async t=>{const[e,n]=await t;if(!gre(e,n)&&tP(e,n))throw new Ol;return[e,n]},gre=(t,e)=>t===void 0&&e===void 0,tP=(t,e)=>t!==0||e!==null,mre=({error:t,status:e,signal:n,output:r},{maxBuffer:i})=>{const s=yre(t,e,n),o=s?.code==="ETIMEDOUT",a=Vee(s,r,i);return{resultError:s,exitCode:e,signal:n,timedOut:o,isMaxBuffer:a}},yre=(t,e,n)=>t!==void 0?t:tP(e,n)?new Ol:void 0,vre=(t,e,n)=>{const{file:r,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=wre(t,e,n),d=Ere({file:r,commandArguments:i,options:u,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:l,startTime:a});return $0(d,c,u)},wre=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=aI(t,e,n),a=bre(n),{file:c,commandArguments:u,options:l}=JI(t,e,a);Dre(l);const d=Tne(l,o);return{file:c,commandArguments:u,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},bre=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Dre=({ipc:t,ipcInput:e,detached:n,cancelSignal:r})=>{e&&Yp("ipcInput"),t&&Yp("ipc: true"),n&&Yp("detached: true"),r&&Yp("cancelSignal")},Yp=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Ere=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{const c=Tre({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;const{resultError:u,exitCode:l,signal:d,timedOut:f,isMaxBuffer:h}=mre(c,n),{output:p,error:y=u}=sre({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:h,verboseInfo:s}),T=p.map((v,D)=>Ma(v,n,D)),b=Ma(dre(p,n),n,"all");return Sre({error:y,exitCode:l,signal:d,timedOut:f,isMaxBuffer:h,stdio:T,all:b,options:n,command:r,escapedCommand:i,startTime:a})},Tre=({file:t,commandArguments:e,options:n,command:r,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{Yne(s,n);const a=Rre(n);return RN(t,e,a)}catch(a){return R0({error:a,command:r,escapedCommand:i,fileDescriptors:s,options:n,startTime:o,isSync:!0})}},Rre=({encoding:t,maxBuffer:e,...n})=>({...n,encoding:"buffer",maxBuffer:T0(e)}),Sre=({error:t,exitCode:e,signal:n,timedOut:r,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:u,startTime:l})=>t===void 0?mx({command:c,escapedCommand:u,stdio:s,all:o,ipcOutput:[],options:a,startTime:l}):S0({error:t,command:c,escapedCommand:u,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:n,stdio:s,all:o,ipcOutput:[],options:a,startTime:l,isSync:!0}),$re=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0,filter:s}={})=>(c0({methodName:"getOneMessage",isSubprocess:n,ipc:r,isConnected:qI(t)}),kre({anyProcess:t,channel:e,isSubprocess:n,filter:s,reference:i})),kre=async({anyProcess:t,channel:e,isSubprocess:n,filter:r,reference:i})=>{jI(e,i);const s=jp(t,e,n),o=new AbortController;try{return await Promise.race([Cre(s,r,o),_re(s,n,o),Are(s,n,o)])}catch(a){throw u0(t),a}finally{o.abort(),UI(e,i)}},Cre=async(t,e,{signal:n})=>{if(e===void 0){const[r]=await cn(t,"message",{signal:n});return r}for await(const[r]of Hl(t,"message",{signal:n}))if(e(r))return r},_re=async(t,e,{signal:n})=>{await cn(t,"disconnect",{signal:n}),iQ(e)},Are=async(t,e,{signal:n})=>{const[r]=await cn(t,"strict:error",{signal:n});throw OI(r,e)},Ire=({anyProcess:t,channel:e,isSubprocess:n,ipc:r},{reference:i=!0}={})=>nP({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),nP=({anyProcess:t,channel:e,isSubprocess:n,ipc:r,shouldAwait:i,reference:s})=>{c0({methodName:"getEachMessage",isSubprocess:n,ipc:r,isConnected:qI(t)}),jI(e,s);const o=jp(t,e,n),a=new AbortController,c={};return xre(t,o,a),Pre({ipcEmitter:o,isSubprocess:n,controller:a,state:c}),Nre({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:a,state:c,reference:s})},xre=async(t,e,n)=>{try{await cn(e,"disconnect",{signal:n.signal}),n.abort()}catch{}},Pre=async({ipcEmitter:t,isSubprocess:e,controller:n,state:r})=>{try{const[i]=await cn(t,"strict:error",{signal:n.signal});r.error=OI(i,e),n.abort()}catch{}},Nre=async function*({anyProcess:t,channel:e,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(const[c]of Hl(n,"message",{signal:s.signal}))rP(o),yield c}catch{rP(o)}finally{s.abort(),UI(e,a),r||u0(t),i&&await t}},rP=({error:t})=>{if(t)throw t},Ore=(t,{ipc:e})=>{Object.assign(t,iP(t,!1,e))},Fre=()=>{const t=Ee,e=!0,n=Ee.channel!==void 0;return{...iP(t,e,n),getCancelSignal:MQ.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}},iP=(t,e,n)=>({sendMessage:GI.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getOneMessage:$re.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n}),getEachMessage:Ire.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:n})}),Lre=({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,verboseInfo:o})=>{Lx(r);const a=new ab;Mre(a,r),Object.assign(a,{readable:Bre,writable:jre,duplex:Ure});const c=R0({error:t,command:e,escapedCommand:n,fileDescriptors:r,options:i,startTime:s,isSync:!1}),u=qre(c,o,i);return{subprocess:a,promise:u}},Mre=(t,e)=>{const n=jl(),r=jl(),i=jl(),s=Array.from({length:e.length-3},jl),o=jl(),a=[n,r,i,...s];Object.assign(t,{stdin:n,stdout:r,stderr:i,all:o,stdio:a})},jl=()=>{const t=new fb;return t.end(),t},Bre=()=>new Is({read(){}}),jre=()=>new ug({write(){}}),Ure=()=>new lg({read(){},write(){}}),qre=async(t,e,n)=>$0(t,e,n),Wre=(t,e)=>Fx(Gre,t,e,!1),Ul=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Vp[t]}.`)},sP={fileNumber:Ul,generator:Yx,asyncGenerator:Yx,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:n}}){const r=e||n;return{stream:lg.fromWeb(t,{objectMode:r})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Gre={input:{...sP,fileUrl:({value:t})=>({stream:rb(t)}),filePath:({value:{file:t}})=>({stream:rb(t)}),webStream:({value:t})=>({stream:Is.fromWeb(t)}),iterable:({value:t})=>({stream:Is.from(t)}),asyncIterable:({value:t})=>({stream:Is.from(t)}),string:({value:t})=>({stream:Is.from(t)}),uint8Array:({value:t})=>({stream:Is.from(dg.from(t))})},output:{...sP,fileUrl:({value:t})=>({stream:ib(t)}),filePath:({value:{file:t}})=>({stream:ib(t)}),webStream:({value:t})=>({stream:ug.fromWeb(t)}),iterable:Ul,asyncIterable:Ul,string:Ul,uint8Array:Ul}};function O0(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(const i of t)F0(i);const e=t.some(({readableObjectMode:i})=>i),n=zre(t,e),r=new Hre({objectMode:e,writableHighWaterMark:n,readableHighWaterMark:n});for(const i of t)r.add(i);return r}const zre=(t,e)=>{if(t.length===0)return Kl(e);const n=t.filter(({readableObjectMode:r})=>r===e).map(({readableHighWaterMark:r})=>r);return Math.max(...n)};class Hre extends fb{#e=new Set([]);#t=new Set([]);#n=new Set([]);#r;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(F0(e),this.#e.has(e))return;this.#e.add(e),this.#r??=Kre(this,this.#e,this.#s);const n=Xre({passThroughStream:this,stream:e,streams:this.#e,ended:this.#t,aborted:this.#n,onFinished:this.#r,unpipeEvent:this.#s});this.#i.set(e,n),e.pipe(this,{end:!1})}async remove(e){if(F0(e),!this.#e.has(e))return!1;const n=this.#i.get(e);return n===void 0?!1:(this.#i.delete(e),e.unpipe(this),await n,!0)}}const Kre=async(t,e,n)=>{Xp(t,uP);const r=new AbortController;try{await Promise.race([Vre(t,r),Yre(t,e,n,r)])}finally{r.abort(),Xp(t,-uP)}},Vre=async(t,{signal:e})=>{try{await Ai(t,{signal:e,cleanup:!0})}catch(n){throw oP(t,n),n}},Yre=async(t,e,n,{signal:r})=>{for await(const[i]of Hl(t,"unpipe",{signal:r}))e.has(i)&&i.emit(n)},F0=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Xre=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,onFinished:s,unpipeEvent:o})=>{Xp(t,lP);const a=new AbortController;try{await Promise.race([Jre(s,e,a),Zre({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:a}),Qre({stream:e,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),Xp(t,-lP)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?L0(t):eie(t))},Jre=async(t,e,{signal:n})=>{try{await t,n.aborted||L0(e)}catch(r){n.aborted||oP(e,r)}},Zre=async({passThroughStream:t,stream:e,streams:n,ended:r,aborted:i,controller:{signal:s}})=>{try{await Ai(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),n.has(e)&&r.add(e)}catch(o){if(s.aborted||!n.has(e))return;aP(o)?i.add(e):cP(t,o)}},Qre=async({stream:t,streams:e,ended:n,aborted:r,unpipeEvent:i,controller:{signal:s}})=>{if(await cn(t,i,{signal:s}),!t.readable)return cn(s,"abort",{signal:s});e.delete(t),n.delete(t),r.delete(t)},eie=t=>{t.writable&&t.end()},oP=(t,e)=>{aP(e)?L0(t):cP(t,e)},aP=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",L0=t=>{(t.readable||t.writable)&&t.destroy()},cP=(t,e)=>{t.destroyed||(t.once("error",tie),t.destroy(e))},tie=()=>{},Xp=(t,e)=>{const n=t.getMaxListeners();n!==0&&n!==Number.POSITIVE_INFINITY&&t.setMaxListeners(n+e)},uP=2,lP=1,Jp=(t,e)=>{t.pipe(e),nie(t,e),rie(t,e)},nie=async(t,e)=>{if(!(co(t)||co(e))){try{await Ai(t,{cleanup:!0,readable:!0,writable:!1})}catch{}dP(e)}},dP=t=>{t.writable&&t.end()},rie=async(t,e)=>{if(!(co(t)||co(e))){try{await Ai(e,{cleanup:!0,readable:!1,writable:!0})}catch{}fP(t)}},fP=t=>{t.readable&&t.destroy()},iie=(t,e,n)=>{const r=new Map;for(const[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(const{stream:a}of s.filter(({type:c})=>po.has(c)))sie(t,a,o,i);for(const{stream:a}of s.filter(({type:c})=>!po.has(c)))aie({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(const[i,s]of r.entries()){const o=s.length===1?s[0]:O0(s);Jp(o,i)}},sie=(t,e,n,r)=>{n==="output"?Jp(t.stdio[r],e):Jp(e,t.stdio[r]);const i=oie[r];i!==void 0&&(t[i]=e),t.stdio[r]=e},oie=["stdin","stdout","stderr"],aie=({subprocess:t,stream:e,direction:n,fdNumber:r,pipeGroups:i,controller:s})=>{if(e===void 0)return;cie(e,s);const[o,a]=n==="output"?[e,t.stdio[r]]:[t.stdio[r],e],c=i.get(o)??[];i.set(o,[...c,a])},cie=(t,{signal:e})=>{co(t)&&Mp(t,uie,e)},uie=2,Ba=[];Ba.push("SIGHUP","SIGINT","SIGTERM"),process.platform!=="win32"&&Ba.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&Ba.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const Zp=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",M0=Symbol.for("signal-exit emitter"),B0=globalThis,lie=Object.defineProperty.bind(Object);class die{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(B0[M0])return B0[M0];lie(B0,M0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){const r=this.listeners[e],i=r.indexOf(n);i!==-1&&(i===0&&r.length===1?r.length=0:r.splice(i,1))}emit(e,n,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(const s of this.listeners[e])i=s(n,r)===!0||i;return e==="exit"&&(i=this.emit("afterExit",n,r)||i),i}}class hP{}const fie=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}});class hie extends hP{onExit(){return()=>{}}load(){}unload(){}}class pie extends hP{#e=j0.platform==="win32"?"SIGINT":"SIGHUP";#t=new die;#n;#r;#s;#i={};#o=!1;constructor(e){super(),this.#n=e,this.#i={};for(const n of Ba)this.#i[n]=()=>{const r=this.#n.listeners(n);let{count:i}=this.#t;const s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),r.length===i){this.unload();const o=this.#t.emit("exit",null,n),a=n==="SIGHUP"?this.#e:n;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#r=e.emit}onExit(e,n){if(!Zp(this.#n))return()=>{};this.#o===!1&&this.load();const r=n?.alwaysLast?"afterExit":"exit";return this.#t.on(r,e),()=>{this.#t.removeListener(r,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(const e of Ba)try{const n=this.#i[e];n&&this.#n.on(e,n)}catch{}this.#n.emit=(e,...n)=>this.#c(e,...n),this.#n.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Ba.forEach(e=>{const n=this.#i[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#n.removeListener(e,n)}catch{}}),this.#n.emit=this.#r,this.#n.reallyExit=this.#s,this.#t.count-=1)}#a(e){return Zp(this.#n)?(this.#n.exitCode=e||0,this.#t.emit("exit",this.#n.exitCode,null),this.#s.call(this.#n,this.#n.exitCode)):0}#c(e,...n){const r=this.#r;if(e==="exit"&&Zp(this.#n)){typeof n[0]=="number"&&(this.#n.exitCode=n[0]);const i=r.call(this.#n,e,...n);return this.#t.emit("exit",this.#n.exitCode,null),i}else return r.call(this.#n,e,...n)}}const j0=globalThis.process,{onExit:gie,load:sae,unload:oae}=fie(Zp(j0)?new pie(j0):new hie),mie=(t,{cleanup:e,detached:n},{signal:r})=>{if(!e||n)return;const i=gie(()=>{t.kill()});db(r,()=>{i()})},yie=({source:t,sourcePromise:e,boundOptions:n,createNested:r},...i)=>{const s=sI(),{destination:o,destinationStream:a,destinationError:c,from:u,unpipeSignal:l}=vie(n,r,i),{sourceStream:d,sourceError:f}=bie(t,u),{options:h,fileDescriptors:p}=uo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:h,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:p,startTime:s}},vie=(t,e,n)=>{try{const{destination:r,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=wie(t,e,...n),a=FI(r,s);return{destination:r,destinationStream:a,from:i,unpipeSignal:o}}catch(r){return{destinationError:r}}},wie=(t,e,n,...r)=>{if(Array.isArray(n))return{destination:e(pP,t)(n,...r),pipeOptions:t};if(typeof n=="string"||n instanceof URL){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');const[i,s,o]=UA(n,...r);return{destination:e(pP)(i,s,o),pipeOptions:o}}if(uo.has(n)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:n,pipeOptions:r[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},pP=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),bie=(t,e)=>{try{return{sourceStream:l0(t,e)}}catch(n){return{sourceError:n}}},Die=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:s,startTime:o})=>{const a=Eie({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r});if(a!==void 0)throw gP({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},Eie=({sourceStream:t,sourceError:e,destinationStream:n,destinationError:r})=>{if(e!==void 0&&r!==void 0)return r;if(r!==void 0)return fP(t),r;if(e!==void 0)return dP(n),e},gP=({error:t,fileDescriptors:e,sourceOptions:n,startTime:r})=>R0({error:t,command:mP,escapedCommand:mP,fileDescriptors:e,options:n,startTime:r,isSync:!1}),mP="source.pipe(destination)",Tie=async t=>{const[{status:e,reason:n,value:r=n},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(r)||o.pipedFrom.push(r),i==="rejected")throw o;if(e==="rejected")throw r;return o},Rie=(t,e,n)=>{const r=Qp.has(e)?$ie(t,e):Sie(t,e);return Mp(t,Cie,n.signal),Mp(e,_ie,n.signal),kie(e),r},Sie=(t,e)=>{const n=O0([t]);return Jp(n,e),Qp.set(e,n),n},$ie=(t,e)=>{const n=Qp.get(e);return n.add(t),n},kie=async t=>{try{await Ai(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Qp.delete(t)},Qp=new WeakMap,Cie=2,_ie=1,Aie=(t,e)=>t===void 0?[]:[Iie(t,e)],Iie=async(t,{sourceStream:e,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:s})=>{await bN(t,e),await n.remove(e);const o=new Error("Pipe canceled by `unpipeSignal` option.");throw gP({error:o,fileDescriptors:r,sourceOptions:i,startTime:s})},U0=(t,...e)=>{if(Vn(e[0]))return U0.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});const{destination:n,...r}=yie(t,...e),i=xie({...r,destination:n});return i.pipe=U0.bind(void 0,{...t,source:n,sourcePromise:i,boundOptions:{}}),i},xie=async({sourcePromise:t,sourceStream:e,sourceOptions:n,sourceError:r,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:u})=>{const l=Pie(t,i);Die({sourceStream:e,sourceError:r,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:n,startTime:u});const d=new AbortController;try{const f=Rie(e,s,d);return await Promise.race([Tie(l),...Aie(a,{sourceStream:e,mergedStream:f,sourceOptions:n,fileDescriptors:c,startTime:u})])}finally{d.abort()}},Pie=(t,e)=>Promise.allSettled([t,e]),yP=({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:r,encoding:i,preserveNewlines:s})=>{const o=new AbortController;return Nie(e,o),wP({stream:t,controller:o,binary:n,shouldEncode:!t.readableObjectMode&&r,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},Nie=async(t,e)=>{try{await t}catch{}finally{e.abort()}},vP=({stream:t,onStreamEnd:e,lines:n,encoding:r,stripFinalNewline:i,allMixed:s})=>{const o=new AbortController;Oie(e,o,t);const a=t.readableObjectMode&&!s;return wP({stream:t,controller:o,binary:r==="buffer",shouldEncode:!a,encoding:r,shouldSplit:!a&&n,preserveNewlines:!i})},Oie=async(t,e,n)=>{try{await t}catch{n.destroy()}finally{e.abort()}},wP=({stream:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})=>{const a=Hl(t,"data",{signal:e.signal,highWaterMark:DP,highWatermark:DP});return Fie({onStdoutChunk:a,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o})},bP=Kl(!0),DP=bP,Fie=async function*({onStdoutChunk:t,controller:e,binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o}){const a=Lie({binary:n,shouldEncode:r,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(const[c]of t)yield*Bl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*N0(a)}},Lie=({binary:t,shouldEncode:e,encoding:n,shouldSplit:r,preserveNewlines:i})=>[Hx(t,n,!e),Ux(t,i,!r,{})].filter(Boolean),Mie=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:u,streamInfo:l})=>{const d=Bie({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:a,verboseInfo:u,streamInfo:l});if(!i){await Promise.all([jie(t),d]);return}const f=jx(c,n),h=vP({stream:t,onStreamEnd:e,lines:o,encoding:r,stripFinalNewline:f,allMixed:a}),[p]=await Promise.all([Uie({stream:t,iterable:h,fdNumber:n,encoding:r,maxBuffer:s,lines:o}),d]);return p},Bie=async({stream:t,onStreamEnd:e,fdNumber:n,encoding:r,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!Zx({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:s,fdNumber:n}))return;const a=vP({stream:t,onStreamEnd:e,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i});await nre(a,t,n,s)},jie=async t=>{await _N(),t.readableFlowing===null&&t.resume()},Uie=async({stream:t,stream:{readableObjectMode:e},iterable:n,fdNumber:r,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await Eee(n,{maxBuffer:s}):i==="buffer"?new Uint8Array(await kee(n,{maxBuffer:s})):await Lee(n,{maxBuffer:s})}catch(a){return TP(Wee({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:r}))}},EP=async t=>{try{return await t}catch(e){return TP(e)}},TP=({bufferedData:t})=>BX(t)?new Uint8Array(t):t,q0=async(t,e,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{const s=qie(t,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],Ai(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||zie(a,e,n,r)}finally{o.abort()}},qie=(t,{originalStreams:[e],subprocess:n})=>{const r={stdinCleanedUp:!1};return t===e&&Wie(t,n,r),r},Wie=(t,e,n)=>{const{_destroy:r}=t;t._destroy=(...i)=>{Gie(e,n),r.call(t,...i)}},Gie=({exitCode:t,signalCode:e},n)=>{(t!==null||e!==null)&&(n.stdinCleanedUp=!0)},zie=(t,e,n,r)=>{if(!Hie(t,e,n,r))throw t},Hie=(t,e,n,r=!0)=>n.propagating?SP(t)||W0(t):(n.propagating=!0,RP(n,e)===r?SP(t):W0(t)),RP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",W0=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",SP=t=>t?.code==="EPIPE",Kie=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,u)=>$P({stream:c,fdNumber:u,encoding:e,buffer:n[u],maxBuffer:r[u],lines:i[u],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),$P=async({stream:t,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:u})=>{if(!t)return;const l=q0(t,e,u);if(RP(u,e)){await l;return}const[d]=await Promise.all([Mie({stream:t,onStreamEnd:l,fdNumber:e,encoding:n,buffer:r,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:u}),l]);return d},Vie=({stdout:t,stderr:e},{all:n})=>n&&(t||e)?O0([t,e].filter(Boolean)):void 0,Yie=({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>$P({...Xie(t,n),fdNumber:"all",encoding:e,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:Jie(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Xie=({stdout:t,stderr:e,all:n},[,r,i])=>{const s=r||i;return s?r?i?{stream:n,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:n,buffer:s}},Jie=({all:t,stdout:e,stderr:n})=>t&&e&&n&&e.readableObjectMode!==n.readableObjectMode,Zie=t=>jw(t,"ipc"),Qie=(t,e)=>{const n=iI(t);Nl({type:"ipc",verboseMessage:n,fdNumber:"ipc",verboseInfo:e})},ese=async({subprocess:t,buffer:e,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:s})=>{if(!r)return i;const o=Zie(s),a=Pl(e,"ipc"),c=Pl(n,"ipc");for await(const u of nP({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))a&&(zee(t,i,c),i.push(u)),o&&Qie(u,s);return i},tse=async(t,e)=>(await Promise.allSettled([t]),e),nse=async({subprocess:t,options:{encoding:e,buffer:n,maxBuffer:r,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:u,ipc:l,ipcInput:d},context:f,verboseInfo:h,fileDescriptors:p,originalStreams:y,onInternalError:T,controller:b})=>{const v=fre(t,f),D={originalStreams:y,fileDescriptors:p,subprocess:t,exitPromise:v,propagating:!1},k=Kie({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:u,verboseInfo:h,streamInfo:D}),P=Yie({subprocess:t,encoding:e,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:u,verboseInfo:h,streamInfo:D}),M=[],I=ese({subprocess:t,buffer:n,maxBuffer:r,ipc:l,ipcOutput:M,verboseInfo:h}),G=rse(y,t,D),U=ise(p,D);try{return await Promise.race([Promise.all([{},pre(v),Promise.all(k),P,I,eee(t,d),...G,...U]),T,sse(t,b),...HQ(t,s,f,b),...tQ({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:b}),...qQ({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(W){return f.terminationReason??="other",Promise.all([{error:W},v,Promise.all(k.map(A=>EP(A))),EP(P),tse(I,M),Promise.allSettled(G),Promise.allSettled(U)])}},rse=(t,e,n)=>t.map((r,i)=>r===e.stdio[i]?void 0:q0(r,i,n)),ise=(t,e)=>t.flatMap(({stdioItems:n},r)=>n.filter(({value:i,stream:s=i})=>fo(s,{checkOpen:!1})&&!co(s)).map(({type:i,value:s,stream:o=s})=>q0(o,r,e,{isSameDirection:po.has(i),stopOnExit:i==="native"}))),sse=async(t,{signal:e})=>{const[n]=await cn(t,"error",{signal:e});throw n},ose=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),G0=(t,e,n)=>{const r=t[n];r.has(e)||r.set(e,[]);const i=r.get(e),s=Fl();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},eg=async({resolve:t,promises:e},n)=>{t();const[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...e])]);return!r},kP=async t=>{if(t!==void 0)try{await CP(t)}catch{}},ase=async t=>{if(t!==void 0)try{await _P(t)}catch{}},CP=async t=>{await Ai(t,{cleanup:!0,readable:!1,writable:!0})},_P=async t=>{await Ai(t,{cleanup:!0,readable:!0,writable:!1})},AP=async(t,e)=>{if(await t,e)throw e},IP=(t,e,n)=>{n&&!W0(n)?t.destroy(n):e&&t.destroy()},cse=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,binary:i=!0,preserveNewlines:s=!0}={})=>{const o=i||lo.has(n),{subprocessStdout:a,waitReadableDestroy:c}=xP(t,r,e),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=PP(a,o),{read:f,onStdoutDataDone:h}=NP({subprocessStdout:a,subprocess:t,binary:o,encoding:n,preserveNewlines:s}),p=new Is({read:f,destroy:wo(FP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,encoding:u});return OP({subprocessStdout:a,onStdoutDataDone:h,readable:p,subprocess:t}),p},xP=(t,e,n)=>{const r=l0(t,e),i=G0(n,r,"readableDestroy");return{subprocessStdout:r,waitReadableDestroy:i}},PP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n},r)=>r?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:n}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:bP},NP=({subprocessStdout:t,subprocess:e,binary:n,encoding:r,preserveNewlines:i})=>{const s=Fl(),o=yP({subprocessStdout:t,subprocess:e,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){use(this,o,s)},onStdoutDataDone:s}},use=async(t,e,n)=>{try{const{value:r,done:i}=await e.next();i?n.resolve():t.push(r)}catch{}},OP=async({subprocessStdout:t,onStdoutDataDone:e,readable:n,subprocess:r,subprocessStdin:i})=>{try{await _P(t),await r,await kP(i),await e,n.readable&&n.push(null)}catch(s){await kP(i),LP(n,s)}},FP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:n},r)=>{await eg(n,e)&&(LP(t,r),await AP(e,r))},LP=(t,e)=>{IP(t,t.readable,e)},lse=({subprocess:t,concurrentStreams:e},{to:n}={})=>{const{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}=MP(t,n,e),o=new ug({...BP(r,t,i),destroy:wo(UP.bind(void 0,{subprocessStdin:r,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return jP(r,o),o},MP=(t,e,n)=>{const r=FI(t,e),i=G0(n,r,"writableFinal"),s=G0(n,r,"writableDestroy");return{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:s}},BP=(t,e,n)=>({write:dse.bind(void 0,t),final:wo(fse.bind(void 0,t,e,n))}),dse=(t,e,n,r)=>{t.write(e,n)?r():t.once("drain",r)},fse=async(t,e,n)=>{await eg(n,e)&&(t.writable&&t.end(),await e)},jP=async(t,e,n)=>{try{await CP(t),e.writable&&e.end()}catch(r){await ase(n),qP(e,r)}},UP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await eg(n,e),await eg(r,e)&&(qP(t,i),await AP(e,i))},qP=(t,e)=>{IP(t,t.writable,e)},hse=({subprocess:t,concurrentStreams:e,encoding:n},{from:r,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{const a=s||lo.has(n),{subprocessStdout:c,waitReadableDestroy:u}=xP(t,r,e),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:f}=MP(t,i,e),{readableEncoding:h,readableObjectMode:p,readableHighWaterMark:y}=PP(c,a),{read:T,onStdoutDataDone:b}=NP({subprocessStdout:c,subprocess:t,binary:a,encoding:n,preserveNewlines:o}),v=new lg({read:T,...BP(l,t,d),destroy:wo(pse.bind(void 0,{subprocessStdout:c,subprocessStdin:l,subprocess:t,waitReadableDestroy:u,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:y,writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:p,writableObjectMode:l.writableObjectMode,encoding:h});return OP({subprocessStdout:c,onStdoutDataDone:b,readable:v,subprocess:t,subprocessStdin:l}),jP(l,v,c),v},pse=async({subprocessStdout:t,subprocessStdin:e,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([FP({subprocessStdout:t,subprocess:n,waitReadableDestroy:r},o),UP({subprocessStdin:e,subprocess:n,waitWritableFinal:i,waitWritableDestroy:s},o)])},WP=(t,e,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{const s=r||lo.has(e),o=l0(t,n),a=yP({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return gse(a,o,t)},gse=async function*(t,e,n){try{yield*t}finally{e.readable&&e.destroy(),await n}},mse=(t,{encoding:e})=>{const n=ose();t.readable=cse.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.writable=lse.bind(void 0,{subprocess:t,concurrentStreams:n}),t.duplex=hse.bind(void 0,{subprocess:t,concurrentStreams:n,encoding:e}),t.iterable=WP.bind(void 0,t,e),t[Symbol.asyncIterator]=WP.bind(void 0,t,e,{})},yse=(t,e)=>{for(const[n,r]of wse){const i=r.value.bind(e);Reflect.defineProperty(t,n,{...r,value:i})}},vse=(async()=>{})().constructor.prototype,wse=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(vse,t)]),bse=(t,e,n,r)=>{const{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=Dse(t,e,n),{subprocess:f,promise:h}=Tse({file:i,commandArguments:s,options:l,startTime:c,verboseInfo:u,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=U0.bind(void 0,{source:f,sourcePromise:h,boundOptions:{},createNested:r}),yse(f,h),uo.set(f,{options:l,fileDescriptors:d}),f},Dse=(t,e,n)=>{const{command:r,escapedCommand:i,startTime:s,verboseInfo:o}=aI(t,e,n),{file:a,commandArguments:c,options:u}=JI(t,e,n),l=Ese(u),d=Wre(l,o);return{file:a,commandArguments:c,command:r,escapedCommand:i,startTime:s,verboseInfo:o,options:l,fileDescriptors:d}},Ese=({timeout:t,signal:e,...n})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...n,timeoutDuration:t}},Tse=({file:t,commandArguments:e,options:n,startTime:r,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=SN(t,e,n)}catch(p){return Lre({error:p,command:s,escapedCommand:o,fileDescriptors:a,options:n,startTime:r,verboseInfo:i})}const u=new AbortController;IN(Number.POSITIVE_INFINITY,u.signal);const l=[...c.stdio];iie(c,a,u),mie(c,n,u);const d={},f=Fl();c.kill=XZ.bind(void 0,{kill:c.kill.bind(c),options:n,onInternalError:f,context:d,controller:u}),c.all=Vie(c,n),mse(c,n),Ore(c,n);const h=Rse({subprocess:c,options:n,startTime:r,verboseInfo:i,fileDescriptors:a,originalStreams:l,command:s,escapedCommand:o,context:d,onInternalError:f,controller:u});return{subprocess:c,promise:h}},Rse=async({subprocess:t,options:e,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:u,controller:l})=>{const[d,[f,h],p,y,T]=await nse({subprocess:t,options:e,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:s,onInternalError:u,controller:l});l.abort(),u.resolve();const b=p.map((k,P)=>Ma(k,e,P)),v=Ma(y,e,"all"),D=Sse({errorInfo:d,exitCode:f,signal:h,stdio:b,all:v,ipcOutput:T,context:c,options:e,command:o,escapedCommand:a,startTime:n});return $0(D,r,e)},Sse=({errorInfo:t,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:u,startTime:l})=>"error"in t?S0({error:t.error,command:c,escapedCommand:u,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Hp,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:n,stdio:r,all:i,ipcOutput:s,options:a,startTime:l,isSync:!1}):mx({command:c,escapedCommand:u,stdio:r,all:i,ipcOutput:s,options:a,startTime:l}),z0=(t,e)=>{const n=Object.fromEntries(Object.entries(e).map(([r,i])=>[r,$se(r,t[r],i)]));return{...t,...n}},$se=(t,e,n)=>kse.has(t)&&Vn(e)&&Vn(n)?{...e,...n}:n,kse=new Set(["env",...QA]),go=(t,e,n,r)=>{const i=(o,a,c)=>go(o,a,n,c),s=(...o)=>Cse({mapArguments:t,deepOptions:n,boundOptions:e,setBoundExeca:r,createNested:i},...o);return r!==void 0&&r(s,i,e),s},Cse=({mapArguments:t,deepOptions:e={},boundOptions:n={},setBoundExeca:r,createNested:i},s,...o)=>{if(Vn(s))return i(t,z0(n,s),r);const{file:a,commandArguments:c,options:u,isSync:l}=_se({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:n});return l?vre(a,c,u):bse(a,c,u,i)},_se=({mapArguments:t,firstArgument:e,nextArguments:n,deepOptions:r,boundOptions:i})=>{const s=HX(e)?KX(e,n):[e,...n],[o,a,c]=UA(...s),u=z0(z0(r,i),c),{file:l=o,commandArguments:d=a,options:f=u,isSync:h=!1}=t({file:o,commandArguments:a,options:u});return{file:l,commandArguments:d,options:f,isSync:h}},Ase=({file:t,commandArguments:e})=>GP(t,e),Ise=({file:t,commandArguments:e})=>({...GP(t,e),isSync:!0}),GP=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);const[n,...r]=xse(t);return{file:n,commandArguments:r}},xse=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);const e=t.trim();if(e==="")return[];const n=[];for(const r of e.split(Pse)){const i=n.at(-1);i&&i.endsWith("\\")?n[n.length-1]=`${i.slice(0,-1)} ${r}`:n.push(r)}return n},Pse=/ +/g,Nse=(t,e,n)=>{t.sync=e(Fse,n),t.s=t.sync},Ose=({options:t})=>zP(t),Fse=({options:t})=>({...zP(t),isSync:!0}),zP=t=>({options:{...Lse(t),...t}}),Lse=({input:t,inputFile:e,stdio:n})=>t===void 0&&e===void 0&&n===void 0?{stdin:"inherit"}:{},Mse={preferLocal:!0},H0=go(()=>({}));go(()=>({isSync:!0})),go(Ase),go(Ise),go(VQ),go(Ose,{},Mse,Nse),Fre();const K0=Ip(2);class Bse{constructor(e="dot"){this.path=e}async unflatten(e){return await K0(async()=>{const n=await H0("unflatten",["-l 1","-c 3"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});return n instanceof Error&&(n.stdout?Ye.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' failed: ${n.stderr}
1215
-
1216
- but returned
1217
- ${n.stdout}`):Ye.error(`[BinaryGraphvizLayouter.layout] '${n.command}' failed: ${n.stderr}
1218
-
1219
- nothing returned, ignoring...`)),n.stdout&&(e=n.stdout.replaceAll(/\t\[/g," [").replaceAll(/\t/g," ")),e})}async layoutJson(e){return await K0(async()=>{const n=await H0(this.path,["-Tjson","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(n instanceof Error){if(!n.stdout)throw Ye.error(`[BinaryGraphvizLayouter.layout] '${n.command}' nothing returned and failed: "${n.stderr}"`),n;Ye.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' returned result but also failed "${n.stderr}"`)}return n.stdout})}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){return await K0(async()=>{const n=await H0(this.path,["-Tsvg","-y"],{reject:!1,timeout:1e4,input:e,stdin:"pipe",encoding:"utf8"});if(n instanceof Error){if(!n.stdout)throw Ye.error(`[BinaryGraphvizLayouter.layout] '${n.command}' nothing returned and failed: ${n.stderr}`),n;Ye.warn(`[BinaryGraphvizLayouter.layout] '${n.command}' returned result but also failed ${n.stderr}`)}return n.stdout})}}const jse="likec4",Use="1.11.0",qse="MIT",Wse="https://likec4.dev",Gse="Denis Davydkov <denis@davydkov.com>",zse={url:"https://github.com/sponsors/davydkov"},Hse={type:"git",url:"https://github.com/likec4/likec4.git",directory:"packages/likec4"},Kse={node:">=20.0.0"},Vse="https://github.com/likec4/likec4/issues",Yse="module",Xse="./bin/likec4.mjs",Jse={".":"./src/index.ts","./react":{types:"./app/react/components/index.ts",default:"./react/index.mjs"},"./react/style.css":"./react/style.css","./icons/all":{types:"./icons/all.d.ts",default:"./icons/all.js"},"./icons/*":{types:"./icons/icon.d.ts",default:"./icons/*"}},Zse={registry:"https://registry.npmjs.org",access:"public",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.mjs"},"./react":{types:"./react/index.d.ts",default:"./react/index.mjs"},"./react/style.css":"./react/style.css","./icons/all":{types:"./icons/all.d.ts",default:"./icons/all.js"},"./icons/*":{types:"./icons/icon.d.ts",default:"./icons/*"}}},Qse={"turbo-build":"turbo run build --log-prefix=none --log-order=grouped",package:"yarn pack","typecheck:app":"tsc --noEmit -p ./app/tsconfig.json","typecheck:cli":"tsc --noEmit -p ./tsconfig.cli.json",typecheck:"run-p --print-label 'typecheck:*'",prebuild:"tsx scripts/prebuild.ts","build:cli":"unbuild","build:app":"tsx scripts/bundle-app.ts","build:react":"tsx scripts/bundle-react.ts","build:react-dts":"tsx scripts/dts-react.ts","build:webcomponent":"tsx scripts/bundle-webcomponent.ts",build:"run prebuild && run-p --print-label 'build:*'",generate:"tsx scripts/generate.ts",prepack:"turbo run build --log-prefix=none --log-order=grouped",lint:"run -T eslint src/ --fix",clean:"rm -r -f dist app/dist dev/.export dev/dist node_modules/.vite",dev:"tsx watch src/cli/index.ts serve dev","dev:docs:bigbank":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/bigbank","dev:docs:dynamic-view":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/dynamic-view","dev:docs:index-page":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/index-page","dev:docs:theme":"tsx watch src/cli/index.ts serve ../../apps/docs/src/components/likec4-theme","dev:template":"tsx watch src/cli/index.ts serve ../create-likec4/template","dev:example-cloud":"tsx watch src/cli/index.ts serve ../../examples/cloud-system","dev:failed":"tsx watch src/cli/index.ts serve ../../examples/failed","dev:example-dev":"tsx watch src/cli/index.ts serve ../../examples/diagrams-dev/likec4",cli:"tsx src/cli/index.ts","cli:serve":"tsx watch src/cli/index.ts serve dev","cli:build":"tsx src/cli/index.ts build -o dev/dist dev","cli:preview":"tsx src/cli/index.ts preview -o dev/dist dev","cli:export":"tsx src/cli/index.ts export png -o dev/export dev","cli:export:json":"tsx src/cli/index.ts export json -o dev/export/likec4.json dev",test:"vitest run --no-isolate","vitest:ui":"vitest --no-isolate --ui","test:watch":"vitest"},eoe={"@hpcc-js/wasm-graphviz":"1.5.0","@vitejs/plugin-react-swc":"3.7.0",playwright:"1.46.1",react:"^18.3.1","react-dom":"^18.3.1","type-fest":"4.26.1",vite:"5.4.7"},toe={"@fontsource/ibm-plex-sans":"^5.1.0","@likec4/core":"workspace:*","@likec4/diagram":"workspace:*","@likec4/generators":"workspace:*","@likec4/icons":"workspace:*","@likec4/language-server":"workspace:*","@likec4/layouts":"workspace:*","@likec4/log":"workspace:*","@likec4/tsconfig":"workspace:*","@mantine/core":"7.12.2","@mantine/hooks":"7.12.2","@mantine/vanilla-extract":"7.12.2","@nanostores/react":"0.7.3","@react-hookz/web":"^24.0.4","@tabler/icons-react":"^3.16.0","@tanstack/react-router":"1.45.13","@tanstack/router-cli":"1.45.13","@tanstack/router-vite-plugin":"1.45.13","@types/node":"^20.16.1","@types/prop-types":"^15.7.11","@types/react":"18.3.4","@types/react-dom":"18.3.0","@types/string-hash":"^1.1.3","@types/yargs":"^17.0.33","@vanilla-extract/css":"^1.15.5","@vanilla-extract/dynamic":"^2.1.2","@vanilla-extract/vite-plugin":"^4.0.15","@xyflow/react":"12.3.0","@xyflow/system":"0.0.42",autoprefixer:"^10.4.20",classnames:"^2.5.1",clsx:"^2.1.1",defu:"^6.1.4","dts-bundle-generator":"^9.5.1",esbuild:"^0.23.1","esbuild-node-externals":"^1.14.0",execa:"^9.3.1","fast-equals":"^5.0.1",fdir:"^6.3.0","framer-motion":"^11.5.6","get-port":"^7.1.0",glob:"^11.0.0","html-to-image":"^1.11.11",json5:"^2.2.3",langium:"3.2.0",mkdirp:"^3.0.1",nanostores:"0.11.3","npm-run-all2":"^6.2.2","p-limit":"^6.1.0","package-up":"^5.0.0",postcss:"^8.4.41","postcss-preset-mantine":"^1.17.0","pretty-ms":"^9.1.0","react-error-boundary":"^4.0.13","react-resizable-panels":"^2.1.2","react-shadow":"^20.5.0",remeda:"^2.14.0","std-env":"^3.7.0","string-hash":"^1.1.3","strip-indent":"^4.0.0",terser:"^5.31.6",tinyrainbow:"^1.2.0",tsx:"~4.9.3",turbo:"^2.1.1",typescript:"^5.6.2",ufo:"^1.5.4",unbuild:"^3.0.0-rc.7","vite-plugin-css-injected-by-js":"^3.5.1","vite-plugin-shadow-style":"^1.1.1",vitest:"^2.1.1",yargs:"17.7.2"},noe="yarn@4.4.1",HP={name:jse,version:Use,license:qse,homepage:Wse,author:Gse,sponsor:zse,repository:Hse,engines:Kse,bugs:Vse,type:Yse,bin:Xse,exports:Jse,publishConfig:Zse,scripts:Qse,dependencies:eoe,devDependencies:toe,packageManager:noe},tg=Object.create(null),ql=t=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(t?tg:globalThis),ps=new Proxy(tg,{get(t,e){return ql()[e]??tg[e]},has(t,e){const n=ql();return e in n||e in tg},set(t,e,n){const r=ql(!0);return r[e]=n,!0},deleteProperty(t,e){if(!e)return!1;const n=ql(!0);return delete n[e],!0},ownKeys(){const t=ql(!0);return Object.keys(t)}}),roe=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",ioe=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"]];function soe(){if(globalThis.process?.env)for(const t of ioe){const e=t[1]||t[0];if(globalThis.process?.env[e])return{name:t[0].toLowerCase(),...t[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const KP=soe();KP.name;function mo(t){return t?t!=="false":!1}const ooe=globalThis.process?.platform||"",ng=mo(ps.CI)||KP.ci!==!1,VP=mo(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY);mo(ps.DEBUG);const aoe=roe==="test"||mo(ps.TEST);mo(ps.MINIMAL);const coe=/^win/i.test(ooe);!mo(ps.NO_COLOR)&&(mo(ps.FORCE_COLOR)||(VP||coe)&&ps.TERM);const uoe=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null;Number(uoe?.split(".")[0]);const loe=globalThis.process||Object.create(null),YP={versions:{}};new Proxy(loe,{get(t,e){if(e==="env")return ps;if(e in t)return t[e];if(e in YP)return YP[e]}});const doe=globalThis.process?.release?.name==="node",foe=!!globalThis.Bun||!!globalThis.process?.versions?.bun,hoe=!!globalThis.Deno,poe=!!globalThis.fastly,goe=!!globalThis.Netlify,moe=!!globalThis.EdgeRuntime,yoe=globalThis.navigator?.userAgent==="Cloudflare-Workers",voe=!!globalThis.__lagon__,woe=[[goe,"netlify"],[moe,"edge-light"],[yoe,"workerd"],[poe,"fastly"],[hoe,"deno"],[foe,"bun"],[doe,"node"],[voe,"lagon"]];function boe(){const t=woe.find(e=>e[0]);if(t)return{name:t[1]}}const Doe=boe();Doe?.name;const XP=rt.bold(rt.bgRed(rt.white("ERROR"))),Eoe=rt.bold(rt.yellow("WARN")),Toe=rt.bold(rt.green("INFO"));function JP(t){const e=NN("info",{prefix:t,allowClearScreen:!ng}),n=!ng;return{...e,info(r,i){e.info(`${Toe} ${r}`,{timestamp:n,...i})},warn(r,i){e.warn(`${Eoe} ${r}`,{timestamp:n,...i})},error(r,i){if(r instanceof Error){e.error(`${XP} ${rt.red(r.stack??r.name+" "+r.message)}`,{timestamp:n,error:r,...i});return}e.error(`${XP} ${r}`,{timestamp:n,...i})}}}const V0=()=>{},Roe={info:V0,warn:V0,error:V0},Soe=1e6;function ZP(t){const[e,n]=zl(t),r=e*1e3+n/Soe;return{ms:r,pretty:wx(r)}}function $oe(t){const e=zl();return{stopAndLog(n="done in "){n=rt.green(`${n}${ZP(e).pretty}`),t?t.info(n):Ye.success(n)}}}class koe{constructor(e){this.services=e,this.layouter=e.likec4.Layouter}cache=new WeakMap;layouter;previousAction=Promise.resolve();limit=Ip(2);inflightRequest;async computedViews(){try{this.inflightRequest??=Promise.resolve().then(async()=>await this.services.likec4.ModelBuilder.buildComputedModel());const e=await Promise.resolve(this.inflightRequest);return Object.values(e?.views??{})}finally{this.inflightRequest=void 0}}async layoutViews(){const e=this.services.logger,n=this.previousAction.then(async()=>{const r=(await this.computedViews()).map(i=>this.limit(async()=>{try{let s=this.cache.get(i);return s||(s=await this.layouter.layout(i),this.cache.set(i,s)),s}catch(s){return e.error(s),null}}));return(await Promise.all(r)).filter(Z)});return this.previousAction=n.catch(r=>(e.error(r),Promise.resolve([]))),await n}async diagrams(){return(await this.layoutViews()).map(e=>e.diagram)}async viewsAsGraphvizOut(){const e="All-LayoutedViews-DotWithSvg",n=this.services.WorkspaceCache;if(n.has(e))return await Promise.resolve(n.get(e));const r=(await this.computedViews()).map(s=>this.limit(async()=>{const{dot:o,svg:a}=await this.layouter.svg(s);return{id:s.id,dot:o,svg:a}})),i=await Promise.all(r);return n.set(e,i),i}async overviewGraph(){const e="OverviewGraph",n=this.services.WorkspaceCache;if(n.has(e))return await Promise.resolve(n.get(e));const r=await this.computedViews(),i=await this.layouter.layoutOverviewGraph(r);return n.set(e,i),i}}class Coe{constructor(e){this.services=e}isInitialized=!1;async initWorkspace(e){if(this.isInitialized)throw new Error("Workspace already initialized");const n=this.services.logger,r=this.services.shared.workspace.WorkspaceManager;n.info(`${rt.dim("workspace:")} ${e.uri}`),r.initialize({capabilities:{},processId:null,rootUri:null,workspaceFolders:[e]}),await r.initializeWorkspace([e])}async init(){if(this.isInitialized)throw new Error("Workspace already initialized");this.isInitialized=!0;const e=this.services.logger,n=this.services.likec4.ModelBuilder,r=this.services.shared.workspace.LangiumDocuments,i=this.services.shared.workspace.DocumentBuilder,s=r.all.toArray();if(s.length===0)throw e.error("no LikeC4 sources found"),new Error("no LikeC4 sources found");e.info(`${rt.dim("workspace:")} found ${s.length} source files`),await i.build(s,{validation:!0});const o=await n.buildComputedModel(),a=Ff(o?.views??{}).length;if(a===0){e.warn(`${rt.dim("workspace:")} no views found`);return}e.info(`${rt.dim("workspace:")} ${rt.green(`\u2713 computed ${a} views`)}`);const c=await this.services.likec4.Views.diagrams();c.length===a?e.info(`${rt.dim("workspace:")} ${rt.green("\u2713 all views layouted")}`):e.warn(`${rt.dim("workspace:")} ${rt.yellow(`\u2717 layouted ${c.length} views`)}`)}}function QP(t){return e=>new t(e)}const _oe={logger:()=>{throw new Error("Logger must be provided")},likec4:{Layouter:()=>{throw new Error("Layouter must be provided")},Views:QP(koe)},cli:{Workspace:QP(Coe)}};function eN(t){const e=zg(t,{useFileSystem:!0,logger:"default",graphviz:"wasm"});let n;switch(e.logger){case!1:n=Roe;break;case"vite":n=JP("c4:lsp ");break;case"default":n=Ye.withTag("lsp");break;default:n=e.logger}const r=e.graphviz==="binary";n.info(`${rt.dim("version")} ${HP.version}`),n.info(`${rt.dim("layout")} ${r?"binary":"wasm"}`);const i={logger:()=>n,likec4:{Layouter:()=>new FX(r===!0?new Bse:new MX)}};return JK(e.logger===!1?"silent":"info"),e.logger!==!1&&e.logger!=="default"&&Re.setReporters([{log:({level:s,...o},a)=>{const c=o.tag||"",u=o.args.map(d=>ev(d)?d.stack??d.message:typeof d=="string"?d:String(d));c&&u.unshift(`[${c}]`);const l=u.join(" ");switch(!0){case s>=Le.debug:break;case s>=Le.info:{n.info(l);break}case s>=Le.log:{n.info(l);break}case s>=Le.warn:{n.warn(l);break}case s>=Le.fatal:{n.error(l);break}}}}]),TY(e.useFileSystem?CW:{},_oe,i).likec4}const tN=t=>new Error(`Invalid model:
1220
- ${t.getErrors().map(e=>` ${e.sourceFsPath}:${e.line} ${e.message.slice(0,200)}`).join(`
1221
- `)}`);class gs{constructor(e,n,r){this.workspace=e,this.langium=n,this.isPrintErrorEnabled=r,this.logger=n.logger,this.langiumDocuments=n.shared.workspace.LangiumDocuments,this.views=n.likec4.Views,this.isPrintErrorEnabled&&this.printErrors()}static async fromSource(e,n){const r=eN(zg(n,{useFileSystem:!1,logger:!1,graphviz:"wasm"})),i=Wt.from({scheme:"virtual",path:"/workspace"});await r.cli.Workspace.initWorkspace({uri:i.toString(),name:"virtual"});const s=yt.joinPath(i,"source.likec4");r.shared.workspace.LangiumDocuments.createDocument(s,e),await r.cli.Workspace.init();const o=new gs(i.path,r,n?.printErrors??!0);return n?.throwIfInvalid===!0&&o.hasErrors()?(o.dispose(),Promise.reject(tN(o))):o}static likec4Instances=new Map;static async fromWorkspace(e="",n){const r=dN(e);if(!uN(r))throw new Error(`Workspace not found: ${r}`);let i=gs.likec4Instances.get(r);if(!i){const s=eN(zg(n,{useFileSystem:!0,logger:"default",graphviz:"wasm"}));await s.cli.Workspace.initWorkspace({uri:hN(r).toString(),name:fN(r)}),await s.cli.Workspace.init(),i=new gs(r,s,n?.printErrors??!0),gs.likec4Instances.set(r,i)}return n?.throwIfInvalid===!0&&i.hasErrors()?(i.dispose(),Promise.reject(tN(i))):i}modelComputedRef;modelLayoutedRef;logger;langiumDocuments;views;async diagrams(){return await this.langium.likec4.Views.diagrams()}model(){return this.computedModel()}computedModel(){let e=this.modelComputedRef?.deref();if(!e){const n=this.langium.likec4.ModelBuilder.unsafeSyncBuildModel();if(!n)throw new Error("Failed to build model");const r=this.langium.likec4.ModelBuilder.unsafeSyncBuildComputedModel(n);e=za.computed(r),this.modelComputedRef=new WeakRef(e)}return e}async layoutedModel(){let e=this.modelLayoutedRef?.deref();if(!e){const n=await this.langium.likec4.ModelBuilder.buildComputedModel();if(!n)throw new Error("Failed to build model");const r=await this.views.diagrams();e=za.layouted({__:"layouted",...n,views:tv(r,xr("id"))}),this.modelLayoutedRef=new WeakRef(e)}return e}getErrors(){return this.langiumDocuments.all.toArray().flatMap(e=>(e.diagnostics??[]).filter(n=>n.severity===Jc.Error).map(({message:n,range:r})=>({message:n,line:r.start.line,range:r,sourceFsPath:e.uri.fsPath})))}hasErrors(){return this.langiumDocuments.all.some(e=>e.diagnostics?.some(n=>n.severity===Jc.Error)??!1)}printErrors(){let e=!1;for(const n of this.langiumDocuments.all){const r=n.diagnostics?.filter(i=>i.severity===1);if(r&&r.length>0){e=!0;const i=r.flatMap(s=>{const o=s.range.start.line,a=s.message.split(`
1222
- `);return a.length>10&&(a.length=10,a.push("...")),a.map((c,u)=>u===0?" "+rt.dim(`Line ${o}: `)+rt.red(c):" ".repeat(10)+rt.red(c))}).join(`
1223
- `);this.logger.error(`Invalid ${n.uri.fsPath}
1224
- ${i}`)}}return e}async notifyUpdate({changed:e,removed:n}){this.modelLayoutedRef=void 0,this.modelComputedRef=void 0;const r=this.langium.shared.workspace.WorkspaceLock;try{let i=!1;return await r.write(async s=>{await this.langium.shared.workspace.DocumentBuilder.update(e?[Wt.file(e)]:[],n?[Wt.file(n)]:[],s),i=!s.isCancellationRequested}),i}catch(i){return this.logger.error(i),!1}}onModelUpdate(e){const n=this.langium.likec4.ModelBuilder.onModelParsed(()=>e());return()=>{n.dispose()}}dispose(){for(const[e,n]of gs.likec4Instances)n===this&&gs.likec4Instances.delete(e)}}export{$oe as $,Ar as A,Ve as B,Ug as C,Z as D,zi as E,rt as F,Ha as G,VN as H,Ip as I,YN as J,Ye as K,Zn as L,di as M,Os as N,q1 as O,qg as P,Wa as Q,JP as R,pK as S,ce as T,Yv as U,gK as V,iu as W,G1 as X,ZP as Y,za as Z,xo as _,ud as a,Mv as a0,ad as a1,Ir as a2,OD as a3,Le as a4,HP as a5,Ga as b,Pb as c,yg as d,$D as e,Xe as f,gs as g,bF as h,CC as i,AC as j,rn as k,f$ as l,Xt as m,ld as n,AD as o,Lo as p,$e as q,Nn as r,No as s,rE as t,yr as u,lt as v,Tt as w,xb as x,$t as y,ze as z};