solve-engine 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/README.md +12 -17
  2. package/dist/{BytecodeBuilder-Bp9xeTmX.d.cts → BytecodeBuilder-DGGeByAP.d.cts} +18 -0
  3. package/dist/{BytecodeBuilder-Bp9xeTmX.d.ts → BytecodeBuilder-DGGeByAP.d.ts} +18 -0
  4. package/dist/{Configuration-C9W8tJv_.d.cts → Configuration-B6W0-T67.d.cts} +17 -4
  5. package/dist/{Configuration-C9W8tJv_.d.ts → Configuration-B6W0-T67.d.ts} +17 -4
  6. package/dist/{EngineError-CNA_rHY-.d.cts → EngineError-Ce1lPkjZ.d.cts} +2 -0
  7. package/dist/{EngineError-CNA_rHY-.d.ts → EngineError-Ce1lPkjZ.d.ts} +2 -0
  8. package/dist/{PackageCompatibility-B6NX9IaN.d.cts → PackageCompatibility-Bn5jnBtA.d.cts} +2 -2
  9. package/dist/{PackageCompatibility-Ceg5XdAp.d.ts → PackageCompatibility-CIvq2MP5.d.ts} +2 -2
  10. package/dist/{PackageRegistry-DrCPQNyy.d.ts → PackageRegistry-DzeiWcv4.d.ts} +93 -172
  11. package/dist/{PackageRegistry-DnJYVw9G.d.cts → PackageRegistry-dpdurBVO.d.cts} +93 -172
  12. package/dist/{Parselet-Bhf7d0_W.d.ts → Parselet-B-zoPrTa.d.ts} +8 -5
  13. package/dist/{Parselet-Cv7S7KRt.d.cts → Parselet-C4Wu055_.d.cts} +8 -5
  14. package/dist/{ScopeManager-Bzq87GfA.d.ts → ScopeManager-C2LDOrDx.d.ts} +7 -16
  15. package/dist/{ScopeManager-DRDBVfan.d.cts → ScopeManager-D7uMXbhS.d.cts} +7 -16
  16. package/dist/{VMCheckpoints-C6c17Hbo.d.ts → VMCheckpoints-CGyFhivM.d.ts} +3 -3
  17. package/dist/{VMCheckpoints-dZxSMGHG.d.cts → VMCheckpoints-I9jg3jWR.d.cts} +3 -3
  18. package/dist/{Value-DZNQ_PU7.d.cts → Value-CCi_Eecs.d.cts} +40 -0
  19. package/dist/{Value-DZNQ_PU7.d.ts → Value-CCi_Eecs.d.ts} +40 -0
  20. package/dist/{WorkerError-Djd7GGGa.d.cts → WorkerError-B4p6PNfx.d.cts} +1 -1
  21. package/dist/{WorkerError-B7t7R2-m.d.ts → WorkerError-Dhj9BQ_A.d.ts} +1 -1
  22. package/dist/chunk-2JMFUQZH.js +2 -0
  23. package/dist/chunk-2JMFUQZH.js.map +1 -0
  24. package/dist/chunk-2RWAXT6O.js +0 -1
  25. package/dist/chunk-4BZIYU7S.cjs +3 -0
  26. package/dist/chunk-4BZIYU7S.cjs.map +1 -0
  27. package/dist/chunk-4J7XZSZJ.cjs +5 -0
  28. package/dist/chunk-4J7XZSZJ.cjs.map +1 -0
  29. package/dist/chunk-4QVBSG6B.cjs +2 -0
  30. package/dist/chunk-4QVBSG6B.cjs.map +1 -0
  31. package/dist/chunk-5IJD5L3O.cjs +2 -0
  32. package/dist/chunk-5IJD5L3O.cjs.map +1 -0
  33. package/dist/chunk-62LMTO4F.js +2 -0
  34. package/dist/chunk-62LMTO4F.js.map +1 -0
  35. package/dist/chunk-6CY44ZPG.js +2 -0
  36. package/dist/chunk-6CY44ZPG.js.map +1 -0
  37. package/dist/chunk-6G3PMEPA.js +2 -0
  38. package/dist/chunk-6G3PMEPA.js.map +1 -0
  39. package/dist/chunk-6INX773F.cjs +2 -0
  40. package/dist/chunk-6INX773F.cjs.map +1 -0
  41. package/dist/chunk-6KFVG6UY.cjs +2 -0
  42. package/dist/{chunk-YJHY7CMN.cjs.map → chunk-6KFVG6UY.cjs.map} +1 -1
  43. package/dist/chunk-76F3LCIL.js +4 -0
  44. package/dist/chunk-76F3LCIL.js.map +1 -0
  45. package/dist/chunk-7GK3XEZF.js +2 -0
  46. package/dist/chunk-7GK3XEZF.js.map +1 -0
  47. package/dist/chunk-APN442VD.cjs +2 -0
  48. package/dist/chunk-APN442VD.cjs.map +1 -0
  49. package/dist/chunk-AXMQG5TS.cjs +2 -0
  50. package/dist/chunk-AXMQG5TS.cjs.map +1 -0
  51. package/dist/chunk-CIQOK7Q4.cjs +2 -0
  52. package/dist/chunk-CIQOK7Q4.cjs.map +1 -0
  53. package/dist/chunk-E6Z4NQAS.js +2 -0
  54. package/dist/chunk-E6Z4NQAS.js.map +1 -0
  55. package/dist/chunk-EFJCC6FJ.cjs +2 -0
  56. package/dist/chunk-EFJCC6FJ.cjs.map +1 -0
  57. package/dist/chunk-ESUN2THE.cjs +2 -0
  58. package/dist/chunk-ESUN2THE.cjs.map +1 -0
  59. package/dist/chunk-EVAOPEO4.js +2 -0
  60. package/dist/chunk-EVAOPEO4.js.map +1 -0
  61. package/dist/chunk-EYRBENHC.js +3 -0
  62. package/dist/chunk-EYRBENHC.js.map +1 -0
  63. package/dist/chunk-FDE5HWDI.cjs +2 -0
  64. package/dist/chunk-FDE5HWDI.cjs.map +1 -0
  65. package/dist/chunk-FWW3M36J.cjs +2 -0
  66. package/dist/chunk-FWW3M36J.cjs.map +1 -0
  67. package/dist/chunk-GOIQYUWV.js +2 -0
  68. package/dist/chunk-GOIQYUWV.js.map +1 -0
  69. package/dist/chunk-HFKDWQUL.js +2 -0
  70. package/dist/chunk-HFKDWQUL.js.map +1 -0
  71. package/dist/chunk-HLBYHXQD.cjs +3 -0
  72. package/dist/chunk-HLBYHXQD.cjs.map +1 -0
  73. package/dist/chunk-IANAMBJQ.cjs +2 -0
  74. package/dist/chunk-IANAMBJQ.cjs.map +1 -0
  75. package/dist/chunk-IJMNVBIS.js +2 -0
  76. package/dist/chunk-IJMNVBIS.js.map +1 -0
  77. package/dist/chunk-J4LZD4ZY.js +3 -0
  78. package/dist/chunk-J4LZD4ZY.js.map +1 -0
  79. package/dist/chunk-JAK3RAFA.cjs +2 -0
  80. package/dist/chunk-JAK3RAFA.cjs.map +1 -0
  81. package/dist/chunk-JFAJN3C2.cjs +2 -0
  82. package/dist/chunk-JFAJN3C2.cjs.map +1 -0
  83. package/dist/chunk-JPFCXLJV.js +2 -0
  84. package/dist/chunk-JPFCXLJV.js.map +1 -0
  85. package/dist/chunk-JSPKKNPQ.js +3 -0
  86. package/dist/chunk-JSPKKNPQ.js.map +1 -0
  87. package/dist/chunk-L3FPQSGN.js +2 -0
  88. package/dist/chunk-L3FPQSGN.js.map +1 -0
  89. package/dist/chunk-LR4E4A4W.cjs +2 -0
  90. package/dist/chunk-LR4E4A4W.cjs.map +1 -0
  91. package/dist/chunk-MIQBJGGR.js +2 -0
  92. package/dist/chunk-MIQBJGGR.js.map +1 -0
  93. package/dist/chunk-MPB7KUN5.js +3 -0
  94. package/dist/chunk-MPB7KUN5.js.map +1 -0
  95. package/dist/chunk-MSYX32PF.cjs +2 -0
  96. package/dist/chunk-MSYX32PF.cjs.map +1 -0
  97. package/dist/chunk-MVZUTETT.js +2 -0
  98. package/dist/chunk-MVZUTETT.js.map +1 -0
  99. package/dist/chunk-N7N7MPMK.cjs +2 -0
  100. package/dist/chunk-N7N7MPMK.cjs.map +1 -0
  101. package/dist/chunk-NGBBNL4K.cjs +1 -3
  102. package/dist/chunk-P6WPEUAJ.cjs +2 -0
  103. package/dist/chunk-P6WPEUAJ.cjs.map +1 -0
  104. package/dist/chunk-PS272DZJ.cjs +2 -0
  105. package/dist/chunk-PS272DZJ.cjs.map +1 -0
  106. package/dist/chunk-QXQE7X4S.js +2 -0
  107. package/dist/chunk-QXQE7X4S.js.map +1 -0
  108. package/dist/chunk-R2ENWQ76.js +2 -0
  109. package/dist/chunk-R2ENWQ76.js.map +1 -0
  110. package/dist/chunk-R2SZFJTT.cjs +2 -0
  111. package/dist/chunk-R2SZFJTT.cjs.map +1 -0
  112. package/dist/chunk-RAF57WYO.js +2 -0
  113. package/dist/chunk-RAF57WYO.js.map +1 -0
  114. package/dist/chunk-RSF25YSJ.js +2 -0
  115. package/dist/chunk-RSF25YSJ.js.map +1 -0
  116. package/dist/chunk-SOMGSIO4.cjs +3 -0
  117. package/dist/chunk-SOMGSIO4.cjs.map +1 -0
  118. package/dist/chunk-SUXRZWH2.cjs +3 -0
  119. package/dist/chunk-SUXRZWH2.cjs.map +1 -0
  120. package/dist/chunk-SYYE3QAX.cjs +2 -0
  121. package/dist/chunk-SYYE3QAX.cjs.map +1 -0
  122. package/dist/chunk-SZGK6RIP.cjs +2 -0
  123. package/dist/chunk-SZGK6RIP.cjs.map +1 -0
  124. package/dist/chunk-TCZSPH4A.js +2 -0
  125. package/dist/chunk-TCZSPH4A.js.map +1 -0
  126. package/dist/chunk-TLG7VZRX.cjs +2 -0
  127. package/dist/chunk-TLG7VZRX.cjs.map +1 -0
  128. package/dist/chunk-TRBXW6HW.js +2 -0
  129. package/dist/{chunk-AQNHHJMJ.cjs.map → chunk-TRBXW6HW.js.map} +1 -1
  130. package/dist/chunk-TTFO4YDP.cjs +2 -0
  131. package/dist/chunk-TTFO4YDP.cjs.map +1 -0
  132. package/dist/chunk-TWC7K3ZX.js +2 -0
  133. package/dist/chunk-TWC7K3ZX.js.map +1 -0
  134. package/dist/chunk-UDQ57ZRX.cjs +2 -0
  135. package/dist/chunk-UDQ57ZRX.cjs.map +1 -0
  136. package/dist/chunk-UI6IFGBT.js +2 -0
  137. package/dist/chunk-UI6IFGBT.js.map +1 -0
  138. package/dist/chunk-UURM7P3P.cjs +4 -0
  139. package/dist/chunk-UURM7P3P.cjs.map +1 -0
  140. package/dist/chunk-W2JAR233.js +2 -0
  141. package/dist/chunk-W2JAR233.js.map +1 -0
  142. package/dist/chunk-WGZ3FNHI.js +2 -0
  143. package/dist/chunk-WGZ3FNHI.js.map +1 -0
  144. package/dist/chunk-WN5CMP4T.cjs +3 -0
  145. package/dist/chunk-WN5CMP4T.cjs.map +1 -0
  146. package/dist/chunk-XEIDV5JP.js +2 -0
  147. package/dist/chunk-XEIDV5JP.js.map +1 -0
  148. package/dist/chunk-XNIWQHXY.js +2 -0
  149. package/dist/chunk-XNIWQHXY.js.map +1 -0
  150. package/dist/chunk-XR7HEC7B.js +5 -0
  151. package/dist/chunk-XR7HEC7B.js.map +1 -0
  152. package/dist/chunk-Y7O4D3BJ.cjs +2 -0
  153. package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
  154. package/dist/chunk-YAYBVVG2.js +3 -0
  155. package/dist/chunk-YAYBVVG2.js.map +1 -0
  156. package/dist/chunk-YJ2OPULK.js +2 -0
  157. package/dist/chunk-YJ2OPULK.js.map +1 -0
  158. package/dist/chunk-YVKHEAFT.js +2 -0
  159. package/dist/chunk-YVKHEAFT.js.map +1 -0
  160. package/dist/chunk-ZCNBT44X.cjs +2 -0
  161. package/dist/chunk-ZCNBT44X.cjs.map +1 -0
  162. package/dist/chunk-ZLRJ7TDP.cjs +2 -0
  163. package/dist/chunk-ZLRJ7TDP.cjs.map +1 -0
  164. package/dist/constants.cjs +1 -21
  165. package/dist/constants.d.cts +1 -1
  166. package/dist/constants.d.ts +1 -1
  167. package/dist/constants.js +1 -4
  168. package/dist/engine.cjs +1 -94
  169. package/dist/engine.d.cts +10 -11
  170. package/dist/engine.d.ts +10 -11
  171. package/dist/engine.js +1 -37
  172. package/dist/errors.cjs +1 -105
  173. package/dist/errors.d.cts +3 -3
  174. package/dist/errors.d.ts +3 -3
  175. package/dist/errors.js +1 -4
  176. package/dist/format.cjs +1 -26
  177. package/dist/format.d.cts +2 -2
  178. package/dist/format.d.ts +2 -2
  179. package/dist/format.js +1 -9
  180. package/dist/index.cjs +1 -314
  181. package/dist/index.cjs.map +1 -1
  182. package/dist/index.d.cts +52 -20
  183. package/dist/index.d.ts +52 -20
  184. package/dist/index.js +1 -278
  185. package/dist/index.js.map +1 -1
  186. package/dist/language.cjs +1 -369
  187. package/dist/language.cjs.map +1 -1
  188. package/dist/language.d.cts +9 -10
  189. package/dist/language.d.ts +9 -10
  190. package/dist/language.js +1 -348
  191. package/dist/language.js.map +1 -1
  192. package/dist/lexer.cjs +1 -63
  193. package/dist/lexer.js +1 -10
  194. package/dist/normalizer.cjs +1 -39
  195. package/dist/normalizer.js +1 -10
  196. package/dist/packages.cjs +1 -132
  197. package/dist/packages.d.cts +8 -9
  198. package/dist/packages.d.ts +8 -9
  199. package/dist/packages.js +1 -23
  200. package/dist/parser.cjs +1 -54
  201. package/dist/parser.d.cts +8 -8
  202. package/dist/parser.d.ts +8 -8
  203. package/dist/parser.js +1 -9
  204. package/dist/{pipeline-D-PS9gVw.d.ts → pipeline-72QmQlGx.d.ts} +1 -1
  205. package/dist/{pipeline-DtSBJ8TS.d.cts → pipeline-DCQicwWX.d.cts} +1 -1
  206. package/dist/resolvers.cjs +1 -12
  207. package/dist/resolvers.d.cts +2 -2
  208. package/dist/resolvers.d.ts +2 -2
  209. package/dist/resolvers.js +1 -3
  210. package/dist/services.cjs +1 -20
  211. package/dist/services.js +1 -3
  212. package/dist/testing.cjs +3 -477
  213. package/dist/testing.cjs.map +1 -1
  214. package/dist/testing.d.cts +9 -10
  215. package/dist/testing.d.ts +9 -10
  216. package/dist/testing.js +3 -469
  217. package/dist/testing.js.map +1 -1
  218. package/dist/uom.cjs +1 -55
  219. package/dist/uom.d.cts +2 -2
  220. package/dist/uom.d.ts +2 -2
  221. package/dist/uom.js +1 -10
  222. package/dist/utilities.cjs +1 -36
  223. package/dist/utilities.js +1 -7
  224. package/dist/vm.cjs +1 -295
  225. package/dist/vm.cjs.map +1 -1
  226. package/dist/vm.d.cts +22 -10
  227. package/dist/vm.d.ts +22 -10
  228. package/dist/vm.js +1 -193
  229. package/dist/vm.js.map +1 -1
  230. package/dist/worker.cjs +2 -492
  231. package/dist/worker.cjs.map +1 -1
  232. package/dist/worker.d.cts +16 -17
  233. package/dist/worker.d.ts +16 -17
  234. package/dist/worker.js +2 -483
  235. package/dist/worker.js.map +1 -1
  236. package/package.json +1 -13
  237. package/dist/chunk-3BOK2LDK.js +0 -17
  238. package/dist/chunk-3BOK2LDK.js.map +0 -1
  239. package/dist/chunk-3VGDNEE3.js +0 -84
  240. package/dist/chunk-3VGDNEE3.js.map +0 -1
  241. package/dist/chunk-4K5W7EH2.cjs +0 -112
  242. package/dist/chunk-4K5W7EH2.cjs.map +0 -1
  243. package/dist/chunk-5EFKSKMA.js +0 -413
  244. package/dist/chunk-5EFKSKMA.js.map +0 -1
  245. package/dist/chunk-5HRB36DK.js +0 -405
  246. package/dist/chunk-5HRB36DK.js.map +0 -1
  247. package/dist/chunk-5ON7PUAZ.js +0 -12
  248. package/dist/chunk-5ON7PUAZ.js.map +0 -1
  249. package/dist/chunk-7AXJNQMF.cjs +0 -297
  250. package/dist/chunk-7AXJNQMF.cjs.map +0 -1
  251. package/dist/chunk-7JM3F4KL.js +0 -1795
  252. package/dist/chunk-7JM3F4KL.js.map +0 -1
  253. package/dist/chunk-7USV76HV.cjs +0 -341
  254. package/dist/chunk-7USV76HV.cjs.map +0 -1
  255. package/dist/chunk-A2DZ5BEJ.cjs +0 -1930
  256. package/dist/chunk-A2DZ5BEJ.cjs.map +0 -1
  257. package/dist/chunk-ADBA3XBE.cjs +0 -20
  258. package/dist/chunk-ADBA3XBE.cjs.map +0 -1
  259. package/dist/chunk-AKNGX4TZ.cjs +0 -236
  260. package/dist/chunk-AKNGX4TZ.cjs.map +0 -1
  261. package/dist/chunk-ALYRJ72W.cjs +0 -434
  262. package/dist/chunk-ALYRJ72W.cjs.map +0 -1
  263. package/dist/chunk-AMOJYLG2.cjs +0 -1692
  264. package/dist/chunk-AMOJYLG2.cjs.map +0 -1
  265. package/dist/chunk-AOH6UR2L.js +0 -825
  266. package/dist/chunk-AOH6UR2L.js.map +0 -1
  267. package/dist/chunk-AQNHHJMJ.cjs +0 -261
  268. package/dist/chunk-B7LXJ6LC.cjs +0 -36
  269. package/dist/chunk-B7LXJ6LC.cjs.map +0 -1
  270. package/dist/chunk-BESTLPRK.cjs +0 -6919
  271. package/dist/chunk-BESTLPRK.cjs.map +0 -1
  272. package/dist/chunk-BLI4NIQY.js +0 -98
  273. package/dist/chunk-BLI4NIQY.js.map +0 -1
  274. package/dist/chunk-BSPXMGIS.js +0 -455
  275. package/dist/chunk-BSPXMGIS.js.map +0 -1
  276. package/dist/chunk-C2OMO3WN.cjs +0 -2806
  277. package/dist/chunk-C2OMO3WN.cjs.map +0 -1
  278. package/dist/chunk-CSDQMDU2.js +0 -204
  279. package/dist/chunk-CSDQMDU2.js.map +0 -1
  280. package/dist/chunk-EJ3ILXX6.cjs +0 -223
  281. package/dist/chunk-EJ3ILXX6.cjs.map +0 -1
  282. package/dist/chunk-ENRIK36Q.cjs +0 -94
  283. package/dist/chunk-ENRIK36Q.cjs.map +0 -1
  284. package/dist/chunk-F4UB4XIL.js +0 -109
  285. package/dist/chunk-F4UB4XIL.js.map +0 -1
  286. package/dist/chunk-FD5ZZHEU.js +0 -92
  287. package/dist/chunk-FD5ZZHEU.js.map +0 -1
  288. package/dist/chunk-FE4RC37D.js +0 -2801
  289. package/dist/chunk-FE4RC37D.js.map +0 -1
  290. package/dist/chunk-FEAIOR7N.cjs +0 -91
  291. package/dist/chunk-FEAIOR7N.cjs.map +0 -1
  292. package/dist/chunk-FR7RNOPT.cjs +0 -3303
  293. package/dist/chunk-FR7RNOPT.cjs.map +0 -1
  294. package/dist/chunk-G2YPPLGX.cjs +0 -484
  295. package/dist/chunk-G2YPPLGX.cjs.map +0 -1
  296. package/dist/chunk-GCM5JHMX.js +0 -88
  297. package/dist/chunk-GCM5JHMX.js.map +0 -1
  298. package/dist/chunk-GDEU72RG.cjs +0 -829
  299. package/dist/chunk-GDEU72RG.cjs.map +0 -1
  300. package/dist/chunk-HKTQCQ4Z.cjs +0 -8383
  301. package/dist/chunk-HKTQCQ4Z.cjs.map +0 -1
  302. package/dist/chunk-HWHU642X.cjs +0 -316
  303. package/dist/chunk-HWHU642X.cjs.map +0 -1
  304. package/dist/chunk-ICEKS6YC.cjs +0 -507
  305. package/dist/chunk-ICEKS6YC.cjs.map +0 -1
  306. package/dist/chunk-IJGOFP2J.js +0 -6904
  307. package/dist/chunk-IJGOFP2J.js.map +0 -1
  308. package/dist/chunk-IQJGDZOP.js +0 -333
  309. package/dist/chunk-IQJGDZOP.js.map +0 -1
  310. package/dist/chunk-IT74O4BE.cjs +0 -456
  311. package/dist/chunk-IT74O4BE.cjs.map +0 -1
  312. package/dist/chunk-KXDQKVNX.cjs +0 -459
  313. package/dist/chunk-KXDQKVNX.cjs.map +0 -1
  314. package/dist/chunk-L2TE7PMO.cjs +0 -14
  315. package/dist/chunk-L2TE7PMO.cjs.map +0 -1
  316. package/dist/chunk-L5YHV6BQ.js +0 -499
  317. package/dist/chunk-L5YHV6BQ.js.map +0 -1
  318. package/dist/chunk-LO7HU5WB.cjs +0 -209
  319. package/dist/chunk-LO7HU5WB.cjs.map +0 -1
  320. package/dist/chunk-LSALB3IN.js +0 -292
  321. package/dist/chunk-LSALB3IN.js.map +0 -1
  322. package/dist/chunk-MI7OTUHL.cjs +0 -339
  323. package/dist/chunk-MI7OTUHL.cjs.map +0 -1
  324. package/dist/chunk-MIGXCBXT.cjs +0 -381
  325. package/dist/chunk-MIGXCBXT.cjs.map +0 -1
  326. package/dist/chunk-MVTOCRV2.js +0 -213
  327. package/dist/chunk-MVTOCRV2.js.map +0 -1
  328. package/dist/chunk-N7FNVFXW.cjs +0 -32
  329. package/dist/chunk-N7FNVFXW.cjs.map +0 -1
  330. package/dist/chunk-N7OA4WPJ.js +0 -362
  331. package/dist/chunk-N7OA4WPJ.js.map +0 -1
  332. package/dist/chunk-NAWZATKT.js +0 -478
  333. package/dist/chunk-NAWZATKT.js.map +0 -1
  334. package/dist/chunk-NLNDMWZC.js +0 -31
  335. package/dist/chunk-NLNDMWZC.js.map +0 -1
  336. package/dist/chunk-ORM7CHYZ.js +0 -1531
  337. package/dist/chunk-ORM7CHYZ.js.map +0 -1
  338. package/dist/chunk-OUHT5Z36.cjs +0 -393
  339. package/dist/chunk-OUHT5Z36.cjs.map +0 -1
  340. package/dist/chunk-PCZVMMWU.cjs +0 -74
  341. package/dist/chunk-PCZVMMWU.cjs.map +0 -1
  342. package/dist/chunk-RNKDIXDV.js +0 -336
  343. package/dist/chunk-RNKDIXDV.js.map +0 -1
  344. package/dist/chunk-SBUFNJVE.js +0 -258
  345. package/dist/chunk-SBUFNJVE.js.map +0 -1
  346. package/dist/chunk-TC6BTUSU.cjs +0 -1799
  347. package/dist/chunk-TC6BTUSU.cjs.map +0 -1
  348. package/dist/chunk-TPOK3UNI.js +0 -8355
  349. package/dist/chunk-TPOK3UNI.js.map +0 -1
  350. package/dist/chunk-UF6JG5SG.js +0 -312
  351. package/dist/chunk-UF6JG5SG.js.map +0 -1
  352. package/dist/chunk-UKQHXPGW.js +0 -30
  353. package/dist/chunk-UKQHXPGW.js.map +0 -1
  354. package/dist/chunk-V4XG5QF6.js +0 -1685
  355. package/dist/chunk-V4XG5QF6.js.map +0 -1
  356. package/dist/chunk-VEKIWQ3F.cjs +0 -39
  357. package/dist/chunk-VEKIWQ3F.cjs.map +0 -1
  358. package/dist/chunk-WMQRJTAO.js +0 -3266
  359. package/dist/chunk-WMQRJTAO.js.map +0 -1
  360. package/dist/chunk-X6K3HUOY.cjs +0 -86
  361. package/dist/chunk-X6K3HUOY.cjs.map +0 -1
  362. package/dist/chunk-XBTEO4OB.js +0 -391
  363. package/dist/chunk-XBTEO4OB.js.map +0 -1
  364. package/dist/chunk-XIYYHA65.cjs +0 -101
  365. package/dist/chunk-XIYYHA65.cjs.map +0 -1
  366. package/dist/chunk-YJHY7CMN.cjs +0 -1534
  367. package/dist/chunk-YLJ4XMA6.js +0 -33
  368. package/dist/chunk-YLJ4XMA6.js.map +0 -1
  369. package/dist/chunk-YNIWOYW6.js +0 -232
  370. package/dist/chunk-YNIWOYW6.js.map +0 -1
  371. package/dist/chunk-Z2XP767T.cjs +0 -35
  372. package/dist/chunk-Z2XP767T.cjs.map +0 -1
  373. package/dist/chunk-Z4X2RWOF.js +0 -37
  374. package/dist/chunk-Z4X2RWOF.js.map +0 -1
  375. package/dist/chunk-ZN6YYPIW.js +0 -67
  376. package/dist/chunk-ZN6YYPIW.js.map +0 -1
  377. package/dist/chunk-ZNFFTYWH.js +0 -1854
  378. package/dist/chunk-ZNFFTYWH.js.map +0 -1
  379. package/dist/variables.cjs +0 -17
  380. package/dist/variables.cjs.map +0 -1
  381. package/dist/variables.d.cts +0 -87
  382. package/dist/variables.d.ts +0 -87
  383. package/dist/variables.js +0 -4
  384. package/dist/variables.js.map +0 -1
@@ -1,339 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkG2YPPLGX_cjs = require('./chunk-G2YPPLGX.cjs');
4
- var chunkOUHT5Z36_cjs = require('./chunk-OUHT5Z36.cjs');
5
- var chunkMIGXCBXT_cjs = require('./chunk-MIGXCBXT.cjs');
6
-
7
- // src/parser/BindingPower.ts
8
- var BindingPower = {
9
- Lowest: 0,
10
- Assignment: 10,
11
- LogicalOr: 12,
12
- // `or`, `||` — loosest of the boolean-logic operators
13
- LogicalAnd: 14,
14
- // `&&` — binds tighter than `or` ("a or b and c" = "a or (b and c)")
15
- // The word "and" (`AND_CONJ`), which is both arithmetic addition ("5 and 3"
16
- // is 8) and boolean conjunction ("true and false"). A phrase parselet
17
- // collecting a list ("average of X, Y and Z") parses each argument at this
18
- // level, and an argument stops at any operator whose power is <= the level it
19
- // was parsed at, so putting "and" here is what makes it end an argument
20
- // rather than be consumed as the addition it also is. Everything an argument
21
- // should keep binds tighter, including a genuine "+" (`Sum`).
22
- //
23
- // It sits BELOW `Conditional` because the boolean reading needs comparisons
24
- // to be its operands: at 28, "5 > 3 and 2 > 1" parsed as "5 > (3 and 2) > 1"
25
- // and answered false. Above `LogicalAnd` so that "and" is still the tighter
26
- // of the two conjunctions, and two steps off each neighbour to leave room.
27
- Conjunction: 16,
28
- // The bitwise trio and the shifts, ordered exactly as C and JavaScript order
29
- // them, which is the order every language that borrowed these operators from
30
- // C uses: `|` looser than `xor`, `xor` looser than `&`, all three looser than
31
- // comparison, and the shifts tighter than comparison but looser than `+`.
32
- // They used to share one level (35) between `Sum` and `Product`, so
33
- // "1 + 2 << 3" answered 17 where JavaScript answers 24 and "4 & 3 + 1"
34
- // answered 1 where JavaScript answers 4. Each has its own level now because
35
- // a shared level makes "4 | 6 & 3" group left instead of letting `&` win.
36
- //
37
- // They stay TIGHTER than `Conjunction` so that a phrase argument parsed at
38
- // that level ("average of 5 | 3, 2 and 4") keeps its bitwise operators
39
- // instead of stopping at the first one.
40
- BitwiseOr: 18,
41
- // `|`
42
- BitwiseXor: 20,
43
- // the `xor` keyword (`BIT_XOR`), not the `^` exponent token
44
- BitwiseAnd: 22,
45
- // `&`
46
- Conditional: 24,
47
- // comparisons (`==`, `<`, `>=`, ...), tighter than the bitwise trio, looser than the shifts
48
- Shift: 27,
49
- // `<<`, `>>`, `>>>`
50
- Sum: 30,
51
- Product: 40,
52
- // `±` (the uncertainty operator), tighter than `+ - * /` and looser than `^`,
53
- // so the tolerance attaches to its adjacent values: `12.3 ± 0.5 * 4` reads as
54
- // `(12.3 ± 0.5) * 4` (the parenthesised headline case), and `2 + 3 ± 0.5` as
55
- // `2 + (3 ± 0.5)`. A Tier-2 parselet (packages/uncertainty/), so this level is
56
- // read off the parselet rather than the Tier-1 BUILTIN_INFIX_BP table below.
57
- Uncertainty: 45,
58
- // `^`, RIGHT-associative: "2 ^ 3 ^ 2" is 2^(3^2) = 512, as in mathematics,
59
- // Python, Ruby and JavaScript's `**`. See PrecedenceParser.parseExpression
60
- // and BinaryOpParselet for the two places that associativity is implemented.
61
- Exponent: 50,
62
- Prefix: 60,
63
- Postfix: 70,
64
- Call: 80
65
- };
66
- var BUILTIN_INFIX_BP = {
67
- // Arithmetic (infix, left-associative)
68
- [chunkG2YPPLGX_cjs.TokenTypes.PLUS]: BindingPower.Sum,
69
- [chunkG2YPPLGX_cjs.TokenTypes.MINUS]: BindingPower.Sum,
70
- [chunkG2YPPLGX_cjs.TokenTypes.STAR]: BindingPower.Product,
71
- [chunkG2YPPLGX_cjs.TokenTypes.SLASH]: BindingPower.Product,
72
- [chunkG2YPPLGX_cjs.TokenTypes.MOD]: BindingPower.Product,
73
- // Arithmetic (infix, RIGHT-associative, PrecedenceParser handles this specially)
74
- [chunkG2YPPLGX_cjs.TokenTypes.CARET]: BindingPower.Exponent,
75
- // Bitwise and shift (infix, left-associative), one level each, ordered as C
76
- // and JavaScript order them. `>>>` used to be missing from this table
77
- // entirely, which left it running at its Tier 2 parselet level while `>>`
78
- // ran at the Tier 1 one, so "16 >> 3 & 1" and "16 >>> 3 & 1" grouped
79
- // differently and answered 0 and 8.
80
- [chunkG2YPPLGX_cjs.TokenTypes.BIT_OR]: BindingPower.BitwiseOr,
81
- [chunkG2YPPLGX_cjs.TokenTypes.BIT_XOR]: BindingPower.BitwiseXor,
82
- [chunkG2YPPLGX_cjs.TokenTypes.BIT_AND]: BindingPower.BitwiseAnd,
83
- [chunkG2YPPLGX_cjs.TokenTypes.LSHIFT]: BindingPower.Shift,
84
- [chunkG2YPPLGX_cjs.TokenTypes.RSHIFT]: BindingPower.Shift,
85
- [chunkG2YPPLGX_cjs.TokenTypes.URSHIFT]: BindingPower.Shift,
86
- // Postfix (no right operand, PrecedenceParser handles this specially)
87
- [chunkG2YPPLGX_cjs.TokenTypes.PERCENT]: BindingPower.Postfix,
88
- // Percentage keyword (infix, left-associative: "50% of 200" → MUL)
89
- [chunkG2YPPLGX_cjs.TokenTypes.OF]: BindingPower.Product
90
- };
91
- var _bpTable = null;
92
- function buildBindingPowerTable() {
93
- if (_bpTable) return _bpTable;
94
- let maxId = 0;
95
- for (const name of Object.keys(BUILTIN_INFIX_BP)) {
96
- const id = chunkG2YPPLGX_cjs.tokenTypeId(name);
97
- if (id > maxId) maxId = id;
98
- }
99
- for (const name of Object.values(chunkG2YPPLGX_cjs.TokenTypes)) {
100
- const id = chunkG2YPPLGX_cjs.tokenTypeId(name);
101
- if (id > maxId) maxId = id;
102
- }
103
- const table = new Uint8Array(maxId + 1);
104
- for (const [name, bp] of Object.entries(BUILTIN_INFIX_BP)) {
105
- const id = chunkG2YPPLGX_cjs.tokenTypeId(name);
106
- table[id] = bp;
107
- }
108
- _bpTable = table;
109
- return table;
110
- }
111
- function invalidateBindingPowerTable() {
112
- _bpTable = null;
113
- }
114
-
115
- // src/parser/BytecodeBuilder.ts
116
- var MAX_CONSTANT_POOL_INDEX = 255;
117
- var BytecodeBuilder = class {
118
- constructor() {
119
- this.opcodes = [];
120
- this.numbers = [];
121
- this.strings = [];
122
- this.stringIndex = /* @__PURE__ */ new Map();
123
- this._hasAsync = false;
124
- this.userFunctionBodies = [];
125
- this.anonymousBodies = [];
126
- }
127
- /** Emit an {@link OpCode} instruction. */
128
- emitOpcode(op) {
129
- this.opcodes.push(op);
130
- if (op === 50 /* CALL_PLUGIN */) {
131
- this._hasAsync = true;
132
- }
133
- }
134
- /**
135
- * Emit a numeric literal: appends `n` to the program's constant pool and
136
- * writes its index into the opcode stream (read back by the VM as e.g.
137
- * `PUSH_NUMBER <idx>`).
138
- *
139
- * Numeric constants are NOT deduplicated (unlike {@link emitString})
140
- * every call appends a new entry, so an expression with more than
141
- * {@link MAX_CONSTANT_POOL_INDEX}+1 distinct numeric-literal occurrences
142
- * throws rather than silently wrapping the index (see
143
- * `MAX_CONSTANT_POOL_INDEX`'s doc for what that would otherwise do).
144
- *
145
- * @throws If the constant pool would exceed 256 entries.
146
- */
147
- emitNumber(n) {
148
- const idx = this.numbers.length;
149
- if (idx > MAX_CONSTANT_POOL_INDEX) {
150
- throw chunkMIGXCBXT_cjs.ErrorFactory.parsing(
151
- "TOO_MANY_NUMERIC_CONSTANTS",
152
- `Expression has more than ${MAX_CONSTANT_POOL_INDEX + 1} numeric literals, exceeding the bytecode constant pool's limit.`,
153
- { limit: MAX_CONSTANT_POOL_INDEX + 1 }
154
- );
155
- }
156
- this.numbers.push(n);
157
- this.opcodes.push(idx);
158
- }
159
- /**
160
- * Emit a string literal: interns `s` into the program's string pool
161
- * (deduplicated via `stringIndex`) and writes its index into the opcode
162
- * stream. Subject to the same constant-pool bound as {@link emitNumber},
163
- * but since strings ARE deduplicated, only distinct string values count
164
- * against the limit.
165
- *
166
- * @throws If the string pool would exceed 256 distinct entries.
167
- */
168
- emitString(s) {
169
- let idx = this.stringIndex.get(s);
170
- if (idx === void 0) {
171
- idx = this.strings.length;
172
- if (idx > MAX_CONSTANT_POOL_INDEX) {
173
- throw chunkMIGXCBXT_cjs.ErrorFactory.parsing(
174
- "TOO_MANY_STRING_CONSTANTS",
175
- `Expression has more than ${MAX_CONSTANT_POOL_INDEX + 1} distinct string literals, exceeding the bytecode constant pool's limit.`,
176
- { limit: MAX_CONSTANT_POOL_INDEX + 1 }
177
- );
178
- }
179
- this.strings.push(s);
180
- this.stringIndex.set(s, idx);
181
- }
182
- this.opcodes.push(idx);
183
- }
184
- /**
185
- * Emit a raw numeric operand (0-255) following an opcode, e.g. a
186
- * plugin-function index for `CALL_PLUGIN`, or an argument count. Unlike
187
- * {@link emitOpcode}, this does not go through the `OpCode` enum, so
188
- * package authors use this (not an unsafe cast to `OpCode`) to push
189
- * operands their own opcode handler expects to read positionally.
190
- */
191
- emitIndex(idx) {
192
- this.opcodes.push(idx);
193
- }
194
- /** Emit a raw byte (0-255), used for fixed small operands like argument counts. */
195
- emitByte(b) {
196
- this.opcodes.push(b);
197
- }
198
- /** Number of opcodes/operands emitted so far, used to compute jump targets before {@link patchJump}. */
199
- get currentLength() {
200
- return this.opcodes.length;
201
- }
202
- /**
203
- * Register a compiled user-defined-function body, returning its index
204
- * into this program's `userFunctionBodies` side-table, the caller emits
205
- * that index as `DEFINE_USER_FUNCTION`'s operand via {@link emitIndex}.
206
- * Subject to the same {@link MAX_CONSTANT_POOL_INDEX} bound as
207
- * {@link emitNumber}/{@link emitString} (the index itself is a single
208
- * opcode-stream byte), in practice a single line defines at most a
209
- * handful of functions, so this limit is never realistically reached.
210
- *
211
- * @throws If more than 256 function bodies are registered on one program.
212
- */
213
- emitUserFunctionBody(name, params, program) {
214
- const idx = this.userFunctionBodies.length;
215
- if (idx > MAX_CONSTANT_POOL_INDEX) {
216
- throw chunkMIGXCBXT_cjs.ErrorFactory.parsing(
217
- "TOO_MANY_FUNCTION_DEFINITIONS",
218
- `More than ${MAX_CONSTANT_POOL_INDEX + 1} function definitions on one line, exceeding the bytecode constant pool's limit.`,
219
- { limit: MAX_CONSTANT_POOL_INDEX + 1 }
220
- );
221
- }
222
- this.userFunctionBodies.push({ name, params, program });
223
- return idx;
224
- }
225
- /**
226
- * Register a compiled `map`/`reduce` anonymous transform body, returning
227
- * its index into this program's `anonymousBodies` side-table, the
228
- * caller emits that index as `MAP_INVOKE`/`REDUCE_INVOKE`'s operand via
229
- * {@link emitIndex}. Same {@link MAX_CONSTANT_POOL_INDEX} bound as
230
- * {@link emitUserFunctionBody}.
231
- *
232
- * @throws If more than 256 anonymous bodies are registered on one program.
233
- */
234
- emitAnonymousBody(params, program) {
235
- const idx = this.anonymousBodies.length;
236
- if (idx > MAX_CONSTANT_POOL_INDEX) {
237
- throw chunkMIGXCBXT_cjs.ErrorFactory.parsing(
238
- "TOO_MANY_ANONYMOUS_BODIES",
239
- `More than ${MAX_CONSTANT_POOL_INDEX + 1} map/reduce transform expressions on one line, exceeding the bytecode constant pool's limit.`,
240
- { limit: MAX_CONSTANT_POOL_INDEX + 1 }
241
- );
242
- }
243
- this.anonymousBodies.push({ params, program });
244
- return idx;
245
- }
246
- /** Overwrite a previously-emitted placeholder operand at `position` with the real jump `target`, once known. */
247
- patchJump(position, target) {
248
- this.opcodes[position] = target;
249
- }
250
- /**
251
- * Build the accumulated opcodes/numbers/strings into a BytecodeProgram.
252
- * Creates new TypedArrays, the builder can be reused after this call.
253
- */
254
- build() {
255
- return {
256
- opcodes: new Uint8Array(this.opcodes),
257
- numbers: new Float64Array(this.numbers),
258
- // Defensive copy: .length = 0 in reset() would clear a shared reference.
259
- // Strings are rare (only UoM/datetime parselets emit them), so the copy
260
- // cost is negligible.
261
- strings: [...this.strings],
262
- constants: /* @__PURE__ */ new Map(),
263
- hasAsync: this._hasAsync,
264
- userFunctionBodies: this.userFunctionBodies.length > 0 ? [...this.userFunctionBodies] : void 0,
265
- anonymousBodies: this.anonymousBodies.length > 0 ? [...this.anonymousBodies] : void 0
266
- };
267
- }
268
- /**
269
- * Build directly into a pre-allocated buffer for zero-copy VM consumption.
270
- *
271
- * When `buf` is provided and large enough, writes into it and returns
272
- * subarray **views** (not copies), the returned TypedArrays share the
273
- * buffer's underlying ArrayBuffer. The caller MUST NOT mutate the buffer
274
- * until the returned BytecodeProgram is no longer needed.
275
- *
276
- * If the caller intends to cache the result, they must copy the TypedArrays
277
- * (e.g. `new Uint8Array(program.opcodes)`) before reusing the buffer pool.
278
- *
279
- * When `buf` is omitted or too small, allocates fresh TypedArrays.
280
- */
281
- buildInto(buf) {
282
- const opLen = this.opcodes.length;
283
- const numLen = this.numbers.length;
284
- const reuseOpcodes = buf && buf.opcodes.length >= opLen;
285
- const reuseNumbers = buf && buf.numbers.length >= numLen;
286
- const opcodes = reuseOpcodes ? new Uint8Array(buf.opcodes.buffer, buf.opcodes.byteOffset, opLen) : new Uint8Array(opLen);
287
- const numbers = reuseNumbers ? new Float64Array(buf.numbers.buffer, buf.numbers.byteOffset, numLen) : new Float64Array(numLen);
288
- for (let i = 0; i < opLen; i++) opcodes[i] = this.opcodes[i];
289
- for (let i = 0; i < numLen; i++) numbers[i] = this.numbers[i];
290
- return {
291
- opcodes,
292
- numbers,
293
- strings: [...this.strings],
294
- constants: /* @__PURE__ */ new Map(),
295
- hasAsync: this._hasAsync,
296
- userFunctionBodies: this.userFunctionBodies.length > 0 ? [...this.userFunctionBodies] : void 0,
297
- anonymousBodies: this.anonymousBodies.length > 0 ? [...this.anonymousBodies] : void 0
298
- };
299
- }
300
- reset() {
301
- this.opcodes.length = 0;
302
- this.numbers.length = 0;
303
- this.strings.length = 0;
304
- this.stringIndex.clear();
305
- this._hasAsync = false;
306
- this.userFunctionBodies.length = 0;
307
- this.anonymousBodies.length = 0;
308
- }
309
- };
310
-
311
- // src/parser/BigIntLiteral.ts
312
- var CHAINED_DOT_THOUSANDS_GROUPS = /^\d{1,3}(\.\d{3}){2,}$/;
313
- var DIGITS_ONLY = /^\d+$/;
314
- function bigIntLiteralDigits(raw, localeCode) {
315
- const withoutSuffix = raw.endsWith("n") ? raw.slice(0, -1) : raw;
316
- if (DIGITS_ONLY.test(withoutSuffix)) return withoutSuffix;
317
- const digits = CHAINED_DOT_THOUSANDS_GROUPS.test(withoutSuffix) ? withoutSuffix.split(".").join("") : stripLocaleGrouping(withoutSuffix, localeCode);
318
- if (!DIGITS_ONLY.test(digits)) {
319
- const separator = withoutSuffix.includes(".") ? "." : withoutSuffix.includes(",") ? "," : withoutSuffix;
320
- throw chunkMIGXCBXT_cjs.ErrorFactory.parsing(
321
- "INVALID_NUMBER_LITERAL",
322
- `"${raw}" is not a whole number: "${separator}" separates decimals in the ${localeCode} locale, and a whole number cannot have a fractional part.`,
323
- { raw, localeCode, separator }
324
- );
325
- }
326
- return digits;
327
- }
328
- function stripLocaleGrouping(text, localeCode) {
329
- const thousandsSeparator = chunkOUHT5Z36_cjs.getLocale(localeCode).display.thousandsSeparator;
330
- return thousandsSeparator ? text.split(thousandsSeparator).join("") : text;
331
- }
332
-
333
- exports.BindingPower = BindingPower;
334
- exports.BytecodeBuilder = BytecodeBuilder;
335
- exports.bigIntLiteralDigits = bigIntLiteralDigits;
336
- exports.buildBindingPowerTable = buildBindingPowerTable;
337
- exports.invalidateBindingPowerTable = invalidateBindingPowerTable;
338
- //# sourceMappingURL=chunk-MI7OTUHL.cjs.map
339
- //# sourceMappingURL=chunk-MI7OTUHL.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/parser/BindingPower.ts","../src/parser/BytecodeBuilder.ts","../src/parser/BigIntLiteral.ts"],"names":["TokenTypes","tokenTypeId","ErrorFactory","getLocale"],"mappings":";;;;;;;AAWO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAA,EAAQ,CAAA;AAAA,EACR,UAAA,EAAY,EAAA;AAAA,EACZ,SAAA,EAA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C,EAAA,MAAM,MAAA,GAAS,4BAAA,CAA6B,IAAA,CAAK,aAAa,IAC3D,aAAA,CAAc,KAAA,CAAM,GAAG,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA,GAChC,mBAAA,CAAoB,eAAe,UAAU,CAAA;AAEhD,EAAA,IAAI,CAAC,WAAA,CAAY,IAAA,CAAK,MAAM,CAAA,EAAG;AAC9B,IAAA,MAAM,SAAA,GAAY,aAAA,CAAc,QAAA,CAAS,GAAG,CAAA,GAAI,MAAM,aAAA,CAAc,QAAA,CAAS,GAAG,CAAA,GAAI,GAAA,GAAM,aAAA;AAC1F,IAAA,MAAMA,8BAAA,CAAa,OAAA;AAAA,MAClB,wBAAA;AAAA,MACA,CAAA,CAAA,EAAI,GAAG,CAAA,0BAAA,EAA6B,SAAS,+BAA+B,UAAU,CAAA,0DAAA,CAAA;AAAA,MACtF,EAAE,GAAA,EAAK,UAAA,EAAY,SAAA;AAAU,KAC9B;AAAA,EACD;AACA,EAAA,OAAO,MAAA;AACR;AASA,SAAS,mBAAA,CAAoB,MAAc,UAAA,EAA4B;AACtE,EAAA,MAAM,kBAAA,GAAqBC,2BAAA,CAAU,UAAU,CAAA,CAAE,OAAA,CAAQ,kBAAA;AACzD,EAAA,OAAO,qBAAqB,IAAA,CAAK,KAAA,CAAM,kBAAkB,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA,GAAI,IAAA;AACvE","file":"chunk-MI7OTUHL.cjs","sourcesContent":["/**\n * Named precedence levels for the Pratt parser, from loosest (`Lowest`) to\n * tightest (`Call`) binding. A custom infix parselet compares its own\n * binding power against the current expression's to decide whether to\n * consume the next operator (higher power binds tighter, e.g. `*` over `+`).\n *\n * Package authors reference these when registering an infix parselet via\n * `IPackageRegistry.registerInfixParselet`. See the built-in packages for\n * examples of picking an appropriate level (e.g. arithmetic `+`/`-` use\n * `Sum`, `*`/`/` use `Product`).\n */\nexport const BindingPower = {\n Lowest: 0,\n Assignment: 10,\n LogicalOr: 12, // `or`, `||` — loosest of the boolean-logic operators\n LogicalAnd: 14, // `&&` — binds tighter than `or` (\"a or b and c\" = \"a or (b and c)\")\n // The word \"and\" (`AND_CONJ`), which is both arithmetic addition (\"5 and 3\"\n // is 8) and boolean conjunction (\"true and false\"). A phrase parselet\n // collecting a list (\"average of X, Y and Z\") parses each argument at this\n // level, and an argument stops at any operator whose power is <= the level it\n // was parsed at, so putting \"and\" here is what makes it end an argument\n // rather than be consumed as the addition it also is. Everything an argument\n // should keep binds tighter, including a genuine \"+\" (`Sum`).\n //\n // It sits BELOW `Conditional` because the boolean reading needs comparisons\n // to be its operands: at 28, \"5 > 3 and 2 > 1\" parsed as \"5 > (3 and 2) > 1\"\n // and answered false. Above `LogicalAnd` so that \"and\" is still the tighter\n // of the two conjunctions, and two steps off each neighbour to leave room.\n Conjunction: 16,\n // The bitwise trio and the shifts, ordered exactly as C and JavaScript order\n // them, which is the order every language that borrowed these operators from\n // C uses: `|` looser than `xor`, `xor` looser than `&`, all three looser than\n // comparison, and the shifts tighter than comparison but looser than `+`.\n // They used to share one level (35) between `Sum` and `Product`, so\n // \"1 + 2 << 3\" answered 17 where JavaScript answers 24 and \"4 & 3 + 1\"\n // answered 1 where JavaScript answers 4. Each has its own level now because\n // a shared level makes \"4 | 6 & 3\" group left instead of letting `&` win.\n //\n // They stay TIGHTER than `Conjunction` so that a phrase argument parsed at\n // that level (\"average of 5 | 3, 2 and 4\") keeps its bitwise operators\n // instead of stopping at the first one.\n BitwiseOr: 18, // `|`\n BitwiseXor: 20, // the `xor` keyword (`BIT_XOR`), not the `^` exponent token\n BitwiseAnd: 22, // `&`\n Conditional: 24, // comparisons (`==`, `<`, `>=`, ...), tighter than the bitwise trio, looser than the shifts\n Shift: 27, // `<<`, `>>`, `>>>`\n Sum: 30,\n Product: 40,\n // `±` (the uncertainty operator), tighter than `+ - * /` and looser than `^`,\n // so the tolerance attaches to its adjacent values: `12.3 ± 0.5 * 4` reads as\n // `(12.3 ± 0.5) * 4` (the parenthesised headline case), and `2 + 3 ± 0.5` as\n // `2 + (3 ± 0.5)`. A Tier-2 parselet (packages/uncertainty/), so this level is\n // read off the parselet rather than the Tier-1 BUILTIN_INFIX_BP table below.\n Uncertainty: 45,\n // `^`, RIGHT-associative: \"2 ^ 3 ^ 2\" is 2^(3^2) = 512, as in mathematics,\n // Python, Ruby and JavaScript's `**`. See PrecedenceParser.parseExpression\n // and BinaryOpParselet for the two places that associativity is implemented.\n Exponent: 50,\n Prefix: 60,\n Postfix: 70,\n Call: 80,\n} as const;\n\n/**\n * Set the binding power of a named operator.\n *\n * Binding power is what decides precedence in the Pratt parser: a higher number\n * binds tighter, so `*` outranks `+`. Changing one changes how every existing\n * expression using that operator parses, which is why packages should allocate\n * a new name rather than adjust a built-in.\n *\n * @param name - Operator name.\n * @param power - Higher binds tighter.\n */\nexport function setBindingPower(name: string, power: number): void {\n (BindingPower as Record<string, number>)[name] = power;\n}\n\n/**\n * Read the binding power of a named operator.\n *\n * @param name - Operator name.\n * @returns Its binding power, or 0 when the name is unknown, which makes an\n * unregistered operator terminate an expression rather than swallow the rest\n * of it.\n */\nexport function getBindingPower(name: string): number {\n return (BindingPower as Record<string, number>)[name] ?? 0;\n}\n\n// ── Built-in Infix Operator Binding Power Table ──────────────────────────────\n// Pre-computed Uint8Array lookup indexed by token typeId.\n// value > 0 → built-in infix operator with that binding power\n// value = 0 → not a built-in infix, fall through to Tier 2 parselet registry\n//\n// Built at module load via buildBindingPowerTable(). The table is sparse\n// most entries are 0 since only ~15 of 80+ token types are infix operators.\n//\n// Performance: Uint8Array[typeId] is a single typed array load, no Map.get()\n// no string hashing, no property chain. V8 eliminates bounds checks when typeId\n// is known to be within array length.\n\nimport { TokenTypes } from \"@solve-js/lexer/Token\";\nimport { tokenTypeId } from \"@solve-js/lexer/Token\";\n\n/**\n * Mapping of token type names → binding powers for built-in infix operators.\n * Only operators listed here get the Tier 1 fast path in PrecedenceParser.\n * All other infix tokens use the Tier 2 parselet registry fallback.\n */\nconst BUILTIN_INFIX_BP: Record<string, number> = {\n // Arithmetic (infix, left-associative)\n [TokenTypes.PLUS]: BindingPower.Sum,\n [TokenTypes.MINUS]: BindingPower.Sum,\n [TokenTypes.STAR]: BindingPower.Product,\n [TokenTypes.SLASH]: BindingPower.Product,\n [TokenTypes.MOD]: BindingPower.Product,\n\n // Arithmetic (infix, RIGHT-associative, PrecedenceParser handles this specially)\n [TokenTypes.CARET]: BindingPower.Exponent,\n\n // Bitwise and shift (infix, left-associative), one level each, ordered as C\n // and JavaScript order them. `>>>` used to be missing from this table\n // entirely, which left it running at its Tier 2 parselet level while `>>`\n // ran at the Tier 1 one, so \"16 >> 3 & 1\" and \"16 >>> 3 & 1\" grouped\n // differently and answered 0 and 8.\n [TokenTypes.BIT_OR]: BindingPower.BitwiseOr,\n [TokenTypes.BIT_XOR]: BindingPower.BitwiseXor,\n [TokenTypes.BIT_AND]: BindingPower.BitwiseAnd,\n [TokenTypes.LSHIFT]: BindingPower.Shift,\n [TokenTypes.RSHIFT]: BindingPower.Shift,\n [TokenTypes.URSHIFT]: BindingPower.Shift,\n\n // Postfix (no right operand, PrecedenceParser handles this specially)\n [TokenTypes.PERCENT]: BindingPower.Postfix,\n\n // Percentage keyword (infix, left-associative: \"50% of 200\" → MUL)\n [TokenTypes.OF]: BindingPower.Product,\n};\n\n// Note: These token types are intentionally NOT in the BP_TABLE, they stay in\n// the Tier 2 parselet registry because they require complex handling:\n// IN, TO → UoM conversion parselets (peek at target unit token, complex logic)\n// DOT → Property access (chained OBJ_GET, needs left-token tracking)\n// EQUALS → Assignment (VariableParselet handles :var = expr pattern)\n// EQUALITY, NEQ, GTE, LTE → Comparison ops (need dedicated VM opcodes, task 2.15a)\n// COMMA → Argument separator (function calls, array/object literals)\n\n/** Cached BP_TABLE, built once at module load, immutable thereafter. */\nlet _bpTable: Uint8Array | null = null;\n\n/**\n * Build the Uint8Array binding power table indexed by token typeId.\n * Idempotent, returns cached table on subsequent calls.\n *\n * Must be called after all token types are registered (via registerAllTokenTypes())\n * and after plugin providers have registered their token types.\n */\nexport function buildBindingPowerTable(): Uint8Array {\n if (_bpTable) return _bpTable;\n\n // Size to the largest registered typeId + 1\n let maxId = 0;\n for (const name of Object.keys(BUILTIN_INFIX_BP)) {\n const id = tokenTypeId(name);\n if (id > maxId) maxId = id;\n }\n // Also scan all TokenTypes to ensure table covers all registered IDs\n for (const name of Object.values(TokenTypes)) {\n const id = tokenTypeId(name);\n if (id > maxId) maxId = id;\n }\n\n const table = new Uint8Array(maxId + 1);\n for (const [name, bp] of Object.entries(BUILTIN_INFIX_BP)) {\n const id = tokenTypeId(name);\n table[id] = bp;\n }\n\n _bpTable = table;\n return table;\n}\n\n/**\n * Drop the cached table, so the next {@link buildBindingPowerTable} call builds\n * a fresh one sized to the token types registered by then.\n *\n * It does NOT add a plugin's operator to the Tier 1 fast path, which is what\n * this comment used to promise. The values in the table come from\n * `BUILTIN_INFIX_BP`, which is module-private and has no registration path, so\n * a rebuilt table holds the same binding powers and a plugin token still reads\n * 0. `PrecedenceParser.BP_TABLE` is a static initialized once at class\n * definition time and never re-read, so it would not see a rebuild anyway.\n *\n * A plugin's infix operator takes the Tier 2 parselet-registry route instead,\n * which is where an operator whose binding power the engine does not already\n * know is meant to live.\n */\nexport function invalidateBindingPowerTable(): void {\n _bpTable = null;\n}\n","import { OpCode } from \"@solve-js/parser/OpCode\";\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n/**\n * `BytecodeProgram.opcodes` is a `Uint8Array`, every operand written into\n * it (including constant-pool indices from {@link BytecodeBuilder.emitNumber}/\n * {@link BytecodeBuilder.emitString}) is truncated to a single byte on\n * `build()`. Exceeding this silently wraps the index (e.g. entry 300 reads\n * back as entry 44), producing a wrong result with no error. See\n * {@link BytecodeBuilder.emitNumber} for the guard that turns this into a\n * thrown error instead.\n */\nconst MAX_CONSTANT_POOL_INDEX = 255;\n\n/**\n * Compiled bytecode program produced by {@link BytecodeBuilder}.\n * Ready for consumption by {@link executeBytecode} without further processing.\n */\nexport interface BytecodeProgram {\n\topcodes: Uint8Array;\n\tnumbers: Float64Array;\n\tstrings: string[];\n\tconstants?: Map<number, number>;\n\t/**\n\t * Whether the program contains any async opcodes (CALL_PLUGIN, etc.).\n\t * Set during compilation by the BytecodeBuilder. Allows the engine\n\t * to skip the O(n) resolver preflight check in O(1) for purely\n\t * synchronous expressions like `2 + 2`.\n\t */\n\thasAsync: boolean;\n\t/**\n\t * User-defined-function bodies compiled alongside this program (one\n\t * entry per `name(params) = body` definition on this line). See\n\t * {@link BytecodeBuilder.emitUserFunctionBody}. `OpCode.DEFINE_USER_FUNCTION`'s\n\t * operand is an index into this array, resolved at VM-execution time\n\t * (not parse time) so a diagnostic/lookahead parse that never actually\n\t * executes the definition line has no side effect on `vm.userFunctions`.\n\t */\n\tuserFunctionBodies?: UserFunctionDef[];\n\t/**\n\t * Anonymous function bodies compiled alongside this program, one entry\n\t * per `map`/`reduce` inline transform expression (e.g. the `10*x` in\n\t * `map(10*x, [0,1,500])`). See {@link BytecodeBuilder.emitAnonymousBody}.\n\t * Deliberately a SEPARATE side-table from `userFunctionBodies`, not\n\t * routed through `vm.userFunctions` at all: an inline body has no name\n\t * and must never leak into the persistent name-keyed registry the way\n\t * a real `f(x) = ...` definition does.\n\t */\n\tanonymousBodies?: AnonymousBodyDef[];\n}\n\n/**\n * An anonymous transform body for `map`/`reduce`'s inline-expression form\n * (e.g. `10*x` in `map(10*x, [0,1,500])`, or `acc+x` in `reduce(acc+x,\n * [1,2,3])`). Structurally identical to {@link UserFunctionDef} minus the\n * `name`. See `OpCode.MAP_INVOKE`/`REDUCE_INVOKE` and\n * `vm/VM.ts`'s handlers, which build a call frame from `params`/`args`\n * exactly like `CALL_USER_FUNCTION` does, just without ever registering\n * the body in `vm.userFunctions`.\n */\nexport interface AnonymousBodyDef {\n\tparams: string[];\n\tprogram: BytecodeProgram;\n}\n\n/**\n * A user-defined, parameterized, reusable function's compiled form\n * (`f(x) = 2*x + 1`). See `OpCode.DEFINE_USER_FUNCTION`/`CALL_USER_FUNCTION`\n * and `vm/VM.ts`'s `VM.defineUserFunction`/`getUserFunction`.\n *\n * `program` is the body compiled to its OWN independent `BytecodeProgram`,\n * not a fragment of the definition line's own bytecode. Parameter names\n * inside the body compile to ORDINARY `LOAD_VAR <name>` opcodes, no\n * parse-time rewriting, because parameter resolution happens dynamically\n * at the VM level: `CALL_USER_FUNCTION` pushes a name-keyed call frame\n * (`Map<string, Value>`) before re-executing `program`, and `VM.getVar()`\n * checks the innermost call frame before falling back to the flat\n * document-variable store. This is why a `UNIT`-collision parameter name\n * (e.g. `h` in `area(w, h) = w * h`, which lexes as the \"hour\" unit) needs\n * no special handling anywhere, it's just another `LOAD_VAR \"h\"`, resolved\n * the same way as any other name.\n */\nexport interface UserFunctionDef {\n\tname: string;\n\tparams: string[];\n\tprogram: BytecodeProgram;\n}\n\n/**\n * Direct-to-bytecode compiler for the Pratt parser.\n *\n * Accumulates opcodes, numeric constants, and string references during parsing,\n * then produces a {@link BytecodeProgram} for VM execution. Supports:\n * - Standard build via {@link build}\n * - Zero-copy build into pre-allocated buffers via {@link buildInto}\n * - In-place reset for reuse without reallocation\n */\nexport class BytecodeBuilder {\n\tprivate opcodes: number[] = [];\n\tprivate numbers: number[] = [];\n\tprivate strings: string[] = [];\n\tprivate stringIndex = new Map<string, number>();\n\tprivate _hasAsync = false;\n\tprivate userFunctionBodies: UserFunctionDef[] = [];\n\tprivate anonymousBodies: AnonymousBodyDef[] = [];\n\n\t/** Emit an {@link OpCode} instruction. */\n\temitOpcode(op: OpCode): void {\n\t\tthis.opcodes.push(op);\n\t\tif (op === OpCode.CALL_PLUGIN) {\n\t\t\tthis._hasAsync = true;\n\t\t}\n\t}\n\n\t/**\n\t * Emit a numeric literal: appends `n` to the program's constant pool and\n\t * writes its index into the opcode stream (read back by the VM as e.g.\n\t * `PUSH_NUMBER <idx>`).\n\t *\n\t * Numeric constants are NOT deduplicated (unlike {@link emitString})\n\t * every call appends a new entry, so an expression with more than\n\t * {@link MAX_CONSTANT_POOL_INDEX}+1 distinct numeric-literal occurrences\n\t * throws rather than silently wrapping the index (see\n\t * `MAX_CONSTANT_POOL_INDEX`'s doc for what that would otherwise do).\n\t *\n\t * @throws If the constant pool would exceed 256 entries.\n\t */\n\temitNumber(n: number): void {\n\t\tconst idx = this.numbers.length;\n\t\tif (idx > MAX_CONSTANT_POOL_INDEX) {\n\t\t\tthrow ErrorFactory.parsing(\n\t\t\t\t\"TOO_MANY_NUMERIC_CONSTANTS\",\n\t\t\t\t`Expression has more than ${MAX_CONSTANT_POOL_INDEX + 1} numeric literals, exceeding the bytecode constant pool's limit.`,\n\t\t\t\t{ limit: MAX_CONSTANT_POOL_INDEX + 1 }\n\t\t\t);\n\t\t}\n\t\tthis.numbers.push(n);\n\t\tthis.opcodes.push(idx);\n\t}\n\n\t/**\n\t * Emit a string literal: interns `s` into the program's string pool\n\t * (deduplicated via `stringIndex`) and writes its index into the opcode\n\t * stream. Subject to the same constant-pool bound as {@link emitNumber},\n\t * but since strings ARE deduplicated, only distinct string values count\n\t * against the limit.\n\t *\n\t * @throws If the string pool would exceed 256 distinct entries.\n\t */\n\temitString(s: string): void {\n\t\tlet idx = this.stringIndex.get(s);\n\t\tif (idx === undefined) {\n\t\t\tidx = this.strings.length;\n\t\t\tif (idx > MAX_CONSTANT_POOL_INDEX) {\n\t\t\t\tthrow ErrorFactory.parsing(\n\t\t\t\t\t\"TOO_MANY_STRING_CONSTANTS\",\n\t\t\t\t\t`Expression has more than ${MAX_CONSTANT_POOL_INDEX + 1} distinct string literals, exceeding the bytecode constant pool's limit.`,\n\t\t\t\t\t{ limit: MAX_CONSTANT_POOL_INDEX + 1 }\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.strings.push(s);\n\t\t\tthis.stringIndex.set(s, idx);\n\t\t}\n\t\tthis.opcodes.push(idx);\n\t}\n\n\t/**\n\t * Emit a raw numeric operand (0-255) following an opcode, e.g. a\n\t * plugin-function index for `CALL_PLUGIN`, or an argument count. Unlike\n\t * {@link emitOpcode}, this does not go through the `OpCode` enum, so\n\t * package authors use this (not an unsafe cast to `OpCode`) to push\n\t * operands their own opcode handler expects to read positionally.\n\t */\n\temitIndex(idx: number): void {\n\t\tthis.opcodes.push(idx);\n\t}\n\n\t/** Emit a raw byte (0-255), used for fixed small operands like argument counts. */\n\temitByte(b: number): void {\n\t\tthis.opcodes.push(b);\n\t}\n\n\t/** Number of opcodes/operands emitted so far, used to compute jump targets before {@link patchJump}. */\n\tget currentLength(): number {\n\t\treturn this.opcodes.length;\n\t}\n\n\t/**\n\t * Register a compiled user-defined-function body, returning its index\n\t * into this program's `userFunctionBodies` side-table, the caller emits\n\t * that index as `DEFINE_USER_FUNCTION`'s operand via {@link emitIndex}.\n\t * Subject to the same {@link MAX_CONSTANT_POOL_INDEX} bound as\n\t * {@link emitNumber}/{@link emitString} (the index itself is a single\n\t * opcode-stream byte), in practice a single line defines at most a\n\t * handful of functions, so this limit is never realistically reached.\n\t *\n\t * @throws If more than 256 function bodies are registered on one program.\n\t */\n\temitUserFunctionBody(name: string, params: string[], program: BytecodeProgram): number {\n\t\tconst idx = this.userFunctionBodies.length;\n\t\tif (idx > MAX_CONSTANT_POOL_INDEX) {\n\t\t\tthrow ErrorFactory.parsing(\n\t\t\t\t\"TOO_MANY_FUNCTION_DEFINITIONS\",\n\t\t\t\t`More than ${MAX_CONSTANT_POOL_INDEX + 1} function definitions on one line, exceeding the bytecode constant pool's limit.`,\n\t\t\t\t{ limit: MAX_CONSTANT_POOL_INDEX + 1 }\n\t\t\t);\n\t\t}\n\t\tthis.userFunctionBodies.push({ name, params, program });\n\t\treturn idx;\n\t}\n\n\t/**\n\t * Register a compiled `map`/`reduce` anonymous transform body, returning\n\t * its index into this program's `anonymousBodies` side-table, the\n\t * caller emits that index as `MAP_INVOKE`/`REDUCE_INVOKE`'s operand via\n\t * {@link emitIndex}. Same {@link MAX_CONSTANT_POOL_INDEX} bound as\n\t * {@link emitUserFunctionBody}.\n\t *\n\t * @throws If more than 256 anonymous bodies are registered on one program.\n\t */\n\temitAnonymousBody(params: string[], program: BytecodeProgram): number {\n\t\tconst idx = this.anonymousBodies.length;\n\t\tif (idx > MAX_CONSTANT_POOL_INDEX) {\n\t\t\tthrow ErrorFactory.parsing(\n\t\t\t\t\"TOO_MANY_ANONYMOUS_BODIES\",\n\t\t\t\t`More than ${MAX_CONSTANT_POOL_INDEX + 1} map/reduce transform expressions on one line, exceeding the bytecode constant pool's limit.`,\n\t\t\t\t{ limit: MAX_CONSTANT_POOL_INDEX + 1 }\n\t\t\t);\n\t\t}\n\t\tthis.anonymousBodies.push({ params, program });\n\t\treturn idx;\n\t}\n\n\t/** Overwrite a previously-emitted placeholder operand at `position` with the real jump `target`, once known. */\n\tpatchJump(position: number, target: number): void {\n\t\tthis.opcodes[position] = target;\n\t}\n\n\t/**\n\t * Build the accumulated opcodes/numbers/strings into a BytecodeProgram.\n\t * Creates new TypedArrays, the builder can be reused after this call.\n\t */\n\tbuild(): BytecodeProgram {\n\t\treturn {\n\t\t\topcodes: new Uint8Array(this.opcodes),\n\t\t\tnumbers: new Float64Array(this.numbers),\n\t\t\t// Defensive copy: .length = 0 in reset() would clear a shared reference.\n\t\t\t// Strings are rare (only UoM/datetime parselets emit them), so the copy\n\t\t\t// cost is negligible.\n\t\t\tstrings: [...this.strings],\n\t\t\tconstants: new Map(),\n\t\t\thasAsync: this._hasAsync,\n\t\t\tuserFunctionBodies: this.userFunctionBodies.length > 0 ? [...this.userFunctionBodies] : undefined,\n\t\t\tanonymousBodies: this.anonymousBodies.length > 0 ? [...this.anonymousBodies] : undefined,\n\t\t};\n\t}\n\n\t/**\n\t * Build directly into a pre-allocated buffer for zero-copy VM consumption.\n\t *\n\t * When `buf` is provided and large enough, writes into it and returns\n\t * subarray **views** (not copies), the returned TypedArrays share the\n\t * buffer's underlying ArrayBuffer. The caller MUST NOT mutate the buffer\n\t * until the returned BytecodeProgram is no longer needed.\n\t *\n\t * If the caller intends to cache the result, they must copy the TypedArrays\n\t * (e.g. `new Uint8Array(program.opcodes)`) before reusing the buffer pool.\n\t *\n\t * When `buf` is omitted or too small, allocates fresh TypedArrays.\n\t */\n\tbuildInto(buf?: { opcodes: Uint8Array; numbers: Float64Array }): BytecodeProgram {\n\t\tconst opLen = this.opcodes.length;\n\t\tconst numLen = this.numbers.length;\n\n\t\tconst reuseOpcodes = buf && buf.opcodes.length >= opLen;\n\t\tconst reuseNumbers = buf && buf.numbers.length >= numLen;\n\n\t\t// Subarray views that share the buffer's ArrayBuffer (zero-copy)\n\t\tconst opcodes = reuseOpcodes\n\t\t\t? new Uint8Array(buf!.opcodes.buffer, buf!.opcodes.byteOffset, opLen)\n\t\t\t: new Uint8Array(opLen);\n\t\tconst numbers = reuseNumbers\n\t\t\t? new Float64Array(buf!.numbers.buffer, buf!.numbers.byteOffset, numLen)\n\t\t\t: new Float64Array(numLen);\n\n\t\t// Write data into the views\n\t\tfor (let i = 0; i < opLen; i++) opcodes[i] = this.opcodes[i];\n\t\tfor (let i = 0; i < numLen; i++) numbers[i] = this.numbers[i];\n\n\t\treturn {\n\t\t\topcodes,\n\t\t\tnumbers,\n\t\t\tstrings: [...this.strings],\n\t\t\tconstants: new Map(),\n\t\t\thasAsync: this._hasAsync,\n\t\t\tuserFunctionBodies: this.userFunctionBodies.length > 0 ? [...this.userFunctionBodies] : undefined,\n\t\t\tanonymousBodies: this.anonymousBodies.length > 0 ? [...this.anonymousBodies] : undefined,\n\t\t};\n\t}\n\n\treset(): void {\n\t\t// Retain backing stores with .length = 0 to avoid reallocation on growth.\n\t\t// = [] discards the ArrayBuffer, forcing V8 to reallocate on every push()\n\t\t// threshold (4→8→16→32...). For a 50-opcode expression, that's 3-4 copies.\n\t\tthis.opcodes.length = 0;\n\t\tthis.numbers.length = 0;\n\t\tthis.strings.length = 0;\n\t\tthis.stringIndex.clear();\n\t\tthis._hasAsync = false;\n\t\tthis.userFunctionBodies.length = 0;\n\t\tthis.anonymousBodies.length = 0;\n\t}\n}\n","/**\n * Turning a `123n` literal's source text into the digits `PUSH_BIGINT` stores.\n *\n * The lexer coalesces thousands groups into the number token it is building,\n * accepting both `,` and `.` as the separator regardless of locale (see\n * `lexer/ExpressionLexer.ts`'s \"Thousands separators\" block). For a NUMBER that\n * is fine, because the separators are stripped again when the text is turned\n * into a double. For a BIGINT nothing stripped them: both consumers took the\n * token text, removed the trailing `n`, and handed the rest straight to\n * `BigInt()`.\n *\n * So `1.000n` reached `BigInt(\"1.000\")`, which throws a raw `SyntaxError` that\n * arrived at the host as UNEXPECTED_ERROR/INTERNAL: the engine reporting its\n * own bug for six characters a user typed. `1.01n` and `1.1n` were fine, which\n * is the tell that the `n` suffix was never the problem, the three-digit\n * thousands group was: a dot followed by exactly three digits is what the lexer\n * swallows, and one followed by one or two digits it leaves alone.\n *\n * Written once here rather than inline at both call sites. There are two\n * (`parser/PrecedenceParser.ts`'s Tier-1 switch and\n * `packages/biginteger/parselets/BigIntNumberParselet.ts`), they already held\n * identical copies of the `n`-stripping, and the two tiers disagreeing about a\n * literal is a bug shape this codebase has had before.\n *\n * @module BigIntLiteral\n */\n\nimport { getLocale } from \"@solve-js/constants/locales\";\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n/**\n * Two or more dot-separated groups of three, e.g. `1.234.567`.\n *\n * Unambiguous in any locale, since no locale writes two decimal points, so this\n * is stripped without consulting one. Same regex and same reasoning as\n * `NumberParselet.ts`'s copy for the NUMBER path.\n */\nconst CHAINED_DOT_THOUSANDS_GROUPS = /^\\d{1,3}(\\.\\d{3}){2,}$/;\n\n/** Digits and nothing else, which is what `BigInt()` can be handed safely. */\nconst DIGITS_ONLY = /^\\d+$/;\n\n/**\n * The digit string behind a bigint literal.\n *\n * A bigint literal has no fractional part by construction: the lexer only emits\n * BIGINT when it saw no decimal point of its own and no exponent, so any `.` or\n * `,` still in the text got there as a thousands group. Which of the two the\n * writer meant is a locale question, and answering it wrongly would silently\n * change the value by three orders of magnitude, so only the separator this\n * locale actually uses for grouping is removed. Anything left over is refused\n * rather than guessed at.\n *\n * @param raw - The token's text, with or without the trailing `n`.\n * @param localeCode - The engine's active locale.\n * @returns A string of digits, ready for `BigInt()`.\n * @throws An `INVALID_NUMBER_LITERAL` parsing error when what is left is not a\n * whole number, e.g. `1.000n` in a locale that writes decimals with a dot.\n */\nexport function bigIntLiteralDigits(raw: string, localeCode: string): string {\n\tconst withoutSuffix = raw.endsWith(\"n\") ? raw.slice(0, -1) : raw;\n\n\t// The common case first: nothing was grouped, so there is nothing to decide.\n\tif (DIGITS_ONLY.test(withoutSuffix)) return withoutSuffix;\n\n\tconst digits = CHAINED_DOT_THOUSANDS_GROUPS.test(withoutSuffix)\n\t\t? withoutSuffix.split(\".\").join(\"\")\n\t\t: stripLocaleGrouping(withoutSuffix, localeCode);\n\n\tif (!DIGITS_ONLY.test(digits)) {\n\t\tconst separator = withoutSuffix.includes(\".\") ? \".\" : withoutSuffix.includes(\",\") ? \",\" : withoutSuffix;\n\t\tthrow ErrorFactory.parsing(\n\t\t\t\"INVALID_NUMBER_LITERAL\",\n\t\t\t`\"${raw}\" is not a whole number: \"${separator}\" separates decimals in the ${localeCode} locale, and a whole number cannot have a fractional part.`,\n\t\t\t{ raw, localeCode, separator },\n\t\t);\n\t}\n\treturn digits;\n}\n\n/**\n * Removes the active locale's own thousands separator and nothing else.\n *\n * @param text - The literal without its `n`.\n * @param localeCode - The engine's active locale.\n * @returns The text with grouping removed, which the caller then re-checks.\n */\nfunction stripLocaleGrouping(text: string, localeCode: string): string {\n\tconst thousandsSeparator = getLocale(localeCode).display.thousandsSeparator;\n\treturn thousandsSeparator ? text.split(thousandsSeparator).join(\"\") : text;\n}\n"]}