folderview 0.0.0-stage → 0.2.1

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 (450) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +282 -2
  3. package/dist/cli.js +115 -0
  4. package/dist/client/assets/app.css +1 -0
  5. package/dist/client/assets/chunks/abap-EINPUMCJ.js +1 -0
  6. package/dist/client/assets/chunks/abnfDiagram-S7VZAUFO-W2CM2W6D.js +1 -0
  7. package/dist/client/assets/chunks/actionscript-3-O776AQUO.js +1 -0
  8. package/dist/client/assets/chunks/ada-WLOTXRTV.js +1 -0
  9. package/dist/client/assets/chunks/ahk-EF37A2DY.js +1 -0
  10. package/dist/client/assets/chunks/ahk2-FH4K3CKT.js +1 -0
  11. package/dist/client/assets/chunks/angular-html-ZALQFV2H.js +1 -0
  12. package/dist/client/assets/chunks/angular-ts-4IWMF7QO.js +1 -0
  13. package/dist/client/assets/chunks/apache-44AYOEWM.js +1 -0
  14. package/dist/client/assets/chunks/apex-XRYPID42.js +1 -0
  15. package/dist/client/assets/chunks/apl-5HBALFOI.js +1 -0
  16. package/dist/client/assets/chunks/applescript-2DZEHZEC.js +1 -0
  17. package/dist/client/assets/chunks/ara-ZGZQBLXL.js +1 -0
  18. package/dist/client/assets/chunks/architecture-WOLXFQ4H-EJGENNRL.js +1 -0
  19. package/dist/client/assets/chunks/architectureDiagram-YGSQEFNW-2VHWSKO6.js +36 -0
  20. package/dist/client/assets/chunks/asciidoc-GSQAKCPO.js +1 -0
  21. package/dist/client/assets/chunks/asm-BFURM5BK.js +1 -0
  22. package/dist/client/assets/chunks/astro-VJORWDZJ.js +1 -0
  23. package/dist/client/assets/chunks/awk-BSHTWXXX.js +1 -0
  24. package/dist/client/assets/chunks/ballerina-HAOQJ4B2.js +1 -0
  25. package/dist/client/assets/chunks/bat-OSH45EOF.js +1 -0
  26. package/dist/client/assets/chunks/beancount-RBATIHOV.js +1 -0
  27. package/dist/client/assets/chunks/berry-CZUIOUM4.js +1 -0
  28. package/dist/client/assets/chunks/bibtex-KCL2UWHE.js +1 -0
  29. package/dist/client/assets/chunks/bicep-SZJZB3SG.js +1 -0
  30. package/dist/client/assets/chunks/bird2-XBF5YQQV.js +1 -0
  31. package/dist/client/assets/chunks/blade-Q24LEVFC.js +1 -0
  32. package/dist/client/assets/chunks/blockDiagram-APKKGZFW-53LXSOOT.js +140 -0
  33. package/dist/client/assets/chunks/bpmnIcons-APHXDYXF-FMBRQNTY.js +1 -0
  34. package/dist/client/assets/chunks/bsl-TI44NWFB.js +1 -0
  35. package/dist/client/assets/chunks/c-NLHY4Y4N.js +1 -0
  36. package/dist/client/assets/chunks/c3-BUTEM6PO.js +1 -0
  37. package/dist/client/assets/chunks/c4Diagram-KJ2TOQU5-O53G4GQH.js +38 -0
  38. package/dist/client/assets/chunks/cadence-JIRTEU64.js +1 -0
  39. package/dist/client/assets/chunks/cairo-3W6NVDNW.js +1 -0
  40. package/dist/client/assets/chunks/chapel-BPBJ2E7K.js +1 -0
  41. package/dist/client/assets/chunks/chunk-25KVF5ZE.js +1 -0
  42. package/dist/client/assets/chunks/chunk-2CJKSQOI.js +1 -0
  43. package/dist/client/assets/chunks/chunk-2QIJRTWR.js +1 -0
  44. package/dist/client/assets/chunks/chunk-2ZCRJZGF.js +2 -0
  45. package/dist/client/assets/chunks/chunk-3ILNDZNY.js +213 -0
  46. package/dist/client/assets/chunks/chunk-3M2OOQ7S.js +1 -0
  47. package/dist/client/assets/chunks/chunk-3M57NTNK.js +1 -0
  48. package/dist/client/assets/chunks/chunk-3MR6DCZJ.js +1 -0
  49. package/dist/client/assets/chunks/chunk-3WGHS7F7.js +1 -0
  50. package/dist/client/assets/chunks/chunk-4JK75V33.js +1 -0
  51. package/dist/client/assets/chunks/chunk-4NXNVEWK.js +1 -0
  52. package/dist/client/assets/chunks/chunk-4RNNBDFQ.js +1 -0
  53. package/dist/client/assets/chunks/chunk-4T4NVH7V.js +1 -0
  54. package/dist/client/assets/chunks/chunk-4TFFBC35.js +1 -0
  55. package/dist/client/assets/chunks/chunk-4WYBE67P.js +1 -0
  56. package/dist/client/assets/chunks/chunk-56ITEUFA.js +1 -0
  57. package/dist/client/assets/chunks/chunk-5DXRE7IH.js +1 -0
  58. package/dist/client/assets/chunks/chunk-5IMADCNU.js +1 -0
  59. package/dist/client/assets/chunks/chunk-5XZPGKN4.js +1 -0
  60. package/dist/client/assets/chunks/chunk-6O32UKSP.js +1 -0
  61. package/dist/client/assets/chunks/chunk-7BAEB64Q.js +1 -0
  62. package/dist/client/assets/chunks/chunk-7FMWBHZO.js +1 -0
  63. package/dist/client/assets/chunks/chunk-7GFDITUT.js +1 -0
  64. package/dist/client/assets/chunks/chunk-7H4MLBHI.js +1 -0
  65. package/dist/client/assets/chunks/chunk-7OJ4MEEB.js +1 -0
  66. package/dist/client/assets/chunks/chunk-7RSEISFE.js +1 -0
  67. package/dist/client/assets/chunks/chunk-7YNZZQVT.js +1 -0
  68. package/dist/client/assets/chunks/chunk-AB7TIL2G.js +1 -0
  69. package/dist/client/assets/chunks/chunk-ADDF76FL.js +1 -0
  70. package/dist/client/assets/chunks/chunk-AF6UTCD4.js +321 -0
  71. package/dist/client/assets/chunks/chunk-AJ2K6ASU.js +1 -0
  72. package/dist/client/assets/chunks/chunk-AUBAENQZ.js +1 -0
  73. package/dist/client/assets/chunks/chunk-BJEYVZ65.js +1 -0
  74. package/dist/client/assets/chunks/chunk-BLRM6LXA.js +1 -0
  75. package/dist/client/assets/chunks/chunk-BOCTYCDZ.js +1 -0
  76. package/dist/client/assets/chunks/chunk-BU4VRYN7.js +1 -0
  77. package/dist/client/assets/chunks/chunk-CALYHV7D.js +1 -0
  78. package/dist/client/assets/chunks/chunk-CF4W3RZ4.js +1 -0
  79. package/dist/client/assets/chunks/chunk-DCZ2OBSL.js +1 -0
  80. package/dist/client/assets/chunks/chunk-DUFPBTHD.js +1 -0
  81. package/dist/client/assets/chunks/chunk-DUICIQBC.js +88 -0
  82. package/dist/client/assets/chunks/chunk-EH2N475V.js +1 -0
  83. package/dist/client/assets/chunks/chunk-EHLLNPZT.js +1 -0
  84. package/dist/client/assets/chunks/chunk-EIBFAW37.js +1 -0
  85. package/dist/client/assets/chunks/chunk-EO3ER3GN.js +1 -0
  86. package/dist/client/assets/chunks/chunk-FH24BIIA.js +1 -0
  87. package/dist/client/assets/chunks/chunk-FNOXGAL5.js +2 -0
  88. package/dist/client/assets/chunks/chunk-FTY6WLQF.js +3 -0
  89. package/dist/client/assets/chunks/chunk-FZFME6UK.js +1 -0
  90. package/dist/client/assets/chunks/chunk-FZJZZYYO.js +1 -0
  91. package/dist/client/assets/chunks/chunk-G4Z6L7OO.js +1 -0
  92. package/dist/client/assets/chunks/chunk-GNCEAN2B.js +1 -0
  93. package/dist/client/assets/chunks/chunk-GQJIKV3T.js +1 -0
  94. package/dist/client/assets/chunks/chunk-GUMNOKT2.js +1 -0
  95. package/dist/client/assets/chunks/chunk-GXRORAF3.js +1 -0
  96. package/dist/client/assets/chunks/chunk-H36ABDKY.js +1 -0
  97. package/dist/client/assets/chunks/chunk-HAR5NYVW.js +1 -0
  98. package/dist/client/assets/chunks/chunk-HIGPS4L2.js +1 -0
  99. package/dist/client/assets/chunks/chunk-HMOBGTME.js +1 -0
  100. package/dist/client/assets/chunks/chunk-HNO6SQ7M.js +1 -0
  101. package/dist/client/assets/chunks/chunk-HYVZ3GYN.js +1 -0
  102. package/dist/client/assets/chunks/chunk-I6TGFOQS.js +1 -0
  103. package/dist/client/assets/chunks/chunk-IHIOJK7I.js +1 -0
  104. package/dist/client/assets/chunks/chunk-IHJNUMSC.js +1 -0
  105. package/dist/client/assets/chunks/chunk-IP7PB2OC.js +1 -0
  106. package/dist/client/assets/chunks/chunk-ISDTMH2Y.js +1 -0
  107. package/dist/client/assets/chunks/chunk-J65M2LNT.js +1 -0
  108. package/dist/client/assets/chunks/chunk-JCWYZ7X2.js +62 -0
  109. package/dist/client/assets/chunks/chunk-JENWYTLI.js +1 -0
  110. package/dist/client/assets/chunks/chunk-JJ6YWJQS.js +1 -0
  111. package/dist/client/assets/chunks/chunk-JMUVGGX7.js +32 -0
  112. package/dist/client/assets/chunks/chunk-JNQUFMM4.js +1 -0
  113. package/dist/client/assets/chunks/chunk-JPTECOAL.js +1 -0
  114. package/dist/client/assets/chunks/chunk-JZNK4LKS.js +1 -0
  115. package/dist/client/assets/chunks/chunk-KPNXJBIW.js +1 -0
  116. package/dist/client/assets/chunks/chunk-KZO2GZL7.js +1 -0
  117. package/dist/client/assets/chunks/chunk-L2REESOQ.js +1 -0
  118. package/dist/client/assets/chunks/chunk-LJPJXR7R.js +1 -0
  119. package/dist/client/assets/chunks/chunk-LOEZMLCI.js +1 -0
  120. package/dist/client/assets/chunks/chunk-MLYC6FSE.js +1 -0
  121. package/dist/client/assets/chunks/chunk-MMDGEZYU.js +1 -0
  122. package/dist/client/assets/chunks/chunk-MYXE7CGE.js +1 -0
  123. package/dist/client/assets/chunks/chunk-NBH7YOBD.js +15 -0
  124. package/dist/client/assets/chunks/chunk-NCOVM3YF.js +1 -0
  125. package/dist/client/assets/chunks/chunk-NCWOBVU7.js +1 -0
  126. package/dist/client/assets/chunks/chunk-NLRIHHEH.js +1 -0
  127. package/dist/client/assets/chunks/chunk-NUPEOYK6.js +1 -0
  128. package/dist/client/assets/chunks/chunk-O4MVOA7X.js +1 -0
  129. package/dist/client/assets/chunks/chunk-OBHQQZ4H.js +1 -0
  130. package/dist/client/assets/chunks/chunk-OKPNJIIR.js +1 -0
  131. package/dist/client/assets/chunks/chunk-OLMPB57R.js +1 -0
  132. package/dist/client/assets/chunks/chunk-P2FYOAEV.js +1 -0
  133. package/dist/client/assets/chunks/chunk-PI3SNP4C.js +1 -0
  134. package/dist/client/assets/chunks/chunk-PRDTEROB.js +1 -0
  135. package/dist/client/assets/chunks/chunk-PZELHD2H.js +136 -0
  136. package/dist/client/assets/chunks/chunk-QR2Q34LM.js +1 -0
  137. package/dist/client/assets/chunks/chunk-R4GIXL6S.js +1 -0
  138. package/dist/client/assets/chunks/chunk-RORF4F5V.js +1 -0
  139. package/dist/client/assets/chunks/chunk-S73BYTLL.js +1 -0
  140. package/dist/client/assets/chunks/chunk-SFC5MRYR.js +1 -0
  141. package/dist/client/assets/chunks/chunk-SVM2H22K.js +2 -0
  142. package/dist/client/assets/chunks/chunk-SZ6UCGVD.js +1 -0
  143. package/dist/client/assets/chunks/chunk-SZYM6GIJ.js +127 -0
  144. package/dist/client/assets/chunks/chunk-TT5KJZKM.js +1 -0
  145. package/dist/client/assets/chunks/chunk-UFBKUYNH.js +1 -0
  146. package/dist/client/assets/chunks/chunk-UL57AD4T.js +1 -0
  147. package/dist/client/assets/chunks/chunk-UNEI7LMM.js +1 -0
  148. package/dist/client/assets/chunks/chunk-VNQBBFIY.js +1 -0
  149. package/dist/client/assets/chunks/chunk-WGVITPII.js +1 -0
  150. package/dist/client/assets/chunks/chunk-WRA6KJHX.js +10 -0
  151. package/dist/client/assets/chunks/chunk-WS5EHW43.js +1 -0
  152. package/dist/client/assets/chunks/chunk-XE6SLBBE.js +3 -0
  153. package/dist/client/assets/chunks/chunk-XF5T2P7U.js +72 -0
  154. package/dist/client/assets/chunks/chunk-XFRY5WKO.js +1 -0
  155. package/dist/client/assets/chunks/chunk-XWYV4OPA.js +1 -0
  156. package/dist/client/assets/chunks/chunk-YCE5ECKY.js +1 -0
  157. package/dist/client/assets/chunks/chunk-YIN5CSIF.js +1 -0
  158. package/dist/client/assets/chunks/chunk-YLFUX6XH.js +1 -0
  159. package/dist/client/assets/chunks/chunk-YNXJICZM.js +1 -0
  160. package/dist/client/assets/chunks/chunk-YOHF7NGD.js +1 -0
  161. package/dist/client/assets/chunks/chunk-YORIST7Z.js +1 -0
  162. package/dist/client/assets/chunks/chunk-YUL7CG4R.js +1 -0
  163. package/dist/client/assets/chunks/chunk-YUN7JSFJ.js +2 -0
  164. package/dist/client/assets/chunks/chunk-YZ7D2IT7.js +1 -0
  165. package/dist/client/assets/chunks/chunk-Z7LAPMFJ.js +1 -0
  166. package/dist/client/assets/chunks/chunk-ZE325LPC.js +1 -0
  167. package/dist/client/assets/chunks/chunk-ZN7TN6PO.js +1 -0
  168. package/dist/client/assets/chunks/chunk-ZST3EVPO.js +1 -0
  169. package/dist/client/assets/chunks/chunk-ZZHMDDZN.js +1 -0
  170. package/dist/client/assets/chunks/clarity-RKRYQ7WF.js +1 -0
  171. package/dist/client/assets/chunks/classDiagram-v2-L25IHNXF-Y67HVDZV.js +217 -0
  172. package/dist/client/assets/chunks/clojure-2X2DQECJ.js +1 -0
  173. package/dist/client/assets/chunks/cmake-LH5524XE.js +1 -0
  174. package/dist/client/assets/chunks/cobol-7DALQF3W.js +1 -0
  175. package/dist/client/assets/chunks/codeowners-52SZU5P5.js +1 -0
  176. package/dist/client/assets/chunks/codeql-EISH3KUP.js +1 -0
  177. package/dist/client/assets/chunks/coffee-VAWSGA7Y.js +1 -0
  178. package/dist/client/assets/chunks/common-lisp-4MVK2AN6.js +1 -0
  179. package/dist/client/assets/chunks/coq-4VRYZRZV.js +1 -0
  180. package/dist/client/assets/chunks/core-BRBMZSD2.js +12 -0
  181. package/dist/client/assets/chunks/cose-bilkent-JH36ORCC-BIOOHSAA.js +1 -0
  182. package/dist/client/assets/chunks/cpp-RFECMSKD.js +1 -0
  183. package/dist/client/assets/chunks/crystal-ZBGGFAOI.js +1 -0
  184. package/dist/client/assets/chunks/csharp-BZDPMKKW.js +1 -0
  185. package/dist/client/assets/chunks/css-3WWGM6UD.js +1 -0
  186. package/dist/client/assets/chunks/csv-AB4GNWSB.js +1 -0
  187. package/dist/client/assets/chunks/cue-2E46MZP2.js +1 -0
  188. package/dist/client/assets/chunks/cynefin-EF2NZ3EQ-TLFQLWUN.js +1 -0
  189. package/dist/client/assets/chunks/cynefinDiagram-L36ESFBY-FLPXCSSG.js +62 -0
  190. package/dist/client/assets/chunks/cypher-HR3ILFOL.js +1 -0
  191. package/dist/client/assets/chunks/d-TARSZPOL.js +1 -0
  192. package/dist/client/assets/chunks/dagre-SPEB5RXH-7EGEINJ2.js +4 -0
  193. package/dist/client/assets/chunks/dart-SALLJHVI.js +1 -0
  194. package/dist/client/assets/chunks/dax-WYMRGMXC.js +1 -0
  195. package/dist/client/assets/chunks/desktop-ND5CGLLJ.js +1 -0
  196. package/dist/client/assets/chunks/diagram-3B7GL73J-6USY4HZX.js +200 -0
  197. package/dist/client/assets/chunks/diagram-DNEMPZML-BNSOC4VW.js +24 -0
  198. package/dist/client/assets/chunks/diagram-L3MUGCDN-5V5FZYIG.js +41 -0
  199. package/dist/client/assets/chunks/diagram-LA4NIPWU-25VLY2CO.js +24 -0
  200. package/dist/client/assets/chunks/diagram-MHCOC4E2-G2LFP3JU.js +3 -0
  201. package/dist/client/assets/chunks/diagram-XPFHEONP-E6HBBIBV.js +30 -0
  202. package/dist/client/assets/chunks/diff-PWYGPM7B.js +1 -0
  203. package/dist/client/assets/chunks/docker-A4D7DT7W.js +1 -0
  204. package/dist/client/assets/chunks/dotenv-VWQWV2DY.js +1 -0
  205. package/dist/client/assets/chunks/dream-maker-M5YDQS35.js +1 -0
  206. package/dist/client/assets/chunks/ebnfDiagram-UZSYDL2S-BMXXZZPI.js +1 -0
  207. package/dist/client/assets/chunks/edge-3QXIDJHI.js +1 -0
  208. package/dist/client/assets/chunks/elixir-3OX2UHIZ.js +1 -0
  209. package/dist/client/assets/chunks/elk-XV6XMXQE-IPR65FON.js +27 -0
  210. package/dist/client/assets/chunks/elm-CTS65NCT.js +1 -0
  211. package/dist/client/assets/chunks/emacs-lisp-HHS2IDO7.js +1 -0
  212. package/dist/client/assets/chunks/engine-javascript-DNHSF67B.js +141 -0
  213. package/dist/client/assets/chunks/erDiagram-EYBAPDEH-3GEHFWHG.js +99 -0
  214. package/dist/client/assets/chunks/erb-ICYWK6HS.js +1 -0
  215. package/dist/client/assets/chunks/erlang-BDQPNCKX.js +1 -0
  216. package/dist/client/assets/chunks/eventmodeling-K75KTNOO-B27BJTZL.js +1 -0
  217. package/dist/client/assets/chunks/fennel-4ONBA2PH.js +1 -0
  218. package/dist/client/assets/chunks/fish-ATLPBZSD.js +1 -0
  219. package/dist/client/assets/chunks/flowDiagram-MALGAFMO-5PCLR4AE.js +1 -0
  220. package/dist/client/assets/chunks/fluent-GGMONBVW.js +1 -0
  221. package/dist/client/assets/chunks/fortran-fixed-form-5MSBDRWQ.js +1 -0
  222. package/dist/client/assets/chunks/fortran-free-form-TT3RBL75.js +1 -0
  223. package/dist/client/assets/chunks/fsharp-PAGHNW4O.js +1 -0
  224. package/dist/client/assets/chunks/ganttDiagram-23REXITY-VE5MVBTO.js +292 -0
  225. package/dist/client/assets/chunks/gdresource-5OTP326D.js +1 -0
  226. package/dist/client/assets/chunks/gdscript-VPWHSCLF.js +1 -0
  227. package/dist/client/assets/chunks/gdshader-FYLPXFE5.js +1 -0
  228. package/dist/client/assets/chunks/genie-UYMEEMA2.js +1 -0
  229. package/dist/client/assets/chunks/gherkin-SU7D5DMY.js +1 -0
  230. package/dist/client/assets/chunks/git-commit-5CF5QAG7.js +1 -0
  231. package/dist/client/assets/chunks/git-rebase-X72BAUZI.js +1 -0
  232. package/dist/client/assets/chunks/gitGraph-VSP46ZUC-J6CJ5YZF.js +1 -0
  233. package/dist/client/assets/chunks/gitGraphDiagram-STJD7YCW-7YJGT6ZP.js +106 -0
  234. package/dist/client/assets/chunks/gleam-LR42YRKO.js +1 -0
  235. package/dist/client/assets/chunks/glimmer-js-JPF67FJU.js +1 -0
  236. package/dist/client/assets/chunks/glimmer-ts-BYPAVIZT.js +1 -0
  237. package/dist/client/assets/chunks/glsl-GTGUULBN.js +1 -0
  238. package/dist/client/assets/chunks/gn-NMDQA4K3.js +1 -0
  239. package/dist/client/assets/chunks/gnuplot-UUAMYBCZ.js +1 -0
  240. package/dist/client/assets/chunks/go-4RERSTNP.js +1 -0
  241. package/dist/client/assets/chunks/graphql-5A6RK6YF.js +1 -0
  242. package/dist/client/assets/chunks/groovy-O7BJONCU.js +1 -0
  243. package/dist/client/assets/chunks/hack-7QGTNPDP.js +1 -0
  244. package/dist/client/assets/chunks/haml-ON5GAWN4.js +1 -0
  245. package/dist/client/assets/chunks/handlebars-6UOQSUBP.js +1 -0
  246. package/dist/client/assets/chunks/haskell-OIZXZ26Y.js +1 -0
  247. package/dist/client/assets/chunks/haxe-7FFVS4FO.js +1 -0
  248. package/dist/client/assets/chunks/hcl-XFUFQJHV.js +1 -0
  249. package/dist/client/assets/chunks/hjson-QDBHMTD5.js +1 -0
  250. package/dist/client/assets/chunks/hlsl-4LP25FFN.js +1 -0
  251. package/dist/client/assets/chunks/html-7RNQXAAV.js +1 -0
  252. package/dist/client/assets/chunks/html-derivative-ESOY72Q2.js +1 -0
  253. package/dist/client/assets/chunks/http-SAD4PMBD.js +1 -0
  254. package/dist/client/assets/chunks/hurl-ZSJJXPQH.js +1 -0
  255. package/dist/client/assets/chunks/hxml-HJCC37RK.js +1 -0
  256. package/dist/client/assets/chunks/hy-CLDE3P4K.js +1 -0
  257. package/dist/client/assets/chunks/imba-REB34U5V.js +1 -0
  258. package/dist/client/assets/chunks/info-OHQRW6UA-EQQKXR77.js +1 -0
  259. package/dist/client/assets/chunks/infoDiagram-KBXO4MBG-F6KGZCGS.js +2 -0
  260. package/dist/client/assets/chunks/ini-PDFEMGRA.js +1 -0
  261. package/dist/client/assets/chunks/ishikawaDiagram-M35NCXHK-5D6ZOZ34.js +70 -0
  262. package/dist/client/assets/chunks/java-KB6XENAD.js +1 -0
  263. package/dist/client/assets/chunks/javascript-3JX5T423.js +1 -0
  264. package/dist/client/assets/chunks/jinja-V4UNU6K4.js +1 -0
  265. package/dist/client/assets/chunks/jison-KH5XNLJP.js +1 -0
  266. package/dist/client/assets/chunks/journeyDiagram-OPLOXDXO-ANDOJZKW.js +139 -0
  267. package/dist/client/assets/chunks/json-HPXFRRPY.js +1 -0
  268. package/dist/client/assets/chunks/json5-LJM6TXWM.js +1 -0
  269. package/dist/client/assets/chunks/jsonc-UZWRU3JV.js +1 -0
  270. package/dist/client/assets/chunks/jsonl-RFZD5UN4.js +1 -0
  271. package/dist/client/assets/chunks/jsonnet-GFZABBL6.js +1 -0
  272. package/dist/client/assets/chunks/jssm-2YIGBISJ.js +1 -0
  273. package/dist/client/assets/chunks/jsx-KLV2ZWUT.js +1 -0
  274. package/dist/client/assets/chunks/julia-3TZDIPPO.js +1 -0
  275. package/dist/client/assets/chunks/just-UHCONBQS.js +1 -0
  276. package/dist/client/assets/chunks/kanban-definition-BZKZHSQY-GF5I5NVD.js +89 -0
  277. package/dist/client/assets/chunks/katex-PIN72PQZ.js +257 -0
  278. package/dist/client/assets/chunks/kdl-DARTFOCL.js +1 -0
  279. package/dist/client/assets/chunks/kotlin-7KT5DW6Y.js +1 -0
  280. package/dist/client/assets/chunks/kusto-EKYXZTC5.js +1 -0
  281. package/dist/client/assets/chunks/langs-GO3UQR4H.js +1 -0
  282. package/dist/client/assets/chunks/latex-T57MIHR5.js +1 -0
  283. package/dist/client/assets/chunks/lean-5QVPRMV6.js +1 -0
  284. package/dist/client/assets/chunks/less-K6QEH5TN.js +1 -0
  285. package/dist/client/assets/chunks/liquid-3LCNNEIV.js +1 -0
  286. package/dist/client/assets/chunks/llvm-O32ZIVRF.js +1 -0
  287. package/dist/client/assets/chunks/log-C4YPJ5BB.js +1 -0
  288. package/dist/client/assets/chunks/logo-JPMO43A6.js +1 -0
  289. package/dist/client/assets/chunks/lua-YKVSOG7K.js +1 -0
  290. package/dist/client/assets/chunks/luau-K4EECYSO.js +1 -0
  291. package/dist/client/assets/chunks/make-VHSYMHHW.js +1 -0
  292. package/dist/client/assets/chunks/markdown-GC5J46H4.js +1 -0
  293. package/dist/client/assets/chunks/marko-U45YFADC.js +1 -0
  294. package/dist/client/assets/chunks/matlab-AMOKC4LU.js +1 -0
  295. package/dist/client/assets/chunks/mdc-DIGA2UXP.js +1 -0
  296. package/dist/client/assets/chunks/mdx-BZUGCKQA.js +1 -0
  297. package/dist/client/assets/chunks/mermaid-WHDP6ZPA.js +1 -0
  298. package/dist/client/assets/chunks/mermaid.core-SQMPMUDN.js +10 -0
  299. package/dist/client/assets/chunks/mindmap-definition-I2QAS2VK-4NH5S56C.js +98 -0
  300. package/dist/client/assets/chunks/mipsasm-2S4CUGQV.js +1 -0
  301. package/dist/client/assets/chunks/mojo-ZOL2PNKT.js +1 -0
  302. package/dist/client/assets/chunks/moonbit-U3BDAIFE.js +1 -0
  303. package/dist/client/assets/chunks/move-YSXALBWA.js +1 -0
  304. package/dist/client/assets/chunks/narrat-DHFIAUJH.js +1 -0
  305. package/dist/client/assets/chunks/nextflow-ESAKNTI3.js +1 -0
  306. package/dist/client/assets/chunks/nextflow-groovy-FKDSPJUI.js +1 -0
  307. package/dist/client/assets/chunks/nginx-XYAYERLO.js +1 -0
  308. package/dist/client/assets/chunks/nim-XOWBVFDH.js +1 -0
  309. package/dist/client/assets/chunks/nix-RVSTQSHC.js +1 -0
  310. package/dist/client/assets/chunks/nsis-KMDUKQRL.js +1 -0
  311. package/dist/client/assets/chunks/nushell-SKJHHZ7U.js +1 -0
  312. package/dist/client/assets/chunks/objective-c-3B3KXQ7Q.js +1 -0
  313. package/dist/client/assets/chunks/objective-cpp-6JDULPJS.js +1 -0
  314. package/dist/client/assets/chunks/ocaml-TMRFXBVO.js +1 -0
  315. package/dist/client/assets/chunks/odin-IN3PLCK7.js +1 -0
  316. package/dist/client/assets/chunks/openscad-P52IKPNH.js +1 -0
  317. package/dist/client/assets/chunks/org-N3SJ2PIA.js +1 -0
  318. package/dist/client/assets/chunks/packet-JDAUHWVQ-4SWIKSKP.js +1 -0
  319. package/dist/client/assets/chunks/pascal-T7CUWCQ4.js +1 -0
  320. package/dist/client/assets/chunks/pegDiagram-FD4XPPHP-WDKZSEGN.js +1 -0
  321. package/dist/client/assets/chunks/perl-LCZ4KODH.js +1 -0
  322. package/dist/client/assets/chunks/php-4XHMBVR5.js +1 -0
  323. package/dist/client/assets/chunks/pie-XZMESJXO-PSSWOWGV.js +1 -0
  324. package/dist/client/assets/chunks/pieDiagram-J4AKIIQI-BDW5I5ON.js +39 -0
  325. package/dist/client/assets/chunks/pkl-OACG5B67.js +1 -0
  326. package/dist/client/assets/chunks/plsql-7E5C7CJX.js +1 -0
  327. package/dist/client/assets/chunks/po-ZSREFRRP.js +1 -0
  328. package/dist/client/assets/chunks/polar-4GBINVA7.js +1 -0
  329. package/dist/client/assets/chunks/postcss-B7RPVGFW.js +1 -0
  330. package/dist/client/assets/chunks/powerquery-6UFMTY4G.js +1 -0
  331. package/dist/client/assets/chunks/powershell-3STRPCNT.js +1 -0
  332. package/dist/client/assets/chunks/prisma-4TPSPIZ5.js +1 -0
  333. package/dist/client/assets/chunks/prolog-HEAYPKQW.js +1 -0
  334. package/dist/client/assets/chunks/proto-Y3Y3VKXM.js +1 -0
  335. package/dist/client/assets/chunks/pug-7PBPMG3M.js +1 -0
  336. package/dist/client/assets/chunks/puppet-FR35R4OI.js +1 -0
  337. package/dist/client/assets/chunks/purescript-OUHXQAOW.js +1 -0
  338. package/dist/client/assets/chunks/python-SNDG7FNU.js +1 -0
  339. package/dist/client/assets/chunks/qml-UVIOSWP4.js +1 -0
  340. package/dist/client/assets/chunks/qmldir-6JGUNYL5.js +1 -0
  341. package/dist/client/assets/chunks/qss-ZCC466IZ.js +1 -0
  342. package/dist/client/assets/chunks/quadrantDiagram-XTYBLID2-5VKXWVJ6.js +7 -0
  343. package/dist/client/assets/chunks/r-4XW4O3ZF.js +1 -0
  344. package/dist/client/assets/chunks/racket-YJAYXOOG.js +1 -0
  345. package/dist/client/assets/chunks/radar-ABXABTNO-3AXZCEY2.js +1 -0
  346. package/dist/client/assets/chunks/railroad-I3PHUGI6-2PLXYPOT.js +1 -0
  347. package/dist/client/assets/chunks/railroad-abnf-LNEFI6M7-M4DGICQX.js +1 -0
  348. package/dist/client/assets/chunks/railroad-ebnf-DWYD2UWJ-UEIHQMSZ.js +1 -0
  349. package/dist/client/assets/chunks/railroad-peg-JR7BVNR7-I7VLIBXM.js +1 -0
  350. package/dist/client/assets/chunks/railroadDiagram-MRQ6NCDL-Y6IYWEFL.js +1 -0
  351. package/dist/client/assets/chunks/raku-63NEL5JK.js +1 -0
  352. package/dist/client/assets/chunks/razor-J3CJP523.js +1 -0
  353. package/dist/client/assets/chunks/rbs-6GQLT7NW.js +1 -0
  354. package/dist/client/assets/chunks/reg-6Q3OEC2C.js +1 -0
  355. package/dist/client/assets/chunks/regexp-LPIMILT3.js +1 -0
  356. package/dist/client/assets/chunks/rel-TOQGUTHB.js +1 -0
  357. package/dist/client/assets/chunks/requirementDiagram-Y7LWUY3S-CIWXVVWJ.js +84 -0
  358. package/dist/client/assets/chunks/riscv-UELGBOXE.js +1 -0
  359. package/dist/client/assets/chunks/ron-FW7LCJJH.js +1 -0
  360. package/dist/client/assets/chunks/rosmsg-O63VHE3L.js +1 -0
  361. package/dist/client/assets/chunks/rst-3WJXGLA7.js +1 -0
  362. package/dist/client/assets/chunks/ruby-7S7L6JTH.js +1 -0
  363. package/dist/client/assets/chunks/rust-LIK4HRRI.js +1 -0
  364. package/dist/client/assets/chunks/sankeyDiagram-WGJFYUXA-OGNQPX5V.js +40 -0
  365. package/dist/client/assets/chunks/sas-FHDPZ2JH.js +1 -0
  366. package/dist/client/assets/chunks/sass-UI4HW2FN.js +1 -0
  367. package/dist/client/assets/chunks/scala-KN7RQSUJ.js +1 -0
  368. package/dist/client/assets/chunks/scheme-5R527YZ5.js +1 -0
  369. package/dist/client/assets/chunks/scss-KZ6DRE4A.js +1 -0
  370. package/dist/client/assets/chunks/sdbl-FHOCL5SL.js +1 -0
  371. package/dist/client/assets/chunks/sequenceDiagram-5NDRBG5M-QX2V24ZU.js +169 -0
  372. package/dist/client/assets/chunks/shaderlab-2TLHUS2H.js +1 -0
  373. package/dist/client/assets/chunks/shellscript-PIB6ZBDM.js +1 -0
  374. package/dist/client/assets/chunks/shellsession-5KL7NFNN.js +1 -0
  375. package/dist/client/assets/chunks/sizeCapture-INFHLROL-LCS2PIHM.js +1 -0
  376. package/dist/client/assets/chunks/smalltalk-JFLFU247.js +1 -0
  377. package/dist/client/assets/chunks/smithy-HONEXZAM.js +1 -0
  378. package/dist/client/assets/chunks/solidity-SJ3INJFZ.js +1 -0
  379. package/dist/client/assets/chunks/soy-ND4SWTM2.js +1 -0
  380. package/dist/client/assets/chunks/sparql-YB2JQBZD.js +1 -0
  381. package/dist/client/assets/chunks/splunk-UXIDDAWL.js +1 -0
  382. package/dist/client/assets/chunks/sql-K6OMG7SQ.js +1 -0
  383. package/dist/client/assets/chunks/ssh-config-I7KJY3KQ.js +1 -0
  384. package/dist/client/assets/chunks/stata-DNZ3DTFJ.js +1 -0
  385. package/dist/client/assets/chunks/stateDiagram-v2-FJ4FJNEA-LVAUWF3A.js +291 -0
  386. package/dist/client/assets/chunks/stylus-GWPR6IQY.js +1 -0
  387. package/dist/client/assets/chunks/surrealql-KQNHBWLC.js +1 -0
  388. package/dist/client/assets/chunks/svelte-YQKF25S4.js +1 -0
  389. package/dist/client/assets/chunks/swift-ZCIZUJXA.js +1 -0
  390. package/dist/client/assets/chunks/swimlanes-UMQ2AFYF-B3RQOARQ.js +1 -0
  391. package/dist/client/assets/chunks/swimlanesDiagram-OMPLPG4O-JOE33EOV.js +8 -0
  392. package/dist/client/assets/chunks/system-verilog-Y7E6FIO3.js +1 -0
  393. package/dist/client/assets/chunks/systemd-WHC7NBZP.js +1 -0
  394. package/dist/client/assets/chunks/talonscript-WC7SODAH.js +1 -0
  395. package/dist/client/assets/chunks/tasl-QHY2GTCB.js +1 -0
  396. package/dist/client/assets/chunks/tcl-VAMIL5PJ.js +1 -0
  397. package/dist/client/assets/chunks/temml-ISNSX3VV.js +96 -0
  398. package/dist/client/assets/chunks/templ-B3BHKWV4.js +1 -0
  399. package/dist/client/assets/chunks/terraform-Q4UEK6FK.js +1 -0
  400. package/dist/client/assets/chunks/tex-63OWCYAB.js +1 -0
  401. package/dist/client/assets/chunks/timeline-definition-SEUHKTQE-FDFTVAJG.js +120 -0
  402. package/dist/client/assets/chunks/toml-7Z4IPGES.js +1 -0
  403. package/dist/client/assets/chunks/treeView-D4JQ5SDB-ABSGRAGI.js +1 -0
  404. package/dist/client/assets/chunks/treemap-SAJKECNS-MYX2CBJN.js +1 -0
  405. package/dist/client/assets/chunks/ts-tags-DT62HE52.js +1 -0
  406. package/dist/client/assets/chunks/tsv-RTXHWADP.js +1 -0
  407. package/dist/client/assets/chunks/tsx-UANUBOC7.js +1 -0
  408. package/dist/client/assets/chunks/turtle-QVOUNUUL.js +1 -0
  409. package/dist/client/assets/chunks/twig-ZPC4BPDA.js +1 -0
  410. package/dist/client/assets/chunks/typescript-WGWKIMMW.js +1 -0
  411. package/dist/client/assets/chunks/typespec-TYCVR32J.js +1 -0
  412. package/dist/client/assets/chunks/typst-PIBFYUO6.js +1 -0
  413. package/dist/client/assets/chunks/usecaseDiagram-AFA6YXN4-KW7ADINR.js +370 -0
  414. package/dist/client/assets/chunks/v-3ERNWBSP.js +1 -0
  415. package/dist/client/assets/chunks/vala-UCBCT2GS.js +1 -0
  416. package/dist/client/assets/chunks/vb-DGI3VTPA.js +1 -0
  417. package/dist/client/assets/chunks/vennDiagram-NNMJR3RB-RDGLGOGM.js +34 -0
  418. package/dist/client/assets/chunks/verilog-G72NZROS.js +1 -0
  419. package/dist/client/assets/chunks/vhdl-PYGA77XE.js +1 -0
  420. package/dist/client/assets/chunks/viml-OOC5B5UU.js +1 -0
  421. package/dist/client/assets/chunks/vue-GTNHIOPG.js +1 -0
  422. package/dist/client/assets/chunks/vue-html-DKAMJV55.js +1 -0
  423. package/dist/client/assets/chunks/vue-vine-WTM5HREV.js +1 -0
  424. package/dist/client/assets/chunks/vyper-RHYEHOJM.js +1 -0
  425. package/dist/client/assets/chunks/wardley-7MLQ67FV-QJL2HSBT.js +1 -0
  426. package/dist/client/assets/chunks/wardleyDiagram-S7YFUSEH-A4XX3UJR.js +78 -0
  427. package/dist/client/assets/chunks/wasm-ZMM2Z5XV.js +1 -0
  428. package/dist/client/assets/chunks/wenyan-HF5UTKSJ.js +1 -0
  429. package/dist/client/assets/chunks/wgsl-O7D7OPO7.js +1 -0
  430. package/dist/client/assets/chunks/wikitext-T7BSWSKQ.js +1 -0
  431. package/dist/client/assets/chunks/wit-TKCHPPT6.js +1 -0
  432. package/dist/client/assets/chunks/wolfram-7MN66A7N.js +1 -0
  433. package/dist/client/assets/chunks/xml-NLTLAWOD.js +1 -0
  434. package/dist/client/assets/chunks/xsl-NZ4ECK3P.js +1 -0
  435. package/dist/client/assets/chunks/xychartDiagram-GGNKY7IX-OXJILWHR.js +7 -0
  436. package/dist/client/assets/chunks/yaml-HRJLEV3V.js +1 -0
  437. package/dist/client/assets/chunks/zenscript-4LLRSLPI.js +1 -0
  438. package/dist/client/assets/chunks/zig-Y7MUQFUO.js +1 -0
  439. package/dist/client/assets/main.js +186 -0
  440. package/dist/client/index.html +48 -0
  441. package/dist/config.js +322 -0
  442. package/dist/files.js +178 -0
  443. package/dist/git.js +365 -0
  444. package/dist/glob.js +89 -0
  445. package/dist/review.js +290 -0
  446. package/dist/search.js +136 -0
  447. package/dist/server.js +482 -0
  448. package/dist/watch.js +69 -0
  449. package/dist/zip.js +100 -0
  450. package/package.json +61 -4
@@ -0,0 +1,370 @@
1
+ import{a as Bn}from"./chunk-PI3SNP4C.js";import{b as Dn,c as Fn}from"./chunk-WS5EHW43.js";import{a as $n}from"./chunk-YCE5ECKY.js";import"./chunk-25KVF5ZE.js";import"./chunk-WRA6KJHX.js";import"./chunk-O4MVOA7X.js";import"./chunk-VNQBBFIY.js";import"./chunk-JCWYZ7X2.js";import"./chunk-UNEI7LMM.js";import"./chunk-YORIST7Z.js";import{b as wn,c as Un,d as Ue,e as Pn}from"./chunk-HIGPS4L2.js";import{b as Mn}from"./chunk-XF5T2P7U.js";import"./chunk-OBHQQZ4H.js";import{q as xn}from"./chunk-FNOXGAL5.js";import"./chunk-EO3ER3GN.js";import{B as Nn,H as kn,T as Cn,U as Mt,V as vs,W as wt,X as _s,Y as bn,Z as vn,_ as xs,q as In}from"./chunk-SZYM6GIJ.js";import{b as Ln,d as _n}from"./chunk-5XZPGKN4.js";import{a as h}from"./chunk-EIBFAW37.js";import"./chunk-FTY6WLQF.js";import"./chunk-7FMWBHZO.js";function Pe(s){console&&console.error&&console.error(`Error: ${s}`)}function it(s){console&&console.warn&&console.warn(`Warning: ${s}`)}function rt(s){let e=new Date().getTime(),t=s();return{time:new Date().getTime()-e,value:t}}function at(s){function e(){}e.prototype=s;let t=new e;function n(){return typeof t.bar}return n(),n(),s;(0,eval)(s)}function Jr(s){return Zr(s)?s.LABEL:s.name}function Zr(s){return typeof s.LABEL=="string"&&s.LABEL!==""}var ee=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},k=class extends ee{constructor(e){super([]),this.idx=1,Object.assign(this,le(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},X=class extends ee{constructor(e){super(e.definition),this.orgText="",Object.assign(this,le(e))}},C=class extends ee{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,le(e))}},b=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},F=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},B=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},N=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},w=class extends ee{constructor(e){super(e.definition),this.idx=1,Object.assign(this,le(e))}},U=class extends ee{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,Object.assign(this,le(e))}},O=class{constructor(e){this.idx=1,Object.assign(this,le(e))}accept(e){e.visit(this)}};function Ut(s){return s.map(De)}function De(s){function e(t){return t.map(De)}if(s instanceof k){let t={type:"NonTerminal",name:s.nonTerminalName,idx:s.idx};return typeof s.label=="string"&&(t.label=s.label),t}else{if(s instanceof C)return{type:"Alternative",definition:e(s.definition)};if(s instanceof b)return{type:"Option",idx:s.idx,definition:e(s.definition)};if(s instanceof F)return{type:"RepetitionMandatory",idx:s.idx,definition:e(s.definition)};if(s instanceof B)return{type:"RepetitionMandatoryWithSeparator",idx:s.idx,separator:De(new O({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof w)return{type:"RepetitionWithSeparator",idx:s.idx,separator:De(new O({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof N)return{type:"Repetition",idx:s.idx,definition:e(s.definition)};if(s instanceof U)return{type:"Alternation",idx:s.idx,definition:e(s.definition)};if(s instanceof O){let t={type:"Terminal",name:s.terminalType.name,label:Jr(s.terminalType),idx:s.idx};typeof s.label=="string"&&(t.terminalLabel=s.label);let n=s.terminalType.PATTERN;return s.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}else{if(s instanceof X)return{type:"Rule",name:s.name,orgText:s.orgText,definition:e(s.definition)};throw Error("non exhaustive match")}}}function le(s){return Object.fromEntries(Object.entries(s).filter(([,e])=>e!==void 0))}var Y=class{visit(e){let t=e;switch(t.constructor){case k:return this.visitNonTerminal(t);case C:return this.visitAlternative(t);case b:return this.visitOption(t);case F:return this.visitRepetitionMandatory(t);case B:return this.visitRepetitionMandatoryWithSeparator(t);case w:return this.visitRepetitionWithSeparator(t);case N:return this.visitRepetition(t);case U:return this.visitAlternation(t);case O:return this.visitTerminal(t);case X:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Ms(s){return s instanceof C||s instanceof b||s instanceof N||s instanceof F||s instanceof B||s instanceof w||s instanceof O||s instanceof X}function Oe(s,e=[]){return s instanceof b||s instanceof N||s instanceof w?!0:s instanceof U?s.definition.some(n=>Oe(n,e)):s instanceof k&&e.includes(s)?!1:s instanceof ee?(s instanceof k&&e.push(s),s.definition.every(n=>Oe(n,e))):!1}function ws(s){return s instanceof U}function Z(s){if(s instanceof k)return"SUBRULE";if(s instanceof b)return"OPTION";if(s instanceof U)return"OR";if(s instanceof F)return"AT_LEAST_ONE";if(s instanceof B)return"AT_LEAST_ONE_SEP";if(s instanceof w)return"MANY_SEP";if(s instanceof N)return"MANY";if(s instanceof O)return"CONSUME";throw Error("non exhaustive match")}var de=class{walk(e,t=[]){e.definition.forEach((n,i)=>{let r=e.definition.slice(i+1);if(n instanceof k)this.walkProdRef(n,r,t);else if(n instanceof O)this.walkTerminal(n,r,t);else if(n instanceof C)this.walkFlat(n,r,t);else if(n instanceof b)this.walkOption(n,r,t);else if(n instanceof F)this.walkAtLeastOne(n,r,t);else if(n instanceof B)this.walkAtLeastOneSep(n,r,t);else if(n instanceof w)this.walkManySep(n,r,t);else if(n instanceof N)this.walkMany(n,r,t);else if(n instanceof U)this.walkOr(n,r,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){let i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){let i=[new b({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){let i=Gn(e,t,n);this.walk(e,i)}walkMany(e,t,n){let i=[new b({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){let i=Gn(e,t,n);this.walk(e,i)}walkOr(e,t,n){let i=t.concat(n);e.definition.forEach(r=>{let a=new C({definition:[r]});this.walk(a,i)})}};function Gn(s,e,t){return[new b({definition:[new O({terminalType:s.separator})].concat(s.definition)})].concat(e,t)}function Le(s){if(s instanceof k)return Le(s.referencedRule);if(s instanceof O)return ta(s);if(Ms(s))return Qr(s);if(ws(s))return ea(s);throw Error("non exhaustive match")}function Qr(s){let e=[],t=s.definition,n=0,i=t.length>n,r,a=!0;for(;i&&a;)r=t[n],a=Oe(r),e=e.concat(Le(r)),n=n+1,i=t.length>n;return[...new Set(e)]}function ea(s){let e=s.definition.map(t=>Le(t));return[...new Set(e.flat())]}function ta(s){return[s.terminalType]}var Pt="_~IN~_";var Us=class extends de{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let i=sa(e.referencedRule,e.idx)+this.topProd.name,r=t.concat(n),a=new C({definition:r}),c=Le(a);this.follows[i]=c}};function jn(s){let e={};return s.forEach(t=>{let n=new Us(t).startWalking();Object.assign(e,n)}),e}function sa(s,e){return s.name+e+Pt}function S(s){return s.charCodeAt(0)}function Dt(s,e){Array.isArray(s)?s.forEach(function(t){e.push(t)}):e.push(s)}function Fe(s,e){if(s[e]===!0)throw"duplicate flag "+e;let t=s[e];s[e]=!0}function Ie(s){if(s===void 0)throw Error("Internal Error - Should never get here!");return!0}function ot(){throw Error("Internal Error - Should never get here!")}function Ps(s){return s.type==="Character"}var ct=[];for(let s=S("0");s<=S("9");s++)ct.push(s);var lt=[S("_")].concat(ct);for(let s=S("a");s<=S("z");s++)lt.push(s);for(let s=S("A");s<=S("Z");s++)lt.push(s);var Ds=[S(" "),S("\f"),S(`
2
+ `),S("\r"),S(" "),S("\v"),S(" "),S("\xA0"),S("\u1680"),S("\u2000"),S("\u2001"),S("\u2002"),S("\u2003"),S("\u2004"),S("\u2005"),S("\u2006"),S("\u2007"),S("\u2008"),S("\u2009"),S("\u200A"),S("\u2028"),S("\u2029"),S("\u202F"),S("\u205F"),S("\u3000"),S("\uFEFF")];var na=/[0-9a-fA-F]/,Ft=/[0-9]/,ia=/[1-9]/,ht=class{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("/");let t=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Fe(n,"global");break;case"i":Fe(n,"ignoreCase");break;case"m":Fe(n,"multiLine");break;case"u":Fe(n,"unicode");break;case"y":Fe(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}Ie(t);let n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return ot()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let r;this.isDigit()?(r=this.integerIncludingZero(),t={atLeast:i,atMost:r}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Ie(t);break}if(!(e===!0&&t===void 0)&&Ie(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Ie(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):ot()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[S(`
3
+ `),S("\r"),S("\u2028"),S("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=ct;break;case"D":e=ct,t=!0;break;case"s":e=Ds;break;case"S":e=Ds,t=!0;break;case"w":e=lt;break;case"W":e=lt,t=!0;break}return Ie(e)?{type:"Set",value:e,complement:t}:ot()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=S("\f");break;case"n":e=S(`
4
+ `);break;case"r":e=S("\r");break;case"t":e=S(" ");break;case"v":e=S("\v");break}return Ie(e)?{type:"Character",value:e}:ot()}controlLetterEscapeAtom(){this.consumeChar("c");let 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:S("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:S(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
+ `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:S(e)}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let n=this.classAtom(),i=n.type==="Character";if(Ps(n)&&this.isRangeDash()){this.consumeChar("-");let r=this.classAtom(),a=r.type==="Character";if(Ps(r)){if(r.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:r.value})}else Dt(n.value,e),e.push(S("-")),Dt(r.value,e)}else Dt(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,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:S("\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;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;let t=this.disjunction();this.consumeChar(")");let n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(ia.test(e)===!1)throw Error("Expecting a positive integer");for(;Ft.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Ft.test(e)===!1)throw Error("Expecting an integer");for(;Ft.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let 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:S(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 Ft.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)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){let 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 t="";for(let i=0;i<e;i++){let r=this.popChar();if(na.test(r)===!1)throw Error("Expecting a HexDecimal digits");t+=r}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let 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}}};var Ae=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};var Bt={},ra=new ht;function Ne(s){let e=s.toString();if(Bt.hasOwnProperty(e))return Bt[e];{let t=ra.pattern(e);return Bt[e]=t,t}}function Wn(){Bt={}}var Vn="Complement Sets are not supported for first char optimization",ut=`Unable to use "first char" lexer optimizations:
10
+ `;function zn(s,e=!1){try{let t=Ne(s);return Fs(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===Vn)e&&it(`${ut} Unable to optimize: < ${s.toString()} >
11
+ Complement Sets cannot be automatically optimized.
12
+ This will disable the lexer's first char optimizations.
13
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=`
14
+ This will disable the lexer's first char optimizations.
15
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Pe(`${ut}
16
+ Failed parsing: < ${s.toString()} >
17
+ Using the @chevrotain/regexp-to-ast library
18
+ Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Fs(s,e,t){switch(s.type){case"Disjunction":for(let i=0;i<s.value.length;i++)Fs(s.value[i],e,t);break;case"Alternative":let n=s.value;for(let i=0;i<n.length;i++){let r=n[i];switch(r.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let a=r;switch(a.type){case"Character":$t(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(Vn);a.value.forEach(o=>{if(typeof o=="number")$t(o,e,t);else{let l=o;if(t===!0)for(let d=l.from;d<=l.to;d++)$t(d,e,t);else{for(let d=l.from;d<=l.to&&d<Be;d++)$t(d,e,t);if(l.to>=Be){let d=l.from>=Be?l.from:Be,u=l.to,p=he(d),E=he(u);for(let R=p;R<=E;R++)e[R]=R}}}});break;case"Group":Fs(a.value,e,t);break;default:throw Error("Non Exhaustive Match")}let c=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Bs(a)===!1||a.type!=="Group"&&c===!1)break}break;default:throw Error("non exhaustive match!")}return Object.values(e)}function $t(s,e,t){let n=he(s);e[n]=n,t===!0&&aa(s,e)}function aa(s,e){let t=String.fromCharCode(s),n=t.toUpperCase();if(n!==t){let i=he(n.charCodeAt(0));e[i]=i}else{let i=t.toLowerCase();if(i!==t){let r=he(i.charCodeAt(0));e[r]=r}}}function Kn(s,e){return s.value.find(t=>{if(typeof t=="number")return e.includes(t);{let n=t;return e.find(i=>n.from<=i&&i<=n.to)!==void 0}})}function Bs(s){let e=s.quantifier;return e&&e.atLeast===0?!0:s.value?Array.isArray(s.value)?s.value.every(Bs):Bs(s.value):!1}var $s=class extends Ae{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;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?Kn(e,this.targetCharCodes)===void 0&&(this.found=!0):Kn(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Gt(s,e){if(e instanceof RegExp){let t=Ne(e),n=new $s(s);return n.visit(t),n.found}else{for(let t of e){let n=t.charCodeAt(0);if(s.includes(n))return!0}return!1}}var ke="PATTERN",$e="defaultMode",jt="modes",Kt=0,dt=1,Vt=2,zt=3;function Xn(s,e){e=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
19
+ `],tracer:(T,f)=>f()},e);let t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{Na()});let n;t("Reject Lexer.NA",()=>{n=s.filter(T=>T[ke]!==_.NA)});let i=!1,r;t("Transform Patterns",()=>{i=!1,r=n.map(T=>{let f=T[ke];if(f instanceof RegExp){let m=f.source;return m.length===1&&m!=="^"&&m!=="$"&&m!=="."&&!f.ignoreCase?m:m.length===2&&m[0]==="\\"&&!["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(m[1])?m[1]:Hn(f)}else{if(typeof f=="function")return i=!0,{exec:f};if(typeof f=="object")return i=!0,f;if(typeof f=="string"){if(f.length===1)return f;{let m=f.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),D=new RegExp(m);return Hn(D)}}else throw Error("non exhaustive match")}})});let a,c,o,l,d;t("misc mapping",()=>{a=n.map(T=>T.tokenTypeIdx),c=n.map(T=>{let f=T.GROUP;if(f!==_.SKIPPED){if(typeof f=="string")return f;if(f===void 0)return!1;throw Error("non exhaustive match")}}),o=n.map(T=>{let f=T.LONGER_ALT;if(f)return Array.isArray(f)?f.map(D=>n.indexOf(D)):[n.indexOf(f)]}),l=n.map(T=>T.PUSH_MODE),d=n.map(T=>Object.hasOwn(T,"POP_MODE"))});let u;t("Line Terminator Handling",()=>{let T=ti(e.lineTerminatorCharacters);u=n.map(f=>!1),e.positionTracking!=="onlyOffset"&&(u=n.map(f=>Object.hasOwn(f,"LINE_BREAKS")?!!f.LINE_BREAKS:ei(f,T)===!1&&Gt(T,f.PATTERN)))});let p,E,R,y;t("Misc Mapping #2",()=>{p=n.map(Zn),E=r.map(La),R=n.reduce((T,f)=>{let m=f.GROUP;return typeof m=="string"&&m!==_.SKIPPED&&(T[m]=[]),T},{}),y=r.map((T,f)=>{let m=c[f]===void 0&&o[f]===void 0?oa(n[f].PATTERN):void 0;return{pattern:r[f],asciiClass:m,longerAlt:o[f],canLineTerminator:u[f],matchType:m!==void 0?zt:E[f]!==!1?Kt:p[f]?dt:Vt,short:E[f],group:c[f],push:l[f],pop:d[f],tokenTypeIdx:a[f],tokenType:n[f]}})});let I=!0,g=[];return e.safeMode||t("First Char Optimization",()=>{g=n.reduce((T,f,m)=>{if(typeof f.PATTERN=="string"){let D=f.PATTERN.charCodeAt(0),re=he(D);Gs(T,re,y[m])}else if(Array.isArray(f.START_CHARS_HINT)){let D;f.START_CHARS_HINT.forEach(re=>{let ge=typeof re=="string"?re.charCodeAt(0):re,Re=he(ge);D!==Re&&(D=Re,Gs(T,Re,y[m]))})}else if(f.PATTERN instanceof RegExp)if(f.PATTERN.unicode)I=!1,e.ensureOptimizations&&Pe(`${ut} Unable to analyze < ${f.PATTERN.toString()} > pattern.
20
+ The regexp unicode flag is not currently supported by the regexp-to-ast library.
21
+ This will disable the lexer's first char optimizations.
22
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let D=zn(f.PATTERN,e.ensureOptimizations);D.length===0&&(I=!1),D.forEach(re=>{Gs(T,re,y[m])})}else e.ensureOptimizations&&Pe(`${ut} TokenType: <${f.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
23
+ This will disable the lexer's first char optimizations.
24
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),I=!1;return T},[])}),{emptyGroups:R,patternIdxToConfig:y,charCodeToPatternIdxToConfig:g,hasCustom:i,canBeOptimized:I}}function oa(s){var e,t;if(!(s instanceof RegExp)||s.flags!=="")return;let n;try{n=Ne(s)}catch{return}if(n.value.value.length!==1||n.value.value[0].value.length!==1)return;let i=n.value.value[0].value[0],r;for(;i.type==="Group";){if(i.capturing||i.quantifier!==void 0&&r!==void 0||i.value.value.length!==1||i.value.value[0].value.length!==1)return;r=(e=i.quantifier)!==null&&e!==void 0?e:r,i=i.value.value[0].value[0]}if(i.type!=="Set"||i.complement||i.quantifier!==void 0&&r!==void 0||(r=(t=i.quantifier)!==null&&t!==void 0?t:r,r?.atLeast!==1||r.atMost!==1/0||!r.greedy))return;let a=new Uint8Array(128);for(let c of i.value){let o=typeof c=="number"?c:c.from,l=typeof c=="number"?c:c.to;if(o<0||l>=a.length)return;a.fill(1,o,l+1)}return a}function Yn(s,e){let t=[],n=la(s);t=t.concat(n.errors);let i=ha(n.valid),r=i.valid;return t=t.concat(i.errors),t=t.concat(ca(r)),t=t.concat(ga(r)),t=t.concat(Aa(r,e)),t=t.concat(Sa(r)),t}function ca(s){let e=[],t=s.filter(n=>n[ke]instanceof RegExp);return e=e.concat(da(t)),e=e.concat(ma(t)),e=e.concat(Ea(t)),e=e.concat(Ta(t)),e=e.concat(pa(t)),e}function la(s){let e=s.filter(i=>!Object.hasOwn(i,ke)),t=e.map(i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:v.MISSING_PATTERN,tokenTypes:[i]})),n=s.filter(i=>!e.includes(i));return{errors:t,valid:n}}function ha(s){let e=s.filter(i=>{let r=i[ke];return!(r instanceof RegExp)&&typeof r!="function"&&!Object.hasOwn(r,"exec")&&typeof r!="string"}),t=e.map(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:v.INVALID_PATTERN,tokenTypes:[i]})),n=s.filter(i=>!e.includes(i));return{errors:t,valid:n}}var ua=/[^\\][$]/;function da(s){class e extends Ae{constructor(){super(...arguments),this.found=!1}visitEndAnchor(r){this.found=!0}}return s.filter(i=>{let r=i.PATTERN;try{let a=Ne(r),c=new e;return c.visit(a),c.found}catch{return ua.test(r.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
25
+ Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
26
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:v.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function pa(s){return s.filter(n=>n.PATTERN.test("")).map(n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:v.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var fa=/[^\\[][\^]|^\^/;function ma(s){class e extends Ae{constructor(){super(...arguments),this.found=!1}visitStartAnchor(r){this.found=!0}}return s.filter(i=>{let r=i.PATTERN;try{let a=Ne(r),c=new e;return c.visit(a),c.found}catch{return fa.test(r.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
27
+ Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
28
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:v.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Ea(s){return s.filter(n=>{let i=n[ke];return i instanceof RegExp&&(i.multiline||i.global)}).map(n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:v.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function Ta(s){let e=[],t=s.map(r=>s.reduce((a,c)=>(r.PATTERN.source===c.PATTERN.source&&!e.includes(c)&&c.PATTERN!==_.NA&&(e.push(c),a.push(c)),a),[]));return t=t.filter(Boolean),t.filter(r=>r.length>1).map(r=>{let a=r.map(o=>o.name);return{message:`The same RegExp pattern ->${r[0].PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:v.DUPLICATE_PATTERNS_FOUND,tokenTypes:r}})}function ga(s){return s.filter(n=>{if(!Object.hasOwn(n,"GROUP"))return!1;let i=n.GROUP;return i!==_.SKIPPED&&i!==_.NA&&typeof i!="string"}).map(n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:v.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function Aa(s,e){return s.filter(i=>i.PUSH_MODE!==void 0&&!e.includes(i.PUSH_MODE)).map(i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:v.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function Sa(s){let e=[],t=s.reduce((n,i,r)=>{let a=i.PATTERN;return a===_.NA||(typeof a=="string"?n.push({str:a,idx:r,tokenType:i}):a instanceof RegExp&&ya(a)&&n.push({str:a.source,idx:r,tokenType:i})),n},[]);return s.forEach((n,i)=>{t.forEach(({str:r,idx:a,tokenType:c})=>{if(i<a&&Ra(r,n.PATTERN)){let o=`Token: ->${c.name}<- can never be matched.
29
+ Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
30
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:o,type:v.UNREACHABLE_PATTERN,tokenTypes:[n,c]})}})}),e}function Ra(s,e){if(e instanceof RegExp){if(Oa(e))return!1;let t=e.exec(s);return t!==null&&t.index===0}else{if(typeof e=="function")return e(s,0,[],{});if(Object.hasOwn(e,"exec"))return e.exec(s,0,[],{});if(typeof e=="string")return e===s;throw Error("non exhaustive match")}}function ya(s){return[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(t=>s.source.indexOf(t)!==-1)===void 0}function Oa(s){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(s.source)}function Hn(s){let e=s.ignoreCase?"iy":"y";return new RegExp(`${s.source}`,e)}function qn(s,e,t){let n=[];return Object.hasOwn(s,$e)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+$e+`> property in its definition
31
+ `,type:v.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(s,jt)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+jt+`> property in its definition
32
+ `,type:v.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(s,jt)&&Object.hasOwn(s,$e)&&!Object.hasOwn(s.modes,s.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${$e}: <${s.defaultMode}>which does not exist
33
+ `,type:v.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(s,jt)&&Object.keys(s.modes).forEach(i=>{let r=s.modes[i];r.forEach((a,c)=>{a===void 0?n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${c}>
34
+ `,type:v.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(a,"LONGER_ALT")&&(Array.isArray(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT]).forEach(l=>{l!==void 0&&!r.includes(l)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${a.name}> outside of mode <${i}>
35
+ `,type:v.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),n}function Jn(s,e,t){let n=[],i=!1,a=Object.values(s.modes||{}).flat().filter(Boolean).filter(o=>o[ke]!==_.NA),c=ti(t);return e&&a.forEach(o=>{let l=ei(o,c);if(l!==!1){let u={message:Ia(o,l),type:l.issue,tokenType:o};n.push(u)}else Object.hasOwn(o,"LINE_BREAKS")?o.LINE_BREAKS===!0&&(i=!0):Gt(c,o.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
36
+ This Lexer has been defined to track line and column information,
37
+ But none of the Token Types can be identified as matching a line terminator.
38
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
39
+ for details.`,type:v.NO_LINE_BREAKS_FLAGS}),n}function Zn(s){let e=s.PATTERN;if(e instanceof RegExp)return!1;if(typeof e=="function")return!0;if(Object.hasOwn(e,"exec"))return!0;if(typeof e=="string")return!1;throw Error("non exhaustive match")}function La(s){return typeof s=="string"&&s.length===1?s.charCodeAt(0):!1}var Qn={test:function(s){let e=s.length;for(let t=this.lastIndex;t<e;t++){let n=s.charCodeAt(t);if(n===10)return this.lastIndex=t+1,!0;if(n===13)return s.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function ei(s,e){if(Object.hasOwn(s,"LINE_BREAKS"))return!1;if(s.PATTERN instanceof RegExp){try{Gt(e,s.PATTERN)}catch(t){return{issue:v.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if(typeof s.PATTERN=="string")return!1;if(Zn(s))return{issue:v.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Ia(s,e){if(e.issue===v.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
40
+ The problem is in the <${s.name}> Token Type
41
+ Root cause: ${e.errMsg}.
42
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===v.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
43
+ The problem is in the <${s.name}> Token Type
44
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function ti(s){return s.map(t=>typeof t=="string"?t.charCodeAt(0):t)}function Gs(s,e,t){s[e]===void 0?s[e]=[t]:s[e].push(t)}var Be=256,Wt=[];function he(s){return s<Be?s:Wt[s]}function Na(){if(Wt.length===0){Wt=new Array(65536);for(let s=0;s<65536;s++)Wt[s]=s>255?255+~~(s/255):s}}function pe(s,e){let t=s.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function Ge(s,e){return s.tokenTypeIdx===e.tokenTypeIdx}var si=1,ii={};function fe(s){let e=ka(s);Ca(e),va(e),ba(e),e.forEach(t=>{t.isParent=t.categoryMatches.length>0})}function ka(s){let e=[...s],t=s,n=!0;for(;n;){t=t.map(r=>r.CATEGORIES).flat().filter(Boolean);let i=t.filter(r=>!e.includes(r));e=e.concat(i),i.length===0?n=!1:t=i}return e}function Ca(s){s.forEach(e=>{js(e)||(ii[si]=e,e.tokenTypeIdx=si++),ni(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),ni(e)||(e.CATEGORIES=[]),_a(e)||(e.categoryMatches=[]),xa(e)||(e.categoryMatchesMap={})})}function ba(s){s.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push(ii[t].tokenTypeIdx)})})}function va(s){s.forEach(e=>{ri([],e)})}function ri(s,e){s.forEach(t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),e.CATEGORIES.forEach(t=>{let n=s.concat(e);n.includes(t)||ri(n,t)})}function js(s){return Object.hasOwn(s??{},"tokenTypeIdx")}function ni(s){return Object.hasOwn(s??{},"CATEGORIES")}function _a(s){return Object.hasOwn(s??{},"categoryMatches")}function xa(s){return Object.hasOwn(s??{},"categoryMatchesMap")}function ai(s){return Object.hasOwn(s??{},"tokenTypeIdx")}var Ws={buildUnableToPopLexerModeMessage(s){return`Unable to pop Lexer Mode after encountering Token ->${s.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(s,e,t,n,i,r){return`unexpected character: ->${s.charAt(e)}<- at offset: ${e}, skipped ${t} characters.`}};var v;(function(s){s[s.MISSING_PATTERN=0]="MISSING_PATTERN",s[s.INVALID_PATTERN=1]="INVALID_PATTERN",s[s.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",s[s.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",s[s.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",s[s.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",s[s.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",s[s.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",s[s.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",s[s.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",s[s.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",s[s.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",s[s.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",s[s.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",s[s.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",s[s.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",s[s.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",s[s.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(v||(v={}));var pt={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
45
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Ws,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(pt);var _=class{constructor(e,t=pt){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,r)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);let{time:c,value:o}=rt(r),l=c>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(`${a}<-- <${i}> time: ${c}ms`),this.traceInitIndent--,o}else return r()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
46
+ a boolean 2nd argument is no longer supported`);this.config=Object.assign({},pt,t);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,r=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===pt.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Qn;else if(this.config.lineTerminatorCharacters===pt.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
47
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?i={modes:{defaultMode:[...e]},defaultMode:$e}:(r=!1,i=Object.assign({},e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(qn(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Jn(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Object.entries(i.modes).forEach(([c,o])=>{i.modes[c]=o.filter(l=>l!==void 0)});let a=Object.keys(i.modes);if(Object.entries(i.modes).forEach(([c,o])=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Yn(o,a))}),this.lexerDefinitionErrors.length===0){fe(o);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=Xn(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=l.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let o=this.lexerDefinitionErrors.map(l=>l.message).join(`-----------------------
48
+ `);throw new Error(`Errors detected in definition of Lexer:
49
+ `+o)}this.lexerDefinitionWarning.forEach(c=>{it(c.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(r&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=c=>c),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=()=>{}),/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",()=>{let c=Object.entries(this.canModeBeOptimized).reduce((o,[l,d])=>(d===!1&&o.push(l),o),[]);if(t.ensureOptimizations&&c.length>0)throw Error(`Lexer Modes: < ${c.join(", ")} > cannot be optimized.
50
+ Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
51
+ Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Wn()}),this.TRACE_INIT("toFastProperties",()=>{at(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let i=this.lexerDefinitionErrors.map(r=>r.message).join(`-----------------------
52
+ `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
53
+ `+i)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,i,r,a,c,o,l,d,u,p,E,R,y,I,g,T=e,f=T.length,m=0,D=0,re=this.hasCustom?0:Math.floor(e.length/10),ge=new Array(re),Re=[],et=this.trackStartLines?1:void 0,ce=this.trackStartLines?1:void 0,we={};for(let G=0;G<this.cachedGroupKeys.length;G++)we[this.cachedGroupKeys[G]]=[];let Yr=this.trackStartLines,Is=this.config.lineTerminatorsPattern,Ns=0,ye=[],tt=[],st=[],Rn=[];Object.freeze(Rn);let nt=!1,qr=G=>{if(st.length===1&&G.tokenType.PUSH_MODE===void 0){let se=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(G);Re.push({offset:G.startOffset,line:G.startLine,column:G.startColumn,length:G.image.length,message:se})}else{st.pop();let se=st.at(-1);ye=this.patternIdxToConfig[se],tt=this.charCodeToPatternIdxToConfig[se],Ns=ye.length;let ks=this.canModeBeOptimized[se]&&this.config.safeMode===!1;tt&&ks?nt=!0:nt=!1}};function yn(G){st.push(G),tt=this.charCodeToPatternIdxToConfig[G],ye=this.patternIdxToConfig[G],Ns=ye.length;let se=this.canModeBeOptimized[G]&&this.config.safeMode===!1;tt&&se?nt=!0:nt=!1}yn.call(this,t);let te,On=this.config.recoveryEnabled;for(;m<f;){o=null,u=-1;let G=T.charCodeAt(m),se;if(nt){let K=he(G),J=tt[K];se=J!==void 0?J:Rn}else se=ye;let ks=se.length;for(n=0;n<ks;n++){te=se[n];let K=te.pattern;switch(l=null,te.matchType){case Kt:G===te.short&&(u=1,o=K);break;case dt:g=K.exec(T,m,ge,we),g!==null?(o=g[0],u=o.length,g.payload!==void 0&&(l=g.payload)):o=null;break;case zt:{let J=te.asciiClass;if(J[G]!==1){K.lastIndex=0;break}let H=m+1;for(;J[T.charCodeAt(H)]===1;)H++;u=H-m,K.lastIndex=H;break}case Vt:K.lastIndex=m,u=this.matchLength(K,e,m);break}if(u!==-1){if(c=te.longerAlt,c!==void 0){o=e.substring(m,m+u);let J=c.length;for(r=0;r<J;r++){let H=ye[c[r]],ue=H.pattern;if(d=null,H.matchType===dt?(g=ue.exec(T,m,ge,we),g!==null?(a=g[0],g.payload!==void 0&&(d=g.payload)):a=null):(ue.lastIndex=m,a=this.match(ue,e,m)),a&&a.length>o.length){o=a,u=a.length,l=d,te=H;break}}}break}}if(u!==-1){if(p=te.group,p!==void 0&&(o=o!==null?o:e.substring(m,m+u),E=te.tokenTypeIdx,R=this.createTokenInstance(o,m,E,te.tokenType,et,ce,u),this.handlePayload(R,l),p===!1?D=this.addToken(ge,D,R):we[p].push(R)),Yr===!0&&te.canLineTerminator===!0){let K=0,J,H;Is.lastIndex=0;do o=o!==null?o:e.substring(m,m+u),J=Is.test(o),J===!0&&(H=Is.lastIndex-1,K++);while(J===!0);K!==0?(et=et+K,ce=u-H,this.updateTokenEndLineColumnLocation(R,p,H,K,et,ce,u)):ce=this.computeNewColumn(ce,u)}else ce=this.computeNewColumn(ce,u);m=m+u,this.handleModes(te,qr,yn,R)}else{let K=m,J=et,H=ce,ue=On===!1;for(;ue===!1&&m<f;)for(m++,i=0;i<Ns;i++){let Cs=ye[i],bs=Cs.pattern;switch(Cs.matchType){case Kt:T.charCodeAt(m)===Cs.short&&(ue=!0);break;case dt:ue=bs.exec(T,m,ge,we)!==null;break;case zt:case Vt:bs.lastIndex=m,ue=bs.exec(e)!==null;break}if(ue===!0)break}if(y=m-K,ce=this.computeNewColumn(ce,y),I=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(T,K,y,J,H,st.at(-1)),Re.push({offset:K,line:J,column:H,length:y,message:I}),On===!1)break}}return this.hasCustom||(ge.length=D),{tokens:ge,groups:we,errors:Re}}handleModes(e,t,n,i){if(e.pop===!0){let r=e.push;t(i),r!==void 0&&n.call(this,r)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,i,r,a,c){let o,l;t!==void 0&&(o=n===c-1,l=o?-1:0,i===1&&o===!0||(e.endLine=r+l,e.endColumn=a-1+-l))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,i){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,t,n,i,r,a){return{image:e,startOffset:t,startLine:r,startColumn:a,tokenTypeIdx:n,tokenType:i}}createFullToken(e,t,n,i,r,a,c){return{image:e,startOffset:t,endOffset:t+c-1,startLine:r,endLine:r,startColumn:a,endColumn:a+c-1,tokenTypeIdx:n,tokenType:i}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return e.test(t)===!0?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return e.test(t)===!0?e.lastIndex-n:-1}};_.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";_.NA=/NOT_APPLICABLE/;function Ce(s){return Ks(s)?s.LABEL:s.name}function Ks(s){return typeof s.LABEL=="string"&&s.LABEL!==""}var Ma="parent",oi="categories",ci="label",li="group",hi="push_mode",ui="pop_mode",di="longer_alt",pi="line_breaks",fi="start_chars_hint";function A(s){return wa(s)}function wa(s){let e=s.pattern,t={};if(t.name=s.name,e!==void 0&&(t.PATTERN=e),Object.hasOwn(s,Ma))throw`The parent property is no longer supported.
54
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(s,oi)&&(t.CATEGORIES=s[oi]),fe([t]),Object.hasOwn(s,ci)&&(t.LABEL=s[ci]),Object.hasOwn(s,li)&&(t.GROUP=s[li]),Object.hasOwn(s,ui)&&(t.POP_MODE=s[ui]),Object.hasOwn(s,hi)&&(t.PUSH_MODE=s[hi]),Object.hasOwn(s,di)&&(t.LONGER_ALT=s[di]),Object.hasOwn(s,pi)&&(t.LINE_BREAKS=s[pi]),Object.hasOwn(s,fi)&&(t.START_CHARS_HINT=s[fi]),t}var Q=A({name:"EOF",pattern:_.NA});fe([Q]);function be(s,e,t,n,i,r,a,c){return{image:e,startOffset:t,endOffset:n,startLine:i,endLine:r,startColumn:a,endColumn:c,tokenTypeIdx:s.tokenTypeIdx,tokenType:s}}function ft(s,e){return pe(s,e)}var Ht={buildMismatchTokenMessage({expected:s,actual:e,previous:t,ruleName:n}){return`Expecting ${Ks(s)?`--> ${Ce(s)} <--`:`token of type --> ${s.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:s,ruleName:e}){return"Redundant input, expecting EOF but found: "+s.image},buildNoViableAltMessage({expectedPathsPerAlt:s,actual:e,previous:t,customUserDescription:n,ruleName:i}){let r="Expecting: ",c=`
55
+ but found: '`+e[0].image+"'";if(n)return r+n+c;{let u=`one of these possible Token sequences:
56
+ ${s.reduce((p,E)=>p.concat(E),[]).map(p=>`[${p.map(E=>Ce(E)).join(", ")}]`).map((p,E)=>` ${E+1}. ${p}`).join(`
57
+ `)}`;return r+u+c}},buildEarlyExitMessage({expectedIterationPaths:s,actual:e,customUserDescription:t,ruleName:n}){let i="Expecting: ",a=`
58
+ but found: '`+e[0].image+"'";if(t)return i+t+a;{let o=`expecting at least one iteration which starts with one of these possible Token sequences::
59
+ <${s.map(l=>`[${l.map(d=>Ce(d)).join(",")}]`).join(" ,")}>`;return i+o+a}}};Object.freeze(Ht);var mi={buildRuleNotFoundError(s,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
60
+ inside top level rule: ->`+s.name+"<-"}},ae={buildDuplicateFoundError(s,e){function t(d){return d instanceof O?d.terminalType.name:d instanceof k?d.nonTerminalName:""}let n=s.name,i=e[0],r=i.idx,a=Z(i),c=t(i),o=r>0,l=`->${a}${o?r:""}<- ${c?`with argument: ->${c}<-`:""}
61
+ appears more than once (${e.length} times) in the top level rule: ->${n}<-.
62
+ For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
63
+ `;return l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,`
64
+ `),l},buildNamespaceConflictError(s){return`Namespace conflict found in grammar.
65
+ The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${s.name}>.
66
+ To resolve this make sure each Terminal and Non-Terminal names are unique
67
+ This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
68
+ and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(s){let e=s.prefixPath.map(i=>Ce(i)).join(", "),t=s.alternation.idx===0?"":s.alternation.idx;return`Ambiguous alternatives: <${s.ambiguityIndices.join(" ,")}> due to common lookahead prefix
69
+ in <OR${t}> inside <${s.topLevelRule.name}> Rule,
70
+ <${e}> may appears as a prefix path in all these alternatives.
71
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
72
+ For Further details.`},buildAlternationAmbiguityError(s){let e=s.alternation.idx===0?"":s.alternation.idx,t=s.prefixPath.length===0,n=`Ambiguous Alternatives Detected: <${s.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${s.topLevelRule.name}> Rule,
73
+ `;if(t)n+=`These alternatives are all empty (match no tokens), making them indistinguishable.
74
+ Only the last alternative may be empty.
75
+ `;else{let i=s.prefixPath.map(r=>Ce(r)).join(", ");n+=`<${i}> may appears as a prefix path in all these alternatives.
76
+ `}return n+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
77
+ For Further details.`,n},buildEmptyRepetitionError(s){let e=Z(s.repetition);return s.repetition.idx!==0&&(e+=s.repetition.idx),`The repetition <${e}> within Rule <${s.topLevelRule.name}> can never consume any tokens.
78
+ This could lead to an infinite loop.`},buildTokenNameError(s){return"deprecated"},buildEmptyAlternationError(s){return`Ambiguous empty alternative: <${s.emptyChoiceIdx+1}> in <OR${s.alternation.idx}> inside <${s.topLevelRule.name}> Rule.
79
+ Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(s){return`An Alternation cannot have more than 256 alternatives:
80
+ <OR${s.alternation.idx}> inside <${s.topLevelRule.name}> Rule.
81
+ has ${s.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(s){let e=s.topLevelRule.name,t=s.leftRecursionPath.map(r=>r.name),n=`${e} --> ${t.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
82
+ rule: <${e}> can be invoked from itself (directly or indirectly)
83
+ without consuming any Tokens. The grammar path that causes this is:
84
+ ${n}
85
+ To fix this refactor your grammar to remove the left recursion.
86
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(s){return"deprecated"},buildDuplicateRuleNameError(s){let e;return s.topLevelRule instanceof X?e=s.topLevelRule.name:e=s.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${s.grammarName}<-`}};function Ei(s,e){let t=new Vs(s,e);return t.resolveRefs(),t.errors}var Vs=class extends Y{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:j.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var zs=class extends de{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Xt=class extends zs{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=t.concat(n),r=new C({definition:i});this.possibleTokTypes=Le(r),this.found=!0}}},je=class extends de{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Yt=class extends je{walkMany(e,t,n){if(e.idx===this.occurrence){let i=t.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,t,n)}},mt=class extends je{walkManySep(e,t,n){if(e.idx===this.occurrence){let i=t.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,t,n)}},qt=class extends je{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let i=t.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,t,n)}},Et=class extends je{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let i=t.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof O&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,t,n)}};function Jt(s,e,t=[]){t=[...t];let n=[],i=0;function r(c){return c.concat(s.slice(i+1))}function a(c){let o=Jt(r(c),e,t);return n.concat(o)}for(;t.length<e&&i<s.length;){let c=s[i];if(c instanceof C)return a(c.definition);if(c instanceof k)return a(c.definition);if(c instanceof b)n=a(c.definition);else if(c instanceof F){let o=c.definition.concat([new N({definition:c.definition})]);return a(o)}else if(c instanceof B){let o=[new C({definition:c.definition}),new N({definition:[new O({terminalType:c.separator})].concat(c.definition)})];return a(o)}else if(c instanceof w){let o=c.definition.concat([new N({definition:[new O({terminalType:c.separator})].concat(c.definition)})]);n=a(o)}else if(c instanceof N){let o=c.definition.concat([new N({definition:c.definition})]);n=a(o)}else{if(c instanceof U)return c.definition.forEach(o=>{o.definition.length!==0&&(n=a(o.definition))}),n;if(c instanceof O)t.push(c.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:t,suffixDef:s.slice(i)}),n}function Ti(s,e,t,n){let i="EXIT_NONE_TERMINAL",r=[i],a="EXIT_ALTERNATIVE",c=!1,o=e.length,l=o-n-1,d=[],u=[];for(u.push({idx:-1,def:s,ruleStack:[],occurrenceStack:[]});u.length!==0;){let p=u.pop();if(p===a){c&&u.at(-1).idx<=l&&u.pop();continue}let E=p.def,R=p.idx,y=p.ruleStack,I=p.occurrenceStack;if(E.length===0)continue;let g=E[0];if(g===i){let T={idx:R,def:E.slice(1),ruleStack:y.slice(0,-1),occurrenceStack:I.slice(0,-1)};u.push(T)}else if(g instanceof O)if(R<o-1){let T=R+1,f=e[T];if(t(f,g.terminalType)){let m={idx:T,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(m)}}else if(R===o-1)d.push({nextTokenType:g.terminalType,nextTokenOccurrence:g.idx,ruleStack:y,occurrenceStack:I}),c=!0;else throw Error("non exhaustive match");else if(g instanceof k){let T=[...y];T.push(g.nonTerminalName);let f=[...I];f.push(g.idx);let m={idx:R,def:g.definition.concat(r,E.slice(1)),ruleStack:T,occurrenceStack:f};u.push(m)}else if(g instanceof b){let T={idx:R,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(T),u.push(a);let f={idx:R,def:g.definition.concat(E.slice(1)),ruleStack:y,occurrenceStack:I};u.push(f)}else if(g instanceof F){let T=new N({definition:g.definition,idx:g.idx}),f=g.definition.concat([T],E.slice(1)),m={idx:R,def:f,ruleStack:y,occurrenceStack:I};u.push(m)}else if(g instanceof B){let T=new O({terminalType:g.separator}),f=new N({definition:[T].concat(g.definition),idx:g.idx}),m=g.definition.concat([f],E.slice(1)),D={idx:R,def:m,ruleStack:y,occurrenceStack:I};u.push(D)}else if(g instanceof w){let T={idx:R,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(T),u.push(a);let f=new O({terminalType:g.separator}),m=new N({definition:[f].concat(g.definition),idx:g.idx}),D=g.definition.concat([m],E.slice(1)),re={idx:R,def:D,ruleStack:y,occurrenceStack:I};u.push(re)}else if(g instanceof N){let T={idx:R,def:E.slice(1),ruleStack:y,occurrenceStack:I};u.push(T),u.push(a);let f=new N({definition:g.definition,idx:g.idx}),m=g.definition.concat([f],E.slice(1)),D={idx:R,def:m,ruleStack:y,occurrenceStack:I};u.push(D)}else if(g instanceof U)for(let T=g.definition.length-1;T>=0;T--){let f=g.definition[T],m={idx:R,def:f.definition.concat(E.slice(1)),ruleStack:y,occurrenceStack:I};u.push(m),u.push(a)}else if(g instanceof C)u.push({idx:R,def:g.definition.concat(E.slice(1)),ruleStack:y,occurrenceStack:I});else if(g instanceof X)u.push(Ua(g,R,y,I));else throw Error("non exhaustive match")}return d}function Ua(s,e,t,n){let i=[...t];i.push(s.name);let r=[...n];return r.push(1),{idx:e,def:s.definition,ruleStack:i,occurrenceStack:r}}var x;(function(s){s[s.OPTION=0]="OPTION",s[s.REPETITION=1]="REPETITION",s[s.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",s[s.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",s[s.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",s[s.ALTERNATION=5]="ALTERNATION"})(x||(x={}));function Qt(s){if(s instanceof b||s==="Option")return x.OPTION;if(s instanceof N||s==="Repetition")return x.REPETITION;if(s instanceof F||s==="RepetitionMandatory")return x.REPETITION_MANDATORY;if(s instanceof B||s==="RepetitionMandatoryWithSeparator")return x.REPETITION_MANDATORY_WITH_SEPARATOR;if(s instanceof w||s==="RepetitionWithSeparator")return x.REPETITION_WITH_SEPARATOR;if(s instanceof U||s==="Alternation")return x.ALTERNATION;throw Error("non exhaustive match")}function Ai(s,e,t,n,i,r){let a=Tt(s,e,t),c=Ii(a)?Ge:pe;return r(a,n,c,i)}function Si(s,e,t,n,i,r){let a=gt(s,e,i,t),c=Ii(a)?Ge:pe;return r(a[0],c,n)}function Ri(s,e,t,n){let i=s.length,r=s.every(a=>a.every(c=>c.length===1));if(e)return function(a){let c=a.map(o=>o.GATE);for(let o=0;o<i;o++){let l=s[o],d=l.length,u=c[o];if(!(u!==void 0&&u.call(this)===!1))e:for(let p=0;p<d;p++){let E=l[p],R=E.length;for(let y=0;y<R;y++){let I=this.LA_FAST(y+1);if(t(I,E[y])===!1)continue e}return o}}};if(r&&!n){let c=s.map(o=>o.flat()).reduce((o,l,d)=>(l.forEach(u=>{u.tokenTypeIdx in o||(o[u.tokenTypeIdx]=d),u.categoryMatches.forEach(p=>{Object.hasOwn(o,p)||(o[p]=d)})}),o),{});return function(){let o=this.LA_FAST(1);return c[o.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){let c=s[a],o=c.length;e:for(let l=0;l<o;l++){let d=c[l],u=d.length;for(let p=0;p<u;p++){let E=this.LA_FAST(p+1);if(t(E,d[p])===!1)continue e}return a}}}}function yi(s,e,t){let n=s.every(r=>r.length===1),i=s.length;if(n&&!t){let r=s.flat();if(r.length===1&&r[0].categoryMatches.length===0){let c=r[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===c}}else{let a=r.reduce((c,o,l)=>(c[o.tokenTypeIdx]=!0,o.categoryMatches.forEach(d=>{c[d]=!0}),c),[]);return function(){let c=this.LA_FAST(1);return a[c.tokenTypeIdx]===!0}}}else return function(){e:for(let r=0;r<i;r++){let a=s[r],c=a.length;for(let o=0;o<c;o++){let l=this.LA_FAST(o+1);if(e(l,a[o])===!1)continue e}return!0}return!1}}var Xs=class extends de{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=n.concat(i),!0):!1}walkOption(e,t,n){this.checkIsTarget(e,x.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,x.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,x.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,x.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,x.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}},Zt=class extends Y{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,x.OPTION)}visitRepetition(e){this.checkIsTarget(e,x.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,x.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,x.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,x.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,x.ALTERNATION)}};function gi(s){let e=new Array(s);for(let t=0;t<s;t++)e[t]=[];return e}function Hs(s){let e=[""];for(let t=0;t<s.length;t++){let n=s[t],i=[];for(let r=0;r<e.length;r++){let a=e[r];i.push(a+"_"+n.tokenTypeIdx);for(let c=0;c<n.categoryMatches.length;c++){let o="_"+n.categoryMatches[c];i.push(a+o)}}e=i}return e}function Pa(s,e,t){for(let n=0;n<s.length;n++){if(n===t)continue;let i=s[n];for(let r=0;r<e.length;r++){let a=e[r];if(i[a]===!0)return!1}}return!0}function Oi(s,e){let t=s.map(a=>Jt([a],1)),n=gi(t.length),i=t.map(a=>{let c={};return a.forEach(o=>{Hs(o.partialPath).forEach(d=>{c[d]=!0})}),c}),r=t;for(let a=1;a<=e;a++){let c=r;r=gi(c.length);for(let o=0;o<c.length;o++){let l=c[o];for(let d=0;d<l.length;d++){let u=l[d].partialPath,p=l[d].suffixDef,E=Hs(u);if(Pa(i,E,o)||p.length===0||u.length===e){let y=n[o];if(es(y,u)===!1){y.push(u);for(let I=0;I<E.length;I++){let g=E[I];i[o][g]=!0}}}else{let y=Jt(p,a+1,u);r[o]=r[o].concat(y),y.forEach(I=>{Hs(I.partialPath).forEach(T=>{i[o][T]=!0})})}}}}return n}function Tt(s,e,t,n){let i=new Zt(s,x.ALTERNATION,n);return e.accept(i),Oi(i.result,t)}function gt(s,e,t,n){let i=new Zt(s,t);e.accept(i);let r=i.result,c=new Xs(e,s,t).startWalking(),o=new C({definition:r}),l=new C({definition:c});return Oi([o,l],n)}function es(s,e){e:for(let t=0;t<s.length;t++){let n=s[t];if(n.length===e.length){for(let i=0;i<n.length;i++){let r=e[i],a=n[i];if((r===a||a.categoryMatchesMap[r.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function Li(s,e){return s.length<e.length&&s.every((t,n)=>{let i=e[n];return t===i||i.categoryMatchesMap[t.tokenTypeIdx]})}function Ii(s){return s.every(e=>e.every(t=>t.every(n=>n.categoryMatches.length===0)))}function Ni(s){return s.lookaheadStrategy.validate({rules:s.rules,tokenTypes:s.tokenTypes,grammarName:s.grammarName}).map(t=>Object.assign({type:j.CUSTOM_LOOKAHEAD_VALIDATION},t))}function ki(s,e,t,n){let i=s.flatMap(o=>Da(o,t)),r=Wa(s,e,t),a=s.flatMap(o=>$a(o,t)),c=s.flatMap(o=>Ba(o,s,n,t));return i.concat(r,a,c)}function Da(s,e){let t=new Ys;s.accept(t);let n=t.allProductions,i=Object.groupBy(n,Fa),r=Object.fromEntries(Object.entries(i).filter(([c,o])=>o.length>1));return Object.values(r).map(c=>{let o=c[0],l=e.buildDuplicateFoundError(s,c),d=Z(o),u={message:l,type:j.DUPLICATE_PRODUCTIONS,ruleName:s.name,dslName:d,occurrence:o.idx},p=Ci(o);return p&&(u.parameter=p),u})}function Fa(s){return`${Z(s)}_#_${s.idx}_#_${Ci(s)}`}function Ci(s){return s instanceof O?s.terminalType.name:s instanceof k?s.nonTerminalName:""}var Ys=class extends Y{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 Ba(s,e,t,n){let i=[];if(e.reduce((a,c)=>c.name===s.name?a+1:a,0)>1){let a=n.buildDuplicateRuleNameError({topLevelRule:s,grammarName:t});i.push({message:a,type:j.DUPLICATE_RULE_NAME,ruleName:s.name})}return i}function bi(s,e,t){let n=[],i;return e.includes(s)||(i=`Invalid rule override, rule: ->${s}<- cannot be overridden in the grammar: ->${t}<-as it is not defined in any of the super grammars `,n.push({message:i,type:j.INVALID_RULE_OVERRIDE,ruleName:s})),n}function Js(s,e,t,n=[]){let i=[],r=ts(e.definition);if(r.length===0)return[];{let a=s.name;r.includes(s)&&i.push({message:t.buildLeftRecursionError({topLevelRule:s,leftRecursionPath:n}),type:j.LEFT_RECURSION,ruleName:a});let o=n.concat([s]),d=r.filter(u=>!o.includes(u)).flatMap(u=>{let p=[...n];return p.push(u),Js(s,u,t,p)});return i.concat(d)}}function ts(s){let e=[];if(s.length===0)return e;let t=s[0];if(t instanceof k)e.push(t.referencedRule);else if(t instanceof C||t instanceof b||t instanceof F||t instanceof B||t instanceof w||t instanceof N)e=e.concat(ts(t.definition));else if(t instanceof U)e=t.definition.map(r=>ts(r.definition)).flat();else if(!(t instanceof O))throw Error("non exhaustive match");let n=Oe(t),i=s.length>1;if(n&&i){let r=s.slice(1);return e.concat(ts(r))}else return e}var At=class extends Y{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function vi(s,e){let t=new At;return s.accept(t),t.alternations.flatMap(r=>r.definition.slice(0,-1).flatMap((c,o)=>Ti([c],[],pe,1).length===0?[{message:e.buildEmptyAlternationError({topLevelRule:s,alternation:r,emptyChoiceIdx:o}),type:j.NONE_LAST_EMPTY_ALT,ruleName:s.name,occurrence:r.idx,alternative:o+1}]:[]))}function _i(s,e,t){let n=new At;s.accept(n);let i=n.alternations;return i=i.filter(a=>a.ignoreAmbiguities!==!0),i.flatMap(a=>{let c=a.idx,o=a.maxLookahead||e,l=Tt(c,s,o,a),d=Ga(l,a,s,t),u=ja(l,a,s,t);return d.concat(u)})}var qs=class extends Y{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 $a(s,e){let t=new At;return s.accept(t),t.alternations.flatMap(r=>r.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:s,alternation:r}),type:j.TOO_MANY_ALTS,ruleName:s.name,occurrence:r.idx}]:[])}function xi(s,e,t){let n=[];return s.forEach(i=>{let r=new qs;i.accept(r),r.allProductions.forEach(c=>{let o=Qt(c),l=c.maxLookahead||e,d=c.idx;if(gt(d,i,o,l)[0].flat().length===0){let E=t.buildEmptyRepetitionError({topLevelRule:i,repetition:c});n.push({message:E,type:j.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function Ga(s,e,t,n){let i=[];return s.reduce((c,o,l)=>(e.definition[l].ignoreAmbiguities===!0||o.forEach(d=>{let u=[l];s.forEach((p,E)=>{l!==E&&es(p,d)&&e.definition[E].ignoreAmbiguities!==!0&&u.push(E)}),u.length>1&&!es(i,d)&&(i.push(d),c.push({alts:u,path:d}))}),c),[]).map(c=>{let o=c.alts.map(d=>d+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:o,prefixPath:c.path}),type:j.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:c.alts}})}function ja(s,e,t,n){let i=s.reduce((a,c,o)=>{let l=c.map(d=>({idx:o,path:d}));return a.concat(l)},[]);return i.flatMap(a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];let o=a.idx,l=a.path;return i.filter(p=>e.definition[p.idx].ignoreAmbiguities!==!0&&p.idx<o&&Li(p.path,l)).map(p=>{let E=[p.idx+1,o+1],R=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:E,prefixPath:p.path}),type:j.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:R,alternatives:E}})})}function Wa(s,e,t){let n=[],i=e.map(r=>r.name);return s.forEach(r=>{let a=r.name;if(i.includes(a)){let c=t.buildNamespaceConflictError(r);n.push({message:c,type:j.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}function Mi(s){let e=Object.assign({errMsgProvider:mi},s),t={};return s.rules.forEach(n=>{t[n.name]=n}),Ei(t,e.errMsgProvider)}function wi(s){var e;let t=(e=s.errMsgProvider)!==null&&e!==void 0?e:ae;return ki(s.rules,s.tokenTypes,t,s.grammarName)}var Ui="MismatchedTokenException",Pi="NoViableAltException",Di="EarlyExitException",Fi="NotAllInputParsedException",Bi=[Ui,Pi,Di,Fi];Object.freeze(Bi);function Se(s){return Bi.includes(s.name)}var We=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},ve=class extends We{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Ui}},St=class extends We{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Pi}},Rt=class extends We{constructor(e,t){super(e,t),this.name=Fi}},yt=class extends We{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=Di}};var Zs={},en="InRuleRecoveryException",Qs=class extends Error{constructor(e){super(e),this.name=en}},ss=class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,"recoveryEnabled")?e.recoveryEnabled:q.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Ka)}getTokenToInsert(e){let t=be(e,"",-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,i){let r=this.findReSyncTokenType(),a=this.exportLexerState(),c=[],o=!1,l=this.LA_FAST(1),d=this.LA_FAST(1),u=()=>{let p=this.LA(0),E=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:p,ruleName:this.getCurrRuleFullName()}),R=new ve(E,l,this.LA(0));R.resyncedTokens=c.slice(0,-1),this.SAVE_ERROR(R)};for(;!o;)if(this.tokenMatcher(d,i)){u();return}else if(n.call(this)){u(),e.apply(this,t);return}else this.tokenMatcher(d,r)?o=!0:(d=this.SKIP_TOKEN(),this.addToResyncTokens(d,c));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,n){return!(n===!1||this.tokenMatcher(this.LA_FAST(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0],i=this.getGAstProductions()[t];return new Xt(i,e).startWalking()}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Qs("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||t.length===0)return!1;let n=this.LA_FAST(1);return t.find(r=>this.tokenMatcher(n,r))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),n=2;for(;;){let i=e.find(r=>ft(t,r));if(i!==void 0)return i;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return Zs;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,n=this.RULE_STACK_IDX+1,i=new Array(n);for(let r=0;r<n;r++)r===0?i[r]=Zs:i[r]={ruleName:this.shortRuleNameToFullName(e[r]),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])};return i}flattenFollowSet(){return this.buildFullFollowKeyStack().map(t=>this.getFollowSetFromFollowKey(t)).flat()}getFollowSetFromFollowKey(e){if(e===Zs)return[Q];let t=e.ruleName+e.idxInCallingRule+Pt+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,Q)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA_FAST(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,n,i,r,a,c){}getCurrentGrammarPath(e,t){let n=this.getHumanReadableRuleStack(),i=this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=new Array(e);for(let n=0;n<e;n++)t[n]=this.shortRuleNameToFullName(this.RULE_STACK[n]);return t}};function Ka(s,e,t,n,i,r,a){var c,o,l;let d=n|i,u=(c=(o=this.firstAfterRepMap)[l=this.currRuleShortName])!==null&&c!==void 0?c:o[l]=[],p=u[d];if(p===void 0){let I=this.getCurrRuleFullName(),g=this.getGAstProductions()[I];p=new r(g,i).startWalking(),u[d]=p}let E=p.token,R=p.occurrence,y=p.isEndOfRule;this.RULE_STACK_IDX===0&&y&&E===void 0&&(E=Q,R=1),!(E===void 0||R===void 0)&&this.shouldInRepetitionRecoveryBeTried(E,R,a)&&this.tryInRepetitionRecovery(s,e,t,E)}var Ot=class{constructor(e){var t;this.maxLookahead=(t=e?.maxLookahead)!==null&&t!==void 0?t:q.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(t.length===0){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),r=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...i,...r]}return t}validateNoLeftRecursion(e){return e.flatMap(t=>Js(t,t,ae))}validateEmptyOrAlternatives(e){return e.flatMap(t=>vi(t,ae))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(n=>_i(n,t,ae))}validateSomeNonEmptyLookaheadPath(e,t){return xi(e,t,ae)}buildLookaheadForAlternation(e){return Ai(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Ri)}buildLookaheadForOptional(e){return Si(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Qt(e.prodType),yi)}};var is=class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:q.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,"maxLookahead")?e.maxLookahead:q.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,"lookaheadStrategy")?e.lookaheadStrategy:new Ot({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:r,repetitionMandatory:a,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:o}=Va(t);n.forEach(l=>{let d=l.idx===0?"":l.idx;this.TRACE_INIT(`${Z(l)}${d}`,()=>{let u=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:l.idx,rule:t,maxLookahead:l.maxLookahead||this.maxLookahead,hasPredicates:l.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[t.name],256|l.idx,u)})}),i.forEach(l=>{this.computeLookaheadFunc(t,l.idx,768,"Repetition",l.maxLookahead,Z(l))}),r.forEach(l=>{this.computeLookaheadFunc(t,l.idx,512,"Option",l.maxLookahead,Z(l))}),a.forEach(l=>{this.computeLookaheadFunc(t,l.idx,1024,"RepetitionMandatory",l.maxLookahead,Z(l))}),c.forEach(l=>{this.computeLookaheadFunc(t,l.idx,1536,"RepetitionMandatoryWithSeparator",l.maxLookahead,Z(l))}),o.forEach(l=>{this.computeLookaheadFunc(t,l.idx,1280,"RepetitionWithSeparator",l.maxLookahead,Z(l))})})})}computeLookaheadFunc(e,t,n,i,r,a){this.TRACE_INIT(`${a}${t===0?"":t}`,()=>{let c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:r||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i});this.setLaFuncCache(this.fullRuleNameToShort[e.name],n|t,c)})}setLaFuncCache(e,t,n){let i=this.lookAheadFuncsCache[e];i===void 0&&(i=[],this.lookAheadFuncsCache[e]=i),i[t]=n}},tn=class extends Y{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)}},ns=new tn;function Va(s){ns.reset(),s.accept(ns);let e=ns.dslMethods;return ns.reset(),e}function rn(s,e){s.startOffset===-1?(s.startOffset=e.startOffset,s.endOffset=e.endOffset):s.endOffset<e.endOffset&&(s.endOffset=e.endOffset)}function an(s,e){s.startOffset===-1?(s.startOffset=e.startOffset,s.startColumn=e.startColumn,s.startLine=e.startLine,s.endOffset=e.endOffset,s.endColumn=e.endColumn,s.endLine=e.endLine):s.endOffset<e.endOffset&&(s.endOffset=e.endOffset,s.endColumn=e.endColumn,s.endLine=e.endLine)}function $i(s,e,t){s.children[t]===void 0?s.children[t]=[e]:s.children[t].push(e)}function Gi(s,e,t){s.children[e]===void 0?s.children[e]=[t]:s.children[e].push(t)}var za="name";function on(s,e){Object.defineProperty(s,za,{enumerable:!1,configurable:!0,writable:!1,value:e})}function Ha(s,e){let t=Object.keys(s),n=t.length;for(let i=0;i<n;i++){let r=t[i],a=s[r],c=a.length;for(let o=0;o<c;o++){let l=a[o];l.tokenTypeIdx===void 0&&this[l.name](l.children,e)}}}function ji(s,e){let t=function(){};on(t,s+"BaseSemantics");let n={visit:function(i,r){if(Array.isArray(i)&&(i=i[0]),i!==void 0)return this[i.name](i.children,r)},validateVisitor:function(){let i=Xa(this,e);if(i.length!==0){let r=i.map(a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
87
+ ${r.join(`
88
+
89
+ `).replace(/\n/g,`
90
+ `)}`)}}};return t.prototype=n,t.prototype.constructor=t,t._RULE_NAMES=e,t}function Wi(s,e,t){let n=function(){};on(n,s+"BaseSemanticsWithDefaults");let i=Object.create(t.prototype);return e.forEach(r=>{i[r]=Ha}),n.prototype=i,n.prototype.constructor=n,n}var cn;(function(s){s[s.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",s[s.MISSING_METHOD=1]="MISSING_METHOD"})(cn||(cn={}));function Xa(s,e){return Ya(s,e)}function Ya(s,e){return e.filter(i=>typeof s[i]!="function").map(i=>({msg:`Missing visitor method: <${i}> on ${s.constructor.name} CST Visitor.`,type:cn.MISSING_METHOD,methodName:i})).filter(Boolean)}var cs=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,"nodeLocationTracking")?e.nodeLocationTracking:q.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=an,this.setNodeLocationFromNode=an,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=rn,this.setNodeLocationFromNode=rn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=-1,n.startLine=-1,n.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=-1}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];$i(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];Gi(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}get currCSTNode(){let e=this;return e.CST_STACK[e.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let e=ji(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=Wi(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}};var ls=class{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.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):me}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?me:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}};var hs=class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Ke){if(this.definedRulesNames.includes(e)){let a={message:ae.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:j.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);let i=this.defineRule(e,t,n);return this[e]=i,i}OVERRIDE_RULE(e,t,n=Ke){let i=bi(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let r=this.defineRule(e,t,n);return this[e]=r,r}BACKTRACK(e,t){var n;let i=(n=e.coreRule)!==null&&n!==void 0?n:e;return function(){this.isBackTrackingStack.push(1);let r=this.saveRecogState();try{return i.apply(this,t),!0}catch(a){if(Se(a))return!1;throw a}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Ut(Object.values(this.gastProductionsCache))}};var us=class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=Ge,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
91
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
92
+ For Further details.`);if(Array.isArray(e)){if(e.length===0)throw Error(`A Token Vocabulary cannot be empty.
93
+ Note that the first argument for the parser constructor
94
+ 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.
95
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
96
+ For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((r,a)=>(r[a.name]=a,r),{});else if(Object.hasOwn(e,"modes")&&Object.values(e.modes).flat().every(ai)){let r=Object.values(e.modes).flat(),a=[...new Set(r)];this.tokensMap=a.reduce((c,o)=>(c[o.name]=o,c),{})}else if(typeof e=="object"&&e!==null)this.tokensMap=Object.assign({},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=Q;let i=(Object.hasOwn(e,"modes")?Object.values(e.modes).flat():Object.values(e)).every(r=>{var a;return((a=r.categoryMatches)===null||a===void 0?void 0:a.length)==0});this.tokenMatcher=i?Ge:pe,fe(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
97
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=Object.hasOwn(n,"resyncEnabled")?n.resyncEnabled:Ke.resyncEnabled,r=Object.hasOwn(n,"recoveryValueFunc")?n.recoveryValueFunc:Ke.recoveryValueFunc,a=this.ruleShortNameIdx++;this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let c;return this.outputCst===!0?c=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,u);let p=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(p),p}catch(p){return this.invokeRuleCatch(p,i,r)}finally{this.ruleFinallyStateUpdate()}}:c=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,u)}catch(p){return this.invokeRuleCatch(p,i,r)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...u){this.onBeforeParse(e);try{return c.apply(this,u)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:c})}invokeRuleCatch(e,t,n){let i=this.RULE_STACK_IDX===0,r=t&&!this.isBackTracking()&&this.recoveryEnabled;if(Se(e)){let a=e;if(r){let c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))if(a.resyncedTokens=this.reSyncTo(c),this.outputCst){let o=this.CST_STACK[this.CST_STACK.length-1];return o.recoveredNode=!0,o}else return n(e);else{if(this.outputCst){let o=this.CST_STACK[this.CST_STACK.length-1];o.recoveredNode=!0,a.partialCstResult=o}throw a}}else{if(i)return this.moveToTerminatedState(),n(e);throw a}}else throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let i=this.currRuleLookaheadFuncs[n],r;if(typeof e!="function"){r=e.DEF;let a=e.GATE;if(a!==void 0){let c=i;i=()=>a.call(this)&&c.call(this)}}else r=e;if(i.call(this)===!0)return r.call(this)}atLeastOneInternal(e,t){let n=1024|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let i=this.currRuleLookaheadFuncs[n],r;if(typeof t!="function"){r=t.DEF;let a=t.GATE;if(a!==void 0){let c=i;i=()=>a.call(this)&&c.call(this)}}else r=t;if(i.call(this)===!0){let a=this.doSingleRepetition(r);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(r)}else throw this.raiseEarlyExitException(e,x.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,1024,e,qt)}atLeastOneSepFirstInternal(e,t){let n=1536|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let i=t.DEF,r=t.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){i.call(this);let c=()=>this.tokenMatcher(this.LA_FAST(1),r);for(;this.tokenMatcher(this.LA_FAST(1),r)===!0;)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,c,i,Et],c,1536,e,Et)}else throw this.raiseEarlyExitException(e,x.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let i=this.currRuleLookaheadFuncs[n],r;if(typeof t!="function"){r=t.DEF;let c=t.GATE;if(c!==void 0){let o=i;i=()=>c.call(this)&&o.call(this)}}else r=t;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Yt,a)}manySepFirstInternal(e,t){let n=1280|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let i=t.DEF,r=t.SEP;if(this.currRuleLookaheadFuncs[n].call(this)===!0){i.call(this);let c=()=>this.tokenMatcher(this.LA_FAST(1),r);for(;this.tokenMatcher(this.LA_FAST(1),r)===!0;)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,c,i,mt],c,1280,e,mt)}}repetitionSepSecondInternal(e,t,n,i,r){for(;n();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,i,r],n,1536,e,r)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,i=Array.isArray(e)?e:e.DEF,a=this.currRuleLookaheadFuncs[n].call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let i;try{let r=n!==void 0?n.ARGS:void 0;return this.subruleIdx=t,i=e.coreRule.apply(this,r),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(r){throw this.subruleInternalError(r,n,e.ruleName)}}subruleInternalError(e,t,n){throw Se(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let i;try{let r=this.LA_FAST(1);this.tokenMatcher(r,e)===!0?(this.consumeToken(),i=r):this.consumeInternalError(e,r,n)}catch(r){i=this.consumeInternalRecovery(e,t,r)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,t,n){let i,r=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:r,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new ve(i,t,r))}consumeInternalRecovery(e,t,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(r){throw r.name===en?n:r}}else throw n}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let n=0;n<t.length;n++)this.RULE_STACK[n]=t[n];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Q)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let t=0;t<this.maxLookahead+1;t++)this.tokVector.push(me)}onAfterParse(e){if(this.isAtEndOfInput()===!1){let t=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:t,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Rt(n,t))}for(;this.tokVector.at(-1)===me;)this.tokVector.pop()}};var ds=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,"errorMessageProvider")?e.errorMessageProvider:q.errorMessageProvider}SAVE_ERROR(e){if(Se(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let i=this.getCurrRuleFullName(),r=this.getGAstProductions()[i],c=gt(e,r,t,this.maxLookahead)[0],o=[];for(let d=1;d<=this.maxLookahead;d++)o.push(this.LA(d));let l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:c,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new yt(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],r=Tt(e,i,this.maxLookahead),a=[];for(let l=1;l<=this.maxLookahead;l++)a.push(this.LA(l));let c=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:a,previous:c,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new St(o,this.LA(1),c))}};var ms={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ms);var Ki=!0,Vi=255,Hi=A({name:"RECORDING_PHASE_TOKEN",pattern:_.NA});fe([Hi]);var Xi=be(Hi,`This IToken indicates the Parser is in Recording Phase
98
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Xi);var qa={name:`This CSTNode indicates the Parser is in Recording Phase
99
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},ps=class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${t}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${t}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${t}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${t}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${t}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${t}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${t}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return me}topLevelRuleRecord(e,t){try{let n=new X({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
100
+ This error was thrown during the "grammar recording phase" For more info see:
101
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,t){return It.call(this,b,e,t)}atLeastOneInternalRecord(e,t){It.call(this,F,t,e)}atLeastOneSepFirstInternalRecord(e,t){It.call(this,B,t,e,Ki)}manyInternalRecord(e,t){It.call(this,N,t,e)}manySepFirstInternalRecord(e,t){It.call(this,w,t,e,Ki)}orInternalRecord(e,t){return Ja.call(this,e,t)}subruleInternalRecord(e,t,n){if(fs(t),!e||!Object.hasOwn(e,"ruleName")){let c=new Error(`<SUBRULE${zi(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
102
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw c.KNOWN_RECORDER_ERROR=!0,c}let i=this.recordingProdStack.at(-1),r=e.ruleName,a=new k({idx:t,nonTerminalName:r,label:n?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?qa:ms}consumeInternalRecord(e,t,n){if(fs(t),!js(e)){let a=new Error(`<CONSUME${zi(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
103
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=this.recordingProdStack.at(-1),r=new O({idx:t,terminalType:e,label:n?.LABEL});return i.definition.push(r),Xi}};function It(s,e,t,n=!1){fs(t);let i=this.recordingProdStack.at(-1),r=typeof e=="function"?e:e.DEF,a=new s({definition:[],idx:t});return n&&(a.separator=e.SEP),Object.hasOwn(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),r.call(this),i.definition.push(a),this.recordingProdStack.pop(),ms}function Ja(s,e){fs(e);let t=this.recordingProdStack.at(-1),n=Array.isArray(s)===!1,i=n===!1?s:s.DEF,r=new U({definition:[],idx:e,ignoreAmbiguities:n&&s.IGNORE_AMBIGUITIES===!0});Object.hasOwn(s,"MAX_LOOKAHEAD")&&(r.maxLookahead=s.MAX_LOOKAHEAD);let a=i.some(c=>typeof c.GATE=="function");return r.hasPredicates=a,t.definition.push(r),i.forEach(c=>{let o=new C({definition:[]});r.definition.push(o),Object.hasOwn(c,"IGNORE_AMBIGUITIES")?o.ignoreAmbiguities=c.IGNORE_AMBIGUITIES:Object.hasOwn(c,"GATE")&&(o.ignoreAmbiguities=!0),this.recordingProdStack.push(o),c.ALT.call(this),this.recordingProdStack.pop()}),ms}function zi(s){return s===0?"":`${s}`}function fs(s){if(s<0||s>Vi){let e=new Error(`Invalid DSL Method idx value: <${s}>
104
+ Idx value must be a none negative value smaller than ${Vi+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var Es=class{initPerformanceTracer(e){if(Object.hasOwn(e,"traceInitPerf")){let t=e.traceInitPerf,n=typeof t=="number";this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=q.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:i,value:r}=rt(t),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,r}else return t()}};function Yi(s,e){e.forEach(t=>{let n=t.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let r=Object.getOwnPropertyDescriptor(n,i);r&&(r.get||r.set)?Object.defineProperty(s.prototype,i,r):s.prototype[i]=t.prototype[i]})})}var me=be(Q,"",-1,-1,-1,-1,-1,-1);Object.freeze(me);var q=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Ht,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ke=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),j;(function(s){s[s.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",s[s.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",s[s.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",s[s.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",s[s.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",s[s.LEFT_RECURSION=5]="LEFT_RECURSION",s[s.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",s[s.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",s[s.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",s[s.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",s[s.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",s[s.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",s[s.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",s[s.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(j||(j={}));var Nt=class s{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;let t=this.className;this.TRACE_INIT("toFastProps",()=>{at(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(i=>{let a=this[i].originalGrammarAction,c;this.TRACE_INIT(`${i} Rule`,()=>{c=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=c})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=Mi({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(n.length===0&&this.skipValidations===!1){let i=wi({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:ae,grammarName:t}),r=Ni({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(i,r)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=jn(Object.values(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,r;(r=(i=this.lookaheadStrategy).initialize)===null||r===void 0||r.call(i,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!s.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw e=this.definitionErrors.map(i=>i.message),new Error(`Parser Definition Errors detected:
105
+ ${e.join(`
106
+ -------------------------------
107
+ `)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initGastRecorder(t),n.initPerformanceTracer(t),Object.hasOwn(t,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
108
+ Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
109
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
110
+ For further details.`);this.skipValidations=Object.hasOwn(t,"skipValidations")?t.skipValidations:q.skipValidations}};Nt.DEFER_DEFINITION_ERRORS_HANDLING=!1;Yi(Nt,[ss,is,cs,ls,us,hs,ds,ps,Es]);var kt=class extends Nt{constructor(e,t=q){let n=Object.assign({},t);n.outputCst=!0,super(e,n)}};var ze=h(s=>s!==void 0&&s>=0,"isKnownLocation");function ir(s,e){let t=s.lexer.tokenize(e);if(t.errors.length>0){let i=t.errors[0],r=ze(i.offset)?i.offset:e.length,a=r+(ze(i.length)?i.length:0);throw new Error(`Error lexing ${s.diagramType} diagram: ${i.message} at line ${i.line??1}, column ${i.column??1} [${r},${a})`)}s.parser.input=t.tokens;let n=s.entry();if(s.parser.errors.length>0)throw new Error(`Error parsing ${s.diagramType} diagram: ${s.parser.errors[0].message}`);s.visit(n)}h(ir,"runChevrotainParse");var M={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},Qa="LR",eo=In.usecase,En=h(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:Qa,relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(eo)}),"createModel"),to=h(s=>{if(!(s.actors instanceof Map)||!(s.useCases instanceof Map)||!(s.systemBoundaries instanceof Map)||!Array.isArray(s.relationships)||!(s.notes instanceof Map)||!(s.jsonNodes instanceof Map)||!(s.classDefs instanceof Map)||!(s.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(s.direction)||!Number.isSafeInteger(s.relationshipCounter)||s.relationshipCounter<0||!Number.isSafeInteger(s.noteCounter)||s.noteCounter<0||typeof s.accTitle!="string"||typeof s.accDescription!="string"||!s.config)throw new Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),L=En(),so=h(()=>structuredClone(L.config),"getConfig"),no=h(()=>L.ast,"getAST"),io=h(s=>{let e=structuredClone(s);to(e);let t=vs(),n=_s();try{Mt(e.accTitle),wt(e.accDescription),L=e}catch(i){throw Mt(t),wt(n),i}},"commit"),ro=h(()=>{L=En(),Cn()},"clear"),ao=h(()=>L.actors,"getActors"),oo=h(s=>L.actors.get(s),"getActor"),co=h(()=>L.useCases,"getUseCases"),lo=h(s=>L.useCases.get(s),"getUseCase"),ho=h(()=>L.systemBoundaries,"getSystemBoundaries"),uo=h(s=>L.systemBoundaries.get(s),"getSystemBoundary"),po=h(()=>L.relationships,"getRelationships"),fo=h(()=>L.notes,"getNotes"),mo=h(s=>L.notes.get(s),"getNote"),Eo=h(()=>L.jsonNodes,"getJsonNodes"),To=h(s=>L.jsonNodes.get(s),"getJsonNode"),go=h(()=>L.classDefs,"getClassDefs"),Ao=h(s=>L.classDefs.get(s),"getClassDef"),rr=h(()=>L.direction,"getDirection"),_e=h(s=>{let e=new Map;for(let t of["default",...s]){let n=L.classDefs.get(t);if(n)for(let i of n.styles){let r=i.trim(),a=r.indexOf(":"),c=(a===-1?r:r.slice(0,a)).trim();c&&e.set(c,r)}}return[...e.values()]},"getCompiledStyles"),So=h(s=>s.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),qi=h(s=>typeof s=="string"?s:s===null?"null":String(s),"displayJsonScalar"),Ro=h((s,e,t=n=>n)=>{let n=[],i=h((a,c,o)=>{n.push({key:t(a),accessibleKey:t(c),value:t(o)})},"append"),r=h((a,c,o)=>{if(Array.isArray(a)){if(a.length===0){i(c,c,"[]");return}if(a.every(d=>d===null||["string","number","boolean"].includes(typeof d))){for(let[d,u]of a.entries())i(d===0?c:"",c,qi(u));return}for(let[d,u]of a.entries())r(u,`${c}[${d}]`,`${o}/${d}`);return}if(a!==null&&typeof a=="object"){let l=a,d=e[o]??Object.keys(l);if(d.length===0){i(c,c,"{}");return}for(let u of d){let p=c?`${c}.${u}`:u;r(l[u],p,`${o}/${So(u)}`)}return}i(c,c,qi(a))},"visit");return r(s,"",""),n},"flattenJsonRows"),yo=h(s=>{switch(s.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),Oo=h(s=>s.shape==="ellipse"?s.business?"usecaseBusiness":"usecaseEllipse":s.shape,"useCaseShape"),Lo=h(s=>{switch(s){case M.SOLID_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case M.BACK_ARROW:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case M.CIRCLE_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case M.CROSS_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case M.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case M.CROSS_ARROW_REVERSED:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case M.LINE_SOLID:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),Io=h(s=>{switch(s.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:`\xAB${s.type}\xBB`,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...Lo(s.arrowType),pattern:"solid",...s.label?{label:s.label}:{},...s.labelType?{labelType:s.labelType}:{}}}},"relationshipVisuals"),No=h(s=>s.animate||s.animation?[`edge-animation-${s.animation??"fast"}`]:[],"animationClasses"),Ct=h((...s)=>s.filter(e=>!!e).join(" "),"classNames"),ko=h(()=>{let s=xs(),e={...L.config,...s.usecase},t=h(o=>kn(o,s),"sanitize"),n=h(o=>t(L.actors.get(o)?.label??L.useCases.get(o)?.label??L.jsonNodes.get(o)?.id??L.notes.get(o)?.label??o),"endpointLabel"),i=[],r=[],a=0,c=0;for(let o of L.actors.values())i.push({id:o.id,label:t(o.label),labelType:o.labelType,shape:yo(o),isGroup:!1,padding:10,look:s.look,colorIndex:a++,cssClasses:Ct("default","usecase-actor",`usecase-actor-${o.type}`,o.business&&"usecase-business",...o.classes),cssStyles:[...o.styles],cssCompiledStyles:_e(o.classes),actorType:o.type,business:o.business,...o.icon?{icon:o.icon}:{},...o.stereotype?{stereotype:t(o.stereotype)}:{},...o.parentId?{parentId:o.parentId}:{}});for(let o of L.useCases.values())i.push({id:o.id,label:t(o.label),labelType:o.labelType,shape:Oo(o),isGroup:!1,padding:o.shape==="ellipse"?20:10,look:s.look,colorIndex:a++,cssClasses:Ct("default","usecase-element",`usecase-${o.shape}`,o.business&&"usecase-business",...o.classes),cssStyles:[...o.styles],cssCompiledStyles:_e(o.classes),business:o.business,...o.stereotype?{stereotype:t(o.stereotype)}:{},...o.parentId?{parentId:o.parentId}:{}});for(let o of L.notes.values())i.push({id:o.id,label:t(o.label),labelType:o.labelType,shape:"note",isGroup:!1,padding:10,look:s.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:_e([]),noteTarget:o.target,noteTargetLabel:t(L.actors.get(o.target)?.label??L.useCases.get(o.target)?.label??L.jsonNodes.get(o.target)?.id??o.target)});for(let o of L.jsonNodes.values())i.push({id:o.id,label:t(o.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:s.look,cssClasses:Ct("default","usecase-json-table",...o.classes),cssStyles:[...o.styles],cssCompiledStyles:_e(o.classes),jsonRows:Ro(o.value,o.propertyOrder,t)});for(let o of L.systemBoundaries.values())i.push({id:o.id,label:t(o.label),labelType:o.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:s.look,colorIndex:c++,cssClasses:Ct("default","system-boundary",`system-boundary-${o.type}`,...o.classes),cssStyles:[...o.styles],cssCompiledStyles:_e(o.classes),boundaryType:o.type});for(let o of L.relationships){let{label:l,...d}=Io(o);r.push({id:o.id,start:o.source,end:o.target,source:o.source,target:o.target,sourceLabel:n(o.source),targetLabel:n(o.target),type:"edge",relationshipType:o.type,internal:!1,...d,...l!==void 0?{label:t(l)}:{},labelpos:"c",classes:Ct("default","relationship",`relationship-${o.type}`,...o.classes,...No(o)),style:[...o.styles],cssCompiledStyles:_e(o.classes),animate:o.animate,...o.animation?{animation:o.animation}:{},look:s.look,thickness:"normal",minlen:o.minlen,isUserDefinedId:o.explicitId})}for(let o of L.notes.values())r.push({id:`${o.id}-edge`,start:o.id,end:o.target,source:o.id,target:o.target,type:"edge",relationshipType:"note",sourceLabel:n(o.id),targetLabel:n(o.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:_e([]),animate:!1,look:s.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let o of i)o.wrappingWidth??=e.wrappingWidth,!o.isGroup&&!o.shape.startsWith("usecaseActor")&&(o.minWidth??=e.minNodeWidth),(o.shape==="usecaseEllipse"||o.shape==="usecaseBusiness")&&(o.spreadPorts=!0);return{nodes:i,edges:r,config:s,type:"usecase",layoutAlgorithm:"dagre",direction:rr(),nodeSpacing:e.nodeSpacing,rankSpacing:e.rankSpacing,actorFontSize:e.actorFontSize,actorFontFamily:e.actorFontFamily,actorFontWeight:e.actorFontWeight,usecaseFontSize:e.usecaseFontSize,usecaseFontFamily:e.usecaseFontFamily,usecaseFontWeight:e.usecaseFontWeight,diagramPadding:e.diagramPadding,useMaxWidth:e.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),Os={getConfig:so,createModel:En,commit:io,getAST:no,clear:ro,setDiagramTitle:bn,getDiagramTitle:vn,setAccTitle:Mt,getAccTitle:vs,setAccDescription:wt,getAccDescription:_s,getActors:ao,getActor:oo,getUseCases:co,getUseCase:lo,getSystemBoundaries:ho,getSystemBoundary:uo,getRelationships:po,getNotes:fo,getNote:mo,getJsonNodes:Eo,getJsonNode:To,getClassDefs:go,getClassDef:Ao,getDirection:rr,getData:ko};function Me(s,e,t){let n=[t];return n.index=e,n.input=s,n}h(Me,"customMatch");var Co=h((s,e)=>{if(s[e]!=='"'||s[e+1]!=="`")return null;for(let t=e+2;t<s.length-1;t++)if(s[t]==="`"&&s[t+1]==='"')return Me(s,e,s.slice(e,t+2));return null},"matchMarkdownString"),bo=h((s,e)=>{if(s[e]!=="%"||s[e+1]!=="%")return null;for(let n=e-1;n>=0;n--){let i=s[n];if(i===`
111
+ `||i==="\r")break;if(i!==" "&&i!==" ")return null}let t=e+2;for(;t<s.length&&s[t]!==`
112
+ `&&s[t]!=="\r";)t++;return Me(s,e,s.slice(e,t))},"matchComment"),ar=h((s,e)=>{for(let t=e-1;t>=0;t--){let n=s[t];if(n===`
113
+ `||n==="\r")return!0;if(n!==" "&&n!==" ")return!1}return!0},"isIndentedLineStart"),or=h((s,e,t)=>{if(!ar(s,e))return null;let n=t.exec(s.slice(e));return n?Me(s,e,n[0]):null},"matchAccessibilityLine"),vo=h((s,e)=>{if(!ar(s,e))return null;let t=/^accDescr[\t ]*{/.exec(s.slice(e));if(!t)return null;let n=s.indexOf("}",e+t[0].length);return n===-1?null:Me(s,e,s.slice(e,n+1))},"matchAccDescrBlock"),_o=h((s,e)=>{if(s[e]!=="{")return null;let t=0,n=!1,i=!1;for(let r=e;r<s.length;r++){let a=s[r];if(n){i?i=!1:a==="\\"?i=!0:a==='"'&&(n=!1);continue}if(a==='"')n=!0;else if(a==="{")t++;else if(a==="}"&&--t===0)return Me(s,e,s.slice(e,r+1))}return null},"matchJsonObject"),xo=h((s,e)=>{let t=s.indexOf(">>",e);if(t===-1||/[\n\r]/.test(s.slice(e,t)))return null;let n=s.slice(e,t);return n.trim()?Me(s,e,n):null},"matchStereotypeText"),W=A({name:"LABEL_TEXT",pattern:_.NA}),He=A({name:"WORD",pattern:_.NA,categories:W}),Tn=A({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:W}),P=A({name:"IDENTIFIER",pattern:/\w+/,longer_alt:Tn,categories:He}),Mo=A({name:"HWS",pattern:/[\t ]+/,group:_.SKIPPED}),Te=A({name:"MARKDOWN_STRING",pattern:Co,start_chars_hint:['"'],line_breaks:!0}),wo=A({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),hn=A({name:"COMMENT",pattern:bo,start_chars_hint:["%"],line_breaks:!1}),Ee=A({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),cr=A({name:"ACC_DESCR_BLOCK",pattern:vo,start_chars_hint:["a"],line_breaks:!0}),Uo=/^accTitle[\t ]*:[^\n\r]*/,Po=/^accDescr[\t ]*:[^\n\r]*/,lr=A({name:"ACC_TITLE_LINE",pattern:h((s,e)=>or(s,e,Uo),"pattern"),start_chars_hint:["a"],line_breaks:!1}),hr=A({name:"ACC_DESCR_LINE",pattern:h((s,e)=>or(s,e,Po),"pattern"),start_chars_hint:["a"],line_breaks:!1}),ur=A({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),gn=A({name:"JSON_OBJECT_LITERAL",pattern:_o,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),dr=A({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),$=h((s,e)=>A({name:s,pattern:e,longer_alt:P,categories:He}),"keyword"),pr=$("USECASE",/usecase-beta/),un=$("ACTOR",/actor/),fr=$("SYSTEM_BOUNDARY",/systemBoundary/),mr=$("END",/end/),Er=$("DIRECTION",/direction/),Tr=$("TD",/TD/),gr=$("TB",/TB/),Ar=$("BT",/BT/),Sr=$("LR",/LR/),Rr=$("RL",/RL/),yr=$("NOTE",/note/),Or=$("FOR",/for/),Do=$("JSON",/json/),Lr=$("CLASS_DEF",/classDef/),Ir=$("CLASS",/class/),Nr=$("STYLE",/style/),kr=$("INCLUDE",/include/i),Cr=$("EXTEND",/extend/i),br=$("TRUE",/true/),vr=$("FALSE",/false/),_r=A({name:"GENERALIZATION",pattern:/--\|>/}),xr=A({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),Mr=A({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),An=A({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),Sn=A({name:"STEREOTYPE_TEXT",pattern:xo,line_breaks:!1}),wr=A({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),Ur=A({name:"CLASS_SEPARATOR",pattern:/:::/}),Ts=A({name:"FORWARD_SOLID",pattern:/--+>/}),Pr=A({name:"BACKWARD_SOLID",pattern:/<--+/}),gs=A({name:"FORWARD_CIRCLE",pattern:/--o/}),Dr=A({name:"BACKWARD_CIRCLE",pattern:/o--/}),As=A({name:"FORWARD_CROSS",pattern:/--x/}),Fr=A({name:"BACKWARD_CROSS",pattern:/x--/}),ne=A({name:"MARKERLESS_SOLID",pattern:/--+/}),dn=A({name:"METADATA_START",pattern:/@{/}),Ss=A({name:"AT",pattern:/@/,categories:W}),Br=A({name:"LBRACE",pattern:/{/}),pn=A({name:"RBRACE",pattern:/}/}),Rs=A({name:"LBRACKET",pattern:/\[/}),ys=A({name:"RBRACKET",pattern:/]/}),bt=A({name:"LPAREN",pattern:/\(/}),vt=A({name:"RPAREN",pattern:/\)/}),oe=A({name:"COMMA",pattern:/,/,categories:W}),_t=A({name:"COLON",pattern:/:/,categories:W}),$r=A({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:W}),ie=A({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),fn=A({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:W}),Gr=A({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:W}),jr=A({name:"DASH",pattern:/-/,categories:W}),Wr=A({name:"DOT",pattern:/\./,categories:W}),Kr=A({name:"PERCENT",pattern:/%/,categories:W}),Vr=A({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:W}),Fo=A({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:W}),Bo=A({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:W}),zr=[W,He,Mo,Te,wo,hn,Ee,cr,lr,hr,ur,pr,un,fr,mr,Er,Tr,gr,Ar,Sr,Rr,yr,Or,Do,Lr,Ir,Nr,kr,Cr,br,vr,_r,xr,Mr,Ur,Ts,Pr,gs,Dr,As,Fr,ne,dn,Ss,Br,pn,Rs,ys,bt,vt,oe,_t,$r,ie,fn,P,Tn,Gr,jr,Wr,Kr,Vr,Fo,Bo],$o={defaultMode:"defaultMode",modes:{defaultMode:[...zr],jsonBody:[gn,dr],stereotype:[An,Sn,wr]}},Go=[...zr,gn,dr,An,Sn,wr],jo=new _($o),Ji=h(s=>ft(s,W)||s.tokenType===ie||s.tokenType===Te,"isLabelToken"),Wo={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},Xe,Ko=(Xe=class extends kt{constructor(){super(Go,{nodeLocationTracking:"full"}),this.RULE("start",()=>{this.CONSUME(pr),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:h(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:h(()=>this.isStatementStart(),"GATE"),ALT:h(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:h(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:h(()=>this.isMetadataAssignment(),"GATE"),ALT:h(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:h(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:h(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:h(()=>this.CONSUME(Ee),"ALT")},{ALT:h(()=>this.CONSUME(Q),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(Ee)}),this.RULE("commentLine",()=>{this.CONSUME(hn),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(lr),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:h(()=>this.CONSUME(hr),"ALT")},{ALT:h(()=>this.CONSUME(cr),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(un),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:h(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(oe),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:h(()=>this.SUBRULE(this.relationTail),"ALT")}])}),this.SUBRULE(this.lineEnd)}),this.RULE("actorItem",()=>{this.SUBRULE(this.actorName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.stereotype)),this.OPTION3(()=>this.SUBRULE(this.classSuffix))}),this.RULE("actorName",()=>{this.OR([{ALT:h(()=>{this.CONSUME(P),this.OPTION(()=>{this.CONSUME(bt),this.SUBRULE(this.nodeLabel),this.CONSUME(vt)})},"ALT")},{ALT:h(()=>this.CONSUME(ie),"ALT")},{ALT:h(()=>this.CONSUME(Te),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(un),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(oe),this.SUBRULE2(this.actorItem)}),this.SUBRULE(this.lineEnd)}),this.RULE("entityStatement",()=>{this.SUBRULE(this.entityName),this.OPTION(()=>this.SUBRULE(this.relationTail)),this.SUBRULE(this.lineEnd)}),this.RULE("entityName",()=>{this.OR([{ALT:h(()=>{this.CONSUME(P),this.OPTION(()=>{this.OR2([{ALT:h(()=>{this.CONSUME(bt),this.SUBRULE(this.nodeLabel),this.CONSUME(vt)},"ALT")},{ALT:h(()=>{this.CONSUME(Rs),this.SUBRULE2(this.nodeLabel),this.CONSUME(ys)},"ALT")}])})},"ALT")},{ALT:h(()=>this.CONSUME(ie),"ALT")},{ALT:h(()=>this.CONSUME(Te),"ALT")}]),this.OPTION2(()=>this.SUBRULE(this.useCaseMetadata)),this.OPTION3(()=>this.SUBRULE(this.stereotype)),this.OPTION4(()=>this.SUBRULE(this.classSuffix))}),this.RULE("nodeLabel",()=>{this.OR([{ALT:h(()=>this.CONSUME(ie),"ALT")},{ALT:h(()=>this.CONSUME(Te),"ALT")},{ALT:h(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:h(()=>this.LA(1).tokenType===P&&this.LA(2).tokenType===Ss,"GATE"),DEF:h(()=>{this.CONSUME(P),this.CONSUME(Ss)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:h(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:h(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(Ts)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(Pr),this.OPTION({GATE:h(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([ne]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ne)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(ne),this.OPTION({GATE:h(()=>this.LA(0).image==="--"&&this.hasLabeledRight([Ts,ne,gs,As]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:h(()=>this.CONSUME(Ts),"ALT")},{ALT:h(()=>this.CONSUME2(ne),"ALT")},{ALT:h(()=>this.CONSUME(gs),"ALT")},{ALT:h(()=>this.CONSUME(As),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(gs)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(Dr),this.OPTION({GATE:h(()=>this.hasLabeledRight([ne]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ne)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(As)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(Fr),this.OPTION({GATE:h(()=>this.hasLabeledRight([ne]),"GATE"),DEF:h(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(ne)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:h(()=>this.CONSUME(ie),"ALT")},{ALT:h(()=>this.CONSUME(Te),"ALT")},{ALT:h(()=>this.AT_LEAST_ONE(()=>this.CONSUME(W)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:h(()=>{this.CONSUME(xr),this.CONSUME(_t),this.OR2([{ALT:h(()=>this.CONSUME(kr),"ALT")},{ALT:h(()=>this.CONSUME(Cr),"ALT")}])},"ALT")},{ALT:h(()=>this.CONSUME(_r),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(dn),this.MANY(()=>this.CONSUME(Ee)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(oe)),this.MANY3(()=>this.CONSUME2(Ee))}),this.CONSUME(pn)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:h(()=>this.CONSUME(P),"ALT")},{ALT:h(()=>this.CONSUME(ie),"ALT")}]),this.CONSUME(_t),this.OR2([{ALT:h(()=>this.CONSUME2(P),"ALT")},{ALT:h(()=>this.CONSUME2(ie),"ALT")},{ALT:h(()=>this.CONSUME(br),"ALT")},{ALT:h(()=>this.CONSUME(vr),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:h(()=>{this.CONSUME(oe),this.MANY(()=>this.CONSUME(Ee))},"ALT")},{ALT:h(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(Ee)),this.OPTION(()=>this.CONSUME2(oe)),this.MANY2(()=>this.CONSUME3(Ee))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(fr),this.SUBRULE(this.systemBoundaryName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd),this.SUBRULE(this.systemBoundaryContent),this.CONSUME(mr),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:h(()=>{this.CONSUME(P),this.OPTION(()=>{this.OR2([{ALT:h(()=>{this.CONSUME(bt),this.SUBRULE(this.nodeLabel),this.CONSUME(vt)},"ALT")},{ALT:h(()=>{this.CONSUME(Rs),this.SUBRULE2(this.nodeLabel),this.CONSUME(ys)},"ALT")}])})},"ALT")},{ALT:h(()=>this.CONSUME(ie),"ALT")},{ALT:h(()=>this.CONSUME(Te),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:h(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:h(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:h(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:h(()=>{this.SUBRULE(this.entityName),this.SUBRULE(this.lineEnd)},"ALT")}])}),this.RULE("metadataAssignmentStatement",()=>{this.SUBRULE(this.metadataAssignmentTarget),this.SUBRULE(this.metadata),this.SUBRULE(this.lineEnd)}),this.RULE("metadataAssignmentTarget",()=>{this.OR([{ALT:h(()=>this.CONSUME(P),"ALT")},{ALT:h(()=>this.CONSUME(ie),"ALT")},{ALT:h(()=>this.CONSUME(Te),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(yr),this.CONSUME(Or),this.CONSUME(P),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(Mr),this.CONSUME(Sn),this.CONSUME(An)}),this.RULE("classSuffix",()=>{this.CONSUME(Ur),this.CONSUME(P),this.MANY(()=>{this.CONSUME(oe),this.CONSUME2(P)})}),this.RULE("jsonStatement",()=>{this.CONSUME(ur),this.CONSUME(gn),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(Er),this.OR([{ALT:h(()=>this.CONSUME(Tr),"ALT")},{ALT:h(()=>this.CONSUME(gr),"ALT")},{ALT:h(()=>this.CONSUME(Ar),"ALT")},{ALT:h(()=>this.CONSUME(Sr),"ALT")},{ALT:h(()=>this.CONSUME(Rr),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(Lr),this.CONSUME(P),this.MANY(()=>{this.CONSUME(oe),this.CONSUME2(P)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(Ir),this.CONSUME(P),this.MANY(()=>{this.CONSUME(oe),this.CONSUME2(P)}),this.CONSUME3(P),this.MANY2(()=>{this.CONSUME2(oe),this.CONSUME4(P)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(Nr),this.CONSUME(P),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(oe),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:h(()=>this.CONSUME(He),"ALT")},{ALT:h(()=>this.CONSUME(fn),"ALT")},{ALT:h(()=>{this.CONSUME(ne),this.CONSUME2(He)},"ALT")}]),this.CONSUME(_t),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:h(()=>this.CONSUME(He),"ALT")},{ALT:h(()=>this.CONSUME(ie),"ALT")},{ALT:h(()=>this.CONSUME(Tn),"ALT")},{ALT:h(()=>this.CONSUME($r),"ALT")},{ALT:h(()=>this.CONSUME(fn),"ALT")},{ALT:h(()=>this.CONSUME(Gr),"ALT")},{ALT:h(()=>this.CONSUME(jr),"ALT")},{ALT:h(()=>this.CONSUME(Wr),"ALT")},{ALT:h(()=>this.CONSUME(Kr),"ALT")},{ALT:h(()=>this.CONSUME(Vr),"ALT")},{ALT:h(()=>this.CONSUME(_t),"ALT")},{ALT:h(()=>this.CONSUME(bt),"ALT")},{ALT:h(()=>this.CONSUME(vt),"ALT")},{ALT:h(()=>this.CONSUME(Rs),"ALT")},{ALT:h(()=>this.CONSUME(ys),"ALT")},{ALT:h(()=>this.CONSUME(Br),"ALT")},{ALT:h(()=>this.CONSUME(pn),"ALT")},{ALT:h(()=>this.CONSUME(Ss),"ALT")},{ALT:h(()=>this.CONSUME(ne),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===P||e===ie||e===Te)&&this.LA(2).tokenType===dn}isStatementStart(){let e=this.LA(1).tokenType;return e!==Q&&e!==Ee&&e!==hn}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===P&&Wo[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(e){if(!Ji(this.LA(1)))return!1;for(let t=2;;t++){let n=this.LA(t);if(e.includes(n.tokenType))return!0;if(!Ji(n))return!1}}},h(Xe,"UsecaseParser"),Xe),xt=new Ko,Ye,Zi=(Ye=class extends Error{constructor(e,t,n){super(`${e} (line ${t}, column ${n})`),this.line=t,this.column=n,this.name="UsecaseJsonError"}},h(Ye,"UsecaseJsonError"),Ye),mn=h((s,e,t,n)=>{let i=t,r=n,a=Math.min(Math.max(e,0),s.length);for(let c=0;c<a;c++){let o=s[c];o==="\r"?(i++,r=1):o===`
114
+ `?(c===0||s[c-1]!=="\r")&&(i++,r=1):r++}return{line:i,column:r}},"locationAtOffset"),Vo=h((s,e,t,n)=>{let i=/\bposition (\d+)\b/u.exec(s);if(i)return mn(e,Number.parseInt(i[1],10),t,n);let r=/\bline (\d+) column (\d+)\b/u.exec(s);if(r){let a=Number.parseInt(r[1],10),c=Number.parseInt(r[2],10);return{line:t+a-1,column:a===1?n+c-1:c}}if(/unexpected end|end of json input/iu.test(s))return mn(e,e.length,t,n)},"locationFromErrorMessage"),qe,V=(qe=class extends Error{constructor(e){super("Invalid JSON token"),this.offset=e}},h(qe,"JsonWalkError"),qe),Je,Qi=(Je=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new V(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();let t=this.text[this.offset];if(t==="{")this.collectObject(e);else if(t==="[")this.collectArray(e);else if(t==='"')this.readString(!1);else if(t==="t")this.consumeLiteral("true");else if(t==="f")this.consumeLiteral("false");else if(t==="n")this.consumeLiteral("null");else if(t==="-"||t>="0"&&t<="9")this.consumeNumber();else throw new V(this.offset)}collectObject(e){this.offset++;let t=[],n=new Set;if(this.propertyOrder[e]=t,this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}for(;this.offset<this.text.length;){if(this.text[this.offset]!=='"')throw new V(this.offset);let i=this.readString(!0),r=`${e}/${i.replaceAll("~","~0").replaceAll("/","~1")}`;if(n.has(i)?this.deletePointerSubtree(r):(n.add(i),t.push(i)),this.skipWhitespace(),this.text[this.offset]!==":")throw new V(this.offset);if(this.offset++,this.collectValue(r),this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}if(this.text[this.offset]!==",")throw new V(this.offset);this.offset++,this.skipWhitespace()}throw new V(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}let t=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${t}`),t++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}if(this.text[this.offset]!==",")throw new V(this.offset);this.offset++,this.skipWhitespace()}throw new V(this.offset)}readString(e){this.offset++;let t="";for(;this.offset<this.text.length;){let n=this.offset,i=this.text[this.offset++];if(i==='"')return t;if(i.charCodeAt(0)<32)throw new V(n);if(i!=="\\"){e&&(t+=i);continue}let r=this.offset,a=this.text[this.offset++];switch(a){case'"':case"\\":case"/":e&&(t+=a);break;case"b":e&&(t+="\b");break;case"f":e&&(t+="\f");break;case"n":e&&(t+=`
115
+ `);break;case"r":e&&(t+="\r");break;case"t":e&&(t+=" ");break;case"u":{let c=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(c))throw new V(this.offset);e&&(t+=String.fromCharCode(Number.parseInt(c,16))),this.offset+=4;break}default:throw new V(r)}}throw new V(this.offset)}consumeLiteral(e){let t=0;for(let n of e){if(this.text[this.offset+t]!==n)throw new V(this.offset+t);t++}this.offset+=e.length}consumeNumber(){if(this.text[this.offset]==="-"&&this.offset++,this.text[this.offset]==="0")this.offset++;else if(this.text[this.offset]>="1"&&this.text[this.offset]<="9")for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++;else throw new V(this.offset);if(this.text[this.offset]==="."){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new V(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}if(this.text[this.offset]==="e"||this.text[this.offset]==="E"){if(this.offset++,(this.text[this.offset]==="+"||this.text[this.offset]==="-")&&this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new V(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){let e=this.text[this.offset];if(e!==" "&&e!==" "&&e!==`
116
+ `&&e!=="\r")return;this.offset++}}deletePointerSubtree(e){let t=`${e}/`;for(let n of Object.keys(this.propertyOrder))(n===e||n.startsWith(t))&&delete this.propertyOrder[n]}},h(Je,"PropertyOrderCollector"),Je);function Hr(s,e,t){let n;try{n=JSON.parse(s)}catch(i){let r=i instanceof Error?i.message:String(i),a=Vo(r,s,e,t);if(!a){let c=0;try{new Qi(s).collect()}catch(o){o instanceof V&&(c=o.offset)}a=mn(s,c,e,t)}throw new Zi(`Invalid JSON: ${r}`,a.line,a.column)}if(typeof n!="object"||n===null||Array.isArray(n))throw new Zi("JSON value must have an object root",e,t);return{value:n,propertyOrder:new Qi(s).collect()}}h(Hr,"parseOrderedJsonObject");var zo=h(s=>({shape:s.type==="normal"?"actor":s.type==="hollow"?"actor-hollow":s.type==="awesome"?"actor-awesome":"actor-icon",...s.label===s.id?{}:{label:s.label},...s.classes.length?{classes:[...s.classes]}:{},...s.styles.length?{styles:[...s.styles]}:{},attrs:{kind:"actor",actorType:s.type,business:s.business,labelType:s.labelType,...s.icon?{icon:s.icon}:{},...s.stereotype?{stereotype:s.stereotype}:{},...s.parentId?{parentId:s.parentId}:{}}}),"actorNode"),Ho=h(s=>({shape:s.shape,...s.label===s.id?{}:{label:s.label},...s.classes.length?{classes:[...s.classes]}:{},...s.styles.length?{styles:[...s.styles]}:{},attrs:{kind:"usecase",useCaseShape:s.shape,business:s.business,labelType:s.labelType,...s.stereotype?{stereotype:s.stereotype}:{},...s.parentId?{parentId:s.parentId}:{}}}),"useCaseNode"),Xo=h(s=>({label:s.label,shape:"note",attrs:{kind:"note",target:s.target,labelType:s.labelType}}),"noteNode"),Yo=h(s=>({label:s.id,shape:"json-table",...s.classes.length?{classes:[...s.classes]}:{},...s.styles.length?{styles:[...s.styles]}:{},attrs:{kind:"json",value:s.value,propertyOrder:s.propertyOrder,labelType:"text"}}),"jsonNode"),qo=h(s=>({id:s.id,source:s.source,target:s.target,...s.label?{label:s.label}:{},...s.classes.length?{classes:[...s.classes]}:{},...s.styles.length?{styles:[...s.styles]}:{},attrs:{relationshipType:s.type,arrowType:s.arrowType,minlen:s.minlen,explicitId:s.explicitId,animate:s.animate,...s.animation?{animation:s.animation}:{},...s.labelType?{labelType:s.labelType}:{}}}),"relationshipEdge"),Jo=h(s=>({id:`${s.id}-edge`,source:s.id,target:s.target,attrs:{relationshipType:"note",arrowType:M.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),Zo=h((s,e,t,n)=>{let i={};for(let o of s.getActors().values())i[o.id]=zo(o);for(let o of s.getUseCases().values())i[o.id]=Ho(o);for(let o of s.getNotes().values())i[o.id]=Xo(o);for(let o of s.getJsonNodes().values())i[o.id]=Yo(o);let r={};for(let o of s.getSystemBoundaries().values())r[o.id]={...o.label===o.id?{}:{title:o.label},nodes:[...o.members],...o.classes.length?{classes:[...o.classes]}:{},...o.styles.length?{styles:[...o.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:o.type,labelType:o.labelType}};let a={};for(let o of s.getClassDefs().values())a[o.id]={styles:[...o.styles]};let c=s.getDirection();return{version:1,diagramType:"usecase",source:e,header:{keyword:"usecase",direction:c==="TD"?"TB":c,span:t},...s.getAccTitle()?{accTitle:s.getAccTitle()}:{},...s.getAccDescription()?{accDescr:s.getAccDescription()}:{},nodes:i,edges:[...s.getRelationships().map(qo),...[...s.getNotes().values()].map(Jo)],groups:r,classDefs:a,statements:n}},"buildUsecaseGraphAST"),z=h(s=>`line ${s.line}, column ${s.column} [${s.span[0]},${s.span[1]})`,"locationText"),er=h(s=>s===void 0?"":` (label "${s}")`,"labelSuffix"),xe=h(s=>s.generated?s.label:void 0,"generatedFrom"),ln=h((s,e)=>{for(let t of e)s.includes(t)||s.push(t)},"pushUnique"),Ze,Qo=(Ze=class{constructor(e){this.db=e,this.source="",this.statements=[],this.elements=[],this.boundaries=[],this.jsonDrafts=[],this.relationshipDrafts=[],this.noteDrafts=[],this.metadataAssignments=[],this.classAssignments=[],this.styleAssignments=[],this.classDefinitions=[],this.directions=[],this.model=e.createModel()}reset(e){this.model=this.db.createModel(),this.source=e,this.statements=[],this.elements.length=0,this.boundaries.length=0,this.jsonDrafts.length=0,this.relationshipDrafts.length=0,this.noteDrafts.length=0,this.metadataAssignments.length=0,this.classAssignments.length=0,this.styleAssignments.length=0,this.classDefinitions.length=0,this.directions.length=0}addElement(e){this.elements.push(e)}addBoundary(e){this.boundaries.push(e)}addJson(e){this.jsonDrafts.push(e)}addRelationship(e){this.relationshipDrafts.push(e)}addNote(e){this.noteDrafts.push(e)}addMetadataAssignment(e,t,n,i){this.metadataAssignments.push({target:e,targetLocation:t,metadata:n,statement:i})}addClassDef(e,t){this.classDefinitions.push({ids:e,styles:t})}addClassAssignment(e,t){this.classAssignments.push({targets:e,classes:t})}addStyleAssignment(e,t,n){this.styleAssignments.push({target:e,location:t,styles:n})}setDirection(e){this.directions.push(e==="TD"?"TB":e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){let t=new Map,n=new Map,i=new Map,r=new Map;for(let l of this.relationshipDrafts)this.recordFirst(r,l.source.id,l.source.location.span[0]),this.recordFirst(r,l.target.id,l.target.location.span[0]);for(let l of this.elements)this.recordFirst(r,l.id,l.location.span[0]);for(let l of this.boundaries)this.recordFirst(r,l.id,l.location.span[0]);for(let l of this.jsonDrafts)this.recordFirst(r,l.id,l.location.span[0]);let a=[...this.elements.map(l=>({offset:l.location.span[0],type:"element",value:l})),...this.boundaries.map(l=>({offset:l.location.span[0],type:"boundary",value:l})),...this.jsonDrafts.map(l=>({offset:l.location.span[0],type:"json",value:l})),...this.relationshipDrafts.filter(l=>l.explicitId).map(l=>({offset:l.explicitIdLocation.span[0],type:"edge",value:l}))].sort((l,d)=>l.offset-d.offset);for(let l of a)l.type==="element"?this.collectElement(l.value,t,n):l.type==="boundary"?this.collectBoundary(l.value,t,i):l.type==="json"?this.registerUnique(t,l.value.id,"json",l.value.location,!1):this.registerUnique(t,l.value.explicitId,"edge",l.value.explicitIdLocation,!1);this.materializeElements(n,r),this.materializeBoundaries(i,r),this.materializeJson(r);let c=this.materializeRelationships(t,n,r);this.reorderElements(n,r),this.applyMetadataAssignments(t,n,i,c),this.validateAndRefreshElements(n),this.refreshBoundaries(i,n),this.materializeNotes(t),this.applyClassDefinitions(),this.applyClassesAndStyles(t,c),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...t].map(([l,d])=>[l,d.kind]));let o=Zo(this,this.source,e,this.statements);return this.model.ast=o,this.db.commit(this.model),o}collectElement(e,t,n){let i=t.get(e.id),r=xe({generated:e.generated,label:e.label.text});i&&i.kind!==e.kind&&this.conflict(`ID '${e.id}' is declared as both ${i.kind} and ${e.kind}`,e.location,i.location,r,xe(i)),i&&(i.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,i.location,r,xe(i));let a=n.get(e.id);if(!a){let c={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(c,e.metadata),n.set(e.id,c),t.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`ID '${e.id}' has conflicting labels`,e.location,a.location),e.shape&&a.shape&&e.shape!==a.shape&&this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,a.location),e.parentId&&a.parentId&&e.parentId!==a.parentId&&this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,a.parentLocation??a.location),e.stereotype&&a.stereotype&&e.stereotype!==a.stereotype&&this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,a.stereotypeLocation??a.location),a.shape??=e.shape,a.parentId??=e.parentId,a.parentLocation??=e.parentLocation,a.stereotype??=e.stereotype,a.stereotypeLocation??=e.stereotype?e.location:void 0,ln(a.classes,e.classes),this.applyDeclarationMetadata(a,e.metadata)}collectBoundary(e,t,n){let i=t.get(e.id),r=xe({generated:e.generated,label:e.label.text});i&&i.kind!=="boundary"&&this.conflict(`ID '${e.id}' is declared as both ${i.kind} and boundary`,e.location,i.location,r,xe(i)),i&&(i.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,i.location,r,xe(i));let a=n.get(e.id);if(a){(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,a.location),ln(a.classes,e.classes);return}n.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),t.set(e.id,{kind:"boundary",location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,t){for(let n of[...e.values()].sort((i,r)=>(t.get(i.id)??0)-(t.get(r.id)??0)))this.setElementModel(n)}materializeBoundaries(e,t){for(let n of[...e.values()].sort((i,r)=>(t.get(i.id)??0)-(t.get(r.id)??0)))this.model.systemBoundaries.set(n.id,{id:n.id,label:n.label.text,labelType:n.label.type,type:n.type??"rect",members:[],classes:[...n.classes],styles:[...n.styles]})}materializeJson(e){for(let t of[...this.jsonDrafts].sort((n,i)=>(e.get(n.id)??0)-(e.get(i.id)??0)))this.model.jsonNodes.set(t.id,{id:t.id,value:t.value,propertyOrder:t.propertyOrder,classes:[...t.classes],styles:[]})}materializeRelationships(e,t,n){let i=new Map,r=0;for(let a of this.relationshipDrafts){let c=this.resolveEndpoint(a.source,e,t,n),o=this.resolveEndpoint(a.target,e,t,n);this.validateRelationship(a,c,o,e);let l=a.explicitId??`edge-${r++}`,d={id:l,explicitId:!!a.explicitId,source:a.source.id,target:a.target.id,type:a.type,arrowType:a.arrowType,...a.label?{label:a.label.text,labelType:a.label.type}:{},minlen:a.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(d),i.set(l,{draft:a,relationship:d})}return this.model.relationshipCounter=r,i}resolveEndpoint(e,t,n,i){if(e.classesOnReference&&!e.declaration)throw new Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${z(e.location)}`);let r=t.get(e.id);return r?r.kind:(n.set(e.id,{kind:"usecase",id:e.id,label:e.label,location:e.location,generated:e.generated,shape:"ellipse",classes:[]}),t.set(e.id,{kind:"usecase",location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(i,e.id,e.location.span[0]),"usecase")}reorderElements(e,t){let n=new Map(this.model.actors),i=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(let r of[...e.values()].sort((a,c)=>(t.get(a.id)??0)-(t.get(c.id)??0))){!n.has(r.id)&&!i.has(r.id)&&this.setElementModel(r);let a=n.get(r.id)??this.model.actors.get(r.id),c=i.get(r.id)??this.model.useCases.get(r.id);a?this.model.actors.set(r.id,a):c&&this.model.useCases.set(r.id,c)}}applyMetadataAssignments(e,t,n,i){for(let r of this.metadataAssignments){let a=e.get(r.target);if(!a){let c=this.inferMetadataKind(r.metadata);throw new Error(`Metadata target '${r.target}' is unresolved${c?` (metadata implies ${c})`:""} at ${z(r.targetLocation)}`)}if(a.kind==="actor"||a.kind==="usecase")this.applyStandaloneElementMetadata(t.get(r.target),r.metadata);else if(a.kind==="boundary"){let c=n.get(r.target);for(let o of r.metadata.properties)(o.key!=="type"||o.value!=="rect"&&o.value!=="package")&&this.invalidMetadata(r.target,a.kind,o),c.type=o.value}else if(a.kind==="edge"){let c=i.get(r.target);if(!c)throw new Error(`Metadata target '${r.target}' is not an explicit edge at ${z(r.targetLocation)}`);r.statement.kind="edgeMetadata",r.statement.edges=[{id:r.target,span:r.statement.span,idSpan:r.targetLocation.span,...r.statement.metadata?{metadata:r.statement.metadata}:{}}],delete r.statement.nodes;for(let o of r.metadata.properties)o.key==="animate"&&typeof o.value=="boolean"?c.relationship.animate=o.value:o.key==="animation"&&(o.value==="fast"||o.value==="slow")?(c.relationship.animation=o.value,c.relationship.animate=!0):this.invalidMetadata(r.target,a.kind,o)}else for(let c of r.metadata.properties)this.invalidMetadata(r.target,a.kind,c)}for(let{relationship:r}of i.values())r.animation&&(r.animate=!0)}applyStandaloneElementMetadata(e,t){for(let n of t.properties)e.kind==="actor"?this.applyActorProperty(e,n,!0):n.key==="business"&&typeof n.value=="boolean"?e.business=n.value:this.invalidMetadata(e.id,e.kind,n)}applyDeclarationMetadata(e,t){if(t)for(let n of t.properties)e.kind==="actor"?this.applyActorProperty(e,n,!1):n.key==="business"&&typeof n.value=="boolean"?(e.business!==void 0&&e.business!==n.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,n.location,e.location),e.business=n.value):this.invalidMetadata(e.id,e.kind,n)}applyActorProperty(e,t,n){t.key==="type"&&(t.value==="normal"||t.value==="hollow"||t.value==="awesome")?(!n&&e.actorType!==void 0&&e.actorType!==t.value&&this.conflict(`Actor '${e.id}' has conflicting type metadata`,t.location,e.location),e.actorType=t.value):t.key==="icon"&&typeof t.value=="string"?(!n&&e.icon!==void 0&&e.icon!==t.value&&this.conflict(`Actor '${e.id}' has conflicting icon metadata`,t.location,e.location),e.icon=t.value):t.key==="business"&&typeof t.value=="boolean"?(!n&&e.business!==void 0&&e.business!==t.value&&this.conflict(`Actor '${e.id}' has conflicting business metadata`,t.location,e.location),e.business=t.value):this.invalidMetadata(e.id,e.kind,t)}validateAndRefreshElements(e){for(let t of e.values()){let n=t.icon?"icon":t.actorType??"normal";if(t.kind==="actor"){if(t.icon&&t.actorType&&t.actorType!=="normal")throw new Error(`Actor '${t.id}' cannot combine icon with type '${t.actorType}' at ${z(t.location)}`);if(t.business&&(n==="icon"||n==="awesome"))throw new Error(`Business actor '${t.id}' must use normal or hollow geometry at ${z(t.location)}`)}else if((t.shape??"ellipse")==="rect"&&t.business)throw new Error(`Rectangular use case '${t.id}' cannot be a business use case at ${z(t.location)}`);this.setElementModel(t)}}refreshBoundaries(e,t){for(let n of e.values())n.members.length=0;for(let n of[...this.elements].sort((i,r)=>i.location.span[0]-r.location.span[0])){if(!n.parentId)continue;let i=e.get(n.parentId);if(!i)throw new Error(`Parent boundary '${n.parentId}' for '${n.id}' is unresolved at ${z(n.parentLocation??n.location)}`);i.members.includes(n.id)||i.members.push(n.id)}for(let n of t.values())if(n.parentId&&!e.has(n.parentId))throw new Error(`Parent boundary '${n.parentId}' for '${n.id}' is unresolved at ${z(n.parentLocation??n.location)}`);for(let n of e.values()){let i=this.model.systemBoundaries.get(n.id);i.type=n.type??"rect",i.members=[...n.members],i.classes=[...n.classes],i.styles=[...n.styles]}}materializeNotes(e){let t=0;for(let n of this.noteDrafts){let i=e.get(n.target);if(!i)throw new Error(`Note target '${n.target}' is unresolved at ${z(n.targetLocation)}`);i.kind!=="actor"&&i.kind!=="usecase"&&this.conflict(`Note target '${n.target}' must be an actor or use case, not ${i.kind}`,n.targetLocation,i.location);let r=`note-${t++}`;this.model.notes.set(r,{id:r,target:n.target,label:n.label.text,labelType:n.label.type})}this.model.noteCounter=t}applyClassDefinitions(){for(let e of this.classDefinitions)for(let t of e.ids)this.model.classDefs.set(t,{id:t,styles:[...e.styles]})}applyClassesAndStyles(e,t){for(let n of this.classAssignments)for(let i of n.targets)ln(this.getStylable(i.id,e,t,i.location).classes,n.classes);for(let n of this.styleAssignments)this.getStylable(n.target,e,t,n.location).styles.push(...n.styles)}getStylable(e,t,n,i){let r=t.get(e)?.kind,a=r==="actor"?this.model.actors.get(e):r==="usecase"?this.model.useCases.get(e):r==="boundary"?this.model.systemBoundaries.get(e):r==="json"?this.model.jsonNodes.get(e):r==="edge"?n.get(e)?.relationship:void 0;if(!a)throw new Error(`Class/style target '${e}' is unresolved or anonymous at ${z(i)}`);return a}validateRelationship(e,t,n,i){let r=h(a=>a==="actor"||a==="usecase"||a==="json","allowed");if(r(t)||this.conflict(`Relationship source '${e.source.id}' cannot be ${t}`,e.source.location,i.get(e.source.id).location),r(n)||this.conflict(`Relationship target '${e.target.id}' cannot be ${n}`,e.target.location,i.get(e.target.id).location),(e.type==="include"||e.type==="extend")&&(t!=="usecase"||n!=="usecase"))throw new Error(`${e.type} relationship requires use-case endpoints at ${z(e.location)}`);if(e.type==="generalization"&&(t!=="actor"&&t!=="usecase"||t!==n))throw new Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${z(e.location)}`);if(e.type==="association"&&(t==="json"||n==="json")&&![0,1,2].includes(e.arrowType))throw new Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${z(e.location)}`)}setElementModel(e){if(e.kind==="actor"){let t=e.icon?"icon":e.actorType??"normal";this.model.useCases.delete(e.id),this.model.actors.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:t,...e.icon?{icon:e.icon}:{},business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.actors.get(e.id)?.styles??[]})}else this.model.actors.delete(e.id),this.model.useCases.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,shape:e.shape??"ellipse",business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.useCases.get(e.id)?.styles??[]})}inferMetadataKind(e){let t=new Set(["actor","usecase","boundary","edge"]);for(let n of e.properties)if(n.key==="icon")t.clear(),t.add("actor");else if(n.key==="animate"||n.key==="animation")t.clear(),t.add("edge");else if(n.key==="type")t.clear(),n.value==="rect"||n.value==="package"?t.add("boundary"):(n.value==="normal"||n.value==="hollow"||n.value==="awesome")&&t.add("actor");else if(n.key==="business")t.delete("boundary"),t.delete("edge");else return;return t.size===1?[...t][0]:void 0}invalidMetadata(e,t,n){throw new Error(`Metadata property '${n.key}' is invalid for ${t} '${e}' at ${z(n.location)}`)}registerUnique(e,t,n,i,r){let a=e.get(t);a&&this.conflict(`ID '${t}' is declared more than once (${a.kind} and ${n})`,i,a.location,void 0,xe(a)),e.set(t,{kind:n,location:i,generated:r})}recordFirst(e,t,n){let i=e.get(t);(i===void 0||n<i)&&e.set(t,n)}conflict(e,t,n,i,r){throw new Error(`${e} at ${z(t)}${er(i)}; previous declaration at ${z(n)}${er(r)}`)}},h(Ze,"UsecaseModelBuilder"),Ze),ec=xt.getBaseCstVisitorConstructor(),Qe,tc=(Qe=class extends ec{constructor(){super(),this.builder=new Qo(Os),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}build(e,t){this.source=t,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(t),this.visit(e)}start(e){let t=this.tokens(e,"USECASE")[0],n=[];for(let i of this.nodes(e,"line"))n.push(this.visit(i));this.builder.setStatements(n),this.builder.finalize(this.tokenSpan(t))}line(e){let t=this.firstNode(e,"blankLine","commentLine","statement");return this.wrap(t,this.visit(t))}statement(e){return this.visit(this.firstNode(e,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(e){}blankLine(e){return{kind:"blank",span:this.tokenSpan(this.tokens(e,"NEWLINE")[0])}}commentLine(e){return{kind:"comment",span:this.tokenSpan(this.tokens(e,"COMMENT")[0])}}accTitleStatement(e){let t=this.tokens(e,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(t.slice(t.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(e){let t=this.tokens(e,"ACC_DESCR_LINE")[0],n=this.tokens(e,"ACC_DESCR_BLOCK")[0],i=t?t.image.slice(t.image.indexOf(":")+1).trim():n.image.slice(n.image.indexOf("{")+1,n.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(i),{kind:"accDescr",span:[0,0]}}actorStatement(e){let t=this.nodes(e,"actorItem"),n=t.map(l=>this.visit(l)),i=this.nodes(e,"relationTail")[0],r=n.map((l,d)=>this.actorOccurrence(t[d],l,!0));for(let l of n)this.builder.addElement(this.actorDraft(l));if(!i)return{kind:"node",span:[0,0],nodes:r};let a=this.visit(i);a.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(a.target));let c=this.relationshipDraft(n[0],a,this.nodeLocation(i));this.builder.addRelationship(c);let o=c.explicitId??`edge-${this.anonymousEdge++}`;return r.push(this.entityOccurrence(this.nodes(i.children,"entityName")[0],a.target,a.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:r,edges:[{id:o,span:[0,0],...c.explicitIdLocation?{idSpan:c.explicitIdLocation.span}:{},...c.label?{labelSpan:c.label.span}:{}}]}}actorItem(e){let t=this.visit(this.nodes(e,"actorName")[0]),n=this.nodes(e,"metadata")[0],i=this.nodes(e,"stereotype")[0],r=this.nodes(e,"classSuffix")[0],a=r?this.visit(r):{classes:[],spans:[]};return{...t,...n?{metadata:this.visit(n)}:{},...i?{stereotype:this.visit(i)}:{},classes:a.classes,classSpans:a.spans}}actorName(e){let t=this.tokens(e,"IDENTIFIER")[0],n=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(t){let r=this.nodes(e,"nodeLabel")[0],a=r?this.visit(r):this.tokenLabel(t);return{id:t.image,label:a,location:this.tokenLocation(t),generated:!1,classes:[],classSpans:[]}}let i=this.tokenLabel(n);return{id:this.generateId(i.text),label:i,location:this.tokenLocation(n),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let t=this.nodes(e,"actorItem"),n=t.map(i=>this.visit(i));for(let i of n)this.builder.addElement(this.actorDraft(i));return{kind:"node",span:[0,0],nodes:n.map((i,r)=>this.actorOccurrence(t[r],i,!0))}}entityStatement(e){let t=this.nodes(e,"entityName"),n=this.visit(t[0]),i=this.nodes(e,"relationTail")[0];if(!i)return n.explicitDeclaration=!0,n.shape??="ellipse",this.builder.addElement(this.entityDraft(n)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(t[0],n,!0)]};n.explicitDeclaration&&this.builder.addElement(this.entityDraft(n));let r=this.visit(i);r.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(r.target));let a={source:this.endpoint(n),target:this.endpoint(r.target),location:this.nodeLocation(i),...r.explicitId?{explicitId:r.explicitId,explicitIdLocation:r.explicitIdLocation}:{},...r.arrow};this.builder.addRelationship(a);let c=a.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(t[0],n,n.explicitDeclaration),this.entityOccurrence(this.nodes(i.children,"entityName")[0],r.target,r.target.explicitDeclaration)],edges:[{id:c,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}entityName(e){let t=this.tokens(e,"IDENTIFIER")[0],n=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],i=this.nodes(e,"nodeLabel")[0],r=this.nodes(e,"useCaseMetadata")[0],a=this.nodes(e,"stereotype")[0],c=this.nodes(e,"classSuffix")[0],o=c?this.visit(c):{classes:[],spans:[]};if(t){let d=i?this.visit(i):this.tokenLabel(t),u=i?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:t.image,label:d,location:this.tokenLocation(t),generated:!1,...u?{shape:u}:{},...r?{metadata:this.visit(r)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(u||r||a)}}let l=this.tokenLabel(n);return{id:this.generateId(l.text),label:l,location:this.tokenLocation(n),generated:!0,...r?{metadata:this.visit(r)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(r||a)}}nodeLabel(e){let t=this.allTokens(e);if(t.length===1&&(t[0].tokenType.name==="PLAIN_STRING"||t[0].tokenType.name==="MARKDOWN_STRING"))return this.tokenLabel(t[0]);let n=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return{text:this.source.slice(n[0],n[1]),type:"text",span:n}}useCaseMetadata(e){return this.visit(this.nodes(e,"metadata")[0])}relationTail(e){let t=this.tokens(e,"IDENTIFIER")[0];return{...t?{explicitId:t.image,explicitIdLocation:this.tokenLocation(t)}:{},arrow:this.visit(this.nodes(e,"arrow")[0]),target:this.visit(this.nodes(e,"entityName")[0])}}arrow(e){return this.visit(this.firstNode(e,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(e){return this.nodeLabel(e)}semanticRelation(e){if(this.tokens(e,"GENERALIZATION").length)return{type:"generalization",arrowType:M.SOLID_ARROW,minlen:1};let t=this.tokens(e,"INCLUDE").length?"include":"extend",n=this.tokens(e,t==="include"?"INCLUDE":"EXTEND")[0];return{type:t,arrowType:M.SOLID_ARROW,label:{text:t,type:"text",span:this.tokenSpan(n)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map(t=>this.visit(t)),location:this.ctxLocation(e)}}metadataProperty(e){let t=this.allTokens(e).filter(c=>c.tokenType.name!=="COLON"),n=t[0],i=t[1],r=i.tokenType.name==="TRUE"?!0:i.tokenType.name==="FALSE"?!1:this.decodePlain(i),a=[n.startOffset,(i.endOffset??i.startOffset)+1];return{key:this.decodePlain(n),value:r,span:a,keySpan:this.contentSpan(n),valueSpan:this.contentSpan(i),location:this.tokenLocation(n)}}metadataSeparator(e){}systemBoundaryStatement(e){let t=this.visit(this.nodes(e,"systemBoundaryName")[0]),n=this.nodes(e,"classSuffix")[0],i=n?this.visit(n):{classes:[],spans:[]};t.classes=i.classes,this.builder.addBoundary(t);let r=this.parentBoundary;this.parentBoundary={id:t.id,location:t.location};let a=this.nodes(e,"systemBoundaryContent")[0],c=a?this.visit(a):[];this.parentBoundary=r;let o=this.tokens(e,"END")[0],l=this.nodes(e,"metadata")[0],d=l?this.visit(l):void 0,u={kind:"group",span:[0,0],group:t.id,idSpan:t.location.span,titleSpan:t.label.span,endSpan:this.tokenSpan(o),classSpans:i.spans,...d?{metadata:d.properties.map(({key:p,span:E,keySpan:R,valueSpan:y})=>({key:p,span:E,keySpan:R,valueSpan:y}))}:{},...c.length?{children:c}:{}};return d&&this.builder.addMetadataAssignment(t.id,t.location,d,u),u}systemBoundaryName(e){let t=this.tokens(e,"IDENTIFIER")[0];if(t){let r=this.nodes(e,"nodeLabel")[0];return{id:t.image,label:r?this.visit(r):this.tokenLabel(t),location:this.tokenLocation(t),generated:!1,classes:[]}}let n=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],i=this.tokenLabel(n);return{id:this.generateId(i.text),label:i,location:this.tokenLocation(n),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((n,i)=>(n.location?.startOffset??0)-(i.location?.startOffset??0)).map(n=>this.wrap(n,this.visit(n)))}boundaryElement(e){let t=this.nodes(e,"actorDeclarationOnly")[0];if(t)return this.visit(t);let n=this.nodes(e,"entityName")[0],i=this.visit(n);return i.explicitDeclaration=!0,i.shape??="ellipse",this.builder.addElement(this.entityDraft(i)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(n,i,!0)]}}metadataAssignmentStatement(e){let t=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),n=this.visit(this.nodes(e,"metadata")[0]),i={kind:"metadata",span:[0,0],nodes:[{id:t.id,span:t.location.span,idSpan:t.location.span}],metadata:n.properties.map(({key:r,span:a,keySpan:c,valueSpan:o})=>({key:r,span:a,keySpan:c,valueSpan:o}))};return this.builder.addMetadataAssignment(t.id,t.location,n,i),i}metadataAssignmentTarget(e){let t=this.allTokens(e)[0],n=this.tokenLabel(t);return{id:t.tokenType.name==="IDENTIFIER"?t.image:this.generateId(n.text),location:this.tokenLocation(t)}}noteStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],n=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:t.image,targetLocation:this.tokenLocation(t),label:n,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:n.span,nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}stereotype(e){let t=this.tokens(e,"STEREOTYPE_TEXT")[0];return{value:t.image.trim(),span:this.tokenSpan(t)}}classSuffix(e){let t=this.tokens(e,"IDENTIFIER");return{classes:t.map(n=>n.image),spans:t.map(n=>this.tokenSpan(n))}}jsonStatement(e){let t=this.tokens(e,"JSON_DECLARATION_START")[0],n=this.tokens(e,"JSON_OBJECT_LITERAL")[0],i=/^json[\t ]+(\w+)/.exec(t.image),r=i[1],a=i[0].length-r.length,c={span:[t.startOffset+a,t.startOffset+a+r.length],line:t.startLine??1,column:(t.startColumn??1)+a},o=Hr(n.image,n.startLine??1,n.startColumn??1),l=this.nodes(e,"classSuffix")[0],d=l?this.visit(l):{classes:[],spans:[]},u={id:r,value:o.value,propertyOrder:o.propertyOrder,location:c,classes:d.classes};return this.builder.addJson(u),{kind:"json",span:[0,0],nodes:[{id:r,span:c.span,idSpan:c.span,defines:!0,classSpans:d.spans}],classSpans:d.spans}}directionStatement(e){let t=this.allTokens(e).find(n=>["TD","TB","BT","RL","LR"].includes(n.tokenType.name));return this.builder.setDirection(t.image),{kind:"direction",span:[0,0]}}classDefStatement(e){let t=this.tokens(e,"IDENTIFIER"),n=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(t.map(i=>i.image),n),{kind:"classDef",span:[0,0],ref:t[0].image,refSpan:this.tokenSpan(t[0])}}classStatement(e){let t=this.tokens(e,"IDENTIFIER"),n=1;for(;n<t.length&&this.source.slice((t[n-1].endOffset??t[n-1].startOffset)+1,t[n].startOffset).includes(",");n++);let i=t.slice(0,n).map(a=>({id:a.image,location:this.tokenLocation(a)})),r=t.slice(n).map(a=>a.image);return this.builder.addClassAssignment(i,r),{kind:"classAssign",span:[0,0],ref:r[0],refSpan:this.tokenSpan(t[n]),nodes:i.map(({id:a,location:c})=>({id:a,span:c.span,idSpan:c.span}))}}styleStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],n=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(t.image,this.tokenLocation(t),n),{kind:"style",span:[0,0],nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}styles(e){return this.nodes(e,"styleValue").map(t=>this.visit(t))}styleValue(e){let t=this.allTokens(e),n=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return this.source.slice(n[0],n[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map(t=>t.image).join("")}forwardSolidOperator(e){let t=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:M.SOLID_ARROW,minlen:this.solidMinlen(t)}}backwardSolidOperator(e){let t=this.tokens(e,"BACKWARD_SOLID")[0],n=this.nodes(e,"edgeLabel")[0],i=n?this.tokens(e,"MARKERLESS_SOLID").at(-1):t;return{type:"association",arrowType:M.BACK_ARROW,minlen:this.solidMinlen(i),...n?{label:this.visit(n)}:{}}}markerlessSolidOperator(e){let t=this.nodes(e,"edgeLabel")[0],n=this.allTokens(e);if(!t)return{type:"association",arrowType:M.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};let i=n.at(-1),r=i.tokenType.name==="FORWARD_SOLID"?M.SOLID_ARROW:i.tokenType.name==="FORWARD_CIRCLE"?M.CIRCLE_ARROW:i.tokenType.name==="FORWARD_CROSS"?M.CROSS_ARROW:M.LINE_SOLID;return{type:"association",arrowType:r,label:this.visit(t),minlen:r===M.SOLID_ARROW||r===M.LINE_SOLID?this.solidMinlen(i):1}}forwardCircleOperator(e){return{type:"association",arrowType:M.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:M.CIRCLE_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:M.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:M.CROSS_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}actorDraft(e){return{id:e.id,kind:"actor",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}entityDraft(e){return{id:e.id,kind:"usecase",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.shape?{shape:e.shape}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}endpoint(e,t=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:t,classesOnReference:e.classes.length>0}}relationshipDraft(e,t,n){return{source:this.endpoint(e,!0),target:this.endpoint(t.target),location:n,...t.explicitId?{explicitId:t.explicitId,explicitIdLocation:t.explicitIdLocation}:{},...t.arrow}}actorOccurrence(e,t,n){return{id:t.id,span:this.nodeSpan(e),idSpan:t.location.span,labelSpan:t.label.span,...n?{defines:!0}:{},...t.stereotype?{stereotypeSpan:t.stereotype.span}:{},...t.metadata?{metadata:t.metadata.properties.map(({key:i,span:r,keySpan:a,valueSpan:c})=>({key:i,span:r,keySpan:a,valueSpan:c}))}:{},...t.classSpans.length?{classSpans:t.classSpans}:{}}}entityOccurrence(e,t,n){return this.actorOccurrence(e,t,n)}wrap(e,t){if(t.kind==="blank"||t.kind==="comment")return t;t.span=this.nodeSpan(e);for(let n of t.edges??[])n.span=t.span;return t}tokenLabel(e){let t=e.tokenType.name==="MARKDOWN_STRING"?"markdown":"text",n=t==="markdown"?2:e.tokenType.name==="PLAIN_STRING"?1:0,i=this.tokenSpan(e,n);return{text:this.source.slice(i[0],i[1]),type:t,span:i}}decodePlain(e){return e.tokenType.name==="PLAIN_STRING"?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,e.tokenType.name==="PLAIN_STRING"?1:e.tokenType.name==="MARKDOWN_STRING"?2:0)}generateId(e){return e.replace(/\W/g,"_")}solidMinlen(e){return Math.max(1,(e.image.match(/-/g)?.length??2)-1)}nodeLocation(e){let t=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:t.startLine??1,column:t.startColumn??1}}ctxLocation(e){let t=this.allTokens(e).filter(r=>r.tokenType.name!=="NEWLINE"&&r.tokenType.name!=="EOF"),n=t[0],i=t.at(-1);return{span:[n.startOffset,Math.min(this.source.length,(i.endOffset??i.startOffset+i.image.length-1)+1)],line:n.startLine??1,column:n.startColumn??1}}tokenLocation(e){let t=e.tokenType.name==="PLAIN_STRING"?1:e.tokenType.name==="MARKDOWN_STRING"?2:0;return{span:this.tokenSpan(e,t),line:e.startLine??1,column:(e.startColumn??1)+t}}nodeSpan(e){let t=this.allTokens(e.children).filter(r=>r.tokenType.name!=="NEWLINE"&&r.tokenType.name!=="EOF"),n=t[0],i=t.at(-1);if(!n||!i)throw new Error("Usecase CST node has no source token");return[n.startOffset,Math.min(this.source.length,(i.endOffset??i.startOffset+i.image.length-1)+1)]}tokenSpan(e,t=0){return[e.startOffset+t,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-t)]}nodes(e,t){return(e[t]??[]).filter(n=>"children"in n)}tokens(e,t){return(e[t]??[]).filter(n=>"tokenTypeIdx"in n)}firstNode(e,...t){for(let n of t){let i=this.nodes(e,n)[0];if(i)return i}throw new Error(`Usecase CST is missing one of: ${t.join(", ")}`)}allTokens(e){let t=[];for(let n of Object.values(e))for(let i of n)"tokenTypeIdx"in i?t.push(i):t.push(...this.allTokens(i.children));return t.sort((n,i)=>n.startOffset-i.startOffset)}},h(Qe,"UsecaseVisitor"),Qe),sc=new tc,nc={parse:h(async s=>{Os.clear(),xt.input=[];try{ir({diagramType:"usecase",lexer:jo,parser:xt,entry:h(()=>xt.start(),"entry"),visit:h(e=>sc.build(e,s),"visit")},s)}catch(e){Os.clear();let t=xt.errors[0];if(t){let{token:n}=t,i=ze(n.startOffset)?n.startOffset:s.length,r=ze(n.endOffset)?n.endOffset+1:i,a=ze(n.startLine)?n.startLine:s.slice(0,i).split(/\r\n|\r|\n/).length,c=Math.max(s.lastIndexOf(`
117
+ `,i-1),s.lastIndexOf("\r",i-1)),o=ze(n.startColumn)?n.startColumn:i-c,l=e instanceof Error?e.message:String(e);throw new Error(`${l} at line ${a}, column ${o} [${i},${r})`)}throw e}},"parse")},ic=["point","circle","cross","extension"],Xr={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},tr=h((s,e)=>{let[t,n]=[s,e].map(i=>i.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${t}-${n}`},"usecaseDomId"),rc=h(s=>`usecase-${s.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),Ls=h((s,e)=>e!=="markdown"?s:Mn(s).map(t=>t.map(n=>n.content).join(" ")).join(`
118
+ `),"getAccessibleLabel"),ac=h(s=>{let e=Ls(s.label??s.id,s.labelType);if(Xr[s.shape]){let n=s.actorType&&s.actorType!=="normal"?`${s.actorType} `:"",i=s.business?"business ":"",r=s.stereotype?`, stereotype ${s.stereotype}`:"";return`${i}${n}actor ${e}${r}`}if(s.shape==="note")return`Note for ${s.noteTargetLabel??s.noteTarget??""}: ${e}`;if(s.shape==="usecaseJsonTable"){let n=(s.jsonRows??[]).map(i=>`${i.accessibleKey}: ${i.value}`).join("; ");return n?`${e}: ${n}`:e}let t=s.stereotype?`, stereotype ${s.stereotype}`:"";return`${s.business?"business ":""}use case ${e}${t}`},"getUsecaseNodeAccessibleName"),oc=h(s=>`${s.boundaryType} system boundary ${Ls(s.label??s.id,s.labelType)}`,"getUsecaseBoundaryAccessibleName"),cc=h(s=>s.relationshipType==="note"?"":`${s.relationshipType==="association"&&s.label?`association ${Ls(s.label,s.labelType)}`:s.relationshipType} from ${s.sourceLabel} to ${s.targetLabel}`,"getUsecaseEdgeAccessibleName"),Ve=h(s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"escapePlainLabel"),sr=h(s=>s.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),lc=h((s,e)=>{s.diagramId=e,s.markers=[...ic];for(let t of s.nodes){let n=t;if(n.domId=rc(t.id),t.label!==void 0&&t.labelType==="text"&&(t.label=Ve(t.label)),t.stereotype&&(t.stereotype=Ve(t.stereotype)),!t.isGroup&&t.shape==="usecaseJsonTable"&&(t.jsonRows=t.jsonRows?.map(i=>({...i,key:Ve(i.key),value:Ve(i.value)}))),!t.isGroup&&(t.shape==="usecaseEllipse"||t.shape==="rect")&&t.stereotype){let i=t.label??Ve(t.id);t.label=`\xAB${sr(t.stereotype)}\xBB<br/>${t.labelType==="text"?sr(i):i}`,t.labelType="markdown",n.hasFoldedStereotype=!0,delete t.stereotype}}for(let t of s.edges)t.label!==void 0&&t.labelType==="text"&&(t.label=Ve(t.label));return s},"prepareUsecaseLayoutData"),hc=h((s,e,t)=>{for(let i of e.nodes){let r=typeof i.domId=="string"?i.domId:tr(e.diagramId,i.id),a=s.select(`#${r}`),c=i.isGroup?"boundary":Xr[i.shape]?"actor":i.shape==="note"?"note":i.shape==="usecaseJsonTable"?"json":"usecase",o=t.nodes.get(i.id)??i.id;if(a.attr("data-usecase-id",i.id).attr("data-usecase-kind",c).attr("role","img").attr("aria-label",o),!i.isGroup&&(i.shape==="usecaseEllipse"||i.shape==="rect")&&"hasFoldedStereotype"in i&&i.hasFoldedStereotype===!0){let l=a.node(),d=l?.querySelector(".nodeLabel"),u=d?.querySelector("p")??d,p=u?.firstChild;if(u&&p?.nodeType===3){let E=u.ownerDocument.createElement("span");E.className="usecase-stereotype",u.insertBefore(E,p),E.appendChild(p)}else l?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let n=new Map(e.edges.map(i=>[i.id,i]));s.selectAll('path[data-et="edge"]').each(function(){let i=n.get(this.getAttribute("data-id")??"");if(!i)return;let r=_n(this);r.attr("id",tr(e.diagramId,i.id)).attr("data-usecase-id",i.id).attr("data-usecase-kind",i.internal?"note-connector":"relationship"),i.internal?r.attr("aria-hidden","true"):r.attr("role","img").attr("aria-label",t.edges.get(i.id)??i.id)})},"annotateUsecaseElements"),nr=h((s,e)=>{s.style("--mermaid-usecase-actor-font-size",`${e.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",e.actorFontFamily).style("--mermaid-usecase-actor-font-weight",e.actorFontWeight).style("--mermaid-usecase-font-size",`${e.usecaseFontSize}px`).style("--mermaid-usecase-font-family",e.usecaseFontFamily).style("--mermaid-usecase-font-weight",e.usecaseFontWeight)},"applyUsecaseFonts"),uc=h(async(s,e,t,n)=>{Ln.info("Drawing usecase diagram (unified)",e);let{layout:i}=xs(),r=n.db,a=r.getData(),c=new Map(a.nodes.map(u=>[u.id,Ls(u.label??u.id,u.labelType)])),o={nodes:new Map(a.nodes.map(u=>[u.id,u.isGroup?oc(u):ac(u.shape==="note"?{...u,noteTargetLabel:c.get(u.noteTarget??"")}:u)])),edges:new Map(a.edges.map(u=>[u.id,cc({...u,sourceLabel:c.get(u.source)??u.sourceLabel,targetLabel:c.get(u.target)??u.targetLabel})]))},l=Bn(e,a.config.securityLevel);a.layoutAlgorithm=Fn(i),lc(a,e),nr(l,a),await Dn(a,l),hc(l,a,o);let d=a.diagramPadding;xn.insertTitle(l,"usecaseDiagramTitleText",0,r.getDiagramTitle?.()??""),$n(l,d,"usecaseDiagram",a.useMaxWidth),nr(l,a)},"draw"),dc={draw:uc},pc=h(s=>({actorBkg:s.usecaseActorBkg??s.actorBkg??s.mainBkg,actorBorder:s.usecaseActorBorder??s.actorBorder??s.primaryColor,bkg:s.usecaseBkg??s.mainBkg,border:s.usecaseBorder??s.nodeBorder??s.primaryColor,boundaryBkg:s.usecaseBoundaryBkg??s.clusterBkg,boundaryBorder:s.usecaseBoundaryBorder??s.clusterBorder,includeLine:s.usecaseIncludeLine??s.lineColor,extendLine:s.usecaseExtendLine??s.lineColor}),"roleColors"),fc=h(s=>{let{theme:e,bkgColorArray:t,borderColorArray:n}=s;if(!Un(e,n))return"";let i=Nn().usecase?.colorScheme==="rotate",r=Ue(s.look),a=r==="handDrawn",c=wn(t),o="";for(let l=0;l<Pn(n);l++){let d=n[l],u=c?`fill: ${t[l%t.length]};`:"",p=`[data-look="${r}"][data-color-id="color-${l}"]`;o+=`
119
+
120
+ & ${p}.system-boundary rect.boundary-body,
121
+ & ${p}.system-boundary rect.boundary-tab,
122
+ & ${p}.system-boundary .boundary-body path,
123
+ & ${p}.system-boundary .boundary-tab path {
124
+ stroke: ${d};
125
+ ${u}
126
+ }
127
+ `,i&&(o+=`
128
+
129
+ /* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and
130
+ the business variant.
131
+
132
+ Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws
133
+ the body as a *pair* of paths, an outline stroked in the border colour and a hachure
134
+ fill stroked in the background colour, with no class to tell them apart. Stroking
135
+ both repaints the fill lines as border colour and the shape collapses into a solid
136
+ block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the
137
+ theme's uniform colours, exactly as handDrawn flowchart nodes do. */
138
+ & ${p}.usecase-element ellipse,
139
+ & ${p}.usecase-element rect {
140
+ stroke: ${d};
141
+ ${u}
142
+ }
143
+
144
+ /* The business marker is a single classed path, so it can be reached safely by name --
145
+ without it the marker keeps the uniform border beside a palette-coloured body. No
146
+ \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
147
+ & ${p}.usecase-element .usecase-business-marker {
148
+ stroke: ${d};
149
+ }
150
+
151
+ /* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph
152
+ group, never on its children, so the hollow variant's own \`fill="none"\` keeps
153
+ winning and a hollow actor stays hollow. Same reason as above for not descending
154
+ into the handDrawn paths. */
155
+ & ${p}.usecase-actor .usecase-actor-shape,
156
+ & ${p}.usecase-actor .usecase-actor-hollow,
157
+ & ${p}.usecase-actor .usecase-actor-awesome,
158
+ & ${p}.usecase-actor .usecase-actor-icon {
159
+ stroke: ${d};
160
+ ${u}
161
+ }
162
+ ${a?"":`
163
+ /* The group rule above reaches the glyph by inheritance, which the neo look breaks: it
164
+ ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths,
165
+ and a value set directly on the child always beats one inherited from the parent,
166
+ whatever the parent rule's specificity. So name the children too.
167
+
168
+ Emitted for every look *except* handDrawn, where roughjs draws the glyph as an
169
+ outline path plus a hachure fill path stroked in the fill colour, indistinguishable
170
+ in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no
171
+ \`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */
172
+ & ${p}.usecase-actor .usecase-actor-glyph path,
173
+ & ${p}.usecase-actor .usecase-actor-glyph circle {
174
+ stroke: ${d};
175
+ }
176
+ `}
177
+ `)}return o},"genColor"),mc=h(s=>{let e=pc(s),t=Ue(s.look)==="handDrawn";return`
178
+ ${fc(s)}
179
+ & .usecase-actor {
180
+ color: ${s.actorTextColor??s.primaryTextColor};
181
+ }
182
+
183
+ & .usecase-actor-shape,
184
+ & .usecase-actor-hollow,
185
+ & .usecase-actor-awesome,
186
+ & .usecase-actor-icon {
187
+ fill: ${e.actorBkg};
188
+ stroke: ${e.actorBorder};
189
+ stroke-width: 2px;
190
+ }
191
+ ${t?"":`
192
+ /* The rule above colours the glyph group and lets its children inherit, which the neo
193
+ look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on
194
+ the glyph's own paths, and a value set directly on a child always beats one inherited
195
+ from its parent, whatever the parent rule's specificity. Since neo is the default look,
196
+ without this every actor renders in the node border colour rather than the actor
197
+ colour the rule above asks for.
198
+
199
+ \`.node\` is in the selector to outrank that neo rule rather than tie with it: both
200
+ would otherwise be one attribute plus one class plus one element, leaving the winner to
201
+ depend on which stylesheet is concatenated last.
202
+
203
+ Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */
204
+ & .node.usecase-actor .usecase-actor-glyph path,
205
+ & .node.usecase-actor .usecase-actor-glyph circle {
206
+ stroke: ${e.actorBorder};
207
+ }
208
+ `}
209
+ & .usecase-actor .nodeLabel,
210
+ & .actor-label {
211
+ color: ${s.actorTextColor??s.primaryTextColor};
212
+ fill: ${s.actorTextColor??s.primaryTextColor};
213
+ font-family: var(--mermaid-usecase-actor-font-family, ${s.fontFamily});
214
+ font-size: var(--mermaid-usecase-actor-font-size, 14px);
215
+ font-weight: var(--mermaid-usecase-actor-font-weight, normal);
216
+ }
217
+
218
+ & .usecase-element ellipse,
219
+ & .usecase-element rect,
220
+ & .usecase-business ellipse,
221
+ & .usecase-business rect {
222
+ fill: ${e.bkg};
223
+ stroke: ${e.border};
224
+ stroke-width: 2px;
225
+ }
226
+ ${t?"":`
227
+ /* The same interception the actor glyph hits, one element down: neo ships
228
+ \`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain
229
+ \`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node
230
+ border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no
231
+ equivalent neo rule and is already correct; restating it here costs nothing and means
232
+ the two forms cannot drift apart again.
233
+
234
+ Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than
235
+ tie with it -- on a tie the later stylesheet would win, which is how neo took this in
236
+ the first place. Skipped under handDrawn, where roughjs draws paths and neither element
237
+ exists. */
238
+ & [data-look="${Ue(s.look)}"].node.usecase-element ellipse,
239
+ & [data-look="${Ue(s.look)}"].node.usecase-element rect {
240
+ fill: ${e.bkg};
241
+ stroke: ${e.border};
242
+ }
243
+
244
+ /* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
245
+ way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
246
+ & [data-look="${Ue(s.look)}"].node.usecase-element .usecase-business-marker {
247
+ stroke: ${e.border};
248
+ }
249
+ `}
250
+ & .usecase-element .nodeLabel,
251
+ & .usecase-label {
252
+ color: ${s.primaryTextColor};
253
+ fill: ${s.primaryTextColor};
254
+ font-family: var(--mermaid-usecase-font-family, ${s.fontFamily});
255
+ font-size: var(--mermaid-usecase-font-size, 12px);
256
+ font-weight: var(--mermaid-usecase-font-weight, normal);
257
+ }
258
+
259
+ & .usecase-stereotype,
260
+ & .usecase-business-marker {
261
+ color: ${s.primaryTextColor};
262
+ fill: ${s.primaryTextColor};
263
+ stroke: ${e.border};
264
+ }
265
+
266
+ & .system-boundary rect.boundary-body,
267
+ & .system-boundary rect.boundary-tab,
268
+ & .system-boundary-package-tab {
269
+ fill: ${e.boundaryBkg};
270
+ stroke: ${e.boundaryBorder};
271
+ stroke-width: 1px;
272
+ }
273
+
274
+ & .system-boundary-title text {
275
+ fill: ${s.titleColor??s.primaryTextColor};
276
+ }
277
+
278
+ /* Only the span, never the <p> inside it: the renderer puts a user-supplied
279
+ 'color' on the span, and that has to stay inheritable by its children. */
280
+ & .system-boundary-title span {
281
+ color: ${s.titleColor??s.primaryTextColor};
282
+ }
283
+
284
+ & .usecase-note {
285
+ fill: ${s.noteBkgColor};
286
+ stroke: ${s.noteBorderColor};
287
+ color: ${s.noteTextColor};
288
+ }
289
+
290
+ & .usecase-note .nodeLabel {
291
+ color: ${s.noteTextColor};
292
+ fill: ${s.noteTextColor};
293
+ }
294
+
295
+ & .usecase-json-table,
296
+ & .usecase-json-table rect,
297
+ & .usecase-json-cell {
298
+ fill: ${s.mainBkg};
299
+ stroke: ${s.nodeBorder??s.primaryColor};
300
+ }
301
+
302
+ & .usecase-json-title,
303
+ & .usecase-json-key,
304
+ & .usecase-json-value {
305
+ color: ${s.primaryTextColor};
306
+ fill: ${s.primaryTextColor};
307
+ }
308
+
309
+ & .relationship {
310
+ fill: none;
311
+ stroke: ${s.lineColor};
312
+ }
313
+
314
+ & .relationship-include,
315
+ & .relationship-extend,
316
+ & .relationship-note {
317
+ stroke-dasharray: 3;
318
+ }
319
+
320
+ /* Include and extend are both dashed, which is a weak distinction at small sizes. The
321
+ tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */
322
+ & .relationship-include {
323
+ stroke: ${e.includeLine};
324
+ }
325
+
326
+ & .relationship-extend {
327
+ stroke: ${e.extendLine};
328
+ }
329
+
330
+ & .relationship.edge-animation-fast,
331
+ & .relationship.edge-animation-slow {
332
+ stroke-linecap: round;
333
+ }
334
+
335
+ & .edgeLabel,
336
+ & .edgeLabel p {
337
+ background-color: ${s.edgeLabelBackground};
338
+ }
339
+
340
+ & .labelBkg {
341
+ background-color: ${s.edgeLabelBackground};
342
+ padding: 0 2px;
343
+ }
344
+
345
+ & .edgeLabel .label rect {
346
+ fill: ${s.edgeLabelBackground};
347
+ }
348
+
349
+ & .relationship-label,
350
+ & .edgeLabel {
351
+ color: ${s.primaryTextColor};
352
+ fill: ${s.primaryTextColor};
353
+ font-family: ${s.fontFamily};
354
+ font-size: 10px;
355
+ font-weight: normal;
356
+ }
357
+
358
+ & .marker,
359
+ & .marker.point,
360
+ & .marker.circle,
361
+ & .marker.cross {
362
+ fill: ${s.lineColor};
363
+ stroke: ${s.lineColor};
364
+ }
365
+
366
+ & .marker.extension {
367
+ fill: ${s.mainBkg};
368
+ stroke: ${s.lineColor};
369
+ }
370
+ `},"getStyles"),Ec=mc,ud={parser:nc,db:Os,renderer:dc,styles:Ec};export{ud as diagram};