ompchamber 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (938) hide show
  1. package/README.md +253 -0
  2. package/dist/client/apple-touch-icon.png +0 -0
  3. package/dist/client/icon-192x192.png +0 -0
  4. package/dist/client/icon-512x512.png +0 -0
  5. package/dist/client/icon-maskable-512x512.png +0 -0
  6. package/dist/client/icon.svg +60 -0
  7. package/dist/client/index.html +41 -0
  8. package/dist/client/manifest.webmanifest +38 -0
  9. package/dist/client/static/css/g.f36aa429fa.css +1 -0
  10. package/dist/client/static/css/index.a0f07455bd.css +2 -0
  11. package/dist/client/static/css/katex-vendor.ca3a0600e8.css +1 -0
  12. package/dist/client/static/font/KaTeX_AMS-Regular.1608a09b4a.woff +0 -0
  13. package/dist/client/static/font/KaTeX_AMS-Regular.4aafdb685c.ttf +0 -0
  14. package/dist/client/static/font/KaTeX_AMS-Regular.a79f1c3119.woff2 +0 -0
  15. package/dist/client/static/font/KaTeX_Caligraphic-Bold.b67709187b.woff +0 -0
  16. package/dist/client/static/font/KaTeX_Caligraphic-Bold.cce5b8ecea.ttf +0 -0
  17. package/dist/client/static/font/KaTeX_Caligraphic-Bold.ec17d13264.woff2 +0 -0
  18. package/dist/client/static/font/KaTeX_Caligraphic-Regular.07ef19e7b0.ttf +0 -0
  19. package/dist/client/static/font/KaTeX_Caligraphic-Regular.55fac25845.woff2 +0 -0
  20. package/dist/client/static/font/KaTeX_Caligraphic-Regular.dad44a7fc6.woff +0 -0
  21. package/dist/client/static/font/KaTeX_Fraktur-Bold.9f256b8593.woff +0 -0
  22. package/dist/client/static/font/KaTeX_Fraktur-Bold.b18f59e1d1.ttf +0 -0
  23. package/dist/client/static/font/KaTeX_Fraktur-Bold.d42a5579b0.woff2 +0 -0
  24. package/dist/client/static/font/KaTeX_Fraktur-Regular.7c1871215e.woff +0 -0
  25. package/dist/client/static/font/KaTeX_Fraktur-Regular.d3c882a649.woff2 +0 -0
  26. package/dist/client/static/font/KaTeX_Fraktur-Regular.ed38e79f57.ttf +0 -0
  27. package/dist/client/static/font/KaTeX_Main-Bold.b74a1a8b2c.ttf +0 -0
  28. package/dist/client/static/font/KaTeX_Main-Bold.c3fb5ac22f.woff2 +0 -0
  29. package/dist/client/static/font/KaTeX_Main-Bold.d181c4650d.woff +0 -0
  30. package/dist/client/static/font/KaTeX_Main-BoldItalic.6f2bb1dff2.woff2 +0 -0
  31. package/dist/client/static/font/KaTeX_Main-BoldItalic.70d8b0a530.ttf +0 -0
  32. package/dist/client/static/font/KaTeX_Main-BoldItalic.e3f82f9d27.woff +0 -0
  33. package/dist/client/static/font/KaTeX_Main-Italic.47373d1e51.ttf +0 -0
  34. package/dist/client/static/font/KaTeX_Main-Italic.8916142bec.woff2 +0 -0
  35. package/dist/client/static/font/KaTeX_Main-Italic.9024d815ba.woff +0 -0
  36. package/dist/client/static/font/KaTeX_Main-Regular.0462f03bdf.woff2 +0 -0
  37. package/dist/client/static/font/KaTeX_Main-Regular.7f51fe0340.woff +0 -0
  38. package/dist/client/static/font/KaTeX_Main-Regular.b7f8fe9b5f.ttf +0 -0
  39. package/dist/client/static/font/KaTeX_Math-BoldItalic.572d331f69.woff2 +0 -0
  40. package/dist/client/static/font/KaTeX_Math-BoldItalic.a879cf8383.ttf +0 -0
  41. package/dist/client/static/font/KaTeX_Math-BoldItalic.f1035d8d5d.woff +0 -0
  42. package/dist/client/static/font/KaTeX_Math-Italic.5295ba483a.woff +0 -0
  43. package/dist/client/static/font/KaTeX_Math-Italic.939bc64440.ttf +0 -0
  44. package/dist/client/static/font/KaTeX_Math-Italic.f28c23acad.woff2 +0 -0
  45. package/dist/client/static/font/KaTeX_SansSerif-Bold.8c5b5494b6.woff2 +0 -0
  46. package/dist/client/static/font/KaTeX_SansSerif-Bold.94e1e8dc5f.ttf +0 -0
  47. package/dist/client/static/font/KaTeX_SansSerif-Bold.bf59d231c3.woff +0 -0
  48. package/dist/client/static/font/KaTeX_SansSerif-Italic.3b1e59b3ba.woff2 +0 -0
  49. package/dist/client/static/font/KaTeX_SansSerif-Italic.7c9bc82b17.woff +0 -0
  50. package/dist/client/static/font/KaTeX_SansSerif-Italic.b4c20c84d8.ttf +0 -0
  51. package/dist/client/static/font/KaTeX_SansSerif-Regular.740484788f.woff +0 -0
  52. package/dist/client/static/font/KaTeX_SansSerif-Regular.ba21ed5f84.woff2 +0 -0
  53. package/dist/client/static/font/KaTeX_SansSerif-Regular.d4d7ba4804.ttf +0 -0
  54. package/dist/client/static/font/KaTeX_Script-Regular.03e9641d6f.woff2 +0 -0
  55. package/dist/client/static/font/KaTeX_Script-Regular.0750571032.woff +0 -0
  56. package/dist/client/static/font/KaTeX_Script-Regular.fe9cbbe1a0.ttf +0 -0
  57. package/dist/client/static/font/KaTeX_Size1-Regular.e1e279cbdd.woff +0 -0
  58. package/dist/client/static/font/KaTeX_Size1-Regular.eae34984b3.woff2 +0 -0
  59. package/dist/client/static/font/KaTeX_Size1-Regular.fabc004aab.ttf +0 -0
  60. package/dist/client/static/font/KaTeX_Size2-Regular.577270225e.woff +0 -0
  61. package/dist/client/static/font/KaTeX_Size2-Regular.5916a24fa3.woff2 +0 -0
  62. package/dist/client/static/font/KaTeX_Size2-Regular.d6b476ecd3.ttf +0 -0
  63. package/dist/client/static/font/KaTeX_Size3-Regular.9acaf01c64.woff +0 -0
  64. package/dist/client/static/font/KaTeX_Size3-Regular.a144ef5840.ttf +0 -0
  65. package/dist/client/static/font/KaTeX_Size4-Regular.10d95fd3a2.woff2 +0 -0
  66. package/dist/client/static/font/KaTeX_Size4-Regular.7a996c9da2.woff +0 -0
  67. package/dist/client/static/font/KaTeX_Size4-Regular.fbccdabe0a.ttf +0 -0
  68. package/dist/client/static/font/KaTeX_Typewriter-Regular.6258592bdc.woff +0 -0
  69. package/dist/client/static/font/KaTeX_Typewriter-Regular.a8709e3622.woff2 +0 -0
  70. package/dist/client/static/font/KaTeX_Typewriter-Regular.d97aaf4a1e.ttf +0 -0
  71. package/dist/client/static/font/fira-code-cyrillic-400-normal.5971438a4a.woff2 +0 -0
  72. package/dist/client/static/font/fira-code-cyrillic-400-normal.9bb7bfea9c.woff +0 -0
  73. package/dist/client/static/font/fira-code-cyrillic-500-normal.5486265b18.woff2 +0 -0
  74. package/dist/client/static/font/fira-code-cyrillic-500-normal.89f92bfb31.woff +0 -0
  75. package/dist/client/static/font/fira-code-cyrillic-600-normal.2805b497e5.woff +0 -0
  76. package/dist/client/static/font/fira-code-cyrillic-600-normal.86e0df22a3.woff2 +0 -0
  77. package/dist/client/static/font/fira-code-cyrillic-700-normal.505a88f22a.woff +0 -0
  78. package/dist/client/static/font/fira-code-cyrillic-700-normal.76f5e8d2e2.woff2 +0 -0
  79. package/dist/client/static/font/fira-code-cyrillic-ext-400-normal.3c4b15e57d.woff2 +0 -0
  80. package/dist/client/static/font/fira-code-cyrillic-ext-400-normal.61323debaa.woff +0 -0
  81. package/dist/client/static/font/fira-code-cyrillic-ext-500-normal.0f34210f2a.woff2 +0 -0
  82. package/dist/client/static/font/fira-code-cyrillic-ext-500-normal.2497cfa1aa.woff +0 -0
  83. package/dist/client/static/font/fira-code-cyrillic-ext-600-normal.40fce94af9.woff2 +0 -0
  84. package/dist/client/static/font/fira-code-cyrillic-ext-600-normal.6c8774b829.woff +0 -0
  85. package/dist/client/static/font/fira-code-cyrillic-ext-700-normal.4b742eb865.woff +0 -0
  86. package/dist/client/static/font/fira-code-cyrillic-ext-700-normal.e75eb4fccc.woff2 +0 -0
  87. package/dist/client/static/font/fira-code-greek-400-normal.bb900468b6.woff2 +0 -0
  88. package/dist/client/static/font/fira-code-greek-400-normal.be76e699ba.woff +0 -0
  89. package/dist/client/static/font/fira-code-greek-500-normal.176c9fb001.woff2 +0 -0
  90. package/dist/client/static/font/fira-code-greek-500-normal.d2c596136b.woff +0 -0
  91. package/dist/client/static/font/fira-code-greek-600-normal.490c3deed7.woff +0 -0
  92. package/dist/client/static/font/fira-code-greek-600-normal.7df14376d9.woff2 +0 -0
  93. package/dist/client/static/font/fira-code-greek-700-normal.c82b6072fc.woff2 +0 -0
  94. package/dist/client/static/font/fira-code-greek-700-normal.d5f2b2917b.woff +0 -0
  95. package/dist/client/static/font/fira-code-greek-ext-400-normal.4849a79781.woff +0 -0
  96. package/dist/client/static/font/fira-code-greek-ext-400-normal.7f5bfc4538.woff2 +0 -0
  97. package/dist/client/static/font/fira-code-greek-ext-500-normal.aaccca4075.woff2 +0 -0
  98. package/dist/client/static/font/fira-code-greek-ext-500-normal.e383181256.woff +0 -0
  99. package/dist/client/static/font/fira-code-greek-ext-600-normal.78cb4bff8e.woff +0 -0
  100. package/dist/client/static/font/fira-code-greek-ext-600-normal.d6c93d54f9.woff2 +0 -0
  101. package/dist/client/static/font/fira-code-greek-ext-700-normal.57ec7c92d9.woff +0 -0
  102. package/dist/client/static/font/fira-code-greek-ext-700-normal.8fafdae5e8.woff2 +0 -0
  103. package/dist/client/static/font/fira-code-latin-400-normal.2655b10c55.woff2 +0 -0
  104. package/dist/client/static/font/fira-code-latin-400-normal.973295532b.woff +0 -0
  105. package/dist/client/static/font/fira-code-latin-500-normal.7ae2be8fb8.woff +0 -0
  106. package/dist/client/static/font/fira-code-latin-500-normal.92a991f204.woff2 +0 -0
  107. package/dist/client/static/font/fira-code-latin-600-normal.1dbbe5bc27.woff +0 -0
  108. package/dist/client/static/font/fira-code-latin-600-normal.43788eb7f1.woff2 +0 -0
  109. package/dist/client/static/font/fira-code-latin-700-normal.2667215d33.woff2 +0 -0
  110. package/dist/client/static/font/fira-code-latin-700-normal.497a70148b.woff +0 -0
  111. package/dist/client/static/font/fira-code-latin-ext-400-normal.9dfae29aaf.woff +0 -0
  112. package/dist/client/static/font/fira-code-latin-ext-400-normal.e534ae46e2.woff2 +0 -0
  113. package/dist/client/static/font/fira-code-latin-ext-500-normal.24c7b781b0.woff +0 -0
  114. package/dist/client/static/font/fira-code-latin-ext-500-normal.aad44ab072.woff2 +0 -0
  115. package/dist/client/static/font/fira-code-latin-ext-600-normal.7bed0f2f7e.woff +0 -0
  116. package/dist/client/static/font/fira-code-latin-ext-600-normal.c509a7c9f1.woff2 +0 -0
  117. package/dist/client/static/font/fira-code-latin-ext-700-normal.6c66c8b0a9.woff2 +0 -0
  118. package/dist/client/static/font/fira-code-latin-ext-700-normal.88f64e2822.woff +0 -0
  119. package/dist/client/static/font/fira-code-symbols2-400-normal.97d3f4b17c.woff +0 -0
  120. package/dist/client/static/font/fira-code-symbols2-500-normal.b06f1a06e4.woff +0 -0
  121. package/dist/client/static/font/fira-code-symbols2-600-normal.304b653b93.woff +0 -0
  122. package/dist/client/static/font/fira-code-symbols2-700-normal.d8ce0ad586.woff +0 -0
  123. package/dist/client/static/js/async/0.8e59f2eb5b.js +1 -0
  124. package/dist/client/static/js/async/0k.5852e6b4fa.js +1 -0
  125. package/dist/client/static/js/async/0w.9ed36d5860.js +1 -0
  126. package/dist/client/static/js/async/1.f387c12b63.js +1 -0
  127. package/dist/client/static/js/async/12.d091f91c99.js +1 -0
  128. package/dist/client/static/js/async/13.8f810a8a6c.js +1 -0
  129. package/dist/client/static/js/async/19.6fe909d55a.js +160 -0
  130. package/dist/client/static/js/async/1b.23f1141a38.js +1 -0
  131. package/dist/client/static/js/async/1k.544adbf77d.js +2 -0
  132. package/dist/client/static/js/async/1k.544adbf77d.js.LICENSE.txt +6 -0
  133. package/dist/client/static/js/async/1p.0d5cddda96.js +1 -0
  134. package/dist/client/static/js/async/2.b589f1733b.js +1 -0
  135. package/dist/client/static/js/async/2v.96165101de.js +1 -0
  136. package/dist/client/static/js/async/3.0cacc08423.js +1 -0
  137. package/dist/client/static/js/async/37.b28b2f61cd.js +1 -0
  138. package/dist/client/static/js/async/3d.5085fb913f.js +1 -0
  139. package/dist/client/static/js/async/3j.a2fcea99be.js +2 -0
  140. package/dist/client/static/js/async/3j.a2fcea99be.js.LICENSE.txt +11 -0
  141. package/dist/client/static/js/async/3p.bcf32a0983.js +1 -0
  142. package/dist/client/static/js/async/3r.3a69e98ee0.js +64 -0
  143. package/dist/client/static/js/async/3u.1228460e2a.js +1 -0
  144. package/dist/client/static/js/async/3y.22075aa079.js +198 -0
  145. package/dist/client/static/js/async/3y.22075aa079.js.LICENSE.txt +5 -0
  146. package/dist/client/static/js/async/4.9442eeb472.js +1 -0
  147. package/dist/client/static/js/async/4e.678285ca55.js +1 -0
  148. package/dist/client/static/js/async/4k.33a0c7eeb4.js +1 -0
  149. package/dist/client/static/js/async/4q.aad20dab25.js +1 -0
  150. package/dist/client/static/js/async/5.ebaf8b89cc.js +36 -0
  151. package/dist/client/static/js/async/51.1938cec320.js +2 -0
  152. package/dist/client/static/js/async/51.1938cec320.js.LICENSE.txt +6 -0
  153. package/dist/client/static/js/async/5b.d88304bc13.js +1 -0
  154. package/dist/client/static/js/async/5j.d6407c4248.js +287 -0
  155. package/dist/client/static/js/async/5o.88316d4460.js +62 -0
  156. package/dist/client/static/js/async/6.7929428505.js +1 -0
  157. package/dist/client/static/js/async/66.5dfa29f957.js +93 -0
  158. package/dist/client/static/js/async/69.a18a10882f.js +1 -0
  159. package/dist/client/static/js/async/6o.5b1a06a382.js +1 -0
  160. package/dist/client/static/js/async/7.e4a9288dd0.js +1 -0
  161. package/dist/client/static/js/async/73.50280ce58d.js +1 -0
  162. package/dist/client/static/js/async/7e.a1cc9bfd88.js +1 -0
  163. package/dist/client/static/js/async/7l.7a6a377ecc.js +1 -0
  164. package/dist/client/static/js/async/8.5067439d8c.js +1 -0
  165. package/dist/client/static/js/async/8j.ea110663fb.js +1 -0
  166. package/dist/client/static/js/async/a.bce4542392.js +1 -0
  167. package/dist/client/static/js/async/aa.65d3852576.js +1 -0
  168. package/dist/client/static/js/async/ar.9dc8b1992a.js +2 -0
  169. package/dist/client/static/js/async/ar.9dc8b1992a.js.LICENSE.txt +6 -0
  170. package/dist/client/static/js/async/az.d656062b0f.js +1 -0
  171. package/dist/client/static/js/async/b.b4f6f06515.js +1 -0
  172. package/dist/client/static/js/async/bi.cbfe8eaa8e.js +1 -0
  173. package/dist/client/static/js/async/bq.586bc738d1.js +1 -0
  174. package/dist/client/static/js/async/c.cd45b0ac45.js +1 -0
  175. package/dist/client/static/js/async/c0.0af1e640d3.js +24 -0
  176. package/dist/client/static/js/async/ca.8a52cfd447.js +1 -0
  177. package/dist/client/static/js/async/cf.d34fff5d67.js +1 -0
  178. package/dist/client/static/js/async/ct.38d9da8a5a.js +1 -0
  179. package/dist/client/static/js/async/cx.ca5feec570.js +226 -0
  180. package/dist/client/static/js/async/d.a5fc8fe1b3.js +1 -0
  181. package/dist/client/static/js/async/da.f62c70f6c8.js +1 -0
  182. package/dist/client/static/js/async/dp.1725d6432c.js +1 -0
  183. package/dist/client/static/js/async/e.93214d622b.js +79 -0
  184. package/dist/client/static/js/async/f.ab50467719.js +19 -0
  185. package/dist/client/static/js/async/f.ab50467719.js.LICENSE.txt +12 -0
  186. package/dist/client/static/js/async/f8.bbf0dbae70.js +1 -0
  187. package/dist/client/static/js/async/fw.fb1a08b92d.js +6 -0
  188. package/dist/client/static/js/async/fw.fb1a08b92d.js.LICENSE.txt +6 -0
  189. package/dist/client/static/js/async/h.4e790471e4.js +27 -0
  190. package/dist/client/static/js/async/h1.e8d5aa8e80.js +1 -0
  191. package/dist/client/static/js/async/h3.216e9798ab.js +148 -0
  192. package/dist/client/static/js/async/hd.0da931b622.js +1 -0
  193. package/dist/client/static/js/async/hk.ba7fb04d41.js +1 -0
  194. package/dist/client/static/js/async/hn.7568bdb58b.js +1 -0
  195. package/dist/client/static/js/async/ho.475a5e1ae4.js +1 -0
  196. package/dist/client/static/js/async/hp.e9fe2e395a.js +2 -0
  197. package/dist/client/static/js/async/hp.e9fe2e395a.js.LICENSE.txt +17 -0
  198. package/dist/client/static/js/async/hs.6d480d0ded.js +41 -0
  199. package/dist/client/static/js/async/i.7c148e8440.js +1 -0
  200. package/dist/client/static/js/async/id.573df20f29.js +1 -0
  201. package/dist/client/static/js/async/j.ab925882d8.js +1 -0
  202. package/dist/client/static/js/async/jd.63886a1f09.js +1 -0
  203. package/dist/client/static/js/async/jg.69a4beade8.js +86 -0
  204. package/dist/client/static/js/async/jl.874d352278.js +1 -0
  205. package/dist/client/static/js/async/jll.11313b455a.js +1 -0
  206. package/dist/client/static/js/async/js.67182759ef.js +1 -0
  207. package/dist/client/static/js/async/jsc.23b70d6f40.js +1 -0
  208. package/dist/client/static/js/async/jse.334588ff5d.js +1 -0
  209. package/dist/client/static/js/async/jz.72eb929106.js +77 -0
  210. package/dist/client/static/js/async/k.e878dd350f.js +217 -0
  211. package/dist/client/static/js/async/ka.c1990ecaa3.js +115 -0
  212. package/dist/client/static/js/async/ku.29c8a59d0c.js +1 -0
  213. package/dist/client/static/js/async/ky.8dab1dade0.js +1 -0
  214. package/dist/client/static/js/async/l.102a97fce6.js +104 -0
  215. package/dist/client/static/js/async/l6.45f3b62e15.js +1 -0
  216. package/dist/client/static/js/async/l9.949710adaf.js +83 -0
  217. package/dist/client/static/js/async/l9.949710adaf.js.LICENSE.txt +13 -0
  218. package/dist/client/static/js/async/m.3fc017a055.js +28 -0
  219. package/dist/client/static/js/async/m.3fc017a055.js.LICENSE.txt +6 -0
  220. package/dist/client/static/js/async/me.8ace414f80.js +23 -0
  221. package/dist/client/static/js/async/mt.0352e976d8.js +1 -0
  222. package/dist/client/static/js/async/n.a9f1c51701.js +1 -0
  223. package/dist/client/static/js/async/na.a36cd532d6.js +1 -0
  224. package/dist/client/static/js/async/nk.6de011832e.js +1 -0
  225. package/dist/client/static/js/async/o.36353dfb88.js +1 -0
  226. package/dist/client/static/js/async/oc.9c060c9779.js +8 -0
  227. package/dist/client/static/js/async/og.ae7acf03ac.js +193 -0
  228. package/dist/client/static/js/async/p.48ecfcd14e.js +1 -0
  229. package/dist/client/static/js/async/px.783b6f91f2.js +1 -0
  230. package/dist/client/static/js/async/q.0b6fb9bf8d.js +21 -0
  231. package/dist/client/static/js/async/q.0b6fb9bf8d.js.LICENSE.txt +6 -0
  232. package/dist/client/static/js/async/q5.e683f7c26e.js +286 -0
  233. package/dist/client/static/js/async/qs.2a9ddb3c72.js +1 -0
  234. package/dist/client/static/js/async/r.51010ad87c.js +1 -0
  235. package/dist/client/static/js/async/rd.b77011ab7f.js +2 -0
  236. package/dist/client/static/js/async/rd.b77011ab7f.js.LICENSE.txt +4 -0
  237. package/dist/client/static/js/async/rf.cfbde7f744.js +2 -0
  238. package/dist/client/static/js/async/rf.cfbde7f744.js.LICENSE.txt +6 -0
  239. package/dist/client/static/js/async/s.c7d521a8ae.js +2 -0
  240. package/dist/client/static/js/async/s.c7d521a8ae.js.LICENSE.txt +6 -0
  241. package/dist/client/static/js/async/sy.7345abcd67.js +94 -0
  242. package/dist/client/static/js/async/t.0dcb01dfde.js +1 -0
  243. package/dist/client/static/js/async/t9.d44f57d518.js +1 -0
  244. package/dist/client/static/js/async/ta.973534bbec.js +1 -0
  245. package/dist/client/static/js/async/ty.3d93cf5f5f.js +1 -0
  246. package/dist/client/static/js/async/u.0871ac5b22.js +1 -0
  247. package/dist/client/static/js/async/up.ea990da0ff.js +32 -0
  248. package/dist/client/static/js/async/uw.8890abbabc.js +1 -0
  249. package/dist/client/static/js/async/v.5c7a4b087b.js +1 -0
  250. package/dist/client/static/js/async/vn.e98e2f3b61.js +309 -0
  251. package/dist/client/static/js/async/vp.9b13bf8610.js +1 -0
  252. package/dist/client/static/js/async/vu.311f1d202c.js +34 -0
  253. package/dist/client/static/js/async/w.08ac210f60.js +1 -0
  254. package/dist/client/static/js/async/wt.ad92393a90.js +1 -0
  255. package/dist/client/static/js/async/x.563f72ca6b.js +1 -0
  256. package/dist/client/static/js/async/x0.475516418f.js +1 -0
  257. package/dist/client/static/js/async/x1.da8687159b.js +90 -0
  258. package/dist/client/static/js/async/xl.a3c562a58c.js +1 -0
  259. package/dist/client/static/js/async/xn.afecebbbd9.js +2 -0
  260. package/dist/client/static/js/async/xn.afecebbbd9.js.LICENSE.txt +12 -0
  261. package/dist/client/static/js/async/y.1a9ed7a5d8.js +1 -0
  262. package/dist/client/static/js/async/y6.43c57defe4.js +1 -0
  263. package/dist/client/static/js/async/yb.8c1342401d.js +1 -0
  264. package/dist/client/static/js/async/ybq.4491f2f2dc.js +1 -0
  265. package/dist/client/static/js/async/yg.9bd4e09ecb.js +149 -0
  266. package/dist/client/static/js/async/yq.917ddd7ba2.js +1 -0
  267. package/dist/client/static/js/async/ys.00687cf82d.js +38 -0
  268. package/dist/client/static/js/async/yv.593a3f7d54.js +1 -0
  269. package/dist/client/static/js/async/z.56f61a4374.js +1 -0
  270. package/dist/client/static/js/async/zi.5fdb07b86a.js +24 -0
  271. package/dist/client/static/js/async/zj.654f37e8ff.js +1 -0
  272. package/dist/client/static/js/async/zn.966d6f1cc6.js +1 -0
  273. package/dist/client/static/js/async/zo.26213b40c0.js +1 -0
  274. package/dist/client/static/js/async/zx.e9f4105e00.js +1 -0
  275. package/dist/client/static/js/g.124fba0826.js +139 -0
  276. package/dist/client/static/js/g.124fba0826.js.LICENSE.txt +8 -0
  277. package/dist/client/static/js/index.907fd4670e.js +68 -0
  278. package/dist/client/static/js/index.907fd4670e.js.LICENSE.txt +4 -0
  279. package/dist/client/static/js/katex-vendor.95e48cf65a.js +1 -0
  280. package/dist/client/static/js/markdown-vendor.9da142c67b.js +144 -0
  281. package/dist/client/static/js/shiki-vendor.cb8452ddcd.js +1 -0
  282. package/dist/client/sw.js +15 -0
  283. package/package.json +75 -0
  284. package/src/cli/lib/args.js +233 -0
  285. package/src/cli/lib/commands/logs.js +108 -0
  286. package/src/cli/lib/commands/restart.js +28 -0
  287. package/src/cli/lib/commands/serve.js +109 -0
  288. package/src/cli/lib/commands/status.js +63 -0
  289. package/src/cli/lib/commands/stop.js +63 -0
  290. package/src/cli/lib/commands/update.js +120 -0
  291. package/src/cli/lib/output.js +136 -0
  292. package/src/cli/lib/path-utils.js +48 -0
  293. package/src/cli/lib/path-utils.test.js +71 -0
  294. package/src/cli/lib/paths.js +60 -0
  295. package/src/cli/lib/process-lifecycle.js +110 -0
  296. package/src/cli/lib/runtime.js +280 -0
  297. package/src/cli/ompchamber.js +56 -0
  298. package/src/client/App.tsx +95 -0
  299. package/src/client/bootstrap.d.ts +12 -0
  300. package/src/client/components/common/ComposerPicker.tsx +116 -0
  301. package/src/client/components/common/ComposerTextarea.tsx +131 -0
  302. package/src/client/components/common/CopyButton.tsx +73 -0
  303. package/src/client/components/common/FolderPicker.tsx +270 -0
  304. package/src/client/components/common/MarkdownRenderer.tsx +107 -0
  305. package/src/client/components/common/Modal.tsx +75 -0
  306. package/src/client/components/common/PWAInstallButton.tsx +113 -0
  307. package/src/client/components/common/StatCard.tsx +52 -0
  308. package/src/client/components/common/StreamStatusDot.tsx +28 -0
  309. package/src/client/components/common/SubagentStatusIcon.tsx +27 -0
  310. package/src/client/components/common/Toast.tsx +79 -0
  311. package/src/client/components/common/ToastStack.tsx +18 -0
  312. package/src/client/components/common/ViewportSelector.tsx +206 -0
  313. package/src/client/components/common/code-editor/index.tsx +343 -0
  314. package/src/client/components/common/code-surface/index.tsx +75 -0
  315. package/src/client/components/common/file-icon/brand-paths.ts +62 -0
  316. package/src/client/components/common/file-icon/index.tsx +127 -0
  317. package/src/client/components/common/lazy-panels.tsx +80 -0
  318. package/src/client/components/common/session-state-provider/index.tsx +55 -0
  319. package/src/client/components/common/sort-menu/index.tsx +63 -0
  320. package/src/client/components/common/sort-menu/options.ts +24 -0
  321. package/src/client/components/common/viewport.ts +21 -0
  322. package/src/client/components/common/workspace-options-menu/index.tsx +84 -0
  323. package/src/client/components/layout/RightActivityBar.tsx +95 -0
  324. package/src/client/components/layout/desktop-layout/ResizeHandle.tsx +10 -0
  325. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +94 -0
  326. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +175 -0
  327. package/src/client/components/layout/desktop-layout/index.tsx +280 -0
  328. package/src/client/components/layout/desktop-layout/resizer/index.tsx +344 -0
  329. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +264 -0
  330. package/src/client/components/layout/session-sidebar/Footer.tsx +28 -0
  331. package/src/client/components/layout/session-sidebar/Header.tsx +29 -0
  332. package/src/client/components/layout/session-sidebar/Modals.tsx +209 -0
  333. package/src/client/components/layout/session-sidebar/SessionItem.tsx +145 -0
  334. package/src/client/components/layout/session-sidebar/SessionList.tsx +52 -0
  335. package/src/client/components/layout/session-sidebar/Skeleton.tsx +36 -0
  336. package/src/client/components/layout/session-sidebar/SubagentList.tsx +152 -0
  337. package/src/client/components/layout/session-sidebar/Toolbar.tsx +123 -0
  338. package/src/client/components/layout/session-sidebar/about-modal/SocialLinks.tsx +43 -0
  339. package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +172 -0
  340. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +63 -0
  341. package/src/client/components/layout/session-sidebar/index.tsx +174 -0
  342. package/src/client/components/mobile/LayoutWrapper.tsx +221 -0
  343. package/src/client/components/mobile/MainView.tsx +68 -0
  344. package/src/client/components/mobile/RightSidebar.tsx +217 -0
  345. package/src/client/components/mobile/SessionSidebar.tsx +175 -0
  346. package/src/client/components/mobile/mobile-main-view/Header.tsx +264 -0
  347. package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +80 -0
  348. package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +141 -0
  349. package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +121 -0
  350. package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +69 -0
  351. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +34 -0
  352. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +168 -0
  353. package/src/client/components/mobile/mobile-session-sidebar/List.tsx +53 -0
  354. package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +99 -0
  355. package/src/client/components/mobile/mobile-session-sidebar/Skeleton.tsx +36 -0
  356. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +176 -0
  357. package/src/client/components/settings/LoadingState.tsx +22 -0
  358. package/src/client/components/settings/Modal.tsx +277 -0
  359. package/src/client/components/settings/ProjectSelectorDropdown.tsx +142 -0
  360. package/src/client/components/settings/SettingsSidebarList.tsx +122 -0
  361. package/src/client/components/settings/Sidebar.tsx +153 -0
  362. package/src/client/components/settings/categories/AgentSettings.tsx +84 -0
  363. package/src/client/components/settings/categories/AppearanceSettings.tsx +50 -0
  364. package/src/client/components/settings/categories/BehaviorSettings.tsx +73 -0
  365. package/src/client/components/settings/categories/ChatSettings.tsx +24 -0
  366. package/src/client/components/settings/categories/CommandSettings.tsx +81 -0
  367. package/src/client/components/settings/categories/McpSettings.tsx +142 -0
  368. package/src/client/components/settings/categories/NotificationSettings.tsx +97 -0
  369. package/src/client/components/settings/categories/OmpSettings.tsx +312 -0
  370. package/src/client/components/settings/categories/OtherSettings.tsx +16 -0
  371. package/src/client/components/settings/categories/ProjectSettings.tsx +176 -0
  372. package/src/client/components/settings/categories/ProviderSettings.tsx +146 -0
  373. package/src/client/components/settings/categories/SkillCatalogSettings.tsx +309 -0
  374. package/src/client/components/settings/categories/SkillSettings.tsx +69 -0
  375. package/src/client/components/settings/categories/TokenUsageSettings.tsx +264 -0
  376. package/src/client/components/settings/categories/UsageSettings.tsx +77 -0
  377. package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +333 -0
  378. package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +42 -0
  379. package/src/client/components/settings/categories/behavior-settings/Editor.tsx +244 -0
  380. package/src/client/components/settings/categories/chat-settings/FollowUpSection.tsx +120 -0
  381. package/src/client/components/settings/categories/chat-settings/KeybindingsSection.tsx +107 -0
  382. package/src/client/components/settings/categories/chat-settings/TransportSection.tsx +101 -0
  383. package/src/client/components/settings/categories/command-settings/DetailPane.tsx +292 -0
  384. package/src/client/components/settings/categories/command-settings/SidebarList.tsx +39 -0
  385. package/src/client/components/settings/categories/mcp-settings/ConnectionTest.tsx +89 -0
  386. package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +311 -0
  387. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +161 -0
  388. package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +120 -0
  389. package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +243 -0
  390. package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +61 -0
  391. package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +66 -0
  392. package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +337 -0
  393. package/src/client/components/settings/categories/project-settings/AccentPalette.tsx +76 -0
  394. package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +71 -0
  395. package/src/client/components/settings/categories/project-settings/DetailsHeader.tsx +38 -0
  396. package/src/client/components/settings/categories/project-settings/IconGrid.tsx +152 -0
  397. package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +95 -0
  398. package/src/client/components/settings/categories/project-settings/NameInput.tsx +26 -0
  399. package/src/client/components/settings/categories/project-settings/SidebarList.tsx +100 -0
  400. package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +201 -0
  401. package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +121 -0
  402. package/src/client/components/settings/categories/provider-settings/Header.tsx +22 -0
  403. package/src/client/components/settings/categories/provider-settings/Icons.tsx +35 -0
  404. package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +224 -0
  405. package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +114 -0
  406. package/src/client/components/settings/categories/provider-settings/ModelConfigModal.tsx +155 -0
  407. package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +191 -0
  408. package/src/client/components/settings/categories/provider-settings/ReconnectModal.tsx +163 -0
  409. package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +133 -0
  410. package/src/client/components/settings/categories/skill-catalog/AddSourceModal.tsx +133 -0
  411. package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +210 -0
  412. package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +164 -0
  413. package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +127 -0
  414. package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +74 -0
  415. package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +44 -0
  416. package/src/client/components/settings/categories/usage-settings/DeepSeekCard.tsx +66 -0
  417. package/src/client/components/settings/categories/usage-settings/KenariCard.tsx +68 -0
  418. package/src/client/components/settings/categories/usage-settings/ProviderCard.tsx +52 -0
  419. package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +39 -0
  420. package/src/client/components/settings/categories/usage-settings/QuotaSection.tsx +93 -0
  421. package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +77 -0
  422. package/src/client/components/settings/categories/usage-settings/UsageTable.tsx +66 -0
  423. package/src/client/components/settings/categories/usage-settings/format.ts +63 -0
  424. package/src/client/components/settings/categories/usage-settings/providers.ts +45 -0
  425. package/src/client/components/workspace/SearchPanel.tsx +259 -0
  426. package/src/client/components/workspace/browser-panel/ActivityToasts.tsx +46 -0
  427. package/src/client/components/workspace/browser-panel/AddressBar.tsx +84 -0
  428. package/src/client/components/workspace/browser-panel/Screencast.tsx +109 -0
  429. package/src/client/components/workspace/browser-panel/index.tsx +69 -0
  430. package/src/client/components/workspace/browser-toolbar/ZoomControls.tsx +48 -0
  431. package/src/client/components/workspace/browser-toolbar/index.tsx +140 -0
  432. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +250 -0
  433. package/src/client/components/workspace/chat-timeline/AttachmentChips.tsx +119 -0
  434. package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +121 -0
  435. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +220 -0
  436. package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +94 -0
  437. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +321 -0
  438. package/src/client/components/workspace/chat-timeline/MessageList.tsx +122 -0
  439. package/src/client/components/workspace/chat-timeline/MinimapShortcuts.tsx +47 -0
  440. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +69 -0
  441. package/src/client/components/workspace/chat-timeline/QueueList.tsx +94 -0
  442. package/src/client/components/workspace/chat-timeline/SessionSkeleton.tsx +89 -0
  443. package/src/client/components/workspace/chat-timeline/SubagentView.tsx +148 -0
  444. package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +209 -0
  445. package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +175 -0
  446. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +130 -0
  447. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +130 -0
  448. package/src/client/components/workspace/chat-timeline/ToolCallCard.tsx +291 -0
  449. package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +96 -0
  450. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +83 -0
  451. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +53 -0
  452. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +63 -0
  453. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +49 -0
  454. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +108 -0
  455. package/src/client/components/workspace/chat-timeline/chat-input/access-levels.ts +14 -0
  456. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +341 -0
  457. package/src/client/components/workspace/chat-timeline/index.tsx +290 -0
  458. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/Footer.tsx +97 -0
  459. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/Header.tsx +52 -0
  460. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/Lazy.tsx +24 -0
  461. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/SelectBody.tsx +110 -0
  462. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-dialog/index.tsx +321 -0
  463. package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +92 -0
  464. package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +160 -0
  465. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Ask.tsx +205 -0
  466. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +202 -0
  467. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +223 -0
  468. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Checkpoint.tsx +49 -0
  469. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ContextNotes.tsx +66 -0
  470. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +91 -0
  471. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +288 -0
  472. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +202 -0
  473. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Github.tsx +91 -0
  474. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +247 -0
  475. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Hub.tsx +273 -0
  476. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +276 -0
  477. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +93 -0
  478. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +143 -0
  479. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Memory.tsx +93 -0
  480. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +246 -0
  481. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +96 -0
  482. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchFs.tsx +132 -0
  483. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +317 -0
  484. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +102 -0
  485. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +240 -0
  486. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Think.tsx +52 -0
  487. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +141 -0
  488. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +118 -0
  489. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +150 -0
  490. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput.tsx +107 -0
  491. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +79 -0
  492. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolCardShell.tsx +151 -0
  493. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/read-line-meta.ts +95 -0
  494. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-input.ts +18 -0
  495. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/truncate.ts +18 -0
  496. package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +74 -0
  497. package/src/client/components/workspace/context-panel/LastMessageCard.tsx +34 -0
  498. package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +94 -0
  499. package/src/client/components/workspace/context-panel/RawMessagesList.tsx +293 -0
  500. package/src/client/components/workspace/context-panel/StatsGrid.tsx +64 -0
  501. package/src/client/components/workspace/context-panel/TokenDistributionBar.tsx +62 -0
  502. package/src/client/components/workspace/context-panel/WindowCard.tsx +35 -0
  503. package/src/client/components/workspace/context-panel/index.tsx +142 -0
  504. package/src/client/components/workspace/context-panel/raw-messages.ts +54 -0
  505. package/src/client/components/workspace/diff-panel/SplitView.tsx +165 -0
  506. package/src/client/components/workspace/diff-panel/Toolbar.tsx +177 -0
  507. package/src/client/components/workspace/diff-panel/UnifiedView.tsx +117 -0
  508. package/src/client/components/workspace/diff-panel/index.tsx +213 -0
  509. package/src/client/components/workspace/editor/Tabs.tsx +149 -0
  510. package/src/client/components/workspace/editor/Toolbar.tsx +90 -0
  511. package/src/client/components/workspace/editor/index.tsx +189 -0
  512. package/src/client/components/workspace/file-explorer/GitRepoDropdown.tsx +143 -0
  513. package/src/client/components/workspace/file-explorer/Modals.tsx +236 -0
  514. package/src/client/components/workspace/file-explorer/TreeItem.tsx +289 -0
  515. package/src/client/components/workspace/file-explorer/index.tsx +193 -0
  516. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +188 -0
  517. package/src/client/components/workspace/git-panel/ChangesList.tsx +168 -0
  518. package/src/client/components/workspace/git-panel/CommitBox.tsx +48 -0
  519. package/src/client/components/workspace/git-panel/FileItem.tsx +91 -0
  520. package/src/client/components/workspace/git-panel/Modals.tsx +97 -0
  521. package/src/client/components/workspace/git-panel/RepoHeader.tsx +137 -0
  522. package/src/client/components/workspace/git-panel/TreeItem.tsx +186 -0
  523. package/src/client/components/workspace/git-panel/TreeView.tsx +36 -0
  524. package/src/client/components/workspace/git-panel/commit-modal/CommitActions.tsx +97 -0
  525. package/src/client/components/workspace/git-panel/commit-modal/CommitDiffViewer.tsx +205 -0
  526. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +179 -0
  527. package/src/client/components/workspace/git-panel/commit-modal/GraphCanvas.tsx +164 -0
  528. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +127 -0
  529. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +269 -0
  530. package/src/client/components/workspace/git-panel/index.tsx +326 -0
  531. package/src/client/components/workspace/model-dropdown/Footer.tsx +21 -0
  532. package/src/client/components/workspace/model-dropdown/Header.tsx +50 -0
  533. package/src/client/components/workspace/model-dropdown/Item.tsx +137 -0
  534. package/src/client/components/workspace/model-dropdown/Panel.tsx +146 -0
  535. package/src/client/components/workspace/model-dropdown/Section.tsx +87 -0
  536. package/src/client/components/workspace/model-dropdown/Skeleton.tsx +39 -0
  537. package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +91 -0
  538. package/src/client/components/workspace/model-dropdown/groups.ts +62 -0
  539. package/src/client/components/workspace/model-dropdown/index.tsx +245 -0
  540. package/src/client/components/workspace/model-dropdown/use-catalog.ts +111 -0
  541. package/src/client/components/workspace/terminal-panel/Header.tsx +50 -0
  542. package/src/client/components/workspace/terminal-panel/InputBar.tsx +82 -0
  543. package/src/client/components/workspace/terminal-panel/LogEntry.tsx +70 -0
  544. package/src/client/components/workspace/terminal-panel/QuickActions.tsx +39 -0
  545. package/src/client/components/workspace/terminal-panel/RealtimeXtermView.tsx +340 -0
  546. package/src/client/components/workspace/terminal-panel/index.tsx +110 -0
  547. package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +208 -0
  548. package/src/client/components/workspace/usage-panel/index.tsx +98 -0
  549. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +134 -0
  550. package/src/client/components/workspace/user-browser-panel/Frame.tsx +72 -0
  551. package/src/client/components/workspace/user-browser-panel/index.tsx +87 -0
  552. package/src/client/data/agent-data/builtin.ts +31 -0
  553. package/src/client/data/agent-data/index.ts +10 -0
  554. package/src/client/data/agent-data/orchestrator.ts +113 -0
  555. package/src/client/data/agent-data/specialist.ts +245 -0
  556. package/src/client/data/context-data/index.test.ts +88 -0
  557. package/src/client/data/context-data/index.ts +310 -0
  558. package/src/client/data/context-data/presets.ts +128 -0
  559. package/src/client/data/mock/chat.ts +236 -0
  560. package/src/client/data/mock/git-commits.ts +304 -0
  561. package/src/client/data/mock/subagents.ts +212 -0
  562. package/src/client/data/mock/token-usage.ts +129 -0
  563. package/src/client/data/models/catalog.ts +293 -0
  564. package/src/client/data/samples/dialogue-session.ts +285 -0
  565. package/src/client/data/samples/sample-subagents/scout-raw.ts +341 -0
  566. package/src/client/data/samples/sample-subagents/sleeper-raw.ts +294 -0
  567. package/src/client/data/samples/sample-tools/built-in-part1.ts +265 -0
  568. package/src/client/data/samples/sample-tools/built-in-part2.ts +180 -0
  569. package/src/client/data/samples/sample-tools/other.ts +162 -0
  570. package/src/client/data/samples/subagent-session.ts +99 -0
  571. package/src/client/data/samples/tools-session.ts +85 -0
  572. package/src/client/data/samples/virtual-devices-session.ts +333 -0
  573. package/src/client/data/settings/behavior.ts +12 -0
  574. package/src/client/data/settings/command.ts +188 -0
  575. package/src/client/data/settings/mcp.ts +28 -0
  576. package/src/client/data/settings/omp-schema.json +1 -0
  577. package/src/client/data/settings/project.ts +58 -0
  578. package/src/client/data/settings/provider.ts +185 -0
  579. package/src/client/data/settings/skill.ts +340 -0
  580. package/src/client/data/theme/terminal.ts +150 -0
  581. package/src/client/hooks/browser/use-screencast.ts +178 -0
  582. package/src/client/hooks/browser/use-user-browser.ts +105 -0
  583. package/src/client/hooks/chat/composer/index.ts +181 -0
  584. package/src/client/hooks/chat/composer/items.ts +47 -0
  585. package/src/client/hooks/chat/omp/index.ts +348 -0
  586. package/src/client/hooks/chat/omp/revalidation-throttle.ts +71 -0
  587. package/src/client/hooks/chat/omp/session-list.tsx +148 -0
  588. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +249 -0
  589. package/src/client/hooks/chat/omp/session-statuses.ts +83 -0
  590. package/src/client/hooks/chat/omp/status.ts +31 -0
  591. package/src/client/hooks/chat/omp/stream-poll.ts +37 -0
  592. package/src/client/hooks/chat/omp/stream.ts +108 -0
  593. package/src/client/hooks/chat/stream.ts +228 -0
  594. package/src/client/hooks/chat/subagent/index.ts +290 -0
  595. package/src/client/hooks/chat/timeline/actions.ts +322 -0
  596. package/src/client/hooks/chat/timeline/auto-scroll.ts +58 -0
  597. package/src/client/hooks/chat/timeline/browser-context.ts +40 -0
  598. package/src/client/hooks/chat/timeline/extension-dialog.ts +56 -0
  599. package/src/client/hooks/chat/timeline/index.ts +333 -0
  600. package/src/client/hooks/chat/timeline/queue.ts +87 -0
  601. package/src/client/hooks/chat/timeline/scroll.ts +134 -0
  602. package/src/client/hooks/chat/timeline/send.ts +348 -0
  603. package/src/client/hooks/chat/timeline/session-load.ts +334 -0
  604. package/src/client/hooks/chat/timeline/session-title.ts +40 -0
  605. package/src/client/hooks/chat/timeline/subagent-view.ts +92 -0
  606. package/src/client/hooks/chat/timeline/undo-confirmation.ts +29 -0
  607. package/src/client/hooks/editor/use-file-editor.ts +302 -0
  608. package/src/client/hooks/models/use-model-names.ts +17 -0
  609. package/src/client/hooks/models/use-models-catalog.ts +45 -0
  610. package/src/client/hooks/models/use-provider-names.ts +18 -0
  611. package/src/client/hooks/settings/crud-list.ts +187 -0
  612. package/src/client/hooks/settings/instruction-file.ts +91 -0
  613. package/src/client/hooks/settings/providers.ts +295 -0
  614. package/src/client/hooks/settings/skill-catalog.ts +37 -0
  615. package/src/client/hooks/settings/use-chamber-setting.ts +12 -0
  616. package/src/client/hooks/settings/useUsageReport.ts +41 -0
  617. package/src/client/hooks/ui/clipboard.ts +33 -0
  618. package/src/client/hooks/ui/copy-flag.ts +27 -0
  619. package/src/client/hooks/ui/inline-rename.ts +93 -0
  620. package/src/client/hooks/ui/notification-sound.ts +108 -0
  621. package/src/client/hooks/ui/on-click-outside.ts +22 -0
  622. package/src/client/hooks/ui/open-file.ts +42 -0
  623. package/src/client/hooks/ui/scrollbar-fade.ts +33 -0
  624. package/src/client/hooks/ui/show-more.ts +23 -0
  625. package/src/client/hooks/ui/syntax-ready.ts +17 -0
  626. package/src/client/hooks/ui/theme.ts +76 -0
  627. package/src/client/hooks/ui/toasts.ts +22 -0
  628. package/src/client/hooks/ui/updates.ts +108 -0
  629. package/src/client/hooks/ui/visibility-refresh.ts +66 -0
  630. package/src/client/hooks/ui/window-event.ts +52 -0
  631. package/src/client/hooks/workspace/commit-interactions.ts +111 -0
  632. package/src/client/hooks/workspace/commit-pagination.ts +106 -0
  633. package/src/client/hooks/workspace/file-tabs.ts +136 -0
  634. package/src/client/hooks/workspace/git-status.ts +89 -0
  635. package/src/client/hooks/workspace/git-tree.ts +146 -0
  636. package/src/client/hooks/workspace/panel-refresh.ts +72 -0
  637. package/src/client/hooks/workspace/panel-widths.ts +59 -0
  638. package/src/client/hooks/workspace/search-stream.ts +76 -0
  639. package/src/client/hooks/workspace/session-state/context.ts +15 -0
  640. package/src/client/hooks/workspace/session-state/index.ts +62 -0
  641. package/src/client/hooks/workspace/terminal-output.ts +66 -0
  642. package/src/client/hooks/workspace/terminal.ts +283 -0
  643. package/src/client/hooks/workspace/workspace-folder-actions.ts +110 -0
  644. package/src/client/lib/router/fetcher.ts +100 -0
  645. package/src/client/lib/router/search-params.ts +82 -0
  646. package/src/client/main.tsx +23 -0
  647. package/src/client/tailwind.css +364 -0
  648. package/src/server/db.server.ts +338 -0
  649. package/src/server/index.ts +19 -0
  650. package/src/server/lib/browser/runtime.test.ts +110 -0
  651. package/src/server/lib/browser/runtime.ts +160 -0
  652. package/src/server/lib/chat/session-store.server.ts +61 -0
  653. package/src/server/lib/db/client.ts +55 -0
  654. package/src/server/lib/db/settings-store.ts +148 -0
  655. package/src/server/lib/fs/atomic-write.ts +27 -0
  656. package/src/server/lib/fs/git-diff.ts +116 -0
  657. package/src/server/lib/fs/git-log.ts +174 -0
  658. package/src/server/lib/fs/repo-scope.ts +14 -0
  659. package/src/server/lib/fs/root.ts +77 -0
  660. package/src/server/lib/fs/shell.ts +71 -0
  661. package/src/server/lib/fs/terminal-cwd.ts +49 -0
  662. package/src/server/lib/models/provider-registry.server.ts +269 -0
  663. package/src/server/lib/omp/config/agents.ts +162 -0
  664. package/src/server/lib/omp/config/behavior.ts +113 -0
  665. package/src/server/lib/omp/config/config-cli.ts +94 -0
  666. package/src/server/lib/omp/config/disabled-providers.ts +68 -0
  667. package/src/server/lib/omp/config/extensions.ts +90 -0
  668. package/src/server/lib/omp/config/instructions.ts +81 -0
  669. package/src/server/lib/omp/config/mcp-test.ts +346 -0
  670. package/src/server/lib/omp/config/mcp.ts +258 -0
  671. package/src/server/lib/omp/config/providers.ts +276 -0
  672. package/src/server/lib/omp/config/roles.ts +46 -0
  673. package/src/server/lib/omp/config/skills-catalog.ts +93 -0
  674. package/src/server/lib/omp/config/skills.ts +118 -0
  675. package/src/server/lib/omp/config/yaml.ts +48 -0
  676. package/src/server/lib/omp/core/auth-credentials.ts +87 -0
  677. package/src/server/lib/omp/core/cli.ts +69 -0
  678. package/src/server/lib/omp/core/paths.ts +154 -0
  679. package/src/server/lib/omp/core/registry.ts +140 -0
  680. package/src/server/lib/omp/core/worktree.ts +106 -0
  681. package/src/server/lib/omp/rpc/constants.ts +185 -0
  682. package/src/server/lib/omp/rpc/errors.ts +27 -0
  683. package/src/server/lib/omp/rpc/kill-tree.ts +49 -0
  684. package/src/server/lib/omp/rpc/lines.ts +38 -0
  685. package/src/server/lib/omp/rpc/manager.ts +310 -0
  686. package/src/server/lib/omp/rpc/pending-ui-dialogs.ts +55 -0
  687. package/src/server/lib/omp/rpc/process-helpers.ts +82 -0
  688. package/src/server/lib/omp/rpc/process.ts +319 -0
  689. package/src/server/lib/omp/rpc/session-commands.ts +218 -0
  690. package/src/server/lib/omp/rpc/session-registry.ts +300 -0
  691. package/src/server/lib/omp/rpc/utility.ts +199 -0
  692. package/src/server/lib/omp/rpc/web-state.ts +94 -0
  693. package/src/server/lib/omp/session/files.ts +282 -0
  694. package/src/server/lib/omp/session/locator.ts +60 -0
  695. package/src/server/lib/omp/session/messages.ts +222 -0
  696. package/src/server/lib/omp/session/reader.ts +150 -0
  697. package/src/server/lib/omp/session/sidebar-data.server.ts +195 -0
  698. package/src/server/lib/omp/session/stats.ts +85 -0
  699. package/src/server/lib/omp/session/subagent-presence.ts +74 -0
  700. package/src/server/lib/omp/session/telemetry/compute.ts +188 -0
  701. package/src/server/lib/omp/session/telemetry/format.ts +110 -0
  702. package/src/server/lib/omp/session/telemetry/index.ts +4 -0
  703. package/src/server/lib/omp/session/telemetry/scan.ts +21 -0
  704. package/src/server/lib/omp/session/telemetry-raw.ts +96 -0
  705. package/src/server/lib/omp/session/telemetry.test.ts +154 -0
  706. package/src/server/lib/omp/session/title-slot.ts +203 -0
  707. package/src/server/lib/omp/session/usage.ts +298 -0
  708. package/src/server/lib/omp/subagent/history/fold.ts +196 -0
  709. package/src/server/lib/omp/subagent/history/index.ts +110 -0
  710. package/src/server/lib/omp/subagent/history/paths.ts +29 -0
  711. package/src/server/lib/omp/subagent/history/transcript.test.ts +87 -0
  712. package/src/server/lib/omp/subagent/history/transcript.ts +122 -0
  713. package/src/server/lib/remix-compat.ts +29 -0
  714. package/src/server/lib/route-adapter.ts +144 -0
  715. package/src/server/lib/sse.ts +248 -0
  716. package/src/server/lib/updates/apply.ts +46 -0
  717. package/src/server/lib/updates/check.ts +41 -0
  718. package/src/server/lib/updates/github.ts +71 -0
  719. package/src/server/lib/updates/install-method.ts +73 -0
  720. package/src/server/lib/updates/install.test.ts +74 -0
  721. package/src/server/lib/updates/install.ts +294 -0
  722. package/src/server/lib/updates/omp.ts +86 -0
  723. package/src/server/lib/usage/deepseek.ts +59 -0
  724. package/src/server/lib/usage/kenari.ts +251 -0
  725. package/src/server/lib/usage/provider-key.ts +83 -0
  726. package/src/server/mock.server.ts +33 -0
  727. package/src/server/plugins/compress.ts +51 -0
  728. package/src/server/plugins/dev-assets.ts +49 -0
  729. package/src/server/plugins/ssr.ts +100 -0
  730. package/src/server/plugins/static.ts +81 -0
  731. package/src/server/routes/agent/command.ts +81 -0
  732. package/src/server/routes/agent/events.ts +56 -0
  733. package/src/server/routes/agent/index.ts +12 -0
  734. package/src/server/routes/agent/new.ts +83 -0
  735. package/src/server/routes/agent/prewarm.ts +27 -0
  736. package/src/server/routes/agent/ws.ts +168 -0
  737. package/src/server/routes/browser/index.ts +6 -0
  738. package/src/server/routes/browser/stream.ts +217 -0
  739. package/src/server/routes/chat/index.ts +12 -0
  740. package/src/server/routes/chat/rewind.ts +162 -0
  741. package/src/server/routes/chat/root.ts +78 -0
  742. package/src/server/routes/chat/session.ts +339 -0
  743. package/src/server/routes/chat/stream.ts +111 -0
  744. package/src/server/routes/files/index.ts +10 -0
  745. package/src/server/routes/files/root.ts +29 -0
  746. package/src/server/routes/files/toggle.ts +20 -0
  747. package/src/server/routes/folders/create.ts +98 -0
  748. package/src/server/routes/folders/folder.ts +78 -0
  749. package/src/server/routes/folders/index.ts +16 -0
  750. package/src/server/routes/fs/action.ts +84 -0
  751. package/src/server/routes/fs/git.ts +334 -0
  752. package/src/server/routes/fs/index.ts +19 -0
  753. package/src/server/routes/fs/read.ts +258 -0
  754. package/src/server/routes/fs/replace.ts +69 -0
  755. package/src/server/routes/fs/search.ts +135 -0
  756. package/src/server/routes/fs/validate.ts +61 -0
  757. package/src/server/routes/health/index.ts +6 -0
  758. package/src/server/routes/health/probe.ts +27 -0
  759. package/src/server/routes/index.ts +38 -0
  760. package/src/server/routes/models/index.ts +8 -0
  761. package/src/server/routes/models/roles.ts +31 -0
  762. package/src/server/routes/models/root.ts +328 -0
  763. package/src/server/routes/omp/commands.ts +29 -0
  764. package/src/server/routes/omp/extensions.ts +34 -0
  765. package/src/server/routes/omp/index.ts +20 -0
  766. package/src/server/routes/omp/login.ts +112 -0
  767. package/src/server/routes/omp/plugins.ts +82 -0
  768. package/src/server/routes/omp/pricing.ts +65 -0
  769. package/src/server/routes/omp/session-stats.ts +30 -0
  770. package/src/server/routes/omp/sidebar.ts +40 -0
  771. package/src/server/routes/omp/state.ts +22 -0
  772. package/src/server/routes/sessions/folder.ts +16 -0
  773. package/src/server/routes/sessions/index.ts +25 -0
  774. package/src/server/routes/sessions/list.ts +23 -0
  775. package/src/server/routes/sessions/session.ts +331 -0
  776. package/src/server/routes/sessions/subagents.ts +82 -0
  777. package/src/server/routes/settings/agents.ts +128 -0
  778. package/src/server/routes/settings/behavior.ts +125 -0
  779. package/src/server/routes/settings/commands.ts +89 -0
  780. package/src/server/routes/settings/index.ts +28 -0
  781. package/src/server/routes/settings/mcp-test.ts +71 -0
  782. package/src/server/routes/settings/mcp.ts +261 -0
  783. package/src/server/routes/settings/omp-config.ts +47 -0
  784. package/src/server/routes/settings/projects.ts +84 -0
  785. package/src/server/routes/settings/provider-models.ts +278 -0
  786. package/src/server/routes/settings/providers.ts +137 -0
  787. package/src/server/routes/settings/root.ts +40 -0
  788. package/src/server/routes/settings/skills.ts +175 -0
  789. package/src/server/routes/settings/usage.ts +81 -0
  790. package/src/server/routes/telemetry/context.ts +52 -0
  791. package/src/server/routes/telemetry/index.ts +10 -0
  792. package/src/server/routes/telemetry/raw-messages.ts +80 -0
  793. package/src/server/routes/telemetry/tokens.ts +163 -0
  794. package/src/server/routes/terminal/index.ts +8 -0
  795. package/src/server/routes/terminal/run.ts +135 -0
  796. package/src/server/routes/terminal/stream.ts +100 -0
  797. package/src/server/routes/updates/apply.ts +25 -0
  798. package/src/server/routes/updates/check.ts +27 -0
  799. package/src/server/routes/updates/index.ts +8 -0
  800. package/src/server/routes/well-known/devtools.ts +9 -0
  801. package/src/server/routes/well-known/index.ts +6 -0
  802. package/src/shared/lib/browser/activity.ts +115 -0
  803. package/src/shared/lib/browser/cdp.ts +201 -0
  804. package/src/shared/lib/browser/connection.ts +81 -0
  805. package/src/shared/lib/browser/observer.ts +129 -0
  806. package/src/shared/lib/browser/page-context.ts +20 -0
  807. package/src/shared/lib/browser/targets.test.ts +45 -0
  808. package/src/shared/lib/browser/targets.ts +74 -0
  809. package/src/shared/lib/browser/url.ts +21 -0
  810. package/src/shared/lib/browser/util.ts +20 -0
  811. package/src/shared/lib/browser/viewer.ts +303 -0
  812. package/src/shared/lib/browser/watcher.ts +75 -0
  813. package/src/shared/lib/chat/attachments.ts +62 -0
  814. package/src/shared/lib/chat/capitalize.ts +9 -0
  815. package/src/shared/lib/chat/composer/client.ts +210 -0
  816. package/src/shared/lib/chat/composer/filter.ts +62 -0
  817. package/src/shared/lib/chat/composer/translate.ts +103 -0
  818. package/src/shared/lib/chat/composer/trigger.ts +53 -0
  819. package/src/shared/lib/chat/detect-format.ts +38 -0
  820. package/src/shared/lib/chat/duration.ts +82 -0
  821. package/src/shared/lib/chat/omp/agent-events.test.ts +152 -0
  822. package/src/shared/lib/chat/omp/agent-events.ts +347 -0
  823. package/src/shared/lib/chat/omp/file-mutations.ts +42 -0
  824. package/src/shared/lib/chat/omp/socket.ts +95 -0
  825. package/src/shared/lib/chat/omp/sse.ts +53 -0
  826. package/src/shared/lib/chat/omp/status.ts +45 -0
  827. package/src/shared/lib/chat/omp/transport.ts +50 -0
  828. package/src/shared/lib/chat/order.ts +40 -0
  829. package/src/shared/lib/chat/read-sse.ts +99 -0
  830. package/src/shared/lib/chat/stream-service.ts +273 -0
  831. package/src/shared/lib/chat/task-result-parser.ts +166 -0
  832. package/src/shared/lib/chat/timeline/omp-callbacks.ts +293 -0
  833. package/src/shared/lib/chat/timeline/stream-callbacks.ts +202 -0
  834. package/src/shared/lib/chat/timeline/stream-raf.ts +59 -0
  835. package/src/shared/lib/chat/timeline/tool-phrases.ts +224 -0
  836. package/src/shared/lib/chat/timeline/tool-verbs.ts +160 -0
  837. package/src/shared/lib/chat/timeline/turns.ts +30 -0
  838. package/src/shared/lib/chat/title-case.ts +293 -0
  839. package/src/shared/lib/chat/todo-parser.ts +257 -0
  840. package/src/shared/lib/chat/tool-status.ts +20 -0
  841. package/src/shared/lib/code/ansi.ts +24 -0
  842. package/src/shared/lib/code/editor-utils.ts +16 -0
  843. package/src/shared/lib/code/format.ts +17 -0
  844. package/src/shared/lib/code/highlighter.ts +135 -0
  845. package/src/shared/lib/code/parser.ts +237 -0
  846. package/src/shared/lib/code/shiki-langs.ts +93 -0
  847. package/src/shared/lib/code/shiki-themes.ts +14 -0
  848. package/src/shared/lib/code/syntax-highlight.test.ts +153 -0
  849. package/src/shared/lib/code/syntax-highlight.ts +290 -0
  850. package/src/shared/lib/db/transaction.server.ts +20 -0
  851. package/src/shared/lib/format/number.ts +69 -0
  852. package/src/shared/lib/format/time.ts +39 -0
  853. package/src/shared/lib/fs/diff-parser.ts +135 -0
  854. package/src/shared/lib/fs/file-tree.ts +26 -0
  855. package/src/shared/lib/fs/git-graph.ts +184 -0
  856. package/src/shared/lib/fs/git-status.ts +161 -0
  857. package/src/shared/lib/markdown/marked.ts +228 -0
  858. package/src/shared/lib/markdown/mermaid.ts +153 -0
  859. package/src/shared/lib/markdown/sanitize.ts +138 -0
  860. package/src/shared/lib/models/catalog.ts +88 -0
  861. package/src/shared/lib/models/client.ts +51 -0
  862. package/src/shared/lib/models/identity.ts +21 -0
  863. package/src/shared/lib/models/provider-cleanup.ts +20 -0
  864. package/src/shared/lib/models/provider-connection.ts +41 -0
  865. package/src/shared/lib/models/provider-label.ts +40 -0
  866. package/src/shared/lib/models/provider-models.ts +97 -0
  867. package/src/shared/lib/models/provider-presets.ts +29 -0
  868. package/src/shared/lib/models/remote-list.ts +125 -0
  869. package/src/shared/lib/models/server-cache.ts +27 -0
  870. package/src/shared/lib/models/thinking-levels.ts +68 -0
  871. package/src/shared/lib/omp/config/access-mode.server.ts +27 -0
  872. package/src/shared/lib/omp/config/access-mode.ts +31 -0
  873. package/src/shared/lib/omp/config/schema-extras.ts +230 -0
  874. package/src/shared/lib/omp/config/schema-types.ts +49 -0
  875. package/src/shared/lib/omp/config/schema.ts +81 -0
  876. package/src/shared/lib/omp/rpc/frame.ts +134 -0
  877. package/src/shared/lib/omp/session/default-title.test.ts +50 -0
  878. package/src/shared/lib/omp/session/default-title.ts +51 -0
  879. package/src/shared/lib/omp/session/hashline-patch.test.ts +89 -0
  880. package/src/shared/lib/omp/session/hashline-patch.ts +134 -0
  881. package/src/shared/lib/omp/session/jsonl.ts +197 -0
  882. package/src/shared/lib/omp/session/mapper.ts +145 -0
  883. package/src/shared/lib/omp/session/messages-map.ts +179 -0
  884. package/src/shared/lib/omp/session/messages-parse.ts +69 -0
  885. package/src/shared/lib/omp/session/parse-message-blocks.ts +223 -0
  886. package/src/shared/lib/omp/session/prewarm.ts +41 -0
  887. package/src/shared/lib/omp/session/sidebar.ts +77 -0
  888. package/src/shared/lib/omp/session/stream-state.server.ts +106 -0
  889. package/src/shared/lib/omp/session/telemetry-blocks.ts +60 -0
  890. package/src/shared/lib/omp/session/timestamps.ts +20 -0
  891. package/src/shared/lib/omp/session/turn-error.ts +40 -0
  892. package/src/shared/lib/omp/subagent/history/client.ts +76 -0
  893. package/src/shared/lib/omp/subagent/history/settlement.ts +113 -0
  894. package/src/shared/lib/omp/subagent/history/status.ts +40 -0
  895. package/src/shared/lib/omp/subagent/parse.ts +284 -0
  896. package/src/shared/lib/omp/subagent/result-details.ts +53 -0
  897. package/src/shared/lib/omp/subagent/transcript-client.ts +178 -0
  898. package/src/shared/lib/settings/client.test.ts +62 -0
  899. package/src/shared/lib/settings/client.ts +96 -0
  900. package/src/shared/lib/updates/semver.ts +34 -0
  901. package/src/shared/lib/util/guards.ts +14 -0
  902. package/src/shared/lib/workspace/active-project.ts +42 -0
  903. package/src/shared/lib/workspace/panel-widths.test.ts +72 -0
  904. package/src/shared/lib/workspace/panel-widths.ts +79 -0
  905. package/src/shared/lib/workspace/project-icon.ts +29 -0
  906. package/src/shared/lib/workspace/project-settings-migration.ts +62 -0
  907. package/src/shared/lib/workspace/project-settings.ts +139 -0
  908. package/src/shared/lib/workspace/refresh-cadence.ts +128 -0
  909. package/src/shared/lib/workspace/relative-time.ts +25 -0
  910. package/src/shared/lib/workspace/right-panels.ts +51 -0
  911. package/src/shared/lib/workspace/schema-migrations.ts +19 -0
  912. package/src/shared/lib/workspace/session-state/store.ts +267 -0
  913. package/src/shared/lib/workspace/sidebar-expanded.ts +23 -0
  914. package/src/shared/lib/workspace/sidebar-sort.test.ts +200 -0
  915. package/src/shared/lib/workspace/sidebar-sort.ts +131 -0
  916. package/src/shared/types/browser.ts +58 -0
  917. package/src/shared/types/chat.ts +289 -0
  918. package/src/shared/types/context.ts +87 -0
  919. package/src/shared/types/fs.ts +36 -0
  920. package/src/shared/types/git.ts +60 -0
  921. package/src/shared/types/index.ts +22 -0
  922. package/src/shared/types/omp/agent.ts +109 -0
  923. package/src/shared/types/omp/instructions.ts +38 -0
  924. package/src/shared/types/omp/session.ts +153 -0
  925. package/src/shared/types/omp/subagent.ts +176 -0
  926. package/src/shared/types/settings/agent.ts +16 -0
  927. package/src/shared/types/settings/command.ts +12 -0
  928. package/src/shared/types/settings/mcp.ts +22 -0
  929. package/src/shared/types/settings/project.ts +18 -0
  930. package/src/shared/types/settings/provider.ts +42 -0
  931. package/src/shared/types/settings/skill.ts +35 -0
  932. package/src/shared/types/settings/state.ts +59 -0
  933. package/src/shared/types/settings/usage.ts +99 -0
  934. package/src/shared/types/terminal.ts +19 -0
  935. package/src/shared/types/tokenUsage.ts +44 -0
  936. package/src/shared/types/updates.ts +38 -0
  937. package/src/shared/types/workspace.ts +56 -0
  938. package/tsconfig.json +26 -0
@@ -0,0 +1,309 @@
1
+ "use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["vn"],{WJ(e,t,i){var s=i("Yr"),n=i("M4"),r=i("Gt"),a=(0,r.K)((e,t,i,r)=>{e.attr("class",i);let{width:a,height:c,x:h,y:u}=o(e,t);(0,s.a$)(e,c,a,r);let d=l(h,u,a,c,t);e.attr("viewBox",d),n.R.debug(`viewBox configured: ${d} with padding: ${t}`)},"setupViewPortForSVG"),o=(0,r.K)((e,t)=>{let i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+2*t,height:i.height+2*t,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=(0,r.K)((e,t,i,s,n)=>`${e-n} ${t-n} ${i} ${s}`,"createViewBox");i.d(t,{P:()=>a})},OT(e,t,i){var s=i("Gt"),n=i("El"),r=(0,s.K)((e,t)=>{let i;return"sandbox"===t&&(i=(0,n.Ltv)("#i"+e)),("sandbox"===t?(0,n.Ltv)(i.nodes()[0].contentDocument.body):(0,n.Ltv)("body")).select(`[id="${e}"]`)},"getDiagramElement");i.d(t,{A:()=>r})},Nb(e,t,i){i.d(t,{diagram:()=>lw});var s,n,r,a,o,l,c,h,u,d,p,f,m,T,g,E,y,A,L=i("OT"),S=i("WJ"),O=i("mW");i("Q"),i("ix"),i("LC"),i("bQ"),i("Ut"),i("PF");var b=i("iV");i("h5");var R=i("pK"),k=i("NH"),N=i("Yr"),v=i("M4"),I=i("Gt"),C=function(e,t){for(var i=-1,s=null==e?0:e.length;++i<s&&!1!==t(e[i],i,e););return e},_=function(e,t,i){for(var s=-1,n=Object(e),r=i(e),a=r.length;a--;){var o=r[++s];if(!1===t(n[o],o,n))break}return e},x=function(e,t){for(var i=-1,s=Array(e);++i<e;)s[i]=t(i);return s},U="object"==typeof global&&global&&global.Object===Object&&global,M="object"==typeof self&&self&&self.Object===Object&&self,w=U||M||Function("return this")(),P=w.Symbol,D=Object.prototype,$=D.hasOwnProperty,F=D.toString,B=P?P.toStringTag:void 0,K=function(e){var t=$.call(e,B),i=e[B];try{e[B]=void 0;var s=!0}catch(e){}var n=F.call(e);return s&&(t?e[B]=i:delete e[B]),n},j=Object.prototype.toString,G=P?P.toStringTag:void 0,W=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":G&&G in Object(e)?K(e):j.call(e)},z=function(e){return null!=e&&"object"==typeof e},V=function(e){return z(e)&&"[object Arguments]"==W(e)},H=Object.prototype,Y=H.hasOwnProperty,X=H.propertyIsEnumerable,J=V(function(){return arguments}())?V:function(e){return z(e)&&Y.call(e,"callee")&&!X.call(e,"callee")},q=Array.isArray,Z="object"==typeof exports&&exports&&!exports.nodeType&&exports,Q=Z&&"object"==typeof module&&module&&!module.nodeType&&module,ee=Q&&Q.exports===Z?w.Buffer:void 0,et=(ee?ee.isBuffer:void 0)||function(){return!1},ei=/^(?:0|[1-9]\d*)$/,es=function(e,t){var i=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==i||"symbol"!=i&&ei.test(e))&&e>-1&&e%1==0&&e<t},en=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},er={};er["[object Float32Array]"]=er["[object Float64Array]"]=er["[object Int8Array]"]=er["[object Int16Array]"]=er["[object Int32Array]"]=er["[object Uint8Array]"]=er["[object Uint8ClampedArray]"]=er["[object Uint16Array]"]=er["[object Uint32Array]"]=!0,er["[object Arguments]"]=er["[object Array]"]=er["[object ArrayBuffer]"]=er["[object Boolean]"]=er["[object DataView]"]=er["[object Date]"]=er["[object Error]"]=er["[object Function]"]=er["[object Map]"]=er["[object Number]"]=er["[object Object]"]=er["[object RegExp]"]=er["[object Set]"]=er["[object String]"]=er["[object WeakMap]"]=!1;var ea=function(e){return function(t){return e(t)}},eo="object"==typeof exports&&exports&&!exports.nodeType&&exports,el=eo&&"object"==typeof module&&module&&!module.nodeType&&module,ec=el&&el.exports===eo&&U.process,eh=function(){try{var e=el&&el.require&&el.require("util").types;if(e)return e;return ec&&ec.binding&&ec.binding("util")}catch(e){}}(),eu=eh&&eh.isTypedArray,ed=eu?ea(eu):function(e){return z(e)&&en(e.length)&&!!er[W(e)]},ep=Object.prototype.hasOwnProperty,ef=function(e,t){var i=q(e),s=!i&&J(e),n=!i&&!s&&et(e),r=!i&&!s&&!n&&ed(e),a=i||s||n||r,o=a?x(e.length,String):[],l=o.length;for(var c in e)(t||ep.call(e,c))&&!(a&&("length"==c||n&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||es(c,l)))&&o.push(c);return o},em=Object.prototype,eT=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||em)},eg=function(e,t){return function(i){return e(t(i))}},eE=eg(Object.keys,Object),ey=Object.prototype.hasOwnProperty,eA=function(e){if(!eT(e))return eE(e);var t=[];for(var i in Object(e))ey.call(e,i)&&"constructor"!=i&&t.push(i);return t},eL=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eS=function(e){if(!eL(e))return!1;var t=W(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},eO=function(e){return null!=e&&en(e.length)&&!eS(e)},eb=function(e){return eO(e)?ef(e):eA(e)},eR=(s=function(e,t){return e&&_(e,t,eb)},function(e,t){if(null==e)return e;if(!eO(e))return s(e,t);for(var i=e.length,n=-1,r=Object(e);++n<i&&!1!==t(r[n],n,r););return e}),ek=function(e){return e},eN=function(e,t){return(q(e)?C:eR)(e,"function"==typeof t?t:ek)},ev=function(e,t){for(var i=-1,s=null==e?0:e.length,n=Array(s);++i<s;)n[i]=t(e[i],i,e);return n},eI=function(e){return null==e?[]:ev(eb(e),function(t){return e[t]})},eC=w["__core-js_shared__"],e_=(n=/[^.]+$/.exec(eC&&eC.keys&&eC.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",ex=Function.prototype.toString,eU=function(e){if(null!=e){try{return ex.call(e)}catch(e){}try{return e+""}catch(e){}}return""},eM=/^\[object .+?Constructor\]$/,ew=Object.prototype,eP=Function.prototype.toString,eD=ew.hasOwnProperty,e$=RegExp("^"+eP.call(eD).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),eF=function(e){return!!eL(e)&&(!e_||!(e_ in e))&&(eS(e)?e$:eM).test(eU(e))},eB=function(e,t){var i=null==e?void 0:e[t];return eF(i)?i:void 0},eK=eB(w,"DataView"),ej=eB(w,"Map"),eG=eB(w,"Promise"),eW=eB(w,"Set"),ez=eB(w,"WeakMap"),eV="[object Map]",eH="[object Promise]",eY="[object Set]",eX="[object WeakMap]",eJ="[object DataView]",eq=eU(eK),eZ=eU(ej),eQ=eU(eG),e0=eU(eW),e1=eU(ez),e2=W;(eK&&e2(new eK(new ArrayBuffer(1)))!=eJ||ej&&e2(new ej)!=eV||eG&&e2(eG.resolve())!=eH||eW&&e2(new eW)!=eY||ez&&e2(new ez)!=eX)&&(e2=function(e){var t=W(e),i="[object Object]"==t?e.constructor:void 0,s=i?eU(i):"";if(s)switch(s){case eq:return eJ;case eZ:return eV;case eQ:return eH;case e0:return eY;case e1:return eX}return t});var e3=e2,e6=Object.prototype.hasOwnProperty,e5=function(e){if(null==e)return!0;if(eO(e)&&(q(e)||"string"==typeof e||"function"==typeof e.splice||et(e)||ed(e)||J(e)))return!e.length;var t=e3(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(eT(e))return!eA(e).length;for(var i in e)if(e6.call(e,i))return!1;return!0},e4=function(e,t){return e===t||e!=e&&t!=t},e8=function(e,t){for(var i=e.length;i--;)if(e4(e[i][0],t))return i;return -1},e9=Array.prototype.splice;function e7(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}e7.prototype.clear=function(){this.__data__=[],this.size=0},e7.prototype.delete=function(e){var t=this.__data__,i=e8(t,e);return!(i<0)&&(i==t.length-1?t.pop():e9.call(t,i,1),--this.size,!0)},e7.prototype.get=function(e){var t=this.__data__,i=e8(t,e);return i<0?void 0:t[i][1]},e7.prototype.has=function(e){return e8(this.__data__,e)>-1},e7.prototype.set=function(e,t){var i=this.__data__,s=e8(i,e);return s<0?(++this.size,i.push([e,t])):i[s][1]=t,this};var te=eB(Object,"create"),tt=Object.prototype.hasOwnProperty,ti=Object.prototype.hasOwnProperty;function ts(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}ts.prototype.clear=function(){this.__data__=te?te(null):{},this.size=0},ts.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},ts.prototype.get=function(e){var t=this.__data__;if(te){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return tt.call(t,e)?t[e]:void 0},ts.prototype.has=function(e){var t=this.__data__;return te?void 0!==t[e]:ti.call(t,e)},ts.prototype.set=function(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=te&&void 0===t?"__lodash_hash_undefined__":t,this};var tn=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},tr=function(e,t){var i=e.__data__;return tn(t)?i["string"==typeof t?"string":"hash"]:i.map};function ta(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function to(e){var t=this.__data__=new e7(e);this.size=t.size}function tl(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new ta;++t<i;)this.add(e[t])}ta.prototype.clear=function(){this.size=0,this.__data__={hash:new ts,map:new(ej||e7),string:new ts}},ta.prototype.delete=function(e){var t=tr(this,e).delete(e);return this.size-=!!t,t},ta.prototype.get=function(e){return tr(this,e).get(e)},ta.prototype.has=function(e){return tr(this,e).has(e)},ta.prototype.set=function(e,t){var i=tr(this,e),s=i.size;return i.set(e,t),this.size+=+(i.size!=s),this},to.prototype.clear=function(){this.__data__=new e7,this.size=0},to.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},to.prototype.get=function(e){return this.__data__.get(e)},to.prototype.has=function(e){return this.__data__.has(e)},to.prototype.set=function(e,t){var i=this.__data__;if(i instanceof e7){var s=i.__data__;if(!ej||s.length<199)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new ta(s)}return i.set(e,t),this.size=i.size,this},tl.prototype.add=tl.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},tl.prototype.has=function(e){return this.__data__.has(e)};var tc=function(e,t){for(var i=-1,s=null==e?0:e.length;++i<s;)if(t(e[i],i,e))return!0;return!1},th=function(e,t){return e.has(t)},tu=function(e,t,i,s,n,r){var a=1&i,o=e.length,l=t.length;if(o!=l&&!(a&&l>o))return!1;var c=r.get(e),h=r.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,p=2&i?new tl:void 0;for(r.set(e,t),r.set(t,e);++u<o;){var f=e[u],m=t[u];if(s)var T=a?s(m,f,u,t,e,r):s(f,m,u,e,t,r);if(void 0!==T){if(T)continue;d=!1;break}if(p){if(!tc(t,function(e,t){if(!th(p,t)&&(f===e||n(f,e,i,s,r)))return p.push(t)})){d=!1;break}}else if(!(f===m||n(f,m,i,s,r))){d=!1;break}}return r.delete(e),r.delete(t),d},td=w.Uint8Array,tp=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e,s){i[++t]=[s,e]}),i},tf=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e){i[++t]=e}),i},tm=P?P.prototype:void 0,tT=tm?tm.valueOf:void 0,tg=function(e,t,i,s,n,r,a){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!r(new td(e),new td(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return e4(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var o=tp;case"[object Set]":var l=1&s;if(o||(o=tf),e.size!=t.size&&!l)break;var c=a.get(e);if(c)return c==t;s|=2,a.set(e,t);var h=tu(o(e),o(t),s,n,r,a);return a.delete(e),h;case"[object Symbol]":if(tT)return tT.call(e)==tT.call(t)}return!1},tE=function(e,t){for(var i=-1,s=t.length,n=e.length;++i<s;)e[n+i]=t[i];return e},ty=function(e,t,i){var s=t(e);return q(e)?s:tE(s,i(e))},tA=function(e,t){for(var i=-1,s=null==e?0:e.length,n=0,r=[];++i<s;){var a=e[i];t(a,i,e)&&(r[n++]=a)}return r},tL=function(){return[]},tS=Object.prototype.propertyIsEnumerable,tO=Object.getOwnPropertySymbols,tb=tO?function(e){return null==e?[]:tA(tO(e=Object(e)),function(t){return tS.call(e,t)})}:tL,tR=function(e){return ty(e,eb,tb)},tk=Object.prototype.hasOwnProperty,tN=function(e,t,i,s,n,r){var a=1&i,o=tR(e),l=o.length;if(l!=tR(t).length&&!a)return!1;for(var c=l;c--;){var h=o[c];if(!(a?h in t:tk.call(t,h)))return!1}var u=r.get(e),d=r.get(t);if(u&&d)return u==t&&d==e;var p=!0;r.set(e,t),r.set(t,e);for(var f=a;++c<l;){var m=e[h=o[c]],T=t[h];if(s)var g=a?s(T,m,h,t,e,r):s(m,T,h,e,t,r);if(!(void 0===g?m===T||n(m,T,i,s,r):g)){p=!1;break}f||(f="constructor"==h)}if(p&&!f){var E=e.constructor,y=t.constructor;E!=y&&"constructor"in e&&"constructor"in t&&!("function"==typeof E&&E instanceof E&&"function"==typeof y&&y instanceof y)&&(p=!1)}return r.delete(e),r.delete(t),p},tv="[object Arguments]",tI="[object Array]",tC="[object Object]",t_=Object.prototype.hasOwnProperty,tx=function(e,t,i,s,n,r){var a=q(e),o=q(t),l=a?tI:e3(e),c=o?tI:e3(t);l=l==tv?tC:l,c=c==tv?tC:c;var h=l==tC,u=c==tC,d=l==c;if(d&&et(e)){if(!et(t))return!1;a=!0,h=!1}if(d&&!h)return r||(r=new to),a||ed(e)?tu(e,t,i,s,n,r):tg(e,t,l,i,s,n,r);if(!(1&i)){var p=h&&t_.call(e,"__wrapped__"),f=u&&t_.call(t,"__wrapped__");if(p||f){var m=p?e.value():e,T=f?t.value():t;return r||(r=new to),n(m,T,i,s,r)}}return!!d&&(r||(r=new to),tN(e,t,i,s,n,r))},tU=function e(t,i,s,n,r){return t===i||(null!=t&&null!=i&&(z(t)||z(i))?tx(t,i,s,n,e,r):t!=t&&i!=i)},tM=function(e,t,i,s){var n=i.length,r=n,a=!s;if(null==e)return!r;for(e=Object(e);n--;){var o=i[n];if(a&&o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++n<r;){var l=(o=i[n])[0],c=e[l],h=o[1];if(a&&o[2]){if(void 0===c&&!(l in e))return!1}else{var u=new to;if(s)var d=s(c,h,l,e,t,u);if(!(void 0===d?tU(h,c,3,s,u):d))return!1}}return!0},tw=function(e){return e==e&&!eL(e)},tP=function(e){for(var t=eb(e),i=t.length;i--;){var s=t[i],n=e[s];t[i]=[s,n,tw(n)]}return t},tD=function(e,t){return function(i){return null!=i&&i[e]===t&&(void 0!==t||e in Object(i))}},t$=function(e){var t=tP(e);return 1==t.length&&t[0][2]?tD(t[0][0],t[0][1]):function(i){return i===e||tM(i,e,t)}},tF=function(e){return"symbol"==typeof e||z(e)&&"[object Symbol]"==W(e)},tB=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tK=/^\w*$/,tj=function(e,t){if(q(e))return!1;var i=typeof e;return!!("number"==i||"symbol"==i||"boolean"==i||null==e||tF(e))||tK.test(e)||!tB.test(e)||null!=t&&e in Object(t)};function tG(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var i=function(){var s=arguments,n=t?t.apply(this,s):s[0],r=i.cache;if(r.has(n))return r.get(n);var a=e.apply(this,s);return i.cache=r.set(n,a)||r,a};return i.cache=new(tG.Cache||ta),i}tG.Cache=ta;var tW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tz=/\\(\\)?/g,tV=(a=(r=tG(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(tW,function(e,i,s,n){t.push(s?n.replace(tz,"$1"):i||e)}),t},function(e){return 500===a.size&&a.clear(),e})).cache,r),tH=P?P.prototype:void 0,tY=tH?tH.toString:void 0,tX=function e(t){if("string"==typeof t)return t;if(q(t))return ev(t,e)+"";if(tF(t))return tY?tY.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i},tJ=function(e,t){return q(e)?e:tj(e,t)?[e]:tV(null==e?"":tX(e))},tq=function(e){if("string"==typeof e||tF(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},tZ=function(e,t){t=tJ(t,e);for(var i=0,s=t.length;null!=e&&i<s;)e=e[tq(t[i++])];return i&&i==s?e:void 0},tQ=function(e,t,i){var s=null==e?void 0:tZ(e,t);return void 0===s?i:s},t0=function(e,t){return null!=e&&t in Object(e)},t1=function(e,t,i){t=tJ(t,e);for(var s=-1,n=t.length,r=!1;++s<n;){var a=tq(t[s]);if(!(r=null!=e&&i(e,a)))break;e=e[a]}return r||++s!=n?r:!!(n=null==e?0:e.length)&&en(n)&&es(a,n)&&(q(e)||J(e))},t2=function(e){var t;return tj(e)?(t=tq(e),function(e){return null==e?void 0:e[t]}):function(t){return tZ(t,e)}},t3=function(e){if("function"==typeof e)return e;if(null==e)return ek;if("object"==typeof e){var t,i;return q(e)?(t=e[0],i=e[1],tj(t)&&tw(i)?tD(tq(t),i):function(e){var s=tQ(e,t);return void 0===s&&s===i?null!=e&&t1(e,t,t0):tU(i,s,3)}):t$(e)}return t2(e)},t6=function(e,t){var i=-1,s=eO(e)?Array(e.length):[];return eR(e,function(e,n,r){s[++i]=t(e,n,r)}),s},t5=function(e,t){return(q(e)?ev:t6)(e,t3(t))},t4=Object.prototype.hasOwnProperty,t8=function(e,t){return null!=e&&t4.call(e,t)},t9=function(e,t){return null!=e&&t1(e,t,t8)},t7=function(){try{var e=eB(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ie=function(e,t,i){"__proto__"==t&&t7?t7(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},it=Object.prototype.hasOwnProperty,ii=function(e,t,i){var s=e[t];it.call(e,t)&&e4(s,i)&&(void 0!==i||t in e)||ie(e,t,i)},is=function(e,t,i,s){var n=!i;i||(i={});for(var r=-1,a=t.length;++r<a;){var o=t[r],l=s?s(i[o],e[o],o,i,e):void 0;void 0===l&&(l=e[o]),n?ie(i,o,l):ii(i,o,l)}return i},ir=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t},ia=Object.prototype.hasOwnProperty,io=function(e){if(!eL(e))return ir(e);var t=eT(e),i=[];for(var s in e)"constructor"==s&&(t||!ia.call(e,s))||i.push(s);return i},il=function(e){return eO(e)?ef(e,!0):io(e)},ic="object"==typeof exports&&exports&&!exports.nodeType&&exports,ih=ic&&"object"==typeof module&&module&&!module.nodeType&&module,iu=ih&&ih.exports===ic?w.Buffer:void 0,id=iu?iu.allocUnsafe:void 0,ip=function(e,t){if(t)return e.slice();var i=e.length,s=id?id(i):new e.constructor(i);return e.copy(s),s},im=function(e,t){var i=-1,s=e.length;for(t||(t=Array(s));++i<s;)t[i]=e[i];return t},iT=eg(Object.getPrototypeOf,Object),ig=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tE(t,tb(e)),e=iT(e);return t}:tL,iE=function(e){return ty(e,il,ig)},iy=Object.prototype.hasOwnProperty,iA=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&iy.call(e,"index")&&(i.index=e.index,i.input=e.input),i},iL=function(e){var t=new e.constructor(e.byteLength);return new td(t).set(new td(e)),t},iS=function(e,t){var i=t?iL(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)},iO=/\w*$/,ib=function(e){var t=new e.constructor(e.source,iO.exec(e));return t.lastIndex=e.lastIndex,t},iR=P?P.prototype:void 0,ik=iR?iR.valueOf:void 0,iN=function(e,t){var i=t?iL(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)},iv=function(e,t,i){var s=e.constructor;switch(t){case"[object ArrayBuffer]":return iL(e);case"[object Boolean]":case"[object Date]":return new s(+e);case"[object DataView]":return iS(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return iN(e,i);case"[object Map]":case"[object Set]":return new s;case"[object Number]":case"[object String]":return new s(e);case"[object RegExp]":return ib(e);case"[object Symbol]":return ik?Object(ik.call(e)):{}}},iI=Object.create,iC=function(){function e(){}return function(t){if(!eL(t))return{};if(iI)return iI(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}(),i_=eh&&eh.isMap,ix=i_?ea(i_):function(e){return z(e)&&"[object Map]"==e3(e)},iU=eh&&eh.isSet,iM=iU?ea(iU):function(e){return z(e)&&"[object Set]"==e3(e)},iw="[object Arguments]",iP="[object Function]",iD="[object Object]",i$={};i$[iw]=i$["[object Array]"]=i$["[object ArrayBuffer]"]=i$["[object DataView]"]=i$["[object Boolean]"]=i$["[object Date]"]=i$["[object Float32Array]"]=i$["[object Float64Array]"]=i$["[object Int8Array]"]=i$["[object Int16Array]"]=i$["[object Int32Array]"]=i$["[object Map]"]=i$["[object Number]"]=i$[iD]=i$["[object RegExp]"]=i$["[object Set]"]=i$["[object String]"]=i$["[object Symbol]"]=i$["[object Uint8Array]"]=i$["[object Uint8ClampedArray]"]=i$["[object Uint16Array]"]=i$["[object Uint32Array]"]=!0,i$["[object Error]"]=i$[iP]=i$["[object WeakMap]"]=!1;var iF=function e(t,i,s,n,r,a){var o,l=1&i,c=2&i,h=4&i;if(s&&(o=r?s(t,n,r,a):s(t)),void 0!==o)return o;if(!eL(t))return t;var u=q(t);if(u){if(o=iA(t),!l)return im(t,o)}else{var d,p,f,m,T,g=e3(t),E=g==iP||"[object GeneratorFunction]"==g;if(et(t))return ip(t,l);if(g==iD||g==iw||E&&!r){if(o=c||E||"function"!=typeof(d=t).constructor||eT(d)?{}:iC(iT(d)),!l)return c?(f=(p=o)&&is(t,il(t),p),is(t,ig(t),f)):(T=(m=o)&&is(t,eb(t),m),is(t,tb(t),T))}else{if(!i$[g])return r?t:{};o=iv(t,g,l)}}a||(a=new to);var y=a.get(t);if(y)return y;a.set(t,o),iM(t)?t.forEach(function(n){o.add(e(n,i,s,n,t,a))}):ix(t)&&t.forEach(function(n,r){o.set(r,e(n,i,s,r,t,a))});var A=h?c?iE:tR:c?il:eb,L=u?void 0:A(t);return C(L||t,function(n,r){L&&(n=t[r=n]),ii(o,r,e(n,i,s,r,t,a))}),o},iB=function(e){return iF(e,4)};function iK(e){function t(){}t.prototype=e;let i=new t;function s(){return typeof i.bar}return s(),s(),e}var ij=function(e,t,i){var s=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(i=i>n?n:i)<0&&(i+=n),n=t>i?0:i-t>>>0,t>>>=0;for(var r=Array(n);++s<n;)r[s]=e[s+t];return r},iG=/\s/,iW=function(e){for(var t=e.length;t--&&iG.test(e.charAt(t)););return t},iz=/^\s+/,iV=/^[-+]0x[0-9a-f]+$/i,iH=/^0b[01]+$/i,iY=/^0o[0-7]+$/i,iX=parseInt,iJ=function(e){if("number"==typeof e)return e;if(tF(e))return 0/0;if(eL(e)){var t,i="function"==typeof e.valueOf?e.valueOf():e;e=eL(i)?i+"":i}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)?t.slice(0,iW(t)+1).replace(iz,""):t;var s=iH.test(e);return s||iY.test(e)?iX(e.slice(2),s?2:8):iV.test(e)?0/0:+e},iq=function(e){var t,i=(t=e)?1/0===(t=iJ(t))||-1/0===t?(t<0?-1:1)*17976931348623157e292:t==t?t:0:0===t?t:0,s=i%1;return i==i?s?i-s:i:0},iZ=function(e,t,i){var s=null==e?0:e.length;return s?ij(e,(t=i||void 0===t?1:iq(t))<0?0:t,s):[]},iQ=function(e){return"string"==typeof e||!q(e)&&z(e)&&"[object String]"==W(e)},i0=function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)},i1=Math.max,i2=Date.now,i3=(o=t7?function(e,t){return t7(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:ek,l=0,c=0,function(){var e=i2(),t=16-(e-c);if(c=e,t>0){if(++l>=800)return arguments[0]}else l=0;return o.apply(void 0,arguments)}),i6=function(e,t){var i;return i3((i=i1(void 0===(i=t)?e.length-1:i,0),function(){for(var t=arguments,s=-1,n=i1(t.length-i,0),r=Array(n);++s<n;)r[s]=t[i+s];s=-1;for(var a=Array(i+1);++s<i;)a[s]=t[s];return a[i]=ek(r),i0(e,this,a)}),e+"")},i5=function(e,t,i){if(!eL(i))return!1;var s=typeof t;return("number"==s?!!(eO(i)&&es(t,i.length)):"string"==s&&t in i)&&e4(i[t],e)},i4=Object.prototype.hasOwnProperty,i8=(h=function(e,t){if(eT(t)||eO(t))return void is(t,eb(t),e);for(var i in t)i4.call(t,i)&&ii(e,i,t[i])},i6(function(e,t){var i=-1,s=t.length,n=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(n=h.length>3&&"function"==typeof n?(s--,n):void 0,r&&i5(t[0],t[1],r)&&(n=s<3?void 0:n,s=1),e=Object(e);++i<s;){var a=t[i];a&&h(e,a)}return e})),i9=function(e,t,i,s){if(!eL(e))return e;t=tJ(t,e);for(var n=-1,r=t.length,a=r-1,o=e;null!=o&&++n<r;){var l=tq(t[n]),c=i;if("__proto__"===l||"constructor"===l||"prototype"===l)break;if(n!=a){var h=o[l];void 0===(c=s?s(h,l,o):void 0)&&(c=eL(h)?h:es(t[n+1])?[]:{})}ii(o,l,c),o=o[l]}return e},i7=function(e,t,i){for(var s=-1,n=t.length,r={};++s<n;){var a=t[s],o=tZ(e,a);i(o,a)&&i9(r,tJ(a,e),o)}return r},se=function(e,t){if(null==e)return{};var i=ev(iE(e),function(e){return[e]});return t=t3(t),i7(e,i,function(e,i){return t(e,i[0])})},st=eh&&eh.isRegExp,si=st?ea(st):function(e){return z(e)&&"[object RegExp]"==W(e)};class ss{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),eN(this.definition,t=>{t.accept(e)})}}class sn extends ss{constructor(e){super([]),this.idx=1,i8(this,se(e,e=>void 0!==e))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class sr extends ss{constructor(e){super(e.definition),this.orgText="",i8(this,se(e,e=>void 0!==e))}}class sa extends ss{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,i8(this,se(e,e=>void 0!==e))}}class so extends ss{constructor(e){super(e.definition),this.idx=1,i8(this,se(e,e=>void 0!==e))}}class sl extends ss{constructor(e){super(e.definition),this.idx=1,i8(this,se(e,e=>void 0!==e))}}class sc extends ss{constructor(e){super(e.definition),this.idx=1,i8(this,se(e,e=>void 0!==e))}}class sh extends ss{constructor(e){super(e.definition),this.idx=1,i8(this,se(e,e=>void 0!==e))}}class su extends ss{constructor(e){super(e.definition),this.idx=1,i8(this,se(e,e=>void 0!==e))}}class sd extends ss{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,i8(this,se(e,e=>void 0!==e))}}class sp{constructor(e){this.idx=1,i8(this,se(e,e=>void 0!==e))}accept(e){e.visit(this)}}class sf{visit(e){switch(e.constructor){case sn:return this.visitNonTerminal(e);case sa:return this.visitAlternative(e);case so:return this.visitOption(e);case sl:return this.visitRepetitionMandatory(e);case sc:return this.visitRepetitionMandatoryWithSeparator(e);case su:return this.visitRepetitionWithSeparator(e);case sh:return this.visitRepetition(e);case sd:return this.visitAlternation(e);case sp:return this.visitTerminal(e);case sr:return this.visitRule(e);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){}}var sm=function(e,t){var i;return eR(e,function(e,s,n){return!(i=t(e,s,n))}),!!i},sT=function(e,t,i){var s=q(e)?tc:sm;return i&&i5(e,t,i)&&(t=void 0),s(e,t3(t))},sg=function(e,t,i,s){for(var n=e.length,r=i+(s?1:-1);s?r--:++r<n;)if(t(e[r],r,e))return r;return -1},sE=function(e){return e!=e},sy=function(e,t,i){for(var s=i-1,n=e.length;++s<n;)if(e[s]===t)return s;return -1},sA=function(e,t,i){return t==t?sy(e,t,i):sg(e,sE,i)},sL=Math.max,sS=function(e,t,i,s){e=eO(e)?e:eI(e),i=i&&!s?iq(i):0;var n=e.length;return i<0&&(i=sL(n+i,0)),iQ(e)?i<=n&&e.indexOf(t,i)>-1:!!n&&sA(e,t,i)>-1},sO=function(e,t){for(var i=-1,s=null==e?0:e.length;++i<s;)if(!t(e[i],i,e))return!1;return!0},sb=function(e,t){var i=!0;return eR(e,function(e,s,n){return i=!!t(e,s,n)}),i},sR=function(e,t,i){var s=q(e)?sO:sb;return i&&i5(e,t,i)&&(t=void 0),s(e,t3(t))};function sk(e,t=[]){return e instanceof so||e instanceof sh||e instanceof su||(e instanceof sd?sT(e.definition,e=>sk(e,t)):!(e instanceof sn&&sS(t,e))&&e instanceof ss&&(e instanceof sn&&t.push(e),sR(e.definition,e=>sk(e,t))))}function sN(e){if(e instanceof sn)return"SUBRULE";if(e instanceof so)return"OPTION";if(e instanceof sd)return"OR";if(e instanceof sl)return"AT_LEAST_ONE";if(e instanceof sc)return"AT_LEAST_ONE_SEP";else if(e instanceof su)return"MANY_SEP";else if(e instanceof sh)return"MANY";else if(e instanceof sp)return"CONSUME";else throw Error("non exhaustive match")}class sv{walk(e,t=[]){eN(e.definition,(i,s)=>{let n=iZ(e.definition,s+1);if(i instanceof sn)this.walkProdRef(i,n,t);else if(i instanceof sp)this.walkTerminal(i,n,t);else if(i instanceof sa)this.walkFlat(i,n,t);else if(i instanceof so)this.walkOption(i,n,t);else if(i instanceof sl)this.walkAtLeastOne(i,n,t);else if(i instanceof sc)this.walkAtLeastOneSep(i,n,t);else if(i instanceof su)this.walkManySep(i,n,t);else if(i instanceof sh)this.walkMany(i,n,t);else if(i instanceof sd)this.walkOr(i,n,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,i){}walkProdRef(e,t,i){}walkFlat(e,t,i){let s=t.concat(i);this.walk(e,s)}walkOption(e,t,i){let s=t.concat(i);this.walk(e,s)}walkAtLeastOne(e,t,i){let s=[new so({definition:e.definition})].concat(t,i);this.walk(e,s)}walkAtLeastOneSep(e,t,i){let s=sI(e,t,i);this.walk(e,s)}walkMany(e,t,i){let s=[new so({definition:e.definition})].concat(t,i);this.walk(e,s)}walkManySep(e,t,i){let s=sI(e,t,i);this.walk(e,s)}walkOr(e,t,i){let s=t.concat(i);eN(e.definition,e=>{let t=new sa({definition:[e]});this.walk(t,s)})}}function sI(e,t,i){return[new so({definition:[new sp({terminalType:e.separator})].concat(e.definition)})].concat(t,i)}var sC=function(e,t){return!!(null==e?0:e.length)&&sA(e,t,0)>-1},s_=function(e,t,i){for(var s=-1,n=null==e?0:e.length;++s<n;)if(i(t,e[s]))return!0;return!1},sx=function(){},sU=eW&&1/tf(new eW([,-0]))[1]==1/0?function(e){return new eW(e)}:sx,sM=function(e,t,i){var s=-1,n=sC,r=e.length,a=!0,o=[],l=o;if(i)a=!1,n=s_;else if(r>=200){var c=t?null:sU(e);if(c)return tf(c);a=!1,n=th,l=new tl}else l=t?[]:o;e:for(;++s<r;){var h=e[s],u=t?t(h):h;if(h=i||0!==h?h:0,a&&u==u){for(var d=l.length;d--;)if(l[d]===u)continue e;t&&l.push(u),o.push(h)}else n(l,u,i)||(l!==o&&l.push(u),o.push(h))}return o},sw=function(e){return e&&e.length?sM(e):[]},sP=P?P.isConcatSpreadable:void 0,sD=function(e){return q(e)||J(e)||!!(sP&&e&&e[sP])},s$=function e(t,i,s,n,r){var a=-1,o=t.length;for(s||(s=sD),r||(r=[]);++a<o;){var l=t[a];i>0&&s(l)?i>1?e(l,i-1,s,n,r):tE(r,l):n||(r[r.length]=l)}return r},sF=function(e){return(null==e?0:e.length)?s$(e,1):[]};function sB(e){if(e instanceof sn)return sB(e.referencedRule);if(e instanceof sp)return[e.terminalType];if(e instanceof sa||e instanceof so||e instanceof sh||e instanceof sl||e instanceof sc||e instanceof su||e instanceof sp||e instanceof sr)return function(e){let t,i=[],s=e.definition,n=0,r=s.length>n,a=!0;for(;r&&a;)a=sk(t=s[n]),i=i.concat(sB(t)),n+=1,r=s.length>n;return sw(i)}(e);if(e instanceof sd)return sw(sF(t5(e.definition,e=>sB(e))));throw Error("non exhaustive match")}class sK extends sv{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,i){}walkProdRef(e,t,i){var s,n;let r=(s=e.referencedRule,n=e.idx,s.name+n+"_~IN~_"+this.topProd.name),a=sB(new sa({definition:t.concat(i)}));this.follows[r]=a}}var sj=function(e){return void 0===e};function sG(e){return e.charCodeAt(0)}function sW(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function sz(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function sV(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function sH(){throw Error("Internal Error - Should never get here!")}function sY(e){return"Character"===e.type}let sX=[];for(let e=sG("0");e<=sG("9");e++)sX.push(e);let sJ=[sG("_")].concat(sX);for(let e=sG("a");e<=sG("z");e++)sJ.push(e);for(let e=sG("A");e<=sG("Z");e++)sJ.push(e);let sq=[sG(" "),sG("\f"),sG("\n"),sG("\r"),sG(" "),sG("\v"),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG(" "),sG("\u2028"),sG("\u2029"),sG(" "),sG(" "),sG(" "),sG("\uFEFF")],sZ=/[0-9a-fA-F]/,sQ=/[0-9]/,s0=/[1-9]/;class s1{visitChildren(e){for(let t in e){let i=e[t];e.hasOwnProperty(t)&&(void 0!==i.type?this.visit(i):Array.isArray(i)&&i.forEach(e=>{this.visit(e)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}var s2=Object.prototype,s3=s2.hasOwnProperty,s6=i6(function(e,t){e=Object(e);var i=-1,s=t.length,n=s>2?t[2]:void 0;for(n&&i5(t[0],t[1],n)&&(s=1);++i<s;)for(var r=t[i],a=il(r),o=-1,l=a.length;++o<l;){var c=a[o],h=e[c];(void 0===h||e4(h,s2[c])&&!s3.call(e,c))&&(e[c]=r[c])}return e}),s5=function(e,t){var i=[];return eR(e,function(e,s,n){t(e,s,n)&&i.push(e)}),i},s4=function(e){if("function"!=typeof e)throw TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}},s8=function(e,t){return(q(e)?tA:s5)(e,s4(t3(t)))},s9=Math.max,s7=function(e,t,i){var s=null==e?0:e.length;if(!s)return -1;var n=null==i?0:iq(i);return n<0&&(n=s9(s+n,0)),sA(e,t,n)},ne=function(e,t,i,s){var n=-1,r=null==e?0:e.length;for(s&&r&&(i=e[++n]);++n<r;)i=t(i,e[n],n,e);return i},nt=function(e,t,i,s,n){return n(e,function(e,n,r){i=s?(s=!1,e):t(i,e,n,r)}),i},ni=function(e,t,i){var s=q(e)?ne:nt,n=arguments.length<3;return s(e,t3(t),i,n,eR)},ns=function(e,t){return(q(e)?tA:s5)(e,t3(t))},nn=function(e,t,i,s){var n=-1,r=sC,a=!0,o=e.length,l=[],c=t.length;if(!o)return l;i&&(t=ev(t,ea(i))),s?(r=s_,a=!1):t.length>=200&&(r=th,a=!1,t=new tl(t));e:for(;++n<o;){var h=e[n],u=null==i?h:i(h);if(h=s||0!==h?h:0,a&&u==u){for(var d=c;d--;)if(t[d]===u)continue e;l.push(h)}else r(t,u,s)||l.push(h)}return l},nr=function(e){return z(e)&&eO(e)},na=i6(function(e,t){return nr(e)?nn(e,s$(t,1,nr,!0)):[]}),no=function(e){for(var t=-1,i=null==e?0:e.length,s=0,n=[];++t<i;){var r=e[t];r&&(n[s++]=r)}return n},nl=function(e){return e&&e.length?e[0]:void 0},nc=Math.max,nh=(u=function(e,t,i){var s=null==e?0:e.length;if(!s)return -1;var n=null==i?0:iq(i);return n<0&&(n=nc(s+n,0)),sg(e,t3(t),n)},function(e,t,i){var s=Object(e);if(!eO(e)){var n=t3(t);e=eb(e),t=function(e){return n(s[e],e,s)}}var r=u(e,t,i);return r>-1?s[n?e[r]:r]:void 0});function nu(e){console&&console.error&&console.error(`Error: ${e}`)}function nd(e){console&&console.warn&&console.warn(`Warning: ${e}`)}let np={},nf=new 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 i={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":sz(i,"global");break;case"i":sz(i,"ignoreCase");break;case"m":sz(i,"multiLine");break;case"u":sz(i,"unicode");break;case"y":sz(i,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:i,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"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}}sV(t);let i=this.disjunction();return this.consumeChar(")"),{type:t,value:i,loc:this.loc(e)}}return sH()}quantifier(e=!1){let t,i=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 s=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:s,atMost:s};break;case",":t=this.isDigit()?{atLeast:s,atMost:this.integerIncludingZero()}:{atLeast:s,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;sV(t)}if((!0!==e||void 0!==t)&&sV(t))return"?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(i),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()}return(void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),sV(e))?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):sH()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[sG("\n"),sG("\r"),sG("\u2028"),sG("\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=sX;break;case"D":e=sX,t=!0;break;case"s":e=sq;break;case"S":e=sq,t=!0;break;case"w":e=sJ;break;case"W":e=sJ,t=!0}return sV(e)?{type:"Set",value:e,complement:t}:sH()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=sG("\f");break;case"n":e=sG("\n");break;case"r":e=sG("\r");break;case"t":e=sG(" ");break;case"v":e=sG("\v")}return sV(e)?{type:"Character",value:e}:sH()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:sG("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:sG(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:sG(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,sY(t)&&this.isRangeDash()){this.consumeChar("-");let i=this.classAtom();if(i.type,sY(i)){if(i.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:i.value})}else sW(t.value,e),e.push(sG("-")),sW(i.value,e)}else sW(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:sG("\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 i={type:"Group",capturing:e,value:t};return e&&(i.idx=this.groupIdx),i}positiveInteger(){let e=this.popChar();if(!1===s0.test(e))throw Error("Expecting a positive integer");for(;sQ.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===sQ.test(e))throw Error("Expecting an integer");for(;sQ.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case"\n":case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:sG(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 sQ.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return"?"===this.peekChar(1)&&("="===this.peekChar(2)||"!"===this.peekChar(2)||"<"===this.peekChar(2)&&("="===this.peekChar(3)||"!"===this.peekChar(3)));default:return!1}}isQuantifier(){let e=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let i=0;i<e;i++){let e=this.popChar();if(!1===sZ.test(e))throw Error("Expecting a HexDecimal digits");t+=e}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(void 0!==e&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}};function nm(e){let t=e.toString();if(np.hasOwnProperty(t))return np[t];{let e=nf.pattern(t);return np[t]=e,e}}let nT="Complement Sets are not supported for first char optimization",ng='Unable to use "first char" lexer optimizations:\n';function nE(e,t,i){let s=nw(e);t[s]=s,!0===i&&function(e,t){let i=String.fromCharCode(e),s=i.toUpperCase();if(s!==i){let e=nw(s.charCodeAt(0));t[e]=e}else{let e=i.toLowerCase();if(e!==i){let i=nw(e.charCodeAt(0));t[i]=i}}}(e,t)}function ny(e,t){return nh(e.value,e=>"number"==typeof e?sS(t,e):void 0!==nh(t,t=>e.from<=t&&t<=e.to))}class nA extends s1{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){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){sS(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===ny(e,this.targetCharCodes)&&(this.found=!0):void 0!==ny(e,this.targetCharCodes)&&(this.found=!0)}}function nL(e,t){if(!(t instanceof RegExp))return void 0!==nh(t,t=>sS(e,t.charCodeAt(0)));{let i=nm(t),s=new nA(e);return s.visit(i),s.found}}let nS="PATTERN",nO="defaultMode",nb="modes",nR=/[^\\][$]/,nk=/[^\\[][\^]|^\^/;function nN(e){let t=e.ignoreCase?"iy":"y";return RegExp(`${e.source}`,t)}function nv(e){let t=e.PATTERN;if(si(t))return!1;if(eS(t))return!0;if(t9(t,"exec"))return!0;if(iQ(t))return!1;throw Error("non exhaustive match")}function nI(e){return!!iQ(e)&&1===e.length&&e.charCodeAt(0)}let nC={test:function(e){let t=e.length;for(let i=this.lastIndex;i<t;i++){let t=e.charCodeAt(i);if(10===t)return this.lastIndex=i+1,!0;if(13===t)return 10===e.charCodeAt(i+1)?this.lastIndex=i+2:this.lastIndex=i+1,!0}return!1},lastIndex:0};function n_(e,t){if(t9(e,"LINE_BREAKS"))return!1;if(si(e.PATTERN)){try{nL(t,e.PATTERN)}catch(e){return{issue:g.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(iQ(e.PATTERN))return!1;if(nv(e))return{issue:g.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function nx(e){return t5(e,e=>iQ(e)?e.charCodeAt(0):e)}function nU(e,t,i){void 0===e[t]?e[t]=[i]:e[t].push(i)}let nM=[];function nw(e){return e<256?e:nM[e]}var nP=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};function nD(e){let t=new Date().getTime(),i=e();return{time:new Date().getTime()-t,value:i}}function n$(e,t){let i=e.tokenTypeIdx;return i===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[i]}function nF(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let nB=1,nK={};function nj(e){let t=function(e){let t=iB(e),i=e,s=!0;for(;s;){let e=na(i=no(sF(t5(i,e=>e.CATEGORIES))),t);t=t.concat(e),e5(e)?s=!1:i=e}return t}(e);eN(t,e=>{nG(e)||(nK[nB]=e,e.tokenTypeIdx=nB++),nW(e)&&!q(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),nW(e)||(e.CATEGORIES=[]),t9(e,"categoryMatches")||(e.categoryMatches=[]),t9(e,"categoryMatchesMap")||(e.categoryMatchesMap={})}),eN(t,e=>{!function e(t,i){eN(t,e=>{i.categoryMatchesMap[e.tokenTypeIdx]=!0}),eN(i.CATEGORIES,s=>{let n=t.concat(i);sS(n,s)||e(n,s)})}([],e)}),eN(t,e=>{e.categoryMatches=[],eN(e.categoryMatchesMap,(t,i)=>{e.categoryMatches.push(nK[i].tokenTypeIdx)})}),eN(t,e=>{e.isParent=e.categoryMatches.length>0})}function nG(e){return t9(e,"tokenTypeIdx")}function nW(e){return t9(e,"CATEGORIES")}function nz(e){return t9(e,"tokenTypeIdx")}(d=g||(g={}))[d.MISSING_PATTERN=0]="MISSING_PATTERN",d[d.INVALID_PATTERN=1]="INVALID_PATTERN",d[d.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",d[d.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",d[d.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",d[d.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",d[d.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",d[d.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",d[d.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",d[d.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",d[d.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",d[d.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",d[d.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",d[d.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",d[d.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",d[d.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",d[d.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",d[d.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";let nV={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:{buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,i,s,n,r)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${i} characters.`},traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(nV);class nH{constructor(e,t=nV){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0!==this.traceInitPerf)return t();{this.traceInitIndent++;let i=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${i}--\x3e <${e}>`);let{time:s,value:n}=nD(t),r=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&r(`${i}<-- <${e}> time: ${s}ms`),this.traceInitIndent--,n}},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=i8({},nV,t);let i=this.config.traceInitPerf;!0===i?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof i&&(this.traceInitMaxIdent=i,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===nV.lineTerminatorsPattern)this.config.lineTerminatorsPattern=nC;else if(this.config.lineTerminatorCharacters===nV.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n 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),q(e)?i={modes:{defaultMode:iB(e)},defaultMode:nO}:(s=!1,i=iB(e))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{var e;let t;this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat((e=i,this.trackStartLines,this.config.lineTerminatorCharacters,t=[],t9(e,nO)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+nO+"> property in its definition\n",type:g.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),t9(e,nb)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+nb+"> property in its definition\n",type:g.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),t9(e,nb)&&t9(e,nO)&&!t9(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${nO}: <${e.defaultMode}>which does not exist
2
+ `,type:g.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),t9(e,nb)&&eN(e.modes,(e,i)=>{eN(e,(s,n)=>{sj(s)?t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${n}>
3
+ `,type:g.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):t9(s,"LONGER_ALT")&&eN(q(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT],n=>{sj(n)||sS(e,n)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${n.name}> on token <${s.name}> outside of mode <${i}>
4
+ `,type:g.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),t))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{var e,t,s;let n,r,a,o;this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat((e=i,t=this.trackStartLines,s=this.config.lineTerminatorCharacters,n=[],r=!1,a=s8(no(sF(eI(e.modes))),e=>e[nS]===nH.NA),o=nx(s),t&&eN(a,e=>{let t=n_(e,o);if(!1!==t){let i={message:function(e,t){if(t.issue===g.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
5
+ The problem is in the <${e.name}> Token Type
6
+ Root cause: ${t.errMsg}.
7
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===g.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
8
+ The problem is in the <${e.name}> Token Type
9
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(e,t),type:t.issue,tokenType:e};n.push(i)}else t9(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(r=!0):nL(o,e.PATTERN)&&(r=!0)}),t&&!r&&n.push({message:"Warning: No LINE_BREAKS Found.\n This Lexer has been defined to track line and column information,\n But none of the Token Types can be identified as matching a line terminator.\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n for details.",type:g.NO_LINE_BREAKS_FLAGS}),n))})),i.modes=i.modes?i.modes:{},eN(i.modes,(e,t)=>{i.modes[t]=s8(e,e=>sj(e))});let n=eb(i.modes);if(eN(i.modes,(e,i)=>{this.TRACE_INIT(`Mode: <${i}> processing`,()=>{if(this.modes.push(i),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",()=>{var t,i,s,r,a,o;let l,c,h,u,d,p,f,m,T,E,y,A;this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat((l=[],c={errors:t5(d=ns(t=e,e=>!t9(e,nS)),e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:g.MISSING_PATTERN,tokenTypes:[e]})),valid:na(t,d)},l=l.concat(c.errors),u=(h={errors:t5(p=ns(i=c.valid,e=>{let t=e[nS];return!si(t)&&!eS(t)&&!t9(t,"exec")&&!iQ(t)}),e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:g.INVALID_PATTERN,tokenTypes:[e]})),valid:na(i,p)}).valid,l=(l=(l=(l=(l=l.concat(h.errors)).concat((f=[],m=ns(u,e=>si(e[nS])),(f=(f=(f=(f=f.concat(function(e){class t extends s1{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return t5(ns(e,e=>{let i=e.PATTERN;try{let e=nm(i),s=new t;return s.visit(e),s.found}catch(e){return nR.test(i.source)}}),e=>({message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:g.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}(m))).concat(function(e){class t extends s1{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return t5(ns(e,e=>{let i=e.PATTERN;try{let e=nm(i),s=new t;return s.visit(e),s.found}catch(e){return nk.test(i.source)}}),e=>({message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:g.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}(m))).concat(t5(ns(m,e=>{let t=e[nS];return t instanceof RegExp&&(t.multiline||t.global)}),e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:g.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]})))).concat((T=[],E=t5(s=m,e=>ni(s,(t,i)=>(e.PATTERN.source!==i.PATTERN.source||sS(T,i)||i.PATTERN===nH.NA||(T.push(i),t.push(i)),t),[])),t5(ns(E=no(E),e=>e.length>1),e=>{let t=t5(e,e=>e.name),i=nl(e).PATTERN;return{message:`The same RegExp pattern ->${i}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:g.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})))).concat(t5(ns(m,e=>e.PATTERN.test("")),e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:g.EMPTY_MATCH_PATTERN,tokenTypes:[e]})))))).concat(t5(ns(u,e=>{if(!t9(e,"GROUP"))return!1;let t=e.GROUP;return t!==nH.SKIPPED&&t!==nH.NA&&!iQ(t)}),e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:g.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]})))).concat((r=u,a=n,t5(ns(r,e=>void 0!==e.PUSH_MODE&&!sS(a,e.PUSH_MODE)),e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:g.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))))).concat((y=[],A=ni(o=u,(e,t,i)=>{var s;let n=t.PATTERN;return n===nH.NA||(iQ(n)?e.push({str:n,idx:i,tokenType:t}):si(n)&&(s=n,void 0===nh([".","\\","[","]","|","^","$","(",")","?","*","+","{"],e=>-1!==s.source.indexOf(e)))&&e.push({str:n.source,idx:i,tokenType:t})),e},[]),eN(o,(e,t)=>{eN(A,({str:i,idx:s,tokenType:n})=>{if(t<s&&function(e,t){if(si(t)){var i;if(i=t,/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(i.source))return!1;let s=t.exec(e);return null!==s&&0===s.index}if(eS(t))return t(e,0,[],{});if(t9(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(i,e.PATTERN)){let t=`Token: ->${n.name}<- can never be matched.
10
+ Because it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.
11
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;y.push({message:t,type:g.UNREACHABLE_PATTERN,tokenTypes:[e,n]})}})}),y))))}),e5(this.lexerDefinitionErrors)){let s;nj(e),this.TRACE_INIT("analyzeTokenTypes",()=>{var i;let n,r,a,o,l,c,h,u,d,p,f,m,T,g,E,y;(T=(i=s6(i={lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT},{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer)("initCharCodeToOptimizedIndexMap",()=>{if(e5(nM)){nM=Array(65536);for(let e=0;e<65536;e++)nM[e]=e>255?255+~~(e/255):e}}),T("Reject Lexer.NA",()=>{n=s8(e,e=>e[nS]===nH.NA)}),g=!1,T("Transform Patterns",()=>{g=!1,r=t5(n,e=>{let t=e[nS];if(si(t)){let e=t.source;return 1!==e.length||"^"===e||"$"===e||"."===e||t.ignoreCase?2!==e.length||"\\"!==e[0]||sS(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?nN(t):e[1]:e}if(eS(t))return g=!0,{exec:t};if("object"==typeof t)return g=!0,t;if("string"==typeof t)if(1===t.length)return t;else return nN(new RegExp(t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")));throw Error("non exhaustive match")})}),T("misc mapping",()=>{a=t5(n,e=>e.tokenTypeIdx),o=t5(n,e=>{let t=e.GROUP;if(t!==nH.SKIPPED){if(iQ(t))return t;if(sj(t))return!1;throw Error("non exhaustive match")}}),l=t5(n,e=>{let t=e.LONGER_ALT;if(t)return q(t)?t5(t,e=>s7(n,e)):[s7(n,t)]}),c=t5(n,e=>e.PUSH_MODE),h=t5(n,e=>t9(e,"POP_MODE"))}),T("Line Terminator Handling",()=>{let e=nx(i.lineTerminatorCharacters);u=t5(n,e=>!1),"onlyOffset"!==i.positionTracking&&(u=t5(n,t=>t9(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===n_(t,e)&&nL(e,t.PATTERN)))}),T("Misc Mapping #2",()=>{d=t5(n,nv),p=t5(r,nI),f=ni(n,(e,t)=>{let i=t.GROUP;return iQ(i)&&i!==nH.SKIPPED&&(e[i]=[]),e},{}),m=t5(r,(e,t)=>({pattern:r[t],longerAlt:l[t],canLineTerminator:u[t],isCustom:d[t],short:p[t],group:o[t],push:c[t],pop:h[t],tokenTypeIdx:a[t],tokenType:n[t]}))}),E=!0,y=[],i.safeMode||T("First Char Optimization",()=>{y=ni(n,(e,t,s)=>{if("string"==typeof t.PATTERN)nU(e,nw(t.PATTERN.charCodeAt(0)),m[s]);else if(q(t.START_CHARS_HINT)){let i;eN(t.START_CHARS_HINT,t=>{let n=nw("string"==typeof t?t.charCodeAt(0):t);i!==n&&(i=n,nU(e,n,m[s]))})}else if(si(t.PATTERN))if(t.PATTERN.unicode)E=!1,i.ensureOptimizations&&nu(`${ng} Unable to analyze < ${t.PATTERN.toString()} > pattern.
12
+ The regexp unicode flag is not currently supported by the regexp-to-ast library.
13
+ This will disable the lexer's first char optimizations.
14
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let n=function(e,t=!1){try{let t=nm(e);return function e(t,i,s){switch(t.type){case"Disjunction":for(let n=0;n<t.value.length;n++)e(t.value[n],i,s);break;case"Alternative":let n=t.value;for(let t=0;t<n.length;t++){let r=n[t];switch(r.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}switch(r.type){case"Character":nE(r.value,i,s);break;case"Set":if(!0===r.complement)throw Error(nT);eN(r.value,e=>{if("number"==typeof e)nE(e,i,s);else if(!0===s)for(let t=e.from;t<=e.to;t++)nE(t,i,s);else{for(let t=e.from;t<=e.to&&t<256;t++)nE(t,i,s);if(e.to>=256){let t=e.from>=256?e.from:256,s=e.to,n=nw(t),r=nw(s);for(let e=n;e<=r;e++)i[e]=e}}});break;case"Group":e(r.value,i,s);break;default:throw Error("Non Exhaustive Match")}let a=void 0!==r.quantifier&&0===r.quantifier.atLeast;if("Group"===r.type&&!1===function e(t){let i=t.quantifier;return!!i&&0===i.atLeast||!!t.value&&(q(t.value)?sR(t.value,e):e(t.value))}(r)||"Group"!==r.type&&!1===a)break}break;default:throw Error("non exhaustive match!")}return eI(i)}(t.value,{},t.flags.ignoreCase)}catch(i){if(i.message===nT)t&&nd(`${ng} Unable to optimize: < ${e.toString()} >
15
+ Complement Sets cannot be automatically optimized.
16
+ This will disable the lexer's first char optimizations.
17
+ See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let i="";t&&(i="\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),nu(`${ng}
18
+ Failed parsing: < ${e.toString()} >
19
+ Using the @chevrotain/regexp-to-ast library
20
+ Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+i)}}return[]}(t.PATTERN,i.ensureOptimizations);e5(n)&&(E=!1),eN(n,t=>{nU(e,t,m[s])})}else i.ensureOptimizations&&nu(`${ng} TokenType: <${t.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
21
+ This will disable the lexer's first char optimizations.
22
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),E=!1;return e},[])}),s={emptyGroups:f,patternIdxToConfig:m,charCodeToPatternIdxToConfig:y,hasCustom:g,canBeOptimized:E}}),this.patternIdxToConfig[i]=s.patternIdxToConfig,this.charCodeToPatternIdxToConfig[i]=s.charCodeToPatternIdxToConfig,this.emptyGroups=i8({},this.emptyGroups,s.emptyGroups),this.hasCustom=s.hasCustom||this.hasCustom,this.canModeBeOptimized[i]=s.canBeOptimized}})}),this.defaultMode=i.defaultMode,!e5(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling)throw Error("Errors detected in definition of Lexer:\n"+t5(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n"));eN(this.lexerDefinitionWarning,e=>{nd(e.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(s&&(this.handleModes=sx),!1===this.trackStartLines&&(this.computeNewColumn=ek),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=sx),/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 e=ni(this.canModeBeOptimized,(e,t,i)=>(!1===t&&e.push(i),e),[]);if(t.ensureOptimizations&&!e5(e))throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized.
23
+ Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
24
+ Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{np={}}),this.TRACE_INIT("toFastProperties",()=>{iK(this)})})}tokenize(e,t=this.defaultMode){if(!e5(this.lexerDefinitionErrors))throw Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+t5(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n"));return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){var i;let s,n,r,a,o,l,c,h,u,d,p,f,m,T,g,E,y,A=e.length,L=0,S=0,O=Array(this.hasCustom?0:Math.floor(e.length/10)),b=[],R=this.trackStartLines?1:void 0,k=this.trackStartLines?1:void 0,N=(i=this.emptyGroups,y={},eN(eb(i),e=>{if(q(i[e]))y[e]=[];else throw Error("non exhaustive match")}),y),v=this.trackStartLines,I=this.config.lineTerminatorsPattern,C=0,_=[],x=[],U=[],M=[];Object.freeze(M);let w=!1,P=e=>{if(1===U.length&&void 0===e.tokenType.PUSH_MODE){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);b.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{U.pop();let e=nP(U);_=this.patternIdxToConfig[e],x=this.charCodeToPatternIdxToConfig[e],C=_.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;w=!!x&&!!t}};function D(e){U.push(e),x=this.charCodeToPatternIdxToConfig[e],C=(_=this.patternIdxToConfig[e]).length,C=_.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;w=!!x&&!!t}D.call(this,t);let $=this.config.recoveryEnabled;for(;L<A;){let t;l=null,u=-1;let i=e.charCodeAt(L);if(w){let e=x[nw(i)];t=void 0!==e?e:M}else t=_;let y=t.length;for(s=0;s<y;s++){let n=(E=t[s]).pattern;c=null;let d=E.short;if(!1!==d?i===d&&(u=1,l=n):!0===E.isCustom?null!==(g=n.exec(e,L,O,N))?(u=(l=g[0]).length,void 0!==g.payload&&(c=g.payload)):l=null:(n.lastIndex=L,u=this.matchLength(n,e,L)),-1!==u){if(void 0!==(o=E.longerAlt)){l=e.substring(L,L+u);let t=o.length;for(r=0;r<t;r++){let t=_[o[r]],i=t.pattern;if(h=null,!0===t.isCustom?null!==(g=i.exec(e,L,O,N))?(a=g[0],void 0!==g.payload&&(h=g.payload)):a=null:(i.lastIndex=L,a=this.match(i,e,L)),a&&a.length>l.length){l=a,u=a.length,c=h,E=t;break}}}break}}if(-1!==u){if(void 0!==(d=E.group)&&(l=null!==l?l:e.substring(L,L+u),p=E.tokenTypeIdx,f=this.createTokenInstance(l,L,p,E.tokenType,R,k,u),this.handlePayload(f,c),!1===d?S=this.addToken(O,S,f):N[d].push(f)),!0===v&&!0===E.canLineTerminator){let t,i,s=0;I.lastIndex=0;do l=null!==l?l:e.substring(L,L+u),!0===(t=I.test(l))&&(i=I.lastIndex-1,s++);while(!0===t)0!==s?(R+=s,k=u-i,this.updateTokenEndLineColumnLocation(f,d,i,s,R,k,u)):k=this.computeNewColumn(k,u)}else k=this.computeNewColumn(k,u);L+=u,this.handleModes(E,P,D,f)}else{let t=L,i=R,s=k,r=!1===$;for(;!1===r&&L<A;)for(L++,n=0;n<C;n++){let t=_[n],i=t.pattern,s=t.short;if(!1!==s?e.charCodeAt(L)===s&&(r=!0):!0===t.isCustom?r=null!==i.exec(e,L,O,N):(i.lastIndex=L,r=null!==i.exec(e)),!0===r)break}if(m=L-t,k=this.computeNewColumn(k,m),T=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(e,t,m,i,s,nP(U)),b.push({offset:t,line:i,column:s,length:m,message:T}),!1===$)break}}return this.hasCustom||(O.length=S),{tokens:O,groups:N,errors:b}}handleModes(e,t,i,s){if(!0===e.pop){let n=e.push;t(s),void 0!==n&&i.call(this,n)}else void 0!==e.push&&i.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,i,s,n,r,a){let o,l;void 0!==t&&(l=(o=i===a-1)?-1:0,(1!==s||!0!==o)&&(e.endLine=n+l,e.endColumn=r-1+-l))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,i,s){return{image:e,startOffset:t,tokenTypeIdx:i,tokenType:s}}createStartOnlyToken(e,t,i,s,n,r){return{image:e,startOffset:t,startLine:n,startColumn:r,tokenTypeIdx:i,tokenType:s}}createFullToken(e,t,i,s,n,r,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:n,endLine:n,startColumn:r,endColumn:r+a-1,tokenTypeIdx:i,tokenType:s}}addTokenUsingPush(e,t,i){return e.push(i),t}addTokenUsingMemberAccess(e,t,i){return e[t]=i,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}match(e,t,i){return!0===e.test(t)?t.substring(i,e.lastIndex):null}matchLength(e,t,i){return!0===e.test(t)?e.lastIndex-i:-1}}function nY(e){return nX(e)?e.LABEL:e.name}function nX(e){return iQ(e.LABEL)&&""!==e.LABEL}nH.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.",nH.NA=/NOT_APPLICABLE/;let nJ="categories",nq="label",nZ="group",nQ="push_mode",n0="pop_mode",n1="longer_alt",n2="line_breaks",n3="start_chars_hint";function n6(e){let t=e.pattern,i={};if(i.name=e.name,sj(t)||(i.PATTERN=t),t9(e,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";return t9(e,nJ)&&(i.CATEGORIES=e[nJ]),nj([i]),t9(e,nq)&&(i.LABEL=e[nq]),t9(e,nZ)&&(i.GROUP=e[nZ]),t9(e,n0)&&(i.POP_MODE=e[n0]),t9(e,nQ)&&(i.PUSH_MODE=e[nQ]),t9(e,n1)&&(i.LONGER_ALT=e[n1]),t9(e,n2)&&(i.LINE_BREAKS=e[n2]),t9(e,n3)&&(i.START_CHARS_HINT=e[n3]),i}let n5=n6({name:"EOF",pattern:nH.NA});function n4(e,t,i,s,n,r,a,o){return{image:t,startOffset:i,endOffset:s,startLine:n,endLine:r,startColumn:a,endColumn:o,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}nj([n5]);let n8={buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:s}){let n=nX(e)?`--\x3e ${nY(e)} <--`:`token of type --\x3e ${e.name} <--`;return`Expecting ${n} but found --\x3e '${t.image}' <--`},buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>"Redundant input, expecting EOF but found: "+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:i,customUserDescription:s,ruleName:n}){let r="Expecting: ",a="\nbut found: '"+nl(t).image+"'";if(s)return r+s+a;{let t=t5(ni(e,(e,t)=>e.concat(t),[]),e=>`[${t5(e,e=>nY(e)).join(", ")}]`),i=t5(t,(e,t)=>` ${t+1}. ${e}`);return r+`one of these possible Token sequences:
25
+ ${i.join("\n")}`+a}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:i,ruleName:s}){let n="Expecting: ",r="\nbut found: '"+nl(t).image+"'";if(i)return n+i+r;{let t=t5(e,e=>`[${t5(e,e=>nY(e)).join(",")}]`);return n+`expecting at least one iteration which starts with one of these possible Token sequences::
26
+ <${t.join(" ,")}>`+r}}};Object.freeze(n8);let n9={buildRuleNotFoundError:(e,t)=>"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},n7={buildDuplicateFoundError(e,t){let i=e.name,s=nl(t),n=s.idx,r=sN(s),a=s instanceof sp?s.terminalType.name:s instanceof sn?s.nonTerminalName:"",o=`->${r}${n>0?n:""}<- ${a?`with argument: ->${a}<-`:""}
27
+ appears more than once (${t.length} times) in the top level rule: ->${i}<-.
28
+ For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
29
+ `;return(o=o.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:e=>`Namespace conflict found in grammar.
30
+ The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.
31
+ To resolve this make sure each Terminal and Non-Terminal names are unique
32
+ This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
33
+ and Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(e){let t=t5(e.prefixPath,e=>nY(e)).join(", "),i=0===e.alternation.idx?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix
34
+ in <OR${i}> inside <${e.topLevelRule.name}> Rule,
35
+ <${t}> may appears as a prefix path in all these alternatives.
36
+ See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
37
+ For Further details.`},buildAlternationAmbiguityError(e){let t=0===e.alternation.idx?"":e.alternation.idx,i=0===e.prefixPath.length,s=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${t}> inside <${e.topLevelRule.name}> Rule,
38
+ `;if(i)s+=`These alternatives are all empty (match no tokens), making them indistinguishable.
39
+ Only the last alternative may be empty.
40
+ `;else{let t=t5(e.prefixPath,e=>nY(e)).join(", ");s+=`<${t}> may appears as a prefix path in all these alternatives.
41
+ `}return s+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
42
+ For Further details.`},buildEmptyRepetitionError(e){let t=sN(e.repetition);return 0!==e.repetition.idx&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.
43
+ This could lead to an infinite loop.`},buildTokenNameError:e=>"deprecated",buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
44
+ Only the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives:
45
+ <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
46
+ has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){let t=e.topLevelRule.name,i=t5(e.leftRecursionPath,e=>e.name),s=`${t} --\x3e ${i.concat([t]).join(" --\x3e ")}`;return`Left Recursion found in grammar.
47
+ rule: <${t}> can be invoked from itself (directly or indirectly)
48
+ without consuming any Tokens. The grammar path that causes this is:
49
+ ${s}
50
+ To fix this refactor your grammar to remove the left recursion.
51
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof sr?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class re extends sf{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){eN(eI(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:A.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}var rt=function(e,t){return s$(t5(e,t),1)},ri=function(e,t,i,s){for(var n=-1,r=null==e?0:e.length;++n<r;){var a=e[n];t(s,a,i(a),e)}return s},rs=function(e,t,i,s){return eR(e,function(e,n,r){t(s,e,i(e),r)}),s},rn=Object.prototype.hasOwnProperty,rr=(p=function(e,t,i){rn.call(e,i)?e[i].push(t):ie(e,i,[t])},function(e,t){return(q(e)?ri:rs)(e,p,t3(t),{})}),ra=function(e,t,i){var s=null==e?0:e.length;return s?ij(e,0,(t=s-(t=i||void 0===t?1:iq(t)))<0?0:t):[]};class ro extends sv{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=iB(this.path.ruleStack).reverse(),this.occurrenceStack=iB(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,i){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let s=t.concat(i);this.updateExpectedNext(),this.walk(e.referencedRule,s)}}updateExpectedNext(){e5(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class rl extends ro{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,i){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new sa({definition:t.concat(i)});this.possibleTokTypes=sB(e),this.found=!0}}}class rc extends sv{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class rh extends rc{walkMany(e,t,i){if(e.idx===this.occurrence){let e=nl(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sp&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,i)}}class ru extends rc{walkManySep(e,t,i){if(e.idx===this.occurrence){let e=nl(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sp&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,i)}}class rd extends rc{walkAtLeastOne(e,t,i){if(e.idx===this.occurrence){let e=nl(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sp&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,i)}}class rp extends rc{walkAtLeastOneSep(e,t,i){if(e.idx===this.occurrence){let e=nl(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sp&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,i)}}function rf(e,t,i=[]){i=iB(i);let s=[],n=0;function r(r){let a=rf(r.concat(iZ(e,n+1)),t,i);return s.concat(a)}for(;i.length<t&&n<e.length;){let t=e[n];if(t instanceof sa)return r(t.definition);if(t instanceof sn)return r(t.definition);if(t instanceof so)s=r(t.definition);else if(t instanceof sl)return r(t.definition.concat([new sh({definition:t.definition})]));else if(t instanceof sc)return r([new sa({definition:t.definition}),new sh({definition:[new sp({terminalType:t.separator})].concat(t.definition)})]);else if(t instanceof su)s=r(t.definition.concat([new sh({definition:[new sp({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof sh)s=r(t.definition.concat([new sh({definition:t.definition})]));else if(t instanceof sd)return eN(t.definition,e=>{!1===e5(e.definition)&&(s=r(e.definition))}),s;else if(t instanceof sp)i.push(t.terminalType);else throw Error("non exhaustive match");n++}return s.push({partialPath:i,suffixDef:iZ(e,n)}),s}function rm(e,t,i,s){let n="EXIT_NONE_TERMINAL",r=[n],a="EXIT_ALTERNATIVE",o=!1,l=t.length,c=l-s-1,h=[],u=[];for(u.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!e5(u);){let e=u.pop();if(e===a){o&&nP(u).idx<=c&&u.pop();continue}let s=e.def,d=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(e5(s))continue;let m=s[0];if(m===n){let e={idx:d,def:iZ(s),ruleStack:ra(p),occurrenceStack:ra(f)};u.push(e)}else if(m instanceof sp)if(d<l-1){let e=d+1;if(i(t[e],m.terminalType)){let t={idx:e,def:iZ(s),ruleStack:p,occurrenceStack:f};u.push(t)}}else if(d===l-1)h.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),o=!0;else throw Error("non exhaustive match");else if(m instanceof sn){let e=iB(p);e.push(m.nonTerminalName);let t=iB(f);t.push(m.idx);let i={idx:d,def:m.definition.concat(r,iZ(s)),ruleStack:e,occurrenceStack:t};u.push(i)}else if(m instanceof so){let e={idx:d,def:iZ(s),ruleStack:p,occurrenceStack:f};u.push(e),u.push(a);let t={idx:d,def:m.definition.concat(iZ(s)),ruleStack:p,occurrenceStack:f};u.push(t)}else if(m instanceof sl){let e=new sh({definition:m.definition,idx:m.idx}),t={idx:d,def:m.definition.concat([e],iZ(s)),ruleStack:p,occurrenceStack:f};u.push(t)}else if(m instanceof sc){let e=new sh({definition:[new sp({terminalType:m.separator})].concat(m.definition),idx:m.idx}),t={idx:d,def:m.definition.concat([e],iZ(s)),ruleStack:p,occurrenceStack:f};u.push(t)}else if(m instanceof su){let e={idx:d,def:iZ(s),ruleStack:p,occurrenceStack:f};u.push(e),u.push(a);let t=new sh({definition:[new sp({terminalType:m.separator})].concat(m.definition),idx:m.idx}),i={idx:d,def:m.definition.concat([t],iZ(s)),ruleStack:p,occurrenceStack:f};u.push(i)}else if(m instanceof sh){let e={idx:d,def:iZ(s),ruleStack:p,occurrenceStack:f};u.push(e),u.push(a);let t=new sh({definition:m.definition,idx:m.idx}),i={idx:d,def:m.definition.concat([t],iZ(s)),ruleStack:p,occurrenceStack:f};u.push(i)}else if(m instanceof sd)for(let e=m.definition.length-1;e>=0;e--){let t={idx:d,def:m.definition[e].definition.concat(iZ(s)),ruleStack:p,occurrenceStack:f};u.push(t),u.push(a)}else if(m instanceof sa)u.push({idx:d,def:m.definition.concat(iZ(s)),ruleStack:p,occurrenceStack:f});else if(m instanceof sr)u.push(function(e,t,i,s){let n=iB(i);n.push(e.name);let r=iB(s);return r.push(1),{idx:t,def:e.definition,ruleStack:n,occurrenceStack:r}}(m,d,p,f));else throw Error("non exhaustive match")}return h}function rT(e){if(e instanceof so||"Option"===e)return E.OPTION;if(e instanceof sh||"Repetition"===e)return E.REPETITION;if(e instanceof sl||"RepetitionMandatory"===e)return E.REPETITION_MANDATORY;if(e instanceof sc||"RepetitionMandatoryWithSeparator"===e)return E.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof su||"RepetitionWithSeparator"===e)return E.REPETITION_WITH_SEPARATOR;else if(e instanceof sd||"Alternation"===e)return E.ALTERNATION;else throw Error("non exhaustive match")}function rg(e,t,i,s){let n=e.length,r=sR(e,e=>sR(e,e=>1===e.length));if(t)return function(t){let s=t5(t,e=>e.GATE);for(let t=0;t<n;t++){let n=e[t],r=n.length,a=s[t];if(void 0===a||!1!==a.call(this))t:for(let e=0;e<r;e++){let s=n[e],r=s.length;for(let e=0;e<r;e++)if(!1===i(this.LA(e+1),s[e]))continue t;return t}}};if(!r||s)return function(){for(let t=0;t<n;t++){let s=e[t],n=s.length;t:for(let e=0;e<n;e++){let n=s[e],r=n.length;for(let e=0;e<r;e++)if(!1===i(this.LA(e+1),n[e]))continue t;return t}}};{let t=ni(t5(e,e=>sF(e)),(e,t,i)=>(eN(t,t=>{t9(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=i),eN(t.categoryMatches,t=>{t9(e,t)||(e[t]=i)})}),e),{});return function(){return t[this.LA(1).tokenTypeIdx]}}}function rE(e,t,i){let s=sR(e,e=>1===e.length),n=e.length;if(!s||i)return function(){t:for(let i=0;i<n;i++){let s=e[i],n=s.length;for(let e=0;e<n;e++)if(!1===t(this.LA(e+1),s[e]))continue t;return!0}return!1};{let t=sF(e);if(1===t.length&&e5(t[0].categoryMatches)){let e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{let e=ni(t,(e,t,i)=>(e[t.tokenTypeIdx]=!0,eN(t.categoryMatches,t=>{e[t]=!0}),e),[]);return function(){return!0===e[this.LA(1).tokenTypeIdx]}}}}(f=E||(E={}))[f.OPTION=0]="OPTION",f[f.REPETITION=1]="REPETITION",f[f.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",f[f.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",f[f.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",f[f.ALTERNATION=5]="ALTERNATION";class ry extends sv{constructor(e,t,i){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=i}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,i,s){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=i.concat(s),!0)}walkOption(e,t,i){this.checkIsTarget(e,E.OPTION,t,i)||super.walkOption(e,t,i)}walkAtLeastOne(e,t,i){this.checkIsTarget(e,E.REPETITION_MANDATORY,t,i)||super.walkOption(e,t,i)}walkAtLeastOneSep(e,t,i){this.checkIsTarget(e,E.REPETITION_MANDATORY_WITH_SEPARATOR,t,i)||super.walkOption(e,t,i)}walkMany(e,t,i){this.checkIsTarget(e,E.REPETITION,t,i)||super.walkOption(e,t,i)}walkManySep(e,t,i){this.checkIsTarget(e,E.REPETITION_WITH_SEPARATOR,t,i)||super.walkOption(e,t,i)}}class rA extends sf{constructor(e,t,i){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=i,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(void 0===this.targetRef||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,E.OPTION)}visitRepetition(e){this.checkIsTarget(e,E.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,E.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,E.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,E.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,E.ALTERNATION)}}function rL(e){let t=Array(e);for(let i=0;i<e;i++)t[i]=[];return t}function rS(e){let t=[""];for(let i=0;i<e.length;i++){let s=e[i],n=[];for(let e=0;e<t.length;e++){let i=t[e];n.push(i+"_"+s.tokenTypeIdx);for(let e=0;e<s.categoryMatches.length;e++){let t="_"+s.categoryMatches[e];n.push(i+t)}}t=n}return t}function rO(e,t){let i=t5(e,e=>rf([e],1)),s=rL(i.length),n=t5(i,e=>{let t={};return eN(e,e=>{eN(rS(e.partialPath),e=>{t[e]=!0})}),t}),r=i;for(let e=1;e<=t;e++){let i=r;r=rL(i.length);for(let a=0;a<i.length;a++){let o=i[a];for(let i=0;i<o.length;i++){let l=o[i].partialPath,c=o[i].suffixDef,h=rS(l);if(function(e,t,i){for(let s=0;s<e.length;s++){if(s===i)continue;let n=e[s];for(let e=0;e<t.length;e++)if(!0===n[t[e]])return!1}return!0}(n,h,a)||e5(c)||l.length===t){let e=s[a];if(!1===rk(e,l)){e.push(l);for(let e=0;e<h.length;e++){let t=h[e];n[a][t]=!0}}}else{let t=rf(c,e+1,l);r[a]=r[a].concat(t),eN(t,e=>{eN(rS(e.partialPath),e=>{n[a][e]=!0})})}}}}return s}function rb(e,t,i,s){let n=new rA(e,E.ALTERNATION,s);return t.accept(n),rO(n.result,i)}function rR(e,t,i,s){let n=new rA(e,i);t.accept(n);let r=n.result,a=new ry(t,e,i).startWalking();return rO([new sa({definition:r}),new sa({definition:a})],s)}function rk(e,t){i:for(let i=0;i<e.length;i++){let s=e[i];if(s.length===t.length){for(let e=0;e<s.length;e++){let i=t[e],n=s[e];if(!1==(i===n||void 0!==n.categoryMatchesMap[i.tokenTypeIdx]))continue i}return!0}}return!1}function rN(e){return sR(e,e=>sR(e,e=>sR(e,e=>e5(e.categoryMatches))))}function rv(e){return`${sN(e)}_#_${e.idx}_#_${rI(e)}`}function rI(e){return e instanceof sp?e.terminalType.name:e instanceof sn?e.nonTerminalName:""}class rC extends sf{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)}}class r_ extends sf{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class rx extends sf{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)}}let rU="MismatchedTokenException",rM="NoViableAltException",rw="EarlyExitException",rP="NotAllInputParsedException",rD=[rU,rM,rw,rP];function r$(e){return sS(rD,e.name)}Object.freeze(rD);class rF extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class rB extends rF{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=rU}}class rK extends rF{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=rM}}class rj extends rF{constructor(e,t){super(e,t),this.name=rP}}class rG extends rF{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=rw}}let rW={},rz="InRuleRecoveryException";class rV extends Error{constructor(e){super(e),this.name=rz}}function rH(e,t,i,s,n,r,a){let o=this.getKeyForAutomaticLookahead(s,n),l=this.firstAfterRepMap[o];if(void 0===l){let e=this.getCurrRuleFullName();l=new r(this.getGAstProductions()[e],n).startWalking(),this.firstAfterRepMap[o]=l}let c=l.token,h=l.occurrence,u=l.isEndOfRule;1===this.RULE_STACK.length&&u&&void 0===c&&(c=n5,h=1),void 0!==c&&void 0!==h&&this.shouldInRepetitionRecoveryBeTried(c,h,a)&&this.tryInRepetitionRecovery(e,t,i,c)}class rY{constructor(e){var t;this.maxLookahead=null!=(t=null==e?void 0:e.maxLookahead)?t:r7.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);return e5(t)?[...t,...this.validateEmptyOrAlternatives(e.rules),...this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),...this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead)]:t}validateNoLeftRecursion(e){return rt(e,e=>(function e(t,i,s,n=[]){let r=[],a=function e(t){let i=[];if(e5(t))return i;let s=nl(t);if(s instanceof sn)i.push(s.referencedRule);else if(s instanceof sa||s instanceof so||s instanceof sl||s instanceof sc||s instanceof su||s instanceof sh)i=i.concat(e(s.definition));else if(s instanceof sd)i=sF(t5(s.definition,t=>e(t.definition)));else if(s instanceof sp);else throw Error("non exhaustive match");let n=sk(s),r=t.length>1;if(!n||!r)return i;{let s=iZ(t);return i.concat(e(s))}}(i.definition);if(e5(a))return[];{let i=t.name;sS(a,t)&&r.push({message:s.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:A.LEFT_RECURSION,ruleName:i});let o=rt(na(a,n.concat([t])),i=>{let r=iB(n);return r.push(i),e(t,i,s,r)});return r.concat(o)}})(e,e,n7))}validateEmptyOrAlternatives(e){return rt(e,e=>{let t;return t=new r_,e.accept(t),rt(t.alternations,t=>rt(ra(t.definition),(i,s)=>e5(rm([i],[],n$,1))?[{message:n7.buildEmptyAlternationError({topLevelRule:e,alternation:t,emptyChoiceIdx:s}),type:A.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:t.idx,alternative:s+1}]:[]))})}validateAmbiguousAlternationAlternatives(e,t){return rt(e,e=>{let i;return i=new r_,e.accept(i),rt(s8(i.alternations,e=>!0===e.ignoreAmbiguities),i=>{var s,n,r,a,o,l,c,h;let u,d,p=rb(i.idx,e,i.maxLookahead||t,i),f=(s=p,n=i,r=e,a=n7,u=[],t5(ni(s,(e,t,i)=>(!0===n.definition[i].ignoreAmbiguities||eN(t,t=>{let r=[i];eN(s,(e,s)=>{i!==s&&rk(e,t)&&!0!==n.definition[s].ignoreAmbiguities&&r.push(s)}),r.length>1&&!rk(u,t)&&(u.push(t),e.push({alts:r,path:t}))}),e),[]),e=>{let t=t5(e.alts,e=>e+1);return{message:a.buildAlternationAmbiguityError({topLevelRule:r,alternation:n,ambiguityIndices:t,prefixPath:e.path}),type:A.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:n.idx,alternatives:e.alts}})),m=(o=p,l=i,c=e,h=n7,no(rt(d=ni(o,(e,t,i)=>{let s=t5(t,e=>({idx:i,path:e}));return e.concat(s)},[]),e=>{if(!0===l.definition[e.idx].ignoreAmbiguities)return[];let t=e.idx,i=e.path;return t5(ns(d,e=>{var s;return!0!==l.definition[e.idx].ignoreAmbiguities&&e.idx<t&&(s=e.path,s.length<i.length&&sR(s,(e,t)=>{let s=i[t];return e===s||s.categoryMatchesMap[e.tokenTypeIdx]}))}),e=>{let i=[e.idx+1,t+1],s=0===l.idx?"":l.idx;return{message:h.buildAlternationPrefixAmbiguityError({topLevelRule:c,alternation:l,ambiguityIndices:i,prefixPath:e.path}),type:A.AMBIGUOUS_PREFIX_ALTS,ruleName:c.name,occurrence:s,alternatives:i}})})));return f.concat(m)})})}validateSomeNonEmptyLookaheadPath(e,t){let i;return i=[],eN(e,e=>{let s=new rx;e.accept(s),eN(s.allProductions,s=>{let n=rT(s),r=s.maxLookahead||t;if(e5(sF(rR(s.idx,e,n,r)[0]))){let t=n7.buildEmptyRepetitionError({topLevelRule:e,repetition:s});i.push({message:t,type:A.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),i}buildLookaheadForAlternation(e){var t,i,s,n,r;let a,o;return t=e.prodOccurrence,i=e.rule,s=e.maxLookahead,n=e.hasPredicates,r=e.dynamicTokensEnabled,o=rN(a=rb(t,i,s))?nF:n$,rg(a,n,o,r)}buildLookaheadForOptional(e){var t,i,s,n,r;let a,o;return t=e.prodOccurrence,i=e.rule,s=e.maxLookahead,n=e.dynamicTokensEnabled,r=rT(e.prodType),o=rN(a=rR(t,i,r,s))?nF:n$,rE(a[0],o,n)}}let rX=new class extends sf{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}};function rJ(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function rq(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function rZ(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function rQ(e,t){let i=eb(e),s=i.length;for(let n=0;n<s;n++){let s=e[i[n]],r=s.length;for(let e=0;e<r;e++){let i=s[e];void 0===i.tokenTypeIdx&&this[i.name](i.children,t)}}}(m=y||(y={}))[m.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",m[m.MISSING_METHOD=1]="MISSING_METHOD";let r0={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(r0);let r1=n6({name:"RECORDING_PHASE_TOKEN",pattern:nH.NA});nj([r1]);let r2=n4(r1,"This IToken indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(r2);let r3={name:"This CSTNode indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}};function r6(e,t,i,s=!1){r8(i);let n=nP(this.recordingProdStack),r=eS(t)?t:t.DEF,a=new e({definition:[],idx:i});return s&&(a.separator=t.SEP),t9(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(a),r.call(this),n.definition.push(a),this.recordingProdStack.pop(),r0}function r5(e,t){r8(t);let i=nP(this.recordingProdStack),s=!1===q(e),n=!1===s?e:e.DEF,r=new sd({definition:[],idx:t,ignoreAmbiguities:s&&!0===e.IGNORE_AMBIGUITIES});return t9(e,"MAX_LOOKAHEAD")&&(r.maxLookahead=e.MAX_LOOKAHEAD),r.hasPredicates=sT(n,e=>eS(e.GATE)),i.definition.push(r),eN(n,e=>{let t=new sa({definition:[]});r.definition.push(t),t9(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:t9(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),r0}function r4(e){return 0===e?"":`${e}`}function r8(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>
52
+ Idx value must be a none negative value smaller than ${256}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}let r9=n4(n5,"",0/0,0/0,0/0,0/0,0/0,0/0);Object.freeze(r9);let r7=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:n8,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ae=Object.freeze({recoveryValueFunc:()=>void 0,resyncEnabled:!0});(T=A||(A={}))[T.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",T[T.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",T[T.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",T[T.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",T[T.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",T[T.LEFT_RECURSION=5]="LEFT_RECURSION",T[T.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",T[T.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",T[T.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",T[T.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",T[T.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",T[T.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",T[T.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",T[T.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION";class at{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",()=>{iK(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),eN(this.definedRulesNames,e=>{let t,i=this[e].originalGrammarAction;this.TRACE_INIT(`${e} Rule`,()=>{t=this.topLevelRuleRecord(e,i)}),this.gastProductionsCache[e]=t})}finally{this.disableRecording()}});let i=[];if(this.TRACE_INIT("Grammar Resolving",()=>{var e;let t,s,n;s=s6(e={rules:eI(this.gastProductionsCache)},{errMsgProvider:n9}),n={},eN(e.rules,e=>{n[e.name]=e}),(t=new re(n,s.errMsgProvider)).resolveRefs(),i=t.errors,this.definitionErrors=this.definitionErrors.concat(i)}),this.TRACE_INIT("Grammar Validations",()=>{if(e5(i)&&!1===this.skipValidations){var e,s,n,r,a,o,l,c,h;let i,u,d,p,f,m,T=(s=(e=s6(e={rules:eI(this.gastProductionsCache),tokenTypes:eI(this.tokensMap),errMsgProvider:n7,grammarName:t},{errMsgProvider:n7})).rules,n=e.tokenTypes,r=e.errMsgProvider,a=e.grammarName,d=rt(s,e=>{var t,i;let s;return t=e,i=r,s=new rC,t.accept(s),t5(eI(se(rr(s.allProductions,rv),e=>e.length>1)),e=>{let s=nl(e),n=i.buildDuplicateFoundError(t,e),r=sN(s),a={message:n,type:A.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:r,occurrence:s.idx},o=rI(s);return o&&(a.parameter=o),a})}),l=s,c=n,h=r,i=[],u=t5(c,e=>e.name),eN(l,e=>{let t=e.name;if(sS(u,t)){let s=h.buildNamespaceConflictError(e);i.push({message:s,type:A.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),p=i,f=rt(s,e=>{var t,i;let s;return t=e,i=r,s=new r_,t.accept(s),rt(s.alternations,e=>e.definition.length>255?[{message:i.buildTooManyAlternativesError({topLevelRule:t,alternation:e}),type:A.TOO_MANY_ALTS,ruleName:t.name,occurrence:e.idx}]:[])}),m=rt(s,e=>(function(e,t,i,s){let n=[];if(ni(t,(t,i)=>i.name===e.name?t+1:t,0)>1){let t=s.buildDuplicateRuleNameError({topLevelRule:e,grammarName:i});n.push({message:t,type:A.DUPLICATE_RULE_NAME,ruleName:e.name})}return n})(e,s,a,r)),d.concat(p,f,m)),g=t5((o={lookaheadStrategy:this.lookaheadStrategy,rules:eI(this.gastProductionsCache),tokenTypes:eI(this.tokensMap),grammarName:t}).lookaheadStrategy.validate({rules:o.rules,tokenTypes:o.tokenTypes,grammarName:o.grammarName}),e=>Object.assign({type:A.CUSTOM_LOOKAHEAD_VALIDATION},e));this.definitionErrors=this.definitionErrors.concat(T,g)}}),e5(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{var e;let t,i=(e=eI(this.gastProductionsCache),t={},eN(e,e=>{i8(t,new sK(e).startWalking())}),t);this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var e,t;null==(t=(e=this.lookaheadStrategy).initialize)||t.call(e,{rules:eI(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(eI(this.gastProductionsCache))})),!at.DEFER_DEFINITION_ERRORS_HANDLING&&!e5(this.definitionErrors))throw e=t5(this.definitionErrors,e=>e.message),Error(`Parser Definition Errors detected:
53
+ ${e.join("\n-------------------------------\n")}`)})}constructor(e,t){if(this.definitionErrors=[],this.selfAnalysisDone=!1,this.initErrorHandler(t),this.initLexerAdapter(),this.initLooksAhead(t),this.initRecognizerEngine(e,t),this.initRecoverable(t),this.initTreeBuilder(t),this.initContentAssist(),this.initGastRecorder(t),this.initPerformanceTracer(t),t9(t,"ignoredIssues"))throw Error("The <ignoredIssues> IParserConfig property has been deprecated.\n Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details.");this.skipValidations=t9(t,"skipValidations")?t.skipValidations:r7.skipValidations}}at.DEFER_DEFINITION_ERRORS_HANDLING=!1,[class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t9(e,"recoveryEnabled")?e.recoveryEnabled:r7.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=rH)}getTokenToInsert(e){let t=n4(e,"",0/0,0/0,0/0,0/0,0/0,0/0);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,i,s){let n=this.findReSyncTokenType(),r=this.exportLexerState(),a=[],o=!1,l=this.LA(1),c=this.LA(1),h=()=>{let e=this.LA(0),t=new rB(this.errorMessageProvider.buildMismatchTokenMessage({expected:s,actual:l,previous:e,ruleName:this.getCurrRuleFullName()}),l,this.LA(0));t.resyncedTokens=ra(a),this.SAVE_ERROR(t)};for(;!o;)if(this.tokenMatcher(c,s))return void h();else if(i.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(c,n)?o=!0:(c=this.SKIP_TOKEN(),this.addToResyncTokens(c,a));this.importLexerState(r)}shouldInRepetitionRecoveryBeTried(e,t,i){return!(!1===i||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){let i=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(i)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new rV("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||e5(t))return!1;let i=this.LA(1);return void 0!==nh(t,e=>this.tokenMatcher(i,e))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return sS(this.getFollowSetFromFollowKey(t),e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA(1),i=2;for(;;){let s=nh(e,e=>n$(t,e));if(void 0!==s)return s;t=this.LA(i),i++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return rW;let e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(i)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return t5(e,(i,s)=>0===s?rW:{ruleName:this.shortRuleNameToFullName(i),idxInCallingRule:t[s],inRule:this.shortRuleNameToFullName(e[s-1])})}flattenFollowSet(){return sF(t5(this.buildFullFollowKeyStack(),e=>this.getFollowSetFromFollowKey(e)))}getFollowSetFromFollowKey(e){if(e===rW)return[n5];let t=e.ruleName+e.idxInCallingRule+"_~IN~_"+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,n5)||t.push(e),t}reSyncTo(e){let t=[],i=this.LA(1);for(;!1===this.tokenMatcher(i,e);)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,t);return ra(t)}attemptInRepetitionRecovery(e,t,i,s,n,r,a){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:iB(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return t5(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}},class{initLooksAhead(e){this.dynamicTokensEnabled=t9(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:r7.dynamicTokensEnabled,this.maxLookahead=t9(e,"maxLookahead")?e.maxLookahead:r7.maxLookahead,this.lookaheadStrategy=t9(e,"lookaheadStrategy")?e.lookaheadStrategy:new rY({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){eN(e,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{var t;let i,{alternation:s,repetition:n,option:r,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=(t=e,rX.reset(),t.accept(rX),i=rX.dslMethods,rX.reset(),i);eN(s,t=>{let i=0===t.idx?"":t.idx;this.TRACE_INIT(`${sN(t)}${i}`,()=>{var i;let s=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),n=(i=this.fullRuleNameToShort[e.name],256|t.idx|i);this.setLaFuncCache(n,s)})}),eN(n,t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,sN(t))}),eN(r,t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,sN(t))}),eN(a,t=>{this.computeLookaheadFunc(e,t.idx,1024,"RepetitionMandatory",t.maxLookahead,sN(t))}),eN(o,t=>{this.computeLookaheadFunc(e,t.idx,1536,"RepetitionMandatoryWithSeparator",t.maxLookahead,sN(t))}),eN(l,t=>{this.computeLookaheadFunc(e,t.idx,1280,"RepetitionWithSeparator",t.maxLookahead,sN(t))})})})}computeLookaheadFunc(e,t,i,s,n,r){this.TRACE_INIT(`${r}${0===t?"":t}`,()=>{let r=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:n||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:s}),a=t|i|this.fullRuleNameToShort[e.name];this.setLaFuncCache(a,r)})}getKeyForAutomaticLookahead(e,t){return t|e|this.getLastExplicitRuleShortName()}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=t9(e,"nodeLocationTracking")?e.nodeLocationTracking:r7.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=rq,this.setNodeLocationFromNode=rq,this.cstPostRule=sx,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=sx,this.setNodeLocationFromNode=sx,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=rJ,this.setNodeLocationFromNode=rJ,this.cstPostRule=sx,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=sx,this.setNodeLocationFromNode=sx,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=sx,this.setNodeLocationFromNode=sx,this.cstPostRule=sx,this.setInitialNodeLocation=sx;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);else this.cstInvocationStateUpdate=sx,this.cstFinallyStateUpdate=sx,this.cstPostTerminal=sx,this.cstPostNonTerminal=sx,this.cstPostRule=sx}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:0/0,endOffset:0/0}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:0/0}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:0/0,startLine:0/0,startColumn:0/0,endOffset:0/0,endLine:0/0,endColumn:0/0}}setInitialNodeLocationFullRegular(e){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:0/0,endLine:0/0,endColumn:0/0}}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),i=e.location;i.startOffset<=t.startOffset==!0?(i.endOffset=t.endOffset,i.endLine=t.endLine,i.endColumn=t.endColumn):(i.startOffset=0/0,i.startLine=0/0,i.startColumn=0/0)}cstPostRuleOnlyOffset(e){let t=this.LA(0),i=e.location;i.startOffset<=t.startOffset==!0?i.endOffset=t.endOffset:i.startOffset=0/0}cstPostTerminal(e,t){let i=this.CST_STACK[this.CST_STACK.length-1];void 0===i.children[e]?i.children[e]=[t]:i.children[e].push(t),this.setNodeLocationFromToken(i.location,t)}cstPostNonTerminal(e,t){let i=this.CST_STACK[this.CST_STACK.length-1];void 0===i.children[t]?i.children[t]=[e]:i.children[t].push(e),this.setNodeLocationFromNode(i.location,e.location)}getBaseCstVisitorConstructor(){if(sj(this.baseCstVisitorConstructor)){var e,t;let i,s=(e=this.className,t=eb(this.gastProductionsCache),rZ(i=function(){},e+"BaseSemantics"),i.prototype={visit:function(e,t){if(q(e)&&(e=e[0]),!sj(e))return this[e.name](e.children,t)},validateVisitor:function(){var e,i,s;let n=(e=this,i=t,s=e,no(t5(ns(i,e=>!1===eS(s[e])),e=>({msg:`Missing visitor method: <${e}> on ${s.constructor.name} CST Visitor.`,type:y.MISSING_METHOD,methodName:e}))));if(!e5(n)){let e=t5(n,e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
54
+ ${e.join("\n\n").replace(/\n/g,"\n ")}`)}}},i.prototype.constructor=i,i._RULE_NAMES=t,i);return this.baseCstVisitorConstructor=s,s}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(sj(this.baseCstVisitorWithDefaultsConstructor)){var e,t,i;let s,n,r=(e=this.className,t=eb(this.gastProductionsCache),i=this.getBaseCstVisitorConstructor(),rZ(s=function(){},e+"BaseSemanticsWithDefaults"),n=Object.create(i.prototype),eN(t,e=>{n[e]=rQ}),s.prototype=n,s.prototype.constructor=s,s);return this.baseCstVisitorWithDefaultsConstructor=r,r}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):r9}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?r9:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}},class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=nF,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},t9(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n For Further details.");if(q(e)){if(e5(e))throw Error("A Token Vocabulary cannot be empty.\n Note that the first argument for the parser constructor\n is no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n For Further details.")}if(q(e))this.tokensMap=ni(e,(e,t)=>(e[t.name]=t,e),{});else if(t9(e,"modes")&&sR(sF(eI(e.modes)),nz)){let t=sw(sF(eI(e.modes)));this.tokensMap=ni(t,(e,t)=>(e[t.name]=t,e),{})}else if(eL(e))this.tokensMap=iB(e);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=n5;let i=sR(t9(e,"modes")?sF(eI(e.modes)):eI(e),e=>e5(e.categoryMatches));this.tokenMatcher=i?nF:n$,nj(eI(this.tokensMap))}defineRule(e,t,i){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
55
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let s=t9(i,"resyncEnabled")?i.resyncEnabled:ae.resyncEnabled,n=t9(i,"recoveryValueFunc")?i.recoveryValueFunc:ae.recoveryValueFunc,r=this.ruleShortNameIdx<<12;return this.ruleShortNameIdx++,this.shortRuleNameToFull[r]=e,this.fullRuleNameToShort[e]=r,Object.assign(!0===this.outputCst?function(...i){try{this.ruleInvocationStateUpdate(r,e,this.subruleIdx),t.apply(this,i);let s=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(s),s}catch(e){return this.invokeRuleCatch(e,s,n)}finally{this.ruleFinallyStateUpdate()}}:function(...i){try{return this.ruleInvocationStateUpdate(r,e,this.subruleIdx),t.apply(this,i)}catch(e){return this.invokeRuleCatch(e,s,n)}finally{this.ruleFinallyStateUpdate()}},{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,i){let s=1===this.RULE_STACK.length,n=t&&!this.isBackTracking()&&this.recoveryEnabled;if(r$(e)){if(n){let t=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(t)){if(e.resyncedTokens=this.reSyncTo(t),!this.outputCst)return i(e);{let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}}if(this.outputCst){let t=this.CST_STACK[this.CST_STACK.length-1];t.recoveredNode=!0,e.partialCstResult=t}throw e}if(s)return this.moveToTerminatedState(),i(e)}throw e}optionInternal(e,t){let i=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,i)}optionInternalLogic(e,t,i){let s,n=this.getLaFuncFromCache(i);if("function"!=typeof e){s=e.DEF;let t=e.GATE;if(void 0!==t){let e=n;n=()=>t.call(this)&&e.call(this)}}else s=e;if(!0===n.call(this))return s.call(this)}atLeastOneInternal(e,t){let i=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,t,i)}atLeastOneInternalLogic(e,t,i){let s,n=this.getLaFuncFromCache(i);if("function"!=typeof t){s=t.DEF;let e=t.GATE;if(void 0!==e){let t=n;n=()=>e.call(this)&&t.call(this)}}else s=t;if(!0===n.call(this)){let e=this.doSingleRepetition(s);for(;!0===n.call(this)&&!0===e;)e=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,E.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],n,1024,e,rd)}atLeastOneSepFirstInternal(e,t){let i=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,t,i)}atLeastOneSepFirstInternalLogic(e,t,i){let s=t.DEF,n=t.SEP;if(!0===this.getLaFuncFromCache(i).call(this)){s.call(this);let t=()=>this.tokenMatcher(this.LA(1),n);for(;!0===this.tokenMatcher(this.LA(1),n);)this.CONSUME(n),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,t,s,rp],t,1536,e,rp)}else throw this.raiseEarlyExitException(e,E.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let i=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,i)}manyInternalLogic(e,t,i){let s,n=this.getLaFuncFromCache(i);if("function"!=typeof t){s=t.DEF;let e=t.GATE;if(void 0!==e){let t=n;n=()=>e.call(this)&&t.call(this)}}else s=t;let r=!0;for(;!0===n.call(this)&&!0===r;)r=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],n,768,e,rh,r)}manySepFirstInternal(e,t){let i=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,t,i)}manySepFirstInternalLogic(e,t,i){let s=t.DEF,n=t.SEP;if(!0===this.getLaFuncFromCache(i).call(this)){s.call(this);let t=()=>this.tokenMatcher(this.LA(1),n);for(;!0===this.tokenMatcher(this.LA(1),n);)this.CONSUME(n),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,t,s,ru],t,1280,e,ru)}}repetitionSepSecondInternal(e,t,i,s,n){for(;i();)this.CONSUME(t),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,i,s,n],i,1536,e,n)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let i=this.getKeyForAutomaticLookahead(256,t),s=q(e)?e:e.DEF,n=this.getLaFuncFromCache(i).call(this,s);if(void 0!==n)return s[n].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new rj(t,e))}}subruleInternal(e,t,i){let s;try{let n=void 0!==i?i.ARGS:void 0;return this.subruleIdx=t,s=e.apply(this,n),this.cstPostNonTerminal(s,void 0!==i&&void 0!==i.LABEL?i.LABEL:e.ruleName),s}catch(t){throw this.subruleInternalError(t,i,e.ruleName)}}subruleInternalError(e,t,i){throw r$(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:i),delete e.partialCstResult),e}consumeInternal(e,t,i){let s;try{let t=this.LA(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),s=t):this.consumeInternalError(e,t,i)}catch(i){s=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(void 0!==i&&void 0!==i.LABEL?i.LABEL:e.name,s),s}consumeInternalError(e,t,i){let s,n=this.LA(0);throw s=void 0!==i&&i.ERR_MSG?i.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new rB(s,t,n))}consumeInternalRecovery(e,t,i){if(this.recoveryEnabled&&"MismatchedTokenException"===i.name&&!this.isBackTracking()){let s=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,s)}catch(e){if(e.name===rz)throw i;throw e}}throw i}saveRecogState(){let e=this.errors,t=iB(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,i){this.RULE_OCCURRENCE_STACK.push(i),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),n5)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},class{ACTION(e){return e.call(this)}consume(e,t,i){return this.consumeInternal(t,e,i)}subrule(e,t,i){return this.subruleInternal(t,e,i)}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,i=ae){if(sS(this.definedRulesNames,e)){let t={message:n7.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:A.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let s=this.defineRule(e,t,i);return this[e]=s,s}OVERRIDE_RULE(e,t,i=ae){var s,n;let r,a,o=(s=this.definedRulesNames,n=this.className,a=[],sS(s,e)||(r=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,a.push({message:r,type:A.INVALID_RULE_OVERRIDE,ruleName:e})),a);this.definitionErrors=this.definitionErrors.concat(o);let l=this.defineRule(e,t,i);return this[e]=l,l}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);let i=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(r$(e))return!1;throw e}finally{this.reloadRecogState(i),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return t5(eI(this.gastProductionsCache),function e(t){function i(t){return t5(t,e)}if(t instanceof sn){let e={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return iQ(t.label)&&(e.label=t.label),e}if(t instanceof sa)return{type:"Alternative",definition:i(t.definition)};if(t instanceof so)return{type:"Option",idx:t.idx,definition:i(t.definition)};if(t instanceof sl)return{type:"RepetitionMandatory",idx:t.idx,definition:i(t.definition)};if(t instanceof sc)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:e(new sp({terminalType:t.separator})),definition:i(t.definition)};else if(t instanceof su)return{type:"RepetitionWithSeparator",idx:t.idx,separator:e(new sp({terminalType:t.separator})),definition:i(t.definition)};else if(t instanceof sh)return{type:"Repetition",idx:t.idx,definition:i(t.definition)};else if(t instanceof sd)return{type:"Alternation",idx:t.idx,definition:i(t.definition)};else if(t instanceof sp){var s,n;let e={type:"Terminal",name:t.terminalType.name,label:iQ((n=s=t.terminalType).LABEL)&&""!==n.LABEL?s.LABEL:s.name,idx:t.idx};iQ(t.label)&&(e.terminalLabel=t.label);let i=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(e.pattern=si(i)?i.source:i),e}else if(t instanceof sr)return{type:"Rule",name:t.name,orgText:t.orgText,definition:i(t.definition)};else throw Error("non exhaustive match")})}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=t9(e,"errorMessageProvider")?e.errorMessageProvider:r7.errorMessageProvider}SAVE_ERROR(e){if(r$(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:iB(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return iB(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,i){let s=this.getCurrRuleFullName(),n=rR(e,this.getGAstProductions()[s],t,this.maxLookahead)[0],r=[];for(let e=1;e<=this.maxLookahead;e++)r.push(this.LA(e));let a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:n,actual:r,previous:this.LA(0),customUserDescription:i,ruleName:s});throw this.SAVE_ERROR(new rG(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let i=this.getCurrRuleFullName(),s=rb(e,this.getGAstProductions()[i],this.maxLookahead),n=[];for(let e=1;e<=this.maxLookahead;e++)n.push(this.LA(e));let r=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:n,previous:r,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new rK(a,this.LA(1),r))}},class{initContentAssist(){}computeContentAssist(e,t){let i=this.gastProductionsCache[e];if(sj(i))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return rm([i],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let t=nl(e.ruleStack);return new rl(this.getGAstProductions()[t],e).startWalking()}},class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(t,i){return this.consumeInternalRecord(t,e,i)},this[`SUBRULE${t}`]=function(t,i){return this.subruleInternalRecord(t,e,i)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,i){return this.consumeInternalRecord(t,e,i)},this.subrule=function(e,t,i){return this.subruleInternalRecord(t,e,i)},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",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";delete this[`CONSUME${t}`],delete this[`SUBRULE${t}`],delete this[`OPTION${t}`],delete this[`OR${t}`],delete this[`MANY${t}`],delete this[`MANY_SEP${t}`],delete this[`AT_LEAST_ONE${t}`],delete this[`AT_LEAST_ONE_SEP${t}`]}delete this.consume,delete this.subrule,delete this.option,delete this.or,delete this.many,delete this.atLeastOne,delete this.ACTION,delete this.BACKTRACK,delete this.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return r9}topLevelRuleRecord(e,t){try{let i=new sr({definition:[],name:e});return i.name=e,this.recordingProdStack.push(i),t.call(this),this.recordingProdStack.pop(),i}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.message+'\n This error was thrown during the "grammar recording phase" For more info see:\n https://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(t){throw e}throw e}}optionInternalRecord(e,t){return r6.call(this,so,e,t)}atLeastOneInternalRecord(e,t){r6.call(this,sl,t,e)}atLeastOneSepFirstInternalRecord(e,t){r6.call(this,sc,t,e,!0)}manyInternalRecord(e,t){r6.call(this,sh,t,e)}manySepFirstInternalRecord(e,t){r6.call(this,su,t,e,!0)}orInternalRecord(e,t){return r5.call(this,e,t)}subruleInternalRecord(e,t,i){if(r8(t),!e||!1===t9(e,"ruleName")){let i=Error(`<SUBRULE${r4(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
56
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw i.KNOWN_RECORDER_ERROR=!0,i}let s=nP(this.recordingProdStack),n=new sn({idx:t,nonTerminalName:e.ruleName,label:null==i?void 0:i.LABEL,referencedRule:void 0});return s.definition.push(n),this.outputCst?r3:r0}consumeInternalRecord(e,t,i){if(r8(t),!nG(e)){let i=Error(`<CONSUME${r4(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
57
+ inside top level rule: <${this.recordingProdStack[0].name}>`);throw i.KNOWN_RECORDER_ERROR=!0,i}let s=nP(this.recordingProdStack),n=new sp({idx:t,terminalType:e,label:null==i?void 0:i.LABEL});return s.definition.push(n),r2}},class{initPerformanceTracer(e){if(t9(e,"traceInitPerf")){let t=e.traceInitPerf,i="number"==typeof t;this.traceInitMaxIdent=i?t:1/0,this.traceInitPerf=i?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=r7.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0!==this.traceInitPerf)return t();{this.traceInitIndent++;let i=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${i}--\x3e <${e}>`);let{time:s,value:n}=nD(t),r=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&r(`${i}<-- <${e}> time: ${s}ms`),this.traceInitIndent--,n}}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(i=>{if("constructor"===i)return;let s=Object.getOwnPropertyDescriptor(t,i);s&&(s.get||s.set)?Object.defineProperty(at.prototype,i,s):at.prototype[i]=e.prototype[i]})});class ai extends at{constructor(e,t=r7){let i=iB(t);i.outputCst=!0,super(e,i)}}var as=i("El");function an(e,t){let i=e.lexer.tokenize(t);if(i.errors.length>0){let s=i.errors[0],n=Number.isFinite(s.offset)?s.offset:t.length,r=n+(Number.isFinite(s.length)?s.length:0);throw Error(`Error lexing ${e.diagramType} diagram: ${s.message} at line ${s.line??1}, column ${s.column??1} [${n},${r})`)}e.parser.input=i.tokens;let s=e.entry();if(e.parser.errors.length>0)throw Error(`Error parsing ${e.diagramType} diagram: ${e.parser.errors[0].message}`);e.visit(s)}(0,I.K)(an,"runChevrotainParse");var ar=N.UI.usecase,aa=(0,I.K)(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:"LR",relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(ar)}),"createModel"),ao=(0,I.K)(e=>{if(!(e.actors instanceof Map)||!(e.useCases instanceof Map)||!(e.systemBoundaries instanceof Map)||!Array.isArray(e.relationships)||!(e.notes instanceof Map)||!(e.jsonNodes instanceof Map)||!(e.classDefs instanceof Map)||!(e.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(e.direction)||!Number.isSafeInteger(e.relationshipCounter)||e.relationshipCounter<0||!Number.isSafeInteger(e.noteCounter)||e.noteCounter<0||"string"!=typeof e.accTitle||"string"!=typeof e.accDescription||!e.config)throw Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),al=aa(),ac=(0,I.K)(()=>structuredClone(al.config),"getConfig"),ah=(0,I.K)(()=>al.ast,"getAST"),au=(0,I.K)(e=>{let t=structuredClone(e);ao(t);let i=(0,N.iN)(),s=(0,N.m7)();try{(0,N.SV)(t.accTitle),(0,N.EI)(t.accDescription),al=t}catch(e){throw(0,N.SV)(i),(0,N.EI)(s),e}},"commit"),ad=(0,I.K)(()=>{al=aa(),(0,N.IU)()},"clear"),ap=(0,I.K)(()=>al.actors,"getActors"),af=(0,I.K)(e=>al.actors.get(e),"getActor"),am=(0,I.K)(()=>al.useCases,"getUseCases"),aT=(0,I.K)(e=>al.useCases.get(e),"getUseCase"),ag=(0,I.K)(()=>al.systemBoundaries,"getSystemBoundaries"),aE=(0,I.K)(e=>al.systemBoundaries.get(e),"getSystemBoundary"),ay=(0,I.K)(()=>al.relationships,"getRelationships"),aA=(0,I.K)(()=>al.notes,"getNotes"),aL=(0,I.K)(e=>al.notes.get(e),"getNote"),aS=(0,I.K)(()=>al.jsonNodes,"getJsonNodes"),aO=(0,I.K)(e=>al.jsonNodes.get(e),"getJsonNode"),ab=(0,I.K)(()=>al.classDefs,"getClassDefs"),aR=(0,I.K)(e=>al.classDefs.get(e),"getClassDef"),ak=(0,I.K)(()=>al.direction,"getDirection"),aN=(0,I.K)(e=>{let t=new Map;for(let i of["default",...e]){let e=al.classDefs.get(i);if(e)for(let i of e.styles){let e=i.trim(),s=e.indexOf(":"),n=(-1===s?e:e.slice(0,s)).trim();n&&t.set(n,e)}}return[...t.values()]},"getCompiledStyles"),av=(0,I.K)(e=>e.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),aI=(0,I.K)(e=>"string"==typeof e?e:null===e?"null":String(e),"displayJsonScalar"),aC=(0,I.K)((e,t,i=e=>e)=>{let s=[],n=(0,I.K)((e,t,n)=>{s.push({key:i(e),accessibleKey:i(t),value:i(n)})},"append"),r=(0,I.K)((e,i,s)=>{if(Array.isArray(e)){if(0===e.length)return void n(i,i,"[]");if(e.every(e=>null===e||["string","number","boolean"].includes(typeof e))){for(let[t,s]of e.entries())n(0===t?i:"",i,aI(s));return}for(let[t,n]of e.entries())r(n,`${i}[${t}]`,`${s}/${t}`);return}if(null!==e&&"object"==typeof e){let a=t[s]??Object.keys(e);if(0===a.length)return void n(i,i,"{}");for(let t of a){let n=i?`${i}.${t}`:t;r(e[t],n,`${s}/${av(t)}`)}return}n(i,i,aI(e))},"visit");return r(e,"",""),s},"flattenJsonRows"),a_=(0,I.K)(e=>{switch(e.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),ax=(0,I.K)(e=>"ellipse"===e.shape?e.business?"usecaseBusiness":"usecaseEllipse":e.shape,"useCaseShape"),aU=(0,I.K)(e=>{switch(e){case 0:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case 1:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case 3:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case 4:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case 5:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case 6:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case 2:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),aM=(0,I.K)(e=>{switch(e.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:e.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...aU(e.arrowType),pattern:"solid",...e.label?{label:e.label}:{},...e.labelType?{labelType:e.labelType}:{}}}},"relationshipVisuals"),aw=(0,I.K)(e=>e.animate||e.animation?[`edge-animation-${e.animation??"fast"}`]:[],"animationClasses"),aP=(0,I.K)((...e)=>e.filter(e=>!!e).join(" "),"classNames"),aD=(0,I.K)(()=>{let e=(0,N.D7)(),t={...al.config,...e.usecase},i=(0,I.K)(t=>(0,N.jZ)(t,e),"sanitize"),s=(0,I.K)(e=>i(al.actors.get(e)?.label??al.useCases.get(e)?.label??al.jsonNodes.get(e)?.id??al.notes.get(e)?.label??e),"endpointLabel"),n=[],r=[],a=0,o=0;for(let t of al.actors.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:a_(t),isGroup:!1,padding:10,look:e.look,colorIndex:a++,cssClasses:aP("default","usecase-actor",`usecase-actor-${t.type}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aN(t.classes),actorType:t.type,business:t.business,...t.icon?{icon:t.icon}:{},...t.stereotype?{stereotype:i(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of al.useCases.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:ax(t),isGroup:!1,padding:"ellipse"===t.shape?20:10,look:e.look,colorIndex:a++,cssClasses:aP("default","usecase-element",`usecase-${t.shape}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aN(t.classes),business:t.business,...t.stereotype?{stereotype:i(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of al.notes.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:"note",isGroup:!1,padding:10,look:e.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:aN([]),noteTarget:t.target,noteTargetLabel:i(al.actors.get(t.target)?.label??al.useCases.get(t.target)?.label??al.jsonNodes.get(t.target)?.id??t.target)});for(let t of al.jsonNodes.values())n.push({id:t.id,label:i(t.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:e.look,cssClasses:aP("default","usecase-json-table",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aN(t.classes),jsonRows:aC(t.value,t.propertyOrder,i)});for(let t of al.systemBoundaries.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:e.look,colorIndex:o++,cssClasses:aP("default","system-boundary",`system-boundary-${t.type}`,...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aN(t.classes),boundaryType:t.type});for(let t of al.relationships){let{label:n,...a}=aM(t);r.push({id:t.id,start:t.source,end:t.target,source:t.source,target:t.target,sourceLabel:s(t.source),targetLabel:s(t.target),type:"edge",relationshipType:t.type,internal:!1,...a,...void 0!==n?{label:i(n)}:{},labelpos:"c",classes:aP("default","relationship",`relationship-${t.type}`,...t.classes,...aw(t)),style:[...t.styles],cssCompiledStyles:aN(t.classes),animate:t.animate,...t.animation?{animation:t.animation}:{},look:e.look,thickness:"normal",minlen:t.minlen,isUserDefinedId:t.explicitId})}for(let t of al.notes.values())r.push({id:`${t.id}-edge`,start:t.id,end:t.target,source:t.id,target:t.target,type:"edge",relationshipType:"note",sourceLabel:s(t.id),targetLabel:s(t.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:aN([]),animate:!1,look:e.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let e of n)e.wrappingWidth??=t.wrappingWidth,e.isGroup||e.shape.startsWith("usecaseActor")||(e.minWidth??=t.minNodeWidth),("usecaseEllipse"===e.shape||"usecaseBusiness"===e.shape)&&(e.spreadPorts=!0);return{nodes:n,edges:r,config:e,type:"usecase",layoutAlgorithm:"dagre",direction:ak(),nodeSpacing:t.nodeSpacing,rankSpacing:t.rankSpacing,actorFontSize:t.actorFontSize,actorFontFamily:t.actorFontFamily,actorFontWeight:t.actorFontWeight,usecaseFontSize:t.usecaseFontSize,usecaseFontFamily:t.usecaseFontFamily,usecaseFontWeight:t.usecaseFontWeight,diagramPadding:t.diagramPadding,useMaxWidth:t.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),a$={getConfig:ac,createModel:aa,commit:au,getAST:ah,clear:ad,setDiagramTitle:N.ke,getDiagramTitle:N.ab,setAccTitle:N.SV,getAccTitle:N.iN,setAccDescription:N.EI,getAccDescription:N.m7,getActors:ap,getActor:af,getUseCases:am,getUseCase:aT,getSystemBoundaries:ag,getSystemBoundary:aE,getRelationships:ay,getNotes:aA,getNote:aL,getJsonNodes:aS,getJsonNode:aO,getClassDefs:ab,getClassDef:aR,getDirection:ak,getData:aD};function aF(e,t,i){let s=[i];return s.index=t,s.input=e,s}(0,I.K)(aF,"customMatch");var aB=(0,I.K)((e,t)=>{if('"'!==e[t]||"`"!==e[t+1])return null;for(let i=t+2;i<e.length-1;i++)if("`"===e[i]&&'"'===e[i+1])return aF(e,t,e.slice(t,i+2));return null},"matchMarkdownString"),aK=(0,I.K)((e,t)=>{if("%"!==e[t]||"%"!==e[t+1])return null;for(let i=t-1;i>=0;i--){let t=e[i];if("\n"===t||"\r"===t)break;if(" "!==t&&" "!==t)return null}let i=t+2;for(;i<e.length&&"\n"!==e[i]&&"\r"!==e[i];)i++;return aF(e,t,e.slice(t,i))},"matchComment"),aj=(0,I.K)((e,t)=>{for(let i=t-1;i>=0;i--){let t=e[i];if("\n"===t||"\r"===t)break;if(" "!==t&&" "!==t)return!1}return!0},"isIndentedLineStart"),aG=(0,I.K)((e,t,i)=>{if(!aj(e,t))return null;let s=i.exec(e.slice(t));return s?aF(e,t,s[0]):null},"matchAccessibilityLine"),aW=(0,I.K)((e,t)=>{if(!aj(e,t))return null;let i=/^accDescr[\t ]*{/.exec(e.slice(t));if(!i)return null;let s=e.indexOf("}",t+i[0].length);return -1===s?null:aF(e,t,e.slice(t,s+1))},"matchAccDescrBlock"),az=(0,I.K)((e,t)=>{if("{"!==e[t])return null;let i=0,s=!1,n=!1;for(let r=t;r<e.length;r++){let a=e[r];if(s){n?n=!1:"\\"===a?n=!0:'"'===a&&(s=!1);continue}if('"'===a)s=!0;else if("{"===a)i++;else if("}"===a&&0==--i)return aF(e,t,e.slice(t,r+1))}return null},"matchJsonObject"),aV=(0,I.K)((e,t)=>{let i=e.indexOf(">>",t);if(-1===i||/[\n\r]/.test(e.slice(t,i)))return null;let s=e.slice(t,i);return s.trim()?aF(e,t,s):null},"matchStereotypeText"),aH=n6({name:"LABEL_TEXT",pattern:nH.NA}),aY=n6({name:"WORD",pattern:nH.NA,categories:aH}),aX=n6({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:aH}),aJ=n6({name:"IDENTIFIER",pattern:/\w+/,longer_alt:aX,categories:aY}),aq=n6({name:"HWS",pattern:/[\t ]+/,group:nH.SKIPPED}),aZ=n6({name:"MARKDOWN_STRING",pattern:aB,start_chars_hint:['"'],line_breaks:!0}),aQ=n6({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),a0=n6({name:"COMMENT",pattern:aK,start_chars_hint:["%"],line_breaks:!1}),a1=n6({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),a2=n6({name:"ACC_DESCR_BLOCK",pattern:aW,start_chars_hint:["a"],line_breaks:!0}),a3=/^accTitle[\t ]*:[^\n\r]*/,a6=/^accDescr[\t ]*:[^\n\r]*/,a5=n6({name:"ACC_TITLE_LINE",pattern:(0,I.K)((e,t)=>aG(e,t,a3),"pattern"),start_chars_hint:["a"],line_breaks:!1}),a4=n6({name:"ACC_DESCR_LINE",pattern:(0,I.K)((e,t)=>aG(e,t,a6),"pattern"),start_chars_hint:["a"],line_breaks:!1}),a8=n6({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),a9=n6({name:"JSON_OBJECT_LITERAL",pattern:az,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),a7=n6({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),oe=(0,I.K)((e,t)=>n6({name:e,pattern:t,longer_alt:aJ,categories:aY}),"keyword"),ot=oe("USECASE",/usecase-beta/),oi=oe("ACTOR",/actor/),os=oe("SYSTEM_BOUNDARY",/systemBoundary/),on=oe("END",/end/),or=oe("DIRECTION",/direction/),oa=oe("TD",/TD/),oo=oe("TB",/TB/),ol=oe("BT",/BT/),oc=oe("LR",/LR/),oh=oe("RL",/RL/),ou=oe("NOTE",/note/),od=oe("FOR",/for/),op=oe("JSON",/json/),of=oe("CLASS_DEF",/classDef/),om=oe("CLASS",/class/),oT=oe("STYLE",/style/),og=oe("INCLUDE",/include/i),oE=oe("EXTEND",/extend/i),oy=oe("TRUE",/true/),oA=oe("FALSE",/false/),oL=n6({name:"GENERALIZATION",pattern:/--\|>/}),oS=n6({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),oO=n6({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),ob=n6({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),oR=n6({name:"STEREOTYPE_TEXT",pattern:aV,line_breaks:!1}),ok=n6({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),oN=n6({name:"CLASS_SEPARATOR",pattern:/:::/}),ov=n6({name:"FORWARD_SOLID",pattern:/--+>/}),oI=n6({name:"BACKWARD_SOLID",pattern:/<--+/}),oC=n6({name:"FORWARD_CIRCLE",pattern:/--o/}),o_=n6({name:"BACKWARD_CIRCLE",pattern:/o--/}),ox=n6({name:"FORWARD_CROSS",pattern:/--x/}),oU=n6({name:"BACKWARD_CROSS",pattern:/x--/}),oM=n6({name:"MARKERLESS_SOLID",pattern:/--+/}),ow=n6({name:"METADATA_START",pattern:/@{/}),oP=n6({name:"AT",pattern:/@/,categories:aH}),oD=n6({name:"LBRACE",pattern:/{/}),o$=n6({name:"RBRACE",pattern:/}/}),oF=n6({name:"LBRACKET",pattern:/\[/}),oB=n6({name:"RBRACKET",pattern:/]/}),oK=n6({name:"LPAREN",pattern:/\(/}),oj=n6({name:"RPAREN",pattern:/\)/}),oG=n6({name:"COMMA",pattern:/,/,categories:aH}),oW=n6({name:"COLON",pattern:/:/,categories:aH}),oz=n6({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:aH}),oV=n6({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),oH=n6({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:aH}),oY=n6({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:aH}),oX=n6({name:"DASH",pattern:/-/,categories:aH}),oJ=n6({name:"DOT",pattern:/\./,categories:aH}),oq=n6({name:"PERCENT",pattern:/%/,categories:aH}),oZ=n6({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:aH}),oQ=n6({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:aH}),o0=n6({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:aH}),o1=[aH,aY,aq,aZ,aQ,a0,a1,a2,a5,a4,a8,ot,oi,os,on,or,oa,oo,ol,oc,oh,ou,od,op,of,om,oT,og,oE,oy,oA,oL,oS,oO,oN,ov,oI,oC,o_,ox,oU,oM,ow,oP,oD,o$,oF,oB,oK,oj,oG,oW,oz,oV,oH,aJ,aX,oY,oX,oJ,oq,oZ,oQ,o0],o2={defaultMode:"defaultMode",modes:{defaultMode:[...o1],jsonBody:[a9,a7],stereotype:[ob,oR,ok]}},o3=[...o1,a9,a7,ob,oR,ok],o6=new nH(o2),o5=(0,I.K)(e=>n$(e,aH)||e.tokenType===oV||e.tokenType===aZ,"isLabelToken"),o4={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},o8=new class extends ai{static{(0,I.K)(this,"UsecaseParser")}constructor(){super(o3,{nodeLocationTracking:"full"}),this.RULE("start",()=>{this.CONSUME(ot),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:(0,I.K)(()=>this.isStatementStart(),"GATE"),ALT:(0,I.K)(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:(0,I.K)(()=>this.isMetadataAssignment(),"GATE"),ALT:(0,I.K)(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:(0,I.K)(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:(0,I.K)(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(a1),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(n5),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(a1)}),this.RULE("commentLine",()=>{this.CONSUME(a0),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(a5),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(a4),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(a2),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(oi),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:(0,I.K)(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(oG),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:(0,I.K)(()=>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:(0,I.K)(()=>{this.CONSUME(aJ),this.OPTION(()=>{this.CONSUME(oK),this.SUBRULE(this.nodeLabel),this.CONSUME(oj)})},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(aZ),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(oi),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(oG),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:(0,I.K)(()=>{this.CONSUME(aJ),this.OPTION(()=>{this.OR2([{ALT:(0,I.K)(()=>{this.CONSUME(oK),this.SUBRULE(this.nodeLabel),this.CONSUME(oj)},"ALT")},{ALT:(0,I.K)(()=>{this.CONSUME(oF),this.SUBRULE2(this.nodeLabel),this.CONSUME(oB)},"ALT")}])})},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(aZ),"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:(0,I.K)(()=>this.CONSUME(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(aZ),"ALT")},{ALT:(0,I.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(aH)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:(0,I.K)(()=>this.LA(1).tokenType===aJ&&this.LA(2).tokenType===oP,"GATE"),DEF:(0,I.K)(()=>{this.CONSUME(aJ),this.CONSUME(oP)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(ov)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(oI),this.OPTION({GATE:(0,I.K)(()=>"<--"===this.LA(0).image&&this.hasLabeledRight([oM]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(oM)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(oM),this.OPTION({GATE:(0,I.K)(()=>"--"===this.LA(0).image&&this.hasLabeledRight([ov,oM,oC,ox]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:(0,I.K)(()=>this.CONSUME(ov),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME2(oM),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oC),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(ox),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(oC)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(o_),this.OPTION({GATE:(0,I.K)(()=>this.hasLabeledRight([oM]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(oM)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(ox)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(oU),this.OPTION({GATE:(0,I.K)(()=>this.hasLabeledRight([oM]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(oM)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(aZ),"ALT")},{ALT:(0,I.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(aH)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(oS),this.CONSUME(oW),this.OR2([{ALT:(0,I.K)(()=>this.CONSUME(og),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oE),"ALT")}])},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oL),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(ow),this.MANY(()=>this.CONSUME(a1)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(oG)),this.MANY3(()=>this.CONSUME2(a1))}),this.CONSUME(o$)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(aJ),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oV),"ALT")}]),this.CONSUME(oW),this.OR2([{ALT:(0,I.K)(()=>this.CONSUME2(aJ),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME2(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oy),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oA),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(oG),this.MANY(()=>this.CONSUME(a1))},"ALT")},{ALT:(0,I.K)(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(a1)),this.OPTION(()=>this.CONSUME2(oG)),this.MANY2(()=>this.CONSUME3(a1))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(os),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(on),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(aJ),this.OPTION(()=>{this.OR2([{ALT:(0,I.K)(()=>{this.CONSUME(oK),this.SUBRULE(this.nodeLabel),this.CONSUME(oj)},"ALT")},{ALT:(0,I.K)(()=>{this.CONSUME(oF),this.SUBRULE2(this.nodeLabel),this.CONSUME(oB)},"ALT")}])})},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(aZ),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:(0,I.K)(()=>{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:(0,I.K)(()=>this.CONSUME(aJ),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(aZ),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(ou),this.CONSUME(od),this.CONSUME(aJ),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(oO),this.CONSUME(oR),this.CONSUME(ob)}),this.RULE("classSuffix",()=>{this.CONSUME(oN),this.CONSUME(aJ),this.MANY(()=>{this.CONSUME(oG),this.CONSUME2(aJ)})}),this.RULE("jsonStatement",()=>{this.CONSUME(a8),this.CONSUME(a9),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(or),this.OR([{ALT:(0,I.K)(()=>this.CONSUME(oa),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oo),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(ol),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oc),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oh),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(of),this.CONSUME(aJ),this.MANY(()=>{this.CONSUME(oG),this.CONSUME2(aJ)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(om),this.CONSUME(aJ),this.MANY(()=>{this.CONSUME(oG),this.CONSUME2(aJ)}),this.CONSUME3(aJ),this.MANY2(()=>{this.CONSUME2(oG),this.CONSUME4(aJ)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(oT),this.CONSUME(aJ),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(oG),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(aY),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oH),"ALT")},{ALT:(0,I.K)(()=>{this.CONSUME(oM),this.CONSUME2(aY)},"ALT")}]),this.CONSUME(oW),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(aY),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oV),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(aX),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oz),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oH),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oY),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oX),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oJ),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oq),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oZ),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oW),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oK),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oj),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oF),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oB),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oD),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o$),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oP),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oM),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===aJ||e===oV||e===aZ)&&this.LA(2).tokenType===ow}isStatementStart(){let e=this.LA(1).tokenType;return e!==n5&&e!==a1&&e!==a0}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===aJ&&!0===o4[this.LA(1).image.toLowerCase()]}hasLabeledRight(e){if(!o5(this.LA(1)))return!1;for(let t=2;;t++){let i=this.LA(t);if(e.includes(i.tokenType))return!0;if(!o5(i))return!1}}},o9=class extends Error{constructor(e,t,i){super(`${e} (line ${t}, column ${i})`),this.line=t,this.column=i,this.name="UsecaseJsonError"}static{(0,I.K)(this,"UsecaseJsonError")}},o7=(0,I.K)((e,t,i,s)=>{let n=i,r=s,a=Math.min(Math.max(t,0),e.length);for(let t=0;t<a;t++){let i=e[t];"\r"===i?(n++,r=1):"\n"===i?(0===t||"\r"!==e[t-1])&&(n++,r=1):r++}return{line:n,column:r}},"locationAtOffset"),le=(0,I.K)((e,t,i,s)=>{let n=/\bposition (\d+)\b/u.exec(e);if(n)return o7(t,Number.parseInt(n[1],10),i,s);let r=/\bline (\d+) column (\d+)\b/u.exec(e);if(r){let e=Number.parseInt(r[1],10),t=Number.parseInt(r[2],10);return{line:i+e-1,column:1===e?s+t-1:t}}if(/unexpected end|end of json input/iu.test(e))return o7(t,t.length,i,s)},"locationFromErrorMessage"),lt=class extends Error{constructor(e){super("Invalid JSON token"),this.offset=e}static{(0,I.K)(this,"JsonWalkError")}},li=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}static{(0,I.K)(this,"PropertyOrderCollector")}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new lt(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("f"===t)this.consumeLiteral("false");else if("n"===t)this.consumeLiteral("null");else if("-"===t||t>="0"&&t<="9")this.consumeNumber();else throw new lt(this.offset)}collectObject(e){this.offset++;let t=[],i=new Set;if(this.propertyOrder[e]=t,this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;for(;this.offset<this.text.length&&'"'===this.text[this.offset];){let s=this.readString(!0),n=`${e}/${s.replaceAll("~","~0").replaceAll("/","~1")}`;if(i.has(s)?this.deletePointerSubtree(n):(i.add(s),t.push(s)),this.skipWhitespace(),":"!==this.text[this.offset])break;if(this.offset++,this.collectValue(n),this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new lt(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;let t=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${t}`),t++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new lt(this.offset)}readString(e){this.offset++;let t="";for(;this.offset<this.text.length;){let i=this.offset,s=this.text[this.offset++];if('"'===s)return t;if(32>s.charCodeAt(0))throw new lt(i);if("\\"!==s){e&&(t+=s);continue}let n=this.offset,r=this.text[this.offset++];switch(r){case'"':case"\\":case"/":e&&(t+=r);break;case"b":e&&(t+="\b");break;case"f":e&&(t+="\f");break;case"n":e&&(t+="\n");break;case"r":e&&(t+="\r");break;case"t":e&&(t+=" ");break;case"u":{let i=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(i))throw new lt(this.offset);e&&(t+=String.fromCharCode(Number.parseInt(i,16))),this.offset+=4;break}default:throw new lt(n)}}throw new lt(this.offset)}consumeLiteral(e){let t=0;for(let i of e){if(this.text[this.offset+t]!==i)throw new lt(this.offset+t);t++}this.offset+=e.length}consumeNumber(){if("-"===this.text[this.offset]&&this.offset++,"0"===this.text[this.offset])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 lt(this.offset);if("."===this.text[this.offset]){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new lt(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}if("e"===this.text[this.offset]||"E"===this.text[this.offset]){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 lt(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&&"\n"!==e&&"\r"!==e)return;this.offset++}}deletePointerSubtree(e){let t=`${e}/`;for(let i of Object.keys(this.propertyOrder))(i===e||i.startsWith(t))&&delete this.propertyOrder[i]}};function ls(e,t,i){let s;try{s=JSON.parse(e)}catch(r){let s=r instanceof Error?r.message:String(r),n=le(s,e,t,i);if(!n){let s=0;try{new li(e).collect()}catch(e){e instanceof lt&&(s=e.offset)}n=o7(e,s,t,i)}throw new o9(`Invalid JSON: ${s}`,n.line,n.column)}if("object"!=typeof s||null===s||Array.isArray(s))throw new o9("JSON value must have an object root",t,i);return{value:s,propertyOrder:new li(e).collect()}}(0,I.K)(ls,"parseOrderedJsonObject");var ln=(0,I.K)(e=>({shape:"normal"===e.type?"actor":"hollow"===e.type?"actor-hollow":"awesome"===e.type?"actor-awesome":"actor-icon",...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"actor",actorType:e.type,business:e.business,labelType:e.labelType,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"actorNode"),lr=(0,I.K)(e=>({shape:e.shape,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"usecase",useCaseShape:e.shape,business:e.business,labelType:e.labelType,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"useCaseNode"),la=(0,I.K)(e=>({label:e.label,shape:"note",attrs:{kind:"note",target:e.target,labelType:e.labelType}}),"noteNode"),lo=(0,I.K)(e=>({label:e.id,shape:"json-table",...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"json",value:e.value,propertyOrder:e.propertyOrder,labelType:"text"}}),"jsonNode"),ll=(0,I.K)(e=>({id:e.id,source:e.source,target:e.target,...e.label?{label:e.label}:{},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{relationshipType:e.type,arrowType:e.arrowType,minlen:e.minlen,explicitId:e.explicitId,animate:e.animate,...e.animation?{animation:e.animation}:{},...e.labelType?{labelType:e.labelType}:{}}}),"relationshipEdge"),lc=(0,I.K)(e=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:"note",arrowType:2,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),lh=(0,I.K)((e,t,i,s)=>{let n={};for(let t of e.getActors().values())n[t.id]=ln(t);for(let t of e.getUseCases().values())n[t.id]=lr(t);for(let t of e.getNotes().values())n[t.id]=la(t);for(let t of e.getJsonNodes().values())n[t.id]=lo(t);let r={};for(let t of e.getSystemBoundaries().values())r[t.id]={...t.label===t.id?{}:{title:t.label},nodes:[...t.members],...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:t.type,labelType:t.labelType}};let a={};for(let t of e.getClassDefs().values())a[t.id]={styles:[...t.styles]};let o=e.getDirection();return{version:1,diagramType:"usecase",source:t,header:{keyword:"usecase",direction:"TD"===o?"TB":o,span:i},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:n,edges:[...e.getRelationships().map(ll),...[...e.getNotes().values()].map(lc)],groups:r,classDefs:a,statements:s}},"buildUsecaseGraphAST"),lu=(0,I.K)(e=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,"locationText"),ld=(0,I.K)(e=>void 0===e?"":` (label "${e}")`,"labelSuffix"),lp=(0,I.K)(e=>e.generated?e.label:void 0,"generatedFrom"),lf=(0,I.K)((e,t)=>{for(let i of t)e.includes(i)||e.push(i)},"pushUnique"),lm=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()}static{(0,I.K)(this,"UsecaseModelBuilder")}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,i,s){this.metadataAssignments.push({target:e,targetLocation:t,metadata:i,statement:s})}addClassDef(e,t){this.classDefinitions.push({ids:e,styles:t})}addClassAssignment(e,t){this.classAssignments.push({targets:e,classes:t})}addStyleAssignment(e,t,i){this.styleAssignments.push({target:e,location:t,styles:i})}setDirection(e){this.directions.push("TD"===e?"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,i=new Map,s=new Map,n=new Map;for(let e of this.relationshipDrafts)this.recordFirst(n,e.source.id,e.source.location.span[0]),this.recordFirst(n,e.target.id,e.target.location.span[0]);for(let e of this.elements)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.boundaries)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.jsonDrafts)this.recordFirst(n,e.id,e.location.span[0]);for(let e of[...this.elements.map(e=>({offset:e.location.span[0],type:"element",value:e})),...this.boundaries.map(e=>({offset:e.location.span[0],type:"boundary",value:e})),...this.jsonDrafts.map(e=>({offset:e.location.span[0],type:"json",value:e})),...this.relationshipDrafts.filter(e=>e.explicitId).map(e=>({offset:e.explicitIdLocation.span[0],type:"edge",value:e}))].sort((e,t)=>e.offset-t.offset))"element"===e.type?this.collectElement(e.value,t,i):"boundary"===e.type?this.collectBoundary(e.value,t,s):"json"===e.type?this.registerUnique(t,e.value.id,"json",e.value.location,!1):this.registerUnique(t,e.value.explicitId,"edge",e.value.explicitIdLocation,!1);this.materializeElements(i,n),this.materializeBoundaries(s,n),this.materializeJson(n);let r=this.materializeRelationships(t,i,n);this.reorderElements(i,n),this.applyMetadataAssignments(t,i,s,r),this.validateAndRefreshElements(i),this.refreshBoundaries(s,i),this.materializeNotes(t),this.applyClassDefinitions(),this.applyClassesAndStyles(t,r),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...t].map(([e,t])=>[e,t.kind]));let a=lh(this,this.source,e,this.statements);return this.model.ast=a,this.db.commit(this.model),a}collectElement(e,t,i){let s=t.get(e.id),n=lp({generated:e.generated,label:e.label.text});s&&s.kind!==e.kind&&this.conflict(`ID '${e.id}' is declared as both ${s.kind} and ${e.kind}`,e.location,s.location,n,lp(s)),s&&(s.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,s.location,n,lp(s));let r=i.get(e.id);if(!r){let s={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(s,e.metadata),i.set(e.id,s),t.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}(r.label.text!==e.label.text||r.label.type!==e.label.type)&&this.conflict(`ID '${e.id}' has conflicting labels`,e.location,r.location),e.shape&&r.shape&&e.shape!==r.shape&&this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,r.location),e.parentId&&r.parentId&&e.parentId!==r.parentId&&this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,r.parentLocation??r.location),e.stereotype&&r.stereotype&&e.stereotype!==r.stereotype&&this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,r.stereotypeLocation??r.location),r.shape??=e.shape,r.parentId??=e.parentId,r.parentLocation??=e.parentLocation,r.stereotype??=e.stereotype,r.stereotypeLocation??=e.stereotype?e.location:void 0,lf(r.classes,e.classes),this.applyDeclarationMetadata(r,e.metadata)}collectBoundary(e,t,i){let s=t.get(e.id),n=lp({generated:e.generated,label:e.label.text});s&&"boundary"!==s.kind&&this.conflict(`ID '${e.id}' is declared as both ${s.kind} and boundary`,e.location,s.location,n,lp(s)),s&&(s.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,s.location,n,lp(s));let r=i.get(e.id);if(r){(r.label.text!==e.label.text||r.label.type!==e.label.type)&&this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,r.location),lf(r.classes,e.classes);return}i.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 i of[...e.values()].sort((e,i)=>(t.get(e.id)??0)-(t.get(i.id)??0)))this.setElementModel(i)}materializeBoundaries(e,t){for(let i of[...e.values()].sort((e,i)=>(t.get(e.id)??0)-(t.get(i.id)??0)))this.model.systemBoundaries.set(i.id,{id:i.id,label:i.label.text,labelType:i.label.type,type:i.type??"rect",members:[],classes:[...i.classes],styles:[...i.styles]})}materializeJson(e){for(let t of[...this.jsonDrafts].sort((t,i)=>(e.get(t.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,i){let s=new Map,n=0;for(let r of this.relationshipDrafts){let a=this.resolveEndpoint(r.source,e,t,i),o=this.resolveEndpoint(r.target,e,t,i);this.validateRelationship(r,a,o,e);let l=r.explicitId??`edge-${n++}`,c={id:l,explicitId:!!r.explicitId,source:r.source.id,target:r.target.id,type:r.type,arrowType:r.arrowType,...r.label?{label:r.label.text,labelType:r.label.type}:{},minlen:r.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(c),s.set(l,{draft:r,relationship:c})}return this.model.relationshipCounter=n,s}resolveEndpoint(e,t,i,s){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${lu(e.location)}`);let n=t.get(e.id);return n?n.kind:(i.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(s,e.id,e.location.span[0]),"usecase")}reorderElements(e,t){let i=new Map(this.model.actors),s=new Map(this.model.useCases);for(let n of(this.model.actors.clear(),this.model.useCases.clear(),[...e.values()].sort((e,i)=>(t.get(e.id)??0)-(t.get(i.id)??0)))){i.has(n.id)||s.has(n.id)||this.setElementModel(n);let e=i.get(n.id)??this.model.actors.get(n.id),t=s.get(n.id)??this.model.useCases.get(n.id);e?this.model.actors.set(n.id,e):t&&this.model.useCases.set(n.id,t)}}applyMetadataAssignments(e,t,i,s){for(let n of this.metadataAssignments){let r=e.get(n.target);if(!r){let e=this.inferMetadataKind(n.metadata);throw Error(`Metadata target '${n.target}' is unresolved${e?` (metadata implies ${e})`:""} at ${lu(n.targetLocation)}`)}if("actor"===r.kind||"usecase"===r.kind)this.applyStandaloneElementMetadata(t.get(n.target),n.metadata);else if("boundary"===r.kind){let e=i.get(n.target);for(let t of n.metadata.properties)("type"!==t.key||"rect"!==t.value&&"package"!==t.value)&&this.invalidMetadata(n.target,r.kind,t),e.type=t.value}else if("edge"===r.kind){let e=s.get(n.target);if(!e)throw Error(`Metadata target '${n.target}' is not an explicit edge at ${lu(n.targetLocation)}`);for(let t of(n.statement.kind="edgeMetadata",n.statement.edges=[{id:n.target,span:n.statement.span,idSpan:n.targetLocation.span,...n.statement.metadata?{metadata:n.statement.metadata}:{}}],delete n.statement.nodes,n.metadata.properties))"animate"===t.key&&"boolean"==typeof t.value?e.relationship.animate=t.value:"animation"===t.key&&("fast"===t.value||"slow"===t.value)?(e.relationship.animation=t.value,e.relationship.animate=!0):this.invalidMetadata(n.target,r.kind,t)}else for(let e of n.metadata.properties)this.invalidMetadata(n.target,r.kind,e)}for(let{relationship:e}of s.values())e.animation&&(e.animate=!0)}applyStandaloneElementMetadata(e,t){for(let i of t.properties)"actor"===e.kind?this.applyActorProperty(e,i,!0):"business"===i.key&&"boolean"==typeof i.value?e.business=i.value:this.invalidMetadata(e.id,e.kind,i)}applyDeclarationMetadata(e,t){if(t)for(let i of t.properties)"actor"===e.kind?this.applyActorProperty(e,i,!1):"business"===i.key&&"boolean"==typeof i.value?(void 0!==e.business&&e.business!==i.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,i.location,e.location),e.business=i.value):this.invalidMetadata(e.id,e.kind,i)}applyActorProperty(e,t,i){"type"===t.key&&("normal"===t.value||"hollow"===t.value||"awesome"===t.value)?(i||void 0===e.actorType||e.actorType===t.value||this.conflict(`Actor '${e.id}' has conflicting type metadata`,t.location,e.location),e.actorType=t.value):"icon"===t.key&&"string"==typeof t.value?(i||void 0===e.icon||e.icon===t.value||this.conflict(`Actor '${e.id}' has conflicting icon metadata`,t.location,e.location),e.icon=t.value):"business"===t.key&&"boolean"==typeof t.value?(i||void 0===e.business||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 e=t.icon?"icon":t.actorType??"normal";if("actor"===t.kind){if(t.icon&&t.actorType&&"normal"!==t.actorType)throw Error(`Actor '${t.id}' cannot combine icon with type '${t.actorType}' at ${lu(t.location)}`);if(t.business&&("icon"===e||"awesome"===e))throw Error(`Business actor '${t.id}' must use normal or hollow geometry at ${lu(t.location)}`)}else if((t.shape??"ellipse")==="rect"&&t.business)throw Error(`Rectangular use case '${t.id}' cannot be a business use case at ${lu(t.location)}`);this.setElementModel(t)}}refreshBoundaries(e,t){for(let t of e.values())t.members.length=0;for(let t of[...this.elements].sort((e,t)=>e.location.span[0]-t.location.span[0])){if(!t.parentId)continue;let i=e.get(t.parentId);if(!i)throw Error(`Parent boundary '${t.parentId}' for '${t.id}' is unresolved at ${lu(t.parentLocation??t.location)}`);i.members.includes(t.id)||i.members.push(t.id)}for(let i of t.values())if(i.parentId&&!e.has(i.parentId))throw Error(`Parent boundary '${i.parentId}' for '${i.id}' is unresolved at ${lu(i.parentLocation??i.location)}`);for(let t of e.values()){let e=this.model.systemBoundaries.get(t.id);e.type=t.type??"rect",e.members=[...t.members],e.classes=[...t.classes],e.styles=[...t.styles]}}materializeNotes(e){let t=0;for(let i of this.noteDrafts){let s=e.get(i.target);if(!s)throw Error(`Note target '${i.target}' is unresolved at ${lu(i.targetLocation)}`);"actor"!==s.kind&&"usecase"!==s.kind&&this.conflict(`Note target '${i.target}' must be an actor or use case, not ${s.kind}`,i.targetLocation,s.location);let n=`note-${t++}`;this.model.notes.set(n,{id:n,target:i.target,label:i.label.text,labelType:i.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 i of this.classAssignments)for(let s of i.targets)lf(this.getStylable(s.id,e,t,s.location).classes,i.classes);for(let i of this.styleAssignments)this.getStylable(i.target,e,t,i.location).styles.push(...i.styles)}getStylable(e,t,i,s){let n=t.get(e)?.kind,r="actor"===n?this.model.actors.get(e):"usecase"===n?this.model.useCases.get(e):"boundary"===n?this.model.systemBoundaries.get(e):"json"===n?this.model.jsonNodes.get(e):"edge"===n?i.get(e)?.relationship:void 0;if(!r)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${lu(s)}`);return r}validateRelationship(e,t,i,s){let n=(0,I.K)(e=>"actor"===e||"usecase"===e||"json"===e,"allowed");if(n(t)||this.conflict(`Relationship source '${e.source.id}' cannot be ${t}`,e.source.location,s.get(e.source.id).location),n(i)||this.conflict(`Relationship target '${e.target.id}' cannot be ${i}`,e.target.location,s.get(e.target.id).location),("include"===e.type||"extend"===e.type)&&("usecase"!==t||"usecase"!==i))throw Error(`${e.type} relationship requires use-case endpoints at ${lu(e.location)}`);if("generalization"===e.type&&("actor"!==t&&"usecase"!==t||t!==i))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${lu(e.location)}`);if("association"===e.type&&("json"===t||"json"===i)&&![0,1,2].includes(e.arrowType))throw Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${lu(e.location)}`)}setElementModel(e){if("actor"===e.kind){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 i of e.properties)if("icon"===i.key)t.clear(),t.add("actor");else if("animate"===i.key||"animation"===i.key)t.clear(),t.add("edge");else if("type"===i.key)t.clear(),"rect"===i.value||"package"===i.value?t.add("boundary"):("normal"===i.value||"hollow"===i.value||"awesome"===i.value)&&t.add("actor");else{if("business"!==i.key)return;t.delete("boundary"),t.delete("edge")}return 1===t.size?[...t][0]:void 0}invalidMetadata(e,t,i){throw Error(`Metadata property '${i.key}' is invalid for ${t} '${e}' at ${lu(i.location)}`)}registerUnique(e,t,i,s,n){let r=e.get(t);r&&this.conflict(`ID '${t}' is declared more than once (${r.kind} and ${i})`,s,r.location,void 0,lp(r)),e.set(t,{kind:i,location:s,generated:n})}recordFirst(e,t,i){let s=e.get(t);(void 0===s||i<s)&&e.set(t,i)}conflict(e,t,i,s,n){throw Error(`${e} at ${lu(t)}${ld(s)}; previous declaration at ${lu(i)}${ld(n)}`)}},lT=o8.getBaseCstVisitorConstructor(),lg=new class extends lT{constructor(){super(),this.builder=new lm(a$),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{(0,I.K)(this,"UsecaseVisitor")}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],i=[];for(let t of this.nodes(e,"line"))i.push(this.visit(t));this.builder.setStatements(i),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],i=this.tokens(e,"ACC_DESCR_BLOCK")[0],s=t?t.image.slice(t.image.indexOf(":")+1).trim():i.image.slice(i.image.indexOf("{")+1,i.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(s),{kind:"accDescr",span:[0,0]}}actorStatement(e){let t=this.nodes(e,"actorItem"),i=t.map(e=>this.visit(e)),s=this.nodes(e,"relationTail")[0],n=i.map((e,i)=>this.actorOccurrence(t[i],e,!0));for(let e of i)this.builder.addElement(this.actorDraft(e));if(!s)return{kind:"node",span:[0,0],nodes:n};let r=this.visit(s);r.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(r.target));let a=this.relationshipDraft(i[0],r,this.nodeLocation(s));this.builder.addRelationship(a);let o=a.explicitId??`edge-${this.anonymousEdge++}`;return n.push(this.entityOccurrence(this.nodes(s.children,"entityName")[0],r.target,r.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:n,edges:[{id:o,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}actorItem(e){let t=this.visit(this.nodes(e,"actorName")[0]),i=this.nodes(e,"metadata")[0],s=this.nodes(e,"stereotype")[0],n=this.nodes(e,"classSuffix")[0],r=n?this.visit(n):{classes:[],spans:[]};return{...t,...i?{metadata:this.visit(i)}:{},...s?{stereotype:this.visit(s)}:{},classes:r.classes,classSpans:r.spans}}actorName(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(t){let i=this.nodes(e,"nodeLabel")[0],s=i?this.visit(i):this.tokenLabel(t);return{id:t.image,label:s,location:this.tokenLocation(t),generated:!1,classes:[],classSpans:[]}}let s=this.tokenLabel(i);return{id:this.generateId(s.text),label:s,location:this.tokenLocation(i),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let t=this.nodes(e,"actorItem"),i=t.map(e=>this.visit(e));for(let e of i)this.builder.addElement(this.actorDraft(e));return{kind:"node",span:[0,0],nodes:i.map((e,i)=>this.actorOccurrence(t[i],e,!0))}}entityStatement(e){let t=this.nodes(e,"entityName"),i=this.visit(t[0]),s=this.nodes(e,"relationTail")[0];if(!s)return i.explicitDeclaration=!0,i.shape??="ellipse",this.builder.addElement(this.entityDraft(i)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(t[0],i,!0)]};i.explicitDeclaration&&this.builder.addElement(this.entityDraft(i));let n=this.visit(s);n.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(n.target));let r={source:this.endpoint(i),target:this.endpoint(n.target),location:this.nodeLocation(s),...n.explicitId?{explicitId:n.explicitId,explicitIdLocation:n.explicitIdLocation}:{},...n.arrow};this.builder.addRelationship(r);let a=r.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(t[0],i,i.explicitDeclaration),this.entityOccurrence(this.nodes(s.children,"entityName")[0],n.target,n.target.explicitDeclaration)],edges:[{id:a,span:[0,0],...r.explicitIdLocation?{idSpan:r.explicitIdLocation.span}:{},...r.label?{labelSpan:r.label.span}:{}}]}}entityName(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],s=this.nodes(e,"nodeLabel")[0],n=this.nodes(e,"useCaseMetadata")[0],r=this.nodes(e,"stereotype")[0],a=this.nodes(e,"classSuffix")[0],o=a?this.visit(a):{classes:[],spans:[]};if(t){let i=s?this.visit(s):this.tokenLabel(t),a=s?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:t.image,label:i,location:this.tokenLocation(t),generated:!1,...a?{shape:a}:{},...n?{metadata:this.visit(n)}:{},...r?{stereotype:this.visit(r)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(a||n||r)}}let l=this.tokenLabel(i);return{id:this.generateId(l.text),label:l,location:this.tokenLocation(i),generated:!0,...n?{metadata:this.visit(n)}:{},...r?{stereotype:this.visit(r)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(n||r)}}nodeLabel(e){let t=this.allTokens(e);if(1===t.length&&("PLAIN_STRING"===t[0].tokenType.name||"MARKDOWN_STRING"===t[0].tokenType.name))return this.tokenLabel(t[0]);let i=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return{text:this.source.slice(i[0],i[1]),type:"text",span:i}}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:0,minlen:1};let t=this.tokens(e,"INCLUDE").length?"include":"extend",i=this.tokens(e,"include"===t?"INCLUDE":"EXTEND")[0];return{type:t,arrowType:0,label:{text:t,type:"text",span:this.tokenSpan(i)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map(e=>this.visit(e)),location:this.ctxLocation(e)}}metadataProperty(e){let t=this.allTokens(e).filter(e=>"COLON"!==e.tokenType.name),i=t[0],s=t[1],n="TRUE"===s.tokenType.name||"FALSE"!==s.tokenType.name&&this.decodePlain(s),r=[i.startOffset,(s.endOffset??s.startOffset)+1];return{key:this.decodePlain(i),value:n,span:r,keySpan:this.contentSpan(i),valueSpan:this.contentSpan(s),location:this.tokenLocation(i)}}metadataSeparator(e){}systemBoundaryStatement(e){let t=this.visit(this.nodes(e,"systemBoundaryName")[0]),i=this.nodes(e,"classSuffix")[0],s=i?this.visit(i):{classes:[],spans:[]};t.classes=s.classes,this.builder.addBoundary(t);let n=this.parentBoundary;this.parentBoundary={id:t.id,location:t.location};let r=this.nodes(e,"systemBoundaryContent")[0],a=r?this.visit(r):[];this.parentBoundary=n;let o=this.tokens(e,"END")[0],l=this.nodes(e,"metadata")[0],c=l?this.visit(l):void 0,h={kind:"group",span:[0,0],group:t.id,idSpan:t.location.span,titleSpan:t.label.span,endSpan:this.tokenSpan(o),classSpans:s.spans,...c?{metadata:c.properties.map(({key:e,span:t,keySpan:i,valueSpan:s})=>({key:e,span:t,keySpan:i,valueSpan:s}))}:{},...a.length?{children:a}:{}};return c&&this.builder.addMetadataAssignment(t.id,t.location,c,h),h}systemBoundaryName(e){let t=this.tokens(e,"IDENTIFIER")[0];if(t){let i=this.nodes(e,"nodeLabel")[0];return{id:t.image,label:i?this.visit(i):this.tokenLabel(t),location:this.tokenLocation(t),generated:!1,classes:[]}}let i=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],s=this.tokenLabel(i);return{id:this.generateId(s.text),label:s,location:this.tokenLocation(i),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((e,t)=>(e.location?.startOffset??0)-(t.location?.startOffset??0)).map(e=>this.wrap(e,this.visit(e)))}boundaryElement(e){let t=this.nodes(e,"actorDeclarationOnly")[0];if(t)return this.visit(t);let i=this.nodes(e,"entityName")[0],s=this.visit(i);return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(i,s,!0)]}}metadataAssignmentStatement(e){let t=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),i=this.visit(this.nodes(e,"metadata")[0]),s={kind:"metadata",span:[0,0],nodes:[{id:t.id,span:t.location.span,idSpan:t.location.span}],metadata:i.properties.map(({key:e,span:t,keySpan:i,valueSpan:s})=>({key:e,span:t,keySpan:i,valueSpan:s}))};return this.builder.addMetadataAssignment(t.id,t.location,i,s),s}metadataAssignmentTarget(e){let t=this.allTokens(e)[0],i=this.tokenLabel(t);return{id:"IDENTIFIER"===t.tokenType.name?t.image:this.generateId(i.text),location:this.tokenLocation(t)}}noteStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:t.image,targetLocation:this.tokenLocation(t),label:i,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:i.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(e=>e.image),spans:t.map(e=>this.tokenSpan(e))}}jsonStatement(e){let t=this.tokens(e,"JSON_DECLARATION_START")[0],i=this.tokens(e,"JSON_OBJECT_LITERAL")[0],s=/^json[\t ]+(\w+)/.exec(t.image),n=s[1],r=s[0].length-n.length,a={span:[t.startOffset+r,t.startOffset+r+n.length],line:t.startLine??1,column:(t.startColumn??1)+r},o=ls(i.image,i.startLine??1,i.startColumn??1),l=this.nodes(e,"classSuffix")[0],c=l?this.visit(l):{classes:[],spans:[]},h={id:n,value:o.value,propertyOrder:o.propertyOrder,location:a,classes:c.classes};return this.builder.addJson(h),{kind:"json",span:[0,0],nodes:[{id:n,span:a.span,idSpan:a.span,defines:!0,classSpans:c.spans}],classSpans:c.spans}}directionStatement(e){let t=this.allTokens(e).find(e=>["TD","TB","BT","RL","LR"].includes(e.tokenType.name));return this.builder.setDirection(t.image),{kind:"direction",span:[0,0]}}classDefStatement(e){let t=this.tokens(e,"IDENTIFIER"),i=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(t.map(e=>e.image),i),{kind:"classDef",span:[0,0],ref:t[0].image,refSpan:this.tokenSpan(t[0])}}classStatement(e){let t=this.tokens(e,"IDENTIFIER"),i=1;for(;i<t.length&&this.source.slice((t[i-1].endOffset??t[i-1].startOffset)+1,t[i].startOffset).includes(",");i++);let s=t.slice(0,i).map(e=>({id:e.image,location:this.tokenLocation(e)})),n=t.slice(i).map(e=>e.image);return this.builder.addClassAssignment(s,n),{kind:"classAssign",span:[0,0],ref:n[0],refSpan:this.tokenSpan(t[i]),nodes:s.map(({id:e,location:t})=>({id:e,span:t.span,idSpan:t.span}))}}styleStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(t.image,this.tokenLocation(t),i),{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(e=>this.visit(e))}styleValue(e){let t=this.allTokens(e),i=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return this.source.slice(i[0],i[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map(e=>e.image).join("")}forwardSolidOperator(e){let t=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:0,minlen:this.solidMinlen(t)}}backwardSolidOperator(e){let t=this.tokens(e,"BACKWARD_SOLID")[0],i=this.nodes(e,"edgeLabel")[0],s=i?this.tokens(e,"MARKERLESS_SOLID").at(-1):t;return{type:"association",arrowType:1,minlen:this.solidMinlen(s),...i?{label:this.visit(i)}:{}}}markerlessSolidOperator(e){let t=this.nodes(e,"edgeLabel")[0],i=this.allTokens(e);if(!t)return{type:"association",arrowType:2,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};let s=i.at(-1),n="FORWARD_SOLID"===s.tokenType.name?0:"FORWARD_CIRCLE"===s.tokenType.name?3:"FORWARD_CROSS"===s.tokenType.name?4:2;return{type:"association",arrowType:n,label:this.visit(t),minlen:0===n||2===n?this.solidMinlen(s):1}}forwardCircleOperator(e){return{type:"association",arrowType:3,minlen:1}}backwardCircleOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:5,minlen:1,...t?{label:this.visit(t)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:4,minlen:1}}backwardCrossOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:6,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,i){return{source:this.endpoint(e,!0),target:this.endpoint(t.target),location:i,...t.explicitId?{explicitId:t.explicitId,explicitIdLocation:t.explicitIdLocation}:{},...t.arrow}}actorOccurrence(e,t,i){return{id:t.id,span:this.nodeSpan(e),idSpan:t.location.span,labelSpan:t.label.span,...i?{defines:!0}:{},...t.stereotype?{stereotypeSpan:t.stereotype.span}:{},...t.metadata?{metadata:t.metadata.properties.map(({key:e,span:t,keySpan:i,valueSpan:s})=>({key:e,span:t,keySpan:i,valueSpan:s}))}:{},...t.classSpans.length?{classSpans:t.classSpans}:{}}}entityOccurrence(e,t,i){return this.actorOccurrence(e,t,i)}wrap(e,t){if("blank"===t.kind||"comment"===t.kind)return t;for(let i of(t.span=this.nodeSpan(e),t.edges??[]))i.span=t.span;return t}tokenLabel(e){let t="MARKDOWN_STRING"===e.tokenType.name?"markdown":"text",i="markdown"===t?2:+("PLAIN_STRING"===e.tokenType.name),s=this.tokenSpan(e,i);return{text:this.source.slice(s[0],s[1]),type:t,span:s}}decodePlain(e){return"PLAIN_STRING"===e.tokenType.name?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,"PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name))}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(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),i=t[0],s=t.at(-1);return{span:[i.startOffset,Math.min(this.source.length,(s.endOffset??s.startOffset+s.image.length-1)+1)],line:i.startLine??1,column:i.startColumn??1}}tokenLocation(e){let t="PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name);return{span:this.tokenSpan(e,t),line:e.startLine??1,column:(e.startColumn??1)+t}}nodeSpan(e){let t=this.allTokens(e.children).filter(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),i=t[0],s=t.at(-1);if(!i||!s)throw Error("Usecase CST node has no source token");return[i.startOffset,Math.min(this.source.length,(s.endOffset??s.startOffset+s.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(e=>"children"in e)}tokens(e,t){return(e[t]??[]).filter(e=>"tokenTypeIdx"in e)}firstNode(e,...t){for(let i of t){let t=this.nodes(e,i)[0];if(t)return t}throw Error(`Usecase CST is missing one of: ${t.join(", ")}`)}allTokens(e){let t=[];for(let i of Object.values(e))for(let e of i)"tokenTypeIdx"in e?t.push(e):t.push(...this.allTokens(e.children));return t.sort((e,t)=>e.startOffset-t.startOffset)}},lE={parse:(0,I.K)(async e=>{a$.clear(),o8.input=[];try{an({diagramType:"usecase",lexer:o6,parser:o8,entry:(0,I.K)(()=>o8.start(),"entry"),visit:(0,I.K)(t=>lg.build(t,e),"visit")},e)}catch(i){a$.clear();let t=o8.errors[0];if(t){let{token:s}=t,n=Number.isFinite(s.startOffset)?s.startOffset:e.length,r="number"==typeof s.endOffset&&Number.isFinite(s.endOffset)?s.endOffset+1:n,a=s.startLine??e.slice(0,n).split(/\r\n|\r|\n/).length,o=Math.max(e.lastIndexOf("\n",n-1),e.lastIndexOf("\r",n-1)),l=s.startColumn??n-o,c=i instanceof Error?i.message:String(i);throw Error(`${c} at line ${a}, column ${l} [${n},${r})`)}throw i}},"parse")},ly=["point","circle","cross","extension"],lA={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},lL=(0,I.K)((e,t)=>{let[i,s]=[e,t].map(e=>e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${i}-${s}`},"usecaseDomId"),lS=(0,I.K)(e=>`usecase-${e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),lO=(0,I.K)((e,t)=>"markdown"!==t?e:(0,b.O6)(e).map(e=>e.map(e=>e.content).join(" ")).join("\n"),"getAccessibleLabel"),lb=(0,I.K)(e=>{let t=lO(e.label??e.id,e.labelType);if(lA[e.shape]){let i=e.actorType&&"normal"!==e.actorType?`${e.actorType} `:"",s=e.business?"business ":"",n=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${s}${i}actor ${t}${n}`}if("note"===e.shape)return`Note for ${e.noteTargetLabel??e.noteTarget??""}: ${t}`;if("usecaseJsonTable"===e.shape){let i=(e.jsonRows??[]).map(e=>`${e.accessibleKey}: ${e.value}`).join("; ");return i?`${t}: ${i}`:t}let i=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${e.business?"business ":""}use case ${t}${i}`},"getUsecaseNodeAccessibleName"),lR=(0,I.K)(e=>`${e.boundaryType} system boundary ${lO(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),lk=(0,I.K)(e=>{if("note"===e.relationshipType)return"";let t="association"===e.relationshipType&&e.label?`association ${lO(e.label,e.labelType)}`:e.relationshipType;return`${t} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),lN=(0,I.K)(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"escapePlainLabel"),lv=(0,I.K)(e=>e.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),lI=(0,I.K)((e,t)=>{for(let i of(e.diagramId=t,e.markers=[...ly],e.nodes))if(i.domId=lS(i.id),void 0!==i.label&&"text"===i.labelType&&(i.label=lN(i.label)),i.stereotype&&(i.stereotype=lN(i.stereotype)),i.isGroup||"usecaseJsonTable"!==i.shape||(i.jsonRows=i.jsonRows?.map(e=>({...e,key:lN(e.key),value:lN(e.value)}))),!i.isGroup&&("usecaseEllipse"===i.shape||"rect"===i.shape)&&i.stereotype){let e=i.label??lN(i.id);i.label=`\xab${lv(i.stereotype)}\xbb<br/>${"text"===i.labelType?lv(e):e}`,i.labelType="markdown",i.hasFoldedStereotype=!0,delete i.stereotype}for(let t of e.edges)void 0!==t.label&&"text"===t.labelType&&(t.label=lN(t.label));return e},"prepareUsecaseLayoutData"),lC=(0,I.K)((e,t,i)=>{for(let s of t.nodes){let n="string"==typeof s.domId?s.domId:lL(t.diagramId,s.id),r=e.select(`#${n}`),a=s.isGroup?"boundary":lA[s.shape]?"actor":"note"===s.shape?"note":"usecaseJsonTable"===s.shape?"json":"usecase",o=i.nodes.get(s.id)??s.id;if(r.attr("data-usecase-id",s.id).attr("data-usecase-kind",a).attr("role","img").attr("aria-label",o),!s.isGroup&&("usecaseEllipse"===s.shape||"rect"===s.shape)&&"hasFoldedStereotype"in s&&!0===s.hasFoldedStereotype){let e=r.node(),t=e?.querySelector(".nodeLabel"),i=t?.querySelector("p")??t,s=i?.firstChild;if(i&&s?.nodeType===3){let e=i.ownerDocument.createElement("span");e.className="usecase-stereotype",i.insertBefore(e,s),e.appendChild(s)}else e?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let s=new Map(t.edges.map(e=>[e.id,e]));e.selectAll('path[data-et="edge"]').each(function(){let e=s.get(this.getAttribute("data-id")??"");if(!e)return;let n=(0,as.Ltv)(this);n.attr("id",lL(t.diagramId,e.id)).attr("data-usecase-id",e.id).attr("data-usecase-kind",e.internal?"note-connector":"relationship"),e.internal?n.attr("aria-hidden","true"):n.attr("role","img").attr("aria-label",i.edges.get(e.id)??e.id)})},"annotateUsecaseElements"),l_=(0,I.K)((e,t)=>{e.style("--mermaid-usecase-actor-font-size",`${t.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",t.actorFontFamily).style("--mermaid-usecase-actor-font-weight",t.actorFontWeight).style("--mermaid-usecase-font-size",`${t.usecaseFontSize}px`).style("--mermaid-usecase-font-family",t.usecaseFontFamily).style("--mermaid-usecase-font-weight",t.usecaseFontWeight)},"applyUsecaseFonts"),lx=(0,I.K)(async(e,t,i,s)=>{v.R.info("Drawing usecase diagram (unified)",t);let{layout:n}=(0,N.D7)(),r=s.db,a=r.getData(),o=new Map(a.nodes.map(e=>[e.id,lO(e.label??e.id,e.labelType)])),l={nodes:new Map(a.nodes.map(e=>[e.id,e.isGroup?lR(e):lb("note"===e.shape?{...e,noteTargetLabel:o.get(e.noteTarget??"")}:e)])),edges:new Map(a.edges.map(e=>[e.id,lk({...e,sourceLabel:o.get(e.source)??e.sourceLabel,targetLabel:o.get(e.target)??e.targetLabel})]))},c=(0,L.A)(t,a.config.securityLevel);a.layoutAlgorithm=(0,O.q7)(n),lI(a,t),l_(c,a),await (0,O.XX)(a,c),lC(c,a,l);let h=a.diagramPadding;k._K.insertTitle(c,"usecaseDiagramTitleText",0,r.getDiagramTitle?.()??""),(0,S.P)(c,h,"usecaseDiagram",a.useMaxWidth),l_(c,a)},"draw"),lU=(0,I.K)(e=>({actorBkg:e.usecaseActorBkg??e.actorBkg??e.mainBkg,actorBorder:e.usecaseActorBorder??e.actorBorder??e.primaryColor,bkg:e.usecaseBkg??e.mainBkg,border:e.usecaseBorder??e.nodeBorder??e.primaryColor,boundaryBkg:e.usecaseBoundaryBkg??e.clusterBkg,boundaryBorder:e.usecaseBoundaryBorder??e.clusterBorder,includeLine:e.usecaseIncludeLine??e.lineColor,extendLine:e.usecaseExtendLine??e.lineColor}),"roleColors"),lM=(0,I.K)(e=>{let{theme:t,bkgColorArray:i,borderColorArray:s}=e;if(!(0,R.P1)(t,s))return"";let n=(0,N.zj)().usecase?.colorScheme==="rotate",r=(0,R.rq)(e.look),a="handDrawn"===r,o=(0,R.Ic)(i),l="";for(let e=0;e<(0,R.Hu)(s);e++){let t=s[e],c=o?`fill: ${i[e%i.length]};`:"",h=`[data-look="${r}"][data-color-id="color-${e}"]`;l+=`
58
+
59
+ & ${h}.system-boundary rect.boundary-body,
60
+ & ${h}.system-boundary rect.boundary-tab,
61
+ & ${h}.system-boundary .boundary-body path,
62
+ & ${h}.system-boundary .boundary-tab path {
63
+ stroke: ${t};
64
+ ${c}
65
+ }
66
+ `,n&&(l+=`
67
+
68
+ /* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and
69
+ the business variant.
70
+
71
+ Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws
72
+ the body as a *pair* of paths, an outline stroked in the border colour and a hachure
73
+ fill stroked in the background colour, with no class to tell them apart. Stroking
74
+ both repaints the fill lines as border colour and the shape collapses into a solid
75
+ block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the
76
+ theme's uniform colours, exactly as handDrawn flowchart nodes do. */
77
+ & ${h}.usecase-element ellipse,
78
+ & ${h}.usecase-element rect {
79
+ stroke: ${t};
80
+ ${c}
81
+ }
82
+
83
+ /* The business marker is a single classed path, so it can be reached safely by name --
84
+ without it the marker keeps the uniform border beside a palette-coloured body. No
85
+ \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
86
+ & ${h}.usecase-element .usecase-business-marker {
87
+ stroke: ${t};
88
+ }
89
+
90
+ /* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph
91
+ group, never on its children, so the hollow variant's own \`fill="none"\` keeps
92
+ winning and a hollow actor stays hollow. Same reason as above for not descending
93
+ into the handDrawn paths. */
94
+ & ${h}.usecase-actor .usecase-actor-shape,
95
+ & ${h}.usecase-actor .usecase-actor-hollow,
96
+ & ${h}.usecase-actor .usecase-actor-awesome,
97
+ & ${h}.usecase-actor .usecase-actor-icon {
98
+ stroke: ${t};
99
+ ${c}
100
+ }
101
+ ${a?"":`
102
+ /* The group rule above reaches the glyph by inheritance, which the neo look breaks: it
103
+ ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths,
104
+ and a value set directly on the child always beats one inherited from the parent,
105
+ whatever the parent rule's specificity. So name the children too.
106
+
107
+ Emitted for every look *except* handDrawn, where roughjs draws the glyph as an
108
+ outline path plus a hachure fill path stroked in the fill colour, indistinguishable
109
+ in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no
110
+ \`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */
111
+ & ${h}.usecase-actor .usecase-actor-glyph path,
112
+ & ${h}.usecase-actor .usecase-actor-glyph circle {
113
+ stroke: ${t};
114
+ }
115
+ `}
116
+ `)}return l},"genColor"),lw={parser:lE,db:a$,renderer:{draw:lx},styles:(0,I.K)(e=>{let t=lU(e),i="handDrawn"===(0,R.rq)(e.look);return`
117
+ ${lM(e)}
118
+ & .usecase-actor {
119
+ color: ${e.actorTextColor??e.primaryTextColor};
120
+ }
121
+
122
+ & .usecase-actor-shape,
123
+ & .usecase-actor-hollow,
124
+ & .usecase-actor-awesome,
125
+ & .usecase-actor-icon {
126
+ fill: ${t.actorBkg};
127
+ stroke: ${t.actorBorder};
128
+ stroke-width: 2px;
129
+ }
130
+ ${i?"":`
131
+ /* The rule above colours the glyph group and lets its children inherit, which the neo
132
+ look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on
133
+ the glyph's own paths, and a value set directly on a child always beats one inherited
134
+ from its parent, whatever the parent rule's specificity. Since neo is the default look,
135
+ without this every actor renders in the node border colour rather than the actor
136
+ colour the rule above asks for.
137
+
138
+ \`.node\` is in the selector to outrank that neo rule rather than tie with it: both
139
+ would otherwise be one attribute plus one class plus one element, leaving the winner to
140
+ depend on which stylesheet is concatenated last.
141
+
142
+ Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */
143
+ & .node.usecase-actor .usecase-actor-glyph path,
144
+ & .node.usecase-actor .usecase-actor-glyph circle {
145
+ stroke: ${t.actorBorder};
146
+ }
147
+ `}
148
+ & .usecase-actor .nodeLabel,
149
+ & .actor-label {
150
+ color: ${e.actorTextColor??e.primaryTextColor};
151
+ fill: ${e.actorTextColor??e.primaryTextColor};
152
+ font-family: var(--mermaid-usecase-actor-font-family, ${e.fontFamily});
153
+ font-size: var(--mermaid-usecase-actor-font-size, 14px);
154
+ font-weight: var(--mermaid-usecase-actor-font-weight, normal);
155
+ }
156
+
157
+ & .usecase-element ellipse,
158
+ & .usecase-element rect,
159
+ & .usecase-business ellipse,
160
+ & .usecase-business rect {
161
+ fill: ${t.bkg};
162
+ stroke: ${t.border};
163
+ stroke-width: 2px;
164
+ }
165
+ ${i?"":`
166
+ /* The same interception the actor glyph hits, one element down: neo ships
167
+ \`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain
168
+ \`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node
169
+ border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no
170
+ equivalent neo rule and is already correct; restating it here costs nothing and means
171
+ the two forms cannot drift apart again.
172
+
173
+ Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than
174
+ tie with it -- on a tie the later stylesheet would win, which is how neo took this in
175
+ the first place. Skipped under handDrawn, where roughjs draws paths and neither element
176
+ exists. */
177
+ & [data-look="${(0,R.rq)(e.look)}"].node.usecase-element ellipse,
178
+ & [data-look="${(0,R.rq)(e.look)}"].node.usecase-element rect {
179
+ fill: ${t.bkg};
180
+ stroke: ${t.border};
181
+ }
182
+
183
+ /* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
184
+ way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
185
+ & [data-look="${(0,R.rq)(e.look)}"].node.usecase-element .usecase-business-marker {
186
+ stroke: ${t.border};
187
+ }
188
+ `}
189
+ & .usecase-element .nodeLabel,
190
+ & .usecase-label {
191
+ color: ${e.primaryTextColor};
192
+ fill: ${e.primaryTextColor};
193
+ font-family: var(--mermaid-usecase-font-family, ${e.fontFamily});
194
+ font-size: var(--mermaid-usecase-font-size, 12px);
195
+ font-weight: var(--mermaid-usecase-font-weight, normal);
196
+ }
197
+
198
+ & .usecase-stereotype,
199
+ & .usecase-business-marker {
200
+ color: ${e.primaryTextColor};
201
+ fill: ${e.primaryTextColor};
202
+ stroke: ${t.border};
203
+ }
204
+
205
+ & .system-boundary rect.boundary-body,
206
+ & .system-boundary rect.boundary-tab,
207
+ & .system-boundary-package-tab {
208
+ fill: ${t.boundaryBkg};
209
+ stroke: ${t.boundaryBorder};
210
+ stroke-width: 1px;
211
+ }
212
+
213
+ & .system-boundary-title text {
214
+ fill: ${e.titleColor??e.primaryTextColor};
215
+ }
216
+
217
+ /* Only the span, never the <p> inside it: the renderer puts a user-supplied
218
+ 'color' on the span, and that has to stay inheritable by its children. */
219
+ & .system-boundary-title span {
220
+ color: ${e.titleColor??e.primaryTextColor};
221
+ }
222
+
223
+ & .usecase-note {
224
+ fill: ${e.noteBkgColor};
225
+ stroke: ${e.noteBorderColor};
226
+ color: ${e.noteTextColor};
227
+ }
228
+
229
+ & .usecase-note .nodeLabel {
230
+ color: ${e.noteTextColor};
231
+ fill: ${e.noteTextColor};
232
+ }
233
+
234
+ & .usecase-json-table,
235
+ & .usecase-json-table rect,
236
+ & .usecase-json-cell {
237
+ fill: ${e.mainBkg};
238
+ stroke: ${e.nodeBorder??e.primaryColor};
239
+ }
240
+
241
+ & .usecase-json-title,
242
+ & .usecase-json-key,
243
+ & .usecase-json-value {
244
+ color: ${e.primaryTextColor};
245
+ fill: ${e.primaryTextColor};
246
+ }
247
+
248
+ & .relationship {
249
+ fill: none;
250
+ stroke: ${e.lineColor};
251
+ }
252
+
253
+ & .relationship-include,
254
+ & .relationship-extend,
255
+ & .relationship-note {
256
+ stroke-dasharray: 3;
257
+ }
258
+
259
+ /* Include and extend are both dashed, which is a weak distinction at small sizes. The
260
+ tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */
261
+ & .relationship-include {
262
+ stroke: ${t.includeLine};
263
+ }
264
+
265
+ & .relationship-extend {
266
+ stroke: ${t.extendLine};
267
+ }
268
+
269
+ & .relationship.edge-animation-fast,
270
+ & .relationship.edge-animation-slow {
271
+ stroke-linecap: round;
272
+ }
273
+
274
+ & .edgeLabel,
275
+ & .edgeLabel p {
276
+ background-color: ${e.edgeLabelBackground};
277
+ }
278
+
279
+ & .labelBkg {
280
+ background-color: ${e.edgeLabelBackground};
281
+ padding: 0 2px;
282
+ }
283
+
284
+ & .edgeLabel .label rect {
285
+ fill: ${e.edgeLabelBackground};
286
+ }
287
+
288
+ & .relationship-label,
289
+ & .edgeLabel {
290
+ color: ${e.primaryTextColor};
291
+ fill: ${e.primaryTextColor};
292
+ font-family: ${e.fontFamily};
293
+ font-size: 10px;
294
+ font-weight: normal;
295
+ }
296
+
297
+ & .marker,
298
+ & .marker.point,
299
+ & .marker.circle,
300
+ & .marker.cross {
301
+ fill: ${e.lineColor};
302
+ stroke: ${e.lineColor};
303
+ }
304
+
305
+ & .marker.extension {
306
+ fill: ${e.mainBkg};
307
+ stroke: ${e.lineColor};
308
+ }
309
+ `},"getStyles")}}}]);