solve-engine 1.2.0 → 2.1.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 (385) 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-2LFLR3VZ.cjs +2 -0
  25. package/dist/chunk-2LFLR3VZ.cjs.map +1 -0
  26. package/dist/chunk-2RWAXT6O.js +0 -1
  27. package/dist/chunk-32GC2FHC.cjs +2 -0
  28. package/dist/chunk-32GC2FHC.cjs.map +1 -0
  29. package/dist/chunk-4BZIYU7S.cjs +3 -0
  30. package/dist/chunk-4BZIYU7S.cjs.map +1 -0
  31. package/dist/chunk-4E4YVQKK.js +5 -0
  32. package/dist/chunk-4E4YVQKK.js.map +1 -0
  33. package/dist/chunk-4QVBSG6B.cjs +2 -0
  34. package/dist/chunk-4QVBSG6B.cjs.map +1 -0
  35. package/dist/chunk-5FO4PDIG.js +2 -0
  36. package/dist/chunk-5FO4PDIG.js.map +1 -0
  37. package/dist/chunk-5IJD5L3O.cjs +2 -0
  38. package/dist/chunk-5IJD5L3O.cjs.map +1 -0
  39. package/dist/chunk-62LMTO4F.js +2 -0
  40. package/dist/chunk-62LMTO4F.js.map +1 -0
  41. package/dist/chunk-6G3PMEPA.js +2 -0
  42. package/dist/chunk-6G3PMEPA.js.map +1 -0
  43. package/dist/chunk-6INX773F.cjs +2 -0
  44. package/dist/chunk-6INX773F.cjs.map +1 -0
  45. package/dist/chunk-76F3LCIL.js +4 -0
  46. package/dist/chunk-76F3LCIL.js.map +1 -0
  47. package/dist/chunk-7BXPCWKM.cjs +2 -0
  48. package/dist/chunk-7BXPCWKM.cjs.map +1 -0
  49. package/dist/chunk-7GK3XEZF.js +2 -0
  50. package/dist/chunk-7GK3XEZF.js.map +1 -0
  51. package/dist/chunk-AXMQG5TS.cjs +2 -0
  52. package/dist/chunk-AXMQG5TS.cjs.map +1 -0
  53. package/dist/chunk-CIQOK7Q4.cjs +2 -0
  54. package/dist/chunk-CIQOK7Q4.cjs.map +1 -0
  55. package/dist/chunk-E2Q3PQ2G.js +3 -0
  56. package/dist/chunk-E2Q3PQ2G.js.map +1 -0
  57. package/dist/chunk-E6Z4NQAS.js +2 -0
  58. package/dist/chunk-E6Z4NQAS.js.map +1 -0
  59. package/dist/chunk-EFJCC6FJ.cjs +2 -0
  60. package/dist/chunk-EFJCC6FJ.cjs.map +1 -0
  61. package/dist/chunk-ESUN2THE.cjs +2 -0
  62. package/dist/chunk-ESUN2THE.cjs.map +1 -0
  63. package/dist/chunk-EVAOPEO4.js +2 -0
  64. package/dist/chunk-EVAOPEO4.js.map +1 -0
  65. package/dist/chunk-EVI6OHQH.cjs +2 -0
  66. package/dist/chunk-EVI6OHQH.cjs.map +1 -0
  67. package/dist/chunk-FDE5HWDI.cjs +2 -0
  68. package/dist/chunk-FDE5HWDI.cjs.map +1 -0
  69. package/dist/chunk-FWW3M36J.cjs +2 -0
  70. package/dist/chunk-FWW3M36J.cjs.map +1 -0
  71. package/dist/chunk-G7TBEQRQ.js +2 -0
  72. package/dist/chunk-G7TBEQRQ.js.map +1 -0
  73. package/dist/chunk-GK2OHWRF.cjs +5 -0
  74. package/dist/chunk-GK2OHWRF.cjs.map +1 -0
  75. package/dist/chunk-HFKDWQUL.js +2 -0
  76. package/dist/chunk-HFKDWQUL.js.map +1 -0
  77. package/dist/chunk-HLBYHXQD.cjs +3 -0
  78. package/dist/chunk-HLBYHXQD.cjs.map +1 -0
  79. package/dist/chunk-I52MYCVI.js +3 -0
  80. package/dist/chunk-I52MYCVI.js.map +1 -0
  81. package/dist/chunk-IANAMBJQ.cjs +2 -0
  82. package/dist/chunk-IANAMBJQ.cjs.map +1 -0
  83. package/dist/chunk-IJMNVBIS.js +2 -0
  84. package/dist/chunk-IJMNVBIS.js.map +1 -0
  85. package/dist/chunk-J4LZD4ZY.js +3 -0
  86. package/dist/chunk-J4LZD4ZY.js.map +1 -0
  87. package/dist/chunk-JAK3RAFA.cjs +2 -0
  88. package/dist/chunk-JAK3RAFA.cjs.map +1 -0
  89. package/dist/chunk-JFAJN3C2.cjs +2 -0
  90. package/dist/chunk-JFAJN3C2.cjs.map +1 -0
  91. package/dist/chunk-JPFCXLJV.js +2 -0
  92. package/dist/chunk-JPFCXLJV.js.map +1 -0
  93. package/dist/chunk-JUIJ6NRD.cjs +3 -0
  94. package/dist/chunk-JUIJ6NRD.cjs.map +1 -0
  95. package/dist/chunk-MIQBJGGR.js +2 -0
  96. package/dist/chunk-MIQBJGGR.js.map +1 -0
  97. package/dist/chunk-MPB7KUN5.js +3 -0
  98. package/dist/chunk-MPB7KUN5.js.map +1 -0
  99. package/dist/chunk-MSYX32PF.cjs +2 -0
  100. package/dist/chunk-MSYX32PF.cjs.map +1 -0
  101. package/dist/chunk-MVZUTETT.js +2 -0
  102. package/dist/chunk-MVZUTETT.js.map +1 -0
  103. package/dist/chunk-N7N7MPMK.cjs +2 -0
  104. package/dist/chunk-N7N7MPMK.cjs.map +1 -0
  105. package/dist/chunk-NGBBNL4K.cjs +1 -3
  106. package/dist/chunk-OVKDDTXO.cjs +3 -0
  107. package/dist/chunk-OVKDDTXO.cjs.map +1 -0
  108. package/dist/chunk-P6WPEUAJ.cjs +2 -0
  109. package/dist/chunk-P6WPEUAJ.cjs.map +1 -0
  110. package/dist/chunk-PS272DZJ.cjs +2 -0
  111. package/dist/chunk-PS272DZJ.cjs.map +1 -0
  112. package/dist/chunk-R2ENWQ76.js +2 -0
  113. package/dist/chunk-R2ENWQ76.js.map +1 -0
  114. package/dist/chunk-R2SZFJTT.cjs +2 -0
  115. package/dist/chunk-R2SZFJTT.cjs.map +1 -0
  116. package/dist/chunk-RAF57WYO.js +2 -0
  117. package/dist/chunk-RAF57WYO.js.map +1 -0
  118. package/dist/chunk-RSF25YSJ.js +2 -0
  119. package/dist/chunk-RSF25YSJ.js.map +1 -0
  120. package/dist/chunk-SOMGSIO4.cjs +3 -0
  121. package/dist/chunk-SOMGSIO4.cjs.map +1 -0
  122. package/dist/chunk-SYYE3QAX.cjs +2 -0
  123. package/dist/chunk-SYYE3QAX.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-TN5E6JU6.js +2 -0
  129. package/dist/chunk-TN5E6JU6.js.map +1 -0
  130. package/dist/chunk-TRBXW6HW.js +2 -0
  131. package/dist/{chunk-AQNHHJMJ.cjs.map → chunk-TRBXW6HW.js.map} +1 -1
  132. package/dist/chunk-TTFO4YDP.cjs +2 -0
  133. package/dist/chunk-TTFO4YDP.cjs.map +1 -0
  134. package/dist/chunk-TWC7K3ZX.js +2 -0
  135. package/dist/chunk-TWC7K3ZX.js.map +1 -0
  136. package/dist/chunk-U4AEVL5Z.js +2 -0
  137. package/dist/chunk-U4AEVL5Z.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-VAGS5JS7.cjs +2 -0
  141. package/dist/chunk-VAGS5JS7.cjs.map +1 -0
  142. package/dist/chunk-W2JAR233.js +2 -0
  143. package/dist/chunk-W2JAR233.js.map +1 -0
  144. package/dist/chunk-WGZ3FNHI.js +2 -0
  145. package/dist/chunk-WGZ3FNHI.js.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-Y7O4D3BJ.cjs +2 -0
  151. package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
  152. package/dist/chunk-YAHGSBMC.js +2 -0
  153. package/dist/chunk-YAHGSBMC.js.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-YJHY7CMN.cjs.map +0 -1
  368. package/dist/chunk-YLJ4XMA6.js +0 -33
  369. package/dist/chunk-YLJ4XMA6.js.map +0 -1
  370. package/dist/chunk-YNIWOYW6.js +0 -232
  371. package/dist/chunk-YNIWOYW6.js.map +0 -1
  372. package/dist/chunk-Z2XP767T.cjs +0 -35
  373. package/dist/chunk-Z2XP767T.cjs.map +0 -1
  374. package/dist/chunk-Z4X2RWOF.js +0 -37
  375. package/dist/chunk-Z4X2RWOF.js.map +0 -1
  376. package/dist/chunk-ZN6YYPIW.js +0 -67
  377. package/dist/chunk-ZN6YYPIW.js.map +0 -1
  378. package/dist/chunk-ZNFFTYWH.js +0 -1854
  379. package/dist/chunk-ZNFFTYWH.js.map +0 -1
  380. package/dist/variables.cjs +0 -17
  381. package/dist/variables.cjs.map +0 -1
  382. package/dist/variables.d.cts +0 -87
  383. package/dist/variables.d.ts +0 -87
  384. package/dist/variables.js +0 -4
  385. package/dist/variables.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/normalizer/TokenNormalizer.ts","../src/normalizer/PhraseTrie.ts","../src/normalizer/BuiltinNormalizerRules.ts"],"names":["DEFAULT_OPTIONS","createFusedToken","type","text","sourceTokens","first","last","token","LexerToken","tokenTypeId","recordSourceSpan","fused","NON_WORD_NAMES","NON_WORD_TABLE","ids","len","table","id","TokenNormalizer","options","PhraseTrie","rule","ruleName","a","b","phrase","tokenType","word","tokens","onFusion","sorted","fusionHandler","maxPasses","maxTokens","current","changed","passCount","result","pos","matched","tid","trieMatch","rt","match","ErrorFactory","words","firstWord","node","i","startType","best","depth","contType","collect","path","child","RATE_DENOMINATOR_WORDS","PHRASE_START_WORDS","implicitMultiplyRule","priority","canStart","phraseGuard","next","nextValue","starToken","isInsideRangeContext","safeStack","t","prev","opensMapReduceCall","createBuiltinNormalizerRules","BUILTIN_PHRASES"],"mappings":"uKA2EA,IAAMA,CAAAA,CAA+C,CACnD,SAAA,CAAW,GAAA,CACX,UAAW,GAAA,CACX,QAAA,CAAU,IAAM,CAAC,CACnB,CAAA,CAwBO,SAASC,CAAAA,CACdC,EACAC,CAAAA,CACAC,CAAAA,CACO,CACP,IAAMC,CAAAA,CAAQD,CAAAA,CAAa,CAAC,CAAA,CACtBE,EAAOF,CAAAA,CAAaA,CAAAA,CAAa,MAAA,CAAS,CAAC,EAC3CG,CAAAA,CAAQ,IAAIC,mBAAAA,CAChBN,CAAAA,CACAO,oBAAYP,CAAI,CAAA,CAChBC,CAAAA,CACAA,CAAAA,CACAE,CAAAA,CAA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AS,UAAA,CACbD,CAAAA,CAAU,KAAK,IAAI,CAAA,CAAA,KAAA,GACVC,CAAAA,CAAE,IAAA,GAAS,SAAU,CAC9B,IAAMC,CAAAA,CAAOxC,CAAAA,CAAOoB,EAAI,CAAC,CAAA,CACnBqB,CAAAA,CAAqB,CAAC,CAACD,CAAAA,GAC3BA,CAAAA,CAAK,IAAA,GAAS,OAASA,CAAAA,CAAK,IAAA,GAAS,QAAA,EAAYA,CAAAA,CAAK,OAAS,QAAA,EAAYA,CAAAA,CAAK,IAAA,GAAS,SAAA,EACxFA,EAAK,IAAA,GAAS,OAAA,GAAYA,CAAAA,CAAK,KAAA,CAAM,WAAA,EAAY,GAAM,KAAA,EAASA,CAAAA,CAAK,MAAM,WAAA,EAAY,GAAM,QAAA,EAAYA,CAAAA,CAAK,MAAM,WAAA,EAAY,GAAM,KAAA,EAASA,CAAAA,CAAK,MAAM,WAAA,EAAY,GAAM,MAAA,CAAA,CAAA,CAE/KF,CAAAA,CAAU,IAAA,CAAKG,CAAkB,EACnC,CAAA,KAAA,CAAWF,EAAE,IAAA,GAAS,UAAA,EAAcA,CAAAA,CAAE,IAAA,GAAS,WAC7CD,CAAAA,CAAU,GAAA,GAEd,CACA,OAAOA,CAAAA,CAAU,MAAA,CAAS,CAAA,EAAKA,CAAAA,CAAUA,CAAAA,CAAU,MAAA,CAAS,CAAC,CAC/D,CAoBO,SAASI,CAAAA,EAAiD,CAC/D,OAAO,CAELZ,CAAAA,EACF,CACF,KASaa,CAAAA,CAA0C,CACtD,iBAAA,CAAmB,OAAA,CACnB,UAAA,CAAY,OAAA,CACZ,aAAA,CAAe,aAAA,CACf,cAAe,aAAA,CACf,UAAA,CAAY,UAAA,CACZ,aAAA,CAAe,cACf,WAAA,CAAa,WAAA,CAKb,eAAA,CAAiB,aAAA,CACjB,aAAc,WACf","file":"chunk-VAGS5JS7.cjs","sourcesContent":["//#region ─── Module Overview ───────────────────────────────────────────────────\n\n/**\n * TokenNormalizer, post-lexer token normalization pass.\n *\n * ## Purpose\n * Applies domain-specific {@link NormalizerRule | NormalizerRules} to the raw\n * token stream produced by the {@link ExpressionLexer}. This keeps the lexer\n * slim and focused on single-token production, while multi-token pattern\n * matching (phrases, implicit operators, domain merges) lives here.\n *\n * ## What rules can do\n * - **Phrase fusion**: Merge consecutive words into compound tokens\n * (e.g., `IDENT + ... + IDENT` → `CARET`)\n * - **Implicit operator insertion**: Insert missing operators between tokens\n * (e.g., `NUMBER IDENT` → `NUMBER STAR IDENT`)\n * - **Domain-specific transformations**: Coalesce item names, currency pairs,\n * percentage syntax, etc.\n *\n * ## Architecture\n * Providers register NormalizerRules alongside Parselets and OpCode handlers\n * via {@link IEnginePackage.normalizerRules}. The normalizer applies them\n * greedily left-to-right in multiple passes with safety limits.\n *\n * @module TokenNormalizer\n */\n\n//#endregion\n//#region ─── Imports ──────────────────────────────────────────────────────────\n\nimport type { Token } from \"@solve-js/lexer/Token\";\nimport { tokenTypeId } from \"@solve-js/lexer/Token\";\nimport { LexerToken } from \"@solve-js/lexer/ExpressionLexer\";\nimport type { NormalizerRule, TokenFusion } from \"./NormalizerRule\";\nimport { PhraseTrie } from \"./PhraseTrie\";\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n//#endregion\n//#region ─── NormalizerOptions, Configuration ────────────────────────────────\n\n/**\n * Configuration options for the normalization pass.\n *\n * These control safety limits and diagnostic callbacks. The defaults\n * are chosen to be generous enough for any realistic expression while\n * preventing runaway token expansion from recursive rules.\n */\nexport interface NormalizerOptions {\n /**\n * Maximum number of full passes over the token stream before bailing out.\n * Prevents infinite loops from recursive rule chains.\n * @default 100\n */\n maxPasses?: number;\n\n /**\n * Maximum number of tokens allowed after normalization.\n * If exceeded, an Error is thrown rather than passing a bloated stream\n * to the parser.\n * @default 10000\n */\n maxTokens?: number;\n\n /**\n * Callback invoked for each fusion event during normalization.\n * Used by diagnostic mode to populate {@link NormalizerOutput.fusions}.\n * When `undefined`, fusions are still tracked internally but no callbacks fire.\n */\n onFusion?: (fusion: TokenFusion) => void;\n}\n\n//#endregion\n//#region ─── Default Options ──────────────────────────────────────────────────\n\n/** Sensible defaults that catch infinite loops without limiting real expressions. */\nconst DEFAULT_OPTIONS: Required<NormalizerOptions> = {\n maxPasses: 100,\n maxTokens: 10000,\n onFusion: () => {},\n};\n\n//#endregion\n//#region ─── createFusedToken, Token Factory ──────────────────────────────────\n\n/**\n * Creates a new normalized token from fused source tokens.\n *\n * The fused token inherits position information (offset, line, column)\n * from the first source token, which preserves source-map accuracy\n * for error messages and diagnostic highlighting.\n *\n * It also records where the source text ENDS, on `sourceEnd`. The start alone\n * is not enough to describe the span a fusion covers, because `text` is the\n * replacement rather than the original: `10 frames` fuses into a FRAME_COUNT\n * whose text is `10`, and a timecode fuses into a token whose text is a\n * comma-separated tuple that appears nowhere in the line. Anything painting the\n * line needs both ends, and only this function is in a position to know them.\n *\n * @param type - The new token type (e.g., \"CARET\", \"TIMES_BY\")\n * @param text - The combined text representation (e.g., \"to the power of\")\n * @param sourceTokens - The original tokens being fused (at least 2)\n * @returns A new {@link LexerToken} with the fused type and combined text\n */\nexport function createFusedToken(\n type: string,\n text: string,\n sourceTokens: Token[]\n): Token {\n const first = sourceTokens[0];\n const last = sourceTokens[sourceTokens.length - 1];\n const token = new LexerToken(\n type,\n tokenTypeId(type),\n text,\n text,\n first.offset,\n first.lineBreaks ?? 0,\n first.line,\n first.col,\n );\n // `text`, not `value`: this is where the SOURCE ended, and the two differ\n // for a string literal, whose value is the payload without its quotes.\n token.sourceEnd = last.sourceEnd ?? last.offset + last.text.length;\n return token;\n}\n\n/**\n * Record, on a token that replaced several, where its source text ended.\n *\n * Called centrally rather than left to each rule. A rule that builds its\n * replacement by hand rather than through {@link createFusedToken} is doing\n * nothing wrong, and several do: the date-literal rule needs a token whose\n * value is an epoch and whose text is the source, which that factory cannot\n * express. Stamping here means every fusion carries its span, including ones\n * written after this was.\n *\n * Reads `sourceEnd` off the last source token when it has one, so a fusion of\n * a fusion still describes the original text rather than the intermediate.\n *\n * @param fused - The single token the rule produced.\n * @param sourceTokens - The tokens it consumed.\n */\nfunction recordSourceSpan(fused: Token, sourceTokens: Token[]): void {\n const last = sourceTokens[sourceTokens.length - 1];\n if (!last) return;\n fused.sourceEnd = last.sourceEnd ?? last.offset + last.text.length;\n}\n\n//#endregion\n//#region ─── NON_WORD_TOKEN_TYPES, Type-guard skip set ────────────────────────\n\n/**\n * Token types that can NEVER start a multi-word phrase.\n *\n * Used by {@link normalize} to skip the PhraseTrie walk entirely at\n * positions where the token type makes phrase matching impossible.\n * This avoids even the O(1) {@link PhraseTrie.canStart} check.\n *\n * Types NOT in this set (IDENT, KEYWORD, FUNC, UNIT, and any custom\n * types registered by packages) still pass through to the trie for\n * a full match attempt.\n */\n// ── Non-word type ID lookup table (flat Uint8Array, true O(1) array index) ──\n//\n// Index = token typeId, value = 1 if non-word (skip trie), 0 otherwise.\n// Array indexing avoids ALL hashing: no Set.has(), no Map.get(), no string ops.\n//\n// Custom types from packages get IDs beyond the table length, so the bounds\n// check `tid < TABLE.length` safely passes them through to the trie.\n//\n// Arithmetic operators (PLUS, MINUS, STAR, SLASH, CARET, MOD, PERCENT) are\n// intentionally excluded: in keyword locales the lexer maps \"times\"→STAR,\n// \"divide\"→SLASH etc., and those tokens CAN start phrases like \"times by\".\n/**\n * Token type names that can NEVER start a multi-word phrase.\n *\n * Exported for testing only, consumers should use the type-guard behavior\n * of {@link TokenNormalizer.normalize} rather than this list directly.\n */\nexport const NON_WORD_NAMES = [\n\t\"NUMBER\", \"HEX\", \"BIGINT\", \"FLOAT\",\n\t\"LSHIFT\", \"RSHIFT\", \"BIT_AND\", \"BIT_OR\", \"BIT_XOR\",\n\t\"LPAREN\", \"RPAREN\", \"LBRACKET\", \"RBRACKET\",\n\t\"COMMA\", \"COLON\", \"EQUALS\", \"THEREFORE\", \"PIPE\", \"AMPERSAND\", \"AT\",\n\t\"SEMICOLON\", \"QUESTION\", \"EXCLAMATION\",\n\t\"EOF\", \"WS\", \"NEWLINE\",\n] as const;\n\n/**\n * Flat Uint8Array lookup table: index = token typeId, value = 1 if non-word.\n *\n * Exported for testing only, consumers should not depend on the internal\n * table layout, as the set of non-word types may change.\n */\nexport const NON_WORD_TABLE: Uint8Array = (() => {\n\t// Resolve all non-word type names to their numeric IDs\n\tconst ids = NON_WORD_NAMES.map(n => tokenTypeId(n));\n\t// Size the table to cover the largest ID + 1\n\tconst len = Math.max(...ids) + 1;\n\tconst table = new Uint8Array(len);\n\t// Mark non-word type positions\n\tfor (const id of ids) table[id] = 1;\n\treturn table;\n})();\n\n//#endregion\n//#region ─── TokenNormalizer Class ─────────────────────────────────────────────\n\n/**\n * Token normalizer: applies {@link NormalizerRule | NormalizerRules} to a token stream.\n *\n * ## Lifecycle\n * 1. **Registration**: Rules are added via {@link register} and sorted by priority\n * 2. **Normalization**: {@link normalize} applies rules greedily left-to-right\n * 3. **Cleanup**: {@link clear} or {@link unregister} removes rules\n *\n * ## Normalization algorithm\n * The normalizer uses a greedy left-to-right multi-pass algorithm:\n * - At each token position, rules are tried in priority order (highest first)\n * - When a rule matches, matched tokens are consumed and replaced\n * - Processing continues from the replacement position\n * - Multiple passes handle cascading matches (one rule's output triggers another)\n * - Safety limits ({@link NormalizerOptions.maxPasses}) prevent infinite loops\n *\n * @example\n * ```ts\n * const normalizer = new TokenNormalizer();\n * normalizer.register(phraseRule); // \"to the power of\" → CARET\n * normalizer.register(implicitMultRule); // \"2 x\" → \"2 * x\"\n * const normalized = normalizer.normalize(rawTokens);\n * ```\n */\nexport class TokenNormalizer {\n /** Registered rules, unsorted, the source of truth. */\n private rules: NormalizerRule[] = [];\n\n /**\n * Priority-sorted copy of {@link rules}, rebuilt lazily on the next\n * {@link normalize} call after a mutation. Rules are registered once at\n * engine/package-registration time and essentially never change during a\n * session, but normalize() runs on every keystroke-driven evaluation, an\n * earlier version re-sorted a fresh copy of `rules` on every single call,\n * which meant every keystroke paid for an allocation + sort of a list that\n * had usually not changed since the last one. `null` means \"stale, rebuild\n * on next use\"; {@link register}/{@link unregister}/{@link clear} all\n * invalidate it.\n */\n private sortedRulesCache: NormalizerRule[] | null = null;\n\n /**\n * Phrase trie for single-pass multi-word phrase fusion.\n * Tried at each token position BEFORE other rules, the trie walk\n * is O(depth) vs O(R × W) for separate rule matching.\n */\n private phraseTrie = new PhraseTrie();\n\n /** Merged options with defaults applied. */\n private options: Required<NormalizerOptions>;\n\n // ── Constructor ──────────────────────────────────────────────────────────\n\n /**\n * @param options - Configuration overrides for safety limits and diagnostic callbacks\n */\n constructor(options: NormalizerOptions = {}) {\n this.options = { ...DEFAULT_OPTIONS, ...options };\n }\n\n // ── Rule Management ──────────────────────────────────────────────────────\n\n /**\n * Register a normalization rule.\n *\n * Rules are sorted by priority (descending) on each {@link normalize} call.\n * Multiple rules can share the same priority, they are tried in registration\n * order when priorities are equal.\n *\n * @param rule - The rule to register\n */\n register(rule: NormalizerRule): void {\n this.rules.push(rule);\n this.sortedRulesCache = null;\n }\n\n /**\n * Unregister a normalization rule by its {@link NormalizerRule.name | name}.\n *\n * If multiple rules share the same name, all are removed. This is safe to\n * call with a name that doesn't match any rule, it simply has no effect.\n *\n * @param ruleName - The name of the rule to remove\n */\n unregister(ruleName: string): void {\n this.rules = this.rules.filter(r => r.name !== ruleName);\n this.sortedRulesCache = null;\n }\n\n /**\n * Remove all registered rules, resetting the normalizer to its initial state.\n * Also clears the phrase trie.\n */\n clear(): void {\n this.rules = [];\n this.sortedRulesCache = null;\n this.phraseTrie = new PhraseTrie();\n }\n\n /**\n * Priority-sorted view of {@link rules} (descending priority; registration\n * order preserved for ties, since {@link Array.prototype.sort} is stable).\n * Cached until the next mutation. See {@link sortedRulesCache}.\n */\n private getSortedRules(): NormalizerRule[] {\n if (this.sortedRulesCache === null) {\n this.sortedRulesCache = [...this.rules].sort((a, b) => b.priority - a.priority);\n }\n return this.sortedRulesCache;\n }\n\n /**\n * Get the number of currently registered rules (excludes phrase trie entries).\n */\n get ruleCount(): number {\n return this.rules.length;\n }\n\n // ── Phrase Registration ────────────────────────────────────────────────\n\n /**\n * Register a multi-word phrase for fusion into a single compound token.\n *\n * This is the preferred way to add phrase patterns. It inserts into the\n * internal {@link PhraseTrie}, which collapses all phrase rules into a\n * single O(depth) trie walk per position, no separate rule scanning.\n *\n * @param phrase - Multi-word phrase (e.g., \"to the power of\", \"abyssal whip\")\n * @param tokenType - Target token type after fusion (e.g., \"CARET\", \"ITEM\")\n */\n addPhrase(phrase: string, tokenType: string): void {\n this.phraseTrie.addPhrase(phrase, tokenType);\n }\n\n /**\n * Check whether a word can start any registered phrase.\n *\n * Used by {@link implicitMultiplyRule} to suppress `*` insertion\n * before phrase-starting identifiers (e.g., \"2 power of 3\" → `2 ^ 3`,\n * not `2 * power of 3`). Delegates to {@link PhraseTrie.canStart}.\n */\n /**\n * Get all registered phrases and their target token types.\n *\n * Exposes the full phrase trie structure for diagnostic rendering\n * in the playground's NormalizerTab. Returns ALL registered phrases,\n * not just the ones that matched in the last evaluation.\n */\n getPhrases(): Record<string, string> {\n return this.phraseTrie.getAllPhrases();\n }\n\n canStartPhrase(word: string): boolean {\n return this.phraseTrie.canStart(word);\n }\n\n // ── Normalization ────────────────────────────────────────────────────────\n\n /**\n * Normalize a token stream by applying all registered rules.\n *\n * ## Algorithm\n * Applies rules greedily left-to-right in multiple passes:\n * 1. Sort rules by priority (descending)\n * 2. Walk the token stream left to right\n * 3. At each position, try rules in priority order\n * 4. On match: consume matched tokens, insert replacements, restart from insert point\n * 5. On no match: pass token through unchanged\n * 6. Repeat until a full pass produces no changes, or maxPasses is reached\n *\n * ## Fusion tracking\n * When a rule consumes more tokens than it produces, the normalizer calls\n * `onFusion` with a {@link TokenFusion} record for diagnostic collection.\n * This populates {@link NormalizerOutput.fusions} in the playground pipeline view.\n *\n * ## Safety\n * If the normalized token count exceeds {@link NormalizerOptions.maxTokens},\n * an Error is thrown to prevent memory exhaustion from runaway rule expansion.\n *\n * @param tokens - Raw tokens from the lexer\n * @param onFusion - Optional fusion callback (overrides {@link NormalizerOptions.onFusion})\n * @returns Normalized tokens ready for parsing\n * @throws {Error} If the normalized token count exceeds maxTokens\n */\n normalize(tokens: Token[], onFusion?: (fusion: TokenFusion) => void): Token[] {\n // ── Early exit: nothing to normalize ──\n if (tokens.length === 0) return tokens;\n\n // ── Priority-sorted rules, cached across calls, see getSortedRules() ──\n const sorted = this.getSortedRules();\n const fusionHandler = onFusion ?? this.options.onFusion;\n const maxPasses = this.options.maxPasses;\n const maxTokens = this.options.maxTokens;\n\n let current = tokens;\n let changed = true;\n let passCount = 0;\n\n // Multi-pass loop: rules may trigger cascading matches across passes\n while (changed && passCount < maxPasses) {\n changed = false;\n passCount++;\n\n const result: Token[] = [];\n let pos = 0;\n\n // Single-pass left-to-right greedy walk\n while (pos < current.length) {\n let matched = false;\n\n // ── Fast path: phrase trie (O(depth) single walk vs O(R × W) per rule) ──\n // O(1) type-guard: skip trie entirely for tokens that can't start phrases.\n // Flat Uint8Array indexed by typeId, no hashing, no Set lookup, true O(1).\n const tid = current[pos].typeId;\n if (tid >= NON_WORD_TABLE.length || NON_WORD_TABLE[tid] === 0) {\n const trieMatch = this.phraseTrie.matchAt(current, pos);\n if (trieMatch) {\n const sourceTokens = current.slice(pos, pos + trieMatch.consumed);\n for (const rt of trieMatch.replacement) {\n result.push(rt);\n }\n if (trieMatch.consumed > 1 && trieMatch.replacement.length === 1) {\n recordSourceSpan(trieMatch.replacement[0], sourceTokens);\n fusionHandler({\n rule: trieMatch.ruleName ?? \"phrase-trie\",\n sourceTokens,\n fusedToken: trieMatch.replacement[0],\n });\n }\n pos += trieMatch.consumed;\n changed = true;\n continue; // trie matched — skip other rules at this position (no need to set matched)\n }\n }\n\n // Try every rule in priority order at this position\n for (const rule of sorted) {\n const match = rule.match(current, pos);\n if (match) {\n // Collect source tokens for fusion tracking\n const sourceTokens = current.slice(pos, pos + match.consumed);\n\n // Insert replacement tokens into result\n for (const rt of match.replacement) {\n result.push(rt);\n }\n\n // Track fusion events for diagnostics:\n // - Multiple tokens → single token: classic fusion\n // - Multiple tokens → fewer tokens: partial fusion\n if (match.consumed > 1 && match.replacement.length === 1) {\n recordSourceSpan(match.replacement[0], sourceTokens);\n fusionHandler({\n rule: rule.name,\n sourceTokens,\n fusedToken: match.replacement[0],\n });\n } else if (match.consumed > 1 && match.replacement.length < match.consumed) {\n for (const rt of match.replacement) {\n fusionHandler({\n rule: rule.name,\n sourceTokens,\n fusedToken: rt,\n });\n }\n }\n\n // Advance position past consumed tokens\n pos += match.consumed;\n changed = true;\n matched = true;\n break; // Rule matched — restart at new position with highest-priority rules\n }\n }\n\n if (!matched) {\n // No rule matched at this position, pass token through unchanged\n result.push(current[pos]);\n pos++;\n }\n }\n\n // Safety: bail if token count explodes (runaway rule expansion)\n if (result.length > maxTokens) {\n // A raw Error here would bypass ThreeTierEvaluator's DAG-preservation\n // enrichment on compile failure (it specifically checks for\n // EngineError). Same reasoning as ExpressionEngineSafety.ts's\n // complexity/length checks, which this mirrors.\n throw ErrorFactory.validation(\n \"NORMALIZED_TOKEN_LIMIT_EXCEEDED\",\n `Normalized token count (${result.length}) exceeds safety limit (${maxTokens})`,\n { tokenCount: result.length, maxTokens }\n );\n }\n\n current = result;\n }\n\n return current;\n }\n}\n\n//#endregion\n","//#region ─── Module Overview ───────────────────────────────────────────────────\n\n/**\n * PhraseTrie, optimized word-level trie for multi-word phrase fusion.\n *\n * ## Problem\n * The normalizer previously applied N separate `phraseFusionRule` instances,\n * each scanning forward from the current token position. For R phrase rules\n * and W average phrase length, this cost O(N × R × W) per pass.\n *\n * ## Solution\n * A single trie walk per position collapses all phrase rules into O(D)\n * where D ≤ longest phrase depth (typically ≤ 5 words). The trie tracks\n * the deepest terminal node reached, implementing longest-match-wins\n * without priority sorting.\n *\n * ## Optimizations\n * 1. **Set<string> quick-reject**, the `startWords` set contains the first\n * word of every registered phrase. At each position, if the token's\n * lowercase value isn't in the set, we bail in O(1) without touching\n * the trie. ~80% of tokens (numbers, operators) hit this fast path.\n * 2. **Longest-match-wins**, the `matchAt()` walk continues past terminal\n * nodes, tracking the deepest one. Shorter overlapping phrases (e.g.,\n * \"power of\") don't need lower priority, the trie naturally prefers\n * the longer match.\n * 3. **Map-based children**, `Map<string, TrieNode>` gives O(1) amortized\n * child lookup per word, faster than array scanning for sparse branches.\n *\n * ## Package integration\n * Packages add phrases via {@link TokenNormalizer.addPhrase} (public API)\n * or the {@link IEnginePackage.phrases} declarative field. Each call to\n * `addPhrase()` inserts the phrase into this trie and updates `startWords`.\n *\n * @module PhraseTrie\n */\n\n//#endregion\n//#region ─── Imports ──────────────────────────────────────────────────────────\n\nimport type { Token } from \"@solve-js/lexer/Token\";\nimport type { NormalizerMatch } from \"./NormalizerRule\";\nimport { createFusedToken } from \"./TokenNormalizer\";\n\n//#endregion\n//#region ─── TrieNode ─────────────────────────────────────────────────────────\n\n/**\n * Internal trie node.\n *\n * Each node represents a matched word in a phrase. The path from root\n * to a node spells out a partial or complete phrase.\n */\ninterface TrieNode {\n\t/** Child nodes keyed by next word (all lowercase). */\n\tchildren: Map<string, TrieNode>;\n\t/**\n\t * If this node completes a phrase, the terminal metadata.\n\t * A node can be both terminal AND have children. This handles\n\t * overlapping phrases like \"power of\" and \"to the power of\".\n\t */\n\tterminal: TrieTerminal | null;\n}\n\n/** Metadata stored at terminal nodes for deferred token creation. */\ninterface TrieTerminal {\n\t/** The target token type after fusion (e.g., \"CARET\", \"TIMES_BY\"). */\n\ttokenType: string;\n\t/** The original phrase string (e.g., \"to the power of\"). */\n\tphrase: string;\n\t/** Number of tokens consumed by this phrase. */\n\tconsumed: number;\n}\n\n//#endregion\n//#region ─── PhraseTrie ─────────────────────────────────────────────────────\n\n/**\n * Word-level trie for single-pass multi-word phrase matching.\n *\n * @example\n * ```ts\n * const trie = new PhraseTrie();\n * trie.addPhrase(\"to the power of\", \"CARET\");\n * trie.addPhrase(\"power of\", \"CARET\");\n * trie.addPhrase(\"abyssal whip\", \"ITEM\");\n *\n * // At position 0 with tokens [\"to\",\"the\",\"power\",\"of\",\"3\"]\n * const match = trie.matchAt(tokens, 0);\n * // → { consumed: 4, replacement: [CARET(\"to the power of\")] }\n * ```\n */\nexport class PhraseTrie {\n\t/**\n\t * First words that can start any registered phrase (all lowercase).\n\t * O(1) quick-reject: if `tokens[pos].value.toLowerCase()` isn't here,\n\t * no phrase can match at this position.\n\t */\n\tprivate startWords = new Set<string>();\n\n\t/**\n\t * Root maps first word → child node.\n\t * Two-level root avoids an unnecessary intermediate TrieNode.\n\t */\n\tprivate root = new Map<string, TrieNode>();\n\n\t// ── Registration ──────────────────────────────────────────────────────\n\n\t/**\n\t * Register a phrase for fusion into a single compound token.\n\t *\n\t * @param phrase - Multi-word phrase (e.g., \"to the power of\")\n\t * @param tokenType - Target token type after fusion (e.g., \"CARET\")\n\t */\n\taddPhrase(phrase: string, tokenType: string): void {\n\t\tconst words = phrase.toLowerCase().trim().split(/\\s+/);\n\t\tif (words.length === 0 || words[0] === \"\") return;\n\n\t\tthis.startWords.add(words[0]);\n\n\t\tconst firstWord = words[0];\n\t\tlet node: TrieNode;\n\n\t\tif (this.root.has(firstWord)) {\n\t\t\tnode = this.root.get(firstWord)!;\n\t\t} else {\n\t\t\tnode = { children: new Map(), terminal: null };\n\t\t\tthis.root.set(firstWord, node);\n\t\t}\n\n\t\t// Single-word phrase: terminal at root's child\n\t\tif (words.length === 1) {\n\t\t\tnode.terminal = { tokenType, phrase, consumed: 1 };\n\t\t\treturn;\n\t\t}\n\n\t\t// Walk/insert remaining words\n\t\tfor (let i = 1; i < words.length; i++) {\n\t\t\tconst word = words[i];\n\t\t\tif (!node.children.has(word)) {\n\t\t\t\tnode.children.set(word, { children: new Map(), terminal: null });\n\t\t\t}\n\t\t\tnode = node.children.get(word)!;\n\t\t}\n\n\t\tnode.terminal = { tokenType, phrase, consumed: words.length };\n\t}\n\n\t// ── Matching ──────────────────────────────────────────────────────────\n\n\t/**\n\t * Attempt to match a phrase starting at `pos` in the token stream.\n\t *\n\t * Walks the trie one token at a time, tracking the deepest terminal\n\t * node reached. Returns the longest match found, or `null` if no\n\t * phrase starts at this position.\n\t *\n\t * @param tokens - The current token stream\n\t * @param pos - Position to attempt matching from\n\t * @returns The longest {@link NormalizerMatch}, or `null` on no match\n\t */\n\tmatchAt(tokens: Token[], pos: number): NormalizerMatch | null {\n\t\t// ── Bounds guard ──\n\t\tif (pos >= tokens.length) return null;\n\n\t\t// ── A tag token never takes part in phrase fusion (#197, #213) ──\n\t\t// A `#tag` is a typed token, not a bare word, so it must not start or\n\t\t// complete a phrase. The trie matches on written value alone, so without\n\t\t// this guard a tag whose name equals a phrase or a phrase-continuation\n\t\t// word (`1200 #assuming`, `total of #column`) is fused into that grammar\n\t\t// before the category-tag rules ever run, and the tag is lost.\n\t\t//\n\t\t// The guard also covers the fused aggregate tokens the tags package emits\n\t\t// (`TAG_SUM` / `TAG_COUNT` / `TAG_AVERAGE`), whose value is the tag NAME:\n\t\t// otherwise `total of #assuming` fuses correctly to TAG_SUM(\"assuming\"),\n\t\t// then the trie re-reads that value on the next pass and turns it back\n\t\t// into the finance ASSUMING keyword (#213). The whole `TAG` / `TAG_*`\n\t\t// namespace belongs to the tags package.\n\t\tconst startType = tokens[pos].type;\n\t\tif (startType === \"TAG\" || startType.startsWith(\"TAG_\")) return null;\n\n\t\t// ── O(1) quick-reject: first word not a phrase starter ──\n\t\tconst firstWord = tokens[pos].value.toLowerCase();\n\t\tif (!this.startWords.has(firstWord)) return null;\n\n\t\t// ── Walk trie, tracking deepest terminal ──\n\t\tlet node: TrieNode | undefined = this.root.get(firstWord);\n\t\tif (!node) return null;\n\n\t\tlet best: NormalizerMatch | null = null;\n\t\tlet depth = 1;\n\n\t\t// Check single-word phrase at first node\n\t\tif (node.terminal) {\n\t\t\tconst sourceTokens = tokens.slice(pos, pos + 1);\n\t\t\tbest = {\n\t\t\t\tconsumed: 1,\n\t\t\t\treplacement: [createFusedToken(node.terminal.tokenType, node.terminal.phrase, sourceTokens)],\n\t\t\t\truleName: node.terminal.phrase,\n\t\t\t};\n\t\t}\n\n\t\t// Walk deeper for multi-word phrases\n\t\tfor (let i = pos + 1; i < tokens.length && node?.children; i++) {\n\t\t\tconst contType = tokens[i].type;\n\t\t\tif (contType === \"TAG\" || contType.startsWith(\"TAG_\")) break; // a tag token can't continue a phrase (#197, #213)\n\t\t\tconst word = tokens[i].value.toLowerCase();\n\t\t\tnode = node.children.get(word);\n\t\t\tif (!node) break; // dead end\n\t\t\tdepth++;\n\n\t\t\tif (node.terminal) {\n\t\t\t\t// Deferred fused-token creation, only on deepest match found\n\t\t\t\tconst sourceTokens = tokens.slice(pos, pos + depth);\n\t\t\t\tbest = {\n\t\t\t\t\tconsumed: depth,\n\t\t\t\t\treplacement: [\n\t\t\t\t\t\tcreateFusedToken(node.terminal.tokenType, node.terminal.phrase, sourceTokens),\n\t\t\t\t\t],\n\t\t\t\t\truleName: node.terminal.phrase,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn best;\n\t}\n\n\t// ── Introspection ─────────────────────────────────────────────────────\n\n\t/** Number of unique first words (not total phrases). */\n\tget size(): number {\n\t\treturn this.root.size;\n\t}\n\n\t/**\n\t * Return all registered phrases and their target token types.\n\t *\n\t * Used by diagnostic mode to expose the complete trie structure to the\n\t * playground's NormalizerTab for rendering ALL registered phrases\n\t * (not just the ones that matched in this evaluation).\n\t */\n\tgetAllPhrases(): Record<string, string> {\n\t\tconst result: Record<string, string> = {};\n\n\t\tconst collect = (node: TrieNode, path: string[]): void => {\n\t\t\tif (node.terminal) {\n\t\t\t\tresult[path.join(' ')] = node.terminal.tokenType;\n\t\t\t}\n\t\t\tfor (const [word, child] of node.children) {\n\t\t\t\tcollect(child, [...path, word]);\n\t\t\t}\n\t\t};\n\n\t\tfor (const [firstWord, node] of this.root) {\n\t\t\tcollect(node, [firstWord]);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** Check if any phrase starts with this word (case-insensitive). */\n\tcanStart(word: string): boolean {\n\t\treturn this.startWords.has(word.toLowerCase());\n\t}\n}\n\n//#endregion\n","//#region ─── Module Overview ───────────────────────────────────────────────────\n\n/**\n * Built-in normalization rules for the {@link TokenNormalizer}.\n *\n * These rules handle common expression patterns that span multiple tokens.\n * Phrase fusion (e.g., \"to the power of\" → CARET) is handled by the\n * internal {@link PhraseTrie}. See {@link TokenNormalizer.addPhrase}.\n * This module only exports non-phrase rules like {@link implicitMultiplyRule}.\n *\n * @module BuiltinNormalizerRules\n */\n\n//#endregion\n//#region ─── Imports ──────────────────────────────────────────────────────────\n\nimport type { Token } from \"@solve-js/lexer/Token\";\nimport { tokenTypeId } from \"@solve-js/lexer/Token\";\nimport { LexerToken } from \"@solve-js/lexer/ExpressionLexer\";\nimport type { NormalizerRule, NormalizerMatch } from \"./NormalizerRule\";\n\n//#endregion\n//#region ─── PHRASE_START_WORDS, Implicit Multiply Guard ─────────────────────\n\n/**\n * Words that can start multi-word phrases, hardcoded fallback.\n *\n * This is ONLY used as the default fallback in {@link implicitMultiplyRule}\n * when no `canStart` predicate is provided. In the recommended pattern,\n * the {@link PhraseTrie}'s live `canStart()` set is passed instead, keeping\n * the guard in sync with package-registered phrases.\n *\n * @see {@link TokenNormalizer.canStartPhrase}\n */\n/**\n * Words that introduce a rate denominator when a unit follows.\n *\n * Kept next to the implicit-multiplication rule because that is the only\n * thing they change here; the rate itself is built in the uom package.\n */\nconst RATE_DENOMINATOR_WORDS = new Set([\"per\", \"a\", \"an\", \"each\", \"every\"]);\n\nconst PHRASE_START_WORDS = new Set([\n \"to\", \"power\", \"increase\", \"decrease\", \"times\", \"multiply\", \"divide\", \"by\",\n]);\n\n//#endregion\n//#region ─── implicitMultiplyRule, Implicit Operator Insertion ────────────────\n\n/**\n * Creates a normalization rule that inserts an implicit multiplication operator\n * between adjacent tokens where multiplication is implied.\n *\n * ## When it fires\n * Inserts a STAR token between:\n * - `NUMBER IDENT` (e.g., \"2 x\" → \"2 * x\")\n * - `RPAREN IDENT` (e.g., \"(x+1)y\" → \"(x+1) * y\")\n * - `NUMBER LPAREN` (e.g., \"2(x+1)\" → \"2 * (x+1)\")\n * - `NUMBER PI` / `NUMBER E` (e.g., \"2π\" → \"2 * π\")\n *\n * ## When it doesn't fire\n * - When the following identifier starts a multi-word phrase\n * (checked against {@link PHRASE_START_WORDS})\n * - When the following token is not an identifier or parenthesized expression\n *\n * ## Priority\n * Default priority is 50, below phrase fusion so phrases match first.\n *\n * @param priority - Rule priority (default 50)\n * @returns A {@link NormalizerRule} that inserts implicit multiply operators\n */\nexport function implicitMultiplyRule(\n\tpriority: number = 50,\n\tcanStart?: (word: string) => boolean\n): NormalizerRule {\n\tconst phraseGuard = canStart ?? ((word: string) => PHRASE_START_WORDS.has(word.toLowerCase()));\n\n\treturn {\n name: \"implicit:multiply\",\n priority,\n match(tokens: Token[], pos: number): NormalizerMatch | null {\n // ── Need at least one token after the current position ──\n if (pos + 1 >= tokens.length) return null;\n\n const t = tokens[pos];\n const next = tokens[pos + 1];\n\n // ── Guard: suppress if the next identifier starts a phrase ──\n // Uses the trie's canStart when available, falls back to hardcoded set.\n // This prevents \"2 power of 3\" from becoming \"2 * power of 3\".\n const nextValue = next.value.toLowerCase();\n if (phraseGuard(nextValue)) return null;\n\n // ── Guard: a rate denominator, not a multiplication ──\n // \"99 per week\" is ninety-nine a week, not ninety-nine times something\n // called per. The trie guard above cannot cover this, because these are\n // not registered phrases; they are recognised by the uom package's\n // bare-denominator rule, which runs after this one and then finds its\n // fused token stranded in operand position. The slash spelling never had\n // the problem, which is what made it hard to see.\n if (RATE_DENOMINATOR_WORDS.has(nextValue) && tokens[pos + 2]?.type === \"UNIT\") return null;\n\n // ── Check trigger conditions ──\n const triggers =\n (t.type === \"NUMBER\" || t.type === \"RPAREN\") &&\n (next.type === \"IDENT\" || next.type === \"LPAREN\" || next.type === \"PI\" || next.type === \"E\");\n\n if (!triggers) return null;\n\n // ── Insert a STAR token at the next token's position ──\n const starToken = new LexerToken(\n \"STAR\", tokenTypeId(\"STAR\"), \"*\", \"*\",\n next.offset, 0, next.line, next.col,\n );\n\n // consumed = 1: only the current token is replaced with [current, STAR]\n // The next token is NOT consumed, it stays for the next iteration\n return { consumed: 1, replacement: [t, starToken] };\n },\n };\n}\n\n//#endregion\n//#region ─── isInsideRangeContext, Bracket/Call-Paren Context Guard ───────────\n\n/**\n * Whether token `pos` sits inside a context where a bare `NUMBER:NUMBER`\n * sequence means a Range, not a clock-time/laptime/video-timecode literal:\n * a matrix literal/index/slice (`[1,2,3]`, `a[0:3]`), OR a `map`/`reduce`/\n * `sum`/`prod` call's own argument-list parens (`map(f, 0:3)`, these\n * accept a bare Range argument directly, per the Calca spec's own\n * example). Scans backward from `pos` over the CURRENT pass's token array,\n * tracking `[`/`(` nesting depth, the same \"positional guard via\n * backward scan\" idiom already used elsewhere in this normalizer layer\n * (e.g. `LineRefNormalizerRule`'s previous-token check), generalized to\n * depth-tracking. An `LBRACKET` is unconditionally a range-safe opener; an\n * `LPAREN` is range-safe ONLY when immediately preceded by MAP/REDUCE/\n * SUM_FN/PROD_FN, an ordinary grouping/function-call paren is NOT, so\n * `(9:00) + 5` still means a clock time, not a range.\n *\n * Needed because the clock-time/laptime/video-timecode rules each match a\n * bare `NUMBER COLON NUMBER...` shape with ZERO context-awareness, a real\n * collision discovered when adding Range support, since e.g. \"0:3\" is\n * valid input to BOTH features. These contexts have no legitimate use for\n * a clock-time/laptime/timecode literal, so the carve-out costs the time\n * features nothing.\n *\n * IMPORTANT cross-pass-timing gotcha (a real bug found and fixed here,\n * not a hypothetical): the `LPAREN`-opener check deliberately tests the\n * RAW word text (`prev.value.toLowerCase()`), not `prev.type ===\n * \"MAP\"/\"REDUCE\"/...`. The normalizer's multi-pass loop hands every rule\n * the SAME frozen `tokens` snapshot for an entire pass, a rule scanning\n * a LATER position in that pass cannot see a fusion `mapReduceCallNormalizerRule`\n * performs at an EARLIER position in that SAME pass (fusion results only\n * become visible to other rules starting the NEXT pass). Checking the\n * fused token type here would miss exactly the case that matters most\n * `map(f, 0:3)` on its very first normalization pass, silently letting\n * `0:3` fuse into a clock time before `map(`'s own fusion ever lands.\n * Testing the raw word is immune to this: it's true from the very first\n * pass, regardless of whether `mapReduceCallNormalizerRule` has run yet.\n * (`LBRACKET` above has no equivalent issue, it's a genuine lexer token\n * from the start, never itself the product of a fusion.)\n */\nexport function isInsideRangeContext(tokens: Token[], pos: number): boolean {\n const safeStack: boolean[] = [];\n for (let i = 0; i < pos; i++) {\n const t = tokens[i];\n if (t.type === \"LBRACKET\") {\n safeStack.push(true);\n } else if (t.type === \"LPAREN\") {\n const prev = tokens[i - 1];\n const opensMapReduceCall = !!prev && (\n prev.type === \"MAP\" || prev.type === \"REDUCE\" || prev.type === \"SUM_FN\" || prev.type === \"PROD_FN\" ||\n (prev.type === \"IDENT\" && (prev.value.toLowerCase() === \"map\" || prev.value.toLowerCase() === \"reduce\" || prev.value.toLowerCase() === \"sum\" || prev.value.toLowerCase() === \"prod\"))\n );\n safeStack.push(opensMapReduceCall);\n } else if (t.type === \"RBRACKET\" || t.type === \"RPAREN\") {\n safeStack.pop();\n }\n }\n return safeStack.length > 0 && safeStack[safeStack.length - 1];\n}\n\n//#endregion\n//#region ─── createBuiltinNormalizerRules, All Built-in Rules ─────────────────\n\n/**\n * Creates built-in non-phrase normalization rules.\n *\n * Returns implicit multiply insertion (priority 50).\n *\n * **Prefer** calling {@link implicitMultiplyRule} directly with a\n * `canStart` predicate wired to the normalizer's phrase trie:\n * ```ts\n * normalizer.register(implicitMultiplyRule(50, (w) => normalizer.canStartPhrase(w)));\n * ```\n * Without the predicate, this function falls back to a hardcoded\n * {@link PHRASE_START_WORDS} set that won't reflect package-registered phrases.\n *\n * @returns An array of {@link NormalizerRule} instances ready for registration\n */\nexport function createBuiltinNormalizerRules(): NormalizerRule[] {\n return [\n // ── Implicit operator insertion (priority 50) ──\n implicitMultiplyRule(),\n ];\n}\n\n/**\n * Built-in phrase → tokenType mappings.\n *\n * These are registered into the engine's {@link PhraseTrie} during\n * construction. Tests that create a standalone {@link TokenNormalizer}\n * should register these via {@link TokenNormalizer.addPhrase}.\n */\nexport const BUILTIN_PHRASES: Record<string, string> = {\n\t\"to the power of\": \"CARET\",\n\t\"power of\": \"CARET\",\n\t\"increase by\": \"INCREASE_BY\",\n\t\"decrease by\": \"DECREASE_BY\",\n\t\"times by\": \"TIMES_BY\",\n\t\"multiply by\": \"MULTIPLY_BY\",\n\t\"divide by\": \"DIVIDE_BY\",\n\t// The past-tense spellings, which is how the operation is usually written\n\t// out: \"3 multiplied by 4\". Same tokens, so no new parselets. Both this\n\t// branch and the parity branch added \"multiplied by\" independently; the\n\t// merge kept both copies and the locale table rejected the duplicate key.\n\t\"multiplied by\": \"MULTIPLY_BY\",\n\t\"divided by\": \"DIVIDE_BY\",\n};\n\n//#endregion\n"]}
@@ -0,0 +1,2 @@
1
+ import {c as c$1}from'./chunk-YAYBVVG2.js';import {ga,C,z,B as B$1,E,p,i,j,r,s,qa as qa$1,l,h,g,f,e as e$1,k as k$1,Q as Q$1,V,ha,la,ra,ja as ja$1,ma,J,w,o,a as a$1,d,u as u$1,W,Y,F,_ as _$1,da,ca,ba,$,L as L$1,O as O$2,c as c$3,na,pa,ka,ia,oa,v as v$1,q as q$1,m,b,A,n as n$1,K as K$1,fa,I as I$1,H as H$1,G,N as N$1,t as t$1,D,P as P$1,y,x,M}from'./chunk-RSF25YSJ.js';import {O as O$1,N,p as p$1,q,I,n,s as s$1,u,C as C$1,v,H,L,t,r as r$1}from'./chunk-EVAOPEO4.js';import {c,e}from'./chunk-WGZ3FNHI.js';import {a}from'./chunk-2JMFUQZH.js';import {c as c$2}from'./chunk-MPB7KUN5.js';function qt(e,t){let n=t===2?L$1:M,o=n(e.n),r=n(e.d);return o===null||r===null?null:{n:o,d:r}}function Yt(e,t){let n=y(e),o=new Map;for(let[r,i]of n){if(i%t!==0)return null;o.set(r,i/t);}return x(o)}function Gn(e,t){let n=y(e);for(let[o,r]of y(t))n.set(o,(n.get(o)??0)+r);return x(n)}function Gt(e,t){let n=y(e);for(let[o,r]of y(t)){let i=(n.get(o)??0)-r;i<=0?n.delete(o):n.set(o,i);}return x(n)}function jn(e,t){let n=y(e),o=new Map;for(let[r,i]of y(t)){let a=n.get(r);a!==void 0&&o.set(r,Math.min(a,i));}return x(o)}function Kn(e){let t=new Set;for(let n of e)for(let o of y(n).keys())t.add(o);return [...t].sort()}function Q(e){let t=new Map;for(let n of e)t.set(n.key,n.coefficient);return E({terms:t,vars:Kn(e.map(n=>n.key))})}function Xe(e){let t=e[0];for(let n=1;n<e.length;n++)t={kind:"mul",left:t,right:e[n]};return t}function Xn(e){return [...e.terms].map(([n,o])=>({key:n,coefficient:o})).sort((n,o)=>D(n.key,o.key,e.vars))}function Xt(e){if(e.vars.length<2)return null;let t=Xn(e);return t.length===2?Zn(t[0],t[1]):t.length===3?Hn(t):t.length===4?Wn(t):null}function Zn(e,t){let n=e.coefficient.n>0n,o=t.coefficient.n>0n;if(!n)return null;let r=Ze(e,t,2);if(r!==null&&!o)return Xe([Q([r.a,Te(r.b)]),Q([r.a,r.b])]);let i=Ze(e,t,3);if(i===null)return null;let a=Q(o?[i.a,i.b]:[i.a,Te(i.b)]),u=o?Te(Oe(i.a,i.b)):Oe(i.a,i.b);return Xe([a,Q([jt(i.a),u,jt(i.b)])])}function Ze(e,t,n){let o=t.coefficient.n<0n?j(t.coefficient):t.coefficient,r=qt(e.coefficient,n),i=qt(o,n);if(r===null||i===null)return null;let a=Yt(e.key,n),u=Yt(t.key,n);return a===null||u===null?null:{a:{key:a,coefficient:r},b:{key:u,coefficient:i}}}function Te(e){return {key:e.key,coefficient:j(e.coefficient)}}function Oe(e,t){return {key:Gn(e.key,t.key),coefficient:h(e.coefficient,t.coefficient)}}function jt(e){return Oe(e,e)}function Hn(e){let[t,n,o]=e;if(t.coefficient.n<0n||o.coefficient.n<0n)return null;let r=Ze(t,o,2);if(r===null)return null;let i$1=Oe(r.a,r.b);if(i$1.key!==n.key)return null;let a=h(i$1.coefficient,{n:2n,d:1n}),u=n.coefficient.n<0n,l=u?j(n.coefficient):n.coefficient;return m(i(l,a))?{kind:"pow",base:Q([r.a,u?Te(r.b):r.b]),exponent:p(2)}:null}function Wn(e){let t=[[[0,1],[2,3]],[[0,2],[1,3]],[[0,3],[1,2]]];for(let n of t){let o=Kt(e[n[0][0]],e[n[0][1]]),r=Kt(e[n[1][0]],e[n[1][1]]);if(!(o===null||r===null)&&Qn(o.cofactor,r.cofactor))return Xe([Q([o.common,r.common]),Q(o.cofactor)])}return null}function Kt(e,t){let n=jn(e.key,t.key),o={key:n,coefficient:e.coefficient},r=[{key:Gt(e.key,n),coefficient:{n:1n,d:1n}},{key:Gt(t.key,n),coefficient:i(t.coefficient,e.coefficient)}];return r[0].key===r[1].key?null:{common:o,cofactor:r}}function Qn(e,t){return e.length!==t.length?false:e.every((n,o)=>n.key===t[o].key&&n.coefficient.n===t[o].coefficient.n&&n.coefficient.d===t[o].coefficient.d)}var zn=12,_e=4096;function we(e,t){let n=e<0n?-e:e,o=t<0n?-t:t;for(;o!==0n;){let r=n%o;n=o,o=r;}return n}function Ht(e,t){return e===0n||t===0n?0n:e/we(e,t)*t}function Zt(e){let t=e<0n?-e:e;if(t===0n)return null;let n=[];for(let o=1n;o*o<=t;o++){if(t%o!==0n)continue;n.push(o);let r=t/o;if(r!==o&&n.push(r),n.length>_e)return null}return n}function Wt(e,t){let n=a$1;for(let o of e)n=f(h(n,t),o);return n}function Jn(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(f(e[o],h(n[o-1],t)));return n}function ue(e){if(e.length<2)return [];let t=1n;for(let s of e)t=Ht(t,s.d);let n=e.map(s=>s.n*t/s.d),o=n[0],r=n[n.length-1];if(r===0n)return [];let i=Zt(r),a=Zt(o);if(i===null||a===null)throw c$2.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial's coefficients have too many divisors to search for rational roots.",{limit:_e});if(i.length*a.length>_e)throw c$2.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial has too many candidate rational roots to test.",{limit:_e});let u=[],l$1=new Set;for(let s of i)for(let p of a)for(let h of [1n,-1n]){let x={n:h*s/we(s,p),d:p/we(s,p)},V=`${x.n}/${x.d}`;l$1.has(V)||(l$1.add(V),l(Wt(e,x))&&u.push(x));}return u}function eo(e,t){return l(t)?q$1(e):t.n>0n?{kind:"sub",left:q$1(e),right:p(t)}:{kind:"add",left:q$1(e),right:p(j(t))}}function to(e,t){let n=e.length-1,o=new Map;return e.forEach((r,i)=>{if(l(r))return;let a=n-i;o.set(a===0?"":a===1?t:`${t}^${a}`,r);}),E({terms:o,vars:o.size>0?[t]:[]})}function We(e,t){let n=[],o=[...e],r=ue(o);for(;r.length>0&&o.length>2;){for(let a of r){let u=0;for(;o.length>1&&l(Wt(o,a));)o=Jn(o,a),u++;u>0&&n.push({base:eo(t,a),power:u});}r=o.length>2?ue(o):[];}return o.length-1>=1?(n.push({base:to(o,t),power:1}),{content:b,factors:n}):{content:o.length===1?o[0]:b,factors:n}}function no(e){let t=[];m(e.content)||t.push(p(e.content));for(let o of e.factors)t.push(o.power===1?o.base:r(o.base,p({n:BigInt(o.power),d:1n})));if(t.length===0)return p(b);let n=t[0];for(let o=1;o<t.length;o++)n={kind:"mul",left:n,right:t[o]};return n}function oo(e){let t=0n,n=1n;for(let o of e.terms.values())t=we(t,o.n),n=Ht(n,o.d);return t===0n?b:{n:t,d:n}}function ro(e){let t=new Map;for(let r of e.vars){let i=1/0;for(let a of e.terms.keys()){let u=io(a,r);u<i&&(i=u);}i>0&&i!==1/0&&t.set(r,i);}if(t.size===0)return {monomial:t,reduced:e};let n=new Map;for(let[r,i]of e.terms){let a=He(r);for(let[u,l]of t)a.set(u,(a.get(u)??0)-l);n.set(ao(a),i);}let o=new Set;for(let r of n.keys())for(let i of He(r).keys())o.add(i);return {monomial:t,reduced:{terms:n,vars:[...o].sort()}}}function io(e,t){return He(e).get(t)??0}function He(e){let t=new Map;if(e==="")return t;for(let n of e.split("*")){let o=n.indexOf("^");o===-1?t.set(n,1):t.set(n.slice(0,o),Number(n.slice(o+1)));}return t}function ao(e){return [...e.keys()].filter(n=>(e.get(n)??0)>0).sort().map(n=>e.get(n)===1?n:`${n}^${e.get(n)}`).join("*")}function uo(e){let t=[...e.keys()].sort(),n=null;for(let o of t){let r$1=e.get(o),i=r$1===1?q$1(o):r(q$1(o),p({n:BigInt(r$1),d:1n}));n=n===null?i:{kind:"mul",left:n,right:i};}return n}function Qt(e){let t=C(e);if(t===null||t.terms.size===0||z(t)>zn||t.vars.length===0)return e;let n=oo(t),o=m(n)?t:lo(t,i(b,n)),{monomial:r,reduced:i$1}=ro(o),a=uo(r),u=A(i$1);if(u===null){let te=Xt(i$1);return te!==null?so(n,a,te):co(n,a,i$1)??e}let l=[...B$1(i$1,u)].reverse(),s=We(l,u),p$1=h(n,s.content);if(s.factors.length<=1&&(s.factors[0]?.power??1)===1&&a===null&&m(p$1))return e;let x=[];m(p$1)||x.push(p(p$1)),a!==null&&x.push(a),x.push(no({content:b,factors:s.factors}));let V=x[0];for(let te=1;te<x.length;te++)V={kind:"mul",left:V,right:x[te]};return V}function lo(e,t){let n=new Map;for(let[o,r]of e.terms)n.set(o,h(r,t));return {terms:n,vars:e.vars}}function so(e,t,n){let o=[];m(e)||o.push(p(e)),t!==null&&o.push(t),o.push(n);let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}function co(e,t,n){if(t===null&&m(e))return null;let o=[];m(e)||o.push(p(e)),t!==null&&o.push(t),o.push(E(n));let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}var k={n:2n,d:1n},B={n:3n,d:1n},be={n:4n,d:1n};function mo(e,t,n,o){let r=j(i(t,h(B,e))),i$1=i(g(h(B,h(e,n)),h(t,t)),h(B,h(e,e))),a=h(k,h(t,h(t,t))),u=h({n:9n,d:1n},h(e,h(t,n))),l=h({n:27n,d:1n},h(h(e,e),o)),s=i(f(g(a,u),l),h({n:27n,d:1n},h(e,h(e,e))));return {p:i$1,q:s,shift:r}}function Jt(e,t,n,o){let{p:r,q:i,shift:a}=mo(e,t,n,o),u=j(f(h(be,h(r,h(r,r))),h({n:27n,d:1n},h(i,i))));return k$1(u,a$1)>0?{exact:[],approximate:bo(r,i,a)}:l(u)?{exact:fo(r,i,a),approximate:[]}:{exact:po(r,i,a),approximate:[]}}function fo(e,t,n){if(l(e))return [p(n)];let o=f(i(h(B,t),e),n),r=f(j(i(h(B,t),h(k,e))),n);return [o,r].sort(k$1).map(p)}function po(e,t,n){let o=j(i(t,k)),r=f(h(i(t,k),i(t,k)),h(i(e,B),h(i(e,B),i(e,B)))),i$1=O$2(r),a={kind:"call",name:"cbrt",args:[{kind:"add",left:p(o),right:i$1}]},u={kind:"call",name:"cbrt",args:[{kind:"sub",left:p(o),right:i$1}]},l={kind:"add",left:a,right:u},s={kind:"sub",left:a,right:u},p$1={kind:"add",left:p(n),right:{kind:"div",left:{kind:"neg",operand:l},right:p(k)}},h$1={kind:"mul",left:{kind:"div",left:{kind:"mul",left:s,right:O$2(B)},right:p(k)},right:w(n$1)};return [{kind:"add",left:p(n),right:l},{kind:"sub",left:p$1,right:h$1},{kind:"add",left:p$1,right:h$1}]}function bo(e,t,n){let o=e$1(e),r=e$1(t),i=e$1(n),a=2*Math.sqrt(-o/3),u=3*r/(2*o)*Math.sqrt(-3/o),l=Math.acos(Math.min(1,Math.max(-1,u)))/3;return [0,1,2].map(s=>a*Math.cos(l-2*Math.PI*s/3)+i).sort((s,p)=>s-p)}function yo(e,t,n,o){let r=j(i(e,be)),i$1=h(e,e),a=g(t,i(h(B,i$1),{n:8n,d:1n})),u=f(g(n,i(h(e,t),k)),i(h(i$1,e),{n:8n,d:1n})),l=g(f(g(o,i(h(e,n),be)),i(h(i$1,t),{n:16n,d:1n})),i(h(B,h(i$1,i$1)),{n:256n,d:1n}));return {p:a,q:u,r:l,shift:r}}function en(e,t,n,o,r,i$1){let a=V=>i(V,e),{p:u,q:l$1,r:s,shift:p$1}=yo(a(t),a(n),a(o),a(r)),h=l(l$1)?No(u,s):vo(u,l$1,s,i$1);if(h===null)return null;let x=l(p$1)?h:h.map(V=>({kind:"add",left:p(p$1),right:V}));return {exact:ho(x),approximate:[]}}function ho(e){let t=new Set,n=[];for(let o of e){let r=t$1(Q$1(o));t.has(r)||(t.add(r),n.push(o));}return n}function No(e,t){let n=g(h(e,e),h(be,t));if(k$1(n,a$1)<0)return xo(e,t);let o=N$1(n);return o!==null?go(j(e),o,l(n)):Ro(e,t,n)}function go(e,t,n){let o=n?[i(e,k)]:[i(f(e,t),k),i(g(e,t),k)],r=[];for(let i of o){if(l(i)){r.push(p(a$1));continue}let a=P$1(i);r.push({kind:"neg",operand:a},a);}return r}function Ro(e,t,n){let o=p(j(e)),r=O$2(n),i=k$1(e,a$1)<=0,a=[{node:Qe({kind:"add",left:o,right:r}),positive:i||k$1(t,a$1)<=0},{node:Qe({kind:"sub",left:o,right:r}),positive:i&&k$1(t,a$1)>=0}],u=[];for(let{node:l,positive:s}of a){let h={kind:"call",name:"sqrt",args:[s?l:{kind:"neg",operand:l}]},x=s?h:{kind:"mul",left:h,right:w(n$1)};u.push({kind:"neg",operand:x},x);}return u}function Qe(e){return {kind:"div",left:e,right:p(k)}}function xo(e,t){let n=i(j(e),k),o=N$1(t),r=o===null?zt(O$2(t),n):O$2(i(f(o,n),k)),a={kind:"mul",left:o===null?zt(O$2(t),j(n)):O$2(i(g(o,n),k)),right:w(n$1)},u={kind:"add",left:r,right:a},l={kind:"sub",left:r,right:a};return [{kind:"neg",operand:u},{kind:"neg",operand:l},l,u]}function zt(e,t){let n=t.n>=0n?{kind:"add",left:e,right:p(t)}:{kind:"sub",left:e,right:p(j(t))};return {kind:"call",name:"sqrt",args:[Qe(n)]}}function vo(e,t,n,o){let r=[{n:1n,d:1n},h(k,e),g(h(e,e),h(be,n)),j(h(t,t))];for(let i$1 of ue(r)){if(k$1(i$1,a$1)<=0)continue;let a=N$1(i$1);if(a===null)continue;let u=f(e,i$1),l=i(t,a),s=i(g(u,l),k),p=i(f(u,l),k),h={n:1n,d:1n};return [...o(h,a,s),...o(h,j(a),p)]}return null}var Io=200,Mo=1e-14,So=1e-10,Eo=1e-10,tn=1e-9,Ao=1e-8,ko=4;function ye(e,t){return {re:e.re-t.re,im:e.im-t.im}}function Vo(e,t){return {re:e.re*t.re-e.im*t.im,im:e.re*t.im+e.im*t.re}}function on(e,t){if(Math.abs(t.re)>=Math.abs(t.im)){let r=t.im/t.re,i=t.re+t.im*r;return {re:(e.re+e.im*r)/i,im:(e.im-e.re*r)/i}}let n=t.re/t.im,o=t.re*n+t.im;return {re:(e.re*n+e.im)/o,im:(e.im*n-e.re)/o}}function K(e){return Math.hypot(e.re,e.im)}function De(e,t){let n=0,o=0;for(let r of e){let i=n*t.re-o*t.im+r;o=n*t.im+o*t.re,n=i;}return {re:n,im:o}}function To(e,t){let n=K(t),o=0;for(let r of e)o=o*n+Math.abs(r);return o}function Oo(e){let t=e.length-1,n=[];for(let o=0;o<t;o++)n.push(e[o]*(t-o));return n}function _o(e){let t=[...e].reverse(),o=[...K$1(t)].reverse().map(e$1);return o.some(r=>!Number.isFinite(r))?null:o}function wo(e){let t=e.length-1,n=0;for(let a=1;a<e.length;a++)n=Math.max(n,Math.abs(e[a]));let o=1+n,r=-e[1]/t,i=[];for(let a=0;a<t;a++){let u=2*Math.PI*a/t+Math.PI/(2*t);i.push({re:r+o*Math.cos(u),im:o*Math.sin(u)});}return i}function Do(e){let t=e.length-1,n=wo(e);for(let o=0;o<Io;o++){let r=0,i=1;for(let a=0;a<t;a++){let u={re:1,im:0};for(let s=0;s<t;s++)a!==s&&(u=Vo(u,ye(n[a],n[s])));if(u.re===0&&u.im===0){n[a]={re:n[a].re+1e-6*(a+1),im:n[a].im+1e-6};continue}let l=on(De(e,n[a]),u);if(!Number.isFinite(l.re)||!Number.isFinite(l.im))return null;n[a]=ye(n[a],l),r=Math.max(r,K(l)),i=Math.max(i,K(n[a]));}if(r<=Mo*i)return n}return null}function nn(e,t,n){let o=n;for(let r=0;r<ko;r++){let i=De(t,o);if(i.re===0&&i.im===0)break;let a=ye(o,on(De(e,o),i));if(!Number.isFinite(a.re)||!Number.isFinite(a.im))break;o=a;}return o}function Co(e,t,n){let o=Math.max(1,K(n));if(n.im!==0&&Math.abs(n.im)<=tn*o){let r=nn(e,t,{re:n.re,im:0});if(ze(e,r))return {re:r.re,im:0}}if(n.re!==0&&Math.abs(n.re)<=tn*o){let r=nn(e,t,{re:0,im:n.im});if(ze(e,r))return {re:0,im:r.im}}return n}function ze(e,t){return !Number.isFinite(t.re)||!Number.isFinite(t.im)?false:K(De(e,t))<=So*To(e,t)}function Po(e){let t=[...e],n=t.map(o=>o.im===0);for(let o=0;o<t.length;o++){if(n[o])continue;let r={re:t[o].re,im:-t[o].im},i=-1,a=Number.POSITIVE_INFINITY;for(let p=o+1;p<t.length;p++){if(n[p])continue;let h=K(ye(t[p],r));h<a&&(a=h,i=p);}if(i===-1||a>Ao*Math.max(1,K(t[o])))continue;let u=(t[o].re+t[i].re)/2,l=(Math.abs(t[o].im)+Math.abs(t[i].im))/2,s=t[o].im<0?-1:1;t[o]={re:u,im:s*l},t[i]={re:u,im:-s*l},n[o]=true,n[i]=true;}return t}function Lo(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let o=Math.max(1,K(e[t]),K(e[n]));if(K(ye(e[t],e[n]))<=Eo*o)return false}return true}function rn(e){let t=_o(e);if(t===null)return null;if(t.length<2)return [];let n=Do(t);if(n===null)return null;let o=Oo(t),r=Po(n).map(i=>Co(t,o,i));for(let i of r)if(!ze(t,i))return null;return Lo(r)?[...r].sort((i,a)=>i.re-a.re||i.im-a.im):null}var an=8;function Fo(e,t){let n=a$1;for(let o of e)n=f(h(n,t),o);return n}function Uo(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(f(e[o],h(n[o-1],t)));return n}function un(e,t,n){let o=g(h(t,t),h(qo(),h(e,n))),r=h(Bo(),e);if(k$1(o,a$1)<0)return $o(j(t),o,r);if(l(o))return [p(i(j(t),r))];let i$1=L$1(o.n),a=L$1(o.d);if(i$1!==null&&a!==null){let h={n:i$1,d:a},x=i(f(j(t),h),r),V=i(g(j(t),h),r);return k$1(V,x)<=0?[p(V),p(x)]:[p(x),p(V)]}let u=O$2(o),l$1=k$1(r,a$1)>0,s={kind:"div",left:{kind:"sub",left:p(j(t)),right:u},right:p(r)},p$1={kind:"div",left:{kind:"add",left:p(j(t)),right:u},right:p(r)};return l$1?[s,p$1]:[p$1,s]}function $o(e,t,n){let o$1=j(t),r=L$1(o$1.n),i$1=L$1(o$1.d);if(r!==null&&i$1!==null){let s=i({n:r,d:i$1},n),p=i(e,n);return [w(o(p,j(s))),w(o(p,s))]}let a=i(e,n),u=i(o$1,h(n,n)),l$1={kind:"mul",left:O$2(u),right:w(n$1)};return l(a)?[{kind:"neg",operand:l$1},l$1]:[{kind:"sub",left:p(a),right:l$1},{kind:"add",left:p(a),right:l$1}]}function Bo(){return {n:2n,d:1n}}function qo(){return {n:4n,d:1n}}function Yo(e){return {re:e,im:0}}function ln(e,t,n){let o=C({kind:"sub",left:e,right:t});if(o===null)return {kind:"unsupported",reason:"this is not a polynomial equation (it divides by an unknown, or calls a function of one)"};let r=o.vars.filter(u=>u!==n),i=z(o,n);if(r.length>0)return i!==1?{kind:"unsupported",reason:`solving for "${n}" needs the equation to be linear in it when other unknowns (${r.join(", ")}) are present`}:Go(o,n);if(i===0)return o.terms.size===0?{kind:"identity"}:{kind:"contradiction"};if(i>an)return {kind:"unsupported",reason:`degree ${i} is above the supported maximum of ${an}`};let a=[...B$1(o,n)].reverse();return Xo(a)}function Go(e,t){let n=new Map,o=new Map;for(let[u,l]of e.terms){let s=u.split("*").filter(h=>h.length>0),p=s.indexOf(t);p===-1?o.set(u,l):(s.splice(p,1),n.set(s.join("*"),l));}let r=u=>{let l=new Set;for(let s of u.keys())for(let p of s.split("*"))p.length>0&&l.add(p.split("^")[0]);return [...l].sort()},i=E({terms:n,vars:r(n)});return {kind:"roots",exact:[{kind:"div",left:{kind:"neg",operand:E({terms:o,vars:r(o)})},right:i}],approximate:[]}}function jo(e){return e.length===4?Jt(e[0],e[1],e[2],e[3]):e.length===5?en(e[0],e[1],e[2],e[3],e[4],un):null}function Ko(e){let t=[],n=[...e],o=0;for(;n.length>1&&l(n[n.length-1]);)n=n.slice(0,-1),o++;for(o>0&&t.push(a$1);n.length>1;){let r=ue(n);if(r.length===0)break;for(let i of r){let a=0;for(;n.length>1&&l(Fo(n,i));)n=Uo(n,i),a++;a>0&&t.push(i);}}return {roots:t.sort(k$1),remaining:n}}function Xo(e){let{roots:t,remaining:n}=Ko(e),o=t.map(p),r=[],i$1=n.length-1,a=e.length-n.length;if(i$1<=0)return le(o,r,a,0,"");if(i$1===1)return o.push(p(i(j(n[1]),n[0]))),le(o,r,a+1,0,"");if(i$1===2)return o.push(...un(n[0],n[1],n[2])),le(o,r,a+2,0,"");let u=jo(n);if(u!==null)return o.push(...u.exact),r.push(...u.approximate.map(Yo)),le(o,r,a+i$1,0,"");let l=rn(n);return l!==null?(r.push(...l),le(o,r,a+i$1,0,"")):le(o,r,a,i$1,`a degree-${i$1} factor of it has no exact solution here and the numerical method did not converge on that factor`)}function le(e,t,n,o,r){let i=e.length+t.length,a=n>=1&&(i<1||i>n);return o>0||a?{kind:"incomplete",exact:e,approximate:t,missing:a?Math.max(1,n+o-i):o,reason:a?`${i} root${i===1?"":"s"} were produced for a degree-${n+o} equation, which does not add up`:r}:{kind:"roots",exact:e,approximate:t}}var sn={0:"sqrt",1:"abs",2:"sin",3:"cos",4:"tan",5:"log",6:"ceil",7:"floor",8:"round",11:"asin",12:"acos",13:"atan",14:"atan2",15:"sinh",16:"cosh",17:"tanh",18:"asinh",19:"acosh",20:"atanh",21:"cbrt",23:"expm1",24:"exp",26:"hypot",28:"log10",29:"log1p",30:"log2",33:"sign",34:"trunc",35:"degtorad",36:"radtodeg",61:"root",62:"fact"},Zo=31,bi=new Set([67,68,69,70,71,72,73,74,75,76,77,78,79]);function O(e){if(e.type===9)return e.value;if(e.type===13||e.type===12)return null;let t=e.toNumber();return Number.isFinite(t)?p(d(t)):null}function _(e){let t=Q$1(e);return t.kind==="const"?n(e$1(t.value)):I(t)}function Ce(e){return N("SYMBOLIC_UNSUPPORTED_FUNCTION",`"${e}" cannot be applied to an expression that still contains an unknown.`)}function yi(e,t){let n=O(e),o=O(t);return n===null||o===null?Ce("^"):_(r(n,o))}function hi(e){let t=O(e);return t===null?Ce("-"):_({kind:"neg",operand:t})}function Ni(e,t){let n=[];for(let r of t){let i=O$1(r);if(i)return i;let a=O(r);if(a===null)return Ce(sn[e]??`builtin ${e}`);n.push(a);}if(e===Zo&&n.length===2)return _(r(n[0],n[1]));let o=sn[e];return o===void 0?Ce(`builtin ${e}`):_(s(o,n))}function Ho(e){let t=_(e);return t.type===0&&!Number.isInteger(t.toNumber())?I(e):t}function Wo(e){return e.im===0?n(e.re):I(w(o(d(e.re),d(e.im))))}function Qo(e){switch(e.kind){case "identity":return t("true for every value");case "contradiction":return t("no solution");case "unsupported":return N("SYMBOLIC_SOLVE_UNSUPPORTED",`Cannot solve this equation: ${e.reason}.`);case "incomplete":{let t=e.exact.length+e.approximate.length;return N("SYMBOLIC_SOLVE_INCOMPLETE",`Only ${t} of this equation's ${t+e.missing} roots could be found: ${e.reason}.`)}case "roots":{let t$1=e.exact.map(Ho);for(let n of e.approximate)t$1.push(Wo(n));return t$1.length===0?t("no solution"):t$1.length===1?t$1[0]:C$1(1,t$1.length,t$1.map(n=>n.type===9?n.value:n.toNumber()))}}}function mn(e,t,n){let o=O(e),r=O(t);return o===null||r===null?N("SYMBOLIC_NONFINITE_OPERAND","An equation side has no exact value to solve with."):Qo(ln(o,r,n))}function he(e$1,t){if(e$1.type===6&&t.type===6){if(e$1.unit===t.unit)return {lv:e$1.toNumber(),rv:t.toNumber(),unit:e$1.unit,sameMeasure:true};let n=c(e$1.unit),o=c(t.unit),r=c$1.isCurrency(e$1.unit)&&c$1.isCurrency(t.unit);if(n&&n===o){let i=e(t.toNumber(),t.unit,e$1.unit);return {lv:e$1.toNumber(),rv:i,unit:e$1.unit,sameMeasure:true}}if(r){let i=c$1.convertSync(t.toNumber(),t.unit,e$1.unit);if(i!==null)return {lv:e$1.toNumber(),rv:i,unit:e$1.unit,sameMeasure:true}}return {lv:e$1.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:false}}return e$1.type===6?{lv:e$1.toNumber(),rv:t.toNumber(),unit:e$1.unit,sameMeasure:true}:t.type===6?{lv:e$1.toNumber(),rv:t.toNumber(),unit:t.unit,sameMeasure:true}:{lv:e$1.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:true}}var zo=1e-12;function Jo(e,t,n){let o=0;return Number.isFinite(e)&&Math.abs(e)>o&&(o=Math.abs(e)),Number.isFinite(t)&&Math.abs(t)>o&&(o=Math.abs(t)),Number.isFinite(n)&&Math.abs(n)>o&&(o=Math.abs(n)),o}function Vi(e,t){let{lv:n,rv:o,sameMeasure:r}=he(e,t);if(!r)return {lv:n,rv:o,equal:false,sameMeasure:false};if(e.type===6&&t.type===6&&e.unit!==void 0&&e.unit===t.unit&&e.exact!==void 0&&t.exact!==void 0&&c$1.isCurrency(e.unit))return {lv:n,rv:o,equal:qa$1(e.exact,t.exact)===0,sameMeasure:true};if(n===o)return {lv:n,rv:o,equal:true,sameMeasure:true};if(!Number.isFinite(n)||!Number.isFinite(o))return {lv:n,rv:o,equal:false,sameMeasure:true};let i=Jo(n,o,t.toNumber());return {lv:n,rv:o,equal:Math.abs(n-o)<=i*zo,sameMeasure:true}}var er={time:"duration",luminousIntensity:"luminous intensity"},tr=new Set(["money","data"]),nr={add:"added",sub:"subtracted",mul:"multiplied",div:"divided"};function Pe(e){if(c$1.isCurrency(e))return "money";let t=c(e);if(t!==void 0)return er[t]??t}function fn(e){return tr.has(e)?e:/^[aeiou]/.test(e)?`an ${e}`:`a ${e}`}function Fe(e,t,n){let o=e===void 0?void 0:Pe(e),r=t===void 0?void 0:Pe(t);if(o!==void 0&&r!==void 0&&o!==r)return `${o} and ${r} cannot be ${n}`}function or(e){return e!==void 0?nr[e]??"combined":"combined"}function Ti(e,t){let n=Pe(e),o=Pe(t);if(n!==void 0&&o!==void 0&&n!==o)return `${fn(n)} cannot be converted to ${fn(o)}`}function Oi(e,t){let n=e.type===6?e.unit:void 0,o=t.type===6?t.unit:void 0,r=Fe(n,o,"compared");return N("INCOMPATIBLE_UNITS",r??`Cannot compare incompatible units: ${n??"?"} and ${o??"?"}`)}function dn(e){if(e.type===2)return e.value;let t=e.toNumber();if(!Number.isInteger(t)){let n=Number.isNaN(t)?"NaN":String(t);throw c$2.execution("BIGINT_INEXACT_OPERAND",`A whole-number (n) value can only be combined with another whole number, and ${n} is not one`,{operand:n})}return BigInt(t)}function _i(){return c$2.execution("BIGINT_DIVISION_BY_ZERO","Division by zero: a whole-number (n) division is exact integer division, which has no answer at zero, unlike 1 / 0 which is Infinity")}function wi(e,t){let n=pn(e),o=pn(t);return n===null||o===null?null:n<o?-1:n>o?1:0}function pn(e){if(e.type===2)return e.value;let t=e.toNumber();return Number.isInteger(t)?BigInt(t):null}function Je(e,t){return Number.isFinite(t)?Math.pow(e,t):e===1||e===-1&&!Number.isNaN(t)?1:Math.pow(e,t)}function bn(e){return e.exact!==void 0?e.exact:ha(e.toNumber())}function rr(e,t,n){let o=e.type===6&&e.unit!==void 0&&e.exact!==void 0&&c$1.isCurrency(e.unit),r=t.type===6&&t.unit!==void 0&&t.exact!==void 0&&c$1.isCurrency(t.unit);if(!o&&!r)return null;let i,a,u;if(o&&r){if(e.unit!==t.unit||n==="div")return null;i=e.exact,a=t.exact,u=e.unit;}else if(o&&t.type!==6)i=e.exact,u=e.unit,a=bn(t);else if(r&&e.type!==6)a=t.exact,u=t.unit,i=bn(e);else return null;if(i===null||a===null)return null;let l;switch(n){case "add":l=ja$1(i,a);break;case "sub":l=ka(i,a);break;case "mul":l=la(i,a);break;case "div":if(na(a))return null;l=pa(i,a);break}return v(ra(l),u,l)}function Le(e){return e.rational!==void 0?e.rational:(e.type===0||e.type===1)&&typeof e.value=="number"&&Number.isInteger(e.value)?c$3(BigInt(e.value)):null}function Di(e,t,n){let o=Le(e);if(o===null)return null;let r=Le(t);if(r===null||n==="div"&&l(r))return null;let i$1;try{switch(n){case "add":i$1=f(o,r);break;case "sub":i$1=g(o,r);break;case "mul":i$1=h(o,r);break;case "div":i$1=i(o,r);break}}catch{return null}return p$1(e$1(i$1),i$1)}function Ci(e,t,n){if(e.type!==0||t.type!==0)return null;let o=e.value,r=t.value,i=e.uncertainty??0,a=t.uncertainty??0,u,l;switch(n){case "add":u=o+r,l=Math.hypot(i,a);break;case "sub":u=o-r,l=Math.hypot(i,a);break;case "mul":u=o*r,l=Math.hypot(r*i,o*a);break;case "div":u=o/r,l=Math.hypot(i/r,o*a/(r*r));break}return q(u,l)}function Pi(e,t){let n=Le(e);if(n===null)return null;let o=Le(t);return o===null?null:k$1(n,o)}function Li(e,t,n$1,o,r){if(e.type===13)return e;if(t.type===13)return t;if(e.type===12)return e;if(t.type===12)return t;if(r&&(e.type===9||t.type===9)){let i=O(e),a=O(t);return i===null||a===null?N("SYMBOLIC_NONFINITE_OPERAND","A symbolic expression cannot combine with a value that has no exact number (NaN or infinity)."):I(Q$1({kind:r,left:i,right:a}))}if(e.type===0&&t.type===0)return n(n$1(e.value,t.value));if(e.type===2||t.type===2){let i=dn(e),a=dn(t);return o?s$1(o(i,a)):s$1(i+a)}if(e.type===6||t.type===6){if(r){let s=rr(e,t,r);if(s)return s}let{lv:i,rv:a,unit:u$1,sameMeasure:l}=he(e,t);if(!l){let s=e.type===6?e.unit:void 0,p=t.type===6?t.unit:void 0,h=Fe(s,p,or(r));return N("INCOMPATIBLE_UNITS",h??`Cannot combine incompatible units: ${s??"?"} and ${p??"?"}`)}return u(n$1(i,a),u$1)}if(e.type===7&&t.type===7){let i=e.value,a=t.value;if(!V(i,a))return N("DIMENSION_MISMATCH",`Cannot combine matrices of different shapes: ${i.rows}x${i.cols} and ${a.rows}x${a.cols}`);let u=new Array(i.data.length);for(let l=0;l<i.data.length;l++)u[l]=n$1(i.data[l],a.data[l]);return C$1(i.rows,i.cols,u)}if(e.type===7){let i=e.value,a=t.toNumber(),u=i.data.map(l=>n$1(l,a));return C$1(i.rows,i.cols,u)}if(t.type===7){let i=t.value,a=e.toNumber(),u=i.data.map(l=>n$1(a,l));return C$1(i.rows,i.cols,u)}return n(n$1(e.toNumber(),t.toNumber()))}var yn=254,hn=200,Ne=class{constructor(){this.handlers=new Map;this.nextOpcode=hn+1;}register(t){this.handlers.set(t.opcode,t.handler);}unregister(t){this.handlers.delete(t);}get(t){return this.handlers.get(t)}has(t){return this.handlers.has(t)}allocateOpcode(){if(this.nextOpcode>yn)throw c$2.config("OPCODE_POOL_EXHAUSTED",`OpRegistry: dynamic opcode pool exhausted (max ${yn-hn} allocations).`);return this.nextOpcode++}},$i=new Ne;var gn=ga(1);function ge(e,t){return c$1.isCurrency(t)?e.exact??ha(e.toNumber()):null}function et(e){if(!Number.isFinite(e))return null;if(Number.isInteger(e))return ga(BigInt(e));let t=String(e);return /^-?\d+\.\d+$/.test(t)?ia(t):null}function Rn(e,t,n){let o=ge(e,n),r=et(t);if(o!==null&&r!==null){let i=la(o,r);return v(ra(i),n,i)}return u(e.toNumber()*t,n)}function xn(e,t,n,o){let r=ge(e,t),i=et(n);if(r!==null&&i!==null){let a=ja$1(gn,o===1?i:ma(i)),u=la(r,a);return v(ra(u),t,u)}return u(e.toNumber()*(1+o*n),t)}function vn(e){let t=et(e);return t===null?null:ja$1(gn,t)}function In(e,t,n){let o=ge(e,t),r=vn(n);if(o===null||r===null||na(r))return null;let i=pa(o,r);return v(ra(i),t,i)}function Mn(e,t,n){let o=ge(e,t),r=vn(n);if(o===null||r===null||na(r))return null;let i=ka(o,pa(o,r));return v(ra(i),t,i)}function Sn(e,t){let n=e.unit,o=n!==void 0&&c$1.isCurrency(n)?ir(e,n):null;if(o===null)return {unit:n,shares:[{value:e.toNumber()/t,count:t}]};let r=BigInt(t),i=o/r,a=o-i*r,u=Number(a<0n?-a:a),l=o<0n?-1n:1n,s=Nn(i,t-u);return u===0?{unit:n,shares:[s]}:{unit:n,shares:[s,Nn(i+l,u)]}}function Nn(e,t){let n=fa(e,2);return {value:ra(n),exact:n,count:t}}function ir(e,t){let n=ge(e,t);return n===null?null:oa(n,2).coef}var ar=12;function En(e,t){if(e.length===0||t.length===0)return [];let n=new Array(e.length+t.length-1).fill(a$1);return e.forEach((o,r)=>{t.forEach((i,a)=>{n[r+a]=f(n[r+a],h(o,i));});}),n}function ur(e,t){let n=[b];for(let o=0;o<t;o++)n=En(n,e);return n}function tt(e,t){return e.map(n=>i(n,t))}function lr(e,t){let n=[],o=0;for(;o<e.length&&l(e[o]);)o++;o>0&&n.push({base:[a$1,b],power:o});let r=e.slice(o);if(r.length>1){let i=We([...r].reverse(),t);for(let a of i.factors){let u=C(a.base);if(u===null)return null;n.push({base:[...B$1(u,t)],power:a.power});}}return n.length>0?n:null}function sr(e){let t=[];return e.forEach((n,o)=>{let r=n.base.length-1;for(let i=1;i<=n.power;i++)for(let a=0;a<r;a++)t.push({factor:o,power:i,degree:a});}),t}function cr(e,t,n){let o=ur(t[e.factor].base,e.power),{quotient:r,remainder:i}=H$1(n,o);if(!G(i))return null;let a=new Array(e.degree).fill(a$1);return a.push(b),En(r,a)}function mr(e,t){let n=t.length;for(let o=0;o<n;o++){let r=-1;for(let i=o;i<n;i++)if(!l(e[i][o])){r=i;break}if(r===-1)return null;[e[o],e[r]]=[e[r],e[o]],[t[o],t[r]]=[t[r],t[o]];for(let i$1=0;i$1<n;i$1++){if(i$1===o||l(e[i$1][o]))continue;let a=i(e[i$1][o],e[o][o]);for(let u=o;u<n;u++)e[i$1][u]=g(e[i$1][u],h(a,e[o][u]));t[i$1]=g(t[i$1],h(a,t[o]));}}return t.map((o,r)=>i(o,e[r][r]))}function nt(e,t,n){if(t.length<2||t.length-1>ar)return null;let o=I$1(e,t),r=o.length>1?H$1(e,o).quotient:[...e],i=o.length>1?H$1(t,o).quotient:[...t];if(i.length===1)return {polynomial:tt(r,i[0]),terms:[]};if(i.length===0)return null;let a=i[i.length-1],u=tt(i,a),l=tt(r,a),{quotient:s,remainder:p}=H$1(l,u);if(G(p))return {polynomial:s,terms:[]};let h=lr(u,n);if(h===null)return null;let x=fr(h,u,p);return x===null?null:{polynomial:s,terms:x}}function fr(e,t,n){let o=sr(e),r=t.length-1;if(o.length!==r)return null;let i=[];for(let s of o){let p=cr(s,e,t);if(p===null)return null;i.push(p);}let a=[];for(let s=0;s<r;s++)a.push(i.map(p=>p[s]??a$1));let u=[];for(let s=0;s<r;s++)u.push(n[s]??a$1);let l=mr(a,u);return l===null?null:dr(o,l,e)}function dr(e,t,n){let o=new Map;e.forEach((i,a)=>{let u=`${i.factor}:${i.power}`,l=o.get(u)??[];l[i.degree]=t[a],o.set(u,l);});let r=[];for(let[i,a]of o){let[u,l$1]=i.split(":").map(Number),s=[...a].map(p=>p??a$1);s.every(l)||r.push({numerator:s,base:n[u].base,power:l$1});}return r}function Re(e,t){let n=new Map;return e.forEach((o,r)=>{l(o)||n.set(r===0?"":r===1?t:`${t}^${r}`,o);}),n.size===0?p(a$1):E({terms:n,vars:e.length>1?[t]:[]})}function An(e){let t=ot(e);if(t===null)return e;let n=nt(t.numerator,t.denominator,t.variable);if(n===null||n.terms.length===0)return e;let o=n.polynomial.length>0?Re(n.polynomial,t.variable):null;for(let r$1 of n.terms){let i=Re(r$1.base,t.variable),a=r$1.power===1?i:r(i,p({n:BigInt(r$1.power),d:1n})),u=pr(r$1.numerator),l=u?r$1.numerator.map(p=>j(p)):r$1.numerator,s={kind:"div",left:Re(l,t.variable),right:a};o===null?o=u?{kind:"neg",operand:s}:s:o={kind:u?"sub":"add",left:o,right:s};}return o===null?e:Q$1(o)}function pr(e){return e.some(t=>t.n<0n)&&e.every(t=>t.n<=0n)}function ot(e){if(e.kind!=="div")return null;let t=C(e.left),n=C(e.right);if(t===null||n===null)return null;let o=A(n);return o===null||t.vars.some(r=>r!==o)?null:{numerator:B$1(t,o),denominator:B$1(n,o),variable:o}}var rt=16;function kn(){return p(a$1)}function X(){return p(b)}function br(e,t){switch(e){case "sin":return s("cos",[t]);case "cos":return {kind:"neg",operand:s("sin",[t])};case "tan":return {kind:"div",left:X(),right:r(s("cos",[t]),p(2))};case "exp":return s("exp",[t]);case "log":return {kind:"div",left:X(),right:t};case "sqrt":return {kind:"div",left:X(),right:{kind:"mul",left:p(2),right:s("sqrt",[t])}};case "asin":return {kind:"div",left:X(),right:s("sqrt",[Vn(t)])};case "acos":return {kind:"neg",operand:{kind:"div",left:X(),right:s("sqrt",[Vn(t)])}};case "atan":return {kind:"div",left:X(),right:yr(t)};case "sinh":return s("cosh",[t]);case "cosh":return s("sinh",[t]);case "tanh":return {kind:"div",left:X(),right:r(s("cosh",[t]),p(2))};case "abs":return s("sign",[t]);default:return null}}function Vn(e){return {kind:"sub",left:X(),right:r(e,p(2))}}function yr(e){return {kind:"add",left:X(),right:r(e,p(2))}}function xe(e,t,n=1){if(n<0||!Number.isInteger(n))throw c$2.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT","A derivative order must be a whole number, at least zero.");if(n>rt)throw c$2.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT",`A derivative order above ${rt} is not supported.`,{limit:rt});let o=Q$1(e);for(let r=0;r<n;r++)o=Q$1(P(o,t));return o}function P(e,t){switch(e.kind){case "const":case "complex":return kn();case "var":return e.name===t?X():kn();case "add":return {kind:"add",left:P(e.left,t),right:P(e.right,t)};case "sub":return {kind:"sub",left:P(e.left,t),right:P(e.right,t)};case "neg":return {kind:"neg",operand:P(e.operand,t)};case "mul":return {kind:"add",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}};case "div":return {kind:"div",left:{kind:"sub",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}},right:r(e.right,p(2))};case "pow":return hr(e,t);case "call":{if(e.args.length!==1)return it(e,t);let n=br(e.name,e.args[0]);return n===null?it(e,t):{kind:"mul",left:n,right:P(e.args[0],t)}}}}function hr(e,t){if(e.exponent.kind==="const"){let n=p(g(e.exponent.value,b));return {kind:"mul",left:{kind:"mul",left:e.exponent,right:r(e.base,n)},right:P(e.base,t)}}return e.base.kind==="const"&&e.base.value.n>0n?{kind:"mul",left:{kind:"mul",left:e,right:s("log",[e.base])},right:P(e.exponent,t)}:it(e,t)}function it(e,t){return s("der",[e,q$1(t)])}function Tn(e,t){let n=C(e);if(n===null||n.vars.filter(u=>u!==t).length>0||z(n,t)>1)return null;let r=B$1(n,t),i=r[0]??{n:0n,d:1n},a=r[1]??{n:0n,d:1n};return l(a)?null:{slope:a,intercept:i}}function Nr(e,t){let n=C(e);if(n===null)return null;let o=n.vars.filter(a=>a!==t);if(o.length>0)return {ok:false,reason:`it involves more than one unknown (${o.join(", ")})`};let r$1=B$1(n,t),i$1=p(0);return r$1.forEach((a,u)=>{if(l(a))return;let l$1=u+1,s=i(a,{n:BigInt(l$1),d:1n}),p$1={kind:"mul",left:p(s),right:l$1===1?q$1(t):r(q$1(t),p(l$1))};i$1={kind:"add",left:i$1,right:p$1};}),{ok:true,value:Q$1(i$1)}}function gr(e,t){if(e.kind!=="call"||e.args.length!==1)return null;let n=Tn(e.args[0],t);if(n===null)return null;let o=e.args[0],r=i=>Q$1({kind:"div",left:i,right:p(n.slope)});switch(e.name){case "exp":return {ok:true,value:r(s("exp",[o]))};case "sin":return {ok:true,value:r({kind:"neg",operand:s("cos",[o])})};case "cos":return {ok:true,value:r(s("sin",[o]))};case "log":return {ok:true,value:r({kind:"sub",left:{kind:"mul",left:o,right:s("log",[o])},right:o})};default:return null}}function Rr(e,t){if(e.kind!=="div"||e.left.kind!=="const"||!at(e.left.value))return null;let n=Tn(e.right,t);if(n!==null)return {ok:true,value:Q$1({kind:"div",left:s("log",[e.right]),right:p(n.slope)})};let o=C(e.right);if(o!==null&&o.vars.length===1&&o.vars[0]===t){let r=B$1(o,t);if(r.length===3&&at(r[0])&&l(r[1])&&at(r[2]))return {ok:true,value:s("atan",[q$1(t)])}}return null}function at(e){return e.n===1n&&e.d===1n}function xr(e,t){let n=ot(e);if(n===null||n.variable!==t)return null;let o=nt(n.numerator,n.denominator,t);if(o===null)return null;let r=o.polynomial.length>0?Mr(o.polynomial,t):p(0);for(let i of o.terms){let a=vr(i,t);if(a===null)return {ok:false,reason:"its denominator has a repeated irreducible quadratic factor, which needs a reduction formula this does not have"};r={kind:"add",left:r,right:a};}return {ok:true,value:Q$1(r)}}function vr(e,t){let n=e.base.length-1,o=Re(e.base,t);if(n===1){let r$1=e.numerator[0]??a$1;if(e.power===1)return {kind:"mul",left:p(r$1),right:s("log",[o])};let i$1=e.power-1,a=i(r$1,{n:BigInt(-i$1),d:1n});return {kind:"div",left:p(a),right:r(o,p({n:BigInt(i$1),d:1n}))}}return n!==2||e.power!==1?null:Ir(e,t,o)}function Ir(e,t,n){let o=e.numerator[0]??a$1,r=e.numerator[1]??a$1,[i,a]=e.base,u={n:1n,d:2n},l$1=h(a,u),s$1={kind:"mul",left:p(h(r,u)),right:s("log",[n])},p$1=g(o,h(r,l$1));if(l(p$1))return s$1;let h$1=O$2(g(i,h(l$1,l$1))),x={kind:"add",left:q$1(t),right:p(l$1)},V={kind:"mul",left:{kind:"div",left:p(p$1),right:h$1},right:s("atan",[{kind:"div",left:x,right:h$1}])};return l(r)?V:{kind:"add",left:s$1,right:V}}function Mr(e,t){let n=p(0);return e.forEach((o,r$1)=>{if(l(o))return;let i$1=r$1+1,a=i(o,{n:BigInt(i$1),d:1n}),u={kind:"mul",left:p(a),right:i$1===1?q$1(t):r(q$1(t),p(i$1))};n={kind:"add",left:n,right:u};}),n}function ve(e,t){let n=Q$1(e);if(!u$1(n).has(t))return {ok:true,value:Q$1({kind:"mul",left:n,right:q$1(t)})};let o=Nr(n,t);if(o!==null)return o;let r=gr(n,t);if(r!==null)return r;let i=Rr(n,t);if(i!==null)return i;let a=xr(n,t);if(a!==null)return a;if(n.kind==="add"||n.kind==="sub"){let u=ve(n.left,t);if(!u.ok)return u;let l=ve(n.right,t);return l.ok?{ok:true,value:Q$1({kind:n.kind,left:u.value,right:l.value})}:l}if(n.kind==="mul"&&n.left.kind==="const"){let u=ve(n.right,t);return u.ok?{ok:true,value:Q$1({kind:"mul",left:n.left,right:u.value})}:u}return {ok:false,reason:"no elementary antiderivative is known for this expression"}}var ut=16;function On(e,t,n,o){if(o<0||!Number.isInteger(o)||o>ut)throw c$2.execution("SYMBOLIC_TAYLOR_DEGREE_LIMIT",`A Taylor degree must be a whole number from 0 to ${ut}.`,{limit:ut});let r$1=p(n),i$1=1n,a=p(a$1);for(let u=0;u<=o;u++){u>0&&(i$1*=BigInt(u));let l$1=xe(e,t,u),s=Q$1(v$1(l$1,t,r$1));if(s.kind!=="const")throw c$2.execution("SYMBOLIC_TAYLOR_INEXACT",`The derivative of order ${u} does not reduce to an exact number at the expansion point, so this series cannot be computed exactly.`,{order:u});let p$1=i(s.value,{n:i$1,d:1n});if(l(p$1))continue;let h=l(n)?q$1(t):{kind:"sub",left:q$1(t),right:r$1},x=u===0?p(1):u===1?h:r(h,p(u));a={kind:"add",left:a,right:{kind:"mul",left:p(p$1),right:x}};}return Q$1(a)}function _n(e,t){return e.map(n=>t.map(o=>xe(n,o)))}function Sr(){return {pluginFunctions:{},opRegistry:new Ne,pluginFunctionOwners:{}}}var wn=Sr();var Er={1970:38.8,1971:40.5,1972:41.8,1973:44.4,1974:49.3,1975:53.8,1976:56.9,1977:60.6,1978:65.2,1979:72.6,1980:82.4,1981:90.9,1982:96.5,1983:99.6,1984:103.9,1985:107.6,1986:109.6,1987:113.6,1988:118.3,1989:124,1990:130.7,1991:136.2,1992:140.3,1993:144.5,1994:148.2,1995:152.4,1996:156.9,1997:160.5,1998:163,1999:166.6,2e3:172.2,2001:177.1,2002:179.9,2003:184,2004:188.9,2005:195.3,2006:201.6,2007:207.3,2008:215.3,2009:214.5,2010:218.1,2011:224.9,2012:229.6,2013:233,2014:236.7,2015:237,2016:240,2017:245.1,2018:251.1,2019:255.7,2020:258.8,2021:271,2022:292.7,2023:304.7,2024:313.7,2025:322.2,2026:332.7},Cn=1970,Pn=2026;function Dn(e){return Er[Math.trunc(e)]}function lt(e,t){let n=Dn(e),o=Dn(t);if(!(n===void 0||o===void 0||n===0))return o/n}function Ra(e,t,n){let o=lt(t,n);if(o!==void 0)return e*o}var Ar=0;function st(e){if(e.type===6&&e.unit!==void 0){let t=a[e.unit.toLowerCase()];if(t!==void 0&&t[0]===Ar)return e.toNumber()*t[1]}return e.toNumber()}function kr(e,t){if(t===1)return e;let n=`${e}s`;return a[n.toLowerCase()]===void 0?e:n}function Ln(e,t){let n$1,o=false;for(let r of e){if(Number.isNaN(r.toNumber())){o=true;continue}if(n$1===void 0){n$1=r;continue}let{lv:i,rv:a,sameMeasure:u}=he(n$1,r);if(!u){let l=n$1.type===6?n$1.unit:void 0,s=r.type===6?r.unit:void 0,p=Fe(l,s,"compared");return N("INCOMPATIBLE_UNITS",p??`Cannot compare incompatible units: ${l??"?"} and ${s??"?"}`)}(t?a>i:a<i)&&(n$1=r);}return o?n(NaN):n$1===void 0?n(t?-1/0:1/0):n$1.type===6?n$1:n(n$1.toNumber())}function Ue(e,t){return e.type===6&&e.unit!==void 0?u(t,e.unit):n(t)}function Fn(e,t){let n=Number.isFinite(t)?Math.min(100,Math.max(0,Math.trunc(t))):0;if(e.exact!==void 0){let a=oa(e.exact,n);return $e(e,ra(a),n,a)}let o=e.toNumber();if(!Number.isFinite(o))return $e(e,o,n);let r=Math.pow(10,n),i=o*r;return !Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER?$e(e,o,n):$e(e,Math.round(i)/r,n)}function $e(e,t,n$1,o){let r=e.type===6&&e.unit!==void 0?u(t,e.unit):n(t);return r.decimalPlaces=n$1,o!==void 0&&(r.exact=o),r}function Un(e,t,n){if(Number.isFinite(e)&&Number.isFinite(t))return null;let o=Number.isFinite(e)?t:e;return N("INVALID_INTEGER_OPERAND",`${n} needs two whole numbers, and ${Number.isNaN(o)?"one of them has no value":"one of them is infinite"}`)}function $n(e,t){let n=e,o=t;for(;o!==0;){let r=o;o=n%o,n=r;}return n}var qa={0:e=>{let t=e[0].toNumber();return t>=0?n(Math.sqrt(t)):_(s("sqrt",[p(t)]))},1:e=>e[0].type===7?ca(e[0].value):Ue(e[0],Math.abs(e[0].toNumber())),2:e=>n(Math.sin(st(e[0]))),3:e=>n(Math.cos(st(e[0]))),4:e=>n(Math.tan(st(e[0]))),5:e=>n(Math.log(e[0].toNumber())),6:e=>Ue(e[0],Math.ceil(e[0].toNumber())),7:e=>Ue(e[0],Math.floor(e[0].toNumber())),8:e=>e.length>=2?Fn(e[0],e[1].toNumber()):Ue(e[0],Math.round(e[0].toNumber())),9:e=>Ln(e,false),10:e=>Ln(e,true),11:e=>n(Math.asin(e[0].toNumber())),12:e=>n(Math.acos(e[0].toNumber())),13:e=>n(Math.atan(e[0].toNumber())),14:e=>n(Math.atan2(e[0].toNumber(),e[1].toNumber())),15:e=>n(Math.sinh(e[0].toNumber())),16:e=>n(Math.cosh(e[0].toNumber())),17:e=>n(Math.tanh(e[0].toNumber())),18:e=>n(Math.asinh(e[0].toNumber())),19:e=>n(Math.acosh(e[0].toNumber())),20:e=>n(Math.atanh(e[0].toNumber())),21:e=>n(Math.cbrt(e[0].toNumber())),22:e=>n(Math.clz32(e[0].toNumber())),23:e=>n(Math.expm1(e[0].toNumber())),24:e=>n(Math.exp(e[0].toNumber())),25:e=>n(Math.fround(e[0].toNumber())),26:e=>n(Math.hypot(...e.map(t=>t.toNumber()))),27:e=>n(Math.imul(e[0].toNumber(),e[1].toNumber())),28:e=>n(Math.log10(e[0].toNumber())),29:e=>n(Math.log1p(e[0].toNumber())),30:e=>n(Math.log2(e[0].toNumber())),31:e=>e[0].type===7?e[1].type!==0?N("MATRIX_POWER_UNSUPPORTED",`pow: a matrix's exponent must be a whole number, as in "pow([1,2;3,4], 2)".`):$(e[0].value,e[1].value):e[1].type===7?N("MATRIX_POWER_UNSUPPORTED",'pow: a matrix may only be the base, as in "pow([1,2;3,4], 2)".'):n(Je(e[0].toNumber(),e[1].toNumber())),32:()=>n(Math.random()),33:e=>n(Math.sign(e[0].toNumber())),34:e=>n(Math.trunc(e[0].toNumber())),35:e=>n(e[0].toNumber()*Math.PI/180),36:e=>n(e[0].toNumber()*180/Math.PI),37:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return t>n$1?N("INVALID_RANGE",`roll: invalid range, ${t} is greater than ${n$1}`):n(Math.floor(Math.random()*(n$1-t+1))+t)},38:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n$1=Math.trunc(Math.abs(e[1].toNumber())),o=Un(t,n$1,"gcd");return o||n($n(t,n$1))},39:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n$1=Math.trunc(Math.abs(e[1].toNumber())),o=Un(t,n$1,"lcm");return o||(t===0||n$1===0?n(0):n(t/$n(t,n$1)*n$1))},40:e=>{let t=Math.trunc(e[0].toNumber()),n$1=Math.trunc(e[1].toNumber());if(t<0||n$1<0||n$1>t)return N("INVALID_RANGE",`permutation: invalid n=${t}, r=${n$1} (require 0 <= r <= n)`);let o=1;for(let r=0;r<n$1;r++)if(o*=t-r,!Number.isFinite(o))return N("PERMUTATION_OVERFLOW",`permutation: P(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${r+1} of ${n$1} factors)`);return n(o)},41:e=>{let t=Math.trunc(e[0].toNumber()),n$1=Math.trunc(e[1].toNumber());if(t<0||n$1<0||n$1>t)return N("INVALID_RANGE",`combination: invalid n=${t}, r=${n$1} (require 0 <= r <= n)`);let o=Math.min(n$1,t-n$1),r=1;for(let i=0;i<o;i++)if(r=r*(t-i)/(i+1),!Number.isFinite(r))return N("COMBINATION_OVERFLOW",`combination: C(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${i+1} of ${o} steps)`);return n(Math.round(r))},42:e=>{if(e.length===0)return n(0);let t=e.reduce((n,o)=>n+o.toNumber(),0);return n(t/e.length)},43:e=>{if(e.length===0)return n(0);let t=e.map(o=>o.toNumber()).sort((o,r)=>o-r),n$1=Math.floor(t.length/2);return n(t.length%2===0?(t[n$1-1]+t[n$1])/2:t[n$1])},44:e=>n(e.reduce((t,n)=>t+n.toNumber(),0)),45:e=>n(e.length),46:e=>{let[t,n$1,o]=e,{lv:r,rv:i}=he(t,n$1);if(r===0)return N("PROPORTION_DIVIDE_BY_ZERO",`Cannot compute proportion: "${t.value}" is zero`);let a=o.toNumber()*(i/r);return o.type===6?u(a,o.unit):n(a)},47:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return n$1>o?N("INVALID_RANGE",`clamp: invalid range, ${n$1} is greater than ${o}`):n(Math.min(Math.max(t,n$1),o))},48:e=>r$1(e[0].toNumber()),49:e=>r$1(e[0].toNumber(),"bin"),50:e=>n(Math.trunc(e[0].toNumber())),51:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(1+n$1<=0)return N("INVALID_RATE",`compoundInterest: rate ${n$1} makes (1 + rate) non-positive`);let r=t*Math.pow(1+n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},52:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(1+n$1<=0)return N("INVALID_RATE",`interestEarned: rate ${n$1} makes (1 + rate) non-positive`);let r=t*(Math.pow(1+n$1,o)-1);return e[0].type===6?u(r,e[0].unit):n(r)},53:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return t<=0||n$1<=0?N("INVALID_RANGE","compoundInterestRate: principal and futureValue must both be positive"):o<=0?N("INVALID_RANGE","compoundInterestRate: years must be greater than 0"):n(Math.pow(n$1/t,1/o)-1)},54:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return t<=0||n$1<=0?N("INVALID_RANGE","compoundInterestYears: principal and futureValue must both be positive"):1+o<=0||o===0?N("INVALID_RATE",`compoundInterestYears: rate ${o} is not usable (must be > -1 and not 0)`):n(Math.log(n$1/t)/Math.log(1+o))},55:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return N("INVALID_RANGE","loanRepayment: principal must be positive");if(o<=0)return N("INVALID_RANGE","loanRepayment: years must be positive");if(n$1<0)return N("INVALID_RATE","loanRepayment: rate must not be negative");if(r<0)return N("INVALID_RANGE","loanRepayment: periodsPerYear must not be negative");let{totalRepayment:i}=ft(t,n$1,o),a=r===0?i:i/(o*r);return e[0].type===6?u(a,e[0].unit):n(a)},56:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return N("INVALID_RANGE","loanInterest: principal must be positive");if(o<=0)return N("INVALID_RANGE","loanInterest: years must be positive");if(n$1<0)return N("INVALID_RATE","loanInterest: rate must not be negative");if(r<0)return N("INVALID_RANGE","loanInterest: periodsPerYear must not be negative");let{totalInterest:i}=ft(t,n$1,o),a=r===0?i:i/(o*r);return e[0].type===6?u(a,e[0].unit):n(a)},57:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(t<=0)return N("INVALID_RANGE","monthlyPayment: principal must be positive");if(o<=0)return N("INVALID_RANGE","monthlyPayment: years must be positive");if(n$1<0)return N("INVALID_RATE","monthlyPayment: rate must not be negative");let{monthlyPayment:r}=ft(t,n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},58:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?xn(e[0],e[0].unit,n$1,1):n(t*(1+n$1))},59:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return 1+n$1<=0?N("INVALID_RATE",`taxRemove: rate ${n$1} makes (1 + rate) non-positive`):e[0].type===6?In(e[0],e[0].unit,n$1)??u(t/(1+n$1),e[0].unit):n(t/(1+n$1))},60:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=lt(n$1,o);if(r===void 0)return N("INFLATION_YEAR_OUT_OF_RANGE",`inflationAdjust: fromYear ${n$1} or toYear ${o} is outside the bundled CPI table's range (${Cn}-${Pn})`);let i=t*r;return e[0].type===6?u(i,e[0].unit):n(i)},61:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return n(Je(n$1,1/t))},62:e=>{let t=e[0].toNumber();if(!Number.isInteger(t)||t<0)return N("INVALID_FACTORIAL_INPUT",`fact: ${t} is not a non-negative integer`);if(t>170)return N("FACTORIAL_OVERFLOW",`fact: ${t}! exceeds the maximum representable double (170! is the largest finite factorial)`);let n$1=1;for(let o=2;o<=t;o++)n$1*=o;return n(n$1)},63:e=>e[0].type===7?ba(e[0].value):e[0],64:e=>e[0].type===7?ca(e[0].value):n(e[0].toNumber()),65:e=>e[0].type===7?da(e[0].value):n(1/e[0].toNumber()),66:e=>{let[t,n$1]=e;if(t.type===0&&n$1.type===0)return n(t.toNumber()*n$1.toNumber());let o=r=>r.type===7?r.value:{rows:1,cols:1,data:[r.toNumber()],hasSymbolic:false};return _$1(o(t),o(n$1))},67:e=>{let[t]=e;return t.type!==9?t:_(F(t.value))},68:e=>{let[t]=e;return t.type!==9?t:_(Qt(t.value))},69:e=>{let[t,n,o]=e;return o?.type!==3?N("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown."):mn(t,n,o.value)},70:e=>{let[t,n,o]=e,r=mt(n,"der");if(typeof r!="string")return r;let i=O(t);return i===null?N("SYMBOLIC_NONFINITE_OPERAND","der needs an expression with an exact value."):_(xe(i,r,o?.toNumber()??1))},71:e=>{let[t,n]=e,o=mt(n,"integral");if(typeof o!="string")return o;let r=O(t);if(r===null)return N("SYMBOLIC_NONFINITE_OPERAND","integral needs an expression with an exact value.");let i=ve(r,o);return i.ok?_(i.value):N("SYMBOLIC_INTEGRAL_UNSUPPORTED",`Cannot integrate this: ${i.reason}.`)},72:e=>{let[t,n,o,r]=e,i=mt(n,"taylor");if(typeof i!="string")return i;let a=O(t),u=O(o);return a===null||u===null||u.kind!=="const"?N("SYMBOLIC_NONFINITE_OPERAND","taylor needs an expression and an exact expansion point."):_(On(a,i,u.value,r.toNumber()))},73:e=>{let t=[];for(let a of e){let u=O(a);if(u===null)return N("SYMBOLIC_NONFINITE_OPERAND","jacobian needs expressions with exact values.");t.push(u);}let n=new Set;for(let a of t)for(let u of u$1(a))n.add(u);let o=[...n].sort();if(o.length===0)return N("SYMBOLIC_JACOBIAN_NO_VARIABLES","jacobian needs at least one unknown to differentiate against.");let r=_n(t,o),i=[];for(let a of r)for(let u of a)i.push(W(u));return C$1(r.length,o.length,Y(r.length,o.length,i))},74:e=>_(w(o(a$1,d(e[0].toNumber())))),75:e=>ct("conj",e[0]),76:e=>ct("re",e[0]),77:e=>ct("im",e[0]),78:e=>{let t=e[0];return t.type!==9?t:_(J(t.value))},79:e=>{let t=e[0];return t.type!==9?t:_(An(t.value))},85:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();if(1+n$1<=0)return N("INVALID_RATE",`taxIn: rate ${n$1} makes (1 + rate) non-positive`);let o=t-t/(1+n$1);return e[0].type===6?Mn(e[0],e[0].unit,n$1)??u(o,e[0].unit):n(o)},86:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?Rn(e[0],n$1,e[0].unit):n(t*n$1)},87:e=>n(Math.sin(e[0].toNumber()*Math.PI/180)),88:e=>n(Math.cos(e[0].toNumber()*Math.PI/180)),89:e=>n(Math.tan(e[0].toNumber()*Math.PI/180)),90:e=>n(Math.asin(e[0].toNumber())*180/Math.PI),91:e=>n(Math.acos(e[0].toNumber())*180/Math.PI),92:e=>n(Math.atan(e[0].toNumber())*180/Math.PI),93:e=>u(e[0].toNumber(),"days"),94:e=>{let t$1=typeof e[1]?.value=="string"?e[1].value:void 0,n=typeof e[2]?.value=="string"?e[2].value:void 0;if(t$1===void 0||n===void 0)return N("UNKNOWN_UNIT",'both units have to be named, as in "12.5 minutes in minutes and seconds"');let o=a[t$1.toLowerCase()],r=a[n.toLowerCase()];if(o===void 0||r===void 0)return N("UNKNOWN_UNIT",`${t$1} and ${n}: one of these is not a unit`);if(o[0]!==r[0])return N("INCOMPATIBLE_UNITS",`${t$1} and ${n} measure different things`);if(r[1]>=o[1])return N("INCOMPATIBLE_UNITS",`${t$1} and ${n}: name the larger unit first`);let i=e[0],a$1=i.type===6&&i.unit!==void 0?a[i.unit.toLowerCase()]:void 0,u=i.toNumber()*(a$1?.[1]??o[1]),l=Math.floor(u/o[1]),s=Math.round((u-l*o[1])/r[1]*1e3)/1e3;return t(`${l} ${t$1} ${s} ${n}`)},95:e=>{let t=e[0],n=String(e[1].value),o=t.type===6&&t.unit!==void 0?t.unit:"";return o.includes("/")?N("INVALID_RATE_UNIT",`${o}/${n}: that is already a rate`):u(t.toNumber(),`${o}/${n}`)},96:e=>{let t=e[0],n$1=e[1];if(n$1.type!==6||n$1.unit===void 0||!n$1.unit.includes("/"))return N("INVALID_RATE",'at: the right-hand side has to be a rate, as in "$30/hour"');let o=n$1.unit.indexOf("/"),r=n$1.unit.slice(0,o),i=n$1.unit.slice(o+1),a$1=t.type===6?t.unit:void 0,u$1=a[i.toLowerCase()],l=a$1===void 0?void 0:a[a$1.toLowerCase()];if(l!==void 0&&u$1!==void 0&&l[0]===u$1[0]){let p=t.toNumber()*l[1]/u$1[1]*n$1.toNumber();return r===""?n(p):u(p,r)}if(a$1!==void 0&&a$1===r){let s=t.toNumber()/n$1.toNumber();return u(s,kr(i,s))}if(a$1===void 0){let s=t.toNumber()*n$1.toNumber();return r===""?n(s):u(s,r)}return N("INCOMPATIBLE_UNITS",`at: ${a$1} matches neither side of ${n$1.unit}`)},80:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0)return N("INVALID_RATE",`compounding: ${r} periods per year is not a period`);if(1+n$1/r<=0)return N("INVALID_RATE",`compounding: rate ${n$1} makes each period non-positive`);let i=t*Math.pow(1+n$1/r,r*o);return e[0].type===6?u(i,e[0].unit):n(i)},81:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0||1+n$1/r<=0)return N("INVALID_RATE",`compounding: rate ${n$1} over ${r} periods per year is not usable`);let i=t*(Math.pow(1+n$1/r,r*o)-1);return e[0].type===6?u(i,e[0].unit):n(i)},82:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(1+n$1<=0)return N("INVALID_RATE",`presentValue: rate ${n$1} makes (1 + rate) non-positive`);let r=t/Math.pow(1+n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},83:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return t===0?N("INVALID_RATE","roi: nothing was invested, so there is no return on it"):n((n$1-t)/t)},84:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0?N("INVALID_RATE","annual return: the amount invested must be positive"):o<=0?N("INVALID_RATE","annual return: the period must be longer than zero"):n<=0?N("INVALID_RATE","annual return: nothing was returned, so there is no annual rate"):L(Math.pow(n/t,1/o)-1)},97:e=>Fn(e[0],e[1].toNumber()),98:e=>{let t=e[1].toNumber();return !Number.isInteger(t)||t<1?N("INVALID_RANGE",`split: the number of shares must be a whole number of at least 1, not ${e[1].toNumber()}.`):H(Sn(e[0],t))},99:e=>{let t=e[0].toNumber(),n$1=Vr(e[1]),o=e[2].toNumber();if(n$1===null)return N("INVALID_RANGE",'savings goal: the duration must be in months or years, e.g. "in 2 years".');if(t<=0)return N("INVALID_RANGE","savings goal: the target must be positive.");if(n$1<=0)return N("INVALID_RANGE","savings goal: the duration must be positive.");if(o<0)return N("INVALID_RATE","savings goal: the rate must not be negative.");let r=Tr(t,o/12,n$1);return e[0].type===6?u(r,e[0].unit):n(r)},100:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber(),i=typeof e[4]?.value=="string"?e[4].value:"periods";if(t<=0)return N("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return N("INVALID_RANGE","savings goal: the contribution must be positive.");if(r<0)return N("INVALID_RATE","savings goal: the rate must not be negative.");let a=Or(t,n,r/o);return u(a,i)}};function Vr(e){if(e.type!==6)return null;let t=e.unit;return t==="months"||t==="month"?e.toNumber():t==="years"||t==="year"?e.toNumber()*12:null}function Tr(e,t,n){return t===0?e/n:e*t/(Math.pow(1+t,n)-1)}function Or(e,t,n){let o=n===0?e/t:Math.log(1+e*n/t)/Math.log(1+n);return Math.ceil(o-1e-9)}function ct(e,t){let n=O(t);return n===null?N("SYMBOLIC_NONFINITE_OPERAND",e+" needs a value with an exact number."):_(s(e,[n]))}function mt(e,t){return e?.type!==3?N("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown.`):e.value}function ft(e,t,n){let o=n*12,r=t/12,i=r===0?e/o:e*r/(1-Math.pow(1+r,-o)),a=i*o,u=a-e;return {monthlyPayment:i,totalRepayment:a,totalInterest:u}}var Ya=wn.pluginFunctions,Bn=255,qn=0;function _r(){if(qn>Bn)throw c$2.config("PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",`allocatePluginFunctionIndex: pool exhausted (max ${Bn+1} allocations).`);return qn++}var Yn=new Map;function Ga(e){let t=Yn.get(e);return t===void 0&&(t=_r(),Yn.set(e,t)),t}var dt=new Map;function ja(e,t){let n=e.toLowerCase(),o=dt.get(n);o&&o!==t&&console.warn(`[asConverterRegistry] Converter name "${n}" is already registered \u2014 overwriting.`),dt.set(n,t);}function Ka(e){dt.delete(e.toLowerCase());}var Be=class Be{constructor(){this.values=new Map;this.listeners=new Set;this.notifyDepth=0;}get(t){return this.values.get(t)}has(t){return this.values.has(t)}set(t,n){let o=this.values.get(t);this.values.set(t,n),!(o!==void 0&&wr(o,n))&&this.notify(t,n);}notify(t,n){if(!(this.notifyDepth>=Be.MAX_NOTIFY_DEPTH)){this.notifyDepth++;try{for(let o of this.listeners)o(t,n);}finally{this.notifyDepth--;}}}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}clear(){this.values.clear(),this.listeners.clear(),this.notifyDepth=0;}};Be.MAX_NOTIFY_DEPTH=64;var pt=Be;function wr(e,t){if(e.type!==t.type||e.unit!==t.unit||(e.timedOut??false)!==(t.timedOut??false))return false;let n=e.value,o=t.value;if(Array.isArray(n)||Array.isArray(o)){if(!Array.isArray(n)||!Array.isArray(o)||n.length!==o.length)return false;for(let r=0;r<n.length;r++)if(!Object.is(n[r],o[r]))return false;return true}return Object.is(n,o)}var Za=new pt;function Ha(e){return `global:${e}`}export{Pn as A,Ra as B,qa as C,Ya as D,_r as E,Ga as F,dt as G,ja as H,Ka as I,Za as J,Ha as K,ge as a,Rn as b,xn as c,ln as d,bi as e,yi as f,hi as g,Ni as h,mn as i,he as j,Vi as k,Ti as l,Oi as m,dn as n,_i as o,wi as p,Je as q,Di as r,Ci as s,Pi as t,Li as u,Ne as v,$i as w,Sr as x,wn as y,Cn as z};//# sourceMappingURL=chunk-W2JAR233.js.map
2
+ //# sourceMappingURL=chunk-W2JAR233.js.map