@bkm016/basalt 0.1.4 → 0.1.6

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 (288) hide show
  1. package/README.md +61 -11
  2. package/{chunk-y648fzx0.js → chunk-0039s4jt.js} +3 -3
  3. package/{chunk-rmj5b73e.js → chunk-053vb71h.js} +1 -1
  4. package/{chunk-whvj83b7.js → chunk-063vbmtp.js} +2 -2
  5. package/{chunk-7tbya5b5.js → chunk-0javrjcm.js} +22 -22
  6. package/{chunk-y7nma9rk.js → chunk-10p3mb40.js} +2 -2
  7. package/{chunk-jk25nt60.js → chunk-39vwrg8n.js} +2 -2
  8. package/chunk-3k627vf2.js +3 -0
  9. package/{chunk-q7t30zz2.js → chunk-6kdgk70p.js} +5 -5
  10. package/{chunk-3x94302m.js → chunk-6ptv4g5e.js} +3 -3
  11. package/chunk-75434aay.js +2 -0
  12. package/{chunk-2zp1mv3q.js → chunk-7hr6zw2m.js} +1 -1
  13. package/{chunk-g2t6t8fk.js → chunk-7jezts2n.js} +2 -2
  14. package/{chunk-y58ygzn9.js → chunk-818nd6s1.js} +3 -3
  15. package/{chunk-k23t7vhs.js → chunk-8gw5bvh3.js} +5 -5
  16. package/{chunk-vv7fp27r.js → chunk-8mezk0cb.js} +2 -2
  17. package/{chunk-zggzfa7j.js → chunk-8saewt61.js} +2 -2
  18. package/{chunk-362g64pd.js → chunk-8wj32837.js} +1 -1
  19. package/{chunk-fjtvjrkg.js → chunk-8wv5t0w6.js} +5 -5
  20. package/{chunk-vk1gxk1t.js → chunk-8x21n7y9.js} +1 -1
  21. package/chunk-a0c989ky.js +2 -0
  22. package/{chunk-4w17tzp5.js → chunk-a5apjjcn.js} +12 -12
  23. package/chunk-a81p46j7.js +2 -0
  24. package/chunk-agsfy9w7.js +2 -0
  25. package/{chunk-fw2bpqmw.js → chunk-arcqjt91.js} +1 -1
  26. package/chunk-bdy4jksd.js +2 -0
  27. package/{chunk-qe0teyn1.js → chunk-benrzwea.js} +1 -1
  28. package/{chunk-0y7ne3d0.js → chunk-bwawt15q.js} +2 -2
  29. package/{chunk-pxsrqrd0.js → chunk-c4qr1f41.js} +2 -2
  30. package/{chunk-981f9dw8.js → chunk-c7rcw9fb.js} +6 -6
  31. package/{chunk-cjc90f84.js → chunk-ca982n62.js} +3 -3
  32. package/chunk-d20p02ny.js +2 -0
  33. package/{chunk-97rzj7f6.js → chunk-d6p2hgxh.js} +1 -1
  34. package/{chunk-k6w6y71k.js → chunk-dnx91jrd.js} +2 -2
  35. package/{chunk-8d46jtbj.js → chunk-dpz4hwqb.js} +2 -2
  36. package/{chunk-aky4tztg.js → chunk-ebpyvs1d.js} +2 -2
  37. package/{chunk-m40gxwq4.js → chunk-ecf896fz.js} +3 -3
  38. package/{chunk-pjyn2s97.js → chunk-ejsneb6f.js} +1 -1
  39. package/{chunk-pbcy6zdt.js → chunk-ey15ye2h.js} +1 -1
  40. package/{chunk-kp22kaez.js → chunk-f156y565.js} +2 -2
  41. package/{chunk-9rmqgc3c.js → chunk-f544p9rh.js} +15 -15
  42. package/chunk-fmq3zwzk.js +2 -0
  43. package/{chunk-em187cy3.js → chunk-fx7f4m3c.js} +2 -2
  44. package/{chunk-r7fpkb49.js → chunk-g0t9c3gv.js} +1 -1
  45. package/{chunk-mvfsxdx6.js → chunk-gv7wqkey.js} +10 -10
  46. package/chunk-hksqjts3.js +3884 -0
  47. package/{chunk-ztsjgssj.js → chunk-j7yvh0ae.js} +1 -1
  48. package/chunk-kns4kv7b.js +3 -0
  49. package/{chunk-nmca5h6m.js → chunk-n85qs7cs.js} +1 -1
  50. package/{chunk-8wc8qdx8.js → chunk-n981vx1t.js} +6 -6
  51. package/{chunk-3ct2tkr8.js → chunk-npez1492.js} +2 -2
  52. package/{chunk-t6zs4kw0.js → chunk-peja51xv.js} +2 -2
  53. package/{chunk-r0scgfwx.js → chunk-pg5nkf1y.js} +2 -2
  54. package/{chunk-7afmgncg.js → chunk-prgm07j4.js} +1 -1
  55. package/{chunk-jwdb0ccj.js → chunk-q9dd6fhj.js} +3 -3
  56. package/{chunk-ykens1hy.js → chunk-r8vvcp6c.js} +1 -1
  57. package/chunk-rfb85nj7.js +2 -0
  58. package/{chunk-ev6yvy5y.js → chunk-rfdt992v.js} +15 -15
  59. package/{chunk-xfvvh1s5.js → chunk-s6dejhfj.js} +1 -1
  60. package/{chunk-xh3vr5vz.js → chunk-s7skpgm2.js} +1 -1
  61. package/chunk-tgfbtehh.js +480 -0
  62. package/{chunk-m8vkwdgr.js → chunk-w67dvqtb.js} +4 -4
  63. package/{chunk-f3xadvab.js → chunk-whj87h4r.js} +2 -2
  64. package/{chunk-2hbfk5xd.js → chunk-wnzvnskb.js} +2 -2
  65. package/{chunk-vexrrw1b.js → chunk-xtq1xpq0.js} +2 -2
  66. package/{chunk-1vd0f74z.js → chunk-y8dkfpmj.js} +5 -5
  67. package/{chunk-shadcb9z.js → chunk-z02sj1je.js} +2 -2
  68. package/{chunk-akr0a8nc.js → chunk-zxkq9m8e.js} +1 -1
  69. package/compiled.js +12 -12
  70. package/package.json +1 -1
  71. package/ui-test-worker.js +32 -32
  72. package/web/{chunk-t4c8xavd.js → chunk-03dmzvaq.js} +7 -7
  73. package/web/{chunk-n8sky2q6.js → chunk-07agqp8h.js} +1 -1
  74. package/web/chunk-0fgaepwm.js +3 -0
  75. package/web/chunk-0gg00f86.js +292 -0
  76. package/web/chunk-0pecj6d7.js +1 -0
  77. package/web/{chunk-ts7zrf5b.js → chunk-0whceqes.js} +2 -2
  78. package/web/chunk-0wt1dgny.js +1 -0
  79. package/web/{chunk-sfg2wkhe.js → chunk-12xxh71x.js} +6 -6
  80. package/web/chunk-1ves7sq5.js +1 -0
  81. package/web/chunk-1yj79b48.js +1 -0
  82. package/web/chunk-296hgy6k.js +370 -0
  83. package/web/{chunk-f4tacm06.js → chunk-2bmq1whf.js} +1 -1
  84. package/web/chunk-2wqxhqr9.js +1 -0
  85. package/web/{chunk-2j4m0bh1.js → chunk-30b33r2w.js} +2 -2
  86. package/web/{chunk-sspfxp5e.js → chunk-30zfw7zg.js} +1 -1
  87. package/web/chunk-39ng8zwx.css +1 -0
  88. package/web/chunk-3de552rg.js +70 -0
  89. package/web/chunk-3nbzj48p.js +36 -0
  90. package/web/{chunk-0z0y25zf.js → chunk-3zebd9fq.js} +3 -3
  91. package/web/chunk-4r1n98zx.js +2 -0
  92. package/web/chunk-59678wmg.js +1 -0
  93. package/web/{chunk-ds7srg4p.js → chunk-5nda24gv.js} +1 -1
  94. package/web/chunk-5v44qv67.js +303 -0
  95. package/web/chunk-5wdk97mk.js +4 -0
  96. package/web/chunk-64rafq66.js +78 -0
  97. package/web/chunk-6bwgdvf6.js +1 -0
  98. package/web/chunk-6kkw9ptc.js +1 -0
  99. package/web/chunk-718mr5gc.js +2 -0
  100. package/web/chunk-7hs57qdr.js +1 -0
  101. package/web/chunk-7kp237t3.js +106 -0
  102. package/web/chunk-86p42kym.js +1 -0
  103. package/web/chunk-8n79cqyd.js +1 -0
  104. package/web/chunk-8r0s8tx7.js +1 -0
  105. package/web/chunk-96v2avmw.js +40 -0
  106. package/web/chunk-9an6wcnr.js +1 -0
  107. package/web/{chunk-5z4jcqct.js → chunk-9c1yt2ex.js} +20 -20
  108. package/web/chunk-9w5tf22s.js +1 -0
  109. package/web/{chunk-pws2seas.js → chunk-a7gtb4kg.js} +19 -19
  110. package/web/chunk-ahztazsg.js +1 -0
  111. package/web/chunk-b985y17w.js +2 -0
  112. package/web/chunk-bz2v64xe.js +1 -0
  113. package/web/{chunk-n1dmrz44.js → chunk-c01176kn.js} +2 -2
  114. package/web/chunk-c3nn0vvc.js +1 -0
  115. package/web/chunk-cb2rxtq9.js +2 -0
  116. package/web/{chunk-b1bgzz66.js → chunk-ck8rr0sr.js} +1 -1
  117. package/web/{chunk-aqfpnhmt.js → chunk-cktmyc13.js} +19 -19
  118. package/web/{chunk-rvrf0f3h.js → chunk-cm92fyr3.js} +2 -2
  119. package/web/chunk-cwtn2kdm.js +1 -0
  120. package/web/chunk-czq1yz51.js +99 -0
  121. package/web/chunk-d22wq71s.js +1 -0
  122. package/web/{chunk-pjkdrgm0.js → chunk-d4z2rgpx.js} +1 -1
  123. package/web/{chunk-hvw3gn2a.js → chunk-d6tbw8br.js} +20 -20
  124. package/web/{chunk-cg3jterp.js → chunk-d9wdsjkk.js} +2 -2
  125. package/web/{chunk-ttg6tbwx.js → chunk-da7m1kva.js} +2 -2
  126. package/web/chunk-dpkyygej.js +1 -0
  127. package/web/{chunk-0b47eyrf.js → chunk-dwajwrpk.js} +1 -1
  128. package/web/chunk-et5ess72.js +1 -0
  129. package/web/chunk-ez8b6neq.js +1 -0
  130. package/web/{chunk-bhsaj6qq.js → chunk-f5txt81n.js} +1 -1
  131. package/web/chunk-fd1kqwe3.js +1 -0
  132. package/web/chunk-fmthkpff.js +1 -0
  133. package/web/chunk-fp48zz2e.js +2 -0
  134. package/web/{chunk-n90cqdvg.js → chunk-fv6vm14n.js} +2 -2
  135. package/web/chunk-fx0n2g22.js +89 -0
  136. package/web/{chunk-9cx1be43.js → chunk-fxs4nb93.js} +16 -16
  137. package/web/chunk-g6k9z8zt.js +1 -0
  138. package/web/{chunk-42e3b9hv.js → chunk-g81h1e6n.js} +19 -19
  139. package/web/{chunk-pz9ps2jm.js → chunk-gsh80797.js} +12 -12
  140. package/web/{chunk-54thej0t.js → chunk-gyp6v7jd.js} +2 -2
  141. package/web/chunk-h0c42zy3.js +1 -0
  142. package/web/{chunk-6m69hczt.js → chunk-h6k1x096.js} +2 -2
  143. package/web/chunk-hs5x78fb.js +1 -0
  144. package/web/{chunk-zx8zec24.js → chunk-ht1dzftc.js} +56 -56
  145. package/web/{chunk-d11v5s7w.js → chunk-hy4m34qp.js} +6 -6
  146. package/web/chunk-hyd5hzpa.js +1 -0
  147. package/web/chunk-hyt1nkaw.js +1 -0
  148. package/web/{chunk-24mfx6w1.js → chunk-j1bw5v1g.js} +2 -2
  149. package/web/chunk-j6a4z530.js +1139 -0
  150. package/web/{chunk-0pbjgdgp.js → chunk-ja7w629n.js} +2 -2
  151. package/web/{chunk-zbj1trar.js → chunk-jam45rqg.js} +2 -2
  152. package/web/chunk-jfvxxp5c.js +1 -0
  153. package/web/{chunk-kmr7r9xj.js → chunk-jve1zc80.js} +2 -2
  154. package/web/chunk-kegv14sg.js +2 -0
  155. package/web/chunk-kw9emsqw.js +1 -0
  156. package/web/{chunk-df5zx17h.js → chunk-kyawkpv2.js} +1 -1
  157. package/web/chunk-m2prjwk3.js +4 -0
  158. package/web/chunk-m9bzz9m0.js +19 -0
  159. package/web/chunk-mqsyzzgt.js +30 -0
  160. package/web/chunk-mz9b5bsa.js +1 -0
  161. package/web/chunk-n1jpg57t.js +169 -0
  162. package/web/{chunk-ybrf9mhz.js → chunk-nyn9tghz.js} +4 -4
  163. package/web/{chunk-1eg9sbbt.js → chunk-nywdeb4m.js} +2 -2
  164. package/web/chunk-prvh9syp.js +324 -0
  165. package/web/chunk-pxkhm40r.js +2 -0
  166. package/web/{chunk-6cnek1xh.js → chunk-q9ekgjh6.js} +1 -1
  167. package/web/{chunk-xzp7jf7e.js → chunk-qcge7d6s.js} +2 -2
  168. package/web/chunk-r3mj50zs.js +1 -0
  169. package/web/{chunk-wnskxerq.js → chunk-rf9dt6bg.js} +5 -5
  170. package/web/{chunk-nvhmq4z5.js → chunk-s2920f21.js} +6 -6
  171. package/web/chunk-sc0ghp25.js +24 -0
  172. package/web/{chunk-ydtrc1ay.js → chunk-sd3cdqcm.js} +2 -2
  173. package/web/{chunk-rykfak98.js → chunk-sf101c23.js} +2 -2
  174. package/web/{chunk-4gavbw65.js → chunk-sy7e4dmq.js} +1 -1
  175. package/web/chunk-t74r2n8h.js +1 -0
  176. package/web/{chunk-0h0vb6gt.js → chunk-t851gdjh.js} +4 -4
  177. package/web/{chunk-a408enpy.js → chunk-t9mvsgt9.js} +1 -1
  178. package/web/chunk-thbqwq6b.js +1 -0
  179. package/web/{chunk-v5cnt7c8.js → chunk-twdy2f67.js} +1 -1
  180. package/web/chunk-v4yqrx5y.js +140 -0
  181. package/web/{chunk-b53bfkys.js → chunk-vf4vkcf9.js} +1 -1
  182. package/web/chunk-vnt34mkb.js +1 -0
  183. package/web/chunk-vtxw9rmr.js +1 -0
  184. package/web/{chunk-92ssjk2y.js → chunk-vw1pbv1x.js} +40 -40
  185. package/web/chunk-x19v2sxv.js +1 -0
  186. package/web/{chunk-3re8y26v.js → chunk-x5s7zr5f.js} +7 -7
  187. package/web/chunk-xc2sq3t5.js +2 -0
  188. package/web/chunk-xce8n339.js +1 -0
  189. package/web/chunk-xtss82z2.js +1 -0
  190. package/web/chunk-xvcfp1zh.js +2 -0
  191. package/web/chunk-y21zy3eh.js +1 -0
  192. package/web/chunk-ya3ghn3n.js +2 -0
  193. package/web/chunk-yd74yxzt.js +8 -0
  194. package/web/{chunk-74j07k8k.js → chunk-z1geewdf.js} +2 -2
  195. package/web/chunk-z4ha8181.js +1 -0
  196. package/web/chunk-z8rarqe6.js +1 -0
  197. package/web/{chunk-kwccs9f6.js → chunk-zp3qrrkb.js} +11 -11
  198. package/web/chunk-zsxw5fj7.js +39 -0
  199. package/web/index.html +1 -1
  200. package/worker.js +1 -1
  201. package/chunk-06hdzq5n.js +0 -2
  202. package/chunk-5dfbezv9.js +0 -2
  203. package/chunk-5x1sankd.js +0 -3753
  204. package/chunk-71h08f4g.js +0 -2
  205. package/chunk-7nzhdrv9.js +0 -2
  206. package/chunk-7q51n619.js +0 -2
  207. package/chunk-9mmz6wt3.js +0 -2
  208. package/chunk-fvn32nzj.js +0 -478
  209. package/chunk-n6e43rvk.js +0 -3
  210. package/chunk-ry0z4ev6.js +0 -2
  211. package/chunk-vkpvcxjr.js +0 -2
  212. package/web/chunk-0rmkpsgp.js +0 -1
  213. package/web/chunk-0s80zw00.js +0 -1
  214. package/web/chunk-0xkyryrq.js +0 -1
  215. package/web/chunk-1gbd61z0.js +0 -2
  216. package/web/chunk-2s0bmrkv.js +0 -39
  217. package/web/chunk-2z1rwr28.js +0 -2
  218. package/web/chunk-344bq59c.js +0 -89
  219. package/web/chunk-3t0211rw.js +0 -1
  220. package/web/chunk-44rmrmcn.js +0 -1
  221. package/web/chunk-4bzqrwr0.js +0 -1139
  222. package/web/chunk-4d3a7xs2.js +0 -1
  223. package/web/chunk-4jmazh6x.js +0 -370
  224. package/web/chunk-4re74xwm.js +0 -140
  225. package/web/chunk-4rm1vy7w.js +0 -1
  226. package/web/chunk-59kqahb3.js +0 -1
  227. package/web/chunk-5qtyq3ce.js +0 -292
  228. package/web/chunk-5z6x2n5h.js +0 -1
  229. package/web/chunk-6beqrmtq.js +0 -1
  230. package/web/chunk-6f5ke0x9.js +0 -1
  231. package/web/chunk-6xaqxcq8.js +0 -1
  232. package/web/chunk-7q6wvv2x.js +0 -1
  233. package/web/chunk-7qsa4p8h.js +0 -1
  234. package/web/chunk-8nja0ygy.js +0 -1
  235. package/web/chunk-8y64fkpz.js +0 -24
  236. package/web/chunk-9ad7v7bm.js +0 -8
  237. package/web/chunk-9dzxv335.js +0 -4
  238. package/web/chunk-9t5dnjaz.js +0 -19
  239. package/web/chunk-a497tykb.js +0 -70
  240. package/web/chunk-b6k9w215.js +0 -2
  241. package/web/chunk-cjfssg3m.js +0 -2
  242. package/web/chunk-cqp1d4p0.js +0 -1
  243. package/web/chunk-dy2gm1fs.js +0 -1
  244. package/web/chunk-e0zre35a.js +0 -1
  245. package/web/chunk-e9twvs9n.js +0 -3
  246. package/web/chunk-f2kgtyfp.js +0 -1
  247. package/web/chunk-f8bn5tzf.js +0 -1
  248. package/web/chunk-f91wzwtk.js +0 -1
  249. package/web/chunk-fdp9bsj7.js +0 -1
  250. package/web/chunk-fh2vj0wv.js +0 -2
  251. package/web/chunk-g1ev11wx.js +0 -1
  252. package/web/chunk-gmzqdm7v.js +0 -1
  253. package/web/chunk-hfaffkrh.js +0 -1
  254. package/web/chunk-j2vt8c8v.js +0 -1
  255. package/web/chunk-ka3q31t1.js +0 -1
  256. package/web/chunk-khxcn8tt.js +0 -106
  257. package/web/chunk-kqqmp1am.js +0 -1
  258. package/web/chunk-m2d1sp30.js +0 -1
  259. package/web/chunk-nbgqbxcy.js +0 -1
  260. package/web/chunk-ncpnpe9w.js +0 -99
  261. package/web/chunk-ne0v8mfb.js +0 -2
  262. package/web/chunk-ngx2cp8x.js +0 -2
  263. package/web/chunk-nxcgf7ec.js +0 -1
  264. package/web/chunk-p0kvmf28.js +0 -2
  265. package/web/chunk-p3k7m5nr.js +0 -1
  266. package/web/chunk-pggaffrh.js +0 -169
  267. package/web/chunk-pxe3vna4.js +0 -1
  268. package/web/chunk-qh15dxav.css +0 -1
  269. package/web/chunk-qpmbxhh6.js +0 -1
  270. package/web/chunk-r0rctnxz.js +0 -1
  271. package/web/chunk-rn3dnqm8.js +0 -1
  272. package/web/chunk-rtf2zzzv.js +0 -1
  273. package/web/chunk-srrfphes.js +0 -1
  274. package/web/chunk-tdr6x2xc.js +0 -1
  275. package/web/chunk-tncvg1nn.js +0 -1
  276. package/web/chunk-vyp0ns1f.js +0 -2
  277. package/web/chunk-wvdehm9y.js +0 -303
  278. package/web/chunk-x7ahcpj7.js +0 -1
  279. package/web/chunk-y38bf0wm.js +0 -1
  280. package/web/chunk-y56aaba5.js +0 -2
  281. package/web/chunk-ye58t45p.js +0 -4
  282. package/web/chunk-yqbnps3a.js +0 -1
  283. package/web/chunk-z1h20s8c.js +0 -78
  284. package/web/chunk-zj4q9jth.js +0 -36
  285. package/web/chunk-zj5k94dk.js +0 -40
  286. package/web/chunk-zqch0sc8.js +0 -30
  287. package/web/install.ps1 +0 -91
  288. package/web/install.sh +0 -177
@@ -1,370 +0,0 @@
1
- import{e,r,D,b,O,C,S,E,T,A,I,L,s,p,N,ti,ce,ae,ie,ft,ge,ye}from"./chunk-wvdehm9y.js";import{he}from"./chunk-bhsaj6qq.js";import{se}from"./chunk-p0kvmf28.js";function tt(t){if(console&&console.error)console.error(`Error: ${t}`)}function gt(t){if(console&&console.warn)console.warn(`Warning: ${t}`)}function At(t){let n=new Date().getTime(),i=t();return{time:new Date().getTime()-n,value:i}}function St(t){function n(){}n.prototype=t;let i=new n;function a(){return typeof i.bar}return a(),a(),t;(0,eval)(t)}function Gr(t){if(Wr(t))return t.LABEL;else return t.name}function Wr(t){return typeof t.LABEL==="string"&&t.LABEL!==""}class Ne{get definition(){return this._definition}set definition(t){this._definition=t}constructor(t){this._definition=t}accept(t){t.visit(this),this.definition.forEach((n)=>{n.accept(t)})}}class W extends Ne{constructor(t){super([]);this.idx=1,Object.assign(this,xe(t))}set definition(t){}get definition(){if(this.referencedRule!==void 0)return this.referencedRule.definition;return[]}accept(t){t.visit(this)}}class Te extends Ne{constructor(t){super(t.definition);this.orgText="",Object.assign(this,xe(t))}}class j extends Ne{constructor(t){super(t.definition);this.ignoreAmbiguities=!1,Object.assign(this,xe(t))}}class K extends Ne{constructor(t){super(t.definition);this.idx=1,Object.assign(this,xe(t))}}class Z extends Ne{constructor(t){super(t.definition);this.idx=1,Object.assign(this,xe(t))}}class Q extends Ne{constructor(t){super(t.definition);this.idx=1,Object.assign(this,xe(t))}}class G extends Ne{constructor(t){super(t.definition);this.idx=1,Object.assign(this,xe(t))}}class q extends Ne{constructor(t){super(t.definition);this.idx=1,Object.assign(this,xe(t))}}class J extends Ne{get definition(){return this._definition}set definition(t){this._definition=t}constructor(t){super(t.definition);this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,xe(t))}}class F{constructor(t){this.idx=1,Object.assign(this,xe(t))}accept(t){t.visit(this)}}function Wt(t){return t.map(st)}function st(t){function n(i){return i.map(st)}if(t instanceof W){let i={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};if(typeof t.label==="string")i.label=t.label;return i}else if(t instanceof j)return{type:"Alternative",definition:n(t.definition)};else if(t instanceof K)return{type:"Option",idx:t.idx,definition:n(t.definition)};else if(t instanceof Z)return{type:"RepetitionMandatory",idx:t.idx,definition:n(t.definition)};else if(t instanceof Q)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:st(new F({terminalType:t.separator})),definition:n(t.definition)};else if(t instanceof q)return{type:"RepetitionWithSeparator",idx:t.idx,separator:st(new F({terminalType:t.separator})),definition:n(t.definition)};else if(t instanceof G)return{type:"Repetition",idx:t.idx,definition:n(t.definition)};else if(t instanceof J)return{type:"Alternation",idx:t.idx,definition:n(t.definition)};else if(t instanceof F){let i={type:"Terminal",name:t.terminalType.name,label:Gr(t.terminalType),idx:t.idx};if(typeof t.label==="string")i.terminalLabel=t.label;let a=t.terminalType.PATTERN;if(t.terminalType.PATTERN)i.pattern=a instanceof RegExp?a.source:a;return i}else if(t instanceof Te)return{type:"Rule",name:t.name,orgText:t.orgText,definition:n(t.definition)};else throw Error("non exhaustive match")}function xe(t){return Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0))}class Ae{visit(t){let n=t;switch(n.constructor){case W:return this.visitNonTerminal(n);case j:return this.visitAlternative(n);case K:return this.visitOption(n);case Z:return this.visitRepetitionMandatory(n);case Q:return this.visitRepetitionMandatoryWithSeparator(n);case q:return this.visitRepetitionWithSeparator(n);case G:return this.visitRepetition(n);case J:return this.visitAlternation(n);case F:return this.visitTerminal(n);case Te:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(t){}visitAlternative(t){}visitOption(t){}visitRepetition(t){}visitRepetitionMandatory(t){}visitRepetitionMandatoryWithSeparator(t){}visitRepetitionWithSeparator(t){}visitAlternation(t){}visitTerminal(t){}visitRule(t){}}function vs(t){return t instanceof j||t instanceof K||t instanceof G||t instanceof Z||t instanceof Q||t instanceof q||t instanceof F||t instanceof Te}function je(t,n=[]){if(t instanceof K||t instanceof G||t instanceof q)return!0;if(t instanceof J)return t.definition.some((a)=>je(a,n));else if(t instanceof W&&n.includes(t))return!1;else if(t instanceof Ne){if(t instanceof W)n.push(t);return t.definition.every((a)=>je(a,n))}else return!1}function Ms(t){return t instanceof J}function Se(t){if(t instanceof W)return"SUBRULE";else if(t instanceof K)return"OPTION";else if(t instanceof J)return"OR";else if(t instanceof Z)return"AT_LEAST_ONE";else if(t instanceof Q)return"AT_LEAST_ONE_SEP";else if(t instanceof q)return"MANY_SEP";else if(t instanceof G)return"MANY";else if(t instanceof F)return"CONSUME";else throw Error("non exhaustive match")}class $e{walk(t,n=[]){t.definition.forEach((i,a)=>{let o=t.definition.slice(a+1);if(i instanceof W)this.walkProdRef(i,o,n);else if(i instanceof F)this.walkTerminal(i,o,n);else if(i instanceof j)this.walkFlat(i,o,n);else if(i instanceof K)this.walkOption(i,o,n);else if(i instanceof Z)this.walkAtLeastOne(i,o,n);else if(i instanceof Q)this.walkAtLeastOneSep(i,o,n);else if(i instanceof q)this.walkManySep(i,o,n);else if(i instanceof G)this.walkMany(i,o,n);else if(i instanceof J)this.walkOr(i,o,n);else throw Error("non exhaustive match")})}walkTerminal(t,n,i){}walkProdRef(t,n,i){}walkFlat(t,n,i){let a=n.concat(i);this.walk(t,a)}walkOption(t,n,i){let a=n.concat(i);this.walk(t,a)}walkAtLeastOne(t,n,i){let a=[new K({definition:t.definition})].concat(n,i);this.walk(t,a)}walkAtLeastOneSep(t,n,i){let a=Nn(t,n,i);this.walk(t,a)}walkMany(t,n,i){let a=[new K({definition:t.definition})].concat(n,i);this.walk(t,a)}walkManySep(t,n,i){let a=Nn(t,n,i);this.walk(t,a)}walkOr(t,n,i){let a=n.concat(i);t.definition.forEach((o)=>{let l=new j({definition:[o]});this.walk(l,a)})}}function Nn(t,n,i){return[new K({definition:[new F({terminalType:t.separator})].concat(t.definition)})].concat(n,i)}function Ke(t){if(t instanceof W)return Ke(t.referencedRule);else if(t instanceof F)return Vr(t);else if(vs(t))return jr(t);else if(Ms(t))return Kr(t);else throw Error("non exhaustive match")}function jr(t){let n=[],i=t.definition,a=0,o=i.length>a,l,h=!0;while(o&&h)l=i[a],h=je(l),n=n.concat(Ke(l)),a=a+1,o=i.length>a;return[...new Set(n)]}function Kr(t){let n=t.definition.map((i)=>Ke(i));return[...new Set(n.flat())]}function Vr(t){return[t.terminalType]}var jt="_~IN~_";class In extends $e{constructor(t){super();this.topProd=t,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(t,n,i){}walkProdRef(t,n,i){let a=zr(t.referencedRule,t.idx)+this.topProd.name,o=n.concat(i),l=new j({definition:o}),h=Ke(l);this.follows[a]=h}}function kn(t){let n={};return t.forEach((i)=>{let a=new In(i).startWalking();Object.assign(n,a)}),n}function zr(t,n){return t.name+n+jt}function v(t){return t.charCodeAt(0)}function Kt(t,n){if(Array.isArray(t))t.forEach(function(i){n.push(i)});else n.push(t)}function nt(t,n){if(t[n]===!0)throw"duplicate flag "+n;let i=t[n];t[n]=!0}function Ve(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Rt(){throw Error("Internal Error - Should never get here!")}function ws(t){return t.type==="Character"}var yt=[];for(let t=v("0");t<=v("9");t++)yt.push(t);var Ot=[v("_")].concat(yt);for(let t=v("a");t<=v("z");t++)Ot.push(t);for(let t=v("A");t<=v("Z");t++)Ot.push(t);var Us=[v(" "),v("\f"),v(`
2
- `),v("\r"),v("\t"),v("\v"),v("\t"),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v(" "),v("\u2028"),v("\u2029"),v(" "),v(" "),v(" "),v("\uFEFF")];var Hr=/[0-9a-fA-F]/,Vt=/[0-9]/,Xr=/[1-9]/;class zt{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(t){this.idx=t.idx,this.input=t.input,this.groupIdx=t.groupIdx}pattern(t){this.idx=0,this.input=t,this.groupIdx=0,this.consumeChar("/");let n=this.disjunction();this.consumeChar("/");let i={type:"Flags",loc:{begin:this.idx,end:t.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};while(this.isRegExpFlag())switch(this.popChar()){case"g":nt(i,"global");break;case"i":nt(i,"ignoreCase");break;case"m":nt(i,"multiLine");break;case"u":nt(i,"unicode");break;case"y":nt(i,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:i,value:n,loc:this.loc(0)}}disjunction(){let t=[],n=this.idx;t.push(this.alternative());while(this.peekChar()==="|")this.consumeChar("|"),t.push(this.alternative());return{type:"Disjunction",value:t,loc:this.loc(n)}}alternative(){let t=[],n=this.idx;while(this.isTerm())t.push(this.term());return{type:"Alternative",value:t,loc:this.loc(n)}}term(){if(this.isAssertion())return this.assertion();else return this.atom()}assertion(){let t=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(t)};case"$":return{type:"EndAnchor",loc:this.loc(t)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(t)};case"B":return{type:"NonWordBoundary",loc:this.loc(t)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":n="Lookbehind";break;case"!":n="NegativeLookbehind"}break}}Ve(n);let i=this.disjunction();return this.consumeChar(")"),{type:n,value:i,loc:this.loc(t)}}return Rt()}quantifier(t=!1){let n=void 0,i=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":let a=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:a,atMost:a};break;case",":let o;if(this.isDigit())o=this.integerIncludingZero(),n={atLeast:a,atMost:o};else n={atLeast:a,atMost:1/0};this.consumeChar("}");break}if(t===!0&&n===void 0)return;Ve(n);break}if(t===!0&&n===void 0)return;if(Ve(n)){if(this.peekChar(0)==="?")this.consumeChar("?"),n.greedy=!1;else n.greedy=!0;return n.type="Quantifier",n.loc=this.loc(i),n}}atom(){let t,n=this.idx;switch(this.peekChar()){case".":t=this.dotAll();break;case"\\":t=this.atomEscape();break;case"[":t=this.characterClass();break;case"(":t=this.group();break}if(t===void 0&&this.isPatternCharacter())t=this.patternCharacter();if(Ve(t)){if(t.loc=this.loc(n),this.isQuantifier())t.quantifier=this.quantifier();return t}return Rt()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[v(`
3
- `),v("\r"),v("\u2028"),v("\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 t,n=!1;switch(this.popChar()){case"d":t=yt;break;case"D":t=yt,n=!0;break;case"s":t=Us;break;case"S":t=Us,n=!0;break;case"w":t=Ot;break;case"W":t=Ot,n=!0;break}if(Ve(t))return{type:"Set",value:t,complement:n};return Rt()}controlEscapeAtom(){let t;switch(this.popChar()){case"f":t=v("\f");break;case"n":t=v(`
4
- `);break;case"r":t=v("\r");break;case"t":t=v("\t");break;case"v":t=v("\v");break}if(Ve(t))return{type:"Character",value:t};return Rt()}controlLetterEscapeAtom(){this.consumeChar("c");let t=this.popChar();if(/[a-zA-Z]/.test(t)===!1)throw Error("Invalid ");return{type:"Character",value:t.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:v("\x00")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let t=this.popChar();return{type:"Character",value:v(t)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
- `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let t=this.popChar();return{type:"Character",value:v(t)}}}characterClass(){let t=[],n=!1;if(this.consumeChar("["),this.peekChar(0)==="^")this.consumeChar("^"),n=!0;while(this.isClassAtom()){let i=this.classAtom(),a=i.type==="Character";if(ws(i)&&this.isRangeDash()){this.consumeChar("-");let o=this.classAtom(),l=o.type==="Character";if(ws(o)){if(o.value<i.value)throw Error("Range out of order in character class");t.push({from:i.value,to:o.value})}else Kt(i.value,t),t.push(v("-")),Kt(o.value,t)}else Kt(i.value,t)}return this.consumeChar("]"),{type:"Set",complement:n,value:t}}classAtom(){switch(this.peekChar()){case"]":case`
6
- `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:v("\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 t=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),t=!1;break;default:this.groupIdx++;break}let n=this.disjunction();this.consumeChar(")");let i={type:"Group",capturing:t,value:n};if(t)i.idx=this.groupIdx;return i}positiveInteger(){let t=this.popChar();if(Xr.test(t)===!1)throw Error("Expecting a positive integer");while(Vt.test(this.peekChar(0)))t+=this.popChar();return parseInt(t,10)}integerIncludingZero(){let t=this.popChar();if(Vt.test(t)===!1)throw Error("Expecting an integer");while(Vt.test(this.peekChar(0)))t+=this.popChar();return parseInt(t,10)}patternCharacter(){let t=this.popChar();switch(t){case`
7
- `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:v(t)}}}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 Vt.test(this.peekChar(0))}isClassAtom(t=0){switch(this.peekChar(t)){case"]":case`
8
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){let t=this.saveState();try{return this.quantifier(!0)!==void 0}catch(n){return!1}finally{this.restoreState(t)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
9
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(t){let n="";for(let a=0;a<t;a++){let o=this.popChar();if(Hr.test(o)===!1)throw Error("Expecting a HexDecimal digits");n+=o}return{type:"Character",value:parseInt(n,16)}}peekChar(t=0){return this.input[this.idx+t]}popChar(){let t=this.peekChar(0);return this.consumeChar(void 0),t}consumeChar(t){if(t!==void 0&&this.input[this.idx]!==t)throw Error("Expected: '"+t+"' 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(t){return{begin:t,end:this.idx}}}class ze{visitChildren(t){for(let n in t){let i=t[n];if(t.hasOwnProperty(n)){if(i.type!==void 0)this.visit(i);else if(Array.isArray(i))i.forEach((a)=>{this.visit(a)},this)}}}visit(t){switch(t.type){case"Pattern":this.visitPattern(t);break;case"Flags":this.visitFlags(t);break;case"Disjunction":this.visitDisjunction(t);break;case"Alternative":this.visitAlternative(t);break;case"StartAnchor":this.visitStartAnchor(t);break;case"EndAnchor":this.visitEndAnchor(t);break;case"WordBoundary":this.visitWordBoundary(t);break;case"NonWordBoundary":this.visitNonWordBoundary(t);break;case"Lookahead":this.visitLookahead(t);break;case"NegativeLookahead":this.visitNegativeLookahead(t);break;case"Lookbehind":this.visitLookbehind(t);break;case"NegativeLookbehind":this.visitNegativeLookbehind(t);break;case"Character":this.visitCharacter(t);break;case"Set":this.visitSet(t);break;case"Group":this.visitGroup(t);break;case"GroupBackReference":this.visitGroupBackReference(t);break;case"Quantifier":this.visitQuantifier(t);break}this.visitChildren(t)}visitPattern(t){}visitFlags(t){}visitDisjunction(t){}visitAlternative(t){}visitStartAnchor(t){}visitEndAnchor(t){}visitWordBoundary(t){}visitNonWordBoundary(t){}visitLookahead(t){}visitNegativeLookahead(t){}visitLookbehind(t){}visitNegativeLookbehind(t){}visitCharacter(t){}visitSet(t){}visitGroup(t){}visitGroupBackReference(t){}visitQuantifier(t){}}var Ht={},Yr=new zt;function He(t){let n=t.toString();if(Ht.hasOwnProperty(n))return Ht[n];else{let i=Yr.pattern(n);return Ht[n]=i,i}}function Cn(){Ht={}}var _n="Complement Sets are not supported for first char optimization",Lt=`Unable to use "first char" lexer optimizations:
10
- `;function xn(t,n=!1){try{let i=He(t);return Ps(i.value,{},i.flags.ignoreCase)}catch(i){if(i.message===_n){if(n)gt(`${Lt} Unable to optimize: < ${t.toString()} >
11
- Complement Sets cannot be automatically optimized.
12
- This will disable the lexer's first char optimizations.
13
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`)}else{let a="";if(n)a=`
14
- This will disable the lexer's first char optimizations.
15
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`;tt(`${Lt}
16
- Failed parsing: < ${t.toString()} >
17
- Using the @chevrotain/regexp-to-ast library
18
- Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+a)}}return[]}function Ps(t,n,i){switch(t.type){case"Disjunction":for(let o=0;o<t.value.length;o++)Ps(t.value[o],n,i);break;case"Alternative":let a=t.value;for(let o=0;o<a.length;o++){let l=a[o];switch(l.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let h=l;switch(h.type){case"Character":Xt(h.value,n,i);break;case"Set":if(h.complement===!0)throw Error(_n);h.value.forEach((c)=>{if(typeof c==="number")Xt(c,n,i);else{let d=c;if(i===!0)for(let f=d.from;f<=d.to;f++)Xt(f,n,i);else{for(let f=d.from;f<=d.to&&f<it;f++)Xt(f,n,i);if(d.to>=it){let f=d.from>=it?d.from:it,m=d.to,R=ve(f),y=ve(m);for(let U=R;U<=y;U++)n[U]=U}}}});break;case"Group":Ps(h.value,n,i);break;default:throw Error("Non Exhaustive Match")}let u=h.quantifier!==void 0&&h.quantifier.atLeast===0;if(h.type==="Group"&&Ds(h)===!1||h.type!=="Group"&&u===!1)break}break;default:throw Error("non exhaustive match!")}return Object.values(n)}function Xt(t,n,i){let a=ve(t);if(n[a]=a,i===!0)qr(t,n)}function qr(t,n){let i=String.fromCharCode(t),a=i.toUpperCase();if(a!==i){let o=ve(a.charCodeAt(0));n[o]=o}else{let o=i.toLowerCase();if(o!==i){let l=ve(o.charCodeAt(0));n[l]=l}}}function bn(t,n){return t.value.find((i)=>{if(typeof i==="number")return n.includes(i);else{let a=i;return n.find((o)=>a.from<=o&&o<=a.to)!==void 0}})}function Ds(t){let n=t.quantifier;if(n&&n.atLeast===0)return!0;if(!t.value)return!1;return Array.isArray(t.value)?t.value.every(Ds):Ds(t.value)}class vn extends ze{constructor(t){super();this.targetCharCodes=t,this.found=!1}visitChildren(t){if(this.found===!0)return;switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return;case"Lookbehind":this.visitLookbehind(t);return;case"NegativeLookbehind":this.visitNegativeLookbehind(t);return}super.visitChildren(t)}visitCharacter(t){if(this.targetCharCodes.includes(t.value))this.found=!0}visitSet(t){if(t.complement){if(bn(t,this.targetCharCodes)===void 0)this.found=!0}else if(bn(t,this.targetCharCodes)!==void 0)this.found=!0}}function Yt(t,n){if(n instanceof RegExp){let i=He(n),a=new vn(t);return a.visit(i),a.found}else{for(let i of n){let a=i.charCodeAt(0);if(t.includes(a))return!0}return!1}}var Xe="PATTERN",rt="defaultMode",qt="modes",Zt=0,Nt=1,Qt=2,es=3;function wn(t,n){n=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
19
- `],tracer:(_,g)=>g()},n);let i=n.tracer;i("initCharCodeToOptimizedIndexMap",()=>{Ea()});let a;i("Reject Lexer.NA",()=>{a=t.filter((_)=>_[Xe]!==z.NA)});let o=!1,l;i("Transform Patterns",()=>{o=!1,l=a.map((_)=>{let g=_[Xe];if(g instanceof RegExp){let w=g.source;if(w.length===1&&w!=="^"&&w!=="$"&&w!=="."&&!g.ignoreCase)return w;else if(w.length===2&&w[0]==="\\"&&!["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(w[1]))return w[1];else return Mn(g)}else if(typeof g==="function")return o=!0,{exec:g};else if(typeof g==="object")return o=!0,g;else if(typeof g==="string")if(g.length===1)return g;else{let w=g.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),te=new RegExp(w);return Mn(te)}else throw Error("non exhaustive match")})});let h,u,c,d,f;i("misc mapping",()=>{h=a.map((_)=>_.tokenTypeIdx),u=a.map((_)=>{let g=_.GROUP;if(g===z.SKIPPED)return;else if(typeof g==="string")return g;else if(g===void 0)return!1;else throw Error("non exhaustive match")}),c=a.map((_)=>{let g=_.LONGER_ALT;if(g)return Array.isArray(g)?g.map((te)=>a.indexOf(te)):[a.indexOf(g)]}),d=a.map((_)=>_.PUSH_MODE),f=a.map((_)=>Object.hasOwn(_,"POP_MODE"))});let m;i("Line Terminator Handling",()=>{let _=Gn(n.lineTerminatorCharacters);if(m=a.map((g)=>!1),n.positionTracking!=="onlyOffset")m=a.map((g)=>{if(Object.hasOwn(g,"LINE_BREAKS"))return!!g.LINE_BREAKS;else return $n(g,_)===!1&&Yt(_,g.PATTERN)})});let R,y,U,P;i("Misc Mapping #2",()=>{R=a.map(Fn),y=l.map(fa),U=a.reduce((_,g)=>{let w=g.GROUP;if(typeof w==="string"&&w!==z.SKIPPED)_[w]=[];return _},{}),P=l.map((_,g)=>{let w=u[g]===void 0&&c[g]===void 0?Jr(a[g].PATTERN):void 0;return{pattern:l[g],asciiClass:w,longerAlt:c[g],canLineTerminator:m[g],matchType:w!==void 0?es:y[g]!==!1?Zt:R[g]?Nt:Qt,short:y[g],group:u[g],push:d[g],pop:f[g],tokenTypeIdx:h[g],tokenType:a[g]}})});let M=!0,x=[];if(!n.safeMode)i("First Char Optimization",()=>{x=a.reduce((_,g,w)=>{if(typeof g.PATTERN==="string"){let te=g.PATTERN.charCodeAt(0),de=ve(te);Fs(_,de,P[w])}else if(Array.isArray(g.START_CHARS_HINT)){let te;g.START_CHARS_HINT.forEach((de)=>{let pt=typeof de==="string"?de.charCodeAt(0):de,Me=ve(pt);if(te!==Me)te=Me,Fs(_,Me,P[w])})}else if(g.PATTERN instanceof RegExp)if(g.PATTERN.unicode){if(M=!1,n.ensureOptimizations)tt(`${Lt} Unable to analyze < ${g.PATTERN.toString()} > pattern.
20
- The regexp unicode flag is not currently supported by the regexp-to-ast library.
21
- This will disable the lexer's first char optimizations.
22
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`)}else{let te=xn(g.PATTERN,n.ensureOptimizations);if(te.length===0)M=!1;te.forEach((de)=>{Fs(_,de,P[w])})}else{if(n.ensureOptimizations)tt(`${Lt} TokenType: <${g.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
23
- This will disable the lexer's first char optimizations.
24
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`);M=!1}return _},[])});return{emptyGroups:U,patternIdxToConfig:P,charCodeToPatternIdxToConfig:x,hasCustom:o,canBeOptimized:M}}function Jr(t){var n,i;if(!(t instanceof RegExp)||t.flags!=="")return;let a;try{a=He(t)}catch(u){return}if(a.value.value.length!==1||a.value.value[0].value.length!==1)return;let o=a.value.value[0].value[0],l;while(o.type==="Group"){if(o.capturing||o.quantifier!==void 0&&l!==void 0||o.value.value.length!==1||o.value.value[0].value.length!==1)return;l=(n=o.quantifier)!==null&&n!==void 0?n:l,o=o.value.value[0].value[0]}if(o.type!=="Set"||o.complement||o.quantifier!==void 0&&l!==void 0)return;if(l=(i=o.quantifier)!==null&&i!==void 0?i:l,(l===null||l===void 0?void 0:l.atLeast)!==1||l.atMost!==1/0||!l.greedy)return;let h=new Uint8Array(128);for(let u of o.value){let c=typeof u==="number"?u:u.from,d=typeof u==="number"?u:u.to;if(c<0||d>=h.length)return;h.fill(1,c,d+1)}return h}function Un(t,n){let i=[],a=Qr(t);i=i.concat(a.errors);let o=ea(a.valid),l=o.valid;return i=i.concat(o.errors),i=i.concat(Zr(l)),i=i.concat(la(l)),i=i.concat(ca(l,n)),i=i.concat(ha(l)),i}function Zr(t){let n=[],i=t.filter((a)=>a[Xe]instanceof RegExp);return n=n.concat(sa(i)),n=n.concat(ra(i)),n=n.concat(aa(i)),n=n.concat(oa(i)),n=n.concat(na(i)),n}function Qr(t){let n=t.filter((o)=>!Object.hasOwn(o,Xe)),i=n.map((o)=>({message:"Token Type: ->"+o.name+"<- missing static 'PATTERN' property",type:V.MISSING_PATTERN,tokenTypes:[o]})),a=t.filter((o)=>!n.includes(o));return{errors:i,valid:a}}function ea(t){let n=t.filter((o)=>{let l=o[Xe];return!(l instanceof RegExp)&&typeof l!=="function"&&!Object.hasOwn(l,"exec")&&typeof l!=="string"}),i=n.map((o)=>({message:"Token Type: ->"+o.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:V.INVALID_PATTERN,tokenTypes:[o]})),a=t.filter((o)=>!n.includes(o));return{errors:i,valid:a}}var ta=/[^\\][$]/;function sa(t){class n extends ze{constructor(){super(...arguments);this.found=!1}visitEndAnchor(o){this.found=!0}}return t.filter((o)=>{let l=o.PATTERN;try{let h=He(l),u=new n;return u.visit(h),u.found}catch(h){return ta.test(l.source)}}).map((o)=>({message:`Unexpected RegExp Anchor Error:
25
- Token Type: ->`+o.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
26
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:V.EOI_ANCHOR_FOUND,tokenTypes:[o]}))}function na(t){return t.filter((a)=>a.PATTERN.test("")).map((a)=>({message:"Token Type: ->"+a.name+"<- static 'PATTERN' must not match an empty string",type:V.EMPTY_MATCH_PATTERN,tokenTypes:[a]}))}var ia=/[^\\[][\^]|^\^/;function ra(t){class n extends ze{constructor(){super(...arguments);this.found=!1}visitStartAnchor(o){this.found=!0}}return t.filter((o)=>{let l=o.PATTERN;try{let h=He(l),u=new n;return u.visit(h),u.found}catch(h){return ia.test(l.source)}}).map((o)=>({message:`Unexpected RegExp Anchor Error:
27
- Token Type: ->`+o.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
28
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:V.SOI_ANCHOR_FOUND,tokenTypes:[o]}))}function aa(t){return t.filter((a)=>{let o=a[Xe];return o instanceof RegExp&&(o.multiline||o.global)}).map((a)=>({message:"Token Type: ->"+a.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:V.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[a]}))}function oa(t){let n=[],i=t.map((l)=>t.reduce((h,u)=>{if(l.PATTERN.source===u.PATTERN.source&&!n.includes(u)&&u.PATTERN!==z.NA)return n.push(u),h.push(u),h;return h},[]));return i=i.filter(Boolean),i.filter((l)=>l.length>1).map((l)=>{let h=l.map((c)=>c.name);return{message:`The same RegExp pattern ->${l[0].PATTERN}<-has been used in all of the following Token Types: ${h.join(", ")} <-`,type:V.DUPLICATE_PATTERNS_FOUND,tokenTypes:l}})}function la(t){return t.filter((a)=>{if(!Object.hasOwn(a,"GROUP"))return!1;let o=a.GROUP;return o!==z.SKIPPED&&o!==z.NA&&typeof o!=="string"}).map((a)=>({message:"Token Type: ->"+a.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:V.INVALID_GROUP_TYPE_FOUND,tokenTypes:[a]}))}function ca(t,n){return t.filter((o)=>o.PUSH_MODE!==void 0&&!n.includes(o.PUSH_MODE)).map((o)=>({message:`Token Type: ->${o.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${o.PUSH_MODE}<-which does not exist`,type:V.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[o]}))}function ha(t){let n=[],i=t.reduce((a,o,l)=>{let h=o.PATTERN;if(h===z.NA)return a;if(typeof h==="string")a.push({str:h,idx:l,tokenType:o});else if(h instanceof RegExp&&da(h))a.push({str:h.source,idx:l,tokenType:o});return a},[]);return t.forEach((a,o)=>{i.forEach(({str:l,idx:h,tokenType:u})=>{if(o<h&&ua(l,a.PATTERN)){let c=`Token: ->${u.name}<- can never be matched.
29
- Because it appears AFTER the Token Type ->${a.name}<-in the lexer's definition.
30
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;n.push({message:c,type:V.UNREACHABLE_PATTERN,tokenTypes:[a,u]})}})}),n}function ua(t,n){if(n instanceof RegExp){if(pa(n))return!1;let i=n.exec(t);return i!==null&&i.index===0}else if(typeof n==="function")return n(t,0,[],{});else if(Object.hasOwn(n,"exec"))return n.exec(t,0,[],{});else if(typeof n==="string")return n===t;else throw Error("non exhaustive match")}function da(t){return[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find((i)=>t.source.indexOf(i)!==-1)===void 0}function pa(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}function Mn(t){let n=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,n)}function Pn(t,n,i){let a=[];if(!Object.hasOwn(t,rt))a.push({message:"A MultiMode Lexer cannot be initialized without a <"+rt+`> property in its definition
31
- `,type:V.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE});if(!Object.hasOwn(t,qt))a.push({message:"A MultiMode Lexer cannot be initialized without a <"+qt+`> property in its definition
32
- `,type:V.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY});if(Object.hasOwn(t,qt)&&Object.hasOwn(t,rt)&&!Object.hasOwn(t.modes,t.defaultMode))a.push({message:`A MultiMode Lexer cannot be initialized with a ${rt}: <${t.defaultMode}>which does not exist
33
- `,type:V.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST});if(Object.hasOwn(t,qt))Object.keys(t.modes).forEach((o)=>{let l=t.modes[o];l.forEach((h,u)=>{if(h===void 0)a.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${o}> at index: <${u}>
34
- `,type:V.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(Object.hasOwn(h,"LONGER_ALT"))(Array.isArray(h.LONGER_ALT)?h.LONGER_ALT:[h.LONGER_ALT]).forEach((d)=>{if(d!==void 0&&!l.includes(d))a.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${d.name}> on token <${h.name}> outside of mode <${o}>
35
- `,type:V.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})});return a}function Dn(t,n,i){let a=[],o=!1,h=Object.values(t.modes||{}).flat().filter(Boolean).filter((c)=>c[Xe]!==z.NA),u=Gn(i);if(n)h.forEach((c)=>{let d=$n(c,u);if(d!==!1){let m={message:ma(c,d),type:d.issue,tokenType:c};a.push(m)}else if(Object.hasOwn(c,"LINE_BREAKS")){if(c.LINE_BREAKS===!0)o=!0}else if(Yt(u,c.PATTERN))o=!0});if(n&&!o)a.push({message:`Warning: No LINE_BREAKS Found.
36
- This Lexer has been defined to track line and column information,
37
- But none of the Token Types can be identified as matching a line terminator.
38
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
39
- for details.`,type:V.NO_LINE_BREAKS_FLAGS});return a}function Fn(t){let n=t.PATTERN;if(n instanceof RegExp)return!1;else if(typeof n==="function")return!0;else if(Object.hasOwn(n,"exec"))return!0;else if(typeof n==="string")return!1;else throw Error("non exhaustive match")}function fa(t){if(typeof t==="string"&&t.length===1)return t.charCodeAt(0);else return!1}var Bn={test:function(t){let n=t.length;for(let i=this.lastIndex;i<n;i++){let a=t.charCodeAt(i);if(a===10)return this.lastIndex=i+1,!0;else if(a===13){if(t.charCodeAt(i+1)===10)this.lastIndex=i+2;else this.lastIndex=i+1;return!0}}return!1},lastIndex:0};function $n(t,n){if(Object.hasOwn(t,"LINE_BREAKS"))return!1;else if(t.PATTERN instanceof RegExp){try{Yt(n,t.PATTERN)}catch(i){return{issue:V.IDENTIFY_TERMINATOR,errMsg:i.message}}return!1}else if(typeof t.PATTERN==="string")return!1;else if(Fn(t))return{issue:V.CUSTOM_LINE_BREAK};else throw Error("non exhaustive match")}function ma(t,n){if(n.issue===V.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
40
- The problem is in the <${t.name}> Token Type
41
- Root cause: ${n.errMsg}.
42
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;else if(n.issue===V.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
43
- The problem is in the <${t.name}> Token Type
44
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;else throw Error("non exhaustive match")}function Gn(t){return t.map((i)=>{if(typeof i==="string")return i.charCodeAt(0);else return i})}function Fs(t,n,i){if(t[n]===void 0)t[n]=[i];else t[n].push(i)}var it=256,Jt=[];function ve(t){return t<it?t:Jt[t]}function Ea(){if(Jt.length===0){Jt=Array(65536);for(let t=0;t<65536;t++)Jt[t]=t>255?255+~~(t/255):t}}function Ue(t,n){let i=t.tokenTypeIdx;if(i===n.tokenTypeIdx)return!0;else return n.isParent===!0&&n.categoryMatchesMap[i]===!0}function at(t,n){return t.tokenTypeIdx===n.tokenTypeIdx}var Wn=1,Kn={};function Pe(t){let n=Ta(t);ga(n),Sa(n),Aa(n),n.forEach((i)=>{i.isParent=i.categoryMatches.length>0})}function Ta(t){let n=[...t],i=t,a=!0;while(a){i=i.map((l)=>l.CATEGORIES).flat().filter(Boolean);let o=i.filter((l)=>!n.includes(l));if(n=n.concat(o),o.length===0)a=!1;else i=o}return n}function ga(t){t.forEach((n)=>{if(!Bs(n))Kn[Wn]=n,n.tokenTypeIdx=Wn++;if(jn(n)&&!Array.isArray(n.CATEGORIES))n.CATEGORIES=[n.CATEGORIES];if(!jn(n))n.CATEGORIES=[];if(!Ra(n))n.categoryMatches=[];if(!ya(n))n.categoryMatchesMap={}})}function Aa(t){t.forEach((n)=>{n.categoryMatches=[],Object.keys(n.categoryMatchesMap).forEach((i)=>{n.categoryMatches.push(Kn[i].tokenTypeIdx)})})}function Sa(t){t.forEach((n)=>{Vn([],n)})}function Vn(t,n){t.forEach((i)=>{n.categoryMatchesMap[i.tokenTypeIdx]=!0}),n.CATEGORIES.forEach((i)=>{let a=t.concat(n);if(!a.includes(i))Vn(a,i)})}function Bs(t){return Object.hasOwn(t!==null&&t!==void 0?t:{},"tokenTypeIdx")}function jn(t){return Object.hasOwn(t!==null&&t!==void 0?t:{},"CATEGORIES")}function Ra(t){return Object.hasOwn(t!==null&&t!==void 0?t:{},"categoryMatches")}function ya(t){return Object.hasOwn(t!==null&&t!==void 0?t:{},"categoryMatchesMap")}function zn(t){return Object.hasOwn(t!==null&&t!==void 0?t:{},"tokenTypeIdx")}var $s={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,n,i,a,o,l){return`unexpected character: ->${t.charAt(n)}<- at offset: ${n}, skipped ${i} characters.`}};var V;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(V||(V={}));var It={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
45
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:$s,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(It);class z{constructor(t,n=It){if(this.lexerDefinition=t,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(a,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let l=Array(this.traceInitIndent+1).join("\t");if(this.traceInitIndent<this.traceInitMaxIdent)console.log(`${l}--> <${a}>`);let{time:h,value:u}=At(o),c=h>10?console.warn:console.log;if(this.traceInitIndent<this.traceInitMaxIdent)c(`${l}<-- <${a}> time: ${h}ms`);return this.traceInitIndent--,u}else return o()},typeof n==="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
46
- a boolean 2nd argument is no longer supported`);this.config=Object.assign({},It,n);let i=this.config.traceInitPerf;if(i===!0)this.traceInitMaxIdent=1/0,this.traceInitPerf=!0;else if(typeof i==="number")this.traceInitMaxIdent=i,this.traceInitPerf=!0;this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let a,o=!0;if(this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===It.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Bn;else if(this.config.lineTerminatorCharacters===It.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
47
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');if(this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(t))a={modes:{defaultMode:[...t]},defaultMode:rt};else o=!1,a=Object.assign({},t)}),this.config.skipValidations===!1)this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Pn(a,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Dn(a,this.trackStartLines,this.config.lineTerminatorCharacters))});a.modes=a.modes?a.modes:{},Object.entries(a.modes).forEach(([h,u])=>{a.modes[h]=u.filter((c)=>c!==void 0)});let l=Object.keys(a.modes);if(Object.entries(a.modes).forEach(([h,u])=>{this.TRACE_INIT(`Mode: <${h}> processing`,()=>{if(this.modes.push(h),this.config.skipValidations===!1)this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Un(u,l))});if(this.lexerDefinitionErrors.length===0){Pe(u);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=wn(u,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[h]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[h]=c.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[h]=c.canBeOptimized}})}),this.defaultMode=a.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let u=this.lexerDefinitionErrors.map((c)=>c.message).join(`-----------------------
48
- `);throw Error(`Errors detected in definition of Lexer:
49
- `+u)}this.lexerDefinitionWarning.forEach((h)=>{gt(h.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(o)this.handleModes=()=>{};if(this.trackStartLines===!1)this.computeNewColumn=(h)=>h;if(this.trackEndLines===!1)this.updateTokenEndLineColumnLocation=()=>{};if(/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}"`);if(this.hasCustom)this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom;else this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let h=Object.entries(this.canModeBeOptimized).reduce((u,[c,d])=>{if(d===!1)u.push(c);return u},[]);if(n.ensureOptimizations&&h.length>0)throw Error(`Lexer Modes: < ${h.join(", ")} > cannot be optimized.
50
- Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
51
- Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Cn()}),this.TRACE_INIT("toFastProperties",()=>{St(this)})})}tokenize(t,n=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let a=this.lexerDefinitionErrors.map((o)=>o.message).join(`-----------------------
52
- `);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
53
- `+a)}return this.tokenizeInternal(t,n)}tokenizeInternal(t,n){let i,a,o,l,h,u,c,d,f,m,R,y,U,P,M,x=t,_=x.length,g=0,w=0,te=this.hasCustom?0:Math.floor(t.length/10),de=Array(te),pt=[],Me=this.trackStartLines?1:void 0,_e=this.trackStartLines?1:void 0,et={};for(let ne=0;ne<this.cachedGroupKeys.length;ne++)et[this.cachedGroupKeys[ne]]=[];let Br=this.trackStartLines,ks=this.config.lineTerminatorsPattern,Cs=0,We=[],mt=[],Et=[],yn=[];Object.freeze(yn);let Tt=!1,$r=(ne)=>{if(Et.length===1&&ne.tokenType.PUSH_MODE===void 0){let Le=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ne);pt.push({offset:ne.startOffset,line:ne.startLine,column:ne.startColumn,length:ne.image.length,message:Le})}else{Et.pop();let Le=Et.at(-1);We=this.patternIdxToConfig[Le],mt=this.charCodeToPatternIdxToConfig[Le],Cs=We.length;let bs=this.canModeBeOptimized[Le]&&this.config.safeMode===!1;if(mt&&bs)Tt=!0;else Tt=!1}};function On(ne){Et.push(ne),mt=this.charCodeToPatternIdxToConfig[ne],We=this.patternIdxToConfig[ne],Cs=We.length;let Le=this.canModeBeOptimized[ne]&&this.config.safeMode===!1;if(mt&&Le)Tt=!0;else Tt=!1}On.call(this,n);let Oe,Ln=this.config.recoveryEnabled;while(g<_){u=null,f=-1;let ne=x.charCodeAt(g),Le;if(Tt){let le=ve(ne),Ee=mt[le];Le=Ee!==void 0?Ee:yn}else Le=We;let bs=Le.length;for(i=0;i<bs;i++){Oe=Le[i];let le=Oe.pattern;switch(c=null,Oe.matchType){case Zt:if(ne===Oe.short)f=1,u=le;break;case Nt:if(M=le.exec(x,g,de,et),M!==null){if(u=M[0],f=u.length,M.payload!==void 0)c=M.payload}else u=null;break;case es:{let Ee=Oe.asciiClass;if(Ee[ne]!==1){le.lastIndex=0;break}let fe=g+1;while(Ee[x.charCodeAt(fe)]===1)fe++;f=fe-g,le.lastIndex=fe;break}case Qt:le.lastIndex=g,f=this.matchLength(le,t,g);break}if(f!==-1){if(h=Oe.longerAlt,h!==void 0){u=t.substring(g,g+f);let Ee=h.length;for(o=0;o<Ee;o++){let fe=We[h[o]],we=fe.pattern;if(d=null,fe.matchType===Nt)if(M=we.exec(x,g,de,et),M!==null){if(l=M[0],M.payload!==void 0)d=M.payload}else l=null;else we.lastIndex=g,l=this.match(we,t,g);if(l&&l.length>u.length){u=l,f=l.length,c=d,Oe=fe;break}}}break}}if(f!==-1){if(m=Oe.group,m!==void 0)if(u=u!==null?u:t.substring(g,g+f),R=Oe.tokenTypeIdx,y=this.createTokenInstance(u,g,R,Oe.tokenType,Me,_e,f),this.handlePayload(y,c),m===!1)w=this.addToken(de,w,y);else et[m].push(y);if(Br===!0&&Oe.canLineTerminator===!0){let le=0,Ee,fe;ks.lastIndex=0;do if(u=u!==null?u:t.substring(g,g+f),Ee=ks.test(u),Ee===!0)fe=ks.lastIndex-1,le++;while(Ee===!0);if(le!==0)Me=Me+le,_e=f-fe,this.updateTokenEndLineColumnLocation(y,m,fe,le,Me,_e,f);else _e=this.computeNewColumn(_e,f)}else _e=this.computeNewColumn(_e,f);g=g+f,this.handleModes(Oe,$r,On,y)}else{let le=g,Ee=Me,fe=_e,we=Ln===!1;while(we===!1&&g<_){g++;for(a=0;a<Cs;a++){let _s=We[a],xs=_s.pattern;switch(_s.matchType){case Zt:if(x.charCodeAt(g)===_s.short)we=!0;break;case Nt:we=xs.exec(x,g,de,et)!==null;break;case es:case Qt:xs.lastIndex=g,we=xs.exec(t)!==null;break}if(we===!0)break}}if(U=g-le,_e=this.computeNewColumn(_e,U),P=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(x,le,U,Ee,fe,Et.at(-1)),pt.push({offset:le,line:Ee,column:fe,length:U,message:P}),Ln===!1)break}}if(!this.hasCustom)de.length=w;return{tokens:de,groups:et,errors:pt}}handleModes(t,n,i,a){if(t.pop===!0){let o=t.push;if(n(a),o!==void 0)i.call(this,o)}else if(t.push!==void 0)i.call(this,t.push)}updateTokenEndLineColumnLocation(t,n,i,a,o,l,h){let u,c;if(n!==void 0){if(u=i===h-1,c=u?-1:0,!(a===1&&u===!0))t.endLine=o+c,t.endColumn=l-1+-c}}computeNewColumn(t,n){return t+n}createOffsetOnlyToken(t,n,i,a){return{image:t,startOffset:n,tokenTypeIdx:i,tokenType:a}}createStartOnlyToken(t,n,i,a,o,l){return{image:t,startOffset:n,startLine:o,startColumn:l,tokenTypeIdx:i,tokenType:a}}createFullToken(t,n,i,a,o,l,h){return{image:t,startOffset:n,endOffset:n+h-1,startLine:o,endLine:o,startColumn:l,endColumn:l+h-1,tokenTypeIdx:i,tokenType:a}}addTokenUsingPush(t,n,i){return t.push(i),n}addTokenUsingMemberAccess(t,n,i){return t[n]=i,n++,n}handlePayloadNoCustom(t,n){}handlePayloadWithCustom(t,n){if(n!==null)t.payload=n}match(t,n,i){if(t.test(n)===!0)return n.substring(i,t.lastIndex);return null}matchLength(t,n,i){if(t.test(n)===!0)return t.lastIndex-i;return-1}}z.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.";z.NA=/NOT_APPLICABLE/;function Ye(t){if(Gs(t))return t.LABEL;else return t.name}function Gs(t){return typeof t.LABEL==="string"&&t.LABEL!==""}var Oa="parent",Hn="categories",Xn="label",Yn="group",qn="push_mode",Jn="pop_mode",Zn="longer_alt",Qn="line_breaks",ei="start_chars_hint";function k(t){return La(t)}function La(t){let n=t.pattern,i={};if(i.name=t.name,n!==void 0)i.PATTERN=n;if(Object.hasOwn(t,Oa))throw`The parent property is no longer supported.
54
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;if(Object.hasOwn(t,Hn))i.CATEGORIES=t[Hn];if(Pe([i]),Object.hasOwn(t,Xn))i.LABEL=t[Xn];if(Object.hasOwn(t,Yn))i.GROUP=t[Yn];if(Object.hasOwn(t,Jn))i.POP_MODE=t[Jn];if(Object.hasOwn(t,qn))i.PUSH_MODE=t[qn];if(Object.hasOwn(t,Zn))i.LONGER_ALT=t[Zn];if(Object.hasOwn(t,Qn))i.LINE_BREAKS=t[Qn];if(Object.hasOwn(t,ei))i.START_CHARS_HINT=t[ei];return i}var Re=k({name:"EOF",pattern:z.NA});Pe([Re]);function qe(t,n,i,a,o,l,h,u){return{image:n,startOffset:i,endOffset:a,startLine:o,endLine:l,startColumn:h,endColumn:u,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function kt(t,n){return Ue(t,n)}var ts={buildMismatchTokenMessage({expected:t,actual:n,previous:i,ruleName:a}){return`Expecting ${Gs(t)?`--> ${Ye(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${n.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:n}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:n,previous:i,customUserDescription:a,ruleName:o}){let u=`
55
- but found: '`+n[0].image+"'";if(a)return"Expecting: "+a+u;else return`Expecting: one of these possible Token sequences:
56
- ${t.reduce((R,y)=>R.concat(y),[]).map((R)=>`[${R.map((y)=>Ye(y)).join(", ")}]`).map((R,y)=>` ${y+1}. ${R}`).join(`
57
- `)}`+u},buildEarlyExitMessage({expectedIterationPaths:t,actual:n,customUserDescription:i,ruleName:a}){let h=`
58
- but found: '`+n[0].image+"'";if(i)return"Expecting: "+i+h;else return`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::
59
- <${t.map((d)=>`[${d.map((f)=>Ye(f)).join(",")}]`).join(" ,")}>`+h}};Object.freeze(ts);var si={buildRuleNotFoundError(t,n){return"Invalid grammar, reference to a rule which is not defined: ->"+n.nonTerminalName+`<-
60
- inside top level rule: ->`+t.name+"<-"}},Ce={buildDuplicateFoundError(t,n){function i(f){if(f instanceof F)return f.terminalType.name;else if(f instanceof W)return f.nonTerminalName;else return""}let a=t.name,o=n[0],l=o.idx,h=Se(o),u=i(o),c=l>0,d=`->${h}${c?l:""}<- ${u?`with argument: ->${u}<-`:""}
61
- appears more than once (${n.length} times) in the top level rule: ->${a}<-.
62
- For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
63
- `;return d=d.replace(/[ \t]+/g," "),d=d.replace(/\s\s+/g,`
64
- `),d},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
65
- The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
66
- To resolve this make sure each Terminal and Non-Terminal names are unique
67
- This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
68
- and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){let n=t.prefixPath.map((o)=>Ye(o)).join(", "),i=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
69
- in <OR${i}> inside <${t.topLevelRule.name}> Rule,
70
- <${n}> may appears as a prefix path in all these alternatives.
71
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
72
- For Further details.`},buildAlternationAmbiguityError(t){let n=t.alternation.idx===0?"":t.alternation.idx,i=t.prefixPath.length===0,a=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
73
- `;if(i)a+=`These alternatives are all empty (match no tokens), making them indistinguishable.
74
- Only the last alternative may be empty.
75
- `;else{let o=t.prefixPath.map((l)=>Ye(l)).join(", ");a+=`<${o}> may appears as a prefix path in all these alternatives.
76
- `}return a+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
77
- For Further details.`,a},buildEmptyRepetitionError(t){let n=Se(t.repetition);if(t.repetition.idx!==0)n+=t.repetition.idx;return`The repetition <${n}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
78
- This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
79
- Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
80
- <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
81
- has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){let n=t.topLevelRule.name,i=t.leftRecursionPath.map((l)=>l.name),a=`${n} --> ${i.concat([n]).join(" --> ")}`;return`Left Recursion found in grammar.
82
- rule: <${n}> can be invoked from itself (directly or indirectly)
83
- without consuming any Tokens. The grammar path that causes this is:
84
- ${a}
85
- To fix this refactor your grammar to remove the left recursion.
86
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let n;if(t.topLevelRule instanceof Te)n=t.topLevelRule.name;else n=t.topLevelRule;return`Duplicate definition, rule: ->${n}<- is already defined in the grammar: ->${t.grammarName}<-`}};function ni(t,n){let i=new ii(t,n);return i.resolveRefs(),i.errors}class ii extends Ae{constructor(t,n){super();this.nameToTopRule=t,this.errMsgProvider=n,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach((t)=>{this.currTopLevel=t,t.accept(this)})}visitNonTerminal(t){let n=this.nameToTopRule[t.nonTerminalName];if(!n){let i=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:i,type:re.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}else t.referencedRule=n}}class ri extends $e{constructor(t,n){super();this.topProd=t,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(t,n=[]){if(!this.found)super.walk(t,n)}walkProdRef(t,n,i){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){let a=n.concat(i);this.updateExpectedNext(),this.walk(t.referencedRule,a)}}updateExpectedNext(){if(this.ruleStack.length===0)this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0;else this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop()}}class Ws extends ri{constructor(t,n){super(t,n);this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(t,n,i){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){let a=n.concat(i),o=new j({definition:a});this.possibleTokTypes=Ke(o),this.found=!0}}}class Ct extends $e{constructor(t,n){super();this.topRule=t,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class js extends Ct{walkMany(t,n,i){if(t.idx===this.occurrence){let a=n.concat(i)[0];if(this.result.isEndOfRule=a===void 0,a instanceof F)this.result.token=a.terminalType,this.result.occurrence=a.idx}else super.walkMany(t,n,i)}}class ss extends Ct{walkManySep(t,n,i){if(t.idx===this.occurrence){let a=n.concat(i)[0];if(this.result.isEndOfRule=a===void 0,a instanceof F)this.result.token=a.terminalType,this.result.occurrence=a.idx}else super.walkManySep(t,n,i)}}class Ks extends Ct{walkAtLeastOne(t,n,i){if(t.idx===this.occurrence){let a=n.concat(i)[0];if(this.result.isEndOfRule=a===void 0,a instanceof F)this.result.token=a.terminalType,this.result.occurrence=a.idx}else super.walkAtLeastOne(t,n,i)}}class ns extends Ct{walkAtLeastOneSep(t,n,i){if(t.idx===this.occurrence){let a=n.concat(i)[0];if(this.result.isEndOfRule=a===void 0,a instanceof F)this.result.token=a.terminalType,this.result.occurrence=a.idx}else super.walkAtLeastOneSep(t,n,i)}}function is(t,n,i=[]){i=[...i];let a=[],o=0;function l(u){return u.concat(t.slice(o+1))}function h(u){let c=is(l(u),n,i);return a.concat(c)}while(i.length<n&&o<t.length){let u=t[o];if(u instanceof j)return h(u.definition);else if(u instanceof W)return h(u.definition);else if(u instanceof K)a=h(u.definition);else if(u instanceof Z){let c=u.definition.concat([new G({definition:u.definition})]);return h(c)}else if(u instanceof Q){let c=[new j({definition:u.definition}),new G({definition:[new F({terminalType:u.separator})].concat(u.definition)})];return h(c)}else if(u instanceof q){let c=u.definition.concat([new G({definition:[new F({terminalType:u.separator})].concat(u.definition)})]);a=h(c)}else if(u instanceof G){let c=u.definition.concat([new G({definition:u.definition})]);a=h(c)}else if(u instanceof J)return u.definition.forEach((c)=>{if(c.definition.length!==0)a=h(c.definition)}),a;else if(u instanceof F)i.push(u.terminalType);else throw Error("non exhaustive match");o++}return a.push({partialPath:i,suffixDef:t.slice(o)}),a}function ai(t,n,i,a){let l=["EXIT_NONE_TERMINAL"],h="EXIT_ALTERNATIVE",u=!1,c=n.length,d=c-a-1,f=[],m=[];m.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});while(m.length!==0){let R=m.pop();if(R==="EXIT_ALTERNATIVE"){if(u&&m.at(-1).idx<=d)m.pop();continue}let{def:y,idx:U,ruleStack:P,occurrenceStack:M}=R;if(y.length===0)continue;let x=y[0];if(x==="EXIT_NONE_TERMINAL"){let _={idx:U,def:y.slice(1),ruleStack:P.slice(0,-1),occurrenceStack:M.slice(0,-1)};m.push(_)}else if(x instanceof F)if(U<c-1){let _=U+1,g=n[_];if(i(g,x.terminalType)){let w={idx:_,def:y.slice(1),ruleStack:P,occurrenceStack:M};m.push(w)}}else if(U===c-1)f.push({nextTokenType:x.terminalType,nextTokenOccurrence:x.idx,ruleStack:P,occurrenceStack:M}),u=!0;else throw Error("non exhaustive match");else if(x instanceof W){let _=[...P];_.push(x.nonTerminalName);let g=[...M];g.push(x.idx);let w={idx:U,def:x.definition.concat(l,y.slice(1)),ruleStack:_,occurrenceStack:g};m.push(w)}else if(x instanceof K){let _={idx:U,def:y.slice(1),ruleStack:P,occurrenceStack:M};m.push(_),m.push("EXIT_ALTERNATIVE");let g={idx:U,def:x.definition.concat(y.slice(1)),ruleStack:P,occurrenceStack:M};m.push(g)}else if(x instanceof Z){let _=new G({definition:x.definition,idx:x.idx}),g=x.definition.concat([_],y.slice(1)),w={idx:U,def:g,ruleStack:P,occurrenceStack:M};m.push(w)}else if(x instanceof Q){let _=new F({terminalType:x.separator}),g=new G({definition:[_].concat(x.definition),idx:x.idx}),w=x.definition.concat([g],y.slice(1)),te={idx:U,def:w,ruleStack:P,occurrenceStack:M};m.push(te)}else if(x instanceof q){let _={idx:U,def:y.slice(1),ruleStack:P,occurrenceStack:M};m.push(_),m.push("EXIT_ALTERNATIVE");let g=new F({terminalType:x.separator}),w=new G({definition:[g].concat(x.definition),idx:x.idx}),te=x.definition.concat([w],y.slice(1)),de={idx:U,def:te,ruleStack:P,occurrenceStack:M};m.push(de)}else if(x instanceof G){let _={idx:U,def:y.slice(1),ruleStack:P,occurrenceStack:M};m.push(_),m.push("EXIT_ALTERNATIVE");let g=new G({definition:x.definition,idx:x.idx}),w=x.definition.concat([g],y.slice(1)),te={idx:U,def:w,ruleStack:P,occurrenceStack:M};m.push(te)}else if(x instanceof J)for(let _=x.definition.length-1;_>=0;_--){let g=x.definition[_],w={idx:U,def:g.definition.concat(y.slice(1)),ruleStack:P,occurrenceStack:M};m.push(w),m.push("EXIT_ALTERNATIVE")}else if(x instanceof j)m.push({idx:U,def:x.definition.concat(y.slice(1)),ruleStack:P,occurrenceStack:M});else if(x instanceof Te)m.push(Na(x,U,P,M));else throw Error("non exhaustive match")}return f}function Na(t,n,i,a){let o=[...i];o.push(t.name);let l=[...a];return l.push(1),{idx:n,def:t.definition,ruleStack:o,occurrenceStack:l}}var H;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(H||(H={}));function rs(t){if(t instanceof K||t==="Option")return H.OPTION;else if(t instanceof G||t==="Repetition")return H.REPETITION;else if(t instanceof Z||t==="RepetitionMandatory")return H.REPETITION_MANDATORY;else if(t instanceof Q||t==="RepetitionMandatoryWithSeparator")return H.REPETITION_MANDATORY_WITH_SEPARATOR;else if(t instanceof q||t==="RepetitionWithSeparator")return H.REPETITION_WITH_SEPARATOR;else if(t instanceof J||t==="Alternation")return H.ALTERNATION;else throw Error("non exhaustive match")}function li(t,n,i,a,o,l){let h=bt(t,n,i),u=mi(h)?at:Ue;return l(h,a,u,o)}function ci(t,n,i,a,o,l){let h=_t(t,n,o,i),u=mi(h)?at:Ue;return l(h[0],u,a)}function hi(t,n,i,a){let o=t.length,l=t.every((h)=>h.every((u)=>u.length===1));if(n)return function(h){let u=h.map((c)=>c.GATE);for(let c=0;c<o;c++){let d=t[c],f=d.length,m=u[c];if(m!==void 0&&m.call(this)===!1)continue;e:for(let R=0;R<f;R++){let y=d[R],U=y.length;for(let P=0;P<U;P++){let M=this.LA_FAST(P+1);if(i(M,y[P])===!1)continue e}return c}}return};else if(l&&!a){let u=t.map((c)=>c.flat()).reduce((c,d,f)=>(d.forEach((m)=>{if(!(m.tokenTypeIdx in c))c[m.tokenTypeIdx]=f;m.categoryMatches.forEach((R)=>{if(!Object.hasOwn(c,R))c[R]=f})}),c),{});return function(){let c=this.LA_FAST(1);return u[c.tokenTypeIdx]}}else return function(){for(let h=0;h<o;h++){let u=t[h],c=u.length;e:for(let d=0;d<c;d++){let f=u[d],m=f.length;for(let R=0;R<m;R++){let y=this.LA_FAST(R+1);if(i(y,f[R])===!1)continue e}return h}}return}}function ui(t,n,i){let a=t.every((l)=>l.length===1),o=t.length;if(a&&!i){let l=t.flat();if(l.length===1&&l[0].categoryMatches.length===0){let u=l[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===u}}else{let h=l.reduce((u,c,d)=>(u[c.tokenTypeIdx]=!0,c.categoryMatches.forEach((f)=>{u[f]=!0}),u),[]);return function(){let u=this.LA_FAST(1);return h[u.tokenTypeIdx]===!0}}}else return function(){e:for(let l=0;l<o;l++){let h=t[l],u=h.length;for(let c=0;c<u;c++){let d=this.LA_FAST(c+1);if(n(d,h[c])===!1)continue e}return!0}return!1}}class di extends $e{constructor(t,n,i){super();this.topProd=t,this.targetOccurrence=n,this.targetProdType=i}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(t,n,i,a){if(t.idx===this.targetOccurrence&&this.targetProdType===n)return this.restDef=i.concat(a),!0;return!1}walkOption(t,n,i){if(!this.checkIsTarget(t,H.OPTION,n,i))super.walkOption(t,n,i)}walkAtLeastOne(t,n,i){if(!this.checkIsTarget(t,H.REPETITION_MANDATORY,n,i))super.walkOption(t,n,i)}walkAtLeastOneSep(t,n,i){if(!this.checkIsTarget(t,H.REPETITION_MANDATORY_WITH_SEPARATOR,n,i))super.walkOption(t,n,i)}walkMany(t,n,i){if(!this.checkIsTarget(t,H.REPETITION,n,i))super.walkOption(t,n,i)}walkManySep(t,n,i){if(!this.checkIsTarget(t,H.REPETITION_WITH_SEPARATOR,n,i))super.walkOption(t,n,i)}}class zs extends Ae{constructor(t,n,i){super();this.targetOccurrence=t,this.targetProdType=n,this.targetRef=i,this.result=[]}checkIsTarget(t,n){if(t.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||t===this.targetRef))this.result=t.definition}visitOption(t){this.checkIsTarget(t,H.OPTION)}visitRepetition(t){this.checkIsTarget(t,H.REPETITION)}visitRepetitionMandatory(t){this.checkIsTarget(t,H.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(t){this.checkIsTarget(t,H.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(t){this.checkIsTarget(t,H.REPETITION_WITH_SEPARATOR)}visitAlternation(t){this.checkIsTarget(t,H.ALTERNATION)}}function oi(t){let n=Array(t);for(let i=0;i<t;i++)n[i]=[];return n}function Vs(t){let n=[""];for(let i=0;i<t.length;i++){let a=t[i],o=[];for(let l=0;l<n.length;l++){let h=n[l];o.push(h+"_"+a.tokenTypeIdx);for(let u=0;u<a.categoryMatches.length;u++){let c="_"+a.categoryMatches[u];o.push(h+c)}}n=o}return n}function Ia(t,n,i){for(let a=0;a<t.length;a++){if(a===i)continue;let o=t[a];for(let l=0;l<n.length;l++){let h=n[l];if(o[h]===!0)return!1}}return!0}function pi(t,n){let i=t.map((h)=>is([h],1)),a=oi(i.length),o=i.map((h)=>{let u={};return h.forEach((c)=>{Vs(c.partialPath).forEach((f)=>{u[f]=!0})}),u}),l=i;for(let h=1;h<=n;h++){let u=l;l=oi(u.length);for(let c=0;c<u.length;c++){let d=u[c];for(let f=0;f<d.length;f++){let m=d[f].partialPath,R=d[f].suffixDef,y=Vs(m);if(Ia(o,y,c)||R.length===0||m.length===n){let P=a[c];if(as(P,m)===!1){P.push(m);for(let M=0;M<y.length;M++){let x=y[M];o[c][x]=!0}}}else{let P=is(R,h+1,m);l[c]=l[c].concat(P),P.forEach((M)=>{Vs(M.partialPath).forEach((_)=>{o[c][_]=!0})})}}}}return a}function bt(t,n,i,a){let o=new zs(t,H.ALTERNATION,a);return n.accept(o),pi(o.result,i)}function _t(t,n,i,a){let o=new zs(t,i);n.accept(o);let l=o.result,u=new di(n,t,i).startWalking(),c=new j({definition:l}),d=new j({definition:u});return pi([c,d],a)}function as(t,n){e:for(let i=0;i<t.length;i++){let a=t[i];if(a.length!==n.length)continue;for(let o=0;o<a.length;o++){let l=n[o],h=a[o];if((l===h||h.categoryMatchesMap[l.tokenTypeIdx]!==void 0)===!1)continue e}return!0}return!1}function fi(t,n){return t.length<n.length&&t.every((i,a)=>{let o=n[a];return i===o||o.categoryMatchesMap[i.tokenTypeIdx]})}function mi(t){return t.every((n)=>n.every((i)=>i.every((a)=>a.categoryMatches.length===0)))}function Ei(t){return t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName}).map((i)=>Object.assign({type:re.CUSTOM_LOOKAHEAD_VALIDATION},i))}function Ti(t,n,i,a){let o=t.flatMap((c)=>ka(c,i)),l=Ma(t,n,i),h=t.flatMap((c)=>_a(c,i)),u=t.flatMap((c)=>ba(c,t,a,i));return o.concat(l,h,u)}function ka(t,n){let i=new Ai;t.accept(i);let a=i.allProductions,o=Object.groupBy(a,Ca),l=Object.fromEntries(Object.entries(o).filter(([u,c])=>c.length>1));return Object.values(l).map((u)=>{let c=u[0],d=n.buildDuplicateFoundError(t,u),f=Se(c),m={message:d,type:re.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:f,occurrence:c.idx},R=gi(c);if(R)m.parameter=R;return m})}function Ca(t){return`${Se(t)}_#_${t.idx}_#_${gi(t)}`}function gi(t){if(t instanceof F)return t.terminalType.name;else if(t instanceof W)return t.nonTerminalName;else return""}class Ai extends Ae{constructor(){super(...arguments);this.allProductions=[]}visitNonTerminal(t){this.allProductions.push(t)}visitOption(t){this.allProductions.push(t)}visitRepetitionWithSeparator(t){this.allProductions.push(t)}visitRepetitionMandatory(t){this.allProductions.push(t)}visitRepetitionMandatoryWithSeparator(t){this.allProductions.push(t)}visitRepetition(t){this.allProductions.push(t)}visitAlternation(t){this.allProductions.push(t)}visitTerminal(t){this.allProductions.push(t)}}function ba(t,n,i,a){let o=[];if(n.reduce((h,u)=>{if(u.name===t.name)return h+1;return h},0)>1){let h=a.buildDuplicateRuleNameError({topLevelRule:t,grammarName:i});o.push({message:h,type:re.DUPLICATE_RULE_NAME,ruleName:t.name})}return o}function Si(t,n,i){let a=[],o;if(!n.includes(t))o=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${i}<-as it is not defined in any of the super grammars `,a.push({message:o,type:re.INVALID_RULE_OVERRIDE,ruleName:t});return a}function Hs(t,n,i,a=[]){let o=[],l=os(n.definition);if(l.length===0)return[];else{let h=t.name;if(l.includes(t))o.push({message:i.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:a}),type:re.LEFT_RECURSION,ruleName:h});let c=a.concat([t]),f=l.filter((m)=>!c.includes(m)).flatMap((m)=>{let R=[...a];return R.push(m),Hs(t,m,i,R)});return o.concat(f)}}function os(t){let n=[];if(t.length===0)return n;let i=t[0];if(i instanceof W)n.push(i.referencedRule);else if(i instanceof j||i instanceof K||i instanceof Z||i instanceof Q||i instanceof q||i instanceof G)n=n.concat(os(i.definition));else if(i instanceof J)n=i.definition.map((l)=>os(l.definition)).flat();else if(i instanceof F);else throw Error("non exhaustive match");let a=je(i),o=t.length>1;if(a&&o){let l=t.slice(1);return n.concat(os(l))}else return n}class ls extends Ae{constructor(){super(...arguments);this.alternations=[]}visitAlternation(t){this.alternations.push(t)}}function Ri(t,n){let i=new ls;return t.accept(i),i.alternations.flatMap((l)=>l.definition.slice(0,-1).flatMap((u,c)=>{if(ai([u],[],Ue,1).length===0)return[{message:n.buildEmptyAlternationError({topLevelRule:t,alternation:l,emptyChoiceIdx:c}),type:re.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:l.idx,alternative:c+1}];else return[]}))}function yi(t,n,i){let a=new ls;t.accept(a);let o=a.alternations;return o=o.filter((h)=>h.ignoreAmbiguities!==!0),o.flatMap((h)=>{let u=h.idx,c=h.maxLookahead||n,d=bt(u,t,c,h),f=xa(d,h,t,i),m=va(d,h,t,i);return f.concat(m)})}class Oi extends Ae{constructor(){super(...arguments);this.allProductions=[]}visitRepetitionWithSeparator(t){this.allProductions.push(t)}visitRepetitionMandatory(t){this.allProductions.push(t)}visitRepetitionMandatoryWithSeparator(t){this.allProductions.push(t)}visitRepetition(t){this.allProductions.push(t)}}function _a(t,n){let i=new ls;return t.accept(i),i.alternations.flatMap((l)=>{if(l.definition.length>255)return[{message:n.buildTooManyAlternativesError({topLevelRule:t,alternation:l}),type:re.TOO_MANY_ALTS,ruleName:t.name,occurrence:l.idx}];else return[]})}function Li(t,n,i){let a=[];return t.forEach((o)=>{let l=new Oi;o.accept(l),l.allProductions.forEach((u)=>{let c=rs(u),d=u.maxLookahead||n,f=u.idx;if(_t(f,o,c,d)[0].flat().length===0){let y=i.buildEmptyRepetitionError({topLevelRule:o,repetition:u});a.push({message:y,type:re.NO_NON_EMPTY_LOOKAHEAD,ruleName:o.name})}})}),a}function xa(t,n,i,a){let o=[];return t.reduce((u,c,d)=>{if(n.definition[d].ignoreAmbiguities===!0)return u;return c.forEach((f)=>{let m=[d];if(t.forEach((R,y)=>{if(d!==y&&as(R,f)&&n.definition[y].ignoreAmbiguities!==!0)m.push(y)}),m.length>1&&!as(o,f))o.push(f),u.push({alts:m,path:f})}),u},[]).map((u)=>{let c=u.alts.map((f)=>f+1);return{message:a.buildAlternationAmbiguityError({topLevelRule:i,alternation:n,ambiguityIndices:c,prefixPath:u.path}),type:re.AMBIGUOUS_ALTS,ruleName:i.name,occurrence:n.idx,alternatives:u.alts}})}function va(t,n,i,a){let o=t.reduce((h,u,c)=>{let d=u.map((f)=>({idx:c,path:f}));return h.concat(d)},[]);return o.flatMap((h)=>{if(n.definition[h.idx].ignoreAmbiguities===!0)return[];let{idx:c,path:d}=h;return o.filter((R)=>n.definition[R.idx].ignoreAmbiguities!==!0&&R.idx<c&&fi(R.path,d)).map((R)=>{let y=[R.idx+1,c+1],U=n.idx===0?"":n.idx;return{message:a.buildAlternationPrefixAmbiguityError({topLevelRule:i,alternation:n,ambiguityIndices:y,prefixPath:R.path}),type:re.AMBIGUOUS_PREFIX_ALTS,ruleName:i.name,occurrence:U,alternatives:y}})})}function Ma(t,n,i){let a=[],o=n.map((l)=>l.name);return t.forEach((l)=>{let h=l.name;if(o.includes(h)){let u=i.buildNamespaceConflictError(l);a.push({message:u,type:re.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:h})}}),a}function Ni(t){let n=Object.assign({errMsgProvider:si},t),i={};return t.rules.forEach((a)=>{i[a.name]=a}),ni(i,n.errMsgProvider)}function Ii(t){var n;let i=(n=t.errMsgProvider)!==null&&n!==void 0?n:Ce;return Ti(t.rules,t.tokenTypes,i,t.grammarName)}var ki=["MismatchedTokenException","NoViableAltException","EarlyExitException","NotAllInputParsedException"];Object.freeze(ki);function Ge(t){return ki.includes(t.name)}class xt extends Error{constructor(t,n){super(t);if(this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}}class ot extends xt{constructor(t,n,i){super(t,n);this.previousToken=i,this.name="MismatchedTokenException"}}class cs extends xt{constructor(t,n,i){super(t,n);this.previousToken=i,this.name="NoViableAltException"}}class hs extends xt{constructor(t,n){super(t,n);this.name="NotAllInputParsedException"}}class us extends xt{constructor(t,n,i){super(t,n);this.previousToken=i,this.name="EarlyExitException"}}var Xs={},Ys="InRuleRecoveryException";class Ci extends Error{constructor(t){super(t);this.name=Ys}}class qs{initRecoverable(t){if(this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(t,"recoveryEnabled")?t.recoveryEnabled:me.recoveryEnabled,this.recoveryEnabled)this.attemptInRepetitionRecovery=wa}getTokenToInsert(t){let n=qe(t,"",-1,-1,-1,-1,-1,-1);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(t){return!0}canTokenTypeBeDeletedInRecovery(t){return!0}tryInRepetitionRecovery(t,n,i,a){let o=this.findReSyncTokenType(),l=this.exportLexerState(),h=[],u=!1,c=this.LA_FAST(1),d=this.LA_FAST(1),f=()=>{let m=this.LA(0),R=this.errorMessageProvider.buildMismatchTokenMessage({expected:a,actual:c,previous:m,ruleName:this.getCurrRuleFullName()}),y=new ot(R,c,this.LA(0));y.resyncedTokens=h.slice(0,-1),this.SAVE_ERROR(y)};while(!u)if(this.tokenMatcher(d,a)){f();return}else if(i.call(this)){f(),t.apply(this,n);return}else if(this.tokenMatcher(d,o))u=!0;else d=this.SKIP_TOKEN(),this.addToResyncTokens(d,h);this.importLexerState(l)}shouldInRepetitionRecoveryBeTried(t,n,i){if(i===!1)return!1;if(this.tokenMatcher(this.LA_FAST(1),t))return!1;if(this.isBackTracking())return!1;if(this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,n)))return!1;return!0}getNextPossibleTokenTypes(t){let n=t.ruleStack[0],a=this.getGAstProductions()[n];return new Ws(a,t).startWalking()}getFollowsForInRuleRecovery(t,n){let i=this.getCurrentGrammarPath(t,n);return this.getNextPossibleTokenTypes(i)}tryInRuleRecovery(t,n){if(this.canRecoverWithSingleTokenInsertion(t,n))return this.getTokenToInsert(t);if(this.canRecoverWithSingleTokenDeletion(t)){let i=this.SKIP_TOKEN();return this.consumeToken(),i}throw new Ci("sad sad panda")}canPerformInRuleRecovery(t,n){return this.canRecoverWithSingleTokenInsertion(t,n)||this.canRecoverWithSingleTokenDeletion(t)}canRecoverWithSingleTokenInsertion(t,n){if(!this.canTokenTypeBeInsertedInRecovery(t))return!1;if(n.length===0)return!1;let i=this.LA_FAST(1);return n.find((o)=>this.tokenMatcher(i,o))!==void 0}canRecoverWithSingleTokenDeletion(t){if(!this.canTokenTypeBeDeletedInRecovery(t))return!1;return this.tokenMatcher(this.LA(2),t)}isInCurrentRuleReSyncSet(t){let n=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(n).includes(t)}findReSyncTokenType(){let t=this.flattenFollowSet(),n=this.LA_FAST(1),i=2;while(!0){let a=t.find((o)=>kt(n,o));if(a!==void 0)return a;n=this.LA(i),i++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return Xs;let t=this.currRuleShortName,n=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(i)}}buildFullFollowKeyStack(){let t=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK,i=this.RULE_STACK_IDX+1,a=Array(i);for(let o=0;o<i;o++)if(o===0)a[o]=Xs;else a[o]={ruleName:this.shortRuleNameToFullName(t[o]),idxInCallingRule:n[o],inRule:this.shortRuleNameToFullName(t[o-1])};return a}flattenFollowSet(){return this.buildFullFollowKeyStack().map((n)=>this.getFollowSetFromFollowKey(n)).flat()}getFollowSetFromFollowKey(t){if(t===Xs)return[Re];let n=t.ruleName+t.idxInCallingRule+jt+t.inRule;return this.resyncFollows[n]}addToResyncTokens(t,n){if(!this.tokenMatcher(t,Re))n.push(t);return n}reSyncTo(t){let n=[],i=this.LA_FAST(1);while(this.tokenMatcher(i,t)===!1)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,n);return n.slice(0,-1)}attemptInRepetitionRecovery(t,n,i,a,o,l,h){}getCurrentGrammarPath(t,n){let i=this.getHumanReadableRuleStack(),a=this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1);return{ruleStack:i,occurrenceStack:a,lastTok:t,lastTokOccurrence:n}}getHumanReadableRuleStack(){let t=this.RULE_STACK_IDX+1,n=Array(t);for(let i=0;i<t;i++)n[i]=this.shortRuleNameToFullName(this.RULE_STACK[i]);return n}}function wa(t,n,i,a,o,l,h){var u,c,d;let f=a|o,m=(u=(c=this.firstAfterRepMap)[d=this.currRuleShortName])!==null&&u!==void 0?u:c[d]=[],R=m[f];if(R===void 0){let M=this.getCurrRuleFullName(),x=this.getGAstProductions()[M];R=new l(x,o).startWalking(),m[f]=R}let y=R.token,U=R.occurrence,P=R.isEndOfRule;if(this.RULE_STACK_IDX===0&&P&&y===void 0)y=Re,U=1;if(y===void 0||U===void 0)return;if(this.shouldInRepetitionRecoveryBeTried(y,U,h))this.tryInRepetitionRecovery(t,n,i,y)}var ds=256,ps=512,vt=768,Mt=1024,wt=1280,lt=1536;class fs{constructor(t){var n;this.maxLookahead=(n=t===null||t===void 0?void 0:t.maxLookahead)!==null&&n!==void 0?n:me.maxLookahead}validate(t){let n=this.validateNoLeftRecursion(t.rules);if(n.length===0){let i=this.validateEmptyOrAlternatives(t.rules),a=this.validateAmbiguousAlternationAlternatives(t.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(t.rules,this.maxLookahead);return[...n,...i,...a,...o]}return n}validateNoLeftRecursion(t){return t.flatMap((n)=>Hs(n,n,Ce))}validateEmptyOrAlternatives(t){return t.flatMap((n)=>Ri(n,Ce))}validateAmbiguousAlternationAlternatives(t,n){return t.flatMap((i)=>yi(i,n,Ce))}validateSomeNonEmptyLookaheadPath(t,n){return Li(t,n,Ce)}buildLookaheadForAlternation(t){return li(t.prodOccurrence,t.rule,t.maxLookahead,t.hasPredicates,t.dynamicTokensEnabled,hi)}buildLookaheadForOptional(t){return ci(t.prodOccurrence,t.rule,t.maxLookahead,t.dynamicTokensEnabled,rs(t.prodType),ui)}}class Js{initLooksAhead(t){this.dynamicTokensEnabled=Object.hasOwn(t,"dynamicTokensEnabled")?t.dynamicTokensEnabled:me.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(t,"maxLookahead")?t.maxLookahead:me.maxLookahead,this.lookaheadStrategy=Object.hasOwn(t,"lookaheadStrategy")?t.lookaheadStrategy:new fs({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(t){t.forEach((n)=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{let{alternation:i,repetition:a,option:o,repetitionMandatory:l,repetitionMandatoryWithSeparator:h,repetitionWithSeparator:u}=Ua(n);i.forEach((c)=>{let d=c.idx===0?"":c.idx;this.TRACE_INIT(`${Se(c)}${d}`,()=>{let f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:n,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[n.name],ds|c.idx,f)})}),a.forEach((c)=>{this.computeLookaheadFunc(n,c.idx,vt,"Repetition",c.maxLookahead,Se(c))}),o.forEach((c)=>{this.computeLookaheadFunc(n,c.idx,ps,"Option",c.maxLookahead,Se(c))}),l.forEach((c)=>{this.computeLookaheadFunc(n,c.idx,Mt,"RepetitionMandatory",c.maxLookahead,Se(c))}),h.forEach((c)=>{this.computeLookaheadFunc(n,c.idx,lt,"RepetitionMandatoryWithSeparator",c.maxLookahead,Se(c))}),u.forEach((c)=>{this.computeLookaheadFunc(n,c.idx,wt,"RepetitionWithSeparator",c.maxLookahead,Se(c))})})})}computeLookaheadFunc(t,n,i,a,o,l){this.TRACE_INIT(`${l}${n===0?"":n}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:t,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:a});this.setLaFuncCache(this.fullRuleNameToShort[t.name],i|n,h)})}setLaFuncCache(t,n,i){let a=this.lookAheadFuncsCache[t];if(a===void 0)a=[],this.lookAheadFuncsCache[t]=a;a[n]=i}}class bi extends Ae{constructor(){super(...arguments);this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(t){this.dslMethods.option.push(t)}visitRepetitionWithSeparator(t){this.dslMethods.repetitionWithSeparator.push(t)}visitRepetitionMandatory(t){this.dslMethods.repetitionMandatory.push(t)}visitRepetitionMandatoryWithSeparator(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)}visitRepetition(t){this.dslMethods.repetition.push(t)}visitAlternation(t){this.dslMethods.alternation.push(t)}}var ms=new bi;function Ua(t){ms.reset(),t.accept(ms);let n=ms.dslMethods;return ms.reset(),n}function Zs(t,n){if(t.startOffset===-1)t.startOffset=n.startOffset,t.endOffset=n.endOffset;else if(t.endOffset<n.endOffset===!0)t.endOffset=n.endOffset}function Qs(t,n){if(t.startOffset===-1)t.startOffset=n.startOffset,t.startColumn=n.startColumn,t.startLine=n.startLine,t.endOffset=n.endOffset,t.endColumn=n.endColumn,t.endLine=n.endLine;else if(t.endOffset<n.endOffset===!0)t.endOffset=n.endOffset,t.endColumn=n.endColumn,t.endLine=n.endLine}function _i(t,n,i){if(t.children[i]===void 0)t.children[i]=[n];else t.children[i].push(n)}function xi(t,n,i){if(t.children[n]===void 0)t.children[n]=[i];else t.children[n].push(i)}function en(t,n){Object.defineProperty(t,"name",{enumerable:!1,configurable:!0,writable:!1,value:n})}function Pa(t,n){let i=Object.keys(t),a=i.length;for(let o=0;o<a;o++){let l=i[o],h=t[l],u=h.length;for(let c=0;c<u;c++){let d=h[c];if(d.tokenTypeIdx===void 0)this[d.name](d.children,n)}}}function vi(t,n){let i=function(){};en(i,t+"BaseSemantics");let a={visit:function(o,l){if(Array.isArray(o))o=o[0];if(o===void 0)return;return this[o.name](o.children,l)},validateVisitor:function(){let o=Da(this,n);if(o.length!==0){let l=o.map((h)=>h.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
87
- ${l.join(`
88
-
89
- `).replace(/\n/g,`
90
- `)}`)}}};return i.prototype=a,i.prototype.constructor=i,i._RULE_NAMES=n,i}function Mi(t,n,i){let a=function(){};en(a,t+"BaseSemanticsWithDefaults");let o=Object.create(i.prototype);return n.forEach((l)=>{o[l]=Pa}),a.prototype=o,a.prototype.constructor=a,a}var tn;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(tn||(tn={}));function Da(t,n){return Fa(t,n)}function Fa(t,n){return n.filter((o)=>typeof t[o]==="function"===!1).map((o)=>({msg:`Missing visitor method: <${o}> on ${t.constructor.name} CST Visitor.`,type:tn.MISSING_METHOD,methodName:o})).filter(Boolean)}class sn{initTreeBuilder(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=Object.hasOwn(t,"nodeLocationTracking")?t.nodeLocationTracking:me.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))if(this.recoveryEnabled)this.setNodeLocationFromToken=Qs,this.setNodeLocationFromNode=Qs,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery;else this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular;else if(/onlyOffset/i.test(this.nodeLocationTracking))if(this.recoveryEnabled)this.setNodeLocationFromToken=Zs,this.setNodeLocationFromNode=Zs,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery;else this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular;else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${t.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(t){t.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(t){t.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(t){t.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(t){let n=this.LA_FAST(1);t.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(t){let n={name:t,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(t){let n=this.LA(0),i=t.location;if(i.startOffset!==-1&&i.startOffset<=n.startOffset===!0)i.endOffset=n.endOffset,i.endLine=n.endLine,i.endColumn=n.endColumn;else i.startOffset=-1,i.startLine=-1,i.startColumn=-1}cstPostRuleOnlyOffset(t){let n=this.LA(0),i=t.location;if(i.startOffset!==-1&&i.startOffset<=n.startOffset===!0)i.endOffset=n.endOffset;else i.startOffset=-1}cstPostTerminal(t,n){let i=this.CST_STACK[this.CST_STACK.length-1];_i(i,n,t),this.setNodeLocationFromToken(i.location,n)}cstPostNonTerminal(t,n){let i=this.CST_STACK[this.CST_STACK.length-1];xi(i,n,t),this.setNodeLocationFromNode(i.location,t.location)}get currCSTNode(){let t=this;return t.CST_STACK[t.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let t=vi(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=t,t}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let t=Mi(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=t,t}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}}class nn{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(t){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=t,this.tokVectorLength=t.length}get input(){return this.tokVector}SKIP_TOKEN(){if(this.currIdx<=this.tokVectorLength-2)return this.consumeToken(),this.LA_FAST(1);else return De}LA_FAST(t){let n=this.currIdx+t;return this.tokVector[n]}LA(t){let n=this.currIdx+t;if(n<0||this.tokVectorLength<=n)return De;else return this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(t){this.currIdx=t}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}}class rn{ACTION(t){return t.call(this)}consume(t,n,i){return this.consumeInternal(n,t,i)}subrule(t,n,i){return this.subruleInternal(n,t,i)}option(t,n){return this.optionInternal(n,t)}or(t,n){return this.orInternal(n,t)}many(t,n){return this.manyInternal(t,n)}atLeastOne(t,n){return this.atLeastOneInternal(t,n)}CONSUME(t,n){return this.consumeInternal(t,0,n)}CONSUME1(t,n){return this.consumeInternal(t,1,n)}CONSUME2(t,n){return this.consumeInternal(t,2,n)}CONSUME3(t,n){return this.consumeInternal(t,3,n)}CONSUME4(t,n){return this.consumeInternal(t,4,n)}CONSUME5(t,n){return this.consumeInternal(t,5,n)}CONSUME6(t,n){return this.consumeInternal(t,6,n)}CONSUME7(t,n){return this.consumeInternal(t,7,n)}CONSUME8(t,n){return this.consumeInternal(t,8,n)}CONSUME9(t,n){return this.consumeInternal(t,9,n)}SUBRULE(t,n){return this.subruleInternal(t,0,n)}SUBRULE1(t,n){return this.subruleInternal(t,1,n)}SUBRULE2(t,n){return this.subruleInternal(t,2,n)}SUBRULE3(t,n){return this.subruleInternal(t,3,n)}SUBRULE4(t,n){return this.subruleInternal(t,4,n)}SUBRULE5(t,n){return this.subruleInternal(t,5,n)}SUBRULE6(t,n){return this.subruleInternal(t,6,n)}SUBRULE7(t,n){return this.subruleInternal(t,7,n)}SUBRULE8(t,n){return this.subruleInternal(t,8,n)}SUBRULE9(t,n){return this.subruleInternal(t,9,n)}OPTION(t){return this.optionInternal(t,0)}OPTION1(t){return this.optionInternal(t,1)}OPTION2(t){return this.optionInternal(t,2)}OPTION3(t){return this.optionInternal(t,3)}OPTION4(t){return this.optionInternal(t,4)}OPTION5(t){return this.optionInternal(t,5)}OPTION6(t){return this.optionInternal(t,6)}OPTION7(t){return this.optionInternal(t,7)}OPTION8(t){return this.optionInternal(t,8)}OPTION9(t){return this.optionInternal(t,9)}OR(t){return this.orInternal(t,0)}OR1(t){return this.orInternal(t,1)}OR2(t){return this.orInternal(t,2)}OR3(t){return this.orInternal(t,3)}OR4(t){return this.orInternal(t,4)}OR5(t){return this.orInternal(t,5)}OR6(t){return this.orInternal(t,6)}OR7(t){return this.orInternal(t,7)}OR8(t){return this.orInternal(t,8)}OR9(t){return this.orInternal(t,9)}MANY(t){this.manyInternal(0,t)}MANY1(t){this.manyInternal(1,t)}MANY2(t){this.manyInternal(2,t)}MANY3(t){this.manyInternal(3,t)}MANY4(t){this.manyInternal(4,t)}MANY5(t){this.manyInternal(5,t)}MANY6(t){this.manyInternal(6,t)}MANY7(t){this.manyInternal(7,t)}MANY8(t){this.manyInternal(8,t)}MANY9(t){this.manyInternal(9,t)}MANY_SEP(t){this.manySepFirstInternal(0,t)}MANY_SEP1(t){this.manySepFirstInternal(1,t)}MANY_SEP2(t){this.manySepFirstInternal(2,t)}MANY_SEP3(t){this.manySepFirstInternal(3,t)}MANY_SEP4(t){this.manySepFirstInternal(4,t)}MANY_SEP5(t){this.manySepFirstInternal(5,t)}MANY_SEP6(t){this.manySepFirstInternal(6,t)}MANY_SEP7(t){this.manySepFirstInternal(7,t)}MANY_SEP8(t){this.manySepFirstInternal(8,t)}MANY_SEP9(t){this.manySepFirstInternal(9,t)}AT_LEAST_ONE(t){this.atLeastOneInternal(0,t)}AT_LEAST_ONE1(t){return this.atLeastOneInternal(1,t)}AT_LEAST_ONE2(t){this.atLeastOneInternal(2,t)}AT_LEAST_ONE3(t){this.atLeastOneInternal(3,t)}AT_LEAST_ONE4(t){this.atLeastOneInternal(4,t)}AT_LEAST_ONE5(t){this.atLeastOneInternal(5,t)}AT_LEAST_ONE6(t){this.atLeastOneInternal(6,t)}AT_LEAST_ONE7(t){this.atLeastOneInternal(7,t)}AT_LEAST_ONE8(t){this.atLeastOneInternal(8,t)}AT_LEAST_ONE9(t){this.atLeastOneInternal(9,t)}AT_LEAST_ONE_SEP(t){this.atLeastOneSepFirstInternal(0,t)}AT_LEAST_ONE_SEP1(t){this.atLeastOneSepFirstInternal(1,t)}AT_LEAST_ONE_SEP2(t){this.atLeastOneSepFirstInternal(2,t)}AT_LEAST_ONE_SEP3(t){this.atLeastOneSepFirstInternal(3,t)}AT_LEAST_ONE_SEP4(t){this.atLeastOneSepFirstInternal(4,t)}AT_LEAST_ONE_SEP5(t){this.atLeastOneSepFirstInternal(5,t)}AT_LEAST_ONE_SEP6(t){this.atLeastOneSepFirstInternal(6,t)}AT_LEAST_ONE_SEP7(t){this.atLeastOneSepFirstInternal(7,t)}AT_LEAST_ONE_SEP8(t){this.atLeastOneSepFirstInternal(8,t)}AT_LEAST_ONE_SEP9(t){this.atLeastOneSepFirstInternal(9,t)}RULE(t,n,i=ct){if(this.definedRulesNames.includes(t)){let l={message:Ce.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:re.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(l)}this.definedRulesNames.push(t);let a=this.defineRule(t,n,i);return this[t]=a,a}OVERRIDE_RULE(t,n,i=ct){let a=Si(t,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(a);let o=this.defineRule(t,n,i);return this[t]=o,o}BACKTRACK(t,n){var i;let a=(i=t.coreRule)!==null&&i!==void 0?i:t;return function(){this.isBackTrackingStack.push(1);let o=this.saveRecogState();try{return a.apply(this,n),!0}catch(l){if(Ge(l))return!1;else throw l}finally{this.reloadRecogState(o),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Wt(Object.values(this.gastProductionsCache))}}class an{initRecognizerEngine(t,n){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=at,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
91
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
92
- For Further details.`);if(Array.isArray(t)){if(t.length===0)throw Error(`A Token Vocabulary cannot be empty.
93
- Note that the first argument for the parser constructor
94
- is no longer a Token vector (since v4.0).`);if(typeof t[0].startOffset==="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
95
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
96
- For Further details.`)}if(Array.isArray(t))this.tokensMap=t.reduce((o,l)=>(o[l.name]=l,o),{});else if(Object.hasOwn(t,"modes")&&Object.values(t.modes).flat().every(zn)){let o=Object.values(t.modes).flat(),l=[...new Set(o)];this.tokensMap=l.reduce((h,u)=>(h[u.name]=u,h),{})}else if(typeof t==="object"&&t!==null)this.tokensMap=Object.assign({},t);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Re;let a=(Object.hasOwn(t,"modes")?Object.values(t.modes).flat():Object.values(t)).every((o)=>{var l;return((l=o.categoryMatches)===null||l===void 0?void 0:l.length)==0});this.tokenMatcher=a?at:Ue,Pe(Object.values(this.tokensMap))}defineRule(t,n,i){if(this.selfAnalysisDone)throw Error(`Grammar rule <${t}> may not be defined after the 'performSelfAnalysis' method has been called'
97
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let a=Object.hasOwn(i,"resyncEnabled")?i.resyncEnabled:ct.resyncEnabled,o=Object.hasOwn(i,"recoveryValueFunc")?i.recoveryValueFunc:ct.recoveryValueFunc,l=this.ruleShortNameIdx++;this.shortRuleNameToFull[l]=t,this.fullRuleNameToShort[t]=l;let h;if(this.outputCst===!0)h=function(...f){try{this.ruleInvocationStateUpdate(l,t,this.subruleIdx),n.apply(this,f);let m=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(m),m}catch(m){return this.invokeRuleCatch(m,a,o)}finally{this.ruleFinallyStateUpdate()}};else h=function(...f){try{return this.ruleInvocationStateUpdate(l,t,this.subruleIdx),n.apply(this,f)}catch(m){return this.invokeRuleCatch(m,a,o)}finally{this.ruleFinallyStateUpdate()}};return Object.assign(function(...f){this.onBeforeParse(t);try{return h.apply(this,f)}finally{this.onAfterParse(t)}},{ruleName:t,originalGrammarAction:n,coreRule:h})}invokeRuleCatch(t,n,i){let a=this.RULE_STACK_IDX===0,o=n&&!this.isBackTracking()&&this.recoveryEnabled;if(Ge(t)){let l=t;if(o){let h=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(h))if(l.resyncedTokens=this.reSyncTo(h),this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return i(t);else{if(this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,l.partialCstResult=u}throw l}}else if(a)return this.moveToTerminatedState(),i(t);else throw l}else throw t}optionInternal(t,n){let i=ps|n;return this.optionInternalLogic(t,n,i)}optionInternalLogic(t,n,i){let a=this.currRuleLookaheadFuncs[i],o;if(typeof t!=="function"){o=t.DEF;let l=t.GATE;if(l!==void 0){let h=a;a=()=>l.call(this)&&h.call(this)}}else o=t;if(a.call(this)===!0)return o.call(this);return}atLeastOneInternal(t,n){let i=Mt|t;return this.atLeastOneInternalLogic(t,n,i)}atLeastOneInternalLogic(t,n,i){let a=this.currRuleLookaheadFuncs[i],o;if(typeof n!=="function"){o=n.DEF;let l=n.GATE;if(l!==void 0){let h=a;a=()=>l.call(this)&&h.call(this)}}else o=n;if(a.call(this)===!0){let l=this.doSingleRepetition(o);while(a.call(this)===!0&&l===!0)l=this.doSingleRepetition(o)}else throw this.raiseEarlyExitException(t,H.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[t,n],a,Mt,t,Ks)}atLeastOneSepFirstInternal(t,n){let i=lt|t;this.atLeastOneSepFirstInternalLogic(t,n,i)}atLeastOneSepFirstInternalLogic(t,n,i){let{DEF:a,SEP:o}=n;if(this.currRuleLookaheadFuncs[i].call(this)===!0){a.call(this);let h=()=>this.tokenMatcher(this.LA_FAST(1),o);while(this.tokenMatcher(this.LA_FAST(1),o)===!0)this.CONSUME(o),a.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,h,a,ns],h,lt,t,ns)}else throw this.raiseEarlyExitException(t,H.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(t,n){let i=vt|t;return this.manyInternalLogic(t,n,i)}manyInternalLogic(t,n,i){let a=this.currRuleLookaheadFuncs[i],o;if(typeof n!=="function"){o=n.DEF;let h=n.GATE;if(h!==void 0){let u=a;a=()=>h.call(this)&&u.call(this)}}else o=n;let l=!0;while(a.call(this)===!0&&l===!0)l=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[t,n],a,vt,t,js,l)}manySepFirstInternal(t,n){let i=wt|t;this.manySepFirstInternalLogic(t,n,i)}manySepFirstInternalLogic(t,n,i){let{DEF:a,SEP:o}=n;if(this.currRuleLookaheadFuncs[i].call(this)===!0){a.call(this);let h=()=>this.tokenMatcher(this.LA_FAST(1),o);while(this.tokenMatcher(this.LA_FAST(1),o)===!0)this.CONSUME(o),a.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,h,a,ss],h,wt,t,ss)}}repetitionSepSecondInternal(t,n,i,a,o){while(i())this.CONSUME(n),a.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,n,i,a,o],i,lt,t,o)}doSingleRepetition(t){let n=this.getLexerPosition();return t.call(this),this.getLexerPosition()>n}orInternal(t,n){let i=ds|n,a=Array.isArray(t)?t:t.DEF,l=this.currRuleLookaheadFuncs[i].call(this,a);if(l!==void 0)return a[l].ALT.call(this);this.raiseNoAltException(n,t.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0)this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName];this.cstFinallyStateUpdate()}subruleInternal(t,n,i){let a;try{let o=i!==void 0?i.ARGS:void 0;return this.subruleIdx=n,a=t.coreRule.apply(this,o),this.cstPostNonTerminal(a,i!==void 0&&i.LABEL!==void 0?i.LABEL:t.ruleName),a}catch(o){throw this.subruleInternalError(o,i,t.ruleName)}}subruleInternalError(t,n,i){if(Ge(t)&&t.partialCstResult!==void 0)this.cstPostNonTerminal(t.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:i),delete t.partialCstResult;throw t}consumeInternal(t,n,i){let a;try{let o=this.LA_FAST(1);if(this.tokenMatcher(o,t)===!0)this.consumeToken(),a=o;else this.consumeInternalError(t,o,i)}catch(o){a=this.consumeInternalRecovery(t,n,o)}return this.cstPostTerminal(i!==void 0&&i.LABEL!==void 0?i.LABEL:t.name,a),a}consumeInternalError(t,n,i){let a,o=this.LA(0);if(i!==void 0&&i.ERR_MSG)a=i.ERR_MSG;else a=this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:n,previous:o,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ot(a,n,o))}consumeInternalRecovery(t,n,i){if(this.recoveryEnabled&&i.name==="MismatchedTokenException"&&!this.isBackTracking()){let a=this.getFollowsForInRuleRecovery(t,n);try{return this.tryInRuleRecovery(t,a)}catch(o){if(o.name===Ys)throw i;else throw o}}else throw i}saveRecogState(){let t=this.errors,n=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(t){this.errors=t.errors,this.importLexerState(t.lexerState);let n=t.RULE_STACK;for(let i=0;i<n.length;i++)this.RULE_STACK[i]=n[i];if(this.RULE_STACK_IDX=n.length-1,this.RULE_STACK_IDX>=0)this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]}ruleInvocationStateUpdate(t,n,i){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=i,this.RULE_STACK[++this.RULE_STACK_IDX]=t,this.currRuleShortName=t,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[t],this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let t=this.currRuleShortName;return this.shortRuleNameToFull[t]}shortRuleNameToFullName(t){return this.shortRuleNameToFull[t]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),Re)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(t){for(let n=0;n<this.maxLookahead+1;n++)this.tokVector.push(De)}onAfterParse(t){if(this.isAtEndOfInput()===!1){let n=this.LA(1),i=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:n,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new hs(i,n))}while(this.tokVector.at(-1)===De)this.tokVector.pop()}}class on{initErrorHandler(t){this._errors=[],this.errorMessageProvider=Object.hasOwn(t,"errorMessageProvider")?t.errorMessageProvider:me.errorMessageProvider}SAVE_ERROR(t){if(Ge(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(t),t;else throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(t){this._errors=t}raiseEarlyExitException(t,n,i){let a=this.getCurrRuleFullName(),o=this.getGAstProductions()[a],h=_t(t,o,n,this.maxLookahead)[0],u=[];for(let d=1;d<=this.maxLookahead;d++)u.push(this.LA(d));let c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:h,actual:u,previous:this.LA(0),customUserDescription:i,ruleName:a});throw this.SAVE_ERROR(new us(c,this.LA(1),this.LA(0)))}raiseNoAltException(t,n){let i=this.getCurrRuleFullName(),a=this.getGAstProductions()[i],o=bt(t,a,this.maxLookahead),l=[];for(let c=1;c<=this.maxLookahead;c++)l.push(this.LA(c));let h=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:l,previous:h,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new cs(u,this.LA(1),h))}}var Ts={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Ts);var wi=!0,Ui=255,Di=k({name:"RECORDING_PHASE_TOKEN",pattern:z.NA});Pe([Di]);var Fi=qe(Di,`This IToken indicates the Parser is in Recording Phase
98
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Fi);var Ba={name:`This CSTNode indicates the Parser is in Recording Phase
99
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class ln{initGastRecorder(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let t=0;t<10;t++){let n=t>0?t:"";this[`CONSUME${n}`]=function(i,a){return this.consumeInternalRecord(i,t,a)},this[`SUBRULE${n}`]=function(i,a){return this.subruleInternalRecord(i,t,a)},this[`OPTION${n}`]=function(i){return this.optionInternalRecord(i,t)},this[`OR${n}`]=function(i){return this.orInternalRecord(i,t)},this[`MANY${n}`]=function(i){this.manyInternalRecord(t,i)},this[`MANY_SEP${n}`]=function(i){this.manySepFirstInternalRecord(t,i)},this[`AT_LEAST_ONE${n}`]=function(i){this.atLeastOneInternalRecord(t,i)},this[`AT_LEAST_ONE_SEP${n}`]=function(i){this.atLeastOneSepFirstInternalRecord(t,i)}}this.consume=function(t,n,i){return this.consumeInternalRecord(n,t,i)},this.subrule=function(t,n,i){return this.subruleInternalRecord(n,t,i)},this.option=function(t,n){return this.optionInternalRecord(n,t)},this.or=function(t,n){return this.orInternalRecord(n,t)},this.many=function(t,n){this.manyInternalRecord(t,n)},this.atLeastOne=function(t,n){this.atLeastOneInternalRecord(t,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let t=this;for(let n=0;n<10;n++){let i=n>0?n:"";delete t[`CONSUME${i}`],delete t[`SUBRULE${i}`],delete t[`OPTION${i}`],delete t[`OR${i}`],delete t[`MANY${i}`],delete t[`MANY_SEP${i}`],delete t[`AT_LEAST_ONE${i}`],delete t[`AT_LEAST_ONE_SEP${i}`]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA})}ACTION_RECORD(t){}BACKTRACK_RECORD(t,n){return()=>!0}LA_RECORD(t){return De}topLevelRuleRecord(t,n){try{let i=new Te({definition:[],name:t});return i.name=t,this.recordingProdStack.push(i),n.call(this),this.recordingProdStack.pop(),i}catch(i){if(i.KNOWN_RECORDER_ERROR!==!0)try{i.message=i.message+`
100
- This error was thrown during the "grammar recording phase" For more info see:
101
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch(a){throw i}throw i}}optionInternalRecord(t,n){return Ut.call(this,K,t,n)}atLeastOneInternalRecord(t,n){Ut.call(this,Z,n,t)}atLeastOneSepFirstInternalRecord(t,n){Ut.call(this,Q,n,t,wi)}manyInternalRecord(t,n){Ut.call(this,G,n,t)}manySepFirstInternalRecord(t,n){Ut.call(this,q,n,t,wi)}orInternalRecord(t,n){return $a.call(this,t,n)}subruleInternalRecord(t,n,i){if(Es(n),!t||!Object.hasOwn(t,"ruleName")){let h=Error(`<SUBRULE${Pi(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(t)}>
102
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw h.KNOWN_RECORDER_ERROR=!0,h}let a=this.recordingProdStack.at(-1),o=t.ruleName,l=new W({idx:n,nonTerminalName:o,label:i===null||i===void 0?void 0:i.LABEL,referencedRule:void 0});return a.definition.push(l),this.outputCst?Ba:Ts}consumeInternalRecord(t,n,i){if(Es(n),!Bs(t)){let l=Error(`<CONSUME${Pi(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(t)}>
103
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw l.KNOWN_RECORDER_ERROR=!0,l}let a=this.recordingProdStack.at(-1),o=new F({idx:n,terminalType:t,label:i===null||i===void 0?void 0:i.LABEL});return a.definition.push(o),Fi}}function Ut(t,n,i,a=!1){Es(i);let o=this.recordingProdStack.at(-1),l=typeof n==="function"?n:n.DEF,h=new t({definition:[],idx:i});if(a)h.separator=n.SEP;if(Object.hasOwn(n,"MAX_LOOKAHEAD"))h.maxLookahead=n.MAX_LOOKAHEAD;return this.recordingProdStack.push(h),l.call(this),o.definition.push(h),this.recordingProdStack.pop(),Ts}function $a(t,n){Es(n);let i=this.recordingProdStack.at(-1),a=Array.isArray(t)===!1,o=a===!1?t:t.DEF,l=new J({definition:[],idx:n,ignoreAmbiguities:a&&t.IGNORE_AMBIGUITIES===!0});if(Object.hasOwn(t,"MAX_LOOKAHEAD"))l.maxLookahead=t.MAX_LOOKAHEAD;let h=o.some((u)=>typeof u.GATE==="function");return l.hasPredicates=h,i.definition.push(l),o.forEach((u)=>{let c=new j({definition:[]});if(l.definition.push(c),Object.hasOwn(u,"IGNORE_AMBIGUITIES"))c.ignoreAmbiguities=u.IGNORE_AMBIGUITIES;else if(Object.hasOwn(u,"GATE"))c.ignoreAmbiguities=!0;this.recordingProdStack.push(c),u.ALT.call(this),this.recordingProdStack.pop()}),Ts}function Pi(t){return t===0?"":`${t}`}function Es(t){if(t<0||t>Ui){let n=Error(`Invalid DSL Method idx value: <${t}>
104
- Idx value must be a none negative value smaller than ${Ui+1}`);throw n.KNOWN_RECORDER_ERROR=!0,n}}class cn{initPerformanceTracer(t){if(Object.hasOwn(t,"traceInitPerf")){let n=t.traceInitPerf,i=typeof n==="number";this.traceInitMaxIdent=i?n:1/0,this.traceInitPerf=i?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=me.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(t,n){if(this.traceInitPerf===!0){this.traceInitIndent++;let i=Array(this.traceInitIndent+1).join("\t");if(this.traceInitIndent<this.traceInitMaxIdent)console.log(`${i}--> <${t}>`);let{time:a,value:o}=At(n),l=a>10?console.warn:console.log;if(this.traceInitIndent<this.traceInitMaxIdent)l(`${i}<-- <${t}> time: ${a}ms`);return this.traceInitIndent--,o}else return n()}}function Bi(t,n){n.forEach((i)=>{let a=i.prototype;Object.getOwnPropertyNames(a).forEach((o)=>{if(o==="constructor")return;let l=Object.getOwnPropertyDescriptor(a,o);if(l&&(l.get||l.set))Object.defineProperty(t.prototype,o,l);else t.prototype[o]=i.prototype[o]})})}var De=qe(Re,"",-1,-1,-1,-1,-1,-1);Object.freeze(De);var me=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ts,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ct=Object.freeze({recoveryValueFunc:()=>{return},resyncEnabled:!0}),re;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(re||(re={}));class Pt{static performSelfAnalysis(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT("toFastProps",()=>{St(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach((a)=>{let l=this[a].originalGrammarAction,h;this.TRACE_INIT(`${a} Rule`,()=>{h=this.topLevelRuleRecord(a,l)}),this.gastProductionsCache[a]=h})}finally{this.disableRecording()}});let i=[];if(this.TRACE_INIT("Grammar Resolving",()=>{i=Ni({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(i)}),this.TRACE_INIT("Grammar Validations",()=>{if(i.length===0&&this.skipValidations===!1){let a=Ii({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:Ce,grammarName:n}),o=Ei({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(a,o)}}),this.definitionErrors.length===0){if(this.recoveryEnabled)this.TRACE_INIT("computeAllProdsFollows",()=>{let a=kn(Object.values(this.gastProductionsCache));this.resyncFollows=a});this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var a,o;(o=(a=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(a,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})}if(!Pt.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map((a)=>a.message),Error(`Parser Definition Errors detected:
105
- ${t.join(`
106
- -------------------------------
107
- `)}`)})}constructor(t,n){this.definitionErrors=[],this.selfAnalysisDone=!1;let i=this;if(i.initErrorHandler(n),i.initLexerAdapter(),i.initLooksAhead(n),i.initRecognizerEngine(t,n),i.initRecoverable(n),i.initTreeBuilder(n),i.initGastRecorder(n),i.initPerformanceTracer(n),Object.hasOwn(n,"ignoredIssues"))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
108
- Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
109
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
110
- For further details.`);this.skipValidations=Object.hasOwn(n,"skipValidations")?n.skipValidations:me.skipValidations}}Pt.DEFER_DEFINITION_ERRORS_HANDLING=!1;Bi(Pt,[qs,Js,sn,nn,an,rn,on,ln,cn]);class gs extends Pt{constructor(t,n=me){let i=Object.assign({},n);i.outputCst=!0;super(t,i)}}var ut=e((t)=>t!==void 0&&t>=0,"isKnownLocation");function Xi(t,n){let i=t.lexer.tokenize(n);if(i.errors.length>0){let o=i.errors[0],l=ut(o.offset)?o.offset:n.length,h=l+(ut(o.length)?o.length:0);throw Error(`Error lexing ${t.diagramType} diagram: ${o.message} at line ${o.line??1}, column ${o.column??1} [${l},${h})`)}t.parser.input=i.tokens;let a=t.entry();if(t.parser.errors.length>0)throw Error(`Error parsing ${t.diagramType} diagram: ${t.parser.errors[0].message}`);t.visit(a)}e(Xi,"runChevrotainParse");var X={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},Wa="LR",ja=D.usecase,Tn=e(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:Wa,relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(ja)}),"createModel"),Ka=e((t)=>{if(!(t.actors instanceof Map)||!(t.useCases instanceof Map)||!(t.systemBoundaries instanceof Map)||!Array.isArray(t.relationships)||!(t.notes instanceof Map)||!(t.jsonNodes instanceof Map)||!(t.classDefs instanceof Map)||!(t.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(t.direction)||!Number.isSafeInteger(t.relationshipCounter)||t.relationshipCounter<0||!Number.isSafeInteger(t.noteCounter)||t.noteCounter<0||typeof t.accTitle!=="string"||typeof t.accDescription!=="string"||!t.config)throw Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),B=Tn(),Va=e(()=>structuredClone(B.config),"getConfig"),za=e(()=>B.ast,"getAST"),Ha=e((t)=>{let n=structuredClone(t);Ka(n);let i=E(),a=A();try{S(n.accTitle),T(n.accDescription),B=n}catch(o){throw S(i),T(a),o}},"commit"),Xa=e(()=>{B=Tn(),C()},"clear"),Ya=e(()=>B.actors,"getActors"),qa=e((t)=>B.actors.get(t),"getActor"),Ja=e(()=>B.useCases,"getUseCases"),Za=e((t)=>B.useCases.get(t),"getUseCase"),Qa=e(()=>B.systemBoundaries,"getSystemBoundaries"),eo=e((t)=>B.systemBoundaries.get(t),"getSystemBoundary"),to=e(()=>B.relationships,"getRelationships"),so=e(()=>B.notes,"getNotes"),no=e((t)=>B.notes.get(t),"getNote"),io=e(()=>B.jsonNodes,"getJsonNodes"),ro=e((t)=>B.jsonNodes.get(t),"getJsonNode"),ao=e(()=>B.classDefs,"getClassDefs"),oo=e((t)=>B.classDefs.get(t),"getClassDef"),Yi=e(()=>B.direction,"getDirection"),Je=e((t)=>{let n=new Map;for(let i of["default",...t]){let a=B.classDefs.get(i);if(!a)continue;for(let o of a.styles){let l=o.trim(),h=l.indexOf(":"),u=(h===-1?l:l.slice(0,h)).trim();if(u)n.set(u,l)}}return[...n.values()]},"getCompiledStyles"),lo=e((t)=>t.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),$i=e((t)=>typeof t==="string"?t:t===null?"null":String(t),"displayJsonScalar"),co=e((t,n,i=(a)=>a)=>{let a=[],o=e((h,u,c)=>{a.push({key:i(h),accessibleKey:i(u),value:i(c)})},"append"),l=e((h,u,c)=>{if(Array.isArray(h)){if(h.length===0){o(u,u,"[]");return}if(h.every((f)=>f===null||["string","number","boolean"].includes(typeof f))){for(let[f,m]of h.entries())o(f===0?u:"",u,$i(m));return}for(let[f,m]of h.entries())l(m,`${u}[${f}]`,`${c}/${f}`);return}if(h!==null&&typeof h==="object"){let d=h,f=n[c]??Object.keys(d);if(f.length===0){o(u,u,"{}");return}for(let m of f){let R=u?`${u}.${m}`:m;l(d[m],R,`${c}/${lo(m)}`)}return}o(u,u,$i(h))},"visit");return l(t,"",""),a},"flattenJsonRows"),ho=e((t)=>{switch(t.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),uo=e((t)=>{if(t.shape==="ellipse")return t.business?"usecaseBusiness":"usecaseEllipse";return t.shape},"useCaseShape"),po=e((t)=>{switch(t){case X.SOLID_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case X.BACK_ARROW:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case X.CIRCLE_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case X.CROSS_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case X.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case X.CROSS_ARROW_REVERSED:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case X.LINE_SOLID:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),fo=e((t)=>{switch(t.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:t.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...po(t.arrowType),pattern:"solid",...t.label?{label:t.label}:{},...t.labelType?{labelType:t.labelType}:{}}}},"relationshipVisuals"),mo=e((t)=>t.animate||t.animation?[`edge-animation-${t.animation??"fast"}`]:[],"animationClasses"),Dt=e((...t)=>t.filter((n)=>Boolean(n)).join(" "),"classNames"),Eo=e(()=>{let t=s(),n={...B.config,...t.usecase},i=e((c)=>O(c,t),"sanitize"),a=e((c)=>i(B.actors.get(c)?.label??B.useCases.get(c)?.label??B.jsonNodes.get(c)?.id??B.notes.get(c)?.label??c),"endpointLabel"),o=[],l=[],h=0,u=0;for(let c of B.actors.values())o.push({id:c.id,label:i(c.label),labelType:c.labelType,shape:ho(c),isGroup:!1,padding:10,look:t.look,colorIndex:h++,cssClasses:Dt("default","usecase-actor",`usecase-actor-${c.type}`,c.business&&"usecase-business",...c.classes),cssStyles:[...c.styles],cssCompiledStyles:Je(c.classes),actorType:c.type,business:c.business,...c.icon?{icon:c.icon}:{},...c.stereotype?{stereotype:i(c.stereotype)}:{},...c.parentId?{parentId:c.parentId}:{}});for(let c of B.useCases.values())o.push({id:c.id,label:i(c.label),labelType:c.labelType,shape:uo(c),isGroup:!1,padding:c.shape==="ellipse"?20:10,look:t.look,colorIndex:h++,cssClasses:Dt("default","usecase-element",`usecase-${c.shape}`,c.business&&"usecase-business",...c.classes),cssStyles:[...c.styles],cssCompiledStyles:Je(c.classes),business:c.business,...c.stereotype?{stereotype:i(c.stereotype)}:{},...c.parentId?{parentId:c.parentId}:{}});for(let c of B.notes.values())o.push({id:c.id,label:i(c.label),labelType:c.labelType,shape:"note",isGroup:!1,padding:10,look:t.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:Je([]),noteTarget:c.target,noteTargetLabel:i(B.actors.get(c.target)?.label??B.useCases.get(c.target)?.label??B.jsonNodes.get(c.target)?.id??c.target)});for(let c of B.jsonNodes.values())o.push({id:c.id,label:i(c.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:t.look,cssClasses:Dt("default","usecase-json-table",...c.classes),cssStyles:[...c.styles],cssCompiledStyles:Je(c.classes),jsonRows:co(c.value,c.propertyOrder,i)});for(let c of B.systemBoundaries.values())o.push({id:c.id,label:i(c.label),labelType:c.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:t.look,colorIndex:u++,cssClasses:Dt("default","system-boundary",`system-boundary-${c.type}`,...c.classes),cssStyles:[...c.styles],cssCompiledStyles:Je(c.classes),boundaryType:c.type});for(let c of B.relationships){let{label:d,...f}=fo(c);l.push({id:c.id,start:c.source,end:c.target,source:c.source,target:c.target,sourceLabel:a(c.source),targetLabel:a(c.target),type:"edge",relationshipType:c.type,internal:!1,...f,...d!==void 0?{label:i(d)}:{},labelpos:"c",classes:Dt("default","relationship",`relationship-${c.type}`,...c.classes,...mo(c)),style:[...c.styles],cssCompiledStyles:Je(c.classes),animate:c.animate,...c.animation?{animation:c.animation}:{},look:t.look,thickness:"normal",minlen:c.minlen,isUserDefinedId:c.explicitId})}for(let c of B.notes.values())l.push({id:`${c.id}-edge`,start:c.id,end:c.target,source:c.id,target:c.target,type:"edge",relationshipType:"note",sourceLabel:a(c.id),targetLabel:a(c.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:Je([]),animate:!1,look:t.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let c of o){if(c.wrappingWidth??=n.wrappingWidth,!c.isGroup&&!c.shape.startsWith("usecaseActor"))c.minWidth??=n.minNodeWidth;if(c.shape==="usecaseEllipse"||c.shape==="usecaseBusiness")c.spreadPorts=!0}return{nodes:o,edges:l,config:t,type:"usecase",layoutAlgorithm:"dagre",direction:Yi(),nodeSpacing:n.nodeSpacing,rankSpacing:n.rankSpacing,actorFontSize:n.actorFontSize,actorFontFamily:n.actorFontFamily,actorFontWeight:n.actorFontWeight,usecaseFontSize:n.usecaseFontSize,usecaseFontFamily:n.usecaseFontFamily,usecaseFontWeight:n.usecaseFontWeight,diagramPadding:n.diagramPadding,useMaxWidth:n.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),Ns={getConfig:Va,createModel:Tn,commit:Ha,getAST:za,clear:Xa,setDiagramTitle:I,getDiagramTitle:L,setAccTitle:S,getAccTitle:E,setAccDescription:T,getAccDescription:A,getActors:Ya,getActor:qa,getUseCases:Ja,getUseCase:Za,getSystemBoundaries:Qa,getSystemBoundary:eo,getRelationships:to,getNotes:so,getNote:no,getJsonNodes:io,getJsonNode:ro,getClassDefs:ao,getClassDef:oo,getDirection:Yi,getData:Eo};function Qe(t,n,i){let a=[i];return a.index=n,a.input=t,a}e(Qe,"customMatch");var To=e((t,n)=>{if(t[n]!=='"'||t[n+1]!=="`")return null;for(let i=n+2;i<t.length-1;i++)if(t[i]==="`"&&t[i+1]==='"')return Qe(t,n,t.slice(n,i+2));return null},"matchMarkdownString"),go=e((t,n)=>{if(t[n]!=="%"||t[n+1]!=="%")return null;for(let a=n-1;a>=0;a--){let o=t[a];if(o===`
111
- `||o==="\r")break;if(o!==" "&&o!=="\t")return null}let i=n+2;while(i<t.length&&t[i]!==`
112
- `&&t[i]!=="\r")i++;return Qe(t,n,t.slice(n,i))},"matchComment"),qi=e((t,n)=>{for(let i=n-1;i>=0;i--){let a=t[i];if(a===`
113
- `||a==="\r")return!0;if(a!==" "&&a!=="\t")return!1}return!0},"isIndentedLineStart"),Ji=e((t,n,i)=>{if(!qi(t,n))return null;let a=i.exec(t.slice(n));return a?Qe(t,n,a[0]):null},"matchAccessibilityLine"),Ao=e((t,n)=>{if(!qi(t,n))return null;let i=/^accDescr[\t ]*{/.exec(t.slice(n));if(!i)return null;let a=t.indexOf("}",n+i[0].length);return a===-1?null:Qe(t,n,t.slice(n,a+1))},"matchAccDescrBlock"),So=e((t,n)=>{if(t[n]!=="{")return null;let i=0,a=!1,o=!1;for(let l=n;l<t.length;l++){let h=t[l];if(a){if(o)o=!1;else if(h==="\\")o=!0;else if(h==='"')a=!1;continue}if(h==='"')a=!0;else if(h==="{")i++;else if(h==="}"&&--i===0)return Qe(t,n,t.slice(n,l+1))}return null},"matchJsonObject"),Ro=e((t,n)=>{let i=t.indexOf(">>",n);if(i===-1||/[\n\r]/.test(t.slice(n,i)))return null;let a=t.slice(n,i);return a.trim()?Qe(t,n,a):null},"matchStereotypeText"),oe=k({name:"LABEL_TEXT",pattern:z.NA}),dt=k({name:"WORD",pattern:z.NA,categories:oe}),gn=k({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:oe}),Y=k({name:"IDENTIFIER",pattern:/\w+/,longer_alt:gn,categories:dt}),yo=k({name:"HWS",pattern:/[\t ]+/,group:z.SKIPPED}),Be=k({name:"MARKDOWN_STRING",pattern:To,start_chars_hint:['"'],line_breaks:!0}),Oo=k({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),un=k({name:"COMMENT",pattern:go,start_chars_hint:["%"],line_breaks:!1}),Fe=k({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),Zi=k({name:"ACC_DESCR_BLOCK",pattern:Ao,start_chars_hint:["a"],line_breaks:!0}),Lo=/^accTitle[\t ]*:[^\n\r]*/,No=/^accDescr[\t ]*:[^\n\r]*/,Qi=k({name:"ACC_TITLE_LINE",pattern:e((t,n)=>Ji(t,n,Lo),"pattern"),start_chars_hint:["a"],line_breaks:!1}),er=k({name:"ACC_DESCR_LINE",pattern:e((t,n)=>Ji(t,n,No),"pattern"),start_chars_hint:["a"],line_breaks:!1}),tr=k({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),An=k({name:"JSON_OBJECT_LITERAL",pattern:So,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),sr=k({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),ee=e((t,n)=>k({name:t,pattern:n,longer_alt:Y,categories:dt}),"keyword"),nr=ee("USECASE",/usecase-beta/),dn=ee("ACTOR",/actor/),ir=ee("SYSTEM_BOUNDARY",/systemBoundary/),rr=ee("END",/end/),ar=ee("DIRECTION",/direction/),or=ee("TD",/TD/),lr=ee("TB",/TB/),cr=ee("BT",/BT/),hr=ee("LR",/LR/),ur=ee("RL",/RL/),dr=ee("NOTE",/note/),pr=ee("FOR",/for/),Io=ee("JSON",/json/),fr=ee("CLASS_DEF",/classDef/),mr=ee("CLASS",/class/),Er=ee("STYLE",/style/),Tr=ee("INCLUDE",/include/i),gr=ee("EXTEND",/extend/i),Ar=ee("TRUE",/true/),Sr=ee("FALSE",/false/),Rr=k({name:"GENERALIZATION",pattern:/--\|>/}),yr=k({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),Or=k({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),Sn=k({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),Rn=k({name:"STEREOTYPE_TEXT",pattern:Ro,line_breaks:!1}),Lr=k({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),Nr=k({name:"CLASS_SEPARATOR",pattern:/:::/}),As=k({name:"FORWARD_SOLID",pattern:/--+>/}),Ir=k({name:"BACKWARD_SOLID",pattern:/<--+/}),Ss=k({name:"FORWARD_CIRCLE",pattern:/--o/}),kr=k({name:"BACKWARD_CIRCLE",pattern:/o--/}),Rs=k({name:"FORWARD_CROSS",pattern:/--x/}),Cr=k({name:"BACKWARD_CROSS",pattern:/x--/}),Ie=k({name:"MARKERLESS_SOLID",pattern:/--+/}),pn=k({name:"METADATA_START",pattern:/@{/}),ys=k({name:"AT",pattern:/@/,categories:oe}),br=k({name:"LBRACE",pattern:/{/}),fn=k({name:"RBRACE",pattern:/}/}),Os=k({name:"LBRACKET",pattern:/\[/}),Ls=k({name:"RBRACKET",pattern:/]/}),Ft=k({name:"LPAREN",pattern:/\(/}),Bt=k({name:"RPAREN",pattern:/\)/}),be=k({name:"COMMA",pattern:/,/,categories:oe}),$t=k({name:"COLON",pattern:/:/,categories:oe}),_r=k({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:oe}),ke=k({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),mn=k({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:oe}),xr=k({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:oe}),vr=k({name:"DASH",pattern:/-/,categories:oe}),Mr=k({name:"DOT",pattern:/\./,categories:oe}),wr=k({name:"PERCENT",pattern:/%/,categories:oe}),Ur=k({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:oe}),ko=k({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:oe}),Co=k({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:oe}),Pr=[oe,dt,yo,Be,Oo,un,Fe,Zi,Qi,er,tr,nr,dn,ir,rr,ar,or,lr,cr,hr,ur,dr,pr,Io,fr,mr,Er,Tr,gr,Ar,Sr,Rr,yr,Or,Nr,As,Ir,Ss,kr,Rs,Cr,Ie,pn,ys,br,fn,Os,Ls,Ft,Bt,be,$t,_r,ke,mn,Y,gn,xr,vr,Mr,wr,Ur,ko,Co],bo={defaultMode:"defaultMode",modes:{defaultMode:[...Pr],jsonBody:[An,sr],stereotype:[Sn,Rn,Lr]}},_o=[...Pr,An,sr,Sn,Rn,Lr],xo=new z(bo),Gi=e((t)=>kt(t,oe)||t.tokenType===ke||t.tokenType===Be,"isLabelToken"),vo={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},Mo=class extends gs{static{e(this,"UsecaseParser")}constructor(){super(_o,{nodeLocationTracking:"full"});this.RULE("start",()=>{this.CONSUME(nr),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:e(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:e(()=>this.isStatementStart(),"GATE"),ALT:e(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:e(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:e(()=>this.isMetadataAssignment(),"GATE"),ALT:e(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:e(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:e(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:e(()=>this.CONSUME(Fe),"ALT")},{ALT:e(()=>this.CONSUME(Re),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(Fe)}),this.RULE("commentLine",()=>{this.CONSUME(un),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(Qi),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:e(()=>this.CONSUME(er),"ALT")},{ALT:e(()=>this.CONSUME(Zi),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(dn),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:e(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(be),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:e(()=>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:e(()=>{this.CONSUME(Y),this.OPTION(()=>{this.CONSUME(Ft),this.SUBRULE(this.nodeLabel),this.CONSUME(Bt)})},"ALT")},{ALT:e(()=>this.CONSUME(ke),"ALT")},{ALT:e(()=>this.CONSUME(Be),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(dn),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(be),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:e(()=>{this.CONSUME(Y),this.OPTION(()=>{this.OR2([{ALT:e(()=>{this.CONSUME(Ft),this.SUBRULE(this.nodeLabel),this.CONSUME(Bt)},"ALT")},{ALT:e(()=>{this.CONSUME(Os),this.SUBRULE2(this.nodeLabel),this.CONSUME(Ls)},"ALT")}])})},"ALT")},{ALT:e(()=>this.CONSUME(ke),"ALT")},{ALT:e(()=>this.CONSUME(Be),"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:e(()=>this.CONSUME(ke),"ALT")},{ALT:e(()=>this.CONSUME(Be),"ALT")},{ALT:e(()=>this.AT_LEAST_ONE(()=>this.CONSUME(oe)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:e(()=>this.LA(1).tokenType===Y&&this.LA(2).tokenType===ys,"GATE"),DEF:e(()=>{this.CONSUME(Y),this.CONSUME(ys)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:e(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:e(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:e(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:e(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:e(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:e(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:e(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(As)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(Ir),this.OPTION({GATE:e(()=>this.LA(0).image==="<--"&&this.hasLabeledRight([Ie]),"GATE"),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ie)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(Ie),this.OPTION({GATE:e(()=>this.LA(0).image==="--"&&this.hasLabeledRight([As,Ie,Ss,Rs]),"GATE"),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:e(()=>this.CONSUME(As),"ALT")},{ALT:e(()=>this.CONSUME2(Ie),"ALT")},{ALT:e(()=>this.CONSUME(Ss),"ALT")},{ALT:e(()=>this.CONSUME(Rs),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(Ss)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(kr),this.OPTION({GATE:e(()=>this.hasLabeledRight([Ie]),"GATE"),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ie)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(Rs)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(Cr),this.OPTION({GATE:e(()=>this.hasLabeledRight([Ie]),"GATE"),DEF:e(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(Ie)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:e(()=>this.CONSUME(ke),"ALT")},{ALT:e(()=>this.CONSUME(Be),"ALT")},{ALT:e(()=>this.AT_LEAST_ONE(()=>this.CONSUME(oe)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:e(()=>{this.CONSUME(yr),this.CONSUME($t),this.OR2([{ALT:e(()=>this.CONSUME(Tr),"ALT")},{ALT:e(()=>this.CONSUME(gr),"ALT")}])},"ALT")},{ALT:e(()=>this.CONSUME(Rr),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(pn),this.MANY(()=>this.CONSUME(Fe)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(be)),this.MANY3(()=>this.CONSUME2(Fe))}),this.CONSUME(fn)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:e(()=>this.CONSUME(Y),"ALT")},{ALT:e(()=>this.CONSUME(ke),"ALT")}]),this.CONSUME($t),this.OR2([{ALT:e(()=>this.CONSUME2(Y),"ALT")},{ALT:e(()=>this.CONSUME2(ke),"ALT")},{ALT:e(()=>this.CONSUME(Ar),"ALT")},{ALT:e(()=>this.CONSUME(Sr),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:e(()=>{this.CONSUME(be),this.MANY(()=>this.CONSUME(Fe))},"ALT")},{ALT:e(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(Fe)),this.OPTION(()=>this.CONSUME2(be)),this.MANY2(()=>this.CONSUME3(Fe))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(ir),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(rr),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:e(()=>{this.CONSUME(Y),this.OPTION(()=>{this.OR2([{ALT:e(()=>{this.CONSUME(Ft),this.SUBRULE(this.nodeLabel),this.CONSUME(Bt)},"ALT")},{ALT:e(()=>{this.CONSUME(Os),this.SUBRULE2(this.nodeLabel),this.CONSUME(Ls)},"ALT")}])})},"ALT")},{ALT:e(()=>this.CONSUME(ke),"ALT")},{ALT:e(()=>this.CONSUME(Be),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:e(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:e(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:e(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:e(()=>{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:e(()=>this.CONSUME(Y),"ALT")},{ALT:e(()=>this.CONSUME(ke),"ALT")},{ALT:e(()=>this.CONSUME(Be),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(dr),this.CONSUME(pr),this.CONSUME(Y),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(Or),this.CONSUME(Rn),this.CONSUME(Sn)}),this.RULE("classSuffix",()=>{this.CONSUME(Nr),this.CONSUME(Y),this.MANY(()=>{this.CONSUME(be),this.CONSUME2(Y)})}),this.RULE("jsonStatement",()=>{this.CONSUME(tr),this.CONSUME(An),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(ar),this.OR([{ALT:e(()=>this.CONSUME(or),"ALT")},{ALT:e(()=>this.CONSUME(lr),"ALT")},{ALT:e(()=>this.CONSUME(cr),"ALT")},{ALT:e(()=>this.CONSUME(hr),"ALT")},{ALT:e(()=>this.CONSUME(ur),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(fr),this.CONSUME(Y),this.MANY(()=>{this.CONSUME(be),this.CONSUME2(Y)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(mr),this.CONSUME(Y),this.MANY(()=>{this.CONSUME(be),this.CONSUME2(Y)}),this.CONSUME3(Y),this.MANY2(()=>{this.CONSUME2(be),this.CONSUME4(Y)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(Er),this.CONSUME(Y),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(be),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:e(()=>this.CONSUME(dt),"ALT")},{ALT:e(()=>this.CONSUME(mn),"ALT")},{ALT:e(()=>{this.CONSUME(Ie),this.CONSUME2(dt)},"ALT")}]),this.CONSUME($t),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:e(()=>this.CONSUME(dt),"ALT")},{ALT:e(()=>this.CONSUME(ke),"ALT")},{ALT:e(()=>this.CONSUME(gn),"ALT")},{ALT:e(()=>this.CONSUME(_r),"ALT")},{ALT:e(()=>this.CONSUME(mn),"ALT")},{ALT:e(()=>this.CONSUME(xr),"ALT")},{ALT:e(()=>this.CONSUME(vr),"ALT")},{ALT:e(()=>this.CONSUME(Mr),"ALT")},{ALT:e(()=>this.CONSUME(wr),"ALT")},{ALT:e(()=>this.CONSUME(Ur),"ALT")},{ALT:e(()=>this.CONSUME($t),"ALT")},{ALT:e(()=>this.CONSUME(Ft),"ALT")},{ALT:e(()=>this.CONSUME(Bt),"ALT")},{ALT:e(()=>this.CONSUME(Os),"ALT")},{ALT:e(()=>this.CONSUME(Ls),"ALT")},{ALT:e(()=>this.CONSUME(br),"ALT")},{ALT:e(()=>this.CONSUME(fn),"ALT")},{ALT:e(()=>this.CONSUME(ys),"ALT")},{ALT:e(()=>this.CONSUME(Ie),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let t=this.LA(1).tokenType;return(t===Y||t===ke||t===Be)&&this.LA(2).tokenType===pn}isStatementStart(){let t=this.LA(1).tokenType;return t!==Re&&t!==Fe&&t!==un}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===Y&&vo[this.LA(1).image.toLowerCase()]===!0}hasLabeledRight(t){if(!Gi(this.LA(1)))return!1;for(let n=2;;n++){let i=this.LA(n);if(t.includes(i.tokenType))return!0;if(!Gi(i))return!1}}},Gt=new Mo,Wi=class extends Error{constructor(t,n,i){super(`${t} (line ${n}, column ${i})`);this.line=n,this.column=i,this.name="UsecaseJsonError"}static{e(this,"UsecaseJsonError")}},En=e((t,n,i,a)=>{let o=i,l=a,h=Math.min(Math.max(n,0),t.length);for(let u=0;u<h;u++){let c=t[u];if(c==="\r")o++,l=1;else if(c===`
114
- `){if(u===0||t[u-1]!=="\r")o++,l=1}else l++}return{line:o,column:l}},"locationAtOffset"),wo=e((t,n,i,a)=>{let o=/\bposition (\d+)\b/u.exec(t);if(o)return En(n,Number.parseInt(o[1],10),i,a);let l=/\bline (\d+) column (\d+)\b/u.exec(t);if(l){let h=Number.parseInt(l[1],10),u=Number.parseInt(l[2],10);return{line:i+h-1,column:h===1?a+u-1:u}}if(/unexpected end|end of json input/iu.test(t))return En(n,n.length,i,a);return},"locationFromErrorMessage"),ue=class extends Error{constructor(t){super("Invalid JSON token");this.offset=t}static{e(this,"JsonWalkError")}},ji=class{constructor(t){this.text=t,this.offset=0,this.propertyOrder={}}static{e(this,"PropertyOrderCollector")}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new ue(this.offset);return this.propertyOrder}collectValue(t){this.skipWhitespace();let n=this.text[this.offset];if(n==="{")this.collectObject(t);else if(n==="[")this.collectArray(t);else if(n==='"')this.readString(!1);else if(n==="t")this.consumeLiteral("true");else if(n==="f")this.consumeLiteral("false");else if(n==="n")this.consumeLiteral("null");else if(n==="-"||n>="0"&&n<="9")this.consumeNumber();else throw new ue(this.offset)}collectObject(t){this.offset++;let n=[],i=new Set;if(this.propertyOrder[t]=n,this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}while(this.offset<this.text.length){if(this.text[this.offset]!=='"')throw new ue(this.offset);let a=this.readString(!0),o=`${t}/${a.replaceAll("~","~0").replaceAll("/","~1")}`;if(i.has(a))this.deletePointerSubtree(o);else i.add(a),n.push(a);if(this.skipWhitespace(),this.text[this.offset]!==":")throw new ue(this.offset);if(this.offset++,this.collectValue(o),this.skipWhitespace(),this.text[this.offset]==="}"){this.offset++;return}if(this.text[this.offset]!==",")throw new ue(this.offset);this.offset++,this.skipWhitespace()}throw new ue(this.offset)}collectArray(t){if(this.offset++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}let n=0;while(this.offset<this.text.length){if(this.collectValue(`${t}/${n}`),n++,this.skipWhitespace(),this.text[this.offset]==="]"){this.offset++;return}if(this.text[this.offset]!==",")throw new ue(this.offset);this.offset++,this.skipWhitespace()}throw new ue(this.offset)}readString(t){this.offset++;let n="";while(this.offset<this.text.length){let i=this.offset,a=this.text[this.offset++];if(a==='"')return n;if(a.charCodeAt(0)<32)throw new ue(i);if(a!=="\\"){if(t)n+=a;continue}let o=this.offset,l=this.text[this.offset++];switch(l){case'"':case"\\":case"/":if(t)n+=l;break;case"b":if(t)n+="\b";break;case"f":if(t)n+="\f";break;case"n":if(t)n+=`
115
- `;break;case"r":if(t)n+="\r";break;case"t":if(t)n+="\t";break;case"u":{let h=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(h))throw new ue(this.offset);if(t)n+=String.fromCharCode(Number.parseInt(h,16));this.offset+=4;break}default:throw new ue(o)}}throw new ue(this.offset)}consumeLiteral(t){let n=0;for(let i of t){if(this.text[this.offset+n]!==i)throw new ue(this.offset+n);n++}this.offset+=t.length}consumeNumber(){if(this.text[this.offset]==="-")this.offset++;if(this.text[this.offset]==="0")this.offset++;else if(this.text[this.offset]>="1"&&this.text[this.offset]<="9")while(this.text[this.offset]>="0"&&this.text[this.offset]<="9")this.offset++;else throw new ue(this.offset);if(this.text[this.offset]==="."){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new ue(this.offset);while(this.text[this.offset]>="0"&&this.text[this.offset]<="9")this.offset++}if(this.text[this.offset]==="e"||this.text[this.offset]==="E"){if(this.offset++,this.text[this.offset]==="+"||this.text[this.offset]==="-")this.offset++;if(this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new ue(this.offset);while(this.text[this.offset]>="0"&&this.text[this.offset]<="9")this.offset++}}skipWhitespace(){while(this.offset<this.text.length){let t=this.text[this.offset];if(t!==" "&&t!=="\t"&&t!==`
116
- `&&t!=="\r")return;this.offset++}}deletePointerSubtree(t){let n=`${t}/`;for(let i of Object.keys(this.propertyOrder))if(i===t||i.startsWith(n))delete this.propertyOrder[i]}};function Dr(t,n,i){let a;try{a=JSON.parse(t)}catch(o){let l=o instanceof Error?o.message:String(o),h=wo(l,t,n,i);if(!h){let u=0;try{new ji(t).collect()}catch(c){if(c instanceof ue)u=c.offset}h=En(t,u,n,i)}throw new Wi(`Invalid JSON: ${l}`,h.line,h.column)}if(typeof a!=="object"||a===null||Array.isArray(a))throw new Wi("JSON value must have an object root",n,i);return{value:a,propertyOrder:new ji(t).collect()}}e(Dr,"parseOrderedJsonObject");var Uo=e((t)=>({shape:t.type==="normal"?"actor":t.type==="hollow"?"actor-hollow":t.type==="awesome"?"actor-awesome":"actor-icon",...t.label===t.id?{}:{label:t.label},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"actor",actorType:t.type,business:t.business,labelType:t.labelType,...t.icon?{icon:t.icon}:{},...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{}}}),"actorNode"),Po=e((t)=>({shape:t.shape,...t.label===t.id?{}:{label:t.label},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"usecase",useCaseShape:t.shape,business:t.business,labelType:t.labelType,...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{}}}),"useCaseNode"),Do=e((t)=>({label:t.label,shape:"note",attrs:{kind:"note",target:t.target,labelType:t.labelType}}),"noteNode"),Fo=e((t)=>({label:t.id,shape:"json-table",...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"json",value:t.value,propertyOrder:t.propertyOrder,labelType:"text"}}),"jsonNode"),Bo=e((t)=>({id:t.id,source:t.source,target:t.target,...t.label?{label:t.label}:{},...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{relationshipType:t.type,arrowType:t.arrowType,minlen:t.minlen,explicitId:t.explicitId,animate:t.animate,...t.animation?{animation:t.animation}:{},...t.labelType?{labelType:t.labelType}:{}}}),"relationshipEdge"),$o=e((t)=>({id:`${t.id}-edge`,source:t.id,target:t.target,attrs:{relationshipType:"note",arrowType:X.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),Go=e((t,n,i,a)=>{let o={};for(let c of t.getActors().values())o[c.id]=Uo(c);for(let c of t.getUseCases().values())o[c.id]=Po(c);for(let c of t.getNotes().values())o[c.id]=Do(c);for(let c of t.getJsonNodes().values())o[c.id]=Fo(c);let l={};for(let c of t.getSystemBoundaries().values())l[c.id]={...c.label===c.id?{}:{title:c.label},nodes:[...c.members],...c.classes.length?{classes:[...c.classes]}:{},...c.styles.length?{styles:[...c.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:c.type,labelType:c.labelType}};let h={};for(let c of t.getClassDefs().values())h[c.id]={styles:[...c.styles]};let u=t.getDirection();return{version:1,diagramType:"usecase",source:n,header:{keyword:"usecase",direction:u==="TD"?"TB":u,span:i},...t.getAccTitle()?{accTitle:t.getAccTitle()}:{},...t.getAccDescription()?{accDescr:t.getAccDescription()}:{},nodes:o,edges:[...t.getRelationships().map(Bo),...[...t.getNotes().values()].map($o)],groups:l,classDefs:h,statements:a}},"buildUsecaseGraphAST"),pe=e((t)=>`line ${t.line}, column ${t.column} [${t.span[0]},${t.span[1]})`,"locationText"),Ki=e((t)=>t===void 0?"":` (label "${t}")`,"labelSuffix"),Ze=e((t)=>t.generated?t.label:void 0,"generatedFrom"),hn=e((t,n)=>{for(let i of n)if(!t.includes(i))t.push(i)},"pushUnique"),Wo=class{constructor(t){this.db=t,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=t.createModel()}static{e(this,"UsecaseModelBuilder")}reset(t){this.model=this.db.createModel(),this.source=t,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(t){this.elements.push(t)}addBoundary(t){this.boundaries.push(t)}addJson(t){this.jsonDrafts.push(t)}addRelationship(t){this.relationshipDrafts.push(t)}addNote(t){this.noteDrafts.push(t)}addMetadataAssignment(t,n,i,a){this.metadataAssignments.push({target:t,targetLocation:n,metadata:i,statement:a})}addClassDef(t,n){this.classDefinitions.push({ids:t,styles:n})}addClassAssignment(t,n){this.classAssignments.push({targets:t,classes:n})}addStyleAssignment(t,n,i){this.styleAssignments.push({target:t,location:n,styles:i})}setDirection(t){this.directions.push(t==="TD"?"TB":t)}setAccTitle(t){this.model.accTitle=t}setAccDescription(t){this.model.accDescription=t}setStatements(t){this.statements=t}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(t){let n=new Map,i=new Map,a=new Map,o=new Map;for(let c of this.relationshipDrafts)this.recordFirst(o,c.source.id,c.source.location.span[0]),this.recordFirst(o,c.target.id,c.target.location.span[0]);for(let c of this.elements)this.recordFirst(o,c.id,c.location.span[0]);for(let c of this.boundaries)this.recordFirst(o,c.id,c.location.span[0]);for(let c of this.jsonDrafts)this.recordFirst(o,c.id,c.location.span[0]);let l=[...this.elements.map((c)=>({offset:c.location.span[0],type:"element",value:c})),...this.boundaries.map((c)=>({offset:c.location.span[0],type:"boundary",value:c})),...this.jsonDrafts.map((c)=>({offset:c.location.span[0],type:"json",value:c})),...this.relationshipDrafts.filter((c)=>c.explicitId).map((c)=>({offset:c.explicitIdLocation.span[0],type:"edge",value:c}))].sort((c,d)=>c.offset-d.offset);for(let c of l)if(c.type==="element")this.collectElement(c.value,n,i);else if(c.type==="boundary")this.collectBoundary(c.value,n,a);else if(c.type==="json")this.registerUnique(n,c.value.id,"json",c.value.location,!1);else this.registerUnique(n,c.value.explicitId,"edge",c.value.explicitIdLocation,!1);this.materializeElements(i,o),this.materializeBoundaries(a,o),this.materializeJson(o);let h=this.materializeRelationships(n,i,o);this.reorderElements(i,o),this.applyMetadataAssignments(n,i,a,h),this.validateAndRefreshElements(i),this.refreshBoundaries(a,i),this.materializeNotes(n),this.applyClassDefinitions(),this.applyClassesAndStyles(n,h),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...n].map(([c,d])=>[c,d.kind]));let u=Go(this,this.source,t,this.statements);return this.model.ast=u,this.db.commit(this.model),u}collectElement(t,n,i){let a=n.get(t.id),o=Ze({generated:t.generated,label:t.label.text});if(a&&a.kind!==t.kind)this.conflict(`ID '${t.id}' is declared as both ${a.kind} and ${t.kind}`,t.location,a.location,o,Ze(a));if(a&&(a.generated||t.generated))this.conflict(`Generated ID '${t.id}' collides with another declaration`,t.location,a.location,o,Ze(a));let l=i.get(t.id);if(!l){let h={kind:t.kind,id:t.id,label:t.label,location:t.location,generated:t.generated,classes:[...t.classes],...t.parentId?{parentId:t.parentId,parentLocation:t.parentLocation}:{},...t.shape?{shape:t.shape}:{},...t.stereotype?{stereotype:t.stereotype,stereotypeLocation:t.location}:{}};this.applyDeclarationMetadata(h,t.metadata),i.set(t.id,h),n.set(t.id,{kind:t.kind,location:t.location,generated:t.generated,label:t.label.text});return}if(l.label.text!==t.label.text||l.label.type!==t.label.type)this.conflict(`ID '${t.id}' has conflicting labels`,t.location,l.location);if(t.shape&&l.shape&&t.shape!==l.shape)this.conflict(`Use case '${t.id}' has conflicting shapes`,t.location,l.location);if(t.parentId&&l.parentId&&t.parentId!==l.parentId)this.conflict(`Element '${t.id}' belongs to more than one system boundary`,t.parentLocation??t.location,l.parentLocation??l.location);if(t.stereotype&&l.stereotype&&t.stereotype!==l.stereotype)this.conflict(`Element '${t.id}' has conflicting stereotypes`,t.location,l.stereotypeLocation??l.location);l.shape??=t.shape,l.parentId??=t.parentId,l.parentLocation??=t.parentLocation,l.stereotype??=t.stereotype,l.stereotypeLocation??=t.stereotype?t.location:void 0,hn(l.classes,t.classes),this.applyDeclarationMetadata(l,t.metadata)}collectBoundary(t,n,i){let a=n.get(t.id),o=Ze({generated:t.generated,label:t.label.text});if(a&&a.kind!=="boundary")this.conflict(`ID '${t.id}' is declared as both ${a.kind} and boundary`,t.location,a.location,o,Ze(a));if(a&&(a.generated||t.generated))this.conflict(`Generated ID '${t.id}' collides with another declaration`,t.location,a.location,o,Ze(a));let l=i.get(t.id);if(l){if(l.label.text!==t.label.text||l.label.type!==t.label.type)this.conflict(`Boundary '${t.id}' has conflicting titles`,t.location,l.location);hn(l.classes,t.classes);return}i.set(t.id,{id:t.id,label:t.label,location:t.location,generated:t.generated,classes:[...t.classes],styles:[],members:[]}),n.set(t.id,{kind:"boundary",location:t.location,generated:t.generated,label:t.label.text})}materializeElements(t,n){for(let i of[...t.values()].sort((a,o)=>(n.get(a.id)??0)-(n.get(o.id)??0)))this.setElementModel(i)}materializeBoundaries(t,n){for(let i of[...t.values()].sort((a,o)=>(n.get(a.id)??0)-(n.get(o.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(t){for(let n of[...this.jsonDrafts].sort((i,a)=>(t.get(i.id)??0)-(t.get(a.id)??0)))this.model.jsonNodes.set(n.id,{id:n.id,value:n.value,propertyOrder:n.propertyOrder,classes:[...n.classes],styles:[]})}materializeRelationships(t,n,i){let a=new Map,o=0;for(let l of this.relationshipDrafts){let h=this.resolveEndpoint(l.source,t,n,i),u=this.resolveEndpoint(l.target,t,n,i);this.validateRelationship(l,h,u,t);let c=l.explicitId??`edge-${o++}`,d={id:c,explicitId:Boolean(l.explicitId),source:l.source.id,target:l.target.id,type:l.type,arrowType:l.arrowType,...l.label?{label:l.label.text,labelType:l.label.type}:{},minlen:l.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(d),a.set(c,{draft:l,relationship:d})}return this.model.relationshipCounter=o,a}resolveEndpoint(t,n,i,a){if(t.classesOnReference&&!t.declaration)throw Error(`Relationship endpoint '${t.id}' uses ::: without declaring the node at ${pe(t.location)}`);let o=n.get(t.id);if(o)return o.kind;return i.set(t.id,{kind:"usecase",id:t.id,label:t.label,location:t.location,generated:t.generated,shape:"ellipse",classes:[]}),n.set(t.id,{kind:"usecase",location:t.location,generated:t.generated,label:t.label.text}),this.recordFirst(a,t.id,t.location.span[0]),"usecase"}reorderElements(t,n){let i=new Map(this.model.actors),a=new Map(this.model.useCases);this.model.actors.clear(),this.model.useCases.clear();for(let o of[...t.values()].sort((l,h)=>(n.get(l.id)??0)-(n.get(h.id)??0))){if(!i.has(o.id)&&!a.has(o.id))this.setElementModel(o);let l=i.get(o.id)??this.model.actors.get(o.id),h=a.get(o.id)??this.model.useCases.get(o.id);if(l)this.model.actors.set(o.id,l);else if(h)this.model.useCases.set(o.id,h)}}applyMetadataAssignments(t,n,i,a){for(let o of this.metadataAssignments){let l=t.get(o.target);if(!l){let h=this.inferMetadataKind(o.metadata);throw Error(`Metadata target '${o.target}' is unresolved${h?` (metadata implies ${h})`:""} at ${pe(o.targetLocation)}`)}if(l.kind==="actor"||l.kind==="usecase")this.applyStandaloneElementMetadata(n.get(o.target),o.metadata);else if(l.kind==="boundary"){let h=i.get(o.target);for(let u of o.metadata.properties){if(u.key!=="type"||u.value!=="rect"&&u.value!=="package")this.invalidMetadata(o.target,l.kind,u);h.type=u.value}}else if(l.kind==="edge"){let h=a.get(o.target);if(!h)throw Error(`Metadata target '${o.target}' is not an explicit edge at ${pe(o.targetLocation)}`);o.statement.kind="edgeMetadata",o.statement.edges=[{id:o.target,span:o.statement.span,idSpan:o.targetLocation.span,...o.statement.metadata?{metadata:o.statement.metadata}:{}}],delete o.statement.nodes;for(let u of o.metadata.properties)if(u.key==="animate"&&typeof u.value==="boolean")h.relationship.animate=u.value;else if(u.key==="animation"&&(u.value==="fast"||u.value==="slow"))h.relationship.animation=u.value,h.relationship.animate=!0;else this.invalidMetadata(o.target,l.kind,u)}else for(let h of o.metadata.properties)this.invalidMetadata(o.target,l.kind,h)}for(let{relationship:o}of a.values())if(o.animation)o.animate=!0}applyStandaloneElementMetadata(t,n){for(let i of n.properties)if(t.kind==="actor")this.applyActorProperty(t,i,!0);else if(i.key==="business"&&typeof i.value==="boolean")t.business=i.value;else this.invalidMetadata(t.id,t.kind,i)}applyDeclarationMetadata(t,n){if(!n)return;for(let i of n.properties)if(t.kind==="actor")this.applyActorProperty(t,i,!1);else if(i.key==="business"&&typeof i.value==="boolean"){if(t.business!==void 0&&t.business!==i.value)this.conflict(`Use case '${t.id}' has conflicting business metadata`,i.location,t.location);t.business=i.value}else this.invalidMetadata(t.id,t.kind,i)}applyActorProperty(t,n,i){if(n.key==="type"&&(n.value==="normal"||n.value==="hollow"||n.value==="awesome")){if(!i&&t.actorType!==void 0&&t.actorType!==n.value)this.conflict(`Actor '${t.id}' has conflicting type metadata`,n.location,t.location);t.actorType=n.value}else if(n.key==="icon"&&typeof n.value==="string"){if(!i&&t.icon!==void 0&&t.icon!==n.value)this.conflict(`Actor '${t.id}' has conflicting icon metadata`,n.location,t.location);t.icon=n.value}else if(n.key==="business"&&typeof n.value==="boolean"){if(!i&&t.business!==void 0&&t.business!==n.value)this.conflict(`Actor '${t.id}' has conflicting business metadata`,n.location,t.location);t.business=n.value}else this.invalidMetadata(t.id,t.kind,n)}validateAndRefreshElements(t){for(let n of t.values()){let i=n.icon?"icon":n.actorType??"normal";if(n.kind==="actor"){if(n.icon&&n.actorType&&n.actorType!=="normal")throw Error(`Actor '${n.id}' cannot combine icon with type '${n.actorType}' at ${pe(n.location)}`);if(n.business&&(i==="icon"||i==="awesome"))throw Error(`Business actor '${n.id}' must use normal or hollow geometry at ${pe(n.location)}`)}else if((n.shape??"ellipse")==="rect"&&n.business)throw Error(`Rectangular use case '${n.id}' cannot be a business use case at ${pe(n.location)}`);this.setElementModel(n)}}refreshBoundaries(t,n){for(let i of t.values())i.members.length=0;for(let i of[...this.elements].sort((a,o)=>a.location.span[0]-o.location.span[0])){if(!i.parentId)continue;let a=t.get(i.parentId);if(!a)throw Error(`Parent boundary '${i.parentId}' for '${i.id}' is unresolved at ${pe(i.parentLocation??i.location)}`);if(!a.members.includes(i.id))a.members.push(i.id)}for(let i of n.values())if(i.parentId&&!t.has(i.parentId))throw Error(`Parent boundary '${i.parentId}' for '${i.id}' is unresolved at ${pe(i.parentLocation??i.location)}`);for(let i of t.values()){let a=this.model.systemBoundaries.get(i.id);a.type=i.type??"rect",a.members=[...i.members],a.classes=[...i.classes],a.styles=[...i.styles]}}materializeNotes(t){let n=0;for(let i of this.noteDrafts){let a=t.get(i.target);if(!a)throw Error(`Note target '${i.target}' is unresolved at ${pe(i.targetLocation)}`);if(a.kind!=="actor"&&a.kind!=="usecase")this.conflict(`Note target '${i.target}' must be an actor or use case, not ${a.kind}`,i.targetLocation,a.location);let o=`note-${n++}`;this.model.notes.set(o,{id:o,target:i.target,label:i.label.text,labelType:i.label.type})}this.model.noteCounter=n}applyClassDefinitions(){for(let t of this.classDefinitions)for(let n of t.ids)this.model.classDefs.set(n,{id:n,styles:[...t.styles]})}applyClassesAndStyles(t,n){for(let i of this.classAssignments)for(let a of i.targets)hn(this.getStylable(a.id,t,n,a.location).classes,i.classes);for(let i of this.styleAssignments)this.getStylable(i.target,t,n,i.location).styles.push(...i.styles)}getStylable(t,n,i,a){let o=n.get(t)?.kind,l=o==="actor"?this.model.actors.get(t):o==="usecase"?this.model.useCases.get(t):o==="boundary"?this.model.systemBoundaries.get(t):o==="json"?this.model.jsonNodes.get(t):o==="edge"?i.get(t)?.relationship:void 0;if(!l)throw Error(`Class/style target '${t}' is unresolved or anonymous at ${pe(a)}`);return l}validateRelationship(t,n,i,a){let o=e((l)=>l==="actor"||l==="usecase"||l==="json","allowed");if(!o(n))this.conflict(`Relationship source '${t.source.id}' cannot be ${n}`,t.source.location,a.get(t.source.id).location);if(!o(i))this.conflict(`Relationship target '${t.target.id}' cannot be ${i}`,t.target.location,a.get(t.target.id).location);if((t.type==="include"||t.type==="extend")&&(n!=="usecase"||i!=="usecase"))throw Error(`${t.type} relationship requires use-case endpoints at ${pe(t.location)}`);if(t.type==="generalization"&&(n!=="actor"&&n!=="usecase"||n!==i))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${pe(t.location)}`);if(t.type==="association"&&(n==="json"||i==="json")&&![0,1,2].includes(t.arrowType))throw Error(`JSON relationship '${t.source.id}' to '${t.target.id}' permits only point, reversed-point, or markerless solid association at ${pe(t.location)}`)}setElementModel(t){if(t.kind==="actor"){let n=t.icon?"icon":t.actorType??"normal";this.model.useCases.delete(t.id),this.model.actors.set(t.id,{id:t.id,label:t.label.text,labelType:t.label.type,type:n,...t.icon?{icon:t.icon}:{},business:t.business??!1,...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{},classes:[...t.classes],styles:this.model.actors.get(t.id)?.styles??[]})}else this.model.actors.delete(t.id),this.model.useCases.set(t.id,{id:t.id,label:t.label.text,labelType:t.label.type,shape:t.shape??"ellipse",business:t.business??!1,...t.stereotype?{stereotype:t.stereotype}:{},...t.parentId?{parentId:t.parentId}:{},classes:[...t.classes],styles:this.model.useCases.get(t.id)?.styles??[]})}inferMetadataKind(t){let n=new Set(["actor","usecase","boundary","edge"]);for(let i of t.properties)if(i.key==="icon")n.clear(),n.add("actor");else if(i.key==="animate"||i.key==="animation")n.clear(),n.add("edge");else if(i.key==="type"){if(n.clear(),i.value==="rect"||i.value==="package")n.add("boundary");else if(i.value==="normal"||i.value==="hollow"||i.value==="awesome")n.add("actor")}else if(i.key==="business")n.delete("boundary"),n.delete("edge");else return;return n.size===1?[...n][0]:void 0}invalidMetadata(t,n,i){throw Error(`Metadata property '${i.key}' is invalid for ${n} '${t}' at ${pe(i.location)}`)}registerUnique(t,n,i,a,o){let l=t.get(n);if(l)this.conflict(`ID '${n}' is declared more than once (${l.kind} and ${i})`,a,l.location,void 0,Ze(l));t.set(n,{kind:i,location:a,generated:o})}recordFirst(t,n,i){let a=t.get(n);if(a===void 0||i<a)t.set(n,i)}conflict(t,n,i,a,o){throw Error(`${t} at ${pe(n)}${Ki(a)}; previous declaration at ${pe(i)}${Ki(o)}`)}},jo=Gt.getBaseCstVisitorConstructor(),Ko=class extends jo{constructor(){super();this.builder=new Wo(Ns),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{e(this,"UsecaseVisitor")}build(t,n){this.source=n,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(n),this.visit(t)}start(t){let n=this.tokens(t,"USECASE")[0],i=[];for(let a of this.nodes(t,"line"))i.push(this.visit(a));this.builder.setStatements(i),this.builder.finalize(this.tokenSpan(n))}line(t){let n=this.firstNode(t,"blankLine","commentLine","statement");return this.wrap(n,this.visit(n))}statement(t){return this.visit(this.firstNode(t,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(t){return}blankLine(t){return{kind:"blank",span:this.tokenSpan(this.tokens(t,"NEWLINE")[0])}}commentLine(t){return{kind:"comment",span:this.tokenSpan(this.tokens(t,"COMMENT")[0])}}accTitleStatement(t){let n=this.tokens(t,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(n.slice(n.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(t){let n=this.tokens(t,"ACC_DESCR_LINE")[0],i=this.tokens(t,"ACC_DESCR_BLOCK")[0],a=n?n.image.slice(n.image.indexOf(":")+1).trim():i.image.slice(i.image.indexOf("{")+1,i.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(a),{kind:"accDescr",span:[0,0]}}actorStatement(t){let n=this.nodes(t,"actorItem"),i=n.map((c)=>this.visit(c)),a=this.nodes(t,"relationTail")[0],o=i.map((c,d)=>this.actorOccurrence(n[d],c,!0));for(let c of i)this.builder.addElement(this.actorDraft(c));if(!a)return{kind:"node",span:[0,0],nodes:o};let l=this.visit(a);if(l.target.explicitDeclaration)this.builder.addElement(this.entityDraft(l.target));let h=this.relationshipDraft(i[0],l,this.nodeLocation(a));this.builder.addRelationship(h);let u=h.explicitId??`edge-${this.anonymousEdge++}`;return o.push(this.entityOccurrence(this.nodes(a.children,"entityName")[0],l.target,l.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:o,edges:[{id:u,span:[0,0],...h.explicitIdLocation?{idSpan:h.explicitIdLocation.span}:{},...h.label?{labelSpan:h.label.span}:{}}]}}actorItem(t){let n=this.visit(this.nodes(t,"actorName")[0]),i=this.nodes(t,"metadata")[0],a=this.nodes(t,"stereotype")[0],o=this.nodes(t,"classSuffix")[0],l=o?this.visit(o):{classes:[],spans:[]};return{...n,...i?{metadata:this.visit(i)}:{},...a?{stereotype:this.visit(a)}:{},classes:l.classes,classSpans:l.spans}}actorName(t){let n=this.tokens(t,"IDENTIFIER")[0],i=this.tokens(t,"PLAIN_STRING")[0]??this.tokens(t,"MARKDOWN_STRING")[0];if(n){let o=this.nodes(t,"nodeLabel")[0],l=o?this.visit(o):this.tokenLabel(n);return{id:n.image,label:l,location:this.tokenLocation(n),generated:!1,classes:[],classSpans:[]}}let a=this.tokenLabel(i);return{id:this.generateId(a.text),label:a,location:this.tokenLocation(i),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(t){let n=this.nodes(t,"actorItem"),i=n.map((a)=>this.visit(a));for(let a of i)this.builder.addElement(this.actorDraft(a));return{kind:"node",span:[0,0],nodes:i.map((a,o)=>this.actorOccurrence(n[o],a,!0))}}entityStatement(t){let n=this.nodes(t,"entityName"),i=this.visit(n[0]),a=this.nodes(t,"relationTail")[0];if(!a)return i.explicitDeclaration=!0,i.shape??="ellipse",this.builder.addElement(this.entityDraft(i)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(n[0],i,!0)]};if(i.explicitDeclaration)this.builder.addElement(this.entityDraft(i));let o=this.visit(a);if(o.target.explicitDeclaration)this.builder.addElement(this.entityDraft(o.target));let l={source:this.endpoint(i),target:this.endpoint(o.target),location:this.nodeLocation(a),...o.explicitId?{explicitId:o.explicitId,explicitIdLocation:o.explicitIdLocation}:{},...o.arrow};this.builder.addRelationship(l);let h=l.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(n[0],i,i.explicitDeclaration),this.entityOccurrence(this.nodes(a.children,"entityName")[0],o.target,o.target.explicitDeclaration)],edges:[{id:h,span:[0,0],...l.explicitIdLocation?{idSpan:l.explicitIdLocation.span}:{},...l.label?{labelSpan:l.label.span}:{}}]}}entityName(t){let n=this.tokens(t,"IDENTIFIER")[0],i=this.tokens(t,"PLAIN_STRING")[0]??this.tokens(t,"MARKDOWN_STRING")[0],a=this.nodes(t,"nodeLabel")[0],o=this.nodes(t,"useCaseMetadata")[0],l=this.nodes(t,"stereotype")[0],h=this.nodes(t,"classSuffix")[0],u=h?this.visit(h):{classes:[],spans:[]};if(n){let d=a?this.visit(a):this.tokenLabel(n),f=a?this.tokens(t,"LBRACKET").length?"rect":"ellipse":void 0;return{id:n.image,label:d,location:this.tokenLocation(n),generated:!1,...f?{shape:f}:{},...o?{metadata:this.visit(o)}:{},...l?{stereotype:this.visit(l)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(f||o||l)}}let c=this.tokenLabel(i);return{id:this.generateId(c.text),label:c,location:this.tokenLocation(i),generated:!0,...o?{metadata:this.visit(o)}:{},...l?{stereotype:this.visit(l)}:{},classes:u.classes,classSpans:u.spans,explicitDeclaration:Boolean(o||l)}}nodeLabel(t){let n=this.allTokens(t);if(n.length===1&&(n[0].tokenType.name==="PLAIN_STRING"||n[0].tokenType.name==="MARKDOWN_STRING"))return this.tokenLabel(n[0]);let i=[n[0].startOffset,(n.at(-1).endOffset??n.at(-1).startOffset)+1];return{text:this.source.slice(i[0],i[1]),type:"text",span:i}}useCaseMetadata(t){return this.visit(this.nodes(t,"metadata")[0])}relationTail(t){let n=this.tokens(t,"IDENTIFIER")[0];return{...n?{explicitId:n.image,explicitIdLocation:this.tokenLocation(n)}:{},arrow:this.visit(this.nodes(t,"arrow")[0]),target:this.visit(this.nodes(t,"entityName")[0])}}arrow(t){return this.visit(this.firstNode(t,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(t){return this.nodeLabel(t)}semanticRelation(t){if(this.tokens(t,"GENERALIZATION").length)return{type:"generalization",arrowType:X.SOLID_ARROW,minlen:1};let n=this.tokens(t,"INCLUDE").length?"include":"extend",i=this.tokens(t,n==="include"?"INCLUDE":"EXTEND")[0];return{type:n,arrowType:X.SOLID_ARROW,label:{text:n,type:"text",span:this.tokenSpan(i)},minlen:1}}metadata(t){return{properties:this.nodes(t,"metadataProperty").map((n)=>this.visit(n)),location:this.ctxLocation(t)}}metadataProperty(t){let n=this.allTokens(t).filter((h)=>h.tokenType.name!=="COLON"),i=n[0],a=n[1],o=a.tokenType.name==="TRUE"?!0:a.tokenType.name==="FALSE"?!1:this.decodePlain(a),l=[i.startOffset,(a.endOffset??a.startOffset)+1];return{key:this.decodePlain(i),value:o,span:l,keySpan:this.contentSpan(i),valueSpan:this.contentSpan(a),location:this.tokenLocation(i)}}metadataSeparator(t){return}systemBoundaryStatement(t){let n=this.visit(this.nodes(t,"systemBoundaryName")[0]),i=this.nodes(t,"classSuffix")[0],a=i?this.visit(i):{classes:[],spans:[]};n.classes=a.classes,this.builder.addBoundary(n);let o=this.parentBoundary;this.parentBoundary={id:n.id,location:n.location};let l=this.nodes(t,"systemBoundaryContent")[0],h=l?this.visit(l):[];this.parentBoundary=o;let u=this.tokens(t,"END")[0],c=this.nodes(t,"metadata")[0],d=c?this.visit(c):void 0,f={kind:"group",span:[0,0],group:n.id,idSpan:n.location.span,titleSpan:n.label.span,endSpan:this.tokenSpan(u),classSpans:a.spans,...d?{metadata:d.properties.map(({key:m,span:R,keySpan:y,valueSpan:U})=>({key:m,span:R,keySpan:y,valueSpan:U}))}:{},...h.length?{children:h}:{}};if(d)this.builder.addMetadataAssignment(n.id,n.location,d,f);return f}systemBoundaryName(t){let n=this.tokens(t,"IDENTIFIER")[0];if(n){let o=this.nodes(t,"nodeLabel")[0];return{id:n.image,label:o?this.visit(o):this.tokenLabel(n),location:this.tokenLocation(n),generated:!1,classes:[]}}let i=this.tokens(t,"PLAIN_STRING")[0]??this.tokens(t,"MARKDOWN_STRING")[0],a=this.tokenLabel(i);return{id:this.generateId(a.text),label:a,location:this.tokenLocation(i),generated:!0,classes:[]}}systemBoundaryContent(t){return[...this.nodes(t,"blankLine"),...this.nodes(t,"commentLine"),...this.nodes(t,"boundaryElement")].sort((i,a)=>(i.location?.startOffset??0)-(a.location?.startOffset??0)).map((i)=>this.wrap(i,this.visit(i)))}boundaryElement(t){let n=this.nodes(t,"actorDeclarationOnly")[0];if(n)return this.visit(n);let i=this.nodes(t,"entityName")[0],a=this.visit(i);return a.explicitDeclaration=!0,a.shape??="ellipse",this.builder.addElement(this.entityDraft(a)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(i,a,!0)]}}metadataAssignmentStatement(t){let n=this.visit(this.nodes(t,"metadataAssignmentTarget")[0]),i=this.visit(this.nodes(t,"metadata")[0]),a={kind:"metadata",span:[0,0],nodes:[{id:n.id,span:n.location.span,idSpan:n.location.span}],metadata:i.properties.map(({key:o,span:l,keySpan:h,valueSpan:u})=>({key:o,span:l,keySpan:h,valueSpan:u}))};return this.builder.addMetadataAssignment(n.id,n.location,i,a),a}metadataAssignmentTarget(t){let n=this.allTokens(t)[0],i=this.tokenLabel(n);return{id:n.tokenType.name==="IDENTIFIER"?n.image:this.generateId(i.text),location:this.tokenLocation(n)}}noteStatement(t){let n=this.tokens(t,"IDENTIFIER")[0],i=this.visit(this.nodes(t,"nodeLabel")[0]);return this.builder.addNote({target:n.image,targetLocation:this.tokenLocation(n),label:i,location:this.ctxLocation(t)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:i.span,nodes:[{id:n.image,span:this.tokenSpan(n),idSpan:this.tokenSpan(n)}]}}stereotype(t){let n=this.tokens(t,"STEREOTYPE_TEXT")[0];return{value:n.image.trim(),span:this.tokenSpan(n)}}classSuffix(t){let n=this.tokens(t,"IDENTIFIER");return{classes:n.map((i)=>i.image),spans:n.map((i)=>this.tokenSpan(i))}}jsonStatement(t){let n=this.tokens(t,"JSON_DECLARATION_START")[0],i=this.tokens(t,"JSON_OBJECT_LITERAL")[0],a=/^json[\t ]+(\w+)/.exec(n.image),o=a[1],l=a[0].length-o.length,h={span:[n.startOffset+l,n.startOffset+l+o.length],line:n.startLine??1,column:(n.startColumn??1)+l},u=Dr(i.image,i.startLine??1,i.startColumn??1),c=this.nodes(t,"classSuffix")[0],d=c?this.visit(c):{classes:[],spans:[]},f={id:o,value:u.value,propertyOrder:u.propertyOrder,location:h,classes:d.classes};return this.builder.addJson(f),{kind:"json",span:[0,0],nodes:[{id:o,span:h.span,idSpan:h.span,defines:!0,classSpans:d.spans}],classSpans:d.spans}}directionStatement(t){let n=this.allTokens(t).find((i)=>["TD","TB","BT","RL","LR"].includes(i.tokenType.name));return this.builder.setDirection(n.image),{kind:"direction",span:[0,0]}}classDefStatement(t){let n=this.tokens(t,"IDENTIFIER"),i=this.visit(this.nodes(t,"styles")[0]);return this.builder.addClassDef(n.map((a)=>a.image),i),{kind:"classDef",span:[0,0],ref:n[0].image,refSpan:this.tokenSpan(n[0])}}classStatement(t){let n=this.tokens(t,"IDENTIFIER"),i=1;for(;i<n.length;i++)if(!this.source.slice((n[i-1].endOffset??n[i-1].startOffset)+1,n[i].startOffset).includes(","))break;let a=n.slice(0,i).map((l)=>({id:l.image,location:this.tokenLocation(l)})),o=n.slice(i).map((l)=>l.image);return this.builder.addClassAssignment(a,o),{kind:"classAssign",span:[0,0],ref:o[0],refSpan:this.tokenSpan(n[i]),nodes:a.map(({id:l,location:h})=>({id:l,span:h.span,idSpan:h.span}))}}styleStatement(t){let n=this.tokens(t,"IDENTIFIER")[0],i=this.visit(this.nodes(t,"styles")[0]);return this.builder.addStyleAssignment(n.image,this.tokenLocation(n),i),{kind:"style",span:[0,0],nodes:[{id:n.image,span:this.tokenSpan(n),idSpan:this.tokenSpan(n)}]}}styles(t){return this.nodes(t,"styleValue").map((n)=>this.visit(n))}styleValue(t){let n=this.allTokens(t),i=[n[0].startOffset,(n.at(-1).endOffset??n.at(-1).startOffset)+1];return this.source.slice(i[0],i[1]).replaceAll("\\,",",")}styleComponent(t){return this.allTokens(t).map((n)=>n.image).join("")}forwardSolidOperator(t){let n=this.tokens(t,"FORWARD_SOLID")[0];return{type:"association",arrowType:X.SOLID_ARROW,minlen:this.solidMinlen(n)}}backwardSolidOperator(t){let n=this.tokens(t,"BACKWARD_SOLID")[0],i=this.nodes(t,"edgeLabel")[0],a=i?this.tokens(t,"MARKERLESS_SOLID").at(-1):n;return{type:"association",arrowType:X.BACK_ARROW,minlen:this.solidMinlen(a),...i?{label:this.visit(i)}:{}}}markerlessSolidOperator(t){let n=this.nodes(t,"edgeLabel")[0],i=this.allTokens(t);if(!n)return{type:"association",arrowType:X.LINE_SOLID,minlen:this.solidMinlen(this.tokens(t,"MARKERLESS_SOLID")[0])};let a=i.at(-1),o=a.tokenType.name==="FORWARD_SOLID"?X.SOLID_ARROW:a.tokenType.name==="FORWARD_CIRCLE"?X.CIRCLE_ARROW:a.tokenType.name==="FORWARD_CROSS"?X.CROSS_ARROW:X.LINE_SOLID;return{type:"association",arrowType:o,label:this.visit(n),minlen:o===X.SOLID_ARROW||o===X.LINE_SOLID?this.solidMinlen(a):1}}forwardCircleOperator(t){return{type:"association",arrowType:X.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(t){let n=this.nodes(t,"edgeLabel")[0];return{type:"association",arrowType:X.CIRCLE_ARROW_REVERSED,minlen:1,...n?{label:this.visit(n)}:{}}}forwardCrossOperator(t){return{type:"association",arrowType:X.CROSS_ARROW,minlen:1}}backwardCrossOperator(t){let n=this.nodes(t,"edgeLabel")[0];return{type:"association",arrowType:X.CROSS_ARROW_REVERSED,minlen:1,...n?{label:this.visit(n)}:{}}}actorDraft(t){return{id:t.id,kind:"actor",label:t.label,location:t.location,generated:t.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...t.metadata?{metadata:t.metadata}:{},...t.stereotype?{stereotype:t.stereotype.value,stereotypeSpan:t.stereotype.span}:{},classes:t.classes}}entityDraft(t){return{id:t.id,kind:"usecase",label:t.label,location:t.location,generated:t.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...t.shape?{shape:t.shape}:{},...t.metadata?{metadata:t.metadata}:{},...t.stereotype?{stereotype:t.stereotype.value,stereotypeSpan:t.stereotype.span}:{},classes:t.classes}}endpoint(t,n=t.explicitDeclaration??!0){return{id:t.id,label:t.label,location:t.location,generated:t.generated,declaration:n,classesOnReference:t.classes.length>0}}relationshipDraft(t,n,i){return{source:this.endpoint(t,!0),target:this.endpoint(n.target),location:i,...n.explicitId?{explicitId:n.explicitId,explicitIdLocation:n.explicitIdLocation}:{},...n.arrow}}actorOccurrence(t,n,i){return{id:n.id,span:this.nodeSpan(t),idSpan:n.location.span,labelSpan:n.label.span,...i?{defines:!0}:{},...n.stereotype?{stereotypeSpan:n.stereotype.span}:{},...n.metadata?{metadata:n.metadata.properties.map(({key:a,span:o,keySpan:l,valueSpan:h})=>({key:a,span:o,keySpan:l,valueSpan:h}))}:{},...n.classSpans.length?{classSpans:n.classSpans}:{}}}entityOccurrence(t,n,i){return this.actorOccurrence(t,n,i)}wrap(t,n){if(n.kind==="blank"||n.kind==="comment")return n;n.span=this.nodeSpan(t);for(let i of n.edges??[])i.span=n.span;return n}tokenLabel(t){let n=t.tokenType.name==="MARKDOWN_STRING"?"markdown":"text",i=n==="markdown"?2:t.tokenType.name==="PLAIN_STRING"?1:0,a=this.tokenSpan(t,i);return{text:this.source.slice(a[0],a[1]),type:n,span:a}}decodePlain(t){return t.tokenType.name==="PLAIN_STRING"?t.image.slice(1,-1):t.image}contentSpan(t){return this.tokenSpan(t,t.tokenType.name==="PLAIN_STRING"?1:t.tokenType.name==="MARKDOWN_STRING"?2:0)}generateId(t){return t.replace(/\W/g,"_")}solidMinlen(t){return Math.max(1,(t.image.match(/-/g)?.length??2)-1)}nodeLocation(t){let n=this.allTokens(t.children)[0];return{span:this.nodeSpan(t),line:n.startLine??1,column:n.startColumn??1}}ctxLocation(t){let n=this.allTokens(t).filter((o)=>o.tokenType.name!=="NEWLINE"&&o.tokenType.name!=="EOF"),i=n[0],a=n.at(-1);return{span:[i.startOffset,Math.min(this.source.length,(a.endOffset??a.startOffset+a.image.length-1)+1)],line:i.startLine??1,column:i.startColumn??1}}tokenLocation(t){let n=t.tokenType.name==="PLAIN_STRING"?1:t.tokenType.name==="MARKDOWN_STRING"?2:0;return{span:this.tokenSpan(t,n),line:t.startLine??1,column:(t.startColumn??1)+n}}nodeSpan(t){let n=this.allTokens(t.children).filter((o)=>o.tokenType.name!=="NEWLINE"&&o.tokenType.name!=="EOF"),i=n[0],a=n.at(-1);if(!i||!a)throw Error("Usecase CST node has no source token");return[i.startOffset,Math.min(this.source.length,(a.endOffset??a.startOffset+a.image.length-1)+1)]}tokenSpan(t,n=0){return[t.startOffset+n,Math.min(this.source.length,(t.endOffset??t.startOffset+t.image.length-1)+1-n)]}nodes(t,n){return(t[n]??[]).filter((i)=>("children"in i))}tokens(t,n){return(t[n]??[]).filter((i)=>("tokenTypeIdx"in i))}firstNode(t,...n){for(let i of n){let a=this.nodes(t,i)[0];if(a)return a}throw Error(`Usecase CST is missing one of: ${n.join(", ")}`)}allTokens(t){let n=[];for(let i of Object.values(t))for(let a of i)if("tokenTypeIdx"in a)n.push(a);else n.push(...this.allTokens(a.children));return n.sort((i,a)=>i.startOffset-a.startOffset)}},Vo=new Ko,zo={parse:e(async(t)=>{Ns.clear(),Gt.input=[];try{Xi({diagramType:"usecase",lexer:xo,parser:Gt,entry:e(()=>Gt.start(),"entry"),visit:e((n)=>Vo.build(n,t),"visit")},t)}catch(n){Ns.clear();let i=Gt.errors[0];if(i){let{token:a}=i,o=ut(a.startOffset)?a.startOffset:t.length,l=ut(a.endOffset)?a.endOffset+1:o,h=ut(a.startLine)?a.startLine:t.slice(0,o).split(/\r\n|\r|\n/).length,u=Math.max(t.lastIndexOf(`
117
- `,o-1),t.lastIndexOf("\r",o-1)),c=ut(a.startColumn)?a.startColumn:o-u,d=n instanceof Error?n.message:String(n);throw Error(`${d} at line ${h}, column ${c} [${o},${l})`)}throw n}},"parse")},Ho=["point","circle","cross","extension"],Fr={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},Vi=e((t,n)=>{let[i,a]=[t,n].map((o)=>o.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${i}-${a}`},"usecaseDomId"),Xo=e((t)=>`usecase-${t.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),Is=e((t,n)=>{if(n!=="markdown")return t;return ti(t).map((i)=>i.map((a)=>a.content).join(" ")).join(`
118
- `)},"getAccessibleLabel"),Yo=e((t)=>{let n=Is(t.label??t.id,t.labelType);if(Fr[t.shape]){let a=t.actorType&&t.actorType!=="normal"?`${t.actorType} `:"",o=t.business?"business ":"",l=t.stereotype?`, stereotype ${t.stereotype}`:"";return`${o}${a}actor ${n}${l}`}if(t.shape==="note")return`Note for ${t.noteTargetLabel??t.noteTarget??""}: ${n}`;if(t.shape==="usecaseJsonTable"){let a=(t.jsonRows??[]).map((o)=>`${o.accessibleKey}: ${o.value}`).join("; ");return a?`${n}: ${a}`:n}let i=t.stereotype?`, stereotype ${t.stereotype}`:"";return`${t.business?"business ":""}use case ${n}${i}`},"getUsecaseNodeAccessibleName"),qo=e((t)=>`${t.boundaryType} system boundary ${Is(t.label??t.id,t.labelType)}`,"getUsecaseBoundaryAccessibleName"),Jo=e((t)=>{if(t.relationshipType==="note")return"";return`${t.relationshipType==="association"&&t.label?`association ${Is(t.label,t.labelType)}`:t.relationshipType} from ${t.sourceLabel} to ${t.targetLabel}`},"getUsecaseEdgeAccessibleName"),ht=e((t)=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"escapePlainLabel"),zi=e((t)=>t.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),Zo=e((t,n)=>{t.diagramId=n,t.markers=[...Ho];for(let i of t.nodes){let a=i;if(a.domId=Xo(i.id),i.label!==void 0&&i.labelType==="text")i.label=ht(i.label);if(i.stereotype)i.stereotype=ht(i.stereotype);if(!i.isGroup&&i.shape==="usecaseJsonTable")i.jsonRows=i.jsonRows?.map((o)=>({...o,key:ht(o.key),value:ht(o.value)}));if(!i.isGroup&&(i.shape==="usecaseEllipse"||i.shape==="rect")&&i.stereotype){let o=i.label??ht(i.id);i.label=`«${zi(i.stereotype)}»<br/>${i.labelType==="text"?zi(o):o}`,i.labelType="markdown",a.hasFoldedStereotype=!0,delete i.stereotype}}for(let i of t.edges)if(i.label!==void 0&&i.labelType==="text")i.label=ht(i.label);return t},"prepareUsecaseLayoutData"),Qo=e((t,n,i)=>{for(let o of n.nodes){let l=typeof o.domId==="string"?o.domId:Vi(n.diagramId,o.id),h=t.select(`#${l}`),u=o.isGroup?"boundary":Fr[o.shape]?"actor":o.shape==="note"?"note":o.shape==="usecaseJsonTable"?"json":"usecase",c=i.nodes.get(o.id)??o.id;if(h.attr("data-usecase-id",o.id).attr("data-usecase-kind",u).attr("role","img").attr("aria-label",c),!o.isGroup&&(o.shape==="usecaseEllipse"||o.shape==="rect")&&"hasFoldedStereotype"in o&&o.hasFoldedStereotype===!0){let d=h.node(),f=d?.querySelector(".nodeLabel"),m=f?.querySelector("p")??f,R=m?.firstChild;if(m&&R?.nodeType===3){let y=m.ownerDocument.createElement("span");y.className="usecase-stereotype",m.insertBefore(y,R),y.appendChild(R)}else d?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let a=new Map(n.edges.map((o)=>[o.id,o]));t.selectAll('path[data-et="edge"]').each(function(){let o=a.get(this.getAttribute("data-id")??"");if(!o)return;let l=p(this);if(l.attr("id",Vi(n.diagramId,o.id)).attr("data-usecase-id",o.id).attr("data-usecase-kind",o.internal?"note-connector":"relationship"),o.internal)l.attr("aria-hidden","true");else l.attr("role","img").attr("aria-label",i.edges.get(o.id)??o.id)})},"annotateUsecaseElements"),Hi=e((t,n)=>{t.style("--mermaid-usecase-actor-font-size",`${n.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",n.actorFontFamily).style("--mermaid-usecase-actor-font-weight",n.actorFontWeight).style("--mermaid-usecase-font-size",`${n.usecaseFontSize}px`).style("--mermaid-usecase-font-family",n.usecaseFontFamily).style("--mermaid-usecase-font-weight",n.usecaseFontWeight)},"applyUsecaseFonts"),el=e(async(t,n,i,a)=>{r.info("Drawing usecase diagram (unified)",n);let{layout:o}=s(),l=a.db,h=l.getData(),u=new Map(h.nodes.map((m)=>[m.id,Is(m.label??m.id,m.labelType)])),c={nodes:new Map(h.nodes.map((m)=>[m.id,m.isGroup?qo(m):Yo(m.shape==="note"?{...m,noteTargetLabel:u.get(m.noteTarget??"")}:m)])),edges:new Map(h.edges.map((m)=>[m.id,Jo({...m,sourceLabel:u.get(m.source)??m.sourceLabel,targetLabel:u.get(m.target)??m.targetLabel})]))},d=he(n,h.config.securityLevel);h.layoutAlgorithm=ye(o),Zo(h,n),Hi(d,h),await ge(h,d),Qo(d,h,c);let f=h.diagramPadding;N.insertTitle(d,"usecaseDiagramTitleText",0,l.getDiagramTitle?.()??""),se(d,f,"usecaseDiagram",h.useMaxWidth),Hi(d,h)},"draw"),tl={draw:el},sl=e((t)=>({actorBkg:t.usecaseActorBkg??t.actorBkg??t.mainBkg,actorBorder:t.usecaseActorBorder??t.actorBorder??t.primaryColor,bkg:t.usecaseBkg??t.mainBkg,border:t.usecaseBorder??t.nodeBorder??t.primaryColor,boundaryBkg:t.usecaseBoundaryBkg??t.clusterBkg,boundaryBorder:t.usecaseBoundaryBorder??t.clusterBorder,includeLine:t.usecaseIncludeLine??t.lineColor,extendLine:t.usecaseExtendLine??t.lineColor}),"roleColors"),nl=e((t)=>{let{theme:n,bkgColorArray:i,borderColorArray:a}=t;if(!ae(n,a))return"";let o=b().usecase?.colorScheme==="rotate",l=ie(t.look),h=l==="handDrawn",u=ce(i),c="";for(let d=0;d<ft(a);d++){let f=a[d],m=u?`fill: ${i[d%i.length]};`:"",R=`[data-look="${l}"][data-color-id="color-${d}"]`;if(c+=`
119
-
120
- & ${R}.system-boundary rect.boundary-body,
121
- & ${R}.system-boundary rect.boundary-tab,
122
- & ${R}.system-boundary .boundary-body path,
123
- & ${R}.system-boundary .boundary-tab path {
124
- stroke: ${f};
125
- ${m}
126
- }
127
- `,!o)continue;c+=`
128
-
129
- /* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and
130
- the business variant.
131
-
132
- Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws
133
- the body as a *pair* of paths, an outline stroked in the border colour and a hachure
134
- fill stroked in the background colour, with no class to tell them apart. Stroking
135
- both repaints the fill lines as border colour and the shape collapses into a solid
136
- block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the
137
- theme's uniform colours, exactly as handDrawn flowchart nodes do. */
138
- & ${R}.usecase-element ellipse,
139
- & ${R}.usecase-element rect {
140
- stroke: ${f};
141
- ${m}
142
- }
143
-
144
- /* The business marker is a single classed path, so it can be reached safely by name --
145
- without it the marker keeps the uniform border beside a palette-coloured body. No
146
- \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
147
- & ${R}.usecase-element .usecase-business-marker {
148
- stroke: ${f};
149
- }
150
-
151
- /* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph
152
- group, never on its children, so the hollow variant's own \`fill="none"\` keeps
153
- winning and a hollow actor stays hollow. Same reason as above for not descending
154
- into the handDrawn paths. */
155
- & ${R}.usecase-actor .usecase-actor-shape,
156
- & ${R}.usecase-actor .usecase-actor-hollow,
157
- & ${R}.usecase-actor .usecase-actor-awesome,
158
- & ${R}.usecase-actor .usecase-actor-icon {
159
- stroke: ${f};
160
- ${m}
161
- }
162
- ${h?"":`
163
- /* The group rule above reaches the glyph by inheritance, which the neo look breaks: it
164
- ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths,
165
- and a value set directly on the child always beats one inherited from the parent,
166
- whatever the parent rule's specificity. So name the children too.
167
-
168
- Emitted for every look *except* handDrawn, where roughjs draws the glyph as an
169
- outline path plus a hachure fill path stroked in the fill colour, indistinguishable
170
- in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no
171
- \`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */
172
- & ${R}.usecase-actor .usecase-actor-glyph path,
173
- & ${R}.usecase-actor .usecase-actor-glyph circle {
174
- stroke: ${f};
175
- }
176
- `}
177
- `}return c},"genColor");var il=e((t)=>{let n=sl(t),i=ie(t.look)==="handDrawn";return`
178
- ${nl(t)}
179
- & .usecase-actor {
180
- color: ${t.actorTextColor??t.primaryTextColor};
181
- }
182
-
183
- & .usecase-actor-shape,
184
- & .usecase-actor-hollow,
185
- & .usecase-actor-awesome,
186
- & .usecase-actor-icon {
187
- fill: ${n.actorBkg};
188
- stroke: ${n.actorBorder};
189
- stroke-width: 2px;
190
- }
191
- ${i?"":`
192
- /* The rule above colours the glyph group and lets its children inherit, which the neo
193
- look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on
194
- the glyph's own paths, and a value set directly on a child always beats one inherited
195
- from its parent, whatever the parent rule's specificity. Since neo is the default look,
196
- without this every actor renders in the node border colour rather than the actor
197
- colour the rule above asks for.
198
-
199
- \`.node\` is in the selector to outrank that neo rule rather than tie with it: both
200
- would otherwise be one attribute plus one class plus one element, leaving the winner to
201
- depend on which stylesheet is concatenated last.
202
-
203
- Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */
204
- & .node.usecase-actor .usecase-actor-glyph path,
205
- & .node.usecase-actor .usecase-actor-glyph circle {
206
- stroke: ${n.actorBorder};
207
- }
208
- `}
209
- & .usecase-actor .nodeLabel,
210
- & .actor-label {
211
- color: ${t.actorTextColor??t.primaryTextColor};
212
- fill: ${t.actorTextColor??t.primaryTextColor};
213
- font-family: var(--mermaid-usecase-actor-font-family, ${t.fontFamily});
214
- font-size: var(--mermaid-usecase-actor-font-size, 14px);
215
- font-weight: var(--mermaid-usecase-actor-font-weight, normal);
216
- }
217
-
218
- & .usecase-element ellipse,
219
- & .usecase-element rect,
220
- & .usecase-business ellipse,
221
- & .usecase-business rect {
222
- fill: ${n.bkg};
223
- stroke: ${n.border};
224
- stroke-width: 2px;
225
- }
226
- ${i?"":`
227
- /* The same interception the actor glyph hits, one element down: neo ships
228
- \`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain
229
- \`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node
230
- border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no
231
- equivalent neo rule and is already correct; restating it here costs nothing and means
232
- the two forms cannot drift apart again.
233
-
234
- Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than
235
- tie with it -- on a tie the later stylesheet would win, which is how neo took this in
236
- the first place. Skipped under handDrawn, where roughjs draws paths and neither element
237
- exists. */
238
- & [data-look="${ie(t.look)}"].node.usecase-element ellipse,
239
- & [data-look="${ie(t.look)}"].node.usecase-element rect {
240
- fill: ${n.bkg};
241
- stroke: ${n.border};
242
- }
243
-
244
- /* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same
245
- way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */
246
- & [data-look="${ie(t.look)}"].node.usecase-element .usecase-business-marker {
247
- stroke: ${n.border};
248
- }
249
- `}
250
- & .usecase-element .nodeLabel,
251
- & .usecase-label {
252
- color: ${t.primaryTextColor};
253
- fill: ${t.primaryTextColor};
254
- font-family: var(--mermaid-usecase-font-family, ${t.fontFamily});
255
- font-size: var(--mermaid-usecase-font-size, 12px);
256
- font-weight: var(--mermaid-usecase-font-weight, normal);
257
- }
258
-
259
- & .usecase-stereotype,
260
- & .usecase-business-marker {
261
- color: ${t.primaryTextColor};
262
- fill: ${t.primaryTextColor};
263
- stroke: ${n.border};
264
- }
265
-
266
- & .system-boundary rect.boundary-body,
267
- & .system-boundary rect.boundary-tab,
268
- & .system-boundary-package-tab {
269
- fill: ${n.boundaryBkg};
270
- stroke: ${n.boundaryBorder};
271
- stroke-width: 1px;
272
- }
273
-
274
- & .system-boundary-title text {
275
- fill: ${t.titleColor??t.primaryTextColor};
276
- }
277
-
278
- /* Only the span, never the <p> inside it: the renderer puts a user-supplied
279
- 'color' on the span, and that has to stay inheritable by its children. */
280
- & .system-boundary-title span {
281
- color: ${t.titleColor??t.primaryTextColor};
282
- }
283
-
284
- & .usecase-note {
285
- fill: ${t.noteBkgColor};
286
- stroke: ${t.noteBorderColor};
287
- color: ${t.noteTextColor};
288
- }
289
-
290
- & .usecase-note .nodeLabel {
291
- color: ${t.noteTextColor};
292
- fill: ${t.noteTextColor};
293
- }
294
-
295
- & .usecase-json-table,
296
- & .usecase-json-table rect,
297
- & .usecase-json-cell {
298
- fill: ${t.mainBkg};
299
- stroke: ${t.nodeBorder??t.primaryColor};
300
- }
301
-
302
- & .usecase-json-title,
303
- & .usecase-json-key,
304
- & .usecase-json-value {
305
- color: ${t.primaryTextColor};
306
- fill: ${t.primaryTextColor};
307
- }
308
-
309
- & .relationship {
310
- fill: none;
311
- stroke: ${t.lineColor};
312
- }
313
-
314
- & .relationship-include,
315
- & .relationship-extend,
316
- & .relationship-note {
317
- stroke-dasharray: 3;
318
- }
319
-
320
- /* Include and extend are both dashed, which is a weak distinction at small sizes. The
321
- tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */
322
- & .relationship-include {
323
- stroke: ${n.includeLine};
324
- }
325
-
326
- & .relationship-extend {
327
- stroke: ${n.extendLine};
328
- }
329
-
330
- & .relationship.edge-animation-fast,
331
- & .relationship.edge-animation-slow {
332
- stroke-linecap: round;
333
- }
334
-
335
- & .edgeLabel,
336
- & .edgeLabel p {
337
- background-color: ${t.edgeLabelBackground};
338
- }
339
-
340
- & .labelBkg {
341
- background-color: ${t.edgeLabelBackground};
342
- padding: 0 2px;
343
- }
344
-
345
- & .edgeLabel .label rect {
346
- fill: ${t.edgeLabelBackground};
347
- }
348
-
349
- & .relationship-label,
350
- & .edgeLabel {
351
- color: ${t.primaryTextColor};
352
- fill: ${t.primaryTextColor};
353
- font-family: ${t.fontFamily};
354
- font-size: 10px;
355
- font-weight: normal;
356
- }
357
-
358
- & .marker,
359
- & .marker.point,
360
- & .marker.circle,
361
- & .marker.cross {
362
- fill: ${t.lineColor};
363
- stroke: ${t.lineColor};
364
- }
365
-
366
- & .marker.extension {
367
- fill: ${t.mainBkg};
368
- stroke: ${t.lineColor};
369
- }
370
- `},"getStyles"),rl=il,ed={parser:zo,db:Ns,renderer:tl,styles:rl};export{ed as diagram};