solve-engine 2.25.0 → 2.26.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 (240) hide show
  1. package/dist/CalendarBackend-MdS3Bb4P.d.cts +181 -0
  2. package/dist/CalendarBackend-MdS3Bb4P.d.ts +181 -0
  3. package/dist/{Configuration-DnzYPmoK.d.cts → Configuration-BxriK9Kw.d.cts} +63 -4
  4. package/dist/{Configuration-DnzYPmoK.d.ts → Configuration-BxriK9Kw.d.ts} +63 -4
  5. package/dist/DateCalendar-B85t6Vk6.d.ts +90 -0
  6. package/dist/DateCalendar-CUGI1fT4.d.cts +90 -0
  7. package/dist/{EngineError-fR1K1rvx.d.cts → EngineError-C-kBwYlN.d.cts} +31 -4
  8. package/dist/{EngineError-fR1K1rvx.d.ts → EngineError-C-kBwYlN.d.ts} +31 -4
  9. package/dist/{FormattingSettings-bRKjU7wI.d.ts → FormattingSettings-ByO-4wiM.d.cts} +14 -0
  10. package/dist/{FormattingSettings-bRKjU7wI.d.cts → FormattingSettings-CvCzAfsz.d.ts} +14 -0
  11. package/dist/{Lexer-aB95pjoX.d.cts → Lexer-DhGhoAa2.d.cts} +13 -3
  12. package/dist/{Lexer-Bmctxl0n.d.ts → Lexer-DqtnZMC5.d.ts} +13 -3
  13. package/dist/{PackageCompatibility-CUVg8tmt.d.cts → PackageCompatibility-CNiTtC6S.d.cts} +1 -1
  14. package/dist/{PackageCompatibility-BludTs7v.d.ts → PackageCompatibility-fj_f7uqC.d.ts} +1 -1
  15. package/dist/{PackageRegistry-Dvn4i2QK.d.cts → PackageRegistry-BHBCFswo.d.cts} +328 -14
  16. package/dist/{PackageRegistry-DT-x32OM.d.ts → PackageRegistry-CNZUwWHJ.d.ts} +328 -14
  17. package/dist/{Parselet-BawfGuTF.d.cts → Parselet-DF3864la.d.cts} +19 -3
  18. package/dist/{Parselet-DqTbbtWA.d.ts → Parselet-Dgymjxzd.d.ts} +19 -3
  19. package/dist/{Token-CbP_OutD.d.cts → Token-D8f7yaz1.d.cts} +17 -0
  20. package/dist/{Token-CbP_OutD.d.ts → Token-D8f7yaz1.d.ts} +17 -0
  21. package/dist/{TokenNormalizer-CLBtiE8M.d.ts → TokenNormalizer-IF7nPRMp.d.ts} +1 -1
  22. package/dist/{TokenNormalizer-CjTDmHgB.d.cts → TokenNormalizer-Pe3_390t.d.cts} +1 -1
  23. package/dist/{ScopeManager-B636am7Y.d.ts → VMBuiltins-CZiZRKn-.d.ts} +91 -9
  24. package/dist/{ScopeManager-CdwX0VTw.d.cts → VMBuiltins-kv4rr0y5.d.cts} +91 -9
  25. package/dist/{VMCheckpoints-DDlxNssY.d.ts → VMCheckpoints-DXze6ypg.d.ts} +2 -2
  26. package/dist/{VMCheckpoints-CYqeq8IV.d.cts → VMCheckpoints-yun4ocSv.d.cts} +2 -2
  27. package/dist/{Value-Ds3Gy07C.d.cts → Value-BYHw-x7q.d.cts} +57 -1
  28. package/dist/{Value-Ds3Gy07C.d.ts → Value-BYHw-x7q.d.ts} +57 -1
  29. package/dist/{WorkerError-B1dF3VYT.d.cts → WorkerError-BLZyNq6M.d.cts} +1 -1
  30. package/dist/{WorkerError-dneODN-u.d.ts → WorkerError-CfBJYueR.d.ts} +1 -1
  31. package/dist/chunk-2SYYKQ4Q.cjs +2 -0
  32. package/dist/chunk-2SYYKQ4Q.cjs.map +1 -0
  33. package/dist/chunk-6EYKVQT3.cjs +2 -0
  34. package/dist/chunk-6EYKVQT3.cjs.map +1 -0
  35. package/dist/chunk-7RC6RBS6.cjs +2 -0
  36. package/dist/chunk-7RC6RBS6.cjs.map +1 -0
  37. package/dist/chunk-AZX4NTYN.cjs +3 -0
  38. package/dist/chunk-AZX4NTYN.cjs.map +1 -0
  39. package/dist/{chunk-JFZ5SLF7.js → chunk-BCR53EIL.js} +2 -2
  40. package/dist/{chunk-JFZ5SLF7.js.map → chunk-BCR53EIL.js.map} +1 -1
  41. package/dist/chunk-BLJ6E577.js +2 -0
  42. package/dist/chunk-BLJ6E577.js.map +1 -0
  43. package/dist/{chunk-4BAUQE6A.cjs → chunk-C5GEMKUY.cjs} +3 -3
  44. package/dist/{chunk-4BAUQE6A.cjs.map → chunk-C5GEMKUY.cjs.map} +1 -1
  45. package/dist/chunk-CL7DM2FX.js +2 -0
  46. package/dist/chunk-CL7DM2FX.js.map +1 -0
  47. package/dist/{chunk-BMXYR5LI.cjs → chunk-CQLCTKMX.cjs} +2 -2
  48. package/dist/{chunk-BMXYR5LI.cjs.map → chunk-CQLCTKMX.cjs.map} +1 -1
  49. package/dist/chunk-CQY23OF5.cjs +5 -0
  50. package/dist/chunk-CQY23OF5.cjs.map +1 -0
  51. package/dist/chunk-D4VBWPWN.js +2 -0
  52. package/dist/chunk-D4VBWPWN.js.map +1 -0
  53. package/dist/chunk-E4HAKNBQ.cjs +2 -0
  54. package/dist/chunk-E4HAKNBQ.cjs.map +1 -0
  55. package/dist/{chunk-XHQYHXRE.js → chunk-ESZNJQ2C.js} +3 -3
  56. package/dist/{chunk-XHQYHXRE.js.map → chunk-ESZNJQ2C.js.map} +1 -1
  57. package/dist/{chunk-IJMNVBIS.js → chunk-FAO6DQ74.js} +2 -2
  58. package/dist/chunk-FAO6DQ74.js.map +1 -0
  59. package/dist/{chunk-WGP4UUO5.cjs → chunk-FDKTESBC.cjs} +2 -2
  60. package/dist/{chunk-WGP4UUO5.cjs.map → chunk-FDKTESBC.cjs.map} +1 -1
  61. package/dist/{chunk-NEGZZB7F.cjs → chunk-G2V33LFM.cjs} +2 -2
  62. package/dist/{chunk-NEGZZB7F.cjs.map → chunk-G2V33LFM.cjs.map} +1 -1
  63. package/dist/chunk-GJZIJK2Q.cjs +2 -0
  64. package/dist/chunk-GJZIJK2Q.cjs.map +1 -0
  65. package/dist/chunk-GQM6ICDM.js +2 -0
  66. package/dist/chunk-GQM6ICDM.js.map +1 -0
  67. package/dist/chunk-GVL3ZMS7.cjs +2 -0
  68. package/dist/chunk-GVL3ZMS7.cjs.map +1 -0
  69. package/dist/{chunk-YBQPEWT7.cjs → chunk-GXO7TSXQ.cjs} +3 -3
  70. package/dist/chunk-GXO7TSXQ.cjs.map +1 -0
  71. package/dist/{chunk-OONQ3V3I.js → chunk-HANGBVEE.js} +2 -2
  72. package/dist/{chunk-OONQ3V3I.js.map → chunk-HANGBVEE.js.map} +1 -1
  73. package/dist/chunk-J4K72CQN.js +2 -0
  74. package/dist/chunk-J4K72CQN.js.map +1 -0
  75. package/dist/{chunk-72PYPENZ.js → chunk-LE6WZLJ4.js} +2 -2
  76. package/dist/{chunk-72PYPENZ.js.map → chunk-LE6WZLJ4.js.map} +1 -1
  77. package/dist/chunk-LMZDTQS5.js +3 -0
  78. package/dist/chunk-LMZDTQS5.js.map +1 -0
  79. package/dist/chunk-LQIRBP4Q.js +2 -0
  80. package/dist/chunk-LQIRBP4Q.js.map +1 -0
  81. package/dist/{chunk-RDYXH7ML.js → chunk-LTUYWJGO.js} +2 -2
  82. package/dist/{chunk-RDYXH7ML.js.map → chunk-LTUYWJGO.js.map} +1 -1
  83. package/dist/chunk-MCU7UYKG.js +3 -0
  84. package/dist/{chunk-ZDCZ5IDD.js.map → chunk-MCU7UYKG.js.map} +1 -1
  85. package/dist/chunk-MTN53APQ.js +5 -0
  86. package/dist/chunk-MTN53APQ.js.map +1 -0
  87. package/dist/chunk-OPKJ2WWB.cjs +3 -0
  88. package/dist/chunk-OPKJ2WWB.cjs.map +1 -0
  89. package/dist/chunk-QQHHZPEW.cjs +2 -0
  90. package/dist/chunk-QQHHZPEW.cjs.map +1 -0
  91. package/dist/chunk-RRUGQ6DM.js +2 -0
  92. package/dist/chunk-RRUGQ6DM.js.map +1 -0
  93. package/dist/chunk-S3ODNMJS.js +2 -0
  94. package/dist/chunk-S3ODNMJS.js.map +1 -0
  95. package/dist/{chunk-SAF3B3AX.cjs → chunk-SE6ZCGZ5.cjs} +2 -2
  96. package/dist/{chunk-SAF3B3AX.cjs.map → chunk-SE6ZCGZ5.cjs.map} +1 -1
  97. package/dist/chunk-TC23XEAV.js +2 -0
  98. package/dist/chunk-TC23XEAV.js.map +1 -0
  99. package/dist/{chunk-FYAMQFZZ.cjs → chunk-TMQ37JQY.cjs} +3 -3
  100. package/dist/{chunk-FYAMQFZZ.cjs.map → chunk-TMQ37JQY.cjs.map} +1 -1
  101. package/dist/chunk-TPPM4QSS.cjs +2 -0
  102. package/dist/chunk-TPPM4QSS.cjs.map +1 -0
  103. package/dist/{chunk-57PSJQQW.js → chunk-VB6QMU2W.js} +3 -3
  104. package/dist/chunk-VB6QMU2W.js.map +1 -0
  105. package/dist/chunk-VQO54ZMA.js +2 -0
  106. package/dist/chunk-VQO54ZMA.js.map +1 -0
  107. package/dist/{chunk-7DP57BA7.js → chunk-Y7XRA2EV.js} +2 -2
  108. package/dist/{chunk-7DP57BA7.js.map → chunk-Y7XRA2EV.js.map} +1 -1
  109. package/dist/{chunk-5IJD5L3O.cjs → chunk-YBQOQTVL.cjs} +2 -2
  110. package/dist/chunk-YBQOQTVL.cjs.map +1 -0
  111. package/dist/{chunk-EL2XUOWX.js → chunk-YG7UWQFV.js} +2 -2
  112. package/dist/{chunk-EL2XUOWX.js.map → chunk-YG7UWQFV.js.map} +1 -1
  113. package/dist/chunk-YS2OW75C.cjs +2 -0
  114. package/dist/chunk-YS2OW75C.cjs.map +1 -0
  115. package/dist/chunk-ZC2NPRLO.js +3 -0
  116. package/dist/chunk-ZC2NPRLO.js.map +1 -0
  117. package/dist/{chunk-FYTB7SDP.cjs → chunk-ZDJTDFTR.cjs} +2 -2
  118. package/dist/{chunk-FYTB7SDP.cjs.map → chunk-ZDJTDFTR.cjs.map} +1 -1
  119. package/dist/chunk-ZE5KKMBV.cjs +2 -0
  120. package/dist/chunk-ZE5KKMBV.cjs.map +1 -0
  121. package/dist/{chunk-GBCN7FNV.cjs → chunk-ZSLVLMO5.cjs} +2 -2
  122. package/dist/{chunk-GBCN7FNV.cjs.map → chunk-ZSLVLMO5.cjs.map} +1 -1
  123. package/dist/constants.cjs +1 -1
  124. package/dist/constants.d.cts +1 -1
  125. package/dist/constants.d.ts +1 -1
  126. package/dist/constants.js +1 -1
  127. package/dist/engine.cjs +1 -1
  128. package/dist/engine.d.cts +14 -12
  129. package/dist/engine.d.ts +14 -12
  130. package/dist/engine.js +1 -1
  131. package/dist/errors.cjs +1 -1
  132. package/dist/errors.d.cts +3 -3
  133. package/dist/errors.d.ts +3 -3
  134. package/dist/errors.js +1 -1
  135. package/dist/format.cjs +1 -1
  136. package/dist/format.d.cts +4 -3
  137. package/dist/format.d.ts +4 -3
  138. package/dist/format.js +1 -1
  139. package/dist/index.cjs +1 -1
  140. package/dist/index.cjs.map +1 -1
  141. package/dist/index.d.cts +15 -13
  142. package/dist/index.d.ts +15 -13
  143. package/dist/index.js +1 -1
  144. package/dist/index.js.map +1 -1
  145. package/dist/language.d.cts +12 -11
  146. package/dist/language.d.ts +12 -11
  147. package/dist/lexer.cjs +1 -1
  148. package/dist/lexer.d.cts +4 -4
  149. package/dist/lexer.d.ts +4 -4
  150. package/dist/lexer.js +1 -1
  151. package/dist/normalizer.cjs +1 -1
  152. package/dist/normalizer.d.cts +3 -3
  153. package/dist/normalizer.d.ts +3 -3
  154. package/dist/normalizer.js +1 -1
  155. package/dist/packages.cjs +1 -1
  156. package/dist/packages.d.cts +11 -10
  157. package/dist/packages.d.ts +11 -10
  158. package/dist/packages.js +1 -1
  159. package/dist/parser.cjs +1 -1
  160. package/dist/parser.d.cts +5 -4
  161. package/dist/parser.d.ts +5 -4
  162. package/dist/parser.js +1 -1
  163. package/dist/{pipeline-69q2tsLE.d.cts → pipeline-BYkKNpql.d.cts} +1 -1
  164. package/dist/{pipeline-DTqGLPsV.d.ts → pipeline-Cl7KW8CB.d.ts} +1 -1
  165. package/dist/resolvers.d.cts +2 -2
  166. package/dist/resolvers.d.ts +2 -2
  167. package/dist/temporal.cjs +2 -0
  168. package/dist/temporal.cjs.map +1 -0
  169. package/dist/temporal.d.cts +201 -0
  170. package/dist/temporal.d.ts +201 -0
  171. package/dist/temporal.js +2 -0
  172. package/dist/temporal.js.map +1 -0
  173. package/dist/testing.cjs +2 -2
  174. package/dist/testing.cjs.map +1 -1
  175. package/dist/testing.d.cts +12 -11
  176. package/dist/testing.d.ts +12 -11
  177. package/dist/testing.js +1 -1
  178. package/dist/testing.js.map +1 -1
  179. package/dist/uom.cjs +1 -1
  180. package/dist/uom.d.cts +2 -2
  181. package/dist/uom.d.ts +2 -2
  182. package/dist/uom.js +1 -1
  183. package/dist/vm.cjs +1 -1
  184. package/dist/vm.cjs.map +1 -1
  185. package/dist/vm.d.cts +8 -56
  186. package/dist/vm.d.ts +8 -56
  187. package/dist/vm.js +1 -1
  188. package/dist/vm.js.map +1 -1
  189. package/dist/worker.cjs +2 -2
  190. package/dist/worker.cjs.map +1 -1
  191. package/dist/worker.d.cts +35 -13
  192. package/dist/worker.d.ts +35 -13
  193. package/dist/worker.js +2 -2
  194. package/dist/worker.js.map +1 -1
  195. package/package.json +12 -1
  196. package/dist/chunk-4BRTUFTH.js +0 -2
  197. package/dist/chunk-4BRTUFTH.js.map +0 -1
  198. package/dist/chunk-4NZXCHQL.cjs +0 -2
  199. package/dist/chunk-4NZXCHQL.cjs.map +0 -1
  200. package/dist/chunk-57PSJQQW.js.map +0 -1
  201. package/dist/chunk-5IJD5L3O.cjs.map +0 -1
  202. package/dist/chunk-634ILVMP.cjs +0 -2
  203. package/dist/chunk-634ILVMP.cjs.map +0 -1
  204. package/dist/chunk-63ZOOUOL.js +0 -2
  205. package/dist/chunk-63ZOOUOL.js.map +0 -1
  206. package/dist/chunk-77KI7AKJ.cjs +0 -2
  207. package/dist/chunk-77KI7AKJ.cjs.map +0 -1
  208. package/dist/chunk-7N3IJSWF.js +0 -5
  209. package/dist/chunk-7N3IJSWF.js.map +0 -1
  210. package/dist/chunk-DUYTXLO2.js +0 -2
  211. package/dist/chunk-DUYTXLO2.js.map +0 -1
  212. package/dist/chunk-IJMNVBIS.js.map +0 -1
  213. package/dist/chunk-JSM3O7EM.cjs +0 -2
  214. package/dist/chunk-JSM3O7EM.cjs.map +0 -1
  215. package/dist/chunk-MZMA32NE.js +0 -3
  216. package/dist/chunk-MZMA32NE.js.map +0 -1
  217. package/dist/chunk-N4SSR7Q6.js +0 -2
  218. package/dist/chunk-N4SSR7Q6.js.map +0 -1
  219. package/dist/chunk-NMU5E7W7.js +0 -2
  220. package/dist/chunk-NMU5E7W7.js.map +0 -1
  221. package/dist/chunk-OB2VX4IL.js +0 -2
  222. package/dist/chunk-OB2VX4IL.js.map +0 -1
  223. package/dist/chunk-RAPEZR5L.cjs +0 -2
  224. package/dist/chunk-RAPEZR5L.cjs.map +0 -1
  225. package/dist/chunk-SPOVFRZO.cjs +0 -5
  226. package/dist/chunk-SPOVFRZO.cjs.map +0 -1
  227. package/dist/chunk-SQHBOWES.cjs +0 -2
  228. package/dist/chunk-SQHBOWES.cjs.map +0 -1
  229. package/dist/chunk-UF5XMZTT.js +0 -2
  230. package/dist/chunk-UF5XMZTT.js.map +0 -1
  231. package/dist/chunk-UV3EUIBT.cjs +0 -3
  232. package/dist/chunk-UV3EUIBT.cjs.map +0 -1
  233. package/dist/chunk-VMSCRVNX.cjs +0 -2
  234. package/dist/chunk-VMSCRVNX.cjs.map +0 -1
  235. package/dist/chunk-XBGK3TTU.cjs +0 -3
  236. package/dist/chunk-XBGK3TTU.cjs.map +0 -1
  237. package/dist/chunk-XX55RR4Q.js +0 -3
  238. package/dist/chunk-XX55RR4Q.js.map +0 -1
  239. package/dist/chunk-YBQPEWT7.cjs.map +0 -1
  240. package/dist/chunk-ZDCZ5IDD.js +0 -3
@@ -1,2 +0,0 @@
1
- import {c as c$1}from'./chunk-57PSJQQW.js';var d="2.25.0";var m=d;var l={date:{maxOffsetYears:100,minOffsetYears:-100,defaultFormat:"YYYY-MM-DD",inputOrder:"auto"},performance:{defaultCacheSize:2e3,maxDocumentLines:1e5},validation:{maxExpressionLength:2e3,maxComplexity:500,maxNestingDepth:50,autoBalanceParens:false},vm:{maxStackDepth:200,maxInstructions:5e4,maxCollectionSize:1e5,maxAllocatedElements:2e6,maxFunctionCalls:1e4,maxGoalSeekIterations:100},worker:{maxConcurrentWorkers:4,idleTimeoutMs:3e4,maxRetries:3,baseBackoffMs:1e3},diagnostic:{enabled:false,vmTraceEnabled:false},backgroundRefresh:{enabled:false},network:{enabled:true}};function r(s,e){return {date:{...s.date,...e.date},performance:{...s.performance,...e.performance},validation:{...s.validation,...e.validation},vm:{...s.vm,...e.vm},worker:{...s.worker,...e.worker},diagnostic:{...s.diagnostic,...e.diagnostic},backgroundRefresh:{...s.backgroundRefresh,...e.backgroundRefresh},network:{...s.network,...e.network}}}var c=class{constructor(e={}){this.config=r(l,e);}get(e){let o=e.split("."),t=this.config;for(let i of o)if(t&&typeof t=="object"&&i in t)t=t[i];else throw c$1.config("CONFIG_PATH_NOT_FOUND",`Configuration path not found: ${e}`,{path:e});return t}set(e,o){let t=e.split(".");if(t.length<2)throw c$1.config("INVALID_CONFIG_PATH",`Invalid path: ${e}. Must be in format 'section.property'`,{path:e});let i=t[0],u=t[1];if(!(i in this.config))throw c$1.config("CONFIG_SECTION_NOT_FOUND",`Configuration section not found: ${i}`,{section:i,path:e});let a=this.config[i];if(a&&typeof a=="object")a[u]=o;else throw c$1.config("CONFIG_PROPERTY_NOT_FOUND",`Configuration property not found: ${e}`,{path:e})}getConfig(){return r(this.config,{})}update(e){this.config=r(this.config,e);}reset(){this.config=r(l,{});}validate(){let e=[];return this.config.performance.maxDocumentLines>1e5&&e.push("maxDocumentLines cannot exceed 100,000"),this.config.date.maxOffsetYears>1e3&&e.push("maxOffsetYears cannot exceed 1000"),{valid:e.length===0,error:e.join("; "),warnings:[]}}};export{m as a,l as b,r as c,c as d};//# sourceMappingURL=chunk-DUYTXLO2.js.map
2
- //# sourceMappingURL=chunk-DUYTXLO2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../package.json","../src/constants/version.ts","../src/constants/Configuration.ts"],"names":["version","ENGINE_VERSION","DEFAULT_CONFIG","mergeEngineConfig","base","override","ConfigManager","config","path","keys","current","key","ErrorFactory","value","section","property","sectionConfig","errors"],"mappings":"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","file":"chunk-DUYTXLO2.js","sourcesContent":["{\n \"name\": \"solve-engine\",\n \"version\": \"2.25.0\",\n \"description\": \"An embeddable expression engine for natural-language calculations: units, currencies, percentages, dates and matrices, with the parsing and evaluation plumbing already built.\",\n \"keywords\": [\n \"expression-evaluator\",\n \"calculator\",\n \"bytecode-vm\",\n \"parser\",\n \"lexer\",\n \"dsl\",\n \"markdown\",\n \"obsidian\"\n ],\n \"license\": \"MIT\",\n \"author\": \"Liam Riddell\",\n \"homepage\": \"https://liamriddell.github.io/solve-engine/\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/LiamRiddell/solve-engine.git\",\n \"directory\": \"packages/engine\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/LiamRiddell/solve-engine/issues\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"files\": [\n \"dist\",\n \"LICENSE\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./engine\": {\n \"import\": {\n \"types\": \"./dist/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n },\n \"require\": {\n \"types\": \"./dist/engine.d.cts\",\n \"default\": \"./dist/engine.cjs\"\n }\n },\n \"./vm\": {\n \"import\": {\n \"types\": \"./dist/vm.d.ts\",\n \"default\": \"./dist/vm.js\"\n },\n \"require\": {\n \"types\": \"./dist/vm.d.cts\",\n \"default\": \"./dist/vm.cjs\"\n }\n },\n \"./format\": {\n \"import\": {\n \"types\": \"./dist/format.d.ts\",\n \"default\": \"./dist/format.js\"\n },\n \"require\": {\n \"types\": \"./dist/format.d.cts\",\n \"default\": \"./dist/format.cjs\"\n }\n },\n \"./language\": {\n \"import\": {\n \"types\": \"./dist/language.d.ts\",\n \"default\": \"./dist/language.js\"\n },\n \"require\": {\n \"types\": \"./dist/language.d.cts\",\n \"default\": \"./dist/language.cjs\"\n }\n },\n \"./packages\": {\n \"import\": {\n \"types\": \"./dist/packages.d.ts\",\n \"default\": \"./dist/packages.js\"\n },\n \"require\": {\n \"types\": \"./dist/packages.d.cts\",\n \"default\": \"./dist/packages.cjs\"\n }\n },\n \"./constants\": {\n \"import\": {\n \"types\": \"./dist/constants.d.ts\",\n \"default\": \"./dist/constants.js\"\n },\n \"require\": {\n \"types\": \"./dist/constants.d.cts\",\n \"default\": \"./dist/constants.cjs\"\n }\n },\n \"./lexer\": {\n \"import\": {\n \"types\": \"./dist/lexer.d.ts\",\n \"default\": \"./dist/lexer.js\"\n },\n \"require\": {\n \"types\": \"./dist/lexer.d.cts\",\n \"default\": \"./dist/lexer.cjs\"\n }\n },\n \"./parser\": {\n \"import\": {\n \"types\": \"./dist/parser.d.ts\",\n \"default\": \"./dist/parser.js\"\n },\n \"require\": {\n \"types\": \"./dist/parser.d.cts\",\n \"default\": \"./dist/parser.cjs\"\n }\n },\n \"./normalizer\": {\n \"import\": {\n \"types\": \"./dist/normalizer.d.ts\",\n \"default\": \"./dist/normalizer.js\"\n },\n \"require\": {\n \"types\": \"./dist/normalizer.d.cts\",\n \"default\": \"./dist/normalizer.cjs\"\n }\n },\n \"./resolvers\": {\n \"import\": {\n \"types\": \"./dist/resolvers.d.ts\",\n \"default\": \"./dist/resolvers.js\"\n },\n \"require\": {\n \"types\": \"./dist/resolvers.d.cts\",\n \"default\": \"./dist/resolvers.cjs\"\n }\n },\n \"./errors\": {\n \"import\": {\n \"types\": \"./dist/errors.d.ts\",\n \"default\": \"./dist/errors.js\"\n },\n \"require\": {\n \"types\": \"./dist/errors.d.cts\",\n \"default\": \"./dist/errors.cjs\"\n }\n },\n \"./utilities\": {\n \"import\": {\n \"types\": \"./dist/utilities.d.ts\",\n \"default\": \"./dist/utilities.js\"\n },\n \"require\": {\n \"types\": \"./dist/utilities.d.cts\",\n \"default\": \"./dist/utilities.cjs\"\n }\n },\n \"./uom\": {\n \"import\": {\n \"types\": \"./dist/uom.d.ts\",\n \"default\": \"./dist/uom.js\"\n },\n \"require\": {\n \"types\": \"./dist/uom.d.cts\",\n \"default\": \"./dist/uom.cjs\"\n }\n },\n \"./services\": {\n \"import\": {\n \"types\": \"./dist/services.d.ts\",\n \"default\": \"./dist/services.js\"\n },\n \"require\": {\n \"types\": \"./dist/services.d.cts\",\n \"default\": \"./dist/services.cjs\"\n }\n },\n \"./worker\": {\n \"import\": {\n \"types\": \"./dist/worker.d.ts\",\n \"default\": \"./dist/worker.js\"\n },\n \"require\": {\n \"types\": \"./dist/worker.d.cts\",\n \"default\": \"./dist/worker.cjs\"\n }\n },\n \"./testing\": {\n \"import\": {\n \"types\": \"./dist/testing.d.ts\",\n \"default\": \"./dist/testing.js\"\n },\n \"require\": {\n \"types\": \"./dist/testing.d.cts\",\n \"default\": \"./dist/testing.cjs\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"prepublishOnly\": \"npm run build && node ../../scripts/assert-publishable.mjs .\",\n \"dev\": \"tsup --watch\",\n \"test\": \"jest --config jest.config.cjs --no-coverage\",\n \"typecheck\": \"tsgo --noEmit --skipLibCheck\",\n \"typecheck:tsc\": \"tsc --noEmit --skipLibCheck\"\n },\n \"dependencies\": {\n \"@tanstack/query-core\": \"^5.102.8\"\n },\n \"devDependencies\": {\n \"@jest/globals\": \"^30.5.0\",\n \"@types/node\": \"^26.4.0\",\n \"convert\": \"^7.0.0\",\n \"jest\": \"^30.5.0\",\n \"ts-jest\": \"^29.4.12\",\n \"tsup\": \"8.5.1\",\n \"typescript\": \"5.9.3\"\n },\n \"//sideEffects\": \"Load-bearing claim, not boilerplate. tsup's splitting emits bare chunk imports at the top of dist/index.js, and this field tells Rollup, webpack and Vite they may delete them, which esbuild reports as [ignored-bare-import] once per import during `npm run size`. The engine does have module-level work to lose: registerAllTokenTypes(), _PrecedenceParser.BP_TABLE and its cached token ids, and several process-wide registries. It is safe because every chunk doing that work is also imported for its bindings somewhere, so no bundler can drop it. That is a property of how tsup currently splits the code rather than a design guarantee, so `npm run smoke:bundled` (scripts/check-tree-shaking.mjs) proves it on every run of `npm run verify` instead of assuming it, and its header explains the two fixes if it ever stops holding.\",\n \"sideEffects\": false\n}\n","/**\n * The running engine's own semver version, sourced directly from this\n * package's package.json so it can never drift from what's actually\n * published. Exists so IEnginePackage.engineVersion range checks\n * (api/EngineVersionCompatibility.ts) have something real to check\n * against.\n */\nimport { version } from \"../../package.json\";\n\n/**\n * The running engine's version, taken from package.json.\n *\n * What a package's `engineVersion` range is checked against at registration.\n * A prerelease is compared by its coerced release version, so a 1.0.0 beta\n * satisfies `^1.0.0`. See `api/EngineVersionCompatibility.ts`.\n */\nexport const ENGINE_VERSION: string = version;\n","/**\n * Configuration Module for solve-js Engine\n * \n * This module provides the **single source of truth** for all engine configuration.\n * Every configurable aspect of the engine, from safety limits and performance\n * budgets to VM constraints and worker pool sizing, is defined here.\n * \n * ### Design principles\n * \n * 1. **Engine owns its config.** The engine defines its own config shape and defaults.\n * Consumers (e.g., the Obsidian plugin) pass partial overrides; all unspecified\n * fields fall back to `DEFAULT_CONFIG`.\n * \n * 2. **Self-documenting.** Every interface and field has descriptive JSDoc so the\n * config is understandable at a glance, whether you're using the engine as an\n * npm package or reading the source.\n * \n * 3. **Minimal consumer knowledge.** Consumers only need to pass `Partial<EngineConfig>`.\n * They don't need to replicate the full config shape, just the fields they\n * want to override.\n * \n * @module Configuration\n */\n\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n/**\n * A host's test for whether a calendar date is a public holiday, given the\n * `Date` for that day at local midnight. Return `true` to exclude it from\n * working-day arithmetic.\n */\nexport type HolidayPredicate = (date: Date) => boolean;\n\n/**\n * The host-supplied public-holiday calendar, in the same \"bring your own data\"\n * shape the stocks and weather packages already use for a host callback (see\n * `packages/stocks/StocksPackage.ts`): weekends are decidable from the date\n * alone, holidays are not, so they come from the host or not at all.\n *\n * Either a {@link HolidayPredicate}, for a host that computes holidays itself\n * (an existing library, a region rule), or an iterable of specific dates as\n * `YYYY-MM-DD` strings, epoch-millisecond numbers or `Date` objects, for a host\n * that just has a list. Resolved to one internal predicate by\n * `vm/HolidayCalendar.ts`'s `resolveHolidayPredicate()`.\n *\n * Left unset, working-day arithmetic skips weekends only, which is the honest\n * default: the engine excludes exactly the days it can prove are non-working.\n */\nexport type HolidayCalendar = HolidayPredicate | Iterable<string | number | Date>;\n\n/**\n * Date-related configuration.\n * Controls the bounds and formatting for date/time expression evaluation\n * (e.g., `today + 20 days`, `last monday`).\n */\n/**\n * How an ambiguous all-numeric date literal is read.\n *\n * - `'auto'`: by separator, the historic behaviour. A slash date is\n * day-first (`25/12/2023`), a hyphen date is month-first (`12-25-2023`)\n * unless its first group is four digits, which makes it ISO (`2023-12-25`).\n * - `'DMY'` / `'MDY'` / `'YMD'`: a fixed order for every numeric separator, so\n * a host can match its readers' locale. `'MDY'` is what lets a US reader's\n * `12/25/2023` parse, which `'auto'` refuses because the slash defaults to\n * day-first.\n *\n * Only the all-numeric literals are affected. A spelled-out month (`March 9,\n * 2024`) is never ambiguous, and an ISO timestamp is always read as ISO.\n */\nexport type DateInputOrder = 'auto' | 'DMY' | 'MDY' | 'YMD';\n\n/** Date-related engine configuration: offset limits, input order, holidays. */\nexport interface DateConfig {\n /**\n * The order an ambiguous all-numeric date literal is read in. Defaults to\n * `'auto'` (by separator, the historic behaviour). See {@link DateInputOrder}.\n */\n readonly inputOrder: DateInputOrder;\n /**\n * How far forward a date offset whose COST grows with the offset may reach,\n * in years. Enforced by `vm/VM.ts`'s `addBusinessDays()`.\n *\n * Bounds the walk, not the calendar. Every other date offset in the engine\n * is arithmetic on a Date field, so `today + 100000 days` costs exactly what\n * one day costs and needs no ceiling; workdays are the one offset that has\n * to step day by day, because which days are skipped depends on where each\n * step lands. `today + 100000000 workdays` therefore froze the host for\n * thirteen seconds inside a single ADD opcode (where `vm.maxInstructions`\n * cannot see it) and then answered \"Invalid Date\", and a trillion never\n * returned at all.\n *\n * Release hardening: this field was declared, documented as a \"safety\n * limit\", and read nowhere, so it bounded nothing. A limit a host can\n * configure and the engine ignores is worse than no limit, because it reads\n * as protection that is not there.\n */\n readonly maxOffsetYears: number;\n /** How far BACK the same walk may reach, in years, as a negative number. See {@link maxOffsetYears}. */\n readonly minOffsetYears: number;\n /** Default date string format for display (moment.js format string) */\n readonly defaultFormat: string;\n /**\n * Public-holiday calendar for working-day arithmetic (`N working days after\n * <date>`, `working days between <date> and <date>`, `<date> + N workdays`).\n * See {@link HolidayCalendar}.\n *\n * Optional and unset by default: with no calendar, working-day arithmetic\n * skips weekends only. A host that wants holidays excluded too supplies one\n * here (`new ExpressionEngine({ config: { date: { holidays } } })`), the\n * same way stocks and weather take a host data source. Threaded into the VM\n * by `engine/ExpressionEngine.ts` exactly as {@link maxOffsetYears} is,\n * because working-day math is a VM operation several grammar forms share, so\n * the calendar has to be one source the VM owns rather than per-package state\n * the VM cannot see.\n */\n readonly holidays?: HolidayCalendar;\n}\n\n/**\n * Performance-related configuration.\n * Controls caching, timeouts, and processing limits to prevent runaway\n * resource consumption on large documents.\n */\nexport interface PerformanceConfig {\n /**\n * Maximum number of entries in {@link ExpressionEngine}'s bytecode cache\n * (per-instance, keyed by expression text) before the oldest entry is\n * evicted. Raise this for documents with many distinct expressions if\n * repeated re-evaluation (e.g. scrolling) is re-parsing instead of\n * hitting cache, bug fix (release hardening pass): this field used to\n * be read nowhere; the cache size was a hardcoded, unconfigurable\n * constant. Note this does NOT bound {@link LineCache}, which has no\n * size limit of its own.\n */\n readonly defaultCacheSize: number;\n /**\n * Maximum lines a document may have for the engine to process it in one\n * pass. Enforced by `ExpressionEngine.parseDocument()` and by\n * `engine/DocumentModel.ts`'s `setDocument()`, the two entry points that\n * take a whole document.\n *\n * A document costs memory per line whatever each line says: a parsed line\n * record, a cache entry, a dependency-graph node. Two hundred thousand\n * lines of `1 + 1` therefore exhausted the heap and aborted the process\n * before any per-line limit had anything to object to, which is the same\n * shape of hole as an unbounded expression and needs the same kind of\n * ceiling. Refusing the document names the limit; a host that genuinely has\n * a larger one raises this field.\n *\n * Release hardening: declared and read nowhere until now.\n */\n readonly maxDocumentLines: number;\n}\n\n/**\n * Validation / safety-limit configuration.\n * Protects against runaway expressions that could cause excessive memory use\n * or stack overflow. These limits are checked during lexing and parsing.\n */\n/** Bounds on untrusted input: expression length and nesting depth. */\nexport interface ValidationConfig {\n /** Maximum expression length in characters. Prevents excessively long strings from entering the pipeline. */\n readonly maxExpressionLength: number;\n /** Maximum expression complexity score (`tokens + functionCalls×5 + nestingDepth×10`). Protects against deeply nested or combinatorially complex expressions. */\n readonly maxComplexity: number;\n /** Maximum parentheses nesting depth. Prevents stack overflow in the recursive-descent parser. */\n readonly maxNestingDepth: number;\n /**\n * Auto-balance unmatched parentheses by appending missing closing parens\n * or prepending missing opening parens. When disabled, unbalanced expressions\n * cause parse errors instead of being silently corrected.\n *\n * Disabled by default for strict parsing. Enable for forgiving user input\n * (e.g., chat-style calculators where users often omit closing parens).\n * Has zero overhead when disabled, the O(n) paren-count scan is skipped.\n */\n readonly autoBalanceParens: boolean;\n}\n\n/**\n * Worker pool configuration.\n * Controls the parallel execution workers used for batch evaluation.\n */\nexport interface WorkerConfig {\n /** Maximum number of concurrent Web Workers allowed */\n readonly maxConcurrentWorkers: number;\n /** Time (ms) a worker stays alive while idle before being terminated */\n readonly idleTimeoutMs: number;\n /** Maximum retry attempts for a failed worker operation */\n readonly maxRetries: number;\n /** Base backoff delay (ms) between retries (exponential backoff applied on top) */\n readonly baseBackoffMs: number;\n} /**\n * Diagnostic / telemetry configuration.\n * Controls the diagnostic event pipeline for profiling and debugging.\n * All diagnostics are disabled by default for maximum production performance.\n */\n export interface DiagnosticConfig {\n /** Master switch: enable the diagnostic pipeline (collectors receive events for all pipeline stages) */\n readonly enabled: boolean;\n /** Enable VM trace mode, emits per-opcode execution events (very verbose; disables some optimizations) */\n readonly vmTraceEnabled: boolean;\n }\n\n /**\n * Proactive background refresh of live async values.\n *\n * Off by default. When a live value (a stock quote, an FX rate) has gone\n * stale, today it only refetches on the next re-evaluation (a keystroke), so a\n * note left open silently ages. With this enabled, the engine drives a refetch\n * on each such value's own cadence (the resolver's `refetchIntervalMs`) for the\n * values currently on screen, and pushes the fresh result to the host through\n * the same event stream the pull path uses. It needs timers and a live editor\n * consuming that stream, so a headless or batch host leaves it off.\n */\n export interface BackgroundRefreshConfig {\n /** Master switch. When false, no timers run and every value refreshes only on re-evaluation. */\n readonly enabled: boolean;\n }\n\n /**\n * Whether the engine may reach the network at all.\n *\n * On by default, which is the historic behaviour: a city name or a currency\n * pair in a line fetches live data from a public endpoint as soon as the\n * line evaluates. A host embedding the engine somewhere that must not make\n * outbound requests (an offline document, a sandboxed evaluation, a tenant\n * with egress rules) switches it off here and gets the same engine with no\n * egress: every live-data form answers with a `NETWORK_DISABLED` error\n * naming the setting, instead of a request.\n *\n * The gate closes before any request is made. It stops every async\n * resolver a package registers (weather, currency, stocks, crypto,\n * knowledge, and any host-supplied one) unless the resolver declares\n * itself `local` (it reads engine state, never a network; the engine's own\n * global-variable resolver is the one built-in case). It also refuses the\n * result of a plugin function that returns a promise. That last case is a\n * boundary rather than a guarantee: such a function has already run by the\n * time the engine sees the promise, so a package that fetches inside a\n * plugin function rather than through an async resolver may still have\n * started its request. The documented shape for live data is the resolver\n * (`createQueryResolver`), which this gate stops cold.\n *\n * Rates a host primes by hand (`currencyExchangeService.primeRates`) keep\n * working with the network off, which is what an offline host with its own\n * rate table wants.\n */\n export interface NetworkConfig {\n /** Master switch. When false, no async resolver runs and no live value is fetched. */\n readonly enabled: boolean;\n }\n\n /**\n * Virtual Machine configuration.\n * Controls the internal bytecode VM that executes compiled expressions.\n */\n export interface VMConfig {\n /** Maximum stack depth (value slots) for VM execution, prevents stack overflow in recursive/pratt-parser generated bytecode */\n readonly maxStackDepth: number;\n /** Maximum opcodes executed per expression, halts runaway infinite loops */\n readonly maxInstructions: number;\n /**\n * Maximum elements a collection may be expanded to before `map`/`reduce`/\n * `sum`/`prod` will iterate it.\n *\n * A Range is stored as its two bounds and costs nothing until something\n * materializes it, at which point it becomes one Value per element. Twenty\n * characters (`sum(x, 1:100000000)`) therefore asked for a hundred million\n * of them, and neither `maxInstructions` nor `maxStackDepth` could see it:\n * the expansion happens inside a single opcode, so the instruction counter\n * is never consulted while it runs, and the elements never reach the value\n * stack. V8 aborted the whole process with \"Reached heap limit\", which a\n * host embedding the engine cannot catch.\n */\n readonly maxCollectionSize: number;\n /**\n * Maximum elements (collection Values, matrix cells) one evaluation may\n * materialize in total.\n *\n * `maxCollectionSize` above bounds a single collection. This bounds the sum\n * of everything an expression asks for, which is a different question and\n * the one that actually protects the host: two collections that are\n * individually legal are legal together, and an operation whose result is\n * the PRODUCT of two legal operands is bounded by neither of them. A matrix\n * multiply is exactly that shape, so three lines within every other limit\n * (`:a = map(1*x, 0:20000)`, `:b = transpose(a)`, `b * a`) asked for four\n * hundred million cells and aborted the process.\n *\n * Counted in elements rather than bytes, because a count is what a call\n * site has before it allocates. An element is 8 bytes as a numeric matrix\n * cell and closer to a hundred as a full Value, so the default is worth\n * roughly 16 MB of matrix or 200 MB of expanded collection: far past any\n * document and far short of what an editor cannot survive.\n */\n readonly maxAllocatedElements: number;\n /**\n * Maximum user-defined-function calls one evaluation may make in TOTAL,\n * however deeply or widely they nest.\n *\n * `maxFunctionRecursionDepth` bounds how DEEP calls nest and cannot see\n * how MANY there are, and those are different numbers. Twenty-two lines of\n * `f(n)(v) = f(n-1)(v) + f(n-1)(v)` reach a depth of only 22 against a\n * limit of 50, and make 2,097,152 calls doing it: a fatal heap abort in\n * under a second. `maxInstructions` cannot bound it either, because\n * `executeBytecode()` re-enters itself per call and each reentrant call\n * gets its OWN instruction count, so recursion refreshes its allowance on\n * the way in. This is the tally that does not refresh; see\n * `vm/AllocationBudget.ts`, which holds it for the same reason it holds\n * the element tally.\n *\n * Counted in calls rather than in the instructions they run, because the\n * call is the thing that multiplies: every call allocates a frame, its\n * arguments and its result whatever its body says.\n */\n readonly maxFunctionCalls: number;\n /**\n * Hard ceiling on how many bisection steps goal seek (`solve line N for\n * <var> = <target>`, see `packages/goalseek/`) may take before it gives up\n * with a structured error rather than continuing.\n *\n * Goal seek re-evaluates the target line's expression once per step while\n * narrowing an interval, and an untrusted document must never be able to\n * make that loop spin. `maxInstructions` bounds each individual\n * re-evaluation, but not how many of them the search performs, so this is\n * the tally that bounds the search itself, the same reason `maxFunctionCalls`\n * exists alongside `maxInstructions`. Bisection halves the interval every\n * step, so a hundred steps resolves an input to roughly one part in 2^100:\n * far past any precision a document needs, and a definite stop either way.\n */\n readonly maxGoalSeekIterations: number;\n }\n\n/**\n * Complete engine configuration.\n *\n * Every field has a default in `DEFAULT_CONFIG`. To customize, pass a\n * `Partial<EngineConfig>` when constructing `ExpressionEngine`. Only the\n * sections/fields you supply are overridden; all others use their defaults.\n *\n * @example\n * ```typescript\n * import { ExpressionEngine } from \"solve-js\";\n *\n * const engine = new ExpressionEngine({ config: {\n * validation: {\n * maxExpressionLength: 1000,\n * maxComplexity: 200,\n * },\n * // date, performance, vm, worker, diagnostic all use defaults\n * } });\n * ```\n */\nexport interface EngineConfig {\n /** Date/time expression evaluation bounds and formatting */\n readonly date: DateConfig;\n /** Performance budgets and cache sizing */\n readonly performance: PerformanceConfig;\n /** Safety limits for expression complexity */\n readonly validation: ValidationConfig;\n /** Internal bytecode VM configuration */\n readonly vm: VMConfig;\n /** Parallel worker pool configuration */\n readonly worker: WorkerConfig;\n /** Diagnostic pipeline configuration */\n readonly diagnostic: DiagnosticConfig;\n /** Proactive background refresh of live async values */\n readonly backgroundRefresh: BackgroundRefreshConfig;\n /** Whether live data may be fetched at all. See {@link NetworkConfig}. */\n readonly network: NetworkConfig;\n }\n\n/**\n * A partial {@link EngineConfig} override, one section at a time.\n *\n * Overrides are merged per section over {@link DEFAULT_CONFIG}, so you can set a\n * single field of one section (`{ validation: { maxExpressionLength: 1000 } }`)\n * and keep every other default in that section. A plain `Partial<EngineConfig>`\n * cannot express that, it demands a whole section object, which is why the\n * documented overrides never typechecked against it. This is the type the\n * constructor and {@link createEngine} accept.\n */\nexport type EngineConfigOverride = {\n readonly [K in keyof EngineConfig]?: Partial<EngineConfig[K]>;\n};\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: EngineConfig = {\n date: {\n // A century of workdays is about 26,000 steps, which is microseconds,\n // and past any offset a person means. The walk is what these bound; see\n // DateConfig above for why no other date offset needs a ceiling.\n maxOffsetYears: 100,\n minOffsetYears: -100,\n defaultFormat: 'YYYY-MM-DD',\n inputOrder: 'auto',\n },\n performance: {\n // Preserves the effective cache size the hardcoded (now-removed)\n // BYTECODE_CACHE_MAX_ENTRIES constant had, so wiring this field up\n // doesn't silently shrink the default cache for existing consumers.\n defaultCacheSize: 2000,\n // Raised from the 10,000 this field was declared with, which was never\n // enforced and turned out to be under what this engine already supports:\n // its paging design is tested against a 20,000-line document\n // (`engine/PageManager.ts` and its spec) and its throughput benchmark\n // parses a 50,000-line one. Twice the largest of those, and the same\n // number `ConfigManager.validate()` already refuses to go above.\n //\n // Measured under a 256MB heap: setting a 100,000-line document costs\n // 64MB, evaluating every line of a 20,000-line one costs 106MB, and\n // 200,000 lines aborts the process before a single expression is looked\n // at. A host with a small heap should lower this; the ceiling is here to\n // stop the size that cannot work anywhere.\n maxDocumentLines: 100000,\n },\n validation: {\n maxExpressionLength: 2000,\n maxComplexity: 500,\n maxNestingDepth: 50,\n autoBalanceParens: false,\n },\n vm: {\n maxStackDepth: 200,\n maxInstructions: 50000,\n // Two orders of magnitude above anything a person types by hand (the\n // longest range in the test suite is 1000 elements) and small enough\n // that expanding it is measured in milliseconds rather than in whether\n // the host survives.\n maxCollectionSize: 100000,\n // Twenty times the single-collection ceiling above, so an expression may\n // legitimately handle a number of large collections, and two hundred\n // times below the allocation that took the process down.\n maxAllocatedElements: 2000000,\n // Six hundred times the largest call count any test or example makes\n // (five levels of composition is sixteen calls), and small enough that\n // the calls it does allow cost single-digit megabytes rather than the\n // heap. A document that needs more than ten thousand calls on one line\n // is doing something a calculator was not built for.\n maxFunctionCalls: 10000,\n // A hundred bisection steps resolve an input to one part in 2^100, far\n // finer than any document needs and a firm stop for an untrusted one. A\n // continuous, monotonic relationship converges in tens of steps, well\n // under this; hitting it means the target is unreachable or the\n // relationship is not the smooth one goal seek assumes.\n maxGoalSeekIterations: 100,\n },\n worker: {\n maxConcurrentWorkers: 4,\n idleTimeoutMs: 30000,\n maxRetries: 3,\n baseBackoffMs: 1000,\n },\n diagnostic: {\n enabled: false,\n vmTraceEnabled: false,\n },\n backgroundRefresh: {\n enabled: false,\n },\n network: {\n // On, because it is what every existing consumer gets today. A host that\n // must not make outbound requests turns it off; see NetworkConfig.\n enabled: true,\n },\n };\n\n/**\n * Merge a partial config override onto a base `EngineConfig`, section by\n * section, `{ ...base.section, ...override.section }` for each of the 8\n * top-level sections, not a single top-level spread.\n *\n * A shallow `{ ...base, ...override }` at the TOP level replaces an entire\n * section wholesale the moment a caller overrides even one field in it\n * (e.g. `{ performance: { defaultCacheSize: 500 } }` would silently drop\n * every other `performance.*` field back to `undefined`, not to its\n * default). This function exists specifically so every config consumer\n * shares one correct merge instead of each hand-rolling (and risking) its\n * own. `ConfigManager` and `ExpressionEngine` both call this rather than\n * either duplicating the section list or instantiating a whole\n * `ConfigManager` just to reuse its private merge logic.\n */\nexport function mergeEngineConfig(\n base: EngineConfig,\n override: EngineConfigOverride\n): EngineConfig {\n return {\n date: { ...base.date, ...override.date },\n performance: { ...base.performance, ...override.performance },\n validation: { ...base.validation, ...override.validation },\n vm: { ...base.vm, ...override.vm },\n worker: { ...base.worker, ...override.worker },\n diagnostic: { ...base.diagnostic, ...override.diagnostic },\n backgroundRefresh: { ...base.backgroundRefresh, ...override.backgroundRefresh },\n network: { ...base.network, ...override.network },\n };\n}\n\n/**\n * Configuration manager for engine settings\n *\n * @example\n * ```typescript\n * const configManager = new ConfigManager();\n * configManager.set('performance.defaultCacheSize', 2000);\n * const cacheSize = configManager.get('performance.defaultCacheSize');\n * ```\n */\nexport class ConfigManager {\n private config: EngineConfig;\n\n constructor(config: Partial<EngineConfig> = {}) {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, config);\n }\n\n /**\n * Get configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @returns Configuration value\n */\n get<T>(path: string): T {\n const keys = path.split('.');\n let current: unknown = this.config;\n\n for (const key of keys) {\n if (current && typeof current === 'object' && key in current) {\n current = (current as Record<string, unknown>)[key];\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PATH_NOT_FOUND\",\n `Configuration path not found: ${path}`,\n { path }\n );\n }\n }\n\n return current as T;\n }\n\n /**\n * Set configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @param value - New value\n */\n set<T>(path: string, value: T): void {\n const keys = path.split('.');\n if (keys.length < 2) {\n throw ErrorFactory.config(\n \"INVALID_CONFIG_PATH\",\n `Invalid path: ${path}. Must be in format 'section.property'`,\n { path }\n );\n }\n \n const section = keys[0];\n const property = keys[1];\n \n if (!(section in this.config)) {\n throw ErrorFactory.config(\n \"CONFIG_SECTION_NOT_FOUND\",\n `Configuration section not found: ${section}`,\n { section, path }\n );\n }\n \n const sectionConfig = this.config[section as keyof EngineConfig];\n if (sectionConfig && typeof sectionConfig === 'object') {\n (sectionConfig as unknown as Record<string, unknown>)[property] = value;\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PROPERTY_NOT_FOUND\",\n `Configuration property not found: ${path}`,\n { path }\n );\n }\n }\n\n /**\n * Get complete configuration.\n *\n * A detached copy, section objects included. A top-level spread would hand\n * the caller this manager's own section objects, so `getConfig().vm.x = 1`\n * would be an undeclared back door into {@link set}, bypassing its path\n * validation and reaching every later {@link get}.\n */\n getConfig(): EngineConfig {\n return mergeEngineConfig(this.config, {});\n }\n\n /**\n * Update multiple configuration values\n */\n update(config: Partial<EngineConfig>): void {\n this.config = mergeEngineConfig(this.config, config);\n }\n\n /**\n * Reset to default configuration.\n *\n * Goes through {@link mergeEngineConfig} for the same reason the constructor\n * does. A top-level `{ ...DEFAULT_CONFIG }` copies the six section\n * references, not the sections, so after a reset this manager's\n * `performance` object WAS `DEFAULT_CONFIG.performance` and the next\n * `set('performance.x', ...)` wrote into the module constant. That constant\n * is what every `ExpressionEngine` is built from, so one manager's reset\n * could change the cache size, instruction ceiling or allocation budget of\n * every engine constructed later in the process.\n */\n reset(): void {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, {});\n }\n\n /**\n * Validate configuration values\n */\n validate(): ValidationResult {\n const errors: string[] = [];\n\n // Validate performance config\n if (this.config.performance.maxDocumentLines > 100000) {\n errors.push('maxDocumentLines cannot exceed 100,000');\n }\n\n // Validate date config\n if (this.config.date.maxOffsetYears > 1000) {\n errors.push('maxOffsetYears cannot exceed 1000');\n }\n\n return {\n valid: errors.length === 0,\n error: errors.join('; '),\n warnings: []\n };\n }\n}\n\n/**\n * Result type for {@link ConfigManager.validate}.\n */\nexport interface ValidationResult {\n valid: boolean;\n error?: string;\n warnings?: string[];\n}\n\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lexer/Token.ts"],"names":["TokenTypes","_nextTokenTypeId","_tokenTypeNameToId","_tokenTypeIdToName","registerTokenType","name","existing","id","tokenTypeId","tokenTypeName","registerAllTokenTypes"],"mappings":"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","file":"chunk-IJMNVBIS.js","sourcesContent":["/**\n * Lexer token produced by {@link ExpressionLexer} and consumed by parsers.\n *\n * Each token carries:\n * - `type`: string name (e.g. \"NUMBER\", \"PLUS\") for diagnostics and parselet lookup\n * - `typeId`: integer ID for O(1) comparison in parser hot paths\n * - `value`/`text`: the token's semantic value and raw source text\n * - `offset`/`line`/`col`: source position for error messages and highlighting\n */\nexport interface Token {\n\t/** String token type (e.g., \"NUMBER\", \"PLUS\", \"IDENT\"). Used by ParseletRegistry string-keyed maps and error messages. */\n\ttype: string;\n\t/** Integer token type ID for fast comparison in Parser hot path.\n\t * Populated by the Lexer via registerTokenType(). Use tokenTypeId(type) to get a type's ID. */\n\ttypeId: number;\n\tvalue: string;\n\ttext: string;\n\toffset: number;\n\tlineBreaks: number;\n\tline: number;\n\tcol: number;\n\t/**\n\t * End offset of the source text this token was fused from, exclusive.\n\t *\n\t * Only set on tokens the normalizer built by fusing several lexer tokens\n\t * into one, and only there because those are the tokens whose `value` no\n\t * longer describes the text they came from. `10 frames` fuses into a\n\t * FRAME_COUNT whose value is `10`, so `offset + value.length` would cover\n\t * two characters of a nine-character phrase.\n\t *\n\t * Evaluation never reads this. It exists so that a consumer painting a line\n\t * (see `LanguageService.getSemanticTokens`) can highlight a fused phrase as\n\t * the one thing the parser will see rather than as its parts.\n\t */\n\tsourceEnd?: number;\n}\n\n/**\n * Canonical token type name constants.\n * All token types used by the lexer, parser, and VM are defined here.\n * Custom/plugin token types should be registered via {@link registerTokenType}.\n */\nexport const TokenTypes = {\n NUMBER: \"NUMBER\",\n BIGINT: \"BIGINT\",\n STRING: \"STRING\",\n IDENT: \"IDENT\",\n PLUS: \"PLUS\",\n MINUS: \"MINUS\",\n // Compound assignment for running totals: `total += 100`, `total -= 40`.\n // Handled by the engine's compound-assignment interception, not a parselet.\n PLUS_EQUALS: \"PLUS_EQUALS\",\n MINUS_EQUALS: \"MINUS_EQUALS\",\n STAR: \"STAR\",\n SLASH: \"SLASH\",\n // The uncertainty operator, `±` (U+00B1) or the ASCII `+/-`. The symbol is\n // lexed directly (ExpressionLexer.ts, alongside `×`/`÷`), and the ASCII\n // spelling is fused from PLUS SLASH MINUS by a normalizer rule (see\n // packages/uncertainty/). Registered here rather than left to be lazily\n // minted so its id is stable, the same reasoning as the algebra verbs below.\n PLUS_MINUS: \"PLUS_MINUS\",\n CARET: \"CARET\",\n PERCENT: \"PERCENT\",\n LSHIFT: \"LSHIFT\",\n RSHIFT: \"RSHIFT\",\n URSHIFT: \"URSHIFT\",\n LPAREN: \"LPAREN\",\n RPAREN: \"RPAREN\",\n LBRACKET: \"LBRACKET\",\n RBRACKET: \"RBRACKET\",\n LBRACE: \"LBRACE\",\n RBRACE: \"RBRACE\",\n COMMA: \"COMMA\",\n DOT: \"DOT\",\n COLON: \"COLON\",\n SEMICOLON: \"SEMICOLON\",\n EQUALS: \"EQUALS\",\n DOLLAR: \"DOLLAR\",\n POUND: \"POUND\",\n EURO: \"EURO\",\n YEN: \"YEN\",\n RUBLE: \"RUBLE\",\n WON: \"WON\",\n QUESTION: \"QUESTION\",\n BANG: \"BANG\",\n BIT_AND: \"BIT_AND\",\n BIT_OR: \"BIT_OR\",\n BIT_NOT: \"BIT_NOT\",\n KEYWORD: \"KEYWORD\",\n EOF: \"EOF\",\n ERROR: \"ERROR\",\n WS: \"WS\",\n NEWLINE: \"NEWLINE\",\n DATETIME_LITERAL: \"DATETIME_LITERAL\",\n DURATION: \"DURATION\",\n UNIT: \"UNIT\",\n ROLL: \"ROLL\",\n PI: \"PI\",\n E: \"E\",\n MOD: \"MOD\",\n // The English word \"and\", which is NOT the same thing as \"+\" even though it\n // adds. It used to map straight onto PLUS in the locale keyword map, which\n // made \"3 and 4\" evaluate to 7 correctly and then quietly broke every phrase\n // that uses \"and\" as a list separator: \"average of 36, 42, 19 and 81\" parsed\n // its last argument as \"19 + 81\" and returned 178/3 rather than 178/4.\n //\n // Giving it its own type lets a parselet tell the two apart. It is still an\n // infix addition (see ArithmeticPackage.ts) so \"3 and 4\" is unchanged, but it\n // binds at BindingPower.Conjunction, looser than both Sum and Conditional, so\n // a phrase parselet can parse an argument at Conjunction and get \"1 + 2\"\n // whole while still stopping at \"and\", and so \"5 > 3 and 2 > 1\" reads as the\n // conjunction of two comparisons rather than \"5 > (3 and 2) > 1\".\n AND_CONJ: \"AND_CONJ\",\n OF: \"OF\",\n INCREASE_BY: \"INCREASE_BY\",\n DECREASE_BY: \"DECREASE_BY\",\n // Percentage solve-for-unknown (packages/percentage/), \"N% of what is\n // X\" solves N% * base = X for base. Fused as a full 3-word phrase (see\n // PercentagePackage.ts's `phrases` field) rather than a bare \"what\"\n // keyword, \"what\" is common enough as a variable name to be worth the\n // same phrase-fusion treatment this codebase gives \"total\"/\"average\"/etc.\n OF_WHAT_IS: \"OF_WHAT_IS\",\n // Sibling solve-for-unknown forms accounting for a +/-1 offset, \"N% on\n // what is X\" (increase) / \"N% off what is X\" (decrease). Same\n // phrase-fusion reasoning as OF_WHAT_IS above.\n ON_WHAT_IS: \"ON_WHAT_IS\",\n OFF_WHAT_IS: \"OFF_WHAT_IS\",\n NOW: \"NOW\",\n TODAY: \"TODAY\",\n TOMORROW: \"TOMORROW\",\n YESTERDAY: \"YESTERDAY\",\n DURATION_DAY: \"DURATION_DAY\",\n DURATION_WEEK: \"DURATION_WEEK\",\n DURATION_MONTH: \"DURATION_MONTH\",\n DURATION_YEAR: \"DURATION_YEAR\",\n DURATION_HOUR: \"DURATION_HOUR\",\n DURATION_MINUTE: \"DURATION_MINUTE\",\n DURATION_SECOND: \"DURATION_SECOND\",\n FUNC: \"FUNC\",\n CONVERT: \"CONVERT\",\n TO: \"TO\",\n BEST: \"BEST\",\n NEXT: \"NEXT\",\n LAST: \"LAST\",\n UNTIL: \"UNTIL\",\n SINCE: \"SINCE\",\n BETWEEN: \"BETWEEN\",\n // Bill split (finance package). Retyped from the ordinary words \"split\",\n // \"ways\" and \"people\" by BillSplitNormalizerRule, but only inside the full\n // split shape, so those words stay usable as variable names and prose\n // everywhere else (the same contextual-claim discipline as the recurring\n // schedule and at-rate rules).\n // The verb-first `split <amount> between N` form (prefix).\n SPLIT: \"SPLIT\",\n // The amount-first `<amount> split N ways` form (infix). A separate,\n // infix-only token so implicit multiplication does not read it as the start\n // of a new value and insert a `*` before it, which the dual-role SPLIT would.\n SPLIT_WAYS: \"SPLIT_WAYS\",\n WAYS: \"WAYS\",\n PEOPLE: \"PEOPLE\",\n FROM: \"FROM\",\n INCREASE: \"INCREASE\",\n DECREASE: \"DECREASE\",\n UNICODE_MATH: \"UNICODE_MATH\",\n TIMES_BY: \"TIMES_BY\",\n MULTIPLY_BY: \"MULTIPLY_BY\",\n DIVIDE_BY: \"DIVIDE_BY\",\n NEQ: \"NEQ\",\n IN: \"IN\",\n BIT_XOR: \"BIT_XOR\",\n EQUALITY: \"EQUALITY\",\n GTE: \"GTE\",\n LTE: \"LTE\",\n LT: \"LT\",\n GT: \"GT\",\n LOGICAL_AND: \"LOGICAL_AND\",\n LOGICAL_OR: \"LOGICAL_OR\",\n OR: \"OR\",\n TRUE: \"TRUE\",\n FALSE: \"FALSE\",\n IF: \"IF\",\n THEN: \"THEN\",\n ELSE: \"ELSE\",\n AS: \"AS\",\n CONVERTER_NAME: \"CONVERTER_NAME\",\n // Rounding (packages/converters/). \"rounded\" is a bare keyword: it is a\n // past participle with no plausible use as a :variableName, the same\n // accepted-risk category as \"between\"/\"from\". TO_NEAREST and\n // DECIMAL_PLACES are fused, since \"to\" already means percentage change.\n ROUNDED: \"ROUNDED\",\n TO_NEAREST: \"TO_NEAREST\",\n DECIMAL_PLACES: \"DECIMAL_PLACES\",\n // Fused two-word phrase tokens (see MathPhrasesPackage.ts's `phrases`\n // field), deliberately NOT bare single-word keywords: \"average\"\n // \"total\", \"count\", etc. are common variable names, and this codebase\n // has a tested policy that colon-prefixed variable names can't be\n // keyword-shaped words (see VariableParselet.ts's doc comment). Fusing\n // the full \"<word> of\"/\"<word> between\" phrase means the bare word\n // itself never becomes its own token type, so \":total = ...\" keeps\n // working exactly as before.\n AVERAGE_OF: \"AVERAGE_OF\",\n MEDIAN_OF: \"MEDIAN_OF\",\n TOTAL_OF: \"TOTAL_OF\",\n COUNT_OF: \"COUNT_OF\",\n LARGER_OF: \"LARGER_OF\",\n SMALLER_OF: \"SMALLER_OF\",\n HALF_OF: \"HALF_OF\",\n MIDPOINT_BETWEEN: \"MIDPOINT_BETWEEN\",\n REMAINDER_OF: \"REMAINDER_OF\",\n NTH_ROOT: \"NTH_ROOT\",\n LOG_PHRASE: \"LOG_PHRASE\",\n LOG_BASE: \"LOG_BASE\",\n GCD_OF: \"GCD_OF\",\n LCM_OF: \"LCM_OF\",\n SQUARE_ROOT_OF: \"SQUARE_ROOT_OF\",\n CUBE_ROOT_OF: \"CUBE_ROOT_OF\",\n RANDOM_NUMBER: \"RANDOM_NUMBER\",\n IS_TO: \"IS_TO\",\n // Bare \"is\", the trigger for the solve-for-the-unknown percentage family\n // (packages/percentage/IsWhatParselet.ts). Safe as a bare keyword: it is a\n // verb, not a plausible :variableName, and the \"is to\" proportion phrase is\n // fused earlier so it still wins.\n IS: \"IS\",\n PCT_ON: \"PCT_ON\",\n PCT_OFF: \"PCT_OFF\",\n // Successive percentage change (packages/percentage/UpDownParselet.ts):\n // `X up N%` grows, `X down N%` shrinks, chainable with `then` and\n // repeatable with `N times`. Retyped from a bare `up`/`down` IDENT only\n // when a percentage immediately follows (PercentUpDownNormalizerRule), so\n // prose that merely mentions the words is untouched. Declared here rather\n // than minted lazily for the same reason as the algebra verbs below: a\n // normalizer rule and its parselet must agree on the id.\n PCT_UP: \"PCT_UP\",\n PCT_DOWN: \"PCT_DOWN\",\n OF_WHAT: \"OF_WHAT\",\n OFF_WHAT: \"OFF_WHAT\",\n ON_WHAT: \"ON_WHAT\",\n // CLAMP stays a bare single-word keyword: \"clamp X between Y and Z\" has\n // the value X between the trigger and \"between\", so it can't be\n // phrase-fused like the others above (same structural reason\n // ClampParselet.ts is hand-written instead of PhrasePattern-based).\n // Matches this codebase's existing accepted risk for \"between\"/\"from\"/\n // \"next\"/\"last\"/\"best\", also bare, also can't be used as `:name`.\n CLAMP: \"CLAMP\",\n // map/reduce/sum/prod (packages/mapreduce/), bare single-word keywords\n // each with its own dedicated parselet (custom argument grammar: a bare\n // builtin/user-function name, an inline transform expression, or\n // `name=collection` zipped pairs, none of which fit the ordinary\n // FunctionCallParselet path, so these can't just reuse the generic FUNC\n // token type the way sqrt/abs/... do).\n MAP: \"MAP\",\n REDUCE: \"REDUCE\",\n SUM_FN: \"SUM_FN\",\n PROD_FN: \"PROD_FN\",\n // The algebra verbs (packages/symbolic/), fused from an ordinary IDENT only\n // when immediately followed by `(`, so `factor`/`solve`/`expand` stay usable\n // as variable names. Declared here rather than left to be minted on first use\n // by `tokenTypeId()`, which is what {@link registerAllTokenTypes} exists for:\n // a lazily-minted id depends on what else happened to be minted before it, so\n // in a single-process run the id a normalizer rule produces can stop matching\n // the id the parselet was registered under. Every token type a built-in\n // package relies on belongs in this table.\n EXPAND_FN: \"EXPAND_FN\",\n FACTOR_FN: \"FACTOR_FN\",\n SOLVE_FN: \"SOLVE_FN\",\n DER_FN: \"DER_FN\",\n INTEGRAL_FN: \"INTEGRAL_FN\",\n TAYLOR_FN: \"TAYLOR_FN\",\n JACOBIAN_FN: \"JACOBIAN_FN\",\n CONJ_FN: \"CONJ_FN\",\n RE_FN: \"RE_FN\",\n IM_FN: \"IM_FN\",\n CANCEL_FN: \"CANCEL_FN\",\n APART_FN: \"APART_FN\",\n // The imaginary-literal suffix, fused from a number followed immediately by\n // `i`. Same registration reasoning as the verbs above.\n IMAGINARY: \"IMAGINARY\",\n // `=>`, \"therefore\"/solve operator. The algebra itself lives in symbolic/;\n // packages/symbolic/ carries the grammar surface for the named operations.\n // A genuine 2-char lexer token (ExpressionLexer.ts's TWO_CHAR_OPS table),\n // same mechanism as ==/!=/>=/<=, not a normalizer-level fusion, \"=\" then\n // \">\" is the opposite char order from GTE's \">=\", so there's no collision.\n THEREFORE: \"THEREFORE\",\n // Timezone query phrases (see TimePackage.ts's `phrases` field). Same\n // phrase-fusion reasoning as above: \"time\"/\"date\"/\"difference\" are\n // common variable names, so the fused trigger is the full phrase.\n // CITY_NAME is the fused-token type for multi-word city/country names\n // (e.g. \"new york\"). See timezones/CityZones.ts's MULTI_WORD_CITY_ZONES.\n TIME_IN: \"TIME_IN\",\n DATE_IN: \"DATE_IN\",\n TIME_DIFFERENCE_BETWEEN: \"TIME_DIFFERENCE_BETWEEN\",\n CITY_NAME: \"CITY_NAME\",\n BACKTICK_OPEN: \"BACKTICK_OPEN\",\n INLINE_SOLVE_START: \"INLINE_SOLVE_START\",\n // Comment marker, `#` or `//` to end of line. Emitted by\n // ExpressionLexer.tokenizeComment()/tokenizeOperator() but never reaches\n // a parselet: ExpressionEngine.prepareExpression() filters COMMENT\n // tokens out of the stream before normalization/parsing (see\n // ExpressionEngine.ts's \"Filter COMMENT tokens\" comments). Listed here\n // for discoverability even though tokenTypeId() would lazily register\n // it anyway on first use.\n COMMENT: \"COMMENT\",\n // A `#hex` colour literal (`#ff0000`), recognised by the lexer where `#`\n // would otherwise be a heading/comment; the colour package's parselet turns\n // it into a colour value. See ExpressionLexer.matchHexColourEnd().\n HEX_COLOUR: \"HEX_COLOUR\",\n // A bounded mid-line `#tag` annotation (`1200 #housing`). Stripped from\n // evaluation by the tags package's strip rule, or consumed by its aggregate\n // rule (`total of #housing`). A line-start `#` is a heading, and `# ` (space)\n // or `//` is still a free-text comment.\n TAG: \"TAG\",\n // A colour function call fused by the colour package's normalizer, e.g.\n // `rgb(`/`lighten(`. Carries the function name; see ColourCallParselet.\n COLOUR_CALL: \"COLOUR_CALL\",\n // Vector types (referenced in locale keywordMap as vec2→VEC2, etc.)\n VEC2: \"VEC2\",\n VEC3: \"VEC3\",\n VEC4: \"VEC4\",\n FLOAT: \"FLOAT\",\n GLOBAL: \"GLOBAL\",\n // ── Finance (packages/finance/) ──\n // OVER/RATE_AT are bare single-word keywords (not phrase-fused): both are\n // prepositions with near-zero plausibility as a variable name (nobody\n // writes \":over = 5\" or \":at = 3\"), the same accepted-risk category as\n // this codebase's existing bare \"between\"/\"from\"/\"next\"/\"last\"/\"best\"\n // keywords (see VariableParselet.ts's doc comment). RATE_AT is deliberately\n // NOT named \"AT\", that name is already reserved (dormant) for a future\n // \"@\" symbol token in TokenNormalizer.NON_WORD_NAMES; reusing it here would\n // create an unintended coupling if \"@\" is ever wired up.\n OVER: \"OVER\",\n RATE_AT: \"RATE_AT\",\n // The investment grammar's connectives (packages/finance/), same\n // accepted-risk category as OVER/RATE_AT above. \"after\"/\"for\" are\n // prepositions; \"compounding\", \"invested\" and \"returned\" are participles,\n // and none is a plausible `:variableName`.\n //\n // \"after\" and \"for\" are the pivots Soulver's own documented syntax uses,\n // `$1,000 after 3 years at 7%` and `$1,000 for 3 years at 7% compounding\n // monthly`. This package originally substituted \"over\" for both and said so\n // in CompoundInterestParselet.ts's doc comment; the documented spellings now\n // work as well, and \"over\" is kept so nothing that already parsed stops.\n AFTER: \"AFTER\",\n PRESENT_VALUE_OF: \"PRESENT_VALUE_OF\",\n ANNUAL_RETURN_ON: \"ANNUAL_RETURN_ON\",\n FOR_DURATION: \"FOR_DURATION\",\n COMPOUNDING: \"COMPOUNDING\",\n INVESTED: \"INVESTED\",\n RETURNED: \"RETURNED\",\n // Fused phrase tokens (see FinancePackage.ts's `phrases` field)\n // deliberately NOT bare single-word keywords: \"interest\", \"tax\", \"vat\",\n // \"repayment\", \"principal\" etc. are all common, plausible variable names\n // (a shipped playground example uses \":total = :subtotal + :tax\". See\n // MathPhrasesPackage.ts's doc comment for the regression this caused\n // once already). Fusing the full \"<word> on\"/\"<word> off\" phrase means\n // the bare leading word itself never becomes its own token type, so\n // \":tax = ...\" keeps working exactly as before.\n COMPOUND_INTEREST_ON: \"COMPOUND_INTEREST_ON\",\n INTEREST_ON: \"INTEREST_ON\",\n DAILY_REPAYMENT_ON: \"DAILY_REPAYMENT_ON\",\n MONTHLY_REPAYMENT_ON: \"MONTHLY_REPAYMENT_ON\",\n ANNUAL_REPAYMENT_ON: \"ANNUAL_REPAYMENT_ON\",\n TOTAL_REPAYMENT_ON: \"TOTAL_REPAYMENT_ON\",\n DAILY_LOAN_INTEREST_ON: \"DAILY_LOAN_INTEREST_ON\",\n MONTHLY_LOAN_INTEREST_ON: \"MONTHLY_LOAN_INTEREST_ON\",\n ANNUAL_LOAN_INTEREST_ON: \"ANNUAL_LOAN_INTEREST_ON\",\n TOTAL_LOAN_INTEREST_ON: \"TOTAL_LOAN_INTEREST_ON\",\n TAX_ON: \"TAX_ON\",\n TAX_OFF: \"TAX_OFF\",\n TAX_IN_PHRASE: \"TAX_IN_PHRASE\",\n // Inflation-adjusted value (packages/finance/) -- fused phrase\n // tokens (see FinancePackage.ts's `phrases` field), same reasoning\n // as the tax/interest phrases above: \"what\"/\"was\"/\"value\"/\"worth\"\n // are all plausible variable names, so only the full phrases are\n // ever claimed as keywords, never the bare leading word.\n WHAT_IS: \"WHAT_IS\",\n WHAT_WAS: \"WHAT_WAS\",\n VALUE_OF: \"VALUE_OF\",\n WORTH_IN: \"WORTH_IN\",\n // Savings goals (finance). Fused whole-phrase triggers, so \"how\", \"much\",\n // \"save\" and \"reach\" stay ordinary variable names, the same reason as the\n // other finance phrases above.\n SAVINGS_HOW_LONG: \"SAVINGS_HOW_LONG\",\n SAVINGS_HOW_MUCH: \"SAVINGS_HOW_MUCH\",\n // Bare single-word keyword (not phrase-fused) -- \"assuming\" has\n // near-zero plausibility as a variable name, the same accepted-risk\n // category as this codebase's existing bare \"over\"/\"at\" keywords\n // (see the OVER/RATE_AT comment above). Registered so its bare word\n // is a recognized phrase-starter (`canStartPhrase`), which suppresses\n // implicit-multiply insertion between the futureYear NUMBER and this\n // word in \"value of $X in <year> assuming N% inflation\" -- without\n // this, \"<year> assuming\" was silently rewritten to \"<year> *\n // assuming\" before parsing ever ran.\n ASSUMING: \"ASSUMING\",\n // Fused by a custom NormalizerRule (not `phrases`), carrying the\n // year as its value -- see\n // finance/normalizer/InYearDollarsNormalizerRule.ts.\n IN_YEAR_DOLLARS: \"IN_YEAR_DOLLARS\",\n // Cooking/UoM (packages/uom/) -- fused ingredient name (single- or\n // multi-word, e.g. \"butter\"/\"olive oil\") carrying the matched name\n // as its value. NOT a bare-word phrase-trie keyword -- see\n // uom/normalizer/IngredientNameNormalizerRule.ts's doc comment for\n // why this is a context-sensitive NormalizerRule instead (so a bare\n // `:butter = 5` variable definition is completely unaffected).\n INGREDIENT_NAME: \"INGREDIENT_NAME\",\n // ── Datetime, workdays/weekdays/timestamps (packages/datetime/) ──\n // Fused phrase tokens (see DatetimePackage.ts's `phrases` field)\n // deliberately NOT bare single-word keywords: \"workdays\"/\"weekday\"/\n // \"timestamp\"/\"date\" are all plausible variable names, same\n // reasoning/regression risk as MathPhrasesPackage.ts's \"total\" note and\n // FinancePackage.ts's \"tax\" note above. Fusing the full phrase means the\n // bare leading word itself never becomes its own token type, so e.g.\n // \":timestamp = 5\" keeps working.\n WORKDAYS_IN: \"WORKDAYS_IN\",\n WEEKDAY_ON: \"WEEKDAY_ON\",\n CURRENT_TIMESTAMP: \"CURRENT_TIMESTAMP\",\n TO_DATE: \"TO_DATE\",\n TO_TIMESTAMP: \"TO_TIMESTAMP\",\n // Natural-question forms over the same date fields, \"what day is it in\n // 30 days\", \"what month is it on 25/12/2026\", \"what week is it\". Each is\n // a fully-fused phrase for the same reason as WEEKDAY_ON above: claiming\n // bare \"day\"/\"month\"/\"week\" as keywords would break \":day = 5\" and\n // collide with the UNIT tokens of the same name.\n WEEKDAY_IN: \"WEEKDAY_IN\",\n MONTH_ON: \"MONTH_ON\",\n MONTH_IN: \"MONTH_IN\",\n WEEK_ON: \"WEEK_ON\",\n DAYS_IN_PERIOD: \"DAYS_IN_PERIOD\",\n IN_TWO_UNITS: \"IN_TWO_UNITS\",\n PER_UNIT: \"PER_UNIT\",\n AT_RATE: \"AT_RATE\",\n WEEK_IN: \"WEEK_IN\",\n // `<unit> between <date> and <date>`, fused UNIT+BETWEEN, exactly like\n // UNTIL_UNIT/SINCE_UNIT above.\n BETWEEN_UNIT: \"BETWEEN_UNIT\",\n // Business-day arithmetic in words, \"N working/business days after|from|\n // before <date>\" (infix, the count is the left operand) and \"working/\n // business days between <date> and <date>\" (prefix). Full phrases for the\n // same reason as WORKDAYS_IN above: \"working\"/\"business\" are ordinary words,\n // so only the complete phrase is claimed, never the bare leading word. See\n // WorkdayOffsetParselet.ts / WorkdaysBetweenParselet.ts.\n WORKDAYS_AFTER: \"WORKDAYS_AFTER\",\n WORKDAYS_BEFORE: \"WORKDAYS_BEFORE\",\n WORKDAYS_BETWEEN: \"WORKDAYS_BETWEEN\",\n // Postfix day-type predicates, \"<date> is a weekend\" / \"is a workday\".\n IS_WEEKEND: \"IS_WEEKEND\",\n IS_WORKDAY: \"IS_WORKDAY\",\n // ── Time, video timecode (packages/time/) ──\n // Fused from a raw `HH:MM:SS:FF` token sequence (see\n // packages/time/normalizer/VideoTimecodeNormalizerRule.ts) and from\n // `NUMBER frames` (see FrameCountNormalizerRule.ts), not a bare-keyword\n // collision risk the way the datetime tokens above are, since neither\n // fusion claims a plain English word as its own token type.\n VIDEO_TIMECODE: \"VIDEO_TIMECODE\",\n FRAME_COUNT: \"FRAME_COUNT\",\n // \"@\". See ExpressionLexer.ts's OP_MAP entry for why this was\n // previously dormant/unproduced despite being anticipated by name here\n // and in TokenNormalizer.ts's NON_WORD_NAMES.\n AT: \"AT\",\n // Generic token for every currency symbol added AFTER the original\n // DOLLAR/POUND/EURO/YEN/RUBLE/WON set (each of which kept its own\n // specific token type for backward compatibility). See\n // uom/CurrencyAliases.ts's CURRENCY_SYMBOL_ALIASES and\n // ExpressionLexer.ts's dispatch for the full symbol list. One shared\n // type avoids needing a new TokenTypes entry + TokenCategoryMap entry +\n // CurrencyPackage.ts prefixParselets entry per additional symbol.\n CURRENCY_SYMBOL: \"CURRENCY_SYMBOL\",\n // ── Cross-line data access (packages/lines/) ──\n // \"prev\" -- bare keyword (nothing to phrase-fuse against, same shape as\n // CLAMP -- accepted collision risk per that package's own precedent).\n PREV: \"PREV\",\n // \"line1\" / \"line 1\" / \"l1\" -- fused by LineRefNormalizerRule (never a\n // bare lexer keyword, so \":line = 5\"/\":l = 5\" stay untouched). Carries\n // the parsed line number as its .value.\n LINE_REF: \"LINE_REF\",\n // \"sum(\" / \"total(\" -- fused ONLY when immediately followed by LPAREN\n // (see LineRefNormalizerRule's lookahead guard), so \":sum = 100\" and\n // MathPhrases' \"total of X, Y\" (no paren after \"of\") are unaffected.\n SUM_RANGE_CALL: \"SUM_RANGE_CALL\",\n AVERAGE_RANGE_CALL: \"AVERAGE_RANGE_CALL\",\n // \"total above\" / \"sum above\" / \"average above\" -- phrase-fused (see\n // LinesPackage.ts's `phrases` field), a deliberate departure from\n // Numi/Numbr's bare \"total\"/\"sum\" wording to avoid the exact bare-\n // keyword collision this codebase already regressed on once.\n TOTAL_ABOVE: \"TOTAL_ABOVE\",\n SUM_ABOVE: \"SUM_ABOVE\",\n AVERAGE_ABOVE: \"AVERAGE_ABOVE\",\n // ── Goal seek (packages/goalseek/) ──\n // \"solve line 4 for rate = 900\" -- fused by GoalSeekNormalizerRule when the\n // bare word \"solve\" is immediately followed by a LINE_REF (never a bare\n // lexer keyword, so \":solve = 2\" and the existing \"solve(...)\" call form\n // both stay untouched, since neither is \"solve\" directly before a LINE_REF).\n GOAL_SEEK: \"GOAL_SEEK\",\n} as const;\n\n/**\n * A token's kind, as a string.\n *\n * Deliberately open rather than an enum: a package registers its own token\n * types at runtime, and a closed set would make that impossible.\n */\nexport type TokenType = (typeof TokenTypes)[keyof typeof TokenTypes];\n\n// ── Integer Token Type ID System ──────────────────────────────────────────────\n// Enables O(1) integer comparison in Parser hot path instead of string hashing.\n\n/** Auto-incrementing integer ID for each token type. */\nlet _nextTokenTypeId = 0;\n\n/** String → integer ID lookup. Populated lazily via registerTokenType(). */\nconst _tokenTypeNameToId = new Map<string, number>();\n\n/** Integer ID → string lookup. For debug/error messages. */\nconst _tokenTypeIdToName = new Map<number, string>();\n\n/**\n * Register a token type name and get back its integer ID.\n * Idempotent, returns existing ID if already registered.\n * Call once per token type at module initialization time.\n */\nexport function registerTokenType(name: string): number {\n\tconst existing = _tokenTypeNameToId.get(name);\n\tif (existing !== undefined) return existing;\n\tconst id = _nextTokenTypeId++;\n\t_tokenTypeNameToId.set(name, id);\n\t_tokenTypeIdToName.set(id, name);\n\treturn id;\n}\n\n/**\n * Get the integer ID for a token type name.\n * Lazily registers unknown token types on first access, enabling plugin providers\n * to define custom token types (VEC2, VEC3, etc.) without pre-registration.\n * All built-in TokenTypes are pre-registered via registerAllTokenTypes().\n */\nexport function tokenTypeId(name: string): number {\n\treturn registerTokenType(name); // registerTokenType is idempotent\n}\n\n/**\n * Get the string name for a token type ID (for error messages and debugging).\n * Returns `UNKNOWN_${id}` if the ID is not registered.\n */\nexport function tokenTypeName(id: number): string {\n\treturn _tokenTypeIdToName.get(id) ?? `UNKNOWN_${id}`;\n}\n\n/**\n * Bootstrap all known token types from TokenTypes at module load.\n * Call this once after TokenTypes is defined.\n */\nexport function registerAllTokenTypes(): void {\n\tfor (const name of Object.values(TokenTypes)) {\n\t\tregisterTokenType(name);\n\t}\n}\n"]}
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkHG4NPDN5_cjs=require('./chunk-HG4NPDN5.cjs'),chunk634ILVMP_cjs=require('./chunk-634ILVMP.cjs'),chunkFYAMQFZZ_cjs=require('./chunk-FYAMQFZZ.cjs'),chunkABVDKMNF_cjs=require('./chunk-ABVDKMNF.cjs'),chunkWGP4UUO5_cjs=require('./chunk-WGP4UUO5.cjs'),chunkSQHBOWES_cjs=require('./chunk-SQHBOWES.cjs'),chunkZKFCKAIX_cjs=require('./chunk-ZKFCKAIX.cjs'),chunkEZKR44MA_cjs=require('./chunk-EZKR44MA.cjs'),chunkYBQPEWT7_cjs=require('./chunk-YBQPEWT7.cjs');var vt=class{constructor(){this.consumers=new Map;this.dependencies=new Map;this.writes=new Map;this.lineReads=new Map;this.dataSourceDependencies=new Map;this.dataSourceConsumers=new Map;}registerLine(a,s,u){let m=this.lineReads.get(a);if(m)for(let g of m){let h=this.consumers.get(g);h&&h.delete(a);}this.lineReads.set(a,new Set(s));for(let g of s)this.consumers.has(g)||this.consumers.set(g,new Set),this.consumers.get(g).add(a);if(u.length>0){this.dependencies.set(a,new Set(s)),this.writes.set(a,new Set(u));for(let g of u){let h=this.consumers.get(g);h&&h.delete(a);}}}registerLineDataSourceDependency(a,s,u){let m=JSON.stringify(u),g=`${s}:${m}`;this.dataSourceDependencies.has(a)||this.dataSourceDependencies.set(a,new Set),this.dataSourceDependencies.get(a).add(g),this.dataSourceConsumers.has(g)||this.dataSourceConsumers.set(g,new Set),this.dataSourceConsumers.get(g).add(a);}getAffectedLines(a){let s=new Set,u=[a];for(;u.length>0;){let m=u.pop(),g=this.consumers.get(m);if(g)for(let h of g){if(s.has(h))continue;s.add(h);let f=this.writes.get(h);if(f)for(let y of f)u.push(y);}}return s}getAffectedLinesInOrder(a){let s=this.getAffectedLines(a);if(s.size===0)return [];let u=new Map,m=new Map;for(let y of s)u.has(y)||u.set(y,0),m.has(y)||m.set(y,[]);let g=new Map;for(let y of s){let x=this.writes.get(y);if(x)for(let S of x)g.set(S,y);}for(let y of s){let x=this.lineReads.get(y);if(x)for(let S of x){let O=g.get(S);O!==void 0&&O!==y&&(m.get(O).push(y),u.set(y,(u.get(y)??0)+1));}}let h=[];for(let[y,x]of u)x===0&&h.push(y);if(h.length===0&&s.size>0){let y=Array.from(s).sort((x,S)=>x-S);h.push(y[0]);}let f=[];for(;h.length>0;){let y=h.shift();f.push(y);for(let x of m.get(y)??[]){let S=(u.get(x)??1)-1;u.set(x,S),S===0&&h.push(x);}}if(f.length<s.size){let y=new Set(f),x=Array.from(s).filter(S=>!y.has(S)).sort((S,O)=>S-O);f.push(...x);}return f}getAffectedLinesByDataSource(a,s){let u=JSON.stringify(s),m=`${a}:${u}`;return this.dataSourceConsumers.get(m)??new Set}removeLine(a){let s=this.lineReads.get(a);if(s){for(let m of s){let g=this.consumers.get(m);g&&g.delete(a);}this.lineReads.delete(a);}this.dependencies.delete(a),this.writes.delete(a);let u=this.dataSourceDependencies.get(a);if(u){for(let m of u)this.dataSourceConsumers.get(m)?.delete(a);this.dataSourceDependencies.delete(a);}}getConsumers(a){return this.consumers.get(a)??new Set}getDependencies(a){return this.dependencies.get(a)??new Set}getWrites(a){return this.writes.get(a)??new Set}getSnapshot(){let a={};for(let[h,f]of this.consumers)a[h]=Array.from(f);let s={};for(let[h,f]of this.writes)s[h]=Array.from(f);let u={};for(let[h,f]of this.lineReads)u[h]=Array.from(f);let m={};for(let[h,f]of this.dataSourceDependencies)m[h]=Array.from(f);let g={};for(let[h,f]of this.dataSourceConsumers)g[h]=Array.from(f);return {consumers:a,writes:s,reads:u,dataSourceDeps:m,dataSourceConsumers:g}}clear(){this.consumers.clear(),this.dependencies.clear(),this.writes.clear(),this.lineReads.clear(),this.dataSourceDependencies.clear(),this.dataSourceConsumers.clear();}};var Rt=class{constructor(){this.definitions=new Map;}write(a,s,u){this.definitions.has(a)||this.definitions.set(a,[]);let m=this.definitions.get(a);m.push({line:s,expr:u}),m.sort((g,h)=>g.line-h.line);}read(a,s){let u=this.definitions.get(a);if(u){for(let m=u.length-1;m>=0;m--)if(u[m].line<=s)return u[m].expr.lastResult}}invalidateDownstream(a,s){let u=this.definitions.get(a);if(!u)return;let m=u.findIndex(g=>g.line===s);m!==-1&&u.splice(m+1);}clear(){this.definitions.clear();}};var je={kg:{dim:[1,0,0,0],si:1},g:{dim:[1,0,0,0],si:.001},tonne:{dim:[1,0,0,0],si:1e3},t:{dim:[1,0,0,0],si:1e3},m:{dim:[0,1,0,0],si:1},cm:{dim:[0,1,0,0],si:.01},mm:{dim:[0,1,0,0],si:.001},km:{dim:[0,1,0,0],si:1e3},s:{dim:[0,0,1,0],si:1},ms:{dim:[0,0,1,0],si:.001},min:{dim:[0,0,1,0],si:60},minute:{dim:[0,0,1,0],si:60},minutes:{dim:[0,0,1,0],si:60},h:{dim:[0,0,1,0],si:3600},hr:{dim:[0,0,1,0],si:3600},hour:{dim:[0,0,1,0],si:3600},hours:{dim:[0,0,1,0],si:3600},A:{dim:[0,0,0,1],si:1},mA:{dim:[0,0,0,1],si:.001},kA:{dim:[0,0,0,1],si:1e3},ampere:{dim:[0,0,0,1],si:1},amperes:{dim:[0,0,0,1],si:1},mps2:{dim:[0,1,-2,0],si:1},N:{dim:[1,1,-2,0],si:1},kN:{dim:[1,1,-2,0],si:1e3},newton:{dim:[1,1,-2,0],si:1},newtons:{dim:[1,1,-2,0],si:1},J:{dim:[1,2,-2,0],si:1},kJ:{dim:[1,2,-2,0],si:1e3},MJ:{dim:[1,2,-2,0],si:1e6},joule:{dim:[1,2,-2,0],si:1},joules:{dim:[1,2,-2,0],si:1},Wh:{dim:[1,2,-2,0],si:3600},kWh:{dim:[1,2,-2,0],si:36e5},W:{dim:[1,2,-3,0],si:1},kW:{dim:[1,2,-3,0],si:1e3},MW:{dim:[1,2,-3,0],si:1e6},watt:{dim:[1,2,-3,0],si:1},watts:{dim:[1,2,-3,0],si:1},Pa:{dim:[1,-1,-2,0],si:1},kPa:{dim:[1,-1,-2,0],si:1e3},MPa:{dim:[1,-1,-2,0],si:1e6},pascal:{dim:[1,-1,-2,0],si:1},pascals:{dim:[1,-1,-2,0],si:1},V:{dim:[1,2,-3,-1],si:1},mV:{dim:[1,2,-3,-1],si:.001},kV:{dim:[1,2,-3,-1],si:1e3},volt:{dim:[1,2,-3,-1],si:1},volts:{dim:[1,2,-3,-1],si:1}},nn={"1,1,-2,0":"N","1,2,-2,0":"J","1,2,-3,0":"W","1,-1,-2,0":"Pa","1,2,-3,-1":"V"},an=r=>r.join(",");function ze(r,a,s){if(r.type!==6||a.type!==6)return null;let u=r.unit?je[r.unit]:void 0,m=a.unit?je[a.unit]:void 0;if(u===void 0||m===void 0)return null;let g=[u.dim[0]+(s?m.dim[0]:-m.dim[0]),u.dim[1]+(s?m.dim[1]:-m.dim[1]),u.dim[2]+(s?m.dim[2]:-m.dim[2]),u.dim[3]+(s?m.dim[3]:-m.dim[3])],h=nn[an(g)];if(h===void 0)return null;let f=r.toNumber()*u.si,y=a.toNumber()*m.si,x=s?f*y:f/y;return chunkSQHBOWES_cjs.u(x/je[h].si,h)}function rn(r){let a=new Date(r).getDay();return a===0||a===6}function Bt(r,a){return rn(r)?false:a?!a(r):true}function Vt(r){let a=new Date(r);return new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime()}function Lt(r,a,s,u){let m=Math.trunc(Math.abs(a)),g=a>=0?1:-1,h=new Date(r),f=0;for(;m>0;){if(h.setDate(h.getDate()+g),f++,f>u)return null;Bt(h.getTime(),s)&&m--;}return h.getTime()}function Ft(r,a,s,u){let m=Vt(Math.min(r,a)),g=Vt(Math.max(r,a)),h=Math.round((g-m)/864e5);if(h>u)return null;let f=0,y=new Date(m);for(let x=0;x<=h;x++)Bt(y.getTime(),s)&&f++,y.setDate(y.getDate()+1);return f}var sn={0:{name:"sqrt",min:1,max:1},1:{name:"abs",min:1,max:1},2:{name:"sin",min:1,max:1},3:{name:"cos",min:1,max:1},4:{name:"tan",min:1,max:1},5:{name:"log",min:1,max:1},6:{name:"ceil",min:1,max:1},7:{name:"floor",min:1,max:1},8:{name:"round",min:1,max:2},9:{name:"min",min:1,max:1/0},10:{name:"max",min:1,max:1/0},11:{name:"asin",min:1,max:1},12:{name:"acos",min:1,max:1},13:{name:"atan",min:1,max:1},14:{name:"atan2",min:2,max:2},15:{name:"sinh",min:1,max:1},16:{name:"cosh",min:1,max:1},17:{name:"tanh",min:1,max:1},18:{name:"asinh",min:1,max:1},19:{name:"acosh",min:1,max:1},20:{name:"atanh",min:1,max:1},21:{name:"cbrt",min:1,max:1},22:{name:"clz32",min:1,max:1},23:{name:"expm1",min:1,max:1},24:{name:"exp",min:1,max:1},25:{name:"fround",min:1,max:1},26:{name:"hypot",min:1,max:1/0},27:{name:"imul",min:2,max:2},28:{name:"log10",min:1,max:1},29:{name:"log1p",min:1,max:1},30:{name:"log2",min:1,max:1},31:{name:"pow",min:2,max:2},32:{name:"random",min:0,max:0},33:{name:"sign",min:1,max:1},34:{name:"trunc",min:1,max:1},35:{name:"degtorad",min:1,max:1},36:{name:"radtodeg",min:1,max:1},37:{name:"roll",min:2,max:2},38:{name:"gcd",min:2,max:2},39:{name:"lcm",min:2,max:2},40:{name:"permutation",min:2,max:2},41:{name:"combination",min:2,max:2},42:{name:"average",min:0,max:1/0},43:{name:"median",min:0,max:1/0},44:{name:"total",min:0,max:1/0},45:{name:"count",min:0,max:1/0},46:{name:"proportion",min:3,max:3},47:{name:"clamp",min:3,max:3},48:{name:"hex",min:1,max:1},49:{name:"bin",min:1,max:1},50:{name:"int",min:1,max:1},51:{name:"compoundInterest",min:3,max:3},52:{name:"interestEarned",min:3,max:3},53:{name:"compoundInterestRate",min:3,max:3},54:{name:"compoundInterestYears",min:3,max:3},55:{name:"loanRepayment",min:4,max:4},56:{name:"loanInterest",min:4,max:4},57:{name:"monthlyPayment",min:3,max:3},58:{name:"taxAdd",min:2,max:2},59:{name:"taxRemove",min:2,max:2},60:{name:"inflationAdjust",min:3,max:3},61:{name:"root",min:2,max:2},62:{name:"fact",min:1,max:1},63:{name:"transpose",min:1,max:1},64:{name:"det",min:1,max:1},65:{name:"inv",min:1,max:1},66:{name:"dot",min:2,max:2},67:{name:"expand",min:1,max:1},68:{name:"factor",min:1,max:1},69:{name:"solve",min:3,max:3},70:{name:"der",min:2,max:3},71:{name:"integral",min:2,max:2},72:{name:"taylor",min:4,max:4},73:{name:"jacobian",min:1,max:1/0},74:{name:"imaginary",min:1,max:1},75:{name:"conj",min:1,max:1},76:{name:"re",min:1,max:1},77:{name:"im",min:1,max:1},78:{name:"cancel",min:1,max:1},79:{name:"apart",min:1,max:1},80:{name:"compoundInterestEvery",min:4,max:4},81:{name:"compoundInterestEarnedEvery",min:4,max:4},82:{name:"presentValue",min:3,max:3},83:{name:"roi",min:2,max:2},84:{name:"annualisedReturn",min:3,max:3},85:{name:"taxIn",min:2,max:2},86:{name:"taxOn",min:2,max:2},87:{name:"sind",min:1,max:1},88:{name:"cosd",min:1,max:1},89:{name:"tand",min:1,max:1},90:{name:"asind",min:1,max:1},91:{name:"acosd",min:1,max:1},92:{name:"atand",min:1,max:1},93:{name:"daysCount",min:1,max:1},94:{name:"asTwoUnits",min:3,max:3},95:{name:"makeRate",min:2,max:2},96:{name:"atRate",min:2,max:2},97:{name:"roundToPlaces",min:2,max:2},98:{name:"splitEach",min:2,max:2},99:{name:"savingsGoalPayment",min:3,max:3},100:{name:"savingsGoalPeriods",min:5,max:5},101:{name:"standardDeviation",min:0,max:1/0},102:{name:"sampleStandardDeviation",min:0,max:1/0},103:{name:"variance",min:0,max:1/0},104:{name:"sampleVariance",min:0,max:1/0},105:{name:"spread",min:0,max:1/0},106:{name:"mode",min:0,max:1/0},107:{name:"weightedAverage",min:2,max:1/0}};function ke(r){return r===1?"1 argument":`${r} arguments`}function on(r){return r.max===1/0?`at least ${ke(r.min)}`:r.min===r.max?ke(r.min):`${r.min} to ${ke(r.max)}`}function $t(r,a){let s=sn[r];if(s!==void 0&&!(a>=s.min&&a<=s.max))return chunkYBQPEWT7_cjs.c.execution("BUILTIN_ARITY_MISMATCH",`${s.name}() takes ${on(s)}, but was given ${a===0?"none":ke(a)}`,{functionName:s.name,expectedMin:s.min,expectedMax:s.max,actual:a})}function ia(r,a=200,s=5e4,u=50,m=1e5,g=2e6,h=1e4,f=100,y=-100,x=chunk634ILVMP_cjs.y,S){let O=[],E=new Map,F=0,j,$,n=[],Q=new Map,X=new Map,K=new Map;return {push(d){if(O.length>=a)throw chunkYBQPEWT7_cjs.c.execution("STACK_LIMIT_EXCEEDED",`Execution exceeded maximum stack depth of ${a}`);O.push(d);},getMaxStackDepth(){return a},getMaxCollectionSize(){return m},getMaxAllocatedElements(){return g},getMaxFunctionCalls(){return h},getMaxDateOffsetYears(){return f},getMinDateOffsetYears(){return y},isHoliday(d){return S?S(d):false},pop(){return c(O)},popNumber(){return c(O).toNumber()},popString(){return q(c(O),"VM.popString()")},peek(){return O[O.length-1]},getStack(){return O},registry:r,getVar(d){if(n.length>0){let e=n[n.length-1].get(d);if(e!==void 0)return e}return E.get(d)},setVar(d,e){E.set(d,e);},deleteVar(d){E.delete(d);},pushCallFrame(d){if(n.length>=u)throw chunkYBQPEWT7_cjs.c.execution("FUNCTION_RECURSION_LIMIT_EXCEEDED",`Function call nesting exceeded maximum depth of ${u} (possible infinite recursion, e.g. f(x) = f(x))`,{maxFunctionRecursionDepth:u});n.push(d);},popCallFrame(){n.pop();},getCallFrame(){return n.length>0?n[n.length-1]:void 0},defineUserFunction(d,e,t){Q.set(d,{name:d,params:e,program:t});},getUserFunction(d){return Q.get(d)},hasUserFunction(d){return Q.has(d)},getVariableEntries(){return Array.from(E.entries())},getUserFunctionDefs(){return Array.from(Q.values())},defineEquation(d,e,t){X.set(d,{variable:d,factorNames:e,rhsProgram:t});},getEquation(d){return X.get(d)},hasEquation(d){return X.has(d)},defineScalarEquation(d,e,t){K.set(d,{variable:d,lhsProgram:e,rhsProgram:t});},getScalarEquation(d){return K.get(d)},hasScalarEquation(d){return K.has(d)},reset(){O.length=0,E.clear(),n.length=0,Q.clear(),X.clear(),K.clear(),F=0,$&&($(),$=void 0),j=void 0;},get activeSignal(){return j},set activeSignal(d){j=d;},get abortCurrent(){return $},set abortCurrent(d){$=d;},context:x,getMaxInstructions(){return s},getInstructionCount(){return F},incrementInstructions(d){if(F+=d,F>s)throw chunkYBQPEWT7_cjs.c.execution("INSTRUCTION_LIMIT_EXCEEDED",`Execution exceeded maximum of ${s} instructions`)}}}function un(r,a){return r.rows===1&&r.cols===1?a.data.length:a.rows===1&&a.cols===1?r.data.length:r.cols!==a.rows?0:r.rows*a.cols}function ln(r,a){return !Number.isInteger(a)||a<0?0:r.rows*r.cols*(1+(a<2?1:2*Math.floor(Math.log2(a))))}function Pt(r,a,s){return r.context.networkEnabled?chunkSQHBOWES_cjs.P("CURRENCY_RATE_UNAVAILABLE",`No exchange rate available for ${a} to ${s}`):chunkSQHBOWES_cjs.P("NETWORK_DISABLED",`No exchange rate for ${a} to ${s}: live data is switched off for this engine (network.enabled is false)`)}function c(r){if(r.length===0)throw chunkYBQPEWT7_cjs.c.internal({code:"STACK_UNDERFLOW",message:"Stack underflow: an opcode expected a value on the stack but it was empty",expected:"at least one value on the VM stack",found:"an empty stack",suggestion:"this indicates corrupted bytecode or a bug in a package's parselet (mismatched push/pop counts), not a user-input error"});return r.pop()}var Zt="bytecode is caller input on this entry point: rebuild the program with the engine's compiler, or fix the hand-assembled stream";function mn(r){return typeof r=="number"?chunkABVDKMNF_cjs.b(r):r}function oe(r,a,s,u,m,g={}){let h=mn(a);return chunkYBQPEWT7_cjs.c.validation({code:r,message:`Malformed bytecode: ${h} ${s}`,expected:u,found:m,suggestion:Zt,context:typeof a=="number"?{opcode:a,opcodeName:h,...g}:{site:h,...g}})}function U(r,a,s,u){if(a>=r.length)throw oe("MALFORMED_BYTECODE_TRUNCATED",s,`is missing its ${u}: the program ends mid-instruction`,`an operand byte at offset ${a}`,`a program only ${r.length} byte(s) long`,{offset:a,length:r.length,role:u});return r[a]}function Je(r,a,s,u,m,g){let h=U(r,a,s,u);if(h>=m)throw oe("MALFORMED_BYTECODE_CONSTANT_INDEX",s,`reads ${g} entry ${h}, which does not exist`,`an index below ${m}`,`${h}`,{index:h,poolSize:m,pool:g});return h}function J(r,a,s,u,m){return Te(s,U(r,a,u,m),u)}function Te(r,a,s){let u=r[a];if(typeof u!="string")throw oe("MALFORMED_BYTECODE_CONSTANT_INDEX",s,`reads string-pool entry ${a}, which is ${a>=r.length?"past the end of the pool":"not a string"}`,`an index below ${r.length}, holding a string`,a>=r.length?`${a}`:typeof u,{index:a,poolSize:r.length,pool:"string-pool"});return u}function q(r,a,s){if(typeof r.value!="string")throw oe("MALFORMED_BYTECODE_OPERAND_TYPE",a,`expected a ${s??"string"} on the stack`,s?`a string value holding the ${s}`:"a string value",`a ${chunkSQHBOWES_cjs.g[r.type]??"unknown"} value`,s?{role:s,valueType:r.type}:{valueType:r.type});return r.value}function Yt(r,a,s){if(r!==0&&r!==1&&r!==2)throw oe("MALFORMED_BYTECODE_BODY_KIND",s,`has body kind ${r}, which is not one this VM knows`,"0 (inline body), 1 (builtin function) or 2 (user-defined function)",`${r}`,{kind:r,ref:a})}function cn(r,a){try{return BigInt(r)}catch{throw oe("MALFORMED_BYTECODE_BIGINT_LITERAL",a,`cannot read "${r}" as a whole number`,"a string holding an integer, with no decimal point or separators",`"${r}"`,{literal:r})}}function pn(r){if(r===null||typeof r!="object")return `expected a bytecode program, got ${r===null?"null":typeof r}`;let a=r;return typeof a.opcodes?.length!="number"?"the program has no `opcodes` array":typeof a.numbers?.length!="number"?"the program has no `numbers` pool":typeof a.strings?.length!="number"?"the program has no `strings` pool":null}var Wt=64;function Qe(r,a,s,u,m,g,h,f){let y=new Map;for(let S=0;S<r.length;S++)y.set(r[S],s[S]);u.pushCallFrame(y);let x;try{x=tt(a,u,m,g,h,f);}finally{u.popCallFrame();}if(x.type==="pending")throw chunkYBQPEWT7_cjs.c.execution("MAP_REDUCE_ASYNC_UNSUPPORTED","map/reduce transform bodies calling an async operation (weather, stocks, currency, ...) aren't supported");if(x.type==="error")throw x.error;return x.value}function dn(r,a,s,u,m,g,h){let f=new Map(s.getCallFrame());f.set(r,chunkSQHBOWES_cjs.K(chunkWGP4UUO5_cjs.q(r))),s.pushCallFrame(f);let y;try{y=tt(a,s,u,m,g,h);}finally{s.popCallFrame();}if(y.type==="pending")throw chunkYBQPEWT7_cjs.c.execution("SYMBOLIC_ASYNC_UNSUPPORTED","an algebra verb's expression cannot call an async operation (weather, stocks, currency, ...)");if(y.type==="error")throw y.error;return y.value}function Gt(r,a){if(r.type!==6||a.type!==6)return null;let s=r.unit,u=a.unit;if(s===void 0||u===void 0)return null;let m=s.indexOf("/"),g=u.indexOf("/");if(m<0||g<0||s.slice(0,m)!==u.slice(0,g))return null;let h=chunkEZKR44MA_cjs.a[s.slice(m+1).toLowerCase()],f=chunkEZKR44MA_cjs.a[u.slice(g+1).toLowerCase()];return h===void 0||f===void 0||h[0]!==f[0]?null:r.toNumber()*(f[1]/h[1])}function Xt(r,a){if(r.type!==6||a.type!==6)return null;let s=r.unit,u=a.unit;if(s===void 0||u===void 0||s.includes("/")||u.includes("/"))return null;let m=chunkWGP4UUO5_cjs.ua[s.toUpperCase()]!==void 0,g=chunkWGP4UUO5_cjs.ua[u.toUpperCase()]!==void 0;return m===g?null:chunkSQHBOWES_cjs.u(r.toNumber()*a.toNumber(),m?s:u)}function Kt(r,a,s){if(r.type===5)return a.type===6&&a.unit!==void 0?chunk634ILVMP_cjs.c(a,a.unit,r.toNumber(),s):a.type!==5&&a.type!==0?null:chunkSQHBOWES_cjs.N(r.toNumber()+s*a.toNumber());if(a.type!==5)return null;let u=1+s*a.toNumber();if(r.type===0){let m=r.toNumber()*u;return r.uncertainty!==void 0?chunkSQHBOWES_cjs.q(m,Math.abs(r.uncertainty*u)):chunkSQHBOWES_cjs.n(m)}return r.type===6&&r.unit!==void 0?chunk634ILVMP_cjs.c(r,r.unit,a.toNumber(),s):null}function fn(r,a){let s=r.type===5?r:a.type===5?a:null;if(s===null)return null;let u=s===r?a:r;if(u.type!==0||u.uncertainty===void 0)return null;let m=s.toNumber();return chunkSQHBOWES_cjs.q(u.toNumber()*m,Math.abs(u.uncertainty*m))}function bn(r,a){let s=r.type===6?r:a,u=r.type===6?a:r;return s.type!==6||s.unit===void 0||!chunkFYAMQFZZ_cjs.c.isCurrency(s.unit)||u.type!==0&&u.type!==5||u.rational!==void 0?null:chunk634ILVMP_cjs.b(s,u.toNumber(),s.unit)}function hn(r,a){if(a.type===5&&r.type===0&&r.uncertainty!==void 0){let s=a.toNumber();return s===0?null:chunkSQHBOWES_cjs.q(r.toNumber()/s,Math.abs(r.uncertainty/s))}if(r.type===5&&a.type===0&&a.uncertainty!==void 0){let s=a.toNumber();return s===0?null:chunkSQHBOWES_cjs.q(r.toNumber()/s,Math.abs(r.toNumber()*a.uncertainty/(s*s)))}return null}function gn(r){if(r.type===6){let a=r.unit;if(a&&chunkZKFCKAIX_cjs.c(a)==="time")try{return chunkZKFCKAIX_cjs.e(r.toNumber(),a,"ms")}catch{}return 0}return r.toNumber()}var Ht=260;function en(r,a,s){let u=Math.trunc(Math.abs(a)),g=(a>=0?1:-1)>0?s.getMaxDateOffsetYears():-s.getMinDateOffsetYears(),h=Math.floor(g*Ht);if(u>h)throw chunkYBQPEWT7_cjs.c.execution("DATE_OFFSET_LIMIT_EXCEEDED",`A date offset of ${u.toLocaleString("en-US")} workdays is about ${Math.round(u/Ht).toLocaleString("en-US")} years, past the limit of ${g} years for a workday offset`,{requestedWorkdays:u,limitYears:g,limitWorkdays:h});let f=h*7+7,y=Lt(r,a,x=>s.isHoliday(x),f);if(y===null)throw chunkYBQPEWT7_cjs.c.execution("DATE_OFFSET_LIMIT_EXCEEDED",`A working-day offset of ${u.toLocaleString("en-US")} could not be reached within the ${g}-year limit; the configured holiday calendar leaves too few working days`,{requestedWorkdays:u,limitYears:g,maxCalendarSteps:f});return y}var qt=864e5,yn={month:1,months:1,mo:1,year:12,years:12,yr:12,y:12,a:12,decade:120,decades:120,dec:120,century:1200,centuries:1200,millennium:12e3,millennia:12e3};function tn(r,a){let s=Math.trunc(a),u=new Date(r);u.setDate(u.getDate()+s);let m=u.getTime();return Number.isNaN(m)?r+a*qt:m+(a-s)*qt}function Nn(r,a){let s=Math.trunc(a),u=new Date(r),m=u.getDate();u.setDate(1),u.setMonth(u.getMonth()+s),u.setDate(Math.min(m,chunk634ILVMP_cjs.L(u.getFullYear(),u.getMonth())));let g=u.getTime(),h=chunkZKFCKAIX_cjs.e(1,"month","ms");return Number.isNaN(g)?r+a*h:g+(a-s)*h}function he(r,a,s,u){if(a.type===6&&a.unit!==void 0){let m=a.unit,g=s*a.toNumber();if(chunkZKFCKAIX_cjs.a(m))return en(r,g,u);let h=yn[m];if(h!==void 0)return Nn(r,g*h);if(chunkZKFCKAIX_cjs.c(m)==="time"){let f=0;try{f=chunkZKFCKAIX_cjs.e(1,m,"day");}catch{}if(Number.isInteger(f)&&f>=1)return tn(r,g*f)}}return r+s*gn(a)}function jt(r,a,s){let u=chunkSQHBOWES_cjs.B(r.unit);if(a.type===6&&chunkSQHBOWES_cjs.A(a.unit)){let m=chunkSQHBOWES_cjs.B(a.unit);return m!==u?chunkSQHBOWES_cjs.P("TIMECODE_FPS_MISMATCH",`Cannot combine timecodes at different frame rates (${u} fps vs ${m} fps)`):s===1?chunkSQHBOWES_cjs.u(r.toNumber()+a.toNumber(),r.unit):chunkSQHBOWES_cjs.u(r.toNumber()-a.toNumber(),"frames")}if(a.type===6&&a.unit==="frames")return chunkSQHBOWES_cjs.u(r.toNumber()+s*a.toNumber(),r.unit);if(a.type===6&&a.unit&&chunkZKFCKAIX_cjs.c(a.unit)==="time"){let m=chunkZKFCKAIX_cjs.e(a.toNumber(),a.unit,"s");return chunkSQHBOWES_cjs.u(r.toNumber()+s*m*u,r.unit)}return chunkSQHBOWES_cjs.u(r.toNumber()+s*a.toNumber(),r.unit)}function ge(r){return r.type===10?r.value:r.toNumber()!==0}function zt(r,a){let s=chunk634ILVMP_cjs.l(r,a);return chunkSQHBOWES_cjs.P("INCOMPATIBLE_UNITS",s??`Cannot convert ${r} to ${a}: they do not measure the same thing`)}var Se=65536;function xn(r,a){if(!Number.isInteger(a)||a<0)return null;if(a===0)return 1;let s=Math.abs(r.toNumber());return s<=1?1:(s<=2?1:Math.log2(s))*a}function En(r,a){let s=1n,u=r,m=a;for(;m>0n;)m%2n===1n&&(s*=u),m/=2n,m>0n&&(u*=u);return s}var Ze=Se;function Jt(r){let a=r<0n?-r:r;if(a===0n)return 0;let s=Number(a);return Number.isFinite(s)?Math.floor(Math.log2(s))+1:a.toString(16).length*4}function Qt(r,a,s){let u=chunk634ILVMP_cjs.n(r),m=chunk634ILVMP_cjs.n(a);if(u===0n)return chunkSQHBOWES_cjs.s(0n);let g=s*Number(m);if(g<=0||Jt(u)+g<=Ze)return chunkSQHBOWES_cjs.s(s===1?u<<m:u>>m);throw chunkYBQPEWT7_cjs.c.execution("BIGINT_SHIFT_LIMIT_EXCEEDED",`Shifting by ${m} would build an exact integer of about ${(Jt(u)+g).toLocaleString("en-US")} bits, past the limit of ${Ze.toLocaleString("en-US")} bits`,{shift:String(m),limitBits:Ze})}function et(r,a){let{numerator:s,denominator:u}=chunkSQHBOWES_cjs.y(r.unit),m=chunkZKFCKAIX_cjs.c(u),g=chunkZKFCKAIX_cjs.c(a.unit);if(!m||m!==g)return chunkSQHBOWES_cjs.P("RATE_MUL_MEASURE_MISMATCH",`Cannot multiply a "${u}"-denominated rate by "${a.unit}" \u2014 different measures`);let h=chunkZKFCKAIX_cjs.e(a.toNumber(),a.unit,u),f=r.toNumber()*h;return s?chunkSQHBOWES_cjs.u(f,s):chunkSQHBOWES_cjs.n(f)}function In(r){if(Number.isNaN(r))return "NaN";if(!isFinite(r))return r>0?"Infinity":"-Infinity";let a=r<0,s=Math.abs(r),u=Math.floor(s),m=s-u;if(m<1e-9)return `${a?"-":""}${u}`;let g=0,h=1,f=1,y=0,x=m,S=1e6;for(let E=0;E<30;E++){let F=Math.floor(x+1e-9),j=F*h+g,$=F*y+f;if($>S||(g=h,h=j,f=y,y=$,Math.abs(m-h/y)<1e-9))break;let n=x-F;if(n<1e-9)break;x=1/n;}let O=u*y+h;return `${a?"-":""}${O}/${y}`}function Dn(r){return r.d===1n?String(r.n):`${r.n}/${r.d}`}function Mn(r){let a=r.toNumber(),s=r.type===5?1+a:a;return `${Math.round(s*1e6)/1e6}x`}function _n(r){if(!Number.isFinite(r))return String(r);if(r===0)return "0e+0";let[a,s]=r.toExponential().split("e");return `${a.includes(".")?a.replace(/0+$/,"").replace(/\.$/,""):a}e${s}`}function tt(r,a,s,u,m,g){let h=pn(r);if(h)return {type:"error",error:chunkYBQPEWT7_cjs.c.validation({code:"MALFORMED_BYTECODE_PROGRAM",message:`Malformed bytecode: ${h}`,expected:"a BytecodeProgram with opcodes, numbers and strings",found:h,suggestion:Zt})};let{opcodes:f,numbers:y,strings:x,userFunctionBodies:S,anonymousBodies:O}=r,E=0,F=0,j=a.getMaxInstructions(),$=a.getMaxStackDepth(),n=a.getStack(),Q=s?.hasCollectors??false,X=chunkSQHBOWES_cjs.j();if(f.length===0)return {type:"value",value:chunkSQHBOWES_cjs.n(0)};chunkSQHBOWES_cjs.a(a);try{for(;E<f.length;){if(++F>j)throw chunkYBQPEWT7_cjs.c.execution("INSTRUCTION_LIMIT_EXCEEDED",`Execution exceeded maximum of ${j} instructions`);if(n.length>$)throw chunkYBQPEWT7_cjs.c.execution("STACK_LIMIT_EXCEEDED",`Execution exceeded maximum stack depth of ${$}`);let d=f[E++];if(Q){let e=n.map(t=>({type:t.type,value:t.value,unit:t.unit}));s.fireVmStep({type:chunkHG4NPDN5_cjs.c.VmStep,elapsedNs:0,expression:u??"",opcode:d,opcodeName:chunkABVDKMNF_cjs.b(d),ip:E-1,stackDepth:n.length,instructionNumber:F,stack:e});}switch(d){case 0:break;case 1:{let e=c(n);return {type:"value",value:X?chunkSQHBOWES_cjs.k(e):e}}case 3:{let e=c(n);n.push(e),n.push(e);break}case 2:{let e=c(n),t=c(n);n.push(e),n.push(t);break}case 10:n.push(chunkSQHBOWES_cjs.n(y[Je(f,E++,d,"constant-pool index",y.length,"number-pool")]));break;case 11:n.push(chunkSQHBOWES_cjs.s(cn(J(f,E++,x,d,"constant-pool index"),d)));break;case 16:{let e=chunkWGP4UUO5_cjs.ia(J(f,E++,x,d,"constant-pool index"));n.push(chunkSQHBOWES_cjs.o(chunkWGP4UUO5_cjs.ra(e),e));break}case 12:n.push(chunkSQHBOWES_cjs.r(y[Je(f,E++,d,"constant-pool index",y.length,"number-pool")]));break;case 13:n.push(chunkSQHBOWES_cjs.t(J(f,E++,x,d,"constant-pool index")));break;case 14:n.push(chunkSQHBOWES_cjs.L(U(f,E++,d,"boolean operand")===1));break;case 20:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let p=chunk634ILVMP_cjs.s(t,e,"add");if(p){n.push(p);break}}if(t.rational!==void 0||e.rational!==void 0){let p=chunk634ILVMP_cjs.r(t,e,"add");if(p){n.push(p);break}}let i=Kt(t,e,1),l=i===null?Gt(t,e):null;i!==null?n.push(i):l!==null?n.push(chunkSQHBOWES_cjs.u(l+e.toNumber(),e.unit)):t.type===0&&e.type===0?n.push(chunkSQHBOWES_cjs.n(t.value+e.value)):t.type===10&&e.type===10?n.push(chunkSQHBOWES_cjs.L(t.value&&e.value)):t.type===4?e.type===4?n.push(chunkSQHBOWES_cjs.P("INVALID_DATETIME_OP","Cannot add two datetimes together")):n.push(chunkSQHBOWES_cjs.M(he(t.toNumber(),e,1,a))):t.type===6&&chunkSQHBOWES_cjs.A(t.unit)?n.push(jt(t,e,1)):e.type===4?n.push(chunkSQHBOWES_cjs.M(he(e.toNumber(),t,1,a))):t.type===3&&e.type===3?n.push(chunkSQHBOWES_cjs.t(t.value+e.value)):n.push(chunk634ILVMP_cjs.u(t,e,(p,b)=>p+b,(p,b)=>p+b,"add"));break}case 21:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let p=chunk634ILVMP_cjs.s(t,e,"sub");if(p){n.push(p);break}}if(t.rational!==void 0||e.rational!==void 0){let p=chunk634ILVMP_cjs.r(t,e,"sub");if(p){n.push(p);break}}let i=Kt(t,e,-1),l=i===null?Gt(t,e):null;i!==null?n.push(i):l!==null?n.push(chunkSQHBOWES_cjs.u(l-e.toNumber(),e.unit)):t.type===0&&e.type===0?n.push(chunkSQHBOWES_cjs.n(t.value-e.value)):t.type===4?e.type===4?n.push(chunkSQHBOWES_cjs.u(t.toNumber()-e.toNumber(),"ms")):n.push(chunkSQHBOWES_cjs.M(he(t.toNumber(),e,-1,a))):t.type===6&&chunkSQHBOWES_cjs.A(t.unit)?n.push(jt(t,e,-1)):e.type===4?n.push(chunkSQHBOWES_cjs.P("INVALID_DATETIME_OP","Cannot subtract a datetime from a value that is not a datetime")):n.push(chunk634ILVMP_cjs.u(t,e,(p,b)=>p-b,(p,b)=>p-b,"sub"));break}case 22:{let e=c(n),t=c(n),o=fn(t,e);if(o){n.push(o);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let l=chunk634ILVMP_cjs.s(t,e,"mul");if(l){n.push(l);break}}if(t.rational!==void 0||e.rational!==void 0){let l=chunk634ILVMP_cjs.r(t,e,"mul");if(l){n.push(l);break}}let i=bn(t,e);if(i){n.push(i);break}if(t.type===0&&e.type===0)n.push(chunkSQHBOWES_cjs.n(t.value*e.value));else if(t.type===7&&e.type===7)chunkSQHBOWES_cjs.d(un(t.value,e.value),"matrix cells"),n.push(chunkWGP4UUO5_cjs._(t.value,e.value));else if(t.type===6&&chunkSQHBOWES_cjs.x(t.unit)&&e.type===6&&e.unit)n.push(et(t,e));else if(e.type===6&&chunkSQHBOWES_cjs.x(e.unit)&&t.type===6&&t.unit)n.push(et(e,t));else if(Xt(t,e)!==null)n.push(Xt(t,e));else {let l=ze(t,e,!0);l?n.push(l):n.push(chunk634ILVMP_cjs.u(t,e,(p,b)=>p*b,(p,b)=>p*b,"mul"));}break}case 23:{let e=c(n),t=c(n),o=hn(t,e);if(o){n.push(o);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let i=chunk634ILVMP_cjs.s(t,e,"div");if(i){n.push(i);break}}if(t.type===6&&e.type===6){let{lv:i,rv:l,sameMeasure:p}=chunk634ILVMP_cjs.j(t,e);if(p)n.push(chunkSQHBOWES_cjs.n(i/l));else if(chunkFYAMQFZZ_cjs.c.isCurrency(t.unit)&&chunkFYAMQFZZ_cjs.c.isCurrency(e.unit))n.push(chunkSQHBOWES_cjs.P("INCOMPATIBLE_UNITS",`Cannot combine incompatible units: ${t.unit} and ${e.unit}`));else {let b=ze(t,e,!1);if(b){n.push(b);break}n.push(chunkSQHBOWES_cjs.w(i/l,t.unit,e.unit));}}else {let i=chunk634ILVMP_cjs.r(t,e,"div");if(i){n.push(i);break}n.push(chunk634ILVMP_cjs.u(t,e,(l,p)=>l/p,(l,p)=>{if(p===0n)throw chunk634ILVMP_cjs.o();return l/p},"div"));}break}case 24:{let e=c(n),t=c(n);n.push(chunk634ILVMP_cjs.u(t,e,(o,i)=>o%i,(o,i)=>{if(i===0n)throw chunk634ILVMP_cjs.o();return o%i}));break}case 25:{let e=c(n),t=c(n);if(t.type===13){n.push(t);break}if(e.type===13){n.push(e);break}if(t.type===12){n.push(t);break}if(e.type===12){n.push(e);break}if(t.type===0&&e.type===0){n.push(chunkSQHBOWES_cjs.n(chunk634ILVMP_cjs.q(t.value,e.value)));break}if(t.type===7||e.type===7){if(t.type!==7||e.type!==0){n.push(chunkSQHBOWES_cjs.P("MATRIX_POWER_UNSUPPORTED",`^: a matrix may only be the base, raised to a whole number (as in "[1,2;3,4]^2"); "${chunkSQHBOWES_cjs.g[t.type]} ^ ${chunkSQHBOWES_cjs.g[e.type]}" has no matrix reading.`));break}chunkSQHBOWES_cjs.d(ln(t.value,e.value),"matrix cells"),n.push(chunkWGP4UUO5_cjs.$(t.value,e.value));break}if(t.type===9||e.type===9){n.push(chunk634ILVMP_cjs.f(t,e));break}if(t.type===2||e.type===2){let o=xn(t,e.toNumber());if(o!==null){if(o>Se)throw chunkYBQPEWT7_cjs.c.execution("BIGINT_POW_LIMIT_EXCEEDED",`That power would build an exact integer of about ${Math.round(o).toLocaleString("en-US")} bits, past the limit of ${Se.toLocaleString("en-US")} bits`,{limitBits:Se});n.push(chunkSQHBOWES_cjs.s(En(chunk634ILVMP_cjs.n(t),chunk634ILVMP_cjs.n(e))));break}}n.push(chunkSQHBOWES_cjs.n(chunk634ILVMP_cjs.q(t.toNumber(),e.toNumber())));break}case 26:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}e.type===2?n.push(chunkSQHBOWES_cjs.s(-e.value)):e.type===6&&e.exact!==void 0?n.push(chunkSQHBOWES_cjs.v(-e.toNumber(),e.unit,chunkWGP4UUO5_cjs.ma(e.exact))):e.type===6?n.push(chunkSQHBOWES_cjs.u(-e.toNumber(),e.unit)):e.type===5?n.push(chunkSQHBOWES_cjs.N(-e.toNumber())):e.type===9?n.push(chunk634ILVMP_cjs.g(e)):e.type===0&&e.rational!==void 0?n.push(chunkSQHBOWES_cjs.p(-e.toNumber(),chunkWGP4UUO5_cjs.j(e.rational))):e.type===0&&e.exact!==void 0?n.push(chunkSQHBOWES_cjs.o(-e.toNumber(),chunkWGP4UUO5_cjs.ma(e.exact))):n.push(chunkSQHBOWES_cjs.n(-e.toNumber()));break}case 27:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}e.type===6&&e.exact!==void 0?n.push(chunkSQHBOWES_cjs.v(e.toNumber(),e.unit,e.exact)):e.type===6?n.push(chunkSQHBOWES_cjs.u(e.toNumber(),e.unit)):e.type===5?n.push(chunkSQHBOWES_cjs.N(e.toNumber())):e.type===0&&e.rational!==void 0?n.push(chunkSQHBOWES_cjs.p(e.toNumber(),e.rational)):e.type===0&&e.exact!==void 0?n.push(chunkSQHBOWES_cjs.o(e.toNumber(),e.exact)):n.push(chunkSQHBOWES_cjs.n(e.toNumber()));break}case 28:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}n.push(chunkSQHBOWES_cjs.q(t.toNumber(),Math.abs(e.toNumber())));break}case 30:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}t.type===2||e.type===2?n.push(Qt(t,e,1)):n.push(chunkSQHBOWES_cjs.n(t.toNumber()<<e.toNumber()));break}case 31:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}t.type===2||e.type===2?n.push(Qt(t,e,-1)):n.push(chunkSQHBOWES_cjs.n(t.toNumber()>>e.toNumber()));break}case 32:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}n.push(chunkSQHBOWES_cjs.n(t.toNumber()>>>e.toNumber()));break}case 33:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}t.type===2||e.type===2?n.push(chunkSQHBOWES_cjs.s(chunk634ILVMP_cjs.n(t)&chunk634ILVMP_cjs.n(e))):n.push(chunkSQHBOWES_cjs.n(t.toNumber()&e.toNumber()));break}case 34:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}t.type===2||e.type===2?n.push(chunkSQHBOWES_cjs.s(chunk634ILVMP_cjs.n(t)|chunk634ILVMP_cjs.n(e))):n.push(chunkSQHBOWES_cjs.n(t.toNumber()|e.toNumber()));break}case 35:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}t.type===2||e.type===2?n.push(chunkSQHBOWES_cjs.s(chunk634ILVMP_cjs.n(t)^chunk634ILVMP_cjs.n(e))):n.push(chunkSQHBOWES_cjs.n(t.toNumber()^e.toNumber()));break}case 36:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}e.type===2?n.push(chunkSQHBOWES_cjs.s(~e.value)):n.push(chunkSQHBOWES_cjs.n(~e.toNumber()));break}case 40:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.rational!==void 0||e.rational!==void 0){let i=chunk634ILVMP_cjs.t(t,e);if(i!==null){n.push(chunkSQHBOWES_cjs.L(i===0));break}}if(t.type===0&&e.type===0)n.push(chunkSQHBOWES_cjs.L(t.value===e.value));else if(t.type===2||e.type===2){let i=chunk634ILVMP_cjs.p(t,e);n.push(chunkSQHBOWES_cjs.L(i===null?t.toNumber()===e.toNumber():i===0));}else if(t.type===3&&e.type===3)n.push(chunkSQHBOWES_cjs.L(t.value===e.value));else if(t.type===6&&e.type===6){let{equal:i,sameMeasure:l}=chunk634ILVMP_cjs.k(t,e);n.push(chunkSQHBOWES_cjs.L(l&&i));}else if(t.type===7&&e.type===7)n.push(chunkWGP4UUO5_cjs.aa(t.value,e.value,(i,l)=>i===l));else if(t.type===14||e.type===14)if(t.type===14&&e.type===14){let i=t.value,l=e.value;n.push(chunkSQHBOWES_cjs.L(i.r===l.r&&i.g===l.g&&i.b===l.b&&i.a===l.a));}else n.push(chunkSQHBOWES_cjs.L(!1));else n.push(chunkSQHBOWES_cjs.L(t.toNumber()===e.toNumber()));break}case 41:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.rational!==void 0||e.rational!==void 0){let i=chunk634ILVMP_cjs.t(t,e);if(i!==null){n.push(chunkSQHBOWES_cjs.L(i!==0));break}}if(t.type===0&&e.type===0)n.push(chunkSQHBOWES_cjs.L(t.value!==e.value));else if(t.type===2||e.type===2){let i=chunk634ILVMP_cjs.p(t,e);n.push(chunkSQHBOWES_cjs.L(i===null?t.toNumber()!==e.toNumber():i!==0));}else if(t.type===3&&e.type===3)n.push(chunkSQHBOWES_cjs.L(t.value!==e.value));else if(t.type===6&&e.type===6){let{equal:i,sameMeasure:l}=chunk634ILVMP_cjs.k(t,e);n.push(chunkSQHBOWES_cjs.L(!l||!i));}else if(t.type===7&&e.type===7)n.push(chunkWGP4UUO5_cjs.aa(t.value,e.value,(i,l)=>i!==l));else if(t.type===14||e.type===14)if(t.type===14&&e.type===14){let i=t.value,l=e.value;n.push(chunkSQHBOWES_cjs.L(!(i.r===l.r&&i.g===l.g&&i.b===l.b&&i.a===l.a)));}else n.push(chunkSQHBOWES_cjs.L(!0));else n.push(chunkSQHBOWES_cjs.L(t.toNumber()!==e.toNumber()));break}case 42:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.rational!==void 0||e.rational!==void 0){let i=chunk634ILVMP_cjs.t(t,e);if(i!==null){n.push(chunkSQHBOWES_cjs.L(i<0));break}}if(t.type===0&&e.type===0)n.push(chunkSQHBOWES_cjs.L(t.value<e.value));else if(t.type===2||e.type===2){let i=chunk634ILVMP_cjs.p(t,e);n.push(chunkSQHBOWES_cjs.L(i===null?t.toNumber()<e.toNumber():i<0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:b}=chunk634ILVMP_cjs.k(t,e);n.push(b?chunkSQHBOWES_cjs.L(!p&&i<l):chunk634ILVMP_cjs.m(t,e));}else t.type===7&&e.type===7?n.push(chunkWGP4UUO5_cjs.aa(t.value,e.value,(i,l)=>i<l)):n.push(chunkSQHBOWES_cjs.L(t.toNumber()<e.toNumber()));break}case 43:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.rational!==void 0||e.rational!==void 0){let i=chunk634ILVMP_cjs.t(t,e);if(i!==null){n.push(chunkSQHBOWES_cjs.L(i<=0));break}}if(t.type===0&&e.type===0)n.push(chunkSQHBOWES_cjs.L(t.value<=e.value));else if(t.type===2||e.type===2){let i=chunk634ILVMP_cjs.p(t,e);n.push(chunkSQHBOWES_cjs.L(i===null?t.toNumber()<=e.toNumber():i<=0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:b}=chunk634ILVMP_cjs.k(t,e);n.push(b?chunkSQHBOWES_cjs.L(p||i<=l):chunk634ILVMP_cjs.m(t,e));}else t.type===7&&e.type===7?n.push(chunkWGP4UUO5_cjs.aa(t.value,e.value,(i,l)=>i<=l)):n.push(chunkSQHBOWES_cjs.L(t.toNumber()<=e.toNumber()));break}case 44:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.rational!==void 0||e.rational!==void 0){let i=chunk634ILVMP_cjs.t(t,e);if(i!==null){n.push(chunkSQHBOWES_cjs.L(i>0));break}}if(t.type===0&&e.type===0)n.push(chunkSQHBOWES_cjs.L(t.value>e.value));else if(t.type===2||e.type===2){let i=chunk634ILVMP_cjs.p(t,e);n.push(chunkSQHBOWES_cjs.L(i===null?t.toNumber()>e.toNumber():i>0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:b}=chunk634ILVMP_cjs.k(t,e);n.push(b?chunkSQHBOWES_cjs.L(!p&&i>l):chunk634ILVMP_cjs.m(t,e));}else t.type===7&&e.type===7?n.push(chunkWGP4UUO5_cjs.aa(t.value,e.value,(i,l)=>i>l)):n.push(chunkSQHBOWES_cjs.L(t.toNumber()>e.toNumber()));break}case 45:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.rational!==void 0||e.rational!==void 0){let i=chunk634ILVMP_cjs.t(t,e);if(i!==null){n.push(chunkSQHBOWES_cjs.L(i>=0));break}}if(t.type===0&&e.type===0)n.push(chunkSQHBOWES_cjs.L(t.value>=e.value));else if(t.type===2||e.type===2){let i=chunk634ILVMP_cjs.p(t,e);n.push(chunkSQHBOWES_cjs.L(i===null?t.toNumber()>=e.toNumber():i>=0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:b}=chunk634ILVMP_cjs.k(t,e);n.push(b?chunkSQHBOWES_cjs.L(p||i>=l):chunk634ILVMP_cjs.m(t,e));}else t.type===7&&e.type===7?n.push(chunkWGP4UUO5_cjs.aa(t.value,e.value,(i,l)=>i>=l)):n.push(chunkSQHBOWES_cjs.L(t.toNumber()>=e.toNumber()));break}case 130:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}n.push(chunkSQHBOWES_cjs.L(ge(t)&&ge(e)));break}case 131:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}n.push(chunkSQHBOWES_cjs.L(ge(t)||ge(e)));break}case 132:{let e=c(n),t=c(n),o=c(n),i=chunkSQHBOWES_cjs.Q(o);if(i){n.push(i);break}n.push(ge(o)?t:e);break}case 50:case 161:{let e;if(d===161){let p=U(f,E++,d,"plugin-function index (low byte)"),b=U(f,E++,d,"plugin-function index (high byte)");e=p|b<<8;}else e=U(f,E++,d,"plugin-function index");let t=U(f,E++,d,"argument count"),o=[];for(let p=0;p<t;p++)o.push(c(n));o.reverse();let i=a.context.pluginFunctions[e],l=chunkSQHBOWES_cjs.R(o);if(l)n.push(l);else if(!i)n.push(chunkSQHBOWES_cjs.P("UNKNOWN_PLUGIN_FUNCTION",`Plugin function index ${e} is not registered with this engine`));else {let p=i(o,m);if(p instanceof Promise){if(!a.context.networkEnabled){p.catch(()=>{}),n.push(chunkSQHBOWES_cjs.P("NETWORK_DISABLED","Live data is switched off for this engine (network.enabled is false), so the result of this call was not awaited"));break}let b=`plugin:${e}:${o.map(R=>`${R.type}:${String(R.value??"")}${R.unit?`:${R.unit}`:""}`).join("|")}`,I=a.activeSignal,C=a.context.pluginFunctionOwners[e]??"";return {type:"pending",queryKey:b,resolver:p,packageId:C,signal:I}}n.push(p);}break}case 51:{let e=U(f,E++,d,"builtin-function index"),t=U(f,E++,d,"argument count"),o=$t(e,t);if(o)throw o;let i=[],l=!1;for(let I=0;I<t;I++){let C=c(n);C.type===9&&(l=!0),i.push(C);}let p=chunkSQHBOWES_cjs.R(i);if(p){n.push(p);break}let b=chunk634ILVMP_cjs.C[e];if(b){let I=i.reverse(),C=l&&!chunk634ILVMP_cjs.e.has(e);n.push(C?chunk634ILVMP_cjs.h(e,I):b(I));}else n.push(chunkSQHBOWES_cjs.P("UNKNOWN_BUILTIN_FUNCTION",`Builtin function index ${e} is not registered`));break}case 150:{let e=U(f,E++,d,"function-body index"),t=S?.[e];if(!t)throw chunkYBQPEWT7_cjs.c.internal("INTERNAL_MISSING_FUNCTION_BODY",`Internal error: DEFINE_USER_FUNCTION referenced missing body index ${e}`,{bodyIdx:e});a.defineUserFunction(t.name,t.params,t.program);break}case 151:{let e=J(f,E++,x,d,"function-name index"),t=U(f,E++,d,"argument count"),o=[];for(let b=0;b<t;b++)o.push(c(n));o.reverse();let i=a.getUserFunction(e);if(!i)throw chunkYBQPEWT7_cjs.c.execution("UNDEFINED_FUNCTION",`Undefined function: ${e}`,{name:e});if(t!==i.params.length)throw chunkYBQPEWT7_cjs.c.execution("FUNCTION_ARITY_MISMATCH",`${e} expects ${i.params.length} argument(s) but got ${t}`,{name:e,expected:i.params.length,actual:t});let l=new Map;for(let b=0;b<i.params.length;b++)l.set(i.params[b],o[b]);chunkSQHBOWES_cjs.f(),a.pushCallFrame(l);let p;try{p=tt(i.program,a,s,u,m);}finally{a.popCallFrame();}if(p.type==="pending")throw chunkYBQPEWT7_cjs.c.execution("USER_FUNCTION_ASYNC_UNSUPPORTED",`${e}: user-defined functions with async bodies (weather, stocks, currency, ...) aren't supported`,{name:e});if(p.type==="error")throw p.error;n.push(p.value);break}case 60:{let e=J(f,E++,x,d,"variable-name index"),t=a.getVar(e);if(t!==void 0)n.push(t);else if(g)n.push(chunkSQHBOWES_cjs.K(chunkWGP4UUO5_cjs.q(e)));else throw chunkYBQPEWT7_cjs.c.execution("UNDEFINED_VARIABLE",`Undefined variable: ${e}`,{varName:e});break}case 61:{let e=c(n),t=J(f,E++,x,d,"variable-name index");a.setVar(t,X?chunkSQHBOWES_cjs.k(e):e),n.push(e);break}case 62:{let e=J(f,E++,x,d,"variable-name index"),t=chunk634ILVMP_cjs.J.get(e);if(t===void 0)throw chunkYBQPEWT7_cjs.c.internal({code:"GLOBAL_VARIABLE_NOT_RESOLVED",message:`Global variable "${e}" was read before it resolved`,expected:`global variable "${e}" to already be resolved (async preflight should guarantee this)`,found:"no value in the global variable store",context:{varName:e}});n.push(t);break}case 63:{let e=c(n),t=J(f,E++,x,d,"variable-name index");chunk634ILVMP_cjs.J.set(t,X?chunkSQHBOWES_cjs.k(e):e),n.push(e);break}case 70:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.n(e.toNumber()));break}case 71:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}if(e.type===14){let o=e.value;n.push(chunkSQHBOWES_cjs.G({r:o.r,g:o.g,b:o.b,a:o.a,format:"hex"}));break}n.push(chunkSQHBOWES_cjs.r(e.type===2?e.value:e.toNumber()));break}case 74:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.N(e.toNumber()));break}case 140:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.t(e.rational!==void 0?Dn(e.rational):In(e.toNumber())));break}case 141:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.t(Mn(e)));break}case 142:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.t(_n(e.toNumber())));break}case 143:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.r(e.type===2?e.value:e.toNumber(),"bin"));break}case 144:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.r(e.type===2?e.value:e.toNumber(),"oct"));break}case 145:{let e=q(c(n),d,"converter name").toLowerCase(),t=c(n),o=chunkSQHBOWES_cjs.Q(t);if(o){n.push(o);break}let i=chunk634ILVMP_cjs.G.get(e);i?n.push(i(t)):n.push(chunkSQHBOWES_cjs.P("UNKNOWN_AS_CONVERTER",`Unknown converter "as ${e}"`));break}case 80:{let e=q(c(n),d,"unit name"),t=c(n),o=chunkSQHBOWES_cjs.Q(t);if(o){n.push(o);break}let i=chunk634ILVMP_cjs.a(t,e);i?n.push(chunkSQHBOWES_cjs.v(t.toNumber(),e,i)):n.push(chunkSQHBOWES_cjs.u(t.toNumber(),e));break}case 81:{let e=q(c(n),d,"target unit name"),t=q(c(n),d,"source unit name"),o=c(n),i=chunkSQHBOWES_cjs.Q(o);if(i){n.push(i);break}let l=o.toNumber(),p=chunkZKFCKAIX_cjs.c(t),b=chunkFYAMQFZZ_cjs.c.isCurrency(t)&&chunkFYAMQFZZ_cjs.c.isCurrency(e);if(p&&chunkZKFCKAIX_cjs.c(e)===p)n.push(chunkSQHBOWES_cjs.u(chunkZKFCKAIX_cjs.e(l,t,e),e));else if(b){let I=chunkFYAMQFZZ_cjs.c.convertSync(l,t,e);I!==null?n.push(chunkSQHBOWES_cjs.u(I,e)):n.push(Pt(a,t,e));}else {let I=chunkZKFCKAIX_cjs.k(l,t,e);I!==null?n.push(chunkSQHBOWES_cjs.u(I,e)):n.push(zt(t,e));}break}case 85:{let e=q(c(n),d,"unit name"),t=chunkZKFCKAIX_cjs.f(e);n.push(chunkSQHBOWES_cjs.t(t.length>0?t.join(", "):`No known units for "${e}"`));break}case 83:{let e=q(c(n),d,"unit name"),t=c(n),o=chunkSQHBOWES_cjs.Q(t);if(o){n.push(o);break}let{value:i,unit:l}=chunkZKFCKAIX_cjs.h(t.toNumber(),e);n.push(chunkSQHBOWES_cjs.u(i,l));break}case 84:{let e=q(c(n),d,"target unit name"),t=c(n),o=chunkSQHBOWES_cjs.Q(t);if(o){n.push(o);break}if(t.type===6){let i=t.unit,l=t.toNumber(),p=chunkZKFCKAIX_cjs.c(i),b=chunkFYAMQFZZ_cjs.c.isCurrency(i)&&chunkFYAMQFZZ_cjs.c.isCurrency(e);if(p&&chunkZKFCKAIX_cjs.c(e)===p)n.push(chunkSQHBOWES_cjs.u(chunkZKFCKAIX_cjs.e(l,i,e),e));else if(b){let I=chunkFYAMQFZZ_cjs.c.convertSync(l,i,e);I!==null?n.push(chunkSQHBOWES_cjs.u(I,e)):n.push(Pt(a,i,e));}else {let I=chunkZKFCKAIX_cjs.k(l,i,e);I!==null?n.push(chunkSQHBOWES_cjs.u(I,e)):n.push(zt(i,e));}}else n.push(chunkSQHBOWES_cjs.u(t.toNumber(),e));break}case 82:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}n.push(chunkSQHBOWES_cjs.n(e.toNumber()));break}case 110:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(e.type!==6||!e.unit){n.push(chunkSQHBOWES_cjs.P("RATE_MISSING_DENOMINATOR_UNIT",'Cannot build a rate: the right-hand side of "/" has no unit'));break}let i=t.type===6?t.unit??"":"";n.push(chunkSQHBOWES_cjs.w(t.toNumber()/e.toNumber(),i,e.unit));break}case 111:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.type!==6||!chunkSQHBOWES_cjs.x(t.unit)){n.push(chunkSQHBOWES_cjs.P("RATE_MUL_LEFT_NOT_A_RATE",'Left-hand side of a rate multiplication must be a rate (e.g. "$50/week")'));break}if(e.type!==6||!e.unit){n.push(chunkSQHBOWES_cjs.P("RATE_MUL_RIGHT_MISSING_UNIT","Right-hand side of a rate multiplication must have a unit matching the rate's denominator"));break}n.push(et(t,e));break}case 112:{let e=q(c(n),d,"denominator unit name"),t=c(n),o=chunkSQHBOWES_cjs.Q(t);if(o){n.push(o);break}if(t.type!==6||!chunkSQHBOWES_cjs.x(t.unit)){n.push(chunkSQHBOWES_cjs.P("RATE_CONVERT_NOT_A_RATE","Cannot convert a non-rate value's denominator"));break}let{numerator:i,denominator:l}=chunkSQHBOWES_cjs.y(t.unit),p=chunkZKFCKAIX_cjs.c(l),b=chunkZKFCKAIX_cjs.c(e);if(!p||p!==b){n.push(chunkSQHBOWES_cjs.P("RATE_CONVERT_MEASURE_MISMATCH",`Cannot convert a "${l}"-denominated rate to "${e}" \u2014 different measures`));break}let I=chunkZKFCKAIX_cjs.e(1,e,l);n.push(chunkSQHBOWES_cjs.w(t.toNumber()*I,i,e));break}case 120:{let e=c(n),t=chunkSQHBOWES_cjs.Q(e);if(t){n.push(t);break}let o=e.toNumber(),i=new Date,l=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0,0);l.setMinutes(o),n.push(chunkSQHBOWES_cjs.M(l.getTime()));break}case 90:n.push(chunkSQHBOWES_cjs.M(Date.now()));break;case 95:n.push(chunkSQHBOWES_cjs.M(y[Je(f,E++,d,"constant-pool index",y.length,"number-pool")]));break;case 91:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}n.push(chunkSQHBOWES_cjs.M(he(t.toNumber(),e,1,a)));break}case 92:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}n.push(chunkSQHBOWES_cjs.M(he(t.toNumber(),e,-1,a)));break}case 96:{let e=U(f,E++,d,"workday offset direction")===1?-1:1,t=c(n),o=c(n),i=chunkSQHBOWES_cjs.Q(o,t);if(i){n.push(i);break}if(t.type!==4){n.push(chunkSQHBOWES_cjs.P(chunkYBQPEWT7_cjs.r.WORKDAY_OFFSET_EXPECTED_DATE,`"working days after/before/from" expects a date to count from, got ${chunkSQHBOWES_cjs.g[t.type]??"an unsupported value"}`));break}n.push(chunkSQHBOWES_cjs.M(en(t.toNumber(),e*o.toNumber(),a)));break}case 97:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.type!==4||e.type!==4){n.push(chunkSQHBOWES_cjs.P(chunkYBQPEWT7_cjs.r.WORKDAYS_BETWEEN_EXPECTED_DATES,`"working days between" expects two dates, got ${chunkSQHBOWES_cjs.g[t.type]??"an unsupported value"} and ${chunkSQHBOWES_cjs.g[e.type]??"an unsupported value"}`));break}let i=Math.ceil((a.getMaxDateOffsetYears()-a.getMinDateOffsetYears())*366),l=Ft(t.toNumber(),e.toNumber(),p=>a.isHoliday(p),i);if(l===null){n.push(chunkSQHBOWES_cjs.P(chunkYBQPEWT7_cjs.r.WORKDAYS_BETWEEN_RANGE_TOO_LARGE,`The two dates are more than ${a.getMaxDateOffsetYears()-a.getMinDateOffsetYears()} years apart, past the working-day count's limit`));break}n.push(chunkSQHBOWES_cjs.n(l));break}case 93:case 94:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}let i=e.toNumber(),l=t.toNumber(),p=new Date(l).getDay(),b=d===93?(i-p+7)%7:(p-i+7)%7;b===0&&(b=7),n.push(chunkSQHBOWES_cjs.M(tn(l,d===93?b:-b)));break}case 152:{let e=U(f,E++,d,"row count"),t=U(f,E++,d,"column count"),o=e*t,i=chunkSQHBOWES_cjs.e(o,"matrix cells"),l=null;for(let p=o-1;p>=0;p--){let b=c(n);l===null&&(l=chunkSQHBOWES_cjs.Q(b)),i[p]=b.type===10||b.type===9?b.value:b.toNumber();}if(l){n.push(l);break}n.push(chunkSQHBOWES_cjs.C(e,t,chunkWGP4UUO5_cjs.Y(e,t,i)));break}case 153:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.type!==7){n.push(chunkSQHBOWES_cjs.P("MATRIX_INDEX_NOT_A_MATRIX",'Cannot index a non-matrix value with "[...]".'));break}let i=t.value,l=Math.trunc(e.toNumber());if(l<0||l>=i.data.length){n.push(chunkSQHBOWES_cjs.P("MATRIX_INDEX_OUT_OF_BOUNDS",`Index ${l} is out of bounds for a ${i.rows}x${i.cols} matrix (valid range: 0-${i.data.length-1}).`));break}let p=chunkWGP4UUO5_cjs.S(i,l);n.push(chunkWGP4UUO5_cjs.X(p));break}case 154:{let e=c(n),t=c(n),o=c(n),i=chunkSQHBOWES_cjs.Q(o,t,e);if(i){n.push(i);break}if(o.type!==7){n.push(chunkSQHBOWES_cjs.P("MATRIX_INDEX_NOT_A_MATRIX",'Cannot index a non-matrix value with "[...]".'));break}let l=o.value,p=Math.trunc(t.toNumber()),b=Math.trunc(e.toNumber());if(!chunkWGP4UUO5_cjs.U(l,p,b)){n.push(chunkSQHBOWES_cjs.P("MATRIX_INDEX_OUT_OF_BOUNDS",`[${p}, ${b}] is out of bounds for a ${l.rows}x${l.cols} matrix.`));break}let I=chunkWGP4UUO5_cjs.T(l,p,b);n.push(chunkWGP4UUO5_cjs.X(I));break}case 156:{let e=c(n),t=c(n),o=chunkSQHBOWES_cjs.Q(t,e);if(o){n.push(o);break}if(t.type!==0||e.type!==0){n.push(chunkSQHBOWES_cjs.P("INVALID_RANGE_BOUND",`A range's bounds must be plain numbers (e.g. "0:3").`));break}let i=t.value,l=e.value;if(!Number.isInteger(i)||!Number.isInteger(l)){n.push(chunkSQHBOWES_cjs.P("NON_INTEGER_RANGE_BOUND",`A range's bounds must be whole numbers, got "${i}:${l}".`));break}if(i>l){n.push(chunkSQHBOWES_cjs.P("DESCENDING_RANGE",`A range's min (${i}) cannot be greater than its max (${l}) \u2014 did you mean "${l}:${i}"?`));break}n.push(chunkSQHBOWES_cjs.F(i,l));break}case 155:{let e=c(n),t=c(n),o=c(n),i=chunkSQHBOWES_cjs.Q(o,t,e);if(i){n.push(i);break}if(o.type!==7){n.push(chunkSQHBOWES_cjs.P("MATRIX_INDEX_NOT_A_MATRIX",'Cannot slice a non-matrix value with "[...]".'));break}if(t.type!==8||e.type!==8){n.push(chunkSQHBOWES_cjs.P("INVALID_MATRIX_SLICE_BOUND",'Matrix slicing needs range bounds (e.g. "a[0:1, 1:2]").'));break}let l=o.value,p=t.value,b=e.value;if(p.min<0||p.max>=l.rows||b.min<0||b.max>=l.cols){n.push(chunkSQHBOWES_cjs.P("MATRIX_INDEX_OUT_OF_BOUNDS",`Slice [${p.min}:${p.max}, ${b.min}:${b.max}] is out of bounds for a ${l.rows}x${l.cols} matrix.`));break}let I=p.max-p.min+1,C=b.max-b.min+1,R=chunkSQHBOWES_cjs.e(I*C,"matrix cells");for(let B=0;B<I;B++)for(let _=0;_<C;_++)R[B+_*I]=chunkWGP4UUO5_cjs.T(l,p.min+B,b.min+_);n.push(chunkSQHBOWES_cjs.C(I,C,R));break}case 157:{let e=U(f,E++,d,"body kind"),t=U(f,E++,d,"body reference"),o=U(f,E++,d,"collection count");Yt(e,t,d);let i=new Array(o);for(let k=o-1;k>=0;k--)i[k]=c(n);let l=[],p;if(e===0){let k=O?.[t];if(!k)throw chunkYBQPEWT7_cjs.c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: MAP_INVOKE referenced missing anonymous body index ${t}`,{ref:t});l=k.params,p=k.program;}else if(e===2){let k=Te(x,t,d),v=a.getUserFunction(k);if(!v){n.push(chunkSQHBOWES_cjs.P("UNDEFINED_FUNCTION",`map: undefined function "${k}"`));break}if(v.params.length!==o){n.push(chunkSQHBOWES_cjs.P("FUNCTION_ARITY_MISMATCH",`map: "${k}" expects ${v.params.length} argument(s) but ${o} collection(s) were given`));break}l=v.params,p=v.program;}let b=-1,I=new Array(o),C;for(let k=0;k<o;k++){let v=chunkWGP4UUO5_cjs.ea(i[k],a.getMaxCollectionSize());if(!Array.isArray(v)){C=v;break}if(chunkSQHBOWES_cjs.c(v.length,"collection elements"),b===-1)b=v.length;else if(v.length!==b){C=chunkSQHBOWES_cjs.P("MAP_COLLECTION_LENGTH_MISMATCH",`map: all collections must have the same length (got ${b} and ${v.length}).`);break}I[k]=v;}if(C){n.push(C);break}let R=chunkSQHBOWES_cjs.e(b,"matrix cells"),B;for(let k=0;k<b;k++){let v=new Array(o);for(let ye=0;ye<o;ye++)v[ye]=I[ye][k];let re=e===1?chunk634ILVMP_cjs.C[t]?.(v)??chunkSQHBOWES_cjs.P("UNKNOWN_BUILTIN_FUNCTION",`map: unknown builtin function index ${t}`):Qe(l,p,v,a,s,u,m,!!g),nt=chunkSQHBOWES_cjs.Q(re);if(nt){B=nt;break}R[k]=re.type===10||re.type===9?re.value:re.toNumber();}if(B){n.push(B);break}let _=i[0],V=_?.type===7?_.value:void 0;V&&V.rows*V.cols===b?n.push(chunkSQHBOWES_cjs.C(V.rows,V.cols,R)):n.push(chunkSQHBOWES_cjs.C(1,b,R));break}case 160:{let e=U(f,E++,d,"plot body reference"),t=U(f,E++,d,"plot expression"),o=Te(x,t,d),i=c(n).toNumber(),l=c(n).toNumber(),p=O?.[e];if(!p)throw chunkYBQPEWT7_cjs.c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: PLOT_INVOKE referenced missing anonymous body index ${e}`,{ref:e});if(!Number.isFinite(l)||!Number.isFinite(i)){n.push(chunkSQHBOWES_cjs.P("PLOT_INVALID_RANGE",`plot: the range bounds must be finite numbers (got ${l} to ${i})`));break}let b=[];for(let _=0;_<Wt;_++){let V=l+_/(Wt-1)*(i-l),k;try{k=Qe(p.params,p.program,[chunkSQHBOWES_cjs.n(V)],a,s,u,m,!!g).toNumber();}catch{continue}Number.isFinite(k)&&b.push([V,k]);}let I=b.map(_=>_[1]),C=I.length?Math.min(...I):0,R=I.length?Math.max(...I):0,B=_=>Number.isInteger(_)?String(_):String(Number(_.toFixed(2)));n.push(chunkSQHBOWES_cjs.I({kind:"plot",points:b,label:`${o} over [${B(l)}, ${B(i)}]`,domain:[l,i],range:[C,R],expr:o}));break}case 158:{let e=U(f,E++,d,"body kind"),t=U(f,E++,d,"body reference"),o=U(f,E++,d,"initial-value flag");Yt(e,t,d);let i=o?c(n):void 0,l=c(n),p=[],b;if(e===0){let _=O?.[t];if(!_)throw chunkYBQPEWT7_cjs.c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: REDUCE_INVOKE referenced missing anonymous body index ${t}`,{ref:t});p=_.params,b=_.program;}else if(e===2){let _=Te(x,t,d),V=a.getUserFunction(_);if(!V){n.push(chunkSQHBOWES_cjs.P("UNDEFINED_FUNCTION",`reduce: undefined function "${_}"`));break}if(V.params.length!==2){n.push(chunkSQHBOWES_cjs.P("FUNCTION_ARITY_MISMATCH",`reduce: "${_}" must take exactly 2 arguments (accumulator, element), got ${V.params.length}`));break}p=V.params,b=V.program;}let I=chunkWGP4UUO5_cjs.ea(l,a.getMaxCollectionSize());if(!Array.isArray(I)){n.push(I);break}chunkSQHBOWES_cjs.c(I.length,"collection elements");let C,R;if(i!==void 0){let _=chunkSQHBOWES_cjs.Q(i);if(_){n.push(_);break}C=i,R=0;}else {if(I.length===0){n.push(chunkSQHBOWES_cjs.P("REDUCE_EMPTY_COLLECTION","reduce: cannot reduce an empty collection without an initial value."));break}C=I[0],R=1;}let B;for(let _=R;_<I.length;_++){let V=[C,I[_]],k=e===1?chunk634ILVMP_cjs.C[t]?.(V)??chunkSQHBOWES_cjs.P("UNKNOWN_BUILTIN_FUNCTION",`reduce: unknown builtin function index ${t}`):Qe(p,b,V,a,s,u,m,!!g),v=chunkSQHBOWES_cjs.Q(k);if(v){B=v;break}C=k;}if(B){n.push(B);break}n.push(C);break}case 159:{let e=U(f,E++,d,"body reference"),t=O?.[e];if(!t)throw chunkYBQPEWT7_cjs.c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: BIND_UNKNOWN referenced missing anonymous body index ${e}`,{ref:e});n.push(dn(t.params[0],t.program,a,s,u,m,!!g));break}}}let K=c(n);return {type:"value",value:X?chunkSQHBOWES_cjs.k(K):K}}catch(K){return {type:"error",error:chunkYBQPEWT7_cjs.d(K)}}finally{chunkSQHBOWES_cjs.b();}}exports.a=vt;exports.b=Rt;exports.c=ia;exports.d=tt;//# sourceMappingURL=chunk-JSM3O7EM.cjs.map
2
- //# sourceMappingURL=chunk-JSM3O7EM.cjs.map