solve-engine 2.6.0 → 2.8.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 (177) hide show
  1. package/dist/{PackageCompatibility-CCdud__Q.d.cts → PackageCompatibility-BG0iur4I.d.cts} +1 -1
  2. package/dist/{PackageCompatibility-4QtIErfx.d.ts → PackageCompatibility-BlIcQg5v.d.ts} +1 -1
  3. package/dist/{PackageRegistry-B7wkfSrY.d.ts → PackageRegistry-BJ0QQd3k.d.ts} +4 -4
  4. package/dist/{PackageRegistry-Hx85XD01.d.cts → PackageRegistry-DeGDZkNt.d.cts} +4 -4
  5. package/dist/{Parselet-CTNpfuEB.d.cts → Parselet-BSndkWEY.d.cts} +1 -1
  6. package/dist/{Parselet-DONNUpur.d.ts → Parselet-Blq8B0Gj.d.ts} +1 -1
  7. package/dist/{ScopeManager-BkbDXK_R.d.ts → ScopeManager-CF3cZUqW.d.ts} +2 -2
  8. package/dist/{ScopeManager-Cvgypcu4.d.cts → ScopeManager-D8nLv--u.d.cts} +2 -2
  9. package/dist/{VMCheckpoints-9zBQnTsN.d.ts → VMCheckpoints-BsR5_auF.d.ts} +2 -2
  10. package/dist/{VMCheckpoints-CBMGiSqw.d.cts → VMCheckpoints-Dy39SVHa.d.cts} +2 -2
  11. package/dist/{Value-D1XlMwe2.d.cts → Value-DCTqTSeP.d.cts} +22 -5
  12. package/dist/{Value-D1XlMwe2.d.ts → Value-DCTqTSeP.d.ts} +22 -5
  13. package/dist/{chunk-T52Y5G24.js → chunk-2V44X7GH.js} +4 -4
  14. package/dist/{chunk-T52Y5G24.js.map → chunk-2V44X7GH.js.map} +1 -1
  15. package/dist/{chunk-5FO4PDIG.js → chunk-3GAWAMT4.js} +2 -2
  16. package/dist/{chunk-5FO4PDIG.js.map → chunk-3GAWAMT4.js.map} +1 -1
  17. package/dist/{chunk-32GC2FHC.cjs → chunk-3HYO3QYW.cjs} +2 -2
  18. package/dist/{chunk-32GC2FHC.cjs.map → chunk-3HYO3QYW.cjs.map} +1 -1
  19. package/dist/{chunk-2JMFUQZH.js → chunk-44EOEWGP.js} +2 -2
  20. package/dist/chunk-44EOEWGP.js.map +1 -0
  21. package/dist/chunk-5TCSFTZD.js +2 -0
  22. package/dist/chunk-5TCSFTZD.js.map +1 -0
  23. package/dist/chunk-5TVI2UPZ.cjs +2 -0
  24. package/dist/chunk-5TVI2UPZ.cjs.map +1 -0
  25. package/dist/{chunk-CIQOK7Q4.cjs → chunk-6QRHN3I6.cjs} +2 -2
  26. package/dist/chunk-6QRHN3I6.cjs.map +1 -0
  27. package/dist/chunk-6TPXH6Y5.cjs +3 -0
  28. package/dist/chunk-6TPXH6Y5.cjs.map +1 -0
  29. package/dist/{chunk-ZOOVGXMK.cjs → chunk-75XDS65A.cjs} +2 -2
  30. package/dist/{chunk-ZOOVGXMK.cjs.map → chunk-75XDS65A.cjs.map} +1 -1
  31. package/dist/chunk-A33K7NY4.js +2 -0
  32. package/dist/chunk-A33K7NY4.js.map +1 -0
  33. package/dist/chunk-BKSKZA4W.cjs +2 -0
  34. package/dist/chunk-BKSKZA4W.cjs.map +1 -0
  35. package/dist/{chunk-VAGS5JS7.cjs → chunk-C65UDMWH.cjs} +2 -2
  36. package/dist/{chunk-VAGS5JS7.cjs.map → chunk-C65UDMWH.cjs.map} +1 -1
  37. package/dist/{chunk-OVQ3V4CG.cjs → chunk-CIENDLKV.cjs} +2 -2
  38. package/dist/{chunk-OVQ3V4CG.cjs.map → chunk-CIENDLKV.cjs.map} +1 -1
  39. package/dist/chunk-DLAKPF5T.js +2 -0
  40. package/dist/chunk-DLAKPF5T.js.map +1 -0
  41. package/dist/chunk-EOMHELRL.js +2 -0
  42. package/dist/chunk-EOMHELRL.js.map +1 -0
  43. package/dist/chunk-EURCQMZK.cjs +2 -0
  44. package/dist/{chunk-Z5KBBQOJ.cjs.map → chunk-EURCQMZK.cjs.map} +1 -1
  45. package/dist/{chunk-HOQU47MF.cjs → chunk-FNNIAJNY.cjs} +2 -2
  46. package/dist/{chunk-HOQU47MF.cjs.map → chunk-FNNIAJNY.cjs.map} +1 -1
  47. package/dist/{chunk-3AVWA5IZ.cjs → chunk-FUDVKPB7.cjs} +2 -2
  48. package/dist/{chunk-3AVWA5IZ.cjs.map → chunk-FUDVKPB7.cjs.map} +1 -1
  49. package/dist/{chunk-4XTD4B77.js → chunk-GAAXTO4K.js} +3 -3
  50. package/dist/{chunk-4XTD4B77.js.map → chunk-GAAXTO4K.js.map} +1 -1
  51. package/dist/{chunk-G7TBEQRQ.js → chunk-GMSBBLUQ.js} +2 -2
  52. package/dist/{chunk-G7TBEQRQ.js.map → chunk-GMSBBLUQ.js.map} +1 -1
  53. package/dist/chunk-HDVZZ7JN.js +3 -0
  54. package/dist/chunk-HDVZZ7JN.js.map +1 -0
  55. package/dist/{chunk-SWKYVSMP.js → chunk-JEFMG6CV.js} +2 -2
  56. package/dist/{chunk-SWKYVSMP.js.map → chunk-JEFMG6CV.js.map} +1 -1
  57. package/dist/{chunk-P6BLASAA.js → chunk-JQBG3LX4.js} +2 -2
  58. package/dist/{chunk-P6BLASAA.js.map → chunk-JQBG3LX4.js.map} +1 -1
  59. package/dist/{chunk-GHW2X7PS.js → chunk-KHCNMNZZ.js} +2 -2
  60. package/dist/{chunk-GHW2X7PS.js.map → chunk-KHCNMNZZ.js.map} +1 -1
  61. package/dist/chunk-LH7URJZT.js +3 -0
  62. package/dist/chunk-LH7URJZT.js.map +1 -0
  63. package/dist/{chunk-R7T3NGUE.cjs → chunk-MVP2YD4X.cjs} +2 -2
  64. package/dist/{chunk-R7T3NGUE.cjs.map → chunk-MVP2YD4X.cjs.map} +1 -1
  65. package/dist/{chunk-KSDTVFXA.cjs → chunk-OZ6SKIPD.cjs} +4 -4
  66. package/dist/{chunk-KSDTVFXA.cjs.map → chunk-OZ6SKIPD.cjs.map} +1 -1
  67. package/dist/chunk-PNDQRCRQ.cjs +2 -0
  68. package/dist/chunk-PNDQRCRQ.cjs.map +1 -0
  69. package/dist/{chunk-YAHGSBMC.js → chunk-QYO7IEPR.js} +2 -2
  70. package/dist/{chunk-YAHGSBMC.js.map → chunk-QYO7IEPR.js.map} +1 -1
  71. package/dist/{chunk-2LFLR3VZ.cjs → chunk-SNVPM27Q.cjs} +2 -2
  72. package/dist/{chunk-2LFLR3VZ.cjs.map → chunk-SNVPM27Q.cjs.map} +1 -1
  73. package/dist/{chunk-AR7L5OJ2.js → chunk-T3FBAFRR.js} +2 -2
  74. package/dist/{chunk-AR7L5OJ2.js.map → chunk-T3FBAFRR.js.map} +1 -1
  75. package/dist/chunk-TUBLMUTZ.cjs +2 -0
  76. package/dist/chunk-TUBLMUTZ.cjs.map +1 -0
  77. package/dist/chunk-U47GA63S.cjs +3 -0
  78. package/dist/chunk-U47GA63S.cjs.map +1 -0
  79. package/dist/{chunk-HMEZJXLX.js → chunk-UKDUFMT5.js} +2 -2
  80. package/dist/{chunk-HMEZJXLX.js.map → chunk-UKDUFMT5.js.map} +1 -1
  81. package/dist/chunk-UWAXJX5G.js +2 -0
  82. package/dist/chunk-UWAXJX5G.js.map +1 -0
  83. package/dist/chunk-WEAKI5V5.cjs +2 -0
  84. package/dist/chunk-WEAKI5V5.cjs.map +1 -0
  85. package/dist/{chunk-VYWGUMFW.js → chunk-WTEXBPBR.js} +2 -2
  86. package/dist/{chunk-VYWGUMFW.js.map → chunk-WTEXBPBR.js.map} +1 -1
  87. package/dist/{chunk-NXIMGB4S.cjs → chunk-WYIOXAFW.cjs} +2 -2
  88. package/dist/{chunk-NXIMGB4S.cjs.map → chunk-WYIOXAFW.cjs.map} +1 -1
  89. package/dist/{chunk-B4P4M4ZW.cjs → chunk-YORX7723.cjs} +3 -3
  90. package/dist/{chunk-B4P4M4ZW.cjs.map → chunk-YORX7723.cjs.map} +1 -1
  91. package/dist/chunk-YTCTUBR2.js +2 -0
  92. package/dist/{chunk-XTM4HTRB.js.map → chunk-YTCTUBR2.js.map} +1 -1
  93. package/dist/constants.cjs +1 -1
  94. package/dist/constants.js +1 -1
  95. package/dist/engine.cjs +1 -1
  96. package/dist/engine.d.cts +7 -7
  97. package/dist/engine.d.ts +7 -7
  98. package/dist/engine.js +1 -1
  99. package/dist/format.cjs +1 -1
  100. package/dist/format.d.cts +1 -1
  101. package/dist/format.d.ts +1 -1
  102. package/dist/format.js +1 -1
  103. package/dist/index.cjs +1 -1
  104. package/dist/index.d.cts +7 -7
  105. package/dist/index.d.ts +7 -7
  106. package/dist/index.js +1 -1
  107. package/dist/language.cjs +1 -1
  108. package/dist/language.d.cts +6 -6
  109. package/dist/language.d.ts +6 -6
  110. package/dist/language.js +1 -1
  111. package/dist/lexer.cjs +1 -1
  112. package/dist/lexer.js +1 -1
  113. package/dist/normalizer.cjs +1 -1
  114. package/dist/normalizer.js +1 -1
  115. package/dist/packages.cjs +1 -1
  116. package/dist/packages.d.cts +6 -6
  117. package/dist/packages.d.ts +6 -6
  118. package/dist/packages.js +1 -1
  119. package/dist/parser.cjs +1 -1
  120. package/dist/parser.d.cts +3 -3
  121. package/dist/parser.d.ts +3 -3
  122. package/dist/parser.js +1 -1
  123. package/dist/{pipeline-DY0rhgQG.d.cts → pipeline-BM8xc0CZ.d.cts} +3 -3
  124. package/dist/{pipeline-BH7BFOTJ.d.ts → pipeline-J2ehIm7t.d.ts} +3 -3
  125. package/dist/resolvers.d.cts +1 -1
  126. package/dist/resolvers.d.ts +1 -1
  127. package/dist/testing.cjs +2 -2
  128. package/dist/testing.d.cts +6 -6
  129. package/dist/testing.d.ts +6 -6
  130. package/dist/testing.js +1 -1
  131. package/dist/uom.cjs +1 -1
  132. package/dist/uom.d.cts +1 -1
  133. package/dist/uom.d.ts +1 -1
  134. package/dist/uom.js +1 -1
  135. package/dist/vm.cjs +1 -1
  136. package/dist/vm.d.cts +6 -6
  137. package/dist/vm.d.ts +6 -6
  138. package/dist/vm.js +1 -1
  139. package/dist/worker.cjs +2 -2
  140. package/dist/worker.cjs.map +1 -1
  141. package/dist/worker.d.cts +15 -5
  142. package/dist/worker.d.ts +15 -5
  143. package/dist/worker.js +2 -2
  144. package/dist/worker.js.map +1 -1
  145. package/package.json +1 -1
  146. package/dist/chunk-2JMFUQZH.js.map +0 -1
  147. package/dist/chunk-3DD2RVBI.cjs +0 -3
  148. package/dist/chunk-3DD2RVBI.cjs.map +0 -1
  149. package/dist/chunk-5FGOIDLS.cjs +0 -2
  150. package/dist/chunk-5FGOIDLS.cjs.map +0 -1
  151. package/dist/chunk-5OIXCVB2.js +0 -3
  152. package/dist/chunk-5OIXCVB2.js.map +0 -1
  153. package/dist/chunk-CIQOK7Q4.cjs.map +0 -1
  154. package/dist/chunk-ESUN2THE.cjs +0 -2
  155. package/dist/chunk-ESUN2THE.cjs.map +0 -1
  156. package/dist/chunk-FWW3M36J.cjs +0 -2
  157. package/dist/chunk-FWW3M36J.cjs.map +0 -1
  158. package/dist/chunk-GKDZ7TSX.cjs +0 -2
  159. package/dist/chunk-GKDZ7TSX.cjs.map +0 -1
  160. package/dist/chunk-IANAMBJQ.cjs +0 -2
  161. package/dist/chunk-IANAMBJQ.cjs.map +0 -1
  162. package/dist/chunk-IO374J6Z.js +0 -2
  163. package/dist/chunk-IO374J6Z.js.map +0 -1
  164. package/dist/chunk-R2ENWQ76.js +0 -2
  165. package/dist/chunk-R2ENWQ76.js.map +0 -1
  166. package/dist/chunk-SOSUS2SK.cjs +0 -3
  167. package/dist/chunk-SOSUS2SK.cjs.map +0 -1
  168. package/dist/chunk-T4Y5XOT2.js +0 -3
  169. package/dist/chunk-T4Y5XOT2.js.map +0 -1
  170. package/dist/chunk-TRBXW6HW.js +0 -2
  171. package/dist/chunk-TRBXW6HW.js.map +0 -1
  172. package/dist/chunk-WGZ3FNHI.js +0 -2
  173. package/dist/chunk-WGZ3FNHI.js.map +0 -1
  174. package/dist/chunk-XTM4HTRB.js +0 -2
  175. package/dist/chunk-Z5KBBQOJ.cjs +0 -2
  176. package/dist/chunk-ZJPAPBP3.js +0 -2
  177. package/dist/chunk-ZJPAPBP3.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import {a,f}from'./chunk-2JMFUQZH.js';var r=new Map([["in","the IN keyword owns this word (the conversion operator). ConvertParselet and friends special-case the IN token type directly and trust its text as a unit name, so inches still convert"],["dec","already a converter name, as in `255 as dec`"],["M","the millions magnitude suffix, as in `2.5M`. Nautical miles are still spelled `nmi` and `NM`"],["pm","the meridiem marker, as in `4pm`. Picometres lose, and `picometre` still works"],["are","the English verb, against a 100-square-metre unit almost nobody writes"],["ares","the English verb in plural, same reasoning as `are` above"],["turn","ordinary English, against a full-rotation angle unit also spelled in gradians"],["turns","ordinary English in plural, same reasoning as `turn` above"],["grade","ordinary English. The angle unit is also spelled `gon` and `grad`"],["grades","ordinary English in plural, same reasoning as `grade` above"],["point","ordinary English. The typographic point is also reachable as `pica`"],["points","ordinary English in plural, same reasoning as `point` above"],["moment","ordinary English, against an obscure medieval time unit of 90 seconds"],["moments","ordinary English in plural, same reasoning as `moment` above"],["shake","ordinary English, against an obscure physics unit of ten nanoseconds"],["shakes","ordinary English in plural, same reasoning as `shake` above"]]);function s(n){return /^[A-Za-z0-9_]+$/.test(n)}var i=new Set(["m","g","t","s","h","d","l","b","B","C","F","K","W"]);function o(n){return !s(n)||r.has(n)?false:n.length===1?i.has(n):true}var t=["USD","EUR","GBP","JPY","AUD","CAD","CHF","CNY","SEK","NOK","DKK","NZD","KRW","SGD","HKD","TWD","INR","BRL","ZAR","MXN","RUB","TRY","SAR","AED","ILS","PLN","CZK","HUF","THB","IDR","MYR","PHP","CLP","COP","ARS","NGN","EGP","PKR","BDT","VND","KES","XOF","XAF","MAD","QAR","KWD","OMR","BHD","JOD","LKR","MMK","UZS","KZT","RON","BGN","HRK","ISK","UAH","GEL","AZN","BTN","BND","BOB","BWP","BYN","BZD","CDF","CRC","CUP","DOP","DZD","ERN","ETB","FJD","FKP","GMD","GNF","GYD","HNL","HTG","JMD","KGZ","KHR","KMF","KYD","LAK","LBP","LRD","LSL","LYD","MDL","MGA","MKD","MNT","MOP","MRU","MUR","MVR","MWK","MZN","NAD","NIO","NPR","PGK","PYG","RSD","RWF","SBD","SCR","SDG","SHP","SLE","SOS","SRD","SSP","STN","SVC","SYP","SZL","TJS","TMT","TND","TOP","TTD","TZS","UGX","UYU","VEB","VUV","WST","XCD","XDR","XPF","YER","ZMW","ZWL","BTC","ETH","SOL","XRP","ADA","DOGE","DOT"],l=["dollar","dollars","euro","euros","yen","ruble","rubles","rouble","roubles","won","rupee","rupees","yuan","renminbi","franc","francs","rand","krona","kronor","krone","kroner","real","reais","peso","pesos","shekel","shekels","lira","hryvnia","hryvnias","zloty","zlotys","forint","koruna","dirham","dirhams","riyal","riyals","rial","rials","ringgit","rupiah","baht","dong","naira"],D=["workday","workdays"],d=new Set([...Object.keys(a).filter(o),...Object.keys(f),...D,...t,...l]);function g(n){return d.has(n)}export{d as a,g as b};//# sourceMappingURL=chunk-TRBXW6HW.js.map
2
- //# sourceMappingURL=chunk-TRBXW6HW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lexer/units.ts"],"names":["EXCLUDED_UNIT_SPELLINGS","isTokenizableSpelling","spelling","GRANDFATHERED_SINGLE_CHARACTER_UNITS","isAdmissible","CURRENCY_CODES","CURRENCY_WORD_FORMS","WORKDAY_UNITS","knownUnits","UNIT_TABLE","EXTENDED_UNITS","isKnownUnit","text"],"mappings":"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","file":"chunk-TRBXW6HW.js","sourcesContent":["/**\n * The set of unit identifiers the lexer will turn into a UNIT token.\n *\n * DERIVED, not hand-listed. This used to be a hand-maintained list of about a\n * hundred spellings, which existed only because the conversion tables lived\n * inside a third-party package and could not be enumerated. Every spelling had\n * to be transcribed by hand and kept in sync, and this file's own history\n * records the consequences: the IEC binary prefixes (`GiB`, `TiB`) were absent\n * for a long time, and the note explaining the fix said it was \"purely a lexer\n * allowlist gap, not a conversion-logic one\".\n *\n * The tables are now in-repo (see `uom/generated/UnitTable.generated.ts`), so\n * the allowlist is computed from them. Roughly 975 base spellings are\n * recognized instead of about 101, which is why `1 kilojoule to Wh`,\n * `5 arcminutes to deg` and `2 fortnights in days` work at all.\n *\n * Units are case-sensitive to eliminate ambiguity (`C` is Celsius and `c` is a\n * cup, `B` is bytes and `b` is bits). Nothing here normalizes or aliases.\n */\n\nimport { UNIT_TABLE } from \"@solve-js/uom/generated/UnitTable.generated\";\nimport { EXTENDED_UNITS } from \"@solve-js/uom/ExtendedUnits\";\n\n/**\n * Spellings the conversion tables accept but the lexer must not claim, each\n * with its reason. `UnitVocabulary.spec.ts` asserts every one of these still\n * fails to lex, so nobody can quietly delete an entry.\n *\n * Only three spellings in the whole table collide with an existing language\n * keyword (`in`, `min`, `dec`), and `min` is left alone because it has always\n * been a time unit here and works. The rest of this list is about ordinary\n * English: a unit spelling that is also a common word turns prose into\n * arithmetic. `shouldEvaluateLine`'s prose gate is a backstop, not a licence\n * to claim every word in the dictionary.\n */\nconst EXCLUDED_UNIT_SPELLINGS: ReadonlyMap<string, string> = new Map([\n [\"in\", \"the IN keyword owns this word (the conversion operator). ConvertParselet and friends special-case the IN token type directly and trust its text as a unit name, so inches still convert\"],\n [\"dec\", \"already a converter name, as in `255 as dec`\"],\n [\"M\", \"the millions magnitude suffix, as in `2.5M`. Nautical miles are still spelled `nmi` and `NM`\"],\n // Claimed by a normalizer rule rather than by the keyword table, which is why\n // scanning the locale keywords alone does not find it. Admitting `pm`\n // (picometre) broke every clock time in the suite: `4pm` lexed as 4\n // picometres. There is deliberately no entry for `am`: the table's SI\n // prefixes stop at femto, so attometres do not exist and an exclusion would\n // be dead weight. `UnitVocabularyCollisions.spec.ts` asserts that.\n [\"pm\", \"the meridiem marker, as in `4pm`. Picometres lose, and `picometre` still works\"],\n [\"are\", \"the English verb, against a 100-square-metre unit almost nobody writes\"],\n [\"ares\", \"the English verb in plural, same reasoning as `are` above\"],\n [\"turn\", \"ordinary English, against a full-rotation angle unit also spelled in gradians\"],\n [\"turns\", \"ordinary English in plural, same reasoning as `turn` above\"],\n [\"grade\", \"ordinary English. The angle unit is also spelled `gon` and `grad`\"],\n [\"grades\", \"ordinary English in plural, same reasoning as `grade` above\"],\n [\"point\", \"ordinary English. The typographic point is also reachable as `pica`\"],\n [\"points\", \"ordinary English in plural, same reasoning as `point` above\"],\n [\"moment\", \"ordinary English, against an obscure medieval time unit of 90 seconds\"],\n [\"moments\", \"ordinary English in plural, same reasoning as `moment` above\"],\n [\"shake\", \"ordinary English, against an obscure physics unit of ten nanoseconds\"],\n [\"shakes\", \"ordinary English in plural, same reasoning as `shake` above\"],\n]);\n\n/**\n * Whether a spelling can be a single UNIT token at all.\n *\n * The lexer reads a unit as one run of `[A-Za-z0-9_]`, so the 465 spellings\n * containing a space, a slash, a prime or a non-ASCII character cannot be\n * tokenized however well the converter understands them. `square metres`,\n * `cd/m2` and `µm²` all remain reachable through the conversion API (notably\n * the cooking package's free-text target unit), just not by typing them in an\n * expression.\n */\nfunction isTokenizableSpelling(spelling: string): boolean {\n return /^[A-Za-z0-9_]+$/.test(spelling);\n}\n\n/**\n * The single-character units that were already claimed before the vocabulary\n * was derived from the tables, and are therefore grandfathered in.\n *\n * No OTHER single character is admitted. A one-letter unit is indistinguishable\n * from the placeholder names people actually write (`x`, `y`, `n`), and the\n * table has ten more of them: `r a y c p S L N J R`. Admitting those turned\n * `x.y` into a unit expression and broke comparison-operator tests that had\n * deliberately picked letters which were not units. The upside was a handful of\n * spellings that all have an unambiguous longer form (`rad`, `year`, `cup`).\n */\nconst GRANDFATHERED_SINGLE_CHARACTER_UNITS = new Set([\n \"m\", \"g\", \"t\", \"s\", \"h\", \"d\", \"l\", \"b\", \"B\", \"C\", \"F\", \"K\", \"W\",\n]);\n\n/** Whether a base-table spelling should become a lexer token. */\nfunction isAdmissible(spelling: string): boolean {\n if (!isTokenizableSpelling(spelling)) return false;\n if (EXCLUDED_UNIT_SPELLINGS.has(spelling)) return false;\n if (spelling.length === 1) return GRANDFATHERED_SINGLE_CHARACTER_UNITS.has(spelling);\n return true;\n}\n\n/**\n * ISO 4217 codes and the crypto tickers handled alongside them.\n *\n * Hand-maintained on purpose: these are NOT units. They route through\n * CurrencyExchangeService, and `getMeasure()` deliberately returns undefined\n * for every one of them, which is how `VM.ts` tells a currency from a unit.\n * Must stay in sync with CurrencyExchangeService's `isCurrency()`: without a\n * lexer entry a code never becomes a UNIT token, so `1 BTC to USD` used to\n * fail at tokenization with \"Undefined variable: BTC\" before ever reaching\n * the currency service that could have handled it.\n */\nconst CURRENCY_CODES = [\n \"USD\", \"EUR\", \"GBP\", \"JPY\",\n \"AUD\", \"CAD\", \"CHF\", \"CNY\", \"SEK\", \"NOK\", \"DKK\", \"NZD\",\n \"KRW\", \"SGD\", \"HKD\", \"TWD\", \"INR\", \"BRL\", \"ZAR\", \"MXN\",\n \"RUB\", \"TRY\", \"SAR\", \"AED\", \"ILS\", \"PLN\", \"CZK\", \"HUF\",\n \"THB\", \"IDR\", \"MYR\", \"PHP\", \"CLP\", \"COP\", \"ARS\", \"NGN\",\n \"EGP\", \"PKR\", \"BDT\", \"VND\", \"KES\", \"XOF\", \"XAF\", \"MAD\",\n \"QAR\", \"KWD\", \"OMR\", \"BHD\", \"JOD\", \"LKR\", \"MMK\", \"UZS\",\n \"KZT\", \"RON\", \"BGN\", \"HRK\", \"ISK\", \"UAH\", \"GEL\", \"AZN\",\n \"BTN\", \"BND\", \"BOB\", \"BWP\", \"BYN\", \"BZD\", \"CDF\", \"CRC\",\n \"CUP\", \"DOP\", \"DZD\", \"ERN\", \"ETB\", \"FJD\", \"FKP\", \"GMD\",\n \"GNF\", \"GYD\", \"HNL\", \"HTG\", \"JMD\", \"KGZ\", \"KHR\", \"KMF\",\n \"KYD\", \"LAK\", \"LBP\", \"LRD\", \"LSL\", \"LYD\", \"MDL\", \"MGA\",\n \"MKD\", \"MNT\", \"MOP\", \"MRU\", \"MUR\", \"MVR\", \"MWK\", \"MZN\",\n \"NAD\", \"NIO\", \"NPR\", \"PGK\", \"PYG\", \"RSD\", \"RWF\", \"SBD\",\n \"SCR\", \"SDG\", \"SHP\", \"SLE\", \"SOS\", \"SRD\", \"SSP\", \"STN\",\n \"SVC\", \"SYP\", \"SZL\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TTD\",\n \"TZS\", \"UGX\", \"UYU\", \"VEB\", \"VUV\", \"WST\", \"XCD\", \"XDR\",\n \"XPF\", \"YER\", \"ZMW\", \"ZWL\",\n \"BTC\", \"ETH\", \"SOL\", \"XRP\", \"ADA\", \"DOGE\", \"DOT\",\n];\n\n/**\n * Currency WORD forms, resolved to their canonical ISO code by\n * `UomLiteralParselet.ts` via `uom/CurrencyAliases.ts`.\n *\n * That table doc-comments every ambiguous choice (peso to MXN, franc to CHF,\n * krona to SEK) and explains why \"pound\"/\"pounds\" is deliberately absent: the\n * mass unit already claims it, and remapping would be exactly the kind of\n * guessing the case-sensitive, no-alias policy exists to prevent.\n */\nconst CURRENCY_WORD_FORMS = [\n \"dollar\", \"dollars\", \"euro\", \"euros\", \"yen\",\n \"ruble\", \"rubles\", \"rouble\", \"roubles\", \"won\",\n \"rupee\", \"rupees\", \"yuan\", \"renminbi\", \"franc\", \"francs\", \"rand\",\n \"krona\", \"kronor\", \"krone\", \"kroner\", \"real\", \"reais\", \"peso\", \"pesos\",\n \"shekel\", \"shekels\", \"lira\", \"hryvnia\", \"hryvnias\", \"zloty\", \"zlotys\",\n \"forint\", \"koruna\", \"dirham\", \"dirhams\", \"riyal\", \"riyals\", \"rial\", \"rials\",\n \"ringgit\", \"rupiah\", \"baht\", \"dong\", \"naira\",\n];\n\n/**\n * \"workday\" and \"workdays\", a business day (Mon-Fri).\n *\n * Backs the datetime package's `<date> + N workdays` arithmetic and\n * `$X/workday` Rate literals. Not a real unit (a business day has no fixed\n * physical duration, it depends on which dates are weekends), so it has no\n * entry in the conversion tables and is shimmed at a fixed 7/5 ratio for rate\n * math only. See `uom/UomConverter.ts`.\n *\n * Safe with respect to variable names: VariableParselet accepts UNIT-typed\n * tokens as names, so `:workday = 5` keeps working, exactly as `:b = 5`\n * already did for the bits unit.\n */\nconst WORKDAY_UNITS = [\"workday\", \"workdays\"];\n\n/**\n * Set of all known unit identifiers (case-sensitive).\n *\n * Base units come from the conversion table; the extended units (speed,\n * voltage, parts-per and the other categories the base table has no measure\n * for) come from ExtendedUnits.ts; currencies and workdays are listed above.\n *\n * Note ExtendedUnits deliberately omits bare `V` (collides with the stocks\n * package's Visa ticker), bare `var` (reads as a variable name) and `fps`\n * (the Time package needs it for frames per second, so speed uses `ft_s`).\n * Those exclusions live there rather than here because they are properties of\n * that table.\n */\nexport const knownUnits: ReadonlySet<string> = new Set([\n ...Object.keys(UNIT_TABLE).filter(isAdmissible),\n ...Object.keys(EXTENDED_UNITS),\n ...WORKDAY_UNITS,\n ...CURRENCY_CODES,\n ...CURRENCY_WORD_FORMS,\n]);\n\n/** The exclusion list, exported so the vocabulary spec can assert each entry. */\nexport const excludedUnitSpellings: ReadonlyMap<string, string> = EXCLUDED_UNIT_SPELLINGS;\n\n/** Units are case-sensitive to eliminate ambiguity (e.g. C=Celsius, c=cup). */\nexport function isKnownUnit(text: string): boolean {\n return knownUnits.has(text);\n}\n"]}
@@ -1,2 +0,0 @@
1
- import {a as a$1,b as b$1,f,e,d,c}from'./chunk-2JMFUQZH.js';var p=new Map(Object.entries(a$1)),_=new Map(Object.entries(b$1));function a(n){return p.get(n)}function b(n,e,t){let r=p.get(e);if(r===void 0)throw new RangeError(`${e} is not a valid unit`);let i=p.get(t);if(i===void 0)throw new RangeError(`${t} is not a valid unit`);return x(n,e,t,r,i)}function x(n,e,t,r,i){let s=r,u=i;if(s[0]!==u[0])throw new RangeError(`Cannot convert between different measures: ${e} and ${t}`);let o=s[1],d=u[1],f=_.get(e),l=_.get(t);return f!==void 0?l!==void 0?(n+f)*(o/d)-l:(n+f)*(o/d):l!==void 0?n*(o/d)-l:n*(o/d)}function B(n,e){let t=p.get(e);if(t===void 0)throw new RangeError(`${e} is not a valid unit`);let r=c[t[0]],i=r[0][0],s=i,u=b(n,e,i),o=u<0?-u:u;for(let d=0;d<r.length;d++){let f=r[d];if(o>=f[1])s=f[0];else break}return {quantity:b(n,e,s),unit:s}}var v=new Set(["workday","workdays"]),F=7/5;function g(n){return typeof n=="string"&&v.has(n)}function k(n){return n}function m(n){if(g(n))return m("day");let e$1=f[n];if(e$1)return e$1.measure;let t=a(n);if(t!==void 0)return e[t[0]]}function K(n,e){if(n===e)return true;if(g(n)||g(e)){let u=m(n),o=m(e);return !!u&&u===o}let t=a(n),r=a(e);if(t!==void 0&&r!==void 0)return t[0]===r[0];let i=f[n],s=f[e];return i!==void 0&&s!==void 0?i.measure===s.measure:y(n,e)||y(e,n)}function y(n,e$1){let t=f[n];if(t===void 0)return false;let r=a(e$1);return r===void 0?false:e[r[0]]===t.measure}function R(n,e,t){if(e===t)return n;let r=a(e),i=a(t);if(r!==void 0&&i!==void 0)return x(n,e,t,r,i);if(g(e)&&g(t))return n;if(g(e)){let o=n*F;return t==="day"?o:R(o,"day",t)}if(g(t))return (e==="day"?n:R(n,e,"day"))/F;let s=f[e],u=f[t];return s!==void 0&&u!==void 0?n*(s.toBase/u.toBase):s!==void 0&&y(e,t)?b(n*s.toBase,N(t),t):u!==void 0&&y(t,e)?b(n,e,N(e))/u.toBase:b(n,e,t)}function N(n){let e=a(n);if(e===void 0)return n;for(let t of Object.keys(a$1)){let r=a$1[t];if(r[0]===e[0]&&r[1]===1)return t}return n}function L(n){let e=n,t=a(e);if(t===void 0)return [];let r=d[t[0]];return r?r.filter(i=>i!==e):[]}function $(n){return g(n)||f[n]?true:a(n)!==void 0}function Y(n,e){let t=e;try{let r=B(n,t);return {value:r.quantity,unit:r.unit}}catch{return {value:n,unit:t}}}function S(n,e){let t=e.indexOf("/");if(t>=0)return {value:n,numerator:e.slice(0,t),denominator:e.slice(t+1)};let r=f[e];return r!==void 0&&r.measure==="speed"?{value:n*r.toBase,numerator:"m",denominator:"s"}:null}function O(n,e){if(n===e)return 1;if(n===""||e==="")return null;let t=m(n),r=m(e);return t===void 0||r===void 0||t!==r?null:R(1,n,e)}function j(n,e,t){let r=S(n,e);if(r===null)return null;let i,s,u,o=t.indexOf("/");if(o>=0)i=t.slice(0,o),s=t.slice(o+1),u=1;else {let l=f[t];if(l===void 0||l.measure!=="speed")return null;i="m",s="s",u=l.toBase;}let d=O(r.numerator,i);if(d===null)return null;let f$1=O(r.denominator,s);return f$1===null?null:r.value*d/f$1/u}export{g as a,k as b,m as c,K as d,R as e,L as f,$ as g,Y as h,j as i};//# sourceMappingURL=chunk-WGZ3FNHI.js.map
2
- //# sourceMappingURL=chunk-WGZ3FNHI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/uom/UnitConversion.ts","../src/uom/UomConverter.ts"],"names":["UNIT_LOOKUP","UNIT_TABLE","DIFFERENCE_LOOKUP","UNIT_DIFFERENCES","lookupUnit","unit","convertRaw","quantity","from","to","parsedFrom","parsedTo","convertResolved","fromEntry","toEntry","fromRatio","toRatio","fromDifference","toDifference","convertToBestMetric","best","BEST_UNITS_METRIC","smallestUnit","bestUnit","baseQuantity","absQuantity","i","bestEntry","WORKDAY_UNIT_NAMES","WORKDAY_TO_DAY_FACTOR","isWorkdayUnit","resolveUnit","getMeasure","extended","EXTENDED_UNITS","entry","MEASURE_KIND_NAMES","canConvert","fromMeasure","toMeasure","fromExtended","toExtended","bridgesToBaseMeasure","extendedUnit","baseUnit","base","convertUnit","value","days","fExt","tExt","baseUnitFor","symbol","candidate","getConvertiblePossibilities","resolved","symbols","MEASURE_SYMBOLS","s","isConvertibleUnit","getBestUnit","u","result","expandUnitToRate","slash","ext","rateAxisFactor","convertRate","source","targetNumerator","targetDenominator","targetScale","numeratorFactor","denominatorFactor"],"mappings":"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","file":"chunk-WGZ3FNHI.js","sourcesContent":["/**\n * The unit conversion algorithm, ported from the `convert` npm package v7.0.2\n * alongside its tables (see `generated/UnitTable.generated.ts` and\n * THIRD-PARTY-NOTICES.md).\n *\n * Transliterated expression for expression rather than rewritten. Floating\n * point is not associative, so `(q + d) * (a / b) - d2` and any algebraically\n * equal rearrangement disagree in the last bits. Those bits are observable:\n * `0.5 l` best-converts to `500.00000000000006 mL` today, and the test suite\n * pins several conversions to ten decimal places.\n *\n * This module is deliberately unaware of the engine's own additions. Workdays,\n * extended units, currency and the caches all live in `UomConverter.ts`, which\n * layers them on top of these three functions.\n */\n\nimport {\n UNIT_TABLE,\n UNIT_DIFFERENCES,\n BEST_UNITS_METRIC,\n type UnitEntry,\n} from \"./generated/UnitTable.generated\";\n\n/**\n * The generated tables re-keyed into Maps once at module load.\n *\n * Not a micro-optimization. A 1456-key object literal lands in V8's dictionary\n * mode, and guarding a read on it against inherited names (`constructor`,\n * `toString`) costs about 123ns per call with either `hasOwnProperty.call` or\n * `Object.hasOwn`, measured. `Map.get` is about 6ns and needs no guard at all,\n * because a Map has no prototype chain to fall through to. That is a 20x\n * difference on the single hottest operation in the unit system: `convertRaw`\n * performs two of these per call, and `LanguageService` sweeps all 1456 keys\n * to build completions.\n */\nconst UNIT_LOOKUP: ReadonlyMap<string, UnitEntry> = new Map(Object.entries(UNIT_TABLE));\n\n/**\n * Temperature offsets, as a Map for the same reason.\n *\n * Also removes a latent hazard: the upstream code tests membership with `in`,\n * and `\"toString\" in UNIT_DIFFERENCES` is true, so an inherited name reaching\n * that branch would add a function to a number.\n */\nconst DIFFERENCE_LOOKUP: ReadonlyMap<string, number> = new Map(Object.entries(UNIT_DIFFERENCES));\n\n/**\n * Looks up a unit spelling.\n *\n * @returns its `[kind, ratio]` entry, or `undefined` if the spelling is not a\n * unit. Case-sensitive: no normalization or aliasing happens anywhere in this\n * module.\n *\n * The one deliberate deviation from upstream. `convert` tests membership with\n * `in` and reads the property directly, so inherited names like \"constructor\"\n * and \"toString\" reach its measure comparison and fail there with \"Cannot\n * convert between different measures\" instead of \"is not a valid unit\". Both\n * throw a RangeError and both report no measure, so nothing downstream can\n * tell the difference, and naming the real problem is the better message.\n */\nexport function lookupUnit(unit: string): UnitEntry | undefined {\n return UNIT_LOOKUP.get(unit);\n}\n\n/**\n * Converts `quantity` from one unit to another.\n *\n * THROWS a `RangeError` for an unknown unit or a pair in different measures.\n * Callers depend on that: `VM.ts`'s `extractDurationMs()` calls this with an\n * arbitrary unit inside a bare try/catch and treats the throw as \"not a\n * duration, contribute zero\". Returning NaN or the input unchanged instead\n * would turn `<date> + 5 kg` into an Invalid Date rather than a no-op.\n */\nexport function convertRaw(quantity: number, from: string, to: string): number {\n const parsedFrom = UNIT_LOOKUP.get(from);\n if (parsedFrom === undefined) {\n throw new RangeError(`${from} is not a valid unit`);\n }\n\n const parsedTo = UNIT_LOOKUP.get(to);\n if (parsedTo === undefined) {\n throw new RangeError(`${to} is not a valid unit`);\n }\n\n return convertResolved(quantity, from, to, parsedFrom, parsedTo);\n}\n\n/**\n * The conversion arithmetic, for callers that have already looked both units\n * up and want to skip doing it twice.\n *\n * Split out for `UomConverter.convertUnit()`, which has to check whether\n * either side is a workday or an extended unit before it can dispatch, and\n * would otherwise resolve each unit once to decide and again to convert. The\n * entries MUST be the ones this module returned for these exact spellings.\n */\nexport function convertResolved(\n quantity: number,\n from: string,\n to: string,\n fromEntry: UnitEntry,\n toEntry: UnitEntry\n): number {\n const parsedFrom = fromEntry;\n const parsedTo = toEntry;\n\n if (parsedFrom[0] !== parsedTo[0]) {\n // DELIBERATE DEVIATION from the ported original, which silently reinterpreted\n // \"m\" as minutes whenever the other side was a time unit. That is a guess,\n // and this project's stated position is that refusing to guess is the safer\n // default for a tool doing arithmetic on someone's real numbers (see\n // docs/architecture/design-decisions.md). The guess was not harmless: it\n // reached `<date> + <duration>` through VM.ts's extractDurationMs(), where\n // `today + 5 m` silently added five MINUTES for someone who wrote metres.\n //\n // Minutes are spelled \"min\", \"minute\" or \"minutes\", all of which the table\n // has always accepted.\n throw new RangeError(`Cannot convert between different measures: ${from} and ${to}`);\n }\n\n const fromRatio = parsedFrom[1];\n const toRatio = parsedTo[1];\n\n // Only six units in the whole table carry an offset, so the common path is\n // both misses. Reading the Map once per side and reusing the value beats\n // testing membership and then reading it again.\n const fromDifference = DIFFERENCE_LOOKUP.get(from);\n const toDifference = DIFFERENCE_LOOKUP.get(to);\n\n // Scales that do not share an origin (temperature) need the offset applied\n // around the ratio. Do not refactor the four branches into one expression:\n // the grouping is what makes the result bit-identical to the original.\n if (fromDifference !== undefined) {\n if (toDifference !== undefined) {\n return (quantity + fromDifference) * (fromRatio / toRatio) - toDifference;\n }\n return (quantity + fromDifference) * (fromRatio / toRatio);\n }\n\n if (toDifference !== undefined) {\n return quantity * (fromRatio / toRatio) - toDifference;\n }\n\n return quantity * (fromRatio / toRatio);\n}\n\n/**\n * Picks the most readable metric unit for a magnitude and converts to it.\n *\n * Only the metric lists are ported; nothing has ever requested the imperial\n * ones. Note the final conversion goes from the ORIGINAL unit to the chosen\n * one directly rather than via the smallest unit, which is what keeps the\n * result exact.\n */\nexport function convertToBestMetric(\n quantity: number,\n from: string\n): { quantity: number; unit: string } {\n const parsedFrom = UNIT_LOOKUP.get(from);\n if (parsedFrom === undefined) {\n throw new RangeError(`${from} is not a valid unit`);\n }\n\n const best = BEST_UNITS_METRIC[parsedFrom[0]];\n const smallestUnit = best[0][0];\n let bestUnit = smallestUnit;\n\n const baseQuantity = convertRaw(quantity, from, smallestUnit);\n const absQuantity = baseQuantity < 0 ? -baseQuantity : baseQuantity;\n\n // Thresholds are expressed in the smallest unit and ascend, so the last one\n // the magnitude reaches wins. Breaking early rather than scanning the whole\n // list matters for zero and for negatives, which stay on the smallest unit.\n for (let i = 0; i < best.length; i++) {\n const bestEntry = best[i];\n if (absQuantity >= bestEntry[1]) {\n bestUnit = bestEntry[0];\n } else {\n break;\n }\n }\n\n return { quantity: convertRaw(quantity, from, bestUnit), unit: bestUnit };\n}\n","/**\n * UoM Converter, built on the in-house unit tables in `UnitConversion.ts` and\n * `generated/UnitTable.generated.ts` (ported from the `convert` npm package\n * v7.0.2 so the engine ships with no runtime dependencies).\n *\n * Units are strictly case-sensitive and are looked up without aliasing. No unit\n * remapping, what you type is what you get.\n * e.g. 'C' = Celsius, 'c' = cup; 'MB' = megabytes, 'mb' = millibits.\n *\n * This file owns everything the base tables do not: the workday shim, the\n * extended (custom-measure) units, and the two caches.\n */\n\nimport { lookupUnit, convertRaw, convertResolved, convertToBestMetric } from \"@solve-js/uom/UnitConversion\";\nimport { MEASURE_KIND_NAMES, MEASURE_SYMBOLS, UNIT_TABLE } from \"@solve-js/uom/generated/UnitTable.generated\";\nimport { EXTENDED_UNITS } from \"@solve-js/uom/ExtendedUnits\";\n\n// ── \"workday\", a synthetic unit with no entry in the base table ───────────\n//\n// A business day (Mon-Fri) backing the datetime package's `<date> + N\n// workdays` arithmetic and `$X/workday` Rate literals\n// (packages/datetime/). NOT a real physical unit, a business day has no\n// fixed duration, since it depends on which calendar dates are weekends\n// so the ported base table has no concept of it and can't be\n// taught one without monkey-patching its internal unit table.\n//\n// For RATE-MATH purposes only (e.g. \"$500/workday x 4 weeks\" needs a\n// workday count to multiply by), a workday is treated as a FIXED 7/5 of a\n// calendar day: 5 workdays span exactly 7 calendar days in a whole week,\n// so this ratio is exact for whole-week spans and a reasonable linear\n// approximation otherwise. This is deliberately NOT the same\n// calendar-aware, weekend-skipping logic real \"<date> + N workdays\" date\n// arithmetic needs (see vm/VM.ts's addBusinessDays()), that can't be\n// reduced to a fixed ratio, since the exact skip pattern depends on which\n// day of the week the calculation actually starts from.\n//\n// Handled here as a thin pre/post layer in front of the normal\n// base-table path (rather than inside the tables themselves) so every\n// caller of getMeasure()/convertUnit()/canConvert() automatically gets\n// workday support for free.\nconst WORKDAY_UNIT_NAMES = new Set([\"workday\", \"workdays\"]);\nconst WORKDAY_TO_DAY_FACTOR = 7 / 5; // 1 workday == 1.4 calendar days\n\n/** Whether `unit` is the synthetic \"workday\" unit (see module note above). */\nexport function isWorkdayUnit(unit: string | undefined): unit is string {\n return typeof unit === \"string\" && WORKDAY_UNIT_NAMES.has(unit);\n}\n\n/**\n * Validate `unit` against the known unit table.\n *\n * @returns `unit` unchanged in all cases. This does NOT normalize casing\n * or aliasing (units are strictly case-sensitive, see the module note\n * above). A unit the table doesn't recognize is still\n * returned as-is (not thrown), so callers must not assume a returned\n * string is actually convertible, check with {@link isConvertibleUnit}\n * or {@link canConvert} first if that matters.\n *\n * Kept as an identity function purely for API compatibility. It used to guard\n * a validity cache, which existed because validating a unit meant a\n * throw/catch round trip through the old dependency. Validation is now a Map\n * lookup, so the cache cost more than it saved: worse, it was capped at 1000\n * entries against a 1456-unit table, so any sweep over the full vocabulary\n * (which is exactly what LanguageService does to build completions) evicted\n * on almost every call. That one change took the full-table sweep from 7.7ms\n * to under 20us.\n */\nexport function resolveUnit(unit: string): string {\n return unit;\n}\n\n// MEASURE_KIND_NAMES now comes from the generated table (it is derived data,\n// so the generator emits it rather than it being retyped here). The reason it\n// is a module-level constant has not changed: getMeasure() runs at least twice\n// per conversion, and this used to be reallocated on every call.\n\n/**\n * Get the measure/dimension kind for `unit` (e.g. `\"length\"`, `\"mass\"`,\n * `\"temperature\"`), used to check whether two units are even in the same\n * dimension before attempting a conversion.\n *\n * @returns `undefined` if `unit` isn't recognized, rather than throwing.\n */\nexport function getMeasure(unit: string): string | undefined {\n // Workday is a Time-measure unit by convention (see isWorkdayUnit's doc\n // comment) and is not in the base table, so resolve its measure via \"day\"\n // instead of attempting the real lookup below.\n if (isWorkdayUnit(unit)) return getMeasure(\"day\");\n\n // Extended (custom) categories the base table has no measure kind for,\n // see ExtendedUnits.ts.\n const extended = EXTENDED_UNITS[unit];\n if (extended) return extended.measure;\n\n const entry = lookupUnit(unit);\n if (entry === undefined) return undefined;\n\n return MEASURE_KIND_NAMES[entry[0]];\n}\n\n/**\n * Check whether `from` can be converted to `to`. Same unit, or same\n * measure kind (length, mass, ...) and the underlying tables accept the pair.\n * Never throws; returns `false` on any failure.\n */\nexport function canConvert(from: string, to: string): boolean {\n if (from === to) return true;\n if (isWorkdayUnit(from) || isWorkdayUnit(to)) {\n const fromMeasure = getMeasure(from);\n const toMeasure = getMeasure(to);\n return !!fromMeasure && fromMeasure === toMeasure;\n }\n // One table read per side, comparing numeric kind ids. The old shape called\n // getMeasure() on each side (two more reads) purely to compare the resulting\n // STRINGS, then did a throwaway conversion to confirm what the kind check had\n // already established.\n const fromEntry = lookupUnit(from);\n const toEntry = lookupUnit(to);\n if (fromEntry !== undefined && toEntry !== undefined) {\n return fromEntry[0] === toEntry[0];\n }\n\n // Extended (custom) categories aren't in the base table at all, so they are\n // compared on their own measure names instead.\n const fromExtended = EXTENDED_UNITS[from];\n const toExtended = EXTENDED_UNITS[to];\n if (fromExtended !== undefined && toExtended !== undefined) {\n return fromExtended.measure === toExtended.measure;\n }\n\n // Mixed: one side is in the base table and the other is extended. That used\n // to be refused outright, on the grounds that the two measure spaces are\n // disjoint. They are not, once an extended unit names a measure the base\n // table also has: `furlong` is a length and so is `m`, and the ratio between\n // them is exactly what both tables already record.\n return bridgesToBaseMeasure(from, to) || bridgesToBaseMeasure(to, from);\n}\n\n/**\n * Whether `extendedUnit` extends a measure the base table also knows, so a\n * value in it can reach `baseUnit`.\n *\n * The bridge works because both tables express a unit as a ratio to the same\n * physical base: the generated table's length ratios are metres and its mass\n * ratios are grams, and an extended unit declaring `measure: \"length\"` states\n * its `toBase` in the same metres. Composing the two ratios is then ordinary\n * arithmetic rather than a second conversion system.\n *\n * A measure the base table has no concept of, such as pace, still fails here,\n * which is the behaviour this replaced and the reason the check is by measure\n * name rather than by presence in the extended table.\n */\nfunction bridgesToBaseMeasure(extendedUnit: string, baseUnit: string): boolean {\n const extended = EXTENDED_UNITS[extendedUnit];\n if (extended === undefined) return false;\n\n const base = lookupUnit(resolveUnit(baseUnit));\n if (base === undefined) return false;\n\n return MEASURE_KIND_NAMES[base[0]] === extended.measure;\n}\n\n/**\n * Convert `value` from unit `from` to unit `to`.\n *\n * Does not validate that the conversion is possible, callers should check\n * with {@link canConvert} first if `from`/`to` aren't already known-good.\n *\n * THROWS a RangeError for an unknown unit or a cross-measure pair. `VM.ts`'s\n * `extractDurationMs()` depends on that, see {@link convertRaw}.\n *\n * This used to memoize a per-pair conversion factor in an LFU cache. The cache\n * is gone: computing the factor is now two Map reads, while the cache cost a\n * template-string key allocation on every call plus the LFU's own frequency\n * bookkeeping, so it was slower than the work it avoided. Removing it is\n * bit-exact, not merely close: the cache stored `convertRaw(1, f, t)`, which is\n * exactly `fromRatio / toRatio`, and then multiplied, which is the identical\n * expression `convertRaw(value, f, t)` evaluates. It also deleted the special\n * case that existed only to keep offset-based temperature pairs out of a\n * factor cache.\n */\nexport function convertUnit(value: number, from: string, to: string): number {\n if (from === to) return value;\n\n // Fast path first: two ordinary units, which is nearly every call. Resolving\n // both here and handing the entries to convertResolved() avoids looking them\n // up again inside convertRaw(). Neither workdays nor extended units appear in\n // the base table, so they always fall through to the branches below and this\n // ordering cannot steal a case from them. UnitVocabulary.spec.ts pins that\n // the two vocabularies stay disjoint.\n const fromEntry = lookupUnit(from);\n const toEntry = lookupUnit(to);\n if (fromEntry !== undefined && toEntry !== undefined) {\n return convertResolved(value, from, to, fromEntry, toEntry);\n }\n\n // Workday <-> any other Time-measure unit: pivot through \"day\" using the\n // fixed 7/5 ratio (see isWorkdayUnit's doc comment above).\n if (isWorkdayUnit(from) && isWorkdayUnit(to)) return value; // \"workday\" <-> \"workdays\" alias\n if (isWorkdayUnit(from)) {\n const days = value * WORKDAY_TO_DAY_FACTOR;\n return to === \"day\" ? days : convertUnit(days, \"day\", to);\n }\n if (isWorkdayUnit(to)) {\n const days = from === \"day\" ? value : convertUnit(value, from, \"day\");\n return days / WORKDAY_TO_DAY_FACTOR;\n }\n\n // Extended (custom) categories the base table has no measure kind for\n // (see ExtendedUnits.ts), compute the ratio directly from each unit's\n // factor-to-base value instead of calling convertRaw(), which would throw\n // on an unrecognized unit string. Every extended category is a pure linear\n // ratio scale (no Temperature-style offset), so this is always safe.\n const fExt = EXTENDED_UNITS[from];\n const tExt = EXTENDED_UNITS[to];\n if (fExt !== undefined && tExt !== undefined) {\n return value * (fExt.toBase / tExt.toBase);\n }\n\n // One side extended, the other in the base table, sharing a measure. Convert\n // through the measure's base unit, which both tables state their ratios\n // against: an extended length declares its `toBase` in metres, and the\n // generated table's length ratios are metres too.\n if (fExt !== undefined && bridgesToBaseMeasure(from, to)) {\n return convertRaw(value * fExt.toBase, baseUnitFor(to), to);\n }\n if (tExt !== undefined && bridgesToBaseMeasure(to, from)) {\n return convertRaw(value, from, baseUnitFor(from)) / tExt.toBase;\n }\n\n // Offsets, cross-measure rejection and the unknown-unit throw all live in\n // convertRaw. Nothing is layered on top here any more.\n return convertRaw(value, from, to);\n}\n\n/**\n * The unit a measure states its ratios against, found from any unit in it.\n *\n * Read out of the table rather than hard-coded, so it cannot drift from the\n * ratios it has to agree with: the base is whichever unit of that measure has\n * a ratio of exactly one.\n */\nfunction baseUnitFor(unit: string): string {\n const entry = lookupUnit(resolveUnit(unit));\n if (entry === undefined) return unit;\n\n for (const symbol of Object.keys(UNIT_TABLE)) {\n const candidate = UNIT_TABLE[symbol];\n if (candidate[0] === entry[0] && candidate[1] === 1) return symbol;\n }\n return unit;\n}\n\n/**\n * List every unit symbol in the same measure/dimension as `unit` (wiki:\n * Units-Of-Measurement, \"Conversion Possibilities\", `sourceUnit to ?`\n * e.g. `cm to ?\"` → every Length unit). Excludes `unit` itself.\n *\n * Reads MEASURE_SYMBOLS, which is a curated symbols-only vocabulary and\n * deliberately NOT the keys of the unit table filtered by kind. The two\n * differ: Volume's symbols include `c` and `pt` but not `cup`/`cups`, and\n * Time's include `wk` and `mo` but not `week`/`month`. Deriving this list\n * from the unit table instead would roughly quadruple every answer.\n *\n * @returns `[]` if `unit` isn't recognized, rather than throwing.\n */\nexport function getConvertiblePossibilities(unit: string): string[] {\n const resolved = resolveUnit(unit);\n const entry = lookupUnit(resolved);\n if (entry === undefined) return [];\n const symbols = MEASURE_SYMBOLS[entry[0]];\n if (!symbols) return [];\n return symbols.filter((s) => s !== resolved);\n}\n\n/** Check whether `unit` is a unit the conversion tables recognize. Never throws. */\nexport function isConvertibleUnit(unit: string): boolean {\n if (isWorkdayUnit(unit)) return true;\n if (EXTENDED_UNITS[unit]) return true;\n return lookupUnit(resolveUnit(unit)) !== undefined;\n}\n\n/**\n * Convert `value` (in `unit`) to whichever unit of the same measure gives\n * the most human-readable magnitude, e.g. 1500 metres becomes 1.5 km. Falls\n * back to returning `value`/`unit` unchanged if `unit` isn't recognized,\n * which is what every extended unit and workday does.\n *\n * Note the chosen unit is drawn from the best-unit lists, which are not\n * restricted to spellings the lexer accepts: 0.5 l reports \"mL\".\n */\nexport function getBestUnit(value: number, unit: string): { value: number; unit: string } {\n const u = resolveUnit(unit);\n try {\n const result = convertToBestMetric(value, u);\n return { value: result.quantity, unit: result.unit };\n } catch {\n return { value, unit: u };\n }\n}\n\n// ── Rate and derived-unit conversion ───────────────────────────────────────\n//\n// A rate value carries a compound unit spelled \"numerator/denominator\" (e.g.\n// \"km/h\", \"m/s\"), see vm/Value.ts's rateValue(). Plain convertUnit() cannot\n// touch one, because neither half is the whole unit and getMeasure(\"km/h\") is\n// undefined. This section converts a rate to another rate, and bridges a rate\n// to the single-token speed spellings (mph, kph, mps, ...) that ExtendedUnits.ts\n// already carries, so \"100 km/h in mph\" and \"60 mph in km/h\" resolve instead of\n// reporting incompatible units.\n\n/** A rate reduced to a numerator unit over a denominator unit. */\ninterface RateForm {\n /** Magnitude, scaled so `value numerator/denominator` is the physical quantity. */\n value: number;\n /** Numerator unit spelling, or `\"\"` for a countless rate such as `30/week`. */\n numerator: string;\n /** Denominator unit spelling. */\n denominator: string;\n}\n\n/**\n * Express `value unit` as a numerator/denominator rate, or `null` when `unit`\n * is neither a compound rate spelling nor a single-token speed alias.\n *\n * A speed alias (mph, kph, ...) is one unit standing for a length/time rate, so\n * it expands to the base pair `m`/`s` with its value scaled by the alias's\n * metres-per-second factor. That collapses both inputs to one shape, so a\n * single routine handles rate/rate and rate/alias without a second code path.\n */\nfunction expandUnitToRate(value: number, unit: string): RateForm | null {\n const slash = unit.indexOf(\"/\");\n if (slash >= 0) {\n return { value, numerator: unit.slice(0, slash), denominator: unit.slice(slash + 1) };\n }\n const ext = EXTENDED_UNITS[unit];\n if (ext !== undefined && ext.measure === \"speed\") {\n // 1 alias == ext.toBase m/s, so `value alias` is `value * toBase` m/s.\n return { value: value * ext.toBase, numerator: \"m\", denominator: \"s\" };\n }\n return null;\n}\n\n/**\n * The factor that turns one `from` into `to` along a single rate axis, or\n * `null` when the two cannot line up.\n *\n * Same spelling needs no conversion. A countless axis (`\"\"`) only lines up with\n * another countless one, never with a real unit. Otherwise both sides must name\n * the same measure, which is what keeps a length numerator from pairing with a\n * mass one.\n */\nfunction rateAxisFactor(from: string, to: string): number | null {\n if (from === to) return 1;\n if (from === \"\" || to === \"\") return null;\n const fromMeasure = getMeasure(from);\n const toMeasure = getMeasure(to);\n if (fromMeasure === undefined || toMeasure === undefined || fromMeasure !== toMeasure) {\n return null;\n }\n return convertUnit(1, from, to);\n}\n\n/**\n * Convert `value` from a rate/speed unit `from` to a rate/speed unit `to`,\n * returning the converted magnitude, or `null` when the pair is not\n * rate-convertible (so the caller falls back to its own incompatible-units\n * handling).\n *\n * Handles rate to rate (`10 m/s in km/h`), rate to speed alias\n * (`100 km/h in mph`) and speed alias to rate (`60 mph in km/h`). Plain\n * same-measure pairs (`kph in mph`, `km in miles`) never reach here, they are\n * resolved by {@link convertUnit} first.\n *\n * The rule is the ordinary one for a quotient of quantities: convert the\n * numerator and the denominator each on their own, so `A/B -> C/D` scales by\n * `(A->C) / (B->D)`.\n */\nexport function convertRate(value: number, from: string, to: string): number | null {\n const source = expandUnitToRate(value, from);\n if (source === null) return null;\n\n // The target is either a rate spelling or a single-token speed alias. An\n // alias expands to the base m/s pair, and `targetScale` is what the base-form\n // magnitude is divided by to read out in the alias itself.\n let targetNumerator: string;\n let targetDenominator: string;\n let targetScale: number;\n const slash = to.indexOf(\"/\");\n if (slash >= 0) {\n targetNumerator = to.slice(0, slash);\n targetDenominator = to.slice(slash + 1);\n targetScale = 1;\n } else {\n const ext = EXTENDED_UNITS[to];\n if (ext === undefined || ext.measure !== \"speed\") return null;\n targetNumerator = \"m\";\n targetDenominator = \"s\";\n targetScale = ext.toBase;\n }\n\n const numeratorFactor = rateAxisFactor(source.numerator, targetNumerator);\n if (numeratorFactor === null) return null;\n const denominatorFactor = rateAxisFactor(source.denominator, targetDenominator);\n if (denominatorFactor === null) return null;\n\n return (source.value * numeratorFactor) / denominatorFactor / targetScale;\n}\n"]}
@@ -1,2 +0,0 @@
1
- import {c as c$1}from'./chunk-YAYBVVG2.js';import {ga,C,z,B as B$1,E,p,i,j,r,s,qa,l,h,g,f,e as e$1,k as k$1,Q as Q$1,V,ha,la,ra,ja as ja$1,ma,J as J$1,w,o,a as a$1,d,u as u$1,W,Y,F,_ as _$1,da,ca,ba,$,L,O as O$2,c as c$3,na,pa,ka,ia,oa,v as v$1,q as q$1,m,b,A,n as n$1,K as K$1,fa,I,H as H$1,G,N,t as t$1,D,P as P$2,y,x,M as M$1}from'./chunk-VYWGUMFW.js';import {P as P$1,O as O$1,p as p$1,q,J,n,s as s$1,u,C as C$1,v,H,M,t,r as r$1}from'./chunk-IO374J6Z.js';import {c,e}from'./chunk-WGZ3FNHI.js';import {a}from'./chunk-2JMFUQZH.js';import {c as c$2}from'./chunk-MPB7KUN5.js';function Yt(e,t){let n=t===2?L:M$1,o=n(e.n),r=n(e.d);return o===null||r===null?null:{n:o,d:r}}function Gt(e,t){let n=y(e),o=new Map;for(let[r,i]of n){if(i%t!==0)return null;o.set(r,i/t);}return x(o)}function jn(e,t){let n=y(e);for(let[o,r]of y(t))n.set(o,(n.get(o)??0)+r);return x(n)}function jt(e,t){let n=y(e);for(let[o,r]of y(t)){let i=(n.get(o)??0)-r;i<=0?n.delete(o):n.set(o,i);}return x(n)}function Kn(e,t){let n=y(e),o=new Map;for(let[r,i]of y(t)){let a=n.get(r);a!==void 0&&o.set(r,Math.min(a,i));}return x(o)}function Xn(e){let t=new Set;for(let n of e)for(let o of y(n).keys())t.add(o);return [...t].sort()}function Q(e){let t=new Map;for(let n of e)t.set(n.key,n.coefficient);return E({terms:t,vars:Xn(e.map(n=>n.key))})}function Ze(e){let t=e[0];for(let n=1;n<e.length;n++)t={kind:"mul",left:t,right:e[n]};return t}function Zn(e){return [...e.terms].map(([n,o])=>({key:n,coefficient:o})).sort((n,o)=>D(n.key,o.key,e.vars))}function Zt(e){if(e.vars.length<2)return null;let t=Zn(e);return t.length===2?Hn(t[0],t[1]):t.length===3?Wn(t):t.length===4?Qn(t):null}function Hn(e,t){let n=e.coefficient.n>0n,o=t.coefficient.n>0n;if(!n)return null;let r=He(e,t,2);if(r!==null&&!o)return Ze([Q([r.a,Te(r.b)]),Q([r.a,r.b])]);let i=He(e,t,3);if(i===null)return null;let a=Q(o?[i.a,i.b]:[i.a,Te(i.b)]),u=o?Te(Oe(i.a,i.b)):Oe(i.a,i.b);return Ze([a,Q([Kt(i.a),u,Kt(i.b)])])}function He(e,t,n){let o=t.coefficient.n<0n?j(t.coefficient):t.coefficient,r=Yt(e.coefficient,n),i=Yt(o,n);if(r===null||i===null)return null;let a=Gt(e.key,n),u=Gt(t.key,n);return a===null||u===null?null:{a:{key:a,coefficient:r},b:{key:u,coefficient:i}}}function Te(e){return {key:e.key,coefficient:j(e.coefficient)}}function Oe(e,t){return {key:jn(e.key,t.key),coefficient:h(e.coefficient,t.coefficient)}}function Kt(e){return Oe(e,e)}function Wn(e){let[t,n,o]=e;if(t.coefficient.n<0n||o.coefficient.n<0n)return null;let r=He(t,o,2);if(r===null)return null;let i$1=Oe(r.a,r.b);if(i$1.key!==n.key)return null;let a=h(i$1.coefficient,{n:2n,d:1n}),u=n.coefficient.n<0n,l=u?j(n.coefficient):n.coefficient;return m(i(l,a))?{kind:"pow",base:Q([r.a,u?Te(r.b):r.b]),exponent:p(2)}:null}function Qn(e){let t=[[[0,1],[2,3]],[[0,2],[1,3]],[[0,3],[1,2]]];for(let n of t){let o=Xt(e[n[0][0]],e[n[0][1]]),r=Xt(e[n[1][0]],e[n[1][1]]);if(!(o===null||r===null)&&zn(o.cofactor,r.cofactor))return Ze([Q([o.common,r.common]),Q(o.cofactor)])}return null}function Xt(e,t){let n=Kn(e.key,t.key),o={key:n,coefficient:e.coefficient},r=[{key:jt(e.key,n),coefficient:{n:1n,d:1n}},{key:jt(t.key,n),coefficient:i(t.coefficient,e.coefficient)}];return r[0].key===r[1].key?null:{common:o,cofactor:r}}function zn(e,t){return e.length!==t.length?false:e.every((n,o)=>n.key===t[o].key&&n.coefficient.n===t[o].coefficient.n&&n.coefficient.d===t[o].coefficient.d)}var Jn=12,_e=4096;function we(e,t){let n=e<0n?-e:e,o=t<0n?-t:t;for(;o!==0n;){let r=n%o;n=o,o=r;}return n}function Wt(e,t){return e===0n||t===0n?0n:e/we(e,t)*t}function Ht(e){let t=e<0n?-e:e;if(t===0n)return null;let n=[];for(let o=1n;o*o<=t;o++){if(t%o!==0n)continue;n.push(o);let r=t/o;if(r!==o&&n.push(r),n.length>_e)return null}return n}function Qt(e,t){let n=a$1;for(let o of e)n=f(h(n,t),o);return n}function eo(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(f(e[o],h(n[o-1],t)));return n}function ue(e){if(e.length<2)return [];let t=1n;for(let s of e)t=Wt(t,s.d);let n=e.map(s=>s.n*t/s.d),o=n[0],r=n[n.length-1];if(r===0n)return [];let i=Ht(r),a=Ht(o);if(i===null||a===null)throw c$2.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial's coefficients have too many divisors to search for rational roots.",{limit:_e});if(i.length*a.length>_e)throw c$2.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial has too many candidate rational roots to test.",{limit:_e});let u=[],l$1=new Set;for(let s of i)for(let p of a)for(let h of [1n,-1n]){let x={n:h*s/we(s,p),d:p/we(s,p)},V=`${x.n}/${x.d}`;l$1.has(V)||(l$1.add(V),l(Qt(e,x))&&u.push(x));}return u}function to(e,t){return l(t)?q$1(e):t.n>0n?{kind:"sub",left:q$1(e),right:p(t)}:{kind:"add",left:q$1(e),right:p(j(t))}}function no(e,t){let n=e.length-1,o=new Map;return e.forEach((r,i)=>{if(l(r))return;let a=n-i;o.set(a===0?"":a===1?t:`${t}^${a}`,r);}),E({terms:o,vars:o.size>0?[t]:[]})}function Qe(e,t){let n=[],o=[...e],r=ue(o);for(;r.length>0&&o.length>2;){for(let a of r){let u=0;for(;o.length>1&&l(Qt(o,a));)o=eo(o,a),u++;u>0&&n.push({base:to(t,a),power:u});}r=o.length>2?ue(o):[];}return o.length-1>=1?(n.push({base:no(o,t),power:1}),{content:b,factors:n}):{content:o.length===1?o[0]:b,factors:n}}function oo(e){let t=[];m(e.content)||t.push(p(e.content));for(let o of e.factors)t.push(o.power===1?o.base:r(o.base,p({n:BigInt(o.power),d:1n})));if(t.length===0)return p(b);let n=t[0];for(let o=1;o<t.length;o++)n={kind:"mul",left:n,right:t[o]};return n}function ro(e){let t=0n,n=1n;for(let o of e.terms.values())t=we(t,o.n),n=Wt(n,o.d);return t===0n?b:{n:t,d:n}}function io(e){let t=new Map;for(let r of e.vars){let i=1/0;for(let a of e.terms.keys()){let u=ao(a,r);u<i&&(i=u);}i>0&&i!==1/0&&t.set(r,i);}if(t.size===0)return {monomial:t,reduced:e};let n=new Map;for(let[r,i]of e.terms){let a=We(r);for(let[u,l]of t)a.set(u,(a.get(u)??0)-l);n.set(uo(a),i);}let o=new Set;for(let r of n.keys())for(let i of We(r).keys())o.add(i);return {monomial:t,reduced:{terms:n,vars:[...o].sort()}}}function ao(e,t){return We(e).get(t)??0}function We(e){let t=new Map;if(e==="")return t;for(let n of e.split("*")){let o=n.indexOf("^");o===-1?t.set(n,1):t.set(n.slice(0,o),Number(n.slice(o+1)));}return t}function uo(e){return [...e.keys()].filter(n=>(e.get(n)??0)>0).sort().map(n=>e.get(n)===1?n:`${n}^${e.get(n)}`).join("*")}function lo(e){let t=[...e.keys()].sort(),n=null;for(let o of t){let r$1=e.get(o),i=r$1===1?q$1(o):r(q$1(o),p({n:BigInt(r$1),d:1n}));n=n===null?i:{kind:"mul",left:n,right:i};}return n}function zt(e){let t=C(e);if(t===null||t.terms.size===0||z(t)>Jn||t.vars.length===0)return e;let n=ro(t),o=m(n)?t:so(t,i(b,n)),{monomial:r,reduced:i$1}=io(o),a=lo(r),u=A(i$1);if(u===null){let te=Zt(i$1);return te!==null?co(n,a,te):mo(n,a,i$1)??e}let l=[...B$1(i$1,u)].reverse(),s=Qe(l,u),p$1=h(n,s.content);if(s.factors.length<=1&&(s.factors[0]?.power??1)===1&&a===null&&m(p$1))return e;let x=[];m(p$1)||x.push(p(p$1)),a!==null&&x.push(a),x.push(oo({content:b,factors:s.factors}));let V=x[0];for(let te=1;te<x.length;te++)V={kind:"mul",left:V,right:x[te]};return V}function so(e,t){let n=new Map;for(let[o,r]of e.terms)n.set(o,h(r,t));return {terms:n,vars:e.vars}}function co(e,t,n){let o=[];m(e)||o.push(p(e)),t!==null&&o.push(t),o.push(n);let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}function mo(e,t,n){if(t===null&&m(e))return null;let o=[];m(e)||o.push(p(e)),t!==null&&o.push(t),o.push(E(n));let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}var k={n:2n,d:1n},B={n:3n,d:1n},be={n:4n,d:1n};function fo(e,t,n,o){let r=j(i(t,h(B,e))),i$1=i(g(h(B,h(e,n)),h(t,t)),h(B,h(e,e))),a=h(k,h(t,h(t,t))),u=h({n:9n,d:1n},h(e,h(t,n))),l=h({n:27n,d:1n},h(h(e,e),o)),s=i(f(g(a,u),l),h({n:27n,d:1n},h(e,h(e,e))));return {p:i$1,q:s,shift:r}}function en(e,t,n,o){let{p:r,q:i,shift:a}=fo(e,t,n,o),u=j(f(h(be,h(r,h(r,r))),h({n:27n,d:1n},h(i,i))));return k$1(u,a$1)>0?{exact:[],approximate:yo(r,i,a)}:l(u)?{exact:po(r,i,a),approximate:[]}:{exact:bo(r,i,a),approximate:[]}}function po(e,t,n){if(l(e))return [p(n)];let o=f(i(h(B,t),e),n),r=f(j(i(h(B,t),h(k,e))),n);return [o,r].sort(k$1).map(p)}function bo(e,t,n){let o=j(i(t,k)),r=f(h(i(t,k),i(t,k)),h(i(e,B),h(i(e,B),i(e,B)))),i$1=O$2(r),a={kind:"call",name:"cbrt",args:[{kind:"add",left:p(o),right:i$1}]},u={kind:"call",name:"cbrt",args:[{kind:"sub",left:p(o),right:i$1}]},l={kind:"add",left:a,right:u},s={kind:"sub",left:a,right:u},p$1={kind:"add",left:p(n),right:{kind:"div",left:{kind:"neg",operand:l},right:p(k)}},h$1={kind:"mul",left:{kind:"div",left:{kind:"mul",left:s,right:O$2(B)},right:p(k)},right:w(n$1)};return [{kind:"add",left:p(n),right:l},{kind:"sub",left:p$1,right:h$1},{kind:"add",left:p$1,right:h$1}]}function yo(e,t,n){let o=e$1(e),r=e$1(t),i=e$1(n),a=2*Math.sqrt(-o/3),u=3*r/(2*o)*Math.sqrt(-3/o),l=Math.acos(Math.min(1,Math.max(-1,u)))/3;return [0,1,2].map(s=>a*Math.cos(l-2*Math.PI*s/3)+i).sort((s,p)=>s-p)}function ho(e,t,n,o){let r=j(i(e,be)),i$1=h(e,e),a=g(t,i(h(B,i$1),{n:8n,d:1n})),u=f(g(n,i(h(e,t),k)),i(h(i$1,e),{n:8n,d:1n})),l=g(f(g(o,i(h(e,n),be)),i(h(i$1,t),{n:16n,d:1n})),i(h(B,h(i$1,i$1)),{n:256n,d:1n}));return {p:a,q:u,r:l,shift:r}}function tn(e,t,n,o,r,i$1){let a=V=>i(V,e),{p:u,q:l$1,r:s,shift:p$1}=ho(a(t),a(n),a(o),a(r)),h=l(l$1)?go(u,s):Io(u,l$1,s,i$1);if(h===null)return null;let x=l(p$1)?h:h.map(V=>({kind:"add",left:p(p$1),right:V}));return {exact:No(x),approximate:[]}}function No(e){let t=new Set,n=[];for(let o of e){let r=t$1(Q$1(o));t.has(r)||(t.add(r),n.push(o));}return n}function go(e,t){let n=g(h(e,e),h(be,t));if(k$1(n,a$1)<0)return vo(e,t);let o=N(n);return o!==null?Ro(j(e),o,l(n)):xo(e,t,n)}function Ro(e,t,n){let o=n?[i(e,k)]:[i(f(e,t),k),i(g(e,t),k)],r=[];for(let i of o){if(l(i)){r.push(p(a$1));continue}let a=P$2(i);r.push({kind:"neg",operand:a},a);}return r}function xo(e,t,n){let o=p(j(e)),r=O$2(n),i=k$1(e,a$1)<=0,a=[{node:ze({kind:"add",left:o,right:r}),positive:i||k$1(t,a$1)<=0},{node:ze({kind:"sub",left:o,right:r}),positive:i&&k$1(t,a$1)>=0}],u=[];for(let{node:l,positive:s}of a){let h={kind:"call",name:"sqrt",args:[s?l:{kind:"neg",operand:l}]},x=s?h:{kind:"mul",left:h,right:w(n$1)};u.push({kind:"neg",operand:x},x);}return u}function ze(e){return {kind:"div",left:e,right:p(k)}}function vo(e,t){let n=i(j(e),k),o=N(t),r=o===null?Jt(O$2(t),n):O$2(i(f(o,n),k)),a={kind:"mul",left:o===null?Jt(O$2(t),j(n)):O$2(i(g(o,n),k)),right:w(n$1)},u={kind:"add",left:r,right:a},l={kind:"sub",left:r,right:a};return [{kind:"neg",operand:u},{kind:"neg",operand:l},l,u]}function Jt(e,t){let n=t.n>=0n?{kind:"add",left:e,right:p(t)}:{kind:"sub",left:e,right:p(j(t))};return {kind:"call",name:"sqrt",args:[ze(n)]}}function Io(e,t,n,o){let r=[{n:1n,d:1n},h(k,e),g(h(e,e),h(be,n)),j(h(t,t))];for(let i$1 of ue(r)){if(k$1(i$1,a$1)<=0)continue;let a=N(i$1);if(a===null)continue;let u=f(e,i$1),l=i(t,a),s=i(g(u,l),k),p=i(f(u,l),k),h={n:1n,d:1n};return [...o(h,a,s),...o(h,j(a),p)]}return null}var Mo=200,So=1e-14,Eo=1e-10,Ao=1e-10,nn=1e-9,ko=1e-8,Vo=4;function ye(e,t){return {re:e.re-t.re,im:e.im-t.im}}function To(e,t){return {re:e.re*t.re-e.im*t.im,im:e.re*t.im+e.im*t.re}}function rn(e,t){if(Math.abs(t.re)>=Math.abs(t.im)){let r=t.im/t.re,i=t.re+t.im*r;return {re:(e.re+e.im*r)/i,im:(e.im-e.re*r)/i}}let n=t.re/t.im,o=t.re*n+t.im;return {re:(e.re*n+e.im)/o,im:(e.im*n-e.re)/o}}function K(e){return Math.hypot(e.re,e.im)}function De(e,t){let n=0,o=0;for(let r of e){let i=n*t.re-o*t.im+r;o=n*t.im+o*t.re,n=i;}return {re:n,im:o}}function Oo(e,t){let n=K(t),o=0;for(let r of e)o=o*n+Math.abs(r);return o}function _o(e){let t=e.length-1,n=[];for(let o=0;o<t;o++)n.push(e[o]*(t-o));return n}function wo(e){let t=[...e].reverse(),o=[...K$1(t)].reverse().map(e$1);return o.some(r=>!Number.isFinite(r))?null:o}function Do(e){let t=e.length-1,n=0;for(let a=1;a<e.length;a++)n=Math.max(n,Math.abs(e[a]));let o=1+n,r=-e[1]/t,i=[];for(let a=0;a<t;a++){let u=2*Math.PI*a/t+Math.PI/(2*t);i.push({re:r+o*Math.cos(u),im:o*Math.sin(u)});}return i}function Co(e){let t=e.length-1,n=Do(e);for(let o=0;o<Mo;o++){let r=0,i=1;for(let a=0;a<t;a++){let u={re:1,im:0};for(let s=0;s<t;s++)a!==s&&(u=To(u,ye(n[a],n[s])));if(u.re===0&&u.im===0){n[a]={re:n[a].re+1e-6*(a+1),im:n[a].im+1e-6};continue}let l=rn(De(e,n[a]),u);if(!Number.isFinite(l.re)||!Number.isFinite(l.im))return null;n[a]=ye(n[a],l),r=Math.max(r,K(l)),i=Math.max(i,K(n[a]));}if(r<=So*i)return n}return null}function on(e,t,n){let o=n;for(let r=0;r<Vo;r++){let i=De(t,o);if(i.re===0&&i.im===0)break;let a=ye(o,rn(De(e,o),i));if(!Number.isFinite(a.re)||!Number.isFinite(a.im))break;o=a;}return o}function Po(e,t,n){let o=Math.max(1,K(n));if(n.im!==0&&Math.abs(n.im)<=nn*o){let r=on(e,t,{re:n.re,im:0});if(Je(e,r))return {re:r.re,im:0}}if(n.re!==0&&Math.abs(n.re)<=nn*o){let r=on(e,t,{re:0,im:n.im});if(Je(e,r))return {re:0,im:r.im}}return n}function Je(e,t){return !Number.isFinite(t.re)||!Number.isFinite(t.im)?false:K(De(e,t))<=Eo*Oo(e,t)}function Lo(e){let t=[...e],n=t.map(o=>o.im===0);for(let o=0;o<t.length;o++){if(n[o])continue;let r={re:t[o].re,im:-t[o].im},i=-1,a=Number.POSITIVE_INFINITY;for(let p=o+1;p<t.length;p++){if(n[p])continue;let h=K(ye(t[p],r));h<a&&(a=h,i=p);}if(i===-1||a>ko*Math.max(1,K(t[o])))continue;let u=(t[o].re+t[i].re)/2,l=(Math.abs(t[o].im)+Math.abs(t[i].im))/2,s=t[o].im<0?-1:1;t[o]={re:u,im:s*l},t[i]={re:u,im:-s*l},n[o]=true,n[i]=true;}return t}function Fo(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let o=Math.max(1,K(e[t]),K(e[n]));if(K(ye(e[t],e[n]))<=Ao*o)return false}return true}function an(e){let t=wo(e);if(t===null)return null;if(t.length<2)return [];let n=Co(t);if(n===null)return null;let o=_o(t),r=Lo(n).map(i=>Po(t,o,i));for(let i of r)if(!Je(t,i))return null;return Fo(r)?[...r].sort((i,a)=>i.re-a.re||i.im-a.im):null}var un=8;function Uo(e,t){let n=a$1;for(let o of e)n=f(h(n,t),o);return n}function $o(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(f(e[o],h(n[o-1],t)));return n}function ln(e,t,n){let o=g(h(t,t),h(Yo(),h(e,n))),r=h(qo(),e);if(k$1(o,a$1)<0)return Bo(j(t),o,r);if(l(o))return [p(i(j(t),r))];let i$1=L(o.n),a=L(o.d);if(i$1!==null&&a!==null){let h={n:i$1,d:a},x=i(f(j(t),h),r),V=i(g(j(t),h),r);return k$1(V,x)<=0?[p(V),p(x)]:[p(x),p(V)]}let u=O$2(o),l$1=k$1(r,a$1)>0,s={kind:"div",left:{kind:"sub",left:p(j(t)),right:u},right:p(r)},p$1={kind:"div",left:{kind:"add",left:p(j(t)),right:u},right:p(r)};return l$1?[s,p$1]:[p$1,s]}function Bo(e,t,n){let o$1=j(t),r=L(o$1.n),i$1=L(o$1.d);if(r!==null&&i$1!==null){let s=i({n:r,d:i$1},n),p=i(e,n);return [w(o(p,j(s))),w(o(p,s))]}let a=i(e,n),u=i(o$1,h(n,n)),l$1={kind:"mul",left:O$2(u),right:w(n$1)};return l(a)?[{kind:"neg",operand:l$1},l$1]:[{kind:"sub",left:p(a),right:l$1},{kind:"add",left:p(a),right:l$1}]}function qo(){return {n:2n,d:1n}}function Yo(){return {n:4n,d:1n}}function Go(e){return {re:e,im:0}}function sn(e,t,n){let o=C({kind:"sub",left:e,right:t});if(o===null)return {kind:"unsupported",reason:"this is not a polynomial equation (it divides by an unknown, or calls a function of one)"};let r=o.vars.filter(u=>u!==n),i=z(o,n);if(r.length>0)return i!==1?{kind:"unsupported",reason:`solving for "${n}" needs the equation to be linear in it when other unknowns (${r.join(", ")}) are present`}:jo(o,n);if(i===0)return o.terms.size===0?{kind:"identity"}:{kind:"contradiction"};if(i>un)return {kind:"unsupported",reason:`degree ${i} is above the supported maximum of ${un}`};let a=[...B$1(o,n)].reverse();return Zo(a)}function jo(e,t){let n=new Map,o=new Map;for(let[u,l]of e.terms){let s=u.split("*").filter(h=>h.length>0),p=s.indexOf(t);p===-1?o.set(u,l):(s.splice(p,1),n.set(s.join("*"),l));}let r=u=>{let l=new Set;for(let s of u.keys())for(let p of s.split("*"))p.length>0&&l.add(p.split("^")[0]);return [...l].sort()},i=E({terms:n,vars:r(n)});return {kind:"roots",exact:[{kind:"div",left:{kind:"neg",operand:E({terms:o,vars:r(o)})},right:i}],approximate:[]}}function Ko(e){return e.length===4?en(e[0],e[1],e[2],e[3]):e.length===5?tn(e[0],e[1],e[2],e[3],e[4],ln):null}function Xo(e){let t=[],n=[...e],o=0;for(;n.length>1&&l(n[n.length-1]);)n=n.slice(0,-1),o++;for(o>0&&t.push(a$1);n.length>1;){let r=ue(n);if(r.length===0)break;for(let i of r){let a=0;for(;n.length>1&&l(Uo(n,i));)n=$o(n,i),a++;a>0&&t.push(i);}}return {roots:t.sort(k$1),remaining:n}}function Zo(e){let{roots:t,remaining:n}=Xo(e),o=t.map(p),r=[],i$1=n.length-1,a=e.length-n.length;if(i$1<=0)return le(o,r,a,0,"");if(i$1===1)return o.push(p(i(j(n[1]),n[0]))),le(o,r,a+1,0,"");if(i$1===2)return o.push(...ln(n[0],n[1],n[2])),le(o,r,a+2,0,"");let u=Ko(n);if(u!==null)return o.push(...u.exact),r.push(...u.approximate.map(Go)),le(o,r,a+i$1,0,"");let l=an(n);return l!==null?(r.push(...l),le(o,r,a+i$1,0,"")):le(o,r,a,i$1,`a degree-${i$1} factor of it has no exact solution here and the numerical method did not converge on that factor`)}function le(e,t,n,o,r){let i=e.length+t.length,a=n>=1&&(i<1||i>n);return o>0||a?{kind:"incomplete",exact:e,approximate:t,missing:a?Math.max(1,n+o-i):o,reason:a?`${i} root${i===1?"":"s"} were produced for a degree-${n+o} equation, which does not add up`:r}:{kind:"roots",exact:e,approximate:t}}var cn={0:"sqrt",1:"abs",2:"sin",3:"cos",4:"tan",5:"log",6:"ceil",7:"floor",8:"round",11:"asin",12:"acos",13:"atan",14:"atan2",15:"sinh",16:"cosh",17:"tanh",18:"asinh",19:"acosh",20:"atanh",21:"cbrt",23:"expm1",24:"exp",26:"hypot",28:"log10",29:"log1p",30:"log2",33:"sign",34:"trunc",35:"degtorad",36:"radtodeg",61:"root",62:"fact"},Ho=31,hi=new Set([67,68,69,70,71,72,73,74,75,76,77,78,79]);function O(e){if(e.type===9)return e.value;if(e.type===13||e.type===12)return null;let t=e.toNumber();return Number.isFinite(t)?p(d(t)):null}function _(e){let t=Q$1(e);return t.kind==="const"?n(e$1(t.value)):J(t)}function Ce(e){return O$1("SYMBOLIC_UNSUPPORTED_FUNCTION",`"${e}" cannot be applied to an expression that still contains an unknown.`)}function Ni(e,t){let n=O(e),o=O(t);return n===null||o===null?Ce("^"):_(r(n,o))}function gi(e){let t=O(e);return t===null?Ce("-"):_({kind:"neg",operand:t})}function Ri(e,t){let n=[];for(let r of t){let i=P$1(r);if(i)return i;let a=O(r);if(a===null)return Ce(cn[e]??`builtin ${e}`);n.push(a);}if(e===Ho&&n.length===2)return _(r(n[0],n[1]));let o=cn[e];return o===void 0?Ce(`builtin ${e}`):_(s(o,n))}function Wo(e){let t=_(e);return t.type===0&&!Number.isInteger(t.toNumber())?J(e):t}function Qo(e){return e.im===0?n(e.re):J(w(o(d(e.re),d(e.im))))}function zo(e){switch(e.kind){case "identity":return t("true for every value");case "contradiction":return t("no solution");case "unsupported":return O$1("SYMBOLIC_SOLVE_UNSUPPORTED",`Cannot solve this equation: ${e.reason}.`);case "incomplete":{let t=e.exact.length+e.approximate.length;return O$1("SYMBOLIC_SOLVE_INCOMPLETE",`Only ${t} of this equation's ${t+e.missing} roots could be found: ${e.reason}.`)}case "roots":{let t$1=e.exact.map(Wo);for(let n of e.approximate)t$1.push(Qo(n));return t$1.length===0?t("no solution"):t$1.length===1?t$1[0]:C$1(1,t$1.length,t$1.map(n=>n.type===9?n.value:n.toNumber()))}}}function fn(e,t,n){let o=O(e),r=O(t);return o===null||r===null?O$1("SYMBOLIC_NONFINITE_OPERAND","An equation side has no exact value to solve with."):zo(sn(o,r,n))}function he(e$1,t){if(e$1.type===6&&t.type===6){if(e$1.unit===t.unit)return {lv:e$1.toNumber(),rv:t.toNumber(),unit:e$1.unit,sameMeasure:true};let n=c(e$1.unit),o=c(t.unit),r=c$1.isCurrency(e$1.unit)&&c$1.isCurrency(t.unit);if(n&&n===o){let i=e(t.toNumber(),t.unit,e$1.unit);return {lv:e$1.toNumber(),rv:i,unit:e$1.unit,sameMeasure:true}}if(r){let i=c$1.convertSync(t.toNumber(),t.unit,e$1.unit);if(i!==null)return {lv:e$1.toNumber(),rv:i,unit:e$1.unit,sameMeasure:true}}return {lv:e$1.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:false}}return e$1.type===6?{lv:e$1.toNumber(),rv:t.toNumber(),unit:e$1.unit,sameMeasure:true}:t.type===6?{lv:e$1.toNumber(),rv:t.toNumber(),unit:t.unit,sameMeasure:true}:{lv:e$1.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:true}}var Jo=1e-12;function er(e,t,n){let o=0;return Number.isFinite(e)&&Math.abs(e)>o&&(o=Math.abs(e)),Number.isFinite(t)&&Math.abs(t)>o&&(o=Math.abs(t)),Number.isFinite(n)&&Math.abs(n)>o&&(o=Math.abs(n)),o}function Oi(e,t){let{lv:n,rv:o,sameMeasure:r}=he(e,t);if(!r)return {lv:n,rv:o,equal:false,sameMeasure:false};if(e.type===6&&t.type===6&&e.unit!==void 0&&e.unit===t.unit&&e.exact!==void 0&&t.exact!==void 0&&c$1.isCurrency(e.unit))return {lv:n,rv:o,equal:qa(e.exact,t.exact)===0,sameMeasure:true};if(n===o)return {lv:n,rv:o,equal:true,sameMeasure:true};if(!Number.isFinite(n)||!Number.isFinite(o))return {lv:n,rv:o,equal:false,sameMeasure:true};let i=er(n,o,t.toNumber());return {lv:n,rv:o,equal:Math.abs(n-o)<=i*Jo,sameMeasure:true}}var tr={time:"duration",luminousIntensity:"luminous intensity"},nr=new Set(["money","data"]),or={add:"added",sub:"subtracted",mul:"multiplied",div:"divided"};function Pe(e){if(c$1.isCurrency(e))return "money";let t=c(e);if(t!==void 0)return tr[t]??t}function dn(e){return nr.has(e)?e:/^[aeiou]/.test(e)?`an ${e}`:`a ${e}`}function Fe(e,t,n){let o=e===void 0?void 0:Pe(e),r=t===void 0?void 0:Pe(t);if(o!==void 0&&r!==void 0&&o!==r)return `${o} and ${r} cannot be ${n}`}function rr(e){return e!==void 0?or[e]??"combined":"combined"}function _i(e,t){let n=Pe(e),o=Pe(t);if(n!==void 0&&o!==void 0&&n!==o)return `${dn(n)} cannot be converted to ${dn(o)}`}function wi(e,t){let n=e.type===6?e.unit:void 0,o=t.type===6?t.unit:void 0,r=Fe(n,o,"compared");return O$1("INCOMPATIBLE_UNITS",r??`Cannot compare incompatible units: ${n??"?"} and ${o??"?"}`)}function pn(e){if(e.type===2)return e.value;let t=e.toNumber();if(!Number.isInteger(t)){let n=Number.isNaN(t)?"NaN":String(t);throw c$2.execution("BIGINT_INEXACT_OPERAND",`A whole-number (n) value can only be combined with another whole number, and ${n} is not one`,{operand:n})}return BigInt(t)}function Di(){return c$2.execution("BIGINT_DIVISION_BY_ZERO","Division by zero: a whole-number (n) division is exact integer division, which has no answer at zero, unlike 1 / 0 which is Infinity")}function Ci(e,t){let n=bn(e),o=bn(t);return n===null||o===null?null:n<o?-1:n>o?1:0}function bn(e){if(e.type===2)return e.value;let t=e.toNumber();return Number.isInteger(t)?BigInt(t):null}function et(e,t){return Number.isFinite(t)?Math.pow(e,t):e===1||e===-1&&!Number.isNaN(t)?1:Math.pow(e,t)}function yn(e){return e.exact!==void 0?e.exact:ha(e.toNumber())}function ir(e,t,n){let o=e.type===6&&e.unit!==void 0&&e.exact!==void 0&&c$1.isCurrency(e.unit),r=t.type===6&&t.unit!==void 0&&t.exact!==void 0&&c$1.isCurrency(t.unit);if(!o&&!r)return null;let i,a,u;if(o&&r){if(e.unit!==t.unit||n==="div")return null;i=e.exact,a=t.exact,u=e.unit;}else if(o&&t.type!==6)i=e.exact,u=e.unit,a=yn(t);else if(r&&e.type!==6)a=t.exact,u=t.unit,i=yn(e);else return null;if(i===null||a===null)return null;let l;switch(n){case "add":l=ja$1(i,a);break;case "sub":l=ka(i,a);break;case "mul":l=la(i,a);break;case "div":if(na(a))return null;l=pa(i,a);break}return v(ra(l),u,l)}function Le(e){return e.rational!==void 0?e.rational:(e.type===0||e.type===1)&&typeof e.value=="number"&&Number.isInteger(e.value)?c$3(BigInt(e.value)):null}function Pi(e,t,n){let o=Le(e);if(o===null)return null;let r=Le(t);if(r===null||n==="div"&&l(r))return null;let i$1;try{switch(n){case "add":i$1=f(o,r);break;case "sub":i$1=g(o,r);break;case "mul":i$1=h(o,r);break;case "div":i$1=i(o,r);break}}catch{return null}return p$1(e$1(i$1),i$1)}function Li(e,t,n){if(e.type!==0||t.type!==0)return null;let o=e.value,r=t.value,i=e.uncertainty??0,a=t.uncertainty??0,u,l;switch(n){case "add":u=o+r,l=Math.hypot(i,a);break;case "sub":u=o-r,l=Math.hypot(i,a);break;case "mul":u=o*r,l=Math.hypot(r*i,o*a);break;case "div":u=o/r,l=Math.hypot(i/r,o*a/(r*r));break}return q(u,l)}function Fi(e,t){let n=Le(e);if(n===null)return null;let o=Le(t);return o===null?null:k$1(n,o)}function Ui(e,t,n$1,o,r){if(e.type===13)return e;if(t.type===13)return t;if(e.type===12)return e;if(t.type===12)return t;if(r&&(e.type===9||t.type===9)){let i=O(e),a=O(t);return i===null||a===null?O$1("SYMBOLIC_NONFINITE_OPERAND","A symbolic expression cannot combine with a value that has no exact number (NaN or infinity)."):J(Q$1({kind:r,left:i,right:a}))}if(e.type===0&&t.type===0)return n(n$1(e.value,t.value));if(e.type===2||t.type===2){let i=pn(e),a=pn(t);return o?s$1(o(i,a)):s$1(i+a)}if(e.type===6||t.type===6){if(r){let s=ir(e,t,r);if(s)return s}let{lv:i,rv:a,unit:u$1,sameMeasure:l}=he(e,t);if(!l){let s=e.type===6?e.unit:void 0,p=t.type===6?t.unit:void 0,h=Fe(s,p,rr(r));return O$1("INCOMPATIBLE_UNITS",h??`Cannot combine incompatible units: ${s??"?"} and ${p??"?"}`)}return u(n$1(i,a),u$1)}if(e.type===7&&t.type===7){let i=e.value,a=t.value;if(!V(i,a))return O$1("DIMENSION_MISMATCH",`Cannot combine matrices of different shapes: ${i.rows}x${i.cols} and ${a.rows}x${a.cols}`);let u=new Array(i.data.length);for(let l=0;l<i.data.length;l++)u[l]=n$1(i.data[l],a.data[l]);return C$1(i.rows,i.cols,u)}if(e.type===7){let i=e.value,a=t.toNumber(),u=i.data.map(l=>n$1(l,a));return C$1(i.rows,i.cols,u)}if(t.type===7){let i=t.value,a=e.toNumber(),u=i.data.map(l=>n$1(a,l));return C$1(i.rows,i.cols,u)}return n(n$1(e.toNumber(),t.toNumber()))}var hn=254,Nn=200,Ne=class{constructor(){this.handlers=new Map;this.nextOpcode=Nn+1;}register(t){this.handlers.set(t.opcode,t.handler);}unregister(t){this.handlers.delete(t);}get(t){return this.handlers.get(t)}has(t){return this.handlers.has(t)}allocateOpcode(){if(this.nextOpcode>hn)throw c$2.config("OPCODE_POOL_EXHAUSTED",`OpRegistry: dynamic opcode pool exhausted (max ${hn-Nn} allocations).`);return this.nextOpcode++}},qi=new Ne;var Rn=ga(1);function ge(e,t){return c$1.isCurrency(t)?e.exact??ha(e.toNumber()):null}function tt(e){if(!Number.isFinite(e))return null;if(Number.isInteger(e))return ga(BigInt(e));let t=String(e);return /^-?\d+\.\d+$/.test(t)?ia(t):null}function xn(e,t,n){let o=ge(e,n),r=tt(t);if(o!==null&&r!==null){let i=la(o,r);return v(ra(i),n,i)}return u(e.toNumber()*t,n)}function vn(e,t,n,o){let r=ge(e,t),i=tt(n);if(r!==null&&i!==null){let a=ja$1(Rn,o===1?i:ma(i)),u=la(r,a);return v(ra(u),t,u)}return u(e.toNumber()*(1+o*n),t)}function In(e){let t=tt(e);return t===null?null:ja$1(Rn,t)}function Mn(e,t,n){let o=ge(e,t),r=In(n);if(o===null||r===null||na(r))return null;let i=pa(o,r);return v(ra(i),t,i)}function Sn(e,t,n){let o=ge(e,t),r=In(n);if(o===null||r===null||na(r))return null;let i=ka(o,pa(o,r));return v(ra(i),t,i)}function En(e,t){let n=e.unit,o=n!==void 0&&c$1.isCurrency(n)?ar(e,n):null;if(o===null)return {unit:n,shares:[{value:e.toNumber()/t,count:t}]};let r=BigInt(t),i=o/r,a=o-i*r,u=Number(a<0n?-a:a),l=o<0n?-1n:1n,s=gn(i,t-u);return u===0?{unit:n,shares:[s]}:{unit:n,shares:[s,gn(i+l,u)]}}function gn(e,t){let n=fa(e,2);return {value:ra(n),exact:n,count:t}}function ar(e,t){let n=ge(e,t);return n===null?null:oa(n,2).coef}var ur=12;function An(e,t){if(e.length===0||t.length===0)return [];let n=new Array(e.length+t.length-1).fill(a$1);return e.forEach((o,r)=>{t.forEach((i,a)=>{n[r+a]=f(n[r+a],h(o,i));});}),n}function lr(e,t){let n=[b];for(let o=0;o<t;o++)n=An(n,e);return n}function nt(e,t){return e.map(n=>i(n,t))}function sr(e,t){let n=[],o=0;for(;o<e.length&&l(e[o]);)o++;o>0&&n.push({base:[a$1,b],power:o});let r=e.slice(o);if(r.length>1){let i=Qe([...r].reverse(),t);for(let a of i.factors){let u=C(a.base);if(u===null)return null;n.push({base:[...B$1(u,t)],power:a.power});}}return n.length>0?n:null}function cr(e){let t=[];return e.forEach((n,o)=>{let r=n.base.length-1;for(let i=1;i<=n.power;i++)for(let a=0;a<r;a++)t.push({factor:o,power:i,degree:a});}),t}function mr(e,t,n){let o=lr(t[e.factor].base,e.power),{quotient:r,remainder:i}=H$1(n,o);if(!G(i))return null;let a=new Array(e.degree).fill(a$1);return a.push(b),An(r,a)}function fr(e,t){let n=t.length;for(let o=0;o<n;o++){let r=-1;for(let i=o;i<n;i++)if(!l(e[i][o])){r=i;break}if(r===-1)return null;[e[o],e[r]]=[e[r],e[o]],[t[o],t[r]]=[t[r],t[o]];for(let i$1=0;i$1<n;i$1++){if(i$1===o||l(e[i$1][o]))continue;let a=i(e[i$1][o],e[o][o]);for(let u=o;u<n;u++)e[i$1][u]=g(e[i$1][u],h(a,e[o][u]));t[i$1]=g(t[i$1],h(a,t[o]));}}return t.map((o,r)=>i(o,e[r][r]))}function ot(e,t,n){if(t.length<2||t.length-1>ur)return null;let o=I(e,t),r=o.length>1?H$1(e,o).quotient:[...e],i=o.length>1?H$1(t,o).quotient:[...t];if(i.length===1)return {polynomial:nt(r,i[0]),terms:[]};if(i.length===0)return null;let a=i[i.length-1],u=nt(i,a),l=nt(r,a),{quotient:s,remainder:p}=H$1(l,u);if(G(p))return {polynomial:s,terms:[]};let h=sr(u,n);if(h===null)return null;let x=dr(h,u,p);return x===null?null:{polynomial:s,terms:x}}function dr(e,t,n){let o=cr(e),r=t.length-1;if(o.length!==r)return null;let i=[];for(let s of o){let p=mr(s,e,t);if(p===null)return null;i.push(p);}let a=[];for(let s=0;s<r;s++)a.push(i.map(p=>p[s]??a$1));let u=[];for(let s=0;s<r;s++)u.push(n[s]??a$1);let l=fr(a,u);return l===null?null:pr(o,l,e)}function pr(e,t,n){let o=new Map;e.forEach((i,a)=>{let u=`${i.factor}:${i.power}`,l=o.get(u)??[];l[i.degree]=t[a],o.set(u,l);});let r=[];for(let[i,a]of o){let[u,l$1]=i.split(":").map(Number),s=[...a].map(p=>p??a$1);s.every(l)||r.push({numerator:s,base:n[u].base,power:l$1});}return r}function Re(e,t){let n=new Map;return e.forEach((o,r)=>{l(o)||n.set(r===0?"":r===1?t:`${t}^${r}`,o);}),n.size===0?p(a$1):E({terms:n,vars:e.length>1?[t]:[]})}function kn(e){let t=rt(e);if(t===null)return e;let n=ot(t.numerator,t.denominator,t.variable);if(n===null||n.terms.length===0)return e;let o=n.polynomial.length>0?Re(n.polynomial,t.variable):null;for(let r$1 of n.terms){let i=Re(r$1.base,t.variable),a=r$1.power===1?i:r(i,p({n:BigInt(r$1.power),d:1n})),u=br(r$1.numerator),l=u?r$1.numerator.map(p=>j(p)):r$1.numerator,s={kind:"div",left:Re(l,t.variable),right:a};o===null?o=u?{kind:"neg",operand:s}:s:o={kind:u?"sub":"add",left:o,right:s};}return o===null?e:Q$1(o)}function br(e){return e.some(t=>t.n<0n)&&e.every(t=>t.n<=0n)}function rt(e){if(e.kind!=="div")return null;let t=C(e.left),n=C(e.right);if(t===null||n===null)return null;let o=A(n);return o===null||t.vars.some(r=>r!==o)?null:{numerator:B$1(t,o),denominator:B$1(n,o),variable:o}}var it=16;function Vn(){return p(a$1)}function X(){return p(b)}function yr(e,t){switch(e){case "sin":return s("cos",[t]);case "cos":return {kind:"neg",operand:s("sin",[t])};case "tan":return {kind:"div",left:X(),right:r(s("cos",[t]),p(2))};case "exp":return s("exp",[t]);case "log":return {kind:"div",left:X(),right:t};case "sqrt":return {kind:"div",left:X(),right:{kind:"mul",left:p(2),right:s("sqrt",[t])}};case "asin":return {kind:"div",left:X(),right:s("sqrt",[Tn(t)])};case "acos":return {kind:"neg",operand:{kind:"div",left:X(),right:s("sqrt",[Tn(t)])}};case "atan":return {kind:"div",left:X(),right:hr(t)};case "sinh":return s("cosh",[t]);case "cosh":return s("sinh",[t]);case "tanh":return {kind:"div",left:X(),right:r(s("cosh",[t]),p(2))};case "abs":return s("sign",[t]);default:return null}}function Tn(e){return {kind:"sub",left:X(),right:r(e,p(2))}}function hr(e){return {kind:"add",left:X(),right:r(e,p(2))}}function xe(e,t,n=1){if(n<0||!Number.isInteger(n))throw c$2.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT","A derivative order must be a whole number, at least zero.");if(n>it)throw c$2.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT",`A derivative order above ${it} is not supported.`,{limit:it});let o=Q$1(e);for(let r=0;r<n;r++)o=Q$1(P(o,t));return o}function P(e,t){switch(e.kind){case "const":case "complex":return Vn();case "var":return e.name===t?X():Vn();case "add":return {kind:"add",left:P(e.left,t),right:P(e.right,t)};case "sub":return {kind:"sub",left:P(e.left,t),right:P(e.right,t)};case "neg":return {kind:"neg",operand:P(e.operand,t)};case "mul":return {kind:"add",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}};case "div":return {kind:"div",left:{kind:"sub",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}},right:r(e.right,p(2))};case "pow":return Nr(e,t);case "call":{if(e.args.length!==1)return at(e,t);let n=yr(e.name,e.args[0]);return n===null?at(e,t):{kind:"mul",left:n,right:P(e.args[0],t)}}}}function Nr(e,t){if(e.exponent.kind==="const"){let n=p(g(e.exponent.value,b));return {kind:"mul",left:{kind:"mul",left:e.exponent,right:r(e.base,n)},right:P(e.base,t)}}return e.base.kind==="const"&&e.base.value.n>0n?{kind:"mul",left:{kind:"mul",left:e,right:s("log",[e.base])},right:P(e.exponent,t)}:at(e,t)}function at(e,t){return s("der",[e,q$1(t)])}function On(e,t){let n=C(e);if(n===null||n.vars.filter(u=>u!==t).length>0||z(n,t)>1)return null;let r=B$1(n,t),i=r[0]??{n:0n,d:1n},a=r[1]??{n:0n,d:1n};return l(a)?null:{slope:a,intercept:i}}function gr(e,t){let n=C(e);if(n===null)return null;let o=n.vars.filter(a=>a!==t);if(o.length>0)return {ok:false,reason:`it involves more than one unknown (${o.join(", ")})`};let r$1=B$1(n,t),i$1=p(0);return r$1.forEach((a,u)=>{if(l(a))return;let l$1=u+1,s=i(a,{n:BigInt(l$1),d:1n}),p$1={kind:"mul",left:p(s),right:l$1===1?q$1(t):r(q$1(t),p(l$1))};i$1={kind:"add",left:i$1,right:p$1};}),{ok:true,value:Q$1(i$1)}}function Rr(e,t){if(e.kind!=="call"||e.args.length!==1)return null;let n=On(e.args[0],t);if(n===null)return null;let o=e.args[0],r=i=>Q$1({kind:"div",left:i,right:p(n.slope)});switch(e.name){case "exp":return {ok:true,value:r(s("exp",[o]))};case "sin":return {ok:true,value:r({kind:"neg",operand:s("cos",[o])})};case "cos":return {ok:true,value:r(s("sin",[o]))};case "log":return {ok:true,value:r({kind:"sub",left:{kind:"mul",left:o,right:s("log",[o])},right:o})};default:return null}}function xr(e,t){if(e.kind!=="div"||e.left.kind!=="const"||!ut(e.left.value))return null;let n=On(e.right,t);if(n!==null)return {ok:true,value:Q$1({kind:"div",left:s("log",[e.right]),right:p(n.slope)})};let o=C(e.right);if(o!==null&&o.vars.length===1&&o.vars[0]===t){let r=B$1(o,t);if(r.length===3&&ut(r[0])&&l(r[1])&&ut(r[2]))return {ok:true,value:s("atan",[q$1(t)])}}return null}function ut(e){return e.n===1n&&e.d===1n}function vr(e,t){let n=rt(e);if(n===null||n.variable!==t)return null;let o=ot(n.numerator,n.denominator,t);if(o===null)return null;let r=o.polynomial.length>0?Sr(o.polynomial,t):p(0);for(let i of o.terms){let a=Ir(i,t);if(a===null)return {ok:false,reason:"its denominator has a repeated irreducible quadratic factor, which needs a reduction formula this does not have"};r={kind:"add",left:r,right:a};}return {ok:true,value:Q$1(r)}}function Ir(e,t){let n=e.base.length-1,o=Re(e.base,t);if(n===1){let r$1=e.numerator[0]??a$1;if(e.power===1)return {kind:"mul",left:p(r$1),right:s("log",[o])};let i$1=e.power-1,a=i(r$1,{n:BigInt(-i$1),d:1n});return {kind:"div",left:p(a),right:r(o,p({n:BigInt(i$1),d:1n}))}}return n!==2||e.power!==1?null:Mr(e,t,o)}function Mr(e,t,n){let o=e.numerator[0]??a$1,r=e.numerator[1]??a$1,[i,a]=e.base,u={n:1n,d:2n},l$1=h(a,u),s$1={kind:"mul",left:p(h(r,u)),right:s("log",[n])},p$1=g(o,h(r,l$1));if(l(p$1))return s$1;let h$1=O$2(g(i,h(l$1,l$1))),x={kind:"add",left:q$1(t),right:p(l$1)},V={kind:"mul",left:{kind:"div",left:p(p$1),right:h$1},right:s("atan",[{kind:"div",left:x,right:h$1}])};return l(r)?V:{kind:"add",left:s$1,right:V}}function Sr(e,t){let n=p(0);return e.forEach((o,r$1)=>{if(l(o))return;let i$1=r$1+1,a=i(o,{n:BigInt(i$1),d:1n}),u={kind:"mul",left:p(a),right:i$1===1?q$1(t):r(q$1(t),p(i$1))};n={kind:"add",left:n,right:u};}),n}function ve(e,t){let n=Q$1(e);if(!u$1(n).has(t))return {ok:true,value:Q$1({kind:"mul",left:n,right:q$1(t)})};let o=gr(n,t);if(o!==null)return o;let r=Rr(n,t);if(r!==null)return r;let i=xr(n,t);if(i!==null)return i;let a=vr(n,t);if(a!==null)return a;if(n.kind==="add"||n.kind==="sub"){let u=ve(n.left,t);if(!u.ok)return u;let l=ve(n.right,t);return l.ok?{ok:true,value:Q$1({kind:n.kind,left:u.value,right:l.value})}:l}if(n.kind==="mul"&&n.left.kind==="const"){let u=ve(n.right,t);return u.ok?{ok:true,value:Q$1({kind:"mul",left:n.left,right:u.value})}:u}return {ok:false,reason:"no elementary antiderivative is known for this expression"}}var lt=16;function _n(e,t,n,o){if(o<0||!Number.isInteger(o)||o>lt)throw c$2.execution("SYMBOLIC_TAYLOR_DEGREE_LIMIT",`A Taylor degree must be a whole number from 0 to ${lt}.`,{limit:lt});let r$1=p(n),i$1=1n,a=p(a$1);for(let u=0;u<=o;u++){u>0&&(i$1*=BigInt(u));let l$1=xe(e,t,u),s=Q$1(v$1(l$1,t,r$1));if(s.kind!=="const")throw c$2.execution("SYMBOLIC_TAYLOR_INEXACT",`The derivative of order ${u} does not reduce to an exact number at the expansion point, so this series cannot be computed exactly.`,{order:u});let p$1=i(s.value,{n:i$1,d:1n});if(l(p$1))continue;let h=l(n)?q$1(t):{kind:"sub",left:q$1(t),right:r$1},x=u===0?p(1):u===1?h:r(h,p(u));a={kind:"add",left:a,right:{kind:"mul",left:p(p$1),right:x}};}return Q$1(a)}function wn(e,t){return e.map(n=>t.map(o=>xe(n,o)))}function Er(){return {pluginFunctions:{},opRegistry:new Ne,pluginFunctionOwners:{}}}var Dn=Er();var Ar={1970:38.8,1971:40.5,1972:41.8,1973:44.4,1974:49.3,1975:53.8,1976:56.9,1977:60.6,1978:65.2,1979:72.6,1980:82.4,1981:90.9,1982:96.5,1983:99.6,1984:103.9,1985:107.6,1986:109.6,1987:113.6,1988:118.3,1989:124,1990:130.7,1991:136.2,1992:140.3,1993:144.5,1994:148.2,1995:152.4,1996:156.9,1997:160.5,1998:163,1999:166.6,2e3:172.2,2001:177.1,2002:179.9,2003:184,2004:188.9,2005:195.3,2006:201.6,2007:207.3,2008:215.3,2009:214.5,2010:218.1,2011:224.9,2012:229.6,2013:233,2014:236.7,2015:237,2016:240,2017:245.1,2018:251.1,2019:255.7,2020:258.8,2021:271,2022:292.7,2023:304.7,2024:313.7,2025:322.2,2026:332.7},Pn=1970,Ln=2026;function Cn(e){return Ar[Math.trunc(e)]}function st(e,t){let n=Cn(e),o=Cn(t);if(!(n===void 0||o===void 0||n===0))return o/n}function va(e,t,n){let o=st(t,n);if(o!==void 0)return e*o}var kr=0;function ct(e){if(e.type===6&&e.unit!==void 0){let t=a[e.unit.toLowerCase()];if(t!==void 0&&t[0]===kr)return e.toNumber()*t[1]}return e.toNumber()}function Vr(e,t){if(t===1)return e;let n=`${e}s`;return a[n.toLowerCase()]===void 0?e:n}function Fn(e,t){let n$1,o=false;for(let r of e){if(Number.isNaN(r.toNumber())){o=true;continue}if(n$1===void 0){n$1=r;continue}let{lv:i,rv:a,sameMeasure:u}=he(n$1,r);if(!u){let l=n$1.type===6?n$1.unit:void 0,s=r.type===6?r.unit:void 0,p=Fe(l,s,"compared");return O$1("INCOMPATIBLE_UNITS",p??`Cannot compare incompatible units: ${l??"?"} and ${s??"?"}`)}(t?a>i:a<i)&&(n$1=r);}return o?n(NaN):n$1===void 0?n(t?-1/0:1/0):n$1.type===6?n$1:n(n$1.toNumber())}function Ue(e,t){return e.type===6&&e.unit!==void 0?u(t,e.unit):n(t)}function Un(e,t){let n=Number.isFinite(t)?Math.min(100,Math.max(0,Math.trunc(t))):0;if(e.exact!==void 0){let a=oa(e.exact,n);return $e(e,ra(a),n,a)}let o=e.toNumber();if(!Number.isFinite(o))return $e(e,o,n);let r=Math.pow(10,n),i=o*r;return !Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER?$e(e,o,n):$e(e,Math.round(i)/r,n)}function $e(e,t,n$1,o){let r=e.type===6&&e.unit!==void 0?u(t,e.unit):n(t);return r.decimalPlaces=n$1,o!==void 0&&(r.exact=o),r}function $n(e,t,n){if(Number.isFinite(e)&&Number.isFinite(t))return null;let o=Number.isFinite(e)?t:e;return O$1("INVALID_INTEGER_OPERAND",`${n} needs two whole numbers, and ${Number.isNaN(o)?"one of them has no value":"one of them is infinite"}`)}function Bn(e,t){let n=e,o=t;for(;o!==0;){let r=o;o=n%o,n=r;}return n}function Tr(e){let t=e.length;if(t===0)return 0;let n=e.reduce((o,r)=>o+r,0)/t;return e.reduce((o,r)=>o+(r-n)*(r-n),0)}function Be(e,t){let n=e.length;if(n===0)return 0;let o=t?n-1:n;return o<=0?0:Tr(e)/o}var Ga={0:e=>{let t=e[0].toNumber();return t>=0?n(Math.sqrt(t)):_(s("sqrt",[p(t)]))},1:e=>e[0].type===7?ca(e[0].value):Ue(e[0],Math.abs(e[0].toNumber())),2:e=>n(Math.sin(ct(e[0]))),3:e=>n(Math.cos(ct(e[0]))),4:e=>n(Math.tan(ct(e[0]))),5:e=>n(Math.log(e[0].toNumber())),6:e=>Ue(e[0],Math.ceil(e[0].toNumber())),7:e=>Ue(e[0],Math.floor(e[0].toNumber())),8:e=>e.length>=2?Un(e[0],e[1].toNumber()):Ue(e[0],Math.round(e[0].toNumber())),9:e=>Fn(e,false),10:e=>Fn(e,true),11:e=>n(Math.asin(e[0].toNumber())),12:e=>n(Math.acos(e[0].toNumber())),13:e=>n(Math.atan(e[0].toNumber())),14:e=>n(Math.atan2(e[0].toNumber(),e[1].toNumber())),15:e=>n(Math.sinh(e[0].toNumber())),16:e=>n(Math.cosh(e[0].toNumber())),17:e=>n(Math.tanh(e[0].toNumber())),18:e=>n(Math.asinh(e[0].toNumber())),19:e=>n(Math.acosh(e[0].toNumber())),20:e=>n(Math.atanh(e[0].toNumber())),21:e=>n(Math.cbrt(e[0].toNumber())),22:e=>n(Math.clz32(e[0].toNumber())),23:e=>n(Math.expm1(e[0].toNumber())),24:e=>n(Math.exp(e[0].toNumber())),25:e=>n(Math.fround(e[0].toNumber())),26:e=>n(Math.hypot(...e.map(t=>t.toNumber()))),27:e=>n(Math.imul(e[0].toNumber(),e[1].toNumber())),28:e=>n(Math.log10(e[0].toNumber())),29:e=>n(Math.log1p(e[0].toNumber())),30:e=>n(Math.log2(e[0].toNumber())),31:e=>e[0].type===7?e[1].type!==0?O$1("MATRIX_POWER_UNSUPPORTED",`pow: a matrix's exponent must be a whole number, as in "pow([1,2;3,4], 2)".`):$(e[0].value,e[1].value):e[1].type===7?O$1("MATRIX_POWER_UNSUPPORTED",'pow: a matrix may only be the base, as in "pow([1,2;3,4], 2)".'):n(et(e[0].toNumber(),e[1].toNumber())),32:()=>n(Math.random()),33:e=>n(Math.sign(e[0].toNumber())),34:e=>n(Math.trunc(e[0].toNumber())),35:e=>n(e[0].toNumber()*Math.PI/180),36:e=>n(e[0].toNumber()*180/Math.PI),37:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return t>n$1?O$1("INVALID_RANGE",`roll: invalid range, ${t} is greater than ${n$1}`):n(Math.floor(Math.random()*(n$1-t+1))+t)},38:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n$1=Math.trunc(Math.abs(e[1].toNumber())),o=$n(t,n$1,"gcd");return o||n(Bn(t,n$1))},39:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n$1=Math.trunc(Math.abs(e[1].toNumber())),o=$n(t,n$1,"lcm");return o||(t===0||n$1===0?n(0):n(t/Bn(t,n$1)*n$1))},40:e=>{let t=Math.trunc(e[0].toNumber()),n$1=Math.trunc(e[1].toNumber());if(t<0||n$1<0||n$1>t)return O$1("INVALID_RANGE",`permutation: invalid n=${t}, r=${n$1} (require 0 <= r <= n)`);let o=1;for(let r=0;r<n$1;r++)if(o*=t-r,!Number.isFinite(o))return O$1("PERMUTATION_OVERFLOW",`permutation: P(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${r+1} of ${n$1} factors)`);return n(o)},41:e=>{let t=Math.trunc(e[0].toNumber()),n$1=Math.trunc(e[1].toNumber());if(t<0||n$1<0||n$1>t)return O$1("INVALID_RANGE",`combination: invalid n=${t}, r=${n$1} (require 0 <= r <= n)`);let o=Math.min(n$1,t-n$1),r=1;for(let i=0;i<o;i++)if(r=r*(t-i)/(i+1),!Number.isFinite(r))return O$1("COMBINATION_OVERFLOW",`combination: C(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${i+1} of ${o} steps)`);return n(Math.round(r))},42:e=>{if(e.length===0)return n(0);let t=e.reduce((n,o)=>n+o.toNumber(),0);return n(t/e.length)},43:e=>{if(e.length===0)return n(0);let t=e.map(o=>o.toNumber()).sort((o,r)=>o-r),n$1=Math.floor(t.length/2);return n(t.length%2===0?(t[n$1-1]+t[n$1])/2:t[n$1])},44:e=>n(e.reduce((t,n)=>t+n.toNumber(),0)),45:e=>n(e.length),46:e=>{let[t,n$1,o]=e,{lv:r,rv:i}=he(t,n$1);if(r===0)return O$1("PROPORTION_DIVIDE_BY_ZERO",`Cannot compute proportion: "${t.value}" is zero`);let a=o.toNumber()*(i/r);return o.type===6?u(a,o.unit):n(a)},47:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return n$1>o?O$1("INVALID_RANGE",`clamp: invalid range, ${n$1} is greater than ${o}`):n(Math.min(Math.max(t,n$1),o))},48:e=>r$1(e[0].toNumber()),49:e=>r$1(e[0].toNumber(),"bin"),50:e=>n(Math.trunc(e[0].toNumber())),51:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(1+n$1<=0)return O$1("INVALID_RATE",`compoundInterest: rate ${n$1} makes (1 + rate) non-positive`);let r=t*Math.pow(1+n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},52:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(1+n$1<=0)return O$1("INVALID_RATE",`interestEarned: rate ${n$1} makes (1 + rate) non-positive`);let r=t*(Math.pow(1+n$1,o)-1);return e[0].type===6?u(r,e[0].unit):n(r)},53:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return t<=0||n$1<=0?O$1("INVALID_RANGE","compoundInterestRate: principal and futureValue must both be positive"):o<=0?O$1("INVALID_RANGE","compoundInterestRate: years must be greater than 0"):n(Math.pow(n$1/t,1/o)-1)},54:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return t<=0||n$1<=0?O$1("INVALID_RANGE","compoundInterestYears: principal and futureValue must both be positive"):1+o<=0||o===0?O$1("INVALID_RATE",`compoundInterestYears: rate ${o} is not usable (must be > -1 and not 0)`):n(Math.log(n$1/t)/Math.log(1+o))},55:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return O$1("INVALID_RANGE","loanRepayment: principal must be positive");if(o<=0)return O$1("INVALID_RANGE","loanRepayment: years must be positive");if(n$1<0)return O$1("INVALID_RATE","loanRepayment: rate must not be negative");if(r<0)return O$1("INVALID_RANGE","loanRepayment: periodsPerYear must not be negative");let{totalRepayment:i}=dt(t,n$1,o),a=r===0?i:i/(o*r);return e[0].type===6?u(a,e[0].unit):n(a)},56:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return O$1("INVALID_RANGE","loanInterest: principal must be positive");if(o<=0)return O$1("INVALID_RANGE","loanInterest: years must be positive");if(n$1<0)return O$1("INVALID_RATE","loanInterest: rate must not be negative");if(r<0)return O$1("INVALID_RANGE","loanInterest: periodsPerYear must not be negative");let{totalInterest:i}=dt(t,n$1,o),a=r===0?i:i/(o*r);return e[0].type===6?u(a,e[0].unit):n(a)},57:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(t<=0)return O$1("INVALID_RANGE","monthlyPayment: principal must be positive");if(o<=0)return O$1("INVALID_RANGE","monthlyPayment: years must be positive");if(n$1<0)return O$1("INVALID_RATE","monthlyPayment: rate must not be negative");let{monthlyPayment:r}=dt(t,n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},58:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?vn(e[0],e[0].unit,n$1,1):n(t*(1+n$1))},59:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return 1+n$1<=0?O$1("INVALID_RATE",`taxRemove: rate ${n$1} makes (1 + rate) non-positive`):e[0].type===6?Mn(e[0],e[0].unit,n$1)??u(t/(1+n$1),e[0].unit):n(t/(1+n$1))},60:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=st(n$1,o);if(r===void 0)return O$1("INFLATION_YEAR_OUT_OF_RANGE",`inflationAdjust: fromYear ${n$1} or toYear ${o} is outside the bundled CPI table's range (${Pn}-${Ln})`);let i=t*r;return e[0].type===6?u(i,e[0].unit):n(i)},61:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return n(et(n$1,1/t))},62:e=>{let t=e[0].toNumber();if(!Number.isInteger(t)||t<0)return O$1("INVALID_FACTORIAL_INPUT",`fact: ${t} is not a non-negative integer`);if(t>170)return O$1("FACTORIAL_OVERFLOW",`fact: ${t}! exceeds the maximum representable double (170! is the largest finite factorial)`);let n$1=1;for(let o=2;o<=t;o++)n$1*=o;return n(n$1)},63:e=>e[0].type===7?ba(e[0].value):e[0],64:e=>e[0].type===7?ca(e[0].value):n(e[0].toNumber()),65:e=>e[0].type===7?da(e[0].value):n(1/e[0].toNumber()),66:e=>{let[t,n$1]=e;if(t.type===0&&n$1.type===0)return n(t.toNumber()*n$1.toNumber());let o=r=>r.type===7?r.value:{rows:1,cols:1,data:[r.toNumber()],hasSymbolic:false};return _$1(o(t),o(n$1))},67:e=>{let[t]=e;return t.type!==9?t:_(F(t.value))},68:e=>{let[t]=e;return t.type!==9?t:_(zt(t.value))},69:e=>{let[t,n,o]=e;return o?.type!==3?O$1("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown."):fn(t,n,o.value)},70:e=>{let[t,n,o]=e,r=ft(n,"der");if(typeof r!="string")return r;let i=O(t);return i===null?O$1("SYMBOLIC_NONFINITE_OPERAND","der needs an expression with an exact value."):_(xe(i,r,o?.toNumber()??1))},71:e=>{let[t,n]=e,o=ft(n,"integral");if(typeof o!="string")return o;let r=O(t);if(r===null)return O$1("SYMBOLIC_NONFINITE_OPERAND","integral needs an expression with an exact value.");let i=ve(r,o);return i.ok?_(i.value):O$1("SYMBOLIC_INTEGRAL_UNSUPPORTED",`Cannot integrate this: ${i.reason}.`)},72:e=>{let[t,n,o,r]=e,i=ft(n,"taylor");if(typeof i!="string")return i;let a=O(t),u=O(o);return a===null||u===null||u.kind!=="const"?O$1("SYMBOLIC_NONFINITE_OPERAND","taylor needs an expression and an exact expansion point."):_(_n(a,i,u.value,r.toNumber()))},73:e=>{let t=[];for(let a of e){let u=O(a);if(u===null)return O$1("SYMBOLIC_NONFINITE_OPERAND","jacobian needs expressions with exact values.");t.push(u);}let n=new Set;for(let a of t)for(let u of u$1(a))n.add(u);let o=[...n].sort();if(o.length===0)return O$1("SYMBOLIC_JACOBIAN_NO_VARIABLES","jacobian needs at least one unknown to differentiate against.");let r=wn(t,o),i=[];for(let a of r)for(let u of a)i.push(W(u));return C$1(r.length,o.length,Y(r.length,o.length,i))},74:e=>_(w(o(a$1,d(e[0].toNumber())))),75:e=>mt("conj",e[0]),76:e=>mt("re",e[0]),77:e=>mt("im",e[0]),78:e=>{let t=e[0];return t.type!==9?t:_(J$1(t.value))},79:e=>{let t=e[0];return t.type!==9?t:_(kn(t.value))},85:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();if(1+n$1<=0)return O$1("INVALID_RATE",`taxIn: rate ${n$1} makes (1 + rate) non-positive`);let o=t-t/(1+n$1);return e[0].type===6?Sn(e[0],e[0].unit,n$1)??u(o,e[0].unit):n(o)},86:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?xn(e[0],n$1,e[0].unit):n(t*n$1)},87:e=>n(Math.sin(e[0].toNumber()*Math.PI/180)),88:e=>n(Math.cos(e[0].toNumber()*Math.PI/180)),89:e=>n(Math.tan(e[0].toNumber()*Math.PI/180)),90:e=>n(Math.asin(e[0].toNumber())*180/Math.PI),91:e=>n(Math.acos(e[0].toNumber())*180/Math.PI),92:e=>n(Math.atan(e[0].toNumber())*180/Math.PI),93:e=>u(e[0].toNumber(),"days"),94:e=>{let t$1=typeof e[1]?.value=="string"?e[1].value:void 0,n=typeof e[2]?.value=="string"?e[2].value:void 0;if(t$1===void 0||n===void 0)return O$1("UNKNOWN_UNIT",'both units have to be named, as in "12.5 minutes in minutes and seconds"');let o=a[t$1.toLowerCase()],r=a[n.toLowerCase()];if(o===void 0||r===void 0)return O$1("UNKNOWN_UNIT",`${t$1} and ${n}: one of these is not a unit`);if(o[0]!==r[0])return O$1("INCOMPATIBLE_UNITS",`${t$1} and ${n} measure different things`);if(r[1]>=o[1])return O$1("INCOMPATIBLE_UNITS",`${t$1} and ${n}: name the larger unit first`);let i=e[0],a$1=i.type===6&&i.unit!==void 0?a[i.unit.toLowerCase()]:void 0,u=i.toNumber()*(a$1?.[1]??o[1]),l=Math.floor(u/o[1]),s=Math.round((u-l*o[1])/r[1]*1e3)/1e3;return t(`${l} ${t$1} ${s} ${n}`)},95:e=>{let t=e[0],n=String(e[1].value),o=t.type===6&&t.unit!==void 0?t.unit:"";return o.includes("/")?O$1("INVALID_RATE_UNIT",`${o}/${n}: that is already a rate`):u(t.toNumber(),`${o}/${n}`)},96:e=>{let t=e[0],n$1=e[1];if(n$1.type!==6||n$1.unit===void 0||!n$1.unit.includes("/"))return O$1("INVALID_RATE",'at: the right-hand side has to be a rate, as in "$30/hour"');let o=n$1.unit.indexOf("/"),r=n$1.unit.slice(0,o),i=n$1.unit.slice(o+1),a$1=t.type===6?t.unit:void 0,u$1=a[i.toLowerCase()],l=a$1===void 0?void 0:a[a$1.toLowerCase()];if(l!==void 0&&u$1!==void 0&&l[0]===u$1[0]){let p=t.toNumber()*l[1]/u$1[1]*n$1.toNumber();return r===""?n(p):u(p,r)}if(a$1!==void 0&&a$1===r){let s=t.toNumber()/n$1.toNumber();return u(s,Vr(i,s))}if(a$1===void 0){let s=t.toNumber()*n$1.toNumber();return r===""?n(s):u(s,r)}return O$1("INCOMPATIBLE_UNITS",`at: ${a$1} matches neither side of ${n$1.unit}`)},80:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0)return O$1("INVALID_RATE",`compounding: ${r} periods per year is not a period`);if(1+n$1/r<=0)return O$1("INVALID_RATE",`compounding: rate ${n$1} makes each period non-positive`);let i=t*Math.pow(1+n$1/r,r*o);return e[0].type===6?u(i,e[0].unit):n(i)},81:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0||1+n$1/r<=0)return O$1("INVALID_RATE",`compounding: rate ${n$1} over ${r} periods per year is not usable`);let i=t*(Math.pow(1+n$1/r,r*o)-1);return e[0].type===6?u(i,e[0].unit):n(i)},82:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();if(1+n$1<=0)return O$1("INVALID_RATE",`presentValue: rate ${n$1} makes (1 + rate) non-positive`);let r=t/Math.pow(1+n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},83:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return t===0?O$1("INVALID_RATE","roi: nothing was invested, so there is no return on it"):n((n$1-t)/t)},84:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0?O$1("INVALID_RATE","annual return: the amount invested must be positive"):o<=0?O$1("INVALID_RATE","annual return: the period must be longer than zero"):n<=0?O$1("INVALID_RATE","annual return: nothing was returned, so there is no annual rate"):M(Math.pow(n/t,1/o)-1)},97:e=>Un(e[0],e[1].toNumber()),98:e=>{let t=e[1].toNumber();return !Number.isInteger(t)||t<1?O$1("INVALID_RANGE",`split: the number of shares must be a whole number of at least 1, not ${e[1].toNumber()}.`):H(En(e[0],t))},99:e=>{let t=e[0].toNumber(),n$1=Or(e[1]),o=e[2].toNumber();if(n$1===null)return O$1("INVALID_RANGE",'savings goal: the duration must be in months or years, e.g. "in 2 years".');if(t<=0)return O$1("INVALID_RANGE","savings goal: the target must be positive.");if(n$1<=0)return O$1("INVALID_RANGE","savings goal: the duration must be positive.");if(o<0)return O$1("INVALID_RATE","savings goal: the rate must not be negative.");let r=_r(t,o/12,n$1);return e[0].type===6?u(r,e[0].unit):n(r)},100:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber(),i=typeof e[4]?.value=="string"?e[4].value:"periods";if(t<=0)return O$1("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return O$1("INVALID_RANGE","savings goal: the contribution must be positive.");if(r<0)return O$1("INVALID_RATE","savings goal: the rate must not be negative.");let a=wr(t,n,r/o);return u(a,i)},101:e=>n(Math.sqrt(Be(e.map(t=>t.toNumber()),false))),102:e=>n(Math.sqrt(Be(e.map(t=>t.toNumber()),true))),103:e=>n(Be(e.map(t=>t.toNumber()),false)),104:e=>n(Be(e.map(t=>t.toNumber()),true)),105:e=>{if(e.length===0)return n(0);let t=e.map(n=>n.toNumber());return n(Math.max(...t)-Math.min(...t))},106:e=>{if(e.length===0)return n(0);let t=new Map,n$1=e[0].toNumber(),o=0;for(let r of e){let i=r.toNumber(),a=(t.get(i)??0)+1;t.set(i,a),a>o&&(o=a,n$1=i);}return n(n$1)},107:e=>{let t=0,n$1=0;for(let o=0;o+1<e.length;o+=2){let r=e[o].toNumber(),i=e[o+1].toNumber();t+=r*i,n$1+=i;}return n$1===0?O$1("WEIGHTED_AVERAGE_ZERO_WEIGHT","weighted average: the weights sum to zero, so there is nothing to divide by"):n(t/n$1)}};function Or(e){if(e.type!==6)return null;let t=e.unit;return t==="months"||t==="month"?e.toNumber():t==="years"||t==="year"?e.toNumber()*12:null}function _r(e,t,n){return t===0?e/n:e*t/(Math.pow(1+t,n)-1)}function wr(e,t,n){let o=n===0?e/t:Math.log(1+e*n/t)/Math.log(1+n);return Math.ceil(o-1e-9)}function mt(e,t){let n=O(t);return n===null?O$1("SYMBOLIC_NONFINITE_OPERAND",e+" needs a value with an exact number."):_(s(e,[n]))}function ft(e,t){return e?.type!==3?O$1("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown.`):e.value}function dt(e,t,n){let o=n*12,r=t/12,i=r===0?e/o:e*r/(1-Math.pow(1+r,-o)),a=i*o,u=a-e;return {monthlyPayment:i,totalRepayment:a,totalInterest:u}}var ja=Dn.pluginFunctions,qn=255,Yn=0;function Dr(){if(Yn>qn)throw c$2.config("PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",`allocatePluginFunctionIndex: pool exhausted (max ${qn+1} allocations).`);return Yn++}var Gn=new Map;function Ka(e){let t=Gn.get(e);return t===void 0&&(t=Dr(),Gn.set(e,t)),t}var pt=new Map;function Xa(e,t){let n=e.toLowerCase(),o=pt.get(n);o&&o!==t&&console.warn(`[asConverterRegistry] Converter name "${n}" is already registered \u2014 overwriting.`),pt.set(n,t);}function Za(e){pt.delete(e.toLowerCase());}var qe=class qe{constructor(){this.values=new Map;this.listeners=new Set;this.notifyDepth=0;}get(t){return this.values.get(t)}has(t){return this.values.has(t)}set(t,n){let o=this.values.get(t);this.values.set(t,n),!(o!==void 0&&Cr(o,n))&&this.notify(t,n);}notify(t,n){if(!(this.notifyDepth>=qe.MAX_NOTIFY_DEPTH)){this.notifyDepth++;try{for(let o of this.listeners)o(t,n);}finally{this.notifyDepth--;}}}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}clear(){this.values.clear(),this.listeners.clear(),this.notifyDepth=0;}};qe.MAX_NOTIFY_DEPTH=64;var bt=qe;function Cr(e,t){if(e.type!==t.type||e.unit!==t.unit||(e.timedOut??false)!==(t.timedOut??false))return false;let n=e.value,o=t.value;if(Array.isArray(n)||Array.isArray(o)){if(!Array.isArray(n)||!Array.isArray(o)||n.length!==o.length)return false;for(let r=0;r<n.length;r++)if(!Object.is(n[r],o[r]))return false;return true}return Object.is(n,o)}var Wa=new bt;function Qa(e){return `global:${e}`}export{Ln as A,va as B,Ga as C,ja as D,Dr as E,Ka as F,pt as G,Xa as H,Za as I,Wa as J,Qa as K,ge as a,xn as b,vn as c,sn as d,hi as e,Ni as f,gi as g,Ri as h,fn as i,he as j,Oi as k,_i as l,wi as m,pn as n,Di as o,Ci as p,et as q,Pi as r,Li as s,Fi as t,Ui as u,Ne as v,qi as w,Er as x,Dn as y,Pn as z};//# sourceMappingURL=chunk-XTM4HTRB.js.map
2
- //# sourceMappingURL=chunk-XTM4HTRB.js.map
@@ -1,2 +0,0 @@
1
- 'use strict';var chunk4BZIYU7S_cjs=require('./chunk-4BZIYU7S.cjs'),chunkZOOVGXMK_cjs=require('./chunk-ZOOVGXMK.cjs'),chunk5FGOIDLS_cjs=require('./chunk-5FGOIDLS.cjs'),chunkIANAMBJQ_cjs=require('./chunk-IANAMBJQ.cjs'),chunkCIQOK7Q4_cjs=require('./chunk-CIQOK7Q4.cjs'),chunkSOMGSIO4_cjs=require('./chunk-SOMGSIO4.cjs');function Yt(e,t){let n=t===2?chunkZOOVGXMK_cjs.L:chunkZOOVGXMK_cjs.M,o=n(e.n),r=n(e.d);return o===null||r===null?null:{n:o,d:r}}function Gt(e,t){let n=chunkZOOVGXMK_cjs.y(e),o=new Map;for(let[r,i]of n){if(i%t!==0)return null;o.set(r,i/t);}return chunkZOOVGXMK_cjs.x(o)}function jn(e,t){let n=chunkZOOVGXMK_cjs.y(e);for(let[o,r]of chunkZOOVGXMK_cjs.y(t))n.set(o,(n.get(o)??0)+r);return chunkZOOVGXMK_cjs.x(n)}function jt(e,t){let n=chunkZOOVGXMK_cjs.y(e);for(let[o,r]of chunkZOOVGXMK_cjs.y(t)){let i=(n.get(o)??0)-r;i<=0?n.delete(o):n.set(o,i);}return chunkZOOVGXMK_cjs.x(n)}function Kn(e,t){let n=chunkZOOVGXMK_cjs.y(e),o=new Map;for(let[r,i]of chunkZOOVGXMK_cjs.y(t)){let a=n.get(r);a!==void 0&&o.set(r,Math.min(a,i));}return chunkZOOVGXMK_cjs.x(o)}function Xn(e){let t=new Set;for(let n of e)for(let o of chunkZOOVGXMK_cjs.y(n).keys())t.add(o);return [...t].sort()}function Q(e){let t=new Map;for(let n of e)t.set(n.key,n.coefficient);return chunkZOOVGXMK_cjs.E({terms:t,vars:Xn(e.map(n=>n.key))})}function Ze(e){let t=e[0];for(let n=1;n<e.length;n++)t={kind:"mul",left:t,right:e[n]};return t}function Zn(e){return [...e.terms].map(([n,o])=>({key:n,coefficient:o})).sort((n,o)=>chunkZOOVGXMK_cjs.D(n.key,o.key,e.vars))}function Zt(e){if(e.vars.length<2)return null;let t=Zn(e);return t.length===2?Hn(t[0],t[1]):t.length===3?Wn(t):t.length===4?Qn(t):null}function Hn(e,t){let n=e.coefficient.n>0n,o=t.coefficient.n>0n;if(!n)return null;let r=He(e,t,2);if(r!==null&&!o)return Ze([Q([r.a,Te(r.b)]),Q([r.a,r.b])]);let i=He(e,t,3);if(i===null)return null;let a=Q(o?[i.a,i.b]:[i.a,Te(i.b)]),u=o?Te(Oe(i.a,i.b)):Oe(i.a,i.b);return Ze([a,Q([Kt(i.a),u,Kt(i.b)])])}function He(e,t,n){let o=t.coefficient.n<0n?chunkZOOVGXMK_cjs.j(t.coefficient):t.coefficient,r=Yt(e.coefficient,n),i=Yt(o,n);if(r===null||i===null)return null;let a=Gt(e.key,n),u=Gt(t.key,n);return a===null||u===null?null:{a:{key:a,coefficient:r},b:{key:u,coefficient:i}}}function Te(e){return {key:e.key,coefficient:chunkZOOVGXMK_cjs.j(e.coefficient)}}function Oe(e,t){return {key:jn(e.key,t.key),coefficient:chunkZOOVGXMK_cjs.h(e.coefficient,t.coefficient)}}function Kt(e){return Oe(e,e)}function Wn(e){let[t,n,o]=e;if(t.coefficient.n<0n||o.coefficient.n<0n)return null;let r=He(t,o,2);if(r===null)return null;let i=Oe(r.a,r.b);if(i.key!==n.key)return null;let a=chunkZOOVGXMK_cjs.h(i.coefficient,{n:2n,d:1n}),u=n.coefficient.n<0n,l=u?chunkZOOVGXMK_cjs.j(n.coefficient):n.coefficient;return chunkZOOVGXMK_cjs.m(chunkZOOVGXMK_cjs.i(l,a))?{kind:"pow",base:Q([r.a,u?Te(r.b):r.b]),exponent:chunkZOOVGXMK_cjs.p(2)}:null}function Qn(e){let t=[[[0,1],[2,3]],[[0,2],[1,3]],[[0,3],[1,2]]];for(let n of t){let o=Xt(e[n[0][0]],e[n[0][1]]),r=Xt(e[n[1][0]],e[n[1][1]]);if(!(o===null||r===null)&&zn(o.cofactor,r.cofactor))return Ze([Q([o.common,r.common]),Q(o.cofactor)])}return null}function Xt(e,t){let n=Kn(e.key,t.key),o={key:n,coefficient:e.coefficient},r=[{key:jt(e.key,n),coefficient:{n:1n,d:1n}},{key:jt(t.key,n),coefficient:chunkZOOVGXMK_cjs.i(t.coefficient,e.coefficient)}];return r[0].key===r[1].key?null:{common:o,cofactor:r}}function zn(e,t){return e.length!==t.length?false:e.every((n,o)=>n.key===t[o].key&&n.coefficient.n===t[o].coefficient.n&&n.coefficient.d===t[o].coefficient.d)}var Jn=12,_e=4096;function we(e,t){let n=e<0n?-e:e,o=t<0n?-t:t;for(;o!==0n;){let r=n%o;n=o,o=r;}return n}function Wt(e,t){return e===0n||t===0n?0n:e/we(e,t)*t}function Ht(e){let t=e<0n?-e:e;if(t===0n)return null;let n=[];for(let o=1n;o*o<=t;o++){if(t%o!==0n)continue;n.push(o);let r=t/o;if(r!==o&&n.push(r),n.length>_e)return null}return n}function Qt(e,t){let n=chunkZOOVGXMK_cjs.a;for(let o of e)n=chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.h(n,t),o);return n}function eo(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(chunkZOOVGXMK_cjs.f(e[o],chunkZOOVGXMK_cjs.h(n[o-1],t)));return n}function ue(e){if(e.length<2)return [];let t=1n;for(let s of e)t=Wt(t,s.d);let n=e.map(s=>s.n*t/s.d),o=n[0],r=n[n.length-1];if(r===0n)return [];let i=Ht(r),a=Ht(o);if(i===null||a===null)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial's coefficients have too many divisors to search for rational roots.",{limit:_e});if(i.length*a.length>_e)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial has too many candidate rational roots to test.",{limit:_e});let u=[],l=new Set;for(let s of i)for(let p of a)for(let h of [1n,-1n]){let x={n:h*s/we(s,p),d:p/we(s,p)},V=`${x.n}/${x.d}`;l.has(V)||(l.add(V),chunkZOOVGXMK_cjs.l(Qt(e,x))&&u.push(x));}return u}function to(e,t){return chunkZOOVGXMK_cjs.l(t)?chunkZOOVGXMK_cjs.q(e):t.n>0n?{kind:"sub",left:chunkZOOVGXMK_cjs.q(e),right:chunkZOOVGXMK_cjs.p(t)}:{kind:"add",left:chunkZOOVGXMK_cjs.q(e),right:chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.j(t))}}function no(e,t){let n=e.length-1,o=new Map;return e.forEach((r,i)=>{if(chunkZOOVGXMK_cjs.l(r))return;let a=n-i;o.set(a===0?"":a===1?t:`${t}^${a}`,r);}),chunkZOOVGXMK_cjs.E({terms:o,vars:o.size>0?[t]:[]})}function Qe(e,t){let n=[],o=[...e],r=ue(o);for(;r.length>0&&o.length>2;){for(let a of r){let u=0;for(;o.length>1&&chunkZOOVGXMK_cjs.l(Qt(o,a));)o=eo(o,a),u++;u>0&&n.push({base:to(t,a),power:u});}r=o.length>2?ue(o):[];}return o.length-1>=1?(n.push({base:no(o,t),power:1}),{content:chunkZOOVGXMK_cjs.b,factors:n}):{content:o.length===1?o[0]:chunkZOOVGXMK_cjs.b,factors:n}}function oo(e){let t=[];chunkZOOVGXMK_cjs.m(e.content)||t.push(chunkZOOVGXMK_cjs.p(e.content));for(let o of e.factors)t.push(o.power===1?o.base:chunkZOOVGXMK_cjs.r(o.base,chunkZOOVGXMK_cjs.p({n:BigInt(o.power),d:1n})));if(t.length===0)return chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.b);let n=t[0];for(let o=1;o<t.length;o++)n={kind:"mul",left:n,right:t[o]};return n}function ro(e){let t=0n,n=1n;for(let o of e.terms.values())t=we(t,o.n),n=Wt(n,o.d);return t===0n?chunkZOOVGXMK_cjs.b:{n:t,d:n}}function io(e){let t=new Map;for(let r of e.vars){let i=1/0;for(let a of e.terms.keys()){let u=ao(a,r);u<i&&(i=u);}i>0&&i!==1/0&&t.set(r,i);}if(t.size===0)return {monomial:t,reduced:e};let n=new Map;for(let[r,i]of e.terms){let a=We(r);for(let[u,l]of t)a.set(u,(a.get(u)??0)-l);n.set(uo(a),i);}let o=new Set;for(let r of n.keys())for(let i of We(r).keys())o.add(i);return {monomial:t,reduced:{terms:n,vars:[...o].sort()}}}function ao(e,t){return We(e).get(t)??0}function We(e){let t=new Map;if(e==="")return t;for(let n of e.split("*")){let o=n.indexOf("^");o===-1?t.set(n,1):t.set(n.slice(0,o),Number(n.slice(o+1)));}return t}function uo(e){return [...e.keys()].filter(n=>(e.get(n)??0)>0).sort().map(n=>e.get(n)===1?n:`${n}^${e.get(n)}`).join("*")}function lo(e){let t=[...e.keys()].sort(),n=null;for(let o of t){let r=e.get(o),i=r===1?chunkZOOVGXMK_cjs.q(o):chunkZOOVGXMK_cjs.r(chunkZOOVGXMK_cjs.q(o),chunkZOOVGXMK_cjs.p({n:BigInt(r),d:1n}));n=n===null?i:{kind:"mul",left:n,right:i};}return n}function zt(e){let t=chunkZOOVGXMK_cjs.C(e);if(t===null||t.terms.size===0||chunkZOOVGXMK_cjs.z(t)>Jn||t.vars.length===0)return e;let n=ro(t),o=chunkZOOVGXMK_cjs.m(n)?t:so(t,chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.b,n)),{monomial:r,reduced:i}=io(o),a=lo(r),u=chunkZOOVGXMK_cjs.A(i);if(u===null){let te=Zt(i);return te!==null?co(n,a,te):mo(n,a,i)??e}let l=[...chunkZOOVGXMK_cjs.B(i,u)].reverse(),s=Qe(l,u),p=chunkZOOVGXMK_cjs.h(n,s.content);if(s.factors.length<=1&&(s.factors[0]?.power??1)===1&&a===null&&chunkZOOVGXMK_cjs.m(p))return e;let x=[];chunkZOOVGXMK_cjs.m(p)||x.push(chunkZOOVGXMK_cjs.p(p)),a!==null&&x.push(a),x.push(oo({content:chunkZOOVGXMK_cjs.b,factors:s.factors}));let V=x[0];for(let te=1;te<x.length;te++)V={kind:"mul",left:V,right:x[te]};return V}function so(e,t){let n=new Map;for(let[o,r]of e.terms)n.set(o,chunkZOOVGXMK_cjs.h(r,t));return {terms:n,vars:e.vars}}function co(e,t,n){let o=[];chunkZOOVGXMK_cjs.m(e)||o.push(chunkZOOVGXMK_cjs.p(e)),t!==null&&o.push(t),o.push(n);let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}function mo(e,t,n){if(t===null&&chunkZOOVGXMK_cjs.m(e))return null;let o=[];chunkZOOVGXMK_cjs.m(e)||o.push(chunkZOOVGXMK_cjs.p(e)),t!==null&&o.push(t),o.push(chunkZOOVGXMK_cjs.E(n));let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}var k={n:2n,d:1n},B={n:3n,d:1n},be={n:4n,d:1n};function fo(e,t,n,o){let r=chunkZOOVGXMK_cjs.j(chunkZOOVGXMK_cjs.i(t,chunkZOOVGXMK_cjs.h(B,e))),i=chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.g(chunkZOOVGXMK_cjs.h(B,chunkZOOVGXMK_cjs.h(e,n)),chunkZOOVGXMK_cjs.h(t,t)),chunkZOOVGXMK_cjs.h(B,chunkZOOVGXMK_cjs.h(e,e))),a=chunkZOOVGXMK_cjs.h(k,chunkZOOVGXMK_cjs.h(t,chunkZOOVGXMK_cjs.h(t,t))),u=chunkZOOVGXMK_cjs.h({n:9n,d:1n},chunkZOOVGXMK_cjs.h(e,chunkZOOVGXMK_cjs.h(t,n))),l=chunkZOOVGXMK_cjs.h({n:27n,d:1n},chunkZOOVGXMK_cjs.h(chunkZOOVGXMK_cjs.h(e,e),o)),s=chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.g(a,u),l),chunkZOOVGXMK_cjs.h({n:27n,d:1n},chunkZOOVGXMK_cjs.h(e,chunkZOOVGXMK_cjs.h(e,e))));return {p:i,q:s,shift:r}}function en(e,t,n,o){let{p:r,q:i,shift:a}=fo(e,t,n,o),u=chunkZOOVGXMK_cjs.j(chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.h(be,chunkZOOVGXMK_cjs.h(r,chunkZOOVGXMK_cjs.h(r,r))),chunkZOOVGXMK_cjs.h({n:27n,d:1n},chunkZOOVGXMK_cjs.h(i,i))));return chunkZOOVGXMK_cjs.k(u,chunkZOOVGXMK_cjs.a)>0?{exact:[],approximate:yo(r,i,a)}:chunkZOOVGXMK_cjs.l(u)?{exact:po(r,i,a),approximate:[]}:{exact:bo(r,i,a),approximate:[]}}function po(e,t,n){if(chunkZOOVGXMK_cjs.l(e))return [chunkZOOVGXMK_cjs.p(n)];let o=chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(B,t),e),n),r=chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.j(chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(B,t),chunkZOOVGXMK_cjs.h(k,e))),n);return [o,r].sort(chunkZOOVGXMK_cjs.k).map(chunkZOOVGXMK_cjs.p)}function bo(e,t,n){let o=chunkZOOVGXMK_cjs.j(chunkZOOVGXMK_cjs.i(t,k)),r=chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.h(chunkZOOVGXMK_cjs.i(t,k),chunkZOOVGXMK_cjs.i(t,k)),chunkZOOVGXMK_cjs.h(chunkZOOVGXMK_cjs.i(e,B),chunkZOOVGXMK_cjs.h(chunkZOOVGXMK_cjs.i(e,B),chunkZOOVGXMK_cjs.i(e,B)))),i=chunkZOOVGXMK_cjs.O(r),a={kind:"call",name:"cbrt",args:[{kind:"add",left:chunkZOOVGXMK_cjs.p(o),right:i}]},u={kind:"call",name:"cbrt",args:[{kind:"sub",left:chunkZOOVGXMK_cjs.p(o),right:i}]},l={kind:"add",left:a,right:u},s={kind:"sub",left:a,right:u},p={kind:"add",left:chunkZOOVGXMK_cjs.p(n),right:{kind:"div",left:{kind:"neg",operand:l},right:chunkZOOVGXMK_cjs.p(k)}},h={kind:"mul",left:{kind:"div",left:{kind:"mul",left:s,right:chunkZOOVGXMK_cjs.O(B)},right:chunkZOOVGXMK_cjs.p(k)},right:chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.n)};return [{kind:"add",left:chunkZOOVGXMK_cjs.p(n),right:l},{kind:"sub",left:p,right:h},{kind:"add",left:p,right:h}]}function yo(e,t,n){let o=chunkZOOVGXMK_cjs.e(e),r=chunkZOOVGXMK_cjs.e(t),i=chunkZOOVGXMK_cjs.e(n),a=2*Math.sqrt(-o/3),u=3*r/(2*o)*Math.sqrt(-3/o),l=Math.acos(Math.min(1,Math.max(-1,u)))/3;return [0,1,2].map(s=>a*Math.cos(l-2*Math.PI*s/3)+i).sort((s,p)=>s-p)}function ho(e,t,n,o){let r=chunkZOOVGXMK_cjs.j(chunkZOOVGXMK_cjs.i(e,be)),i=chunkZOOVGXMK_cjs.h(e,e),a=chunkZOOVGXMK_cjs.g(t,chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(B,i),{n:8n,d:1n})),u=chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.g(n,chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(e,t),k)),chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(i,e),{n:8n,d:1n})),l=chunkZOOVGXMK_cjs.g(chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.g(o,chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(e,n),be)),chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(i,t),{n:16n,d:1n})),chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.h(B,chunkZOOVGXMK_cjs.h(i,i)),{n:256n,d:1n}));return {p:a,q:u,r:l,shift:r}}function tn(e,t,n,o,r,i){let a=V=>chunkZOOVGXMK_cjs.i(V,e),{p:u,q:l,r:s,shift:p}=ho(a(t),a(n),a(o),a(r)),h=chunkZOOVGXMK_cjs.l(l)?go(u,s):Io(u,l,s,i);if(h===null)return null;let x=chunkZOOVGXMK_cjs.l(p)?h:h.map(V=>({kind:"add",left:chunkZOOVGXMK_cjs.p(p),right:V}));return {exact:No(x),approximate:[]}}function No(e){let t=new Set,n=[];for(let o of e){let r=chunkZOOVGXMK_cjs.t(chunkZOOVGXMK_cjs.Q(o));t.has(r)||(t.add(r),n.push(o));}return n}function go(e,t){let n=chunkZOOVGXMK_cjs.g(chunkZOOVGXMK_cjs.h(e,e),chunkZOOVGXMK_cjs.h(be,t));if(chunkZOOVGXMK_cjs.k(n,chunkZOOVGXMK_cjs.a)<0)return vo(e,t);let o=chunkZOOVGXMK_cjs.N(n);return o!==null?Ro(chunkZOOVGXMK_cjs.j(e),o,chunkZOOVGXMK_cjs.l(n)):xo(e,t,n)}function Ro(e,t,n){let o=n?[chunkZOOVGXMK_cjs.i(e,k)]:[chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.f(e,t),k),chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.g(e,t),k)],r=[];for(let i of o){if(chunkZOOVGXMK_cjs.l(i)){r.push(chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.a));continue}let a=chunkZOOVGXMK_cjs.P(i);r.push({kind:"neg",operand:a},a);}return r}function xo(e,t,n){let o=chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.j(e)),r=chunkZOOVGXMK_cjs.O(n),i=chunkZOOVGXMK_cjs.k(e,chunkZOOVGXMK_cjs.a)<=0,a=[{node:ze({kind:"add",left:o,right:r}),positive:i||chunkZOOVGXMK_cjs.k(t,chunkZOOVGXMK_cjs.a)<=0},{node:ze({kind:"sub",left:o,right:r}),positive:i&&chunkZOOVGXMK_cjs.k(t,chunkZOOVGXMK_cjs.a)>=0}],u=[];for(let{node:l,positive:s}of a){let h={kind:"call",name:"sqrt",args:[s?l:{kind:"neg",operand:l}]},x=s?h:{kind:"mul",left:h,right:chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.n)};u.push({kind:"neg",operand:x},x);}return u}function ze(e){return {kind:"div",left:e,right:chunkZOOVGXMK_cjs.p(k)}}function vo(e,t){let n=chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.j(e),k),o=chunkZOOVGXMK_cjs.N(t),r=o===null?Jt(chunkZOOVGXMK_cjs.O(t),n):chunkZOOVGXMK_cjs.O(chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.f(o,n),k)),a={kind:"mul",left:o===null?Jt(chunkZOOVGXMK_cjs.O(t),chunkZOOVGXMK_cjs.j(n)):chunkZOOVGXMK_cjs.O(chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.g(o,n),k)),right:chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.n)},u={kind:"add",left:r,right:a},l={kind:"sub",left:r,right:a};return [{kind:"neg",operand:u},{kind:"neg",operand:l},l,u]}function Jt(e,t){let n=t.n>=0n?{kind:"add",left:e,right:chunkZOOVGXMK_cjs.p(t)}:{kind:"sub",left:e,right:chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.j(t))};return {kind:"call",name:"sqrt",args:[ze(n)]}}function Io(e,t,n,o){let r=[{n:1n,d:1n},chunkZOOVGXMK_cjs.h(k,e),chunkZOOVGXMK_cjs.g(chunkZOOVGXMK_cjs.h(e,e),chunkZOOVGXMK_cjs.h(be,n)),chunkZOOVGXMK_cjs.j(chunkZOOVGXMK_cjs.h(t,t))];for(let i of ue(r)){if(chunkZOOVGXMK_cjs.k(i,chunkZOOVGXMK_cjs.a)<=0)continue;let a=chunkZOOVGXMK_cjs.N(i);if(a===null)continue;let u=chunkZOOVGXMK_cjs.f(e,i),l=chunkZOOVGXMK_cjs.i(t,a),s=chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.g(u,l),k),p=chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.f(u,l),k),h={n:1n,d:1n};return [...o(h,a,s),...o(h,chunkZOOVGXMK_cjs.j(a),p)]}return null}var Mo=200,So=1e-14,Eo=1e-10,Ao=1e-10,nn=1e-9,ko=1e-8,Vo=4;function ye(e,t){return {re:e.re-t.re,im:e.im-t.im}}function To(e,t){return {re:e.re*t.re-e.im*t.im,im:e.re*t.im+e.im*t.re}}function rn(e,t){if(Math.abs(t.re)>=Math.abs(t.im)){let r=t.im/t.re,i=t.re+t.im*r;return {re:(e.re+e.im*r)/i,im:(e.im-e.re*r)/i}}let n=t.re/t.im,o=t.re*n+t.im;return {re:(e.re*n+e.im)/o,im:(e.im*n-e.re)/o}}function K(e){return Math.hypot(e.re,e.im)}function De(e,t){let n=0,o=0;for(let r of e){let i=n*t.re-o*t.im+r;o=n*t.im+o*t.re,n=i;}return {re:n,im:o}}function Oo(e,t){let n=K(t),o=0;for(let r of e)o=o*n+Math.abs(r);return o}function _o(e){let t=e.length-1,n=[];for(let o=0;o<t;o++)n.push(e[o]*(t-o));return n}function wo(e){let t=[...e].reverse(),o=[...chunkZOOVGXMK_cjs.K(t)].reverse().map(chunkZOOVGXMK_cjs.e);return o.some(r=>!Number.isFinite(r))?null:o}function Do(e){let t=e.length-1,n=0;for(let a=1;a<e.length;a++)n=Math.max(n,Math.abs(e[a]));let o=1+n,r=-e[1]/t,i=[];for(let a=0;a<t;a++){let u=2*Math.PI*a/t+Math.PI/(2*t);i.push({re:r+o*Math.cos(u),im:o*Math.sin(u)});}return i}function Co(e){let t=e.length-1,n=Do(e);for(let o=0;o<Mo;o++){let r=0,i=1;for(let a=0;a<t;a++){let u={re:1,im:0};for(let s=0;s<t;s++)a!==s&&(u=To(u,ye(n[a],n[s])));if(u.re===0&&u.im===0){n[a]={re:n[a].re+1e-6*(a+1),im:n[a].im+1e-6};continue}let l=rn(De(e,n[a]),u);if(!Number.isFinite(l.re)||!Number.isFinite(l.im))return null;n[a]=ye(n[a],l),r=Math.max(r,K(l)),i=Math.max(i,K(n[a]));}if(r<=So*i)return n}return null}function on(e,t,n){let o=n;for(let r=0;r<Vo;r++){let i=De(t,o);if(i.re===0&&i.im===0)break;let a=ye(o,rn(De(e,o),i));if(!Number.isFinite(a.re)||!Number.isFinite(a.im))break;o=a;}return o}function Po(e,t,n){let o=Math.max(1,K(n));if(n.im!==0&&Math.abs(n.im)<=nn*o){let r=on(e,t,{re:n.re,im:0});if(Je(e,r))return {re:r.re,im:0}}if(n.re!==0&&Math.abs(n.re)<=nn*o){let r=on(e,t,{re:0,im:n.im});if(Je(e,r))return {re:0,im:r.im}}return n}function Je(e,t){return !Number.isFinite(t.re)||!Number.isFinite(t.im)?false:K(De(e,t))<=Eo*Oo(e,t)}function Lo(e){let t=[...e],n=t.map(o=>o.im===0);for(let o=0;o<t.length;o++){if(n[o])continue;let r={re:t[o].re,im:-t[o].im},i=-1,a=Number.POSITIVE_INFINITY;for(let p=o+1;p<t.length;p++){if(n[p])continue;let h=K(ye(t[p],r));h<a&&(a=h,i=p);}if(i===-1||a>ko*Math.max(1,K(t[o])))continue;let u=(t[o].re+t[i].re)/2,l=(Math.abs(t[o].im)+Math.abs(t[i].im))/2,s=t[o].im<0?-1:1;t[o]={re:u,im:s*l},t[i]={re:u,im:-s*l},n[o]=true,n[i]=true;}return t}function Fo(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let o=Math.max(1,K(e[t]),K(e[n]));if(K(ye(e[t],e[n]))<=Ao*o)return false}return true}function an(e){let t=wo(e);if(t===null)return null;if(t.length<2)return [];let n=Co(t);if(n===null)return null;let o=_o(t),r=Lo(n).map(i=>Po(t,o,i));for(let i of r)if(!Je(t,i))return null;return Fo(r)?[...r].sort((i,a)=>i.re-a.re||i.im-a.im):null}var un=8;function Uo(e,t){let n=chunkZOOVGXMK_cjs.a;for(let o of e)n=chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.h(n,t),o);return n}function $o(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(chunkZOOVGXMK_cjs.f(e[o],chunkZOOVGXMK_cjs.h(n[o-1],t)));return n}function ln(e,t,n){let o=chunkZOOVGXMK_cjs.g(chunkZOOVGXMK_cjs.h(t,t),chunkZOOVGXMK_cjs.h(Yo(),chunkZOOVGXMK_cjs.h(e,n))),r=chunkZOOVGXMK_cjs.h(qo(),e);if(chunkZOOVGXMK_cjs.k(o,chunkZOOVGXMK_cjs.a)<0)return Bo(chunkZOOVGXMK_cjs.j(t),o,r);if(chunkZOOVGXMK_cjs.l(o))return [chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.j(t),r))];let i=chunkZOOVGXMK_cjs.L(o.n),a=chunkZOOVGXMK_cjs.L(o.d);if(i!==null&&a!==null){let h={n:i,d:a},x=chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.f(chunkZOOVGXMK_cjs.j(t),h),r),V=chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.g(chunkZOOVGXMK_cjs.j(t),h),r);return chunkZOOVGXMK_cjs.k(V,x)<=0?[chunkZOOVGXMK_cjs.p(V),chunkZOOVGXMK_cjs.p(x)]:[chunkZOOVGXMK_cjs.p(x),chunkZOOVGXMK_cjs.p(V)]}let u=chunkZOOVGXMK_cjs.O(o),l=chunkZOOVGXMK_cjs.k(r,chunkZOOVGXMK_cjs.a)>0,s={kind:"div",left:{kind:"sub",left:chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.j(t)),right:u},right:chunkZOOVGXMK_cjs.p(r)},p={kind:"div",left:{kind:"add",left:chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.j(t)),right:u},right:chunkZOOVGXMK_cjs.p(r)};return l?[s,p]:[p,s]}function Bo(e,t,n){let o=chunkZOOVGXMK_cjs.j(t),r=chunkZOOVGXMK_cjs.L(o.n),i=chunkZOOVGXMK_cjs.L(o.d);if(r!==null&&i!==null){let s=chunkZOOVGXMK_cjs.i({n:r,d:i},n),p=chunkZOOVGXMK_cjs.i(e,n);return [chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.o(p,chunkZOOVGXMK_cjs.j(s))),chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.o(p,s))]}let a=chunkZOOVGXMK_cjs.i(e,n),u=chunkZOOVGXMK_cjs.i(o,chunkZOOVGXMK_cjs.h(n,n)),l={kind:"mul",left:chunkZOOVGXMK_cjs.O(u),right:chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.n)};return chunkZOOVGXMK_cjs.l(a)?[{kind:"neg",operand:l},l]:[{kind:"sub",left:chunkZOOVGXMK_cjs.p(a),right:l},{kind:"add",left:chunkZOOVGXMK_cjs.p(a),right:l}]}function qo(){return {n:2n,d:1n}}function Yo(){return {n:4n,d:1n}}function Go(e){return {re:e,im:0}}function sn(e,t,n){let o=chunkZOOVGXMK_cjs.C({kind:"sub",left:e,right:t});if(o===null)return {kind:"unsupported",reason:"this is not a polynomial equation (it divides by an unknown, or calls a function of one)"};let r=o.vars.filter(u=>u!==n),i=chunkZOOVGXMK_cjs.z(o,n);if(r.length>0)return i!==1?{kind:"unsupported",reason:`solving for "${n}" needs the equation to be linear in it when other unknowns (${r.join(", ")}) are present`}:jo(o,n);if(i===0)return o.terms.size===0?{kind:"identity"}:{kind:"contradiction"};if(i>un)return {kind:"unsupported",reason:`degree ${i} is above the supported maximum of ${un}`};let a=[...chunkZOOVGXMK_cjs.B(o,n)].reverse();return Zo(a)}function jo(e,t){let n=new Map,o=new Map;for(let[u,l]of e.terms){let s=u.split("*").filter(h=>h.length>0),p=s.indexOf(t);p===-1?o.set(u,l):(s.splice(p,1),n.set(s.join("*"),l));}let r=u=>{let l=new Set;for(let s of u.keys())for(let p of s.split("*"))p.length>0&&l.add(p.split("^")[0]);return [...l].sort()},i=chunkZOOVGXMK_cjs.E({terms:n,vars:r(n)});return {kind:"roots",exact:[{kind:"div",left:{kind:"neg",operand:chunkZOOVGXMK_cjs.E({terms:o,vars:r(o)})},right:i}],approximate:[]}}function Ko(e){return e.length===4?en(e[0],e[1],e[2],e[3]):e.length===5?tn(e[0],e[1],e[2],e[3],e[4],ln):null}function Xo(e){let t=[],n=[...e],o=0;for(;n.length>1&&chunkZOOVGXMK_cjs.l(n[n.length-1]);)n=n.slice(0,-1),o++;for(o>0&&t.push(chunkZOOVGXMK_cjs.a);n.length>1;){let r=ue(n);if(r.length===0)break;for(let i of r){let a=0;for(;n.length>1&&chunkZOOVGXMK_cjs.l(Uo(n,i));)n=$o(n,i),a++;a>0&&t.push(i);}}return {roots:t.sort(chunkZOOVGXMK_cjs.k),remaining:n}}function Zo(e){let{roots:t,remaining:n}=Xo(e),o=t.map(chunkZOOVGXMK_cjs.p),r=[],i=n.length-1,a=e.length-n.length;if(i<=0)return le(o,r,a,0,"");if(i===1)return o.push(chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.i(chunkZOOVGXMK_cjs.j(n[1]),n[0]))),le(o,r,a+1,0,"");if(i===2)return o.push(...ln(n[0],n[1],n[2])),le(o,r,a+2,0,"");let u=Ko(n);if(u!==null)return o.push(...u.exact),r.push(...u.approximate.map(Go)),le(o,r,a+i,0,"");let l=an(n);return l!==null?(r.push(...l),le(o,r,a+i,0,"")):le(o,r,a,i,`a degree-${i} factor of it has no exact solution here and the numerical method did not converge on that factor`)}function le(e,t,n,o,r){let i=e.length+t.length,a=n>=1&&(i<1||i>n);return o>0||a?{kind:"incomplete",exact:e,approximate:t,missing:a?Math.max(1,n+o-i):o,reason:a?`${i} root${i===1?"":"s"} were produced for a degree-${n+o} equation, which does not add up`:r}:{kind:"roots",exact:e,approximate:t}}var cn={0:"sqrt",1:"abs",2:"sin",3:"cos",4:"tan",5:"log",6:"ceil",7:"floor",8:"round",11:"asin",12:"acos",13:"atan",14:"atan2",15:"sinh",16:"cosh",17:"tanh",18:"asinh",19:"acosh",20:"atanh",21:"cbrt",23:"expm1",24:"exp",26:"hypot",28:"log10",29:"log1p",30:"log2",33:"sign",34:"trunc",35:"degtorad",36:"radtodeg",61:"root",62:"fact"},Ho=31,hi=new Set([67,68,69,70,71,72,73,74,75,76,77,78,79]);function O(e){if(e.type===9)return e.value;if(e.type===13||e.type===12)return null;let t=e.toNumber();return Number.isFinite(t)?chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.d(t)):null}function _(e){let t=chunkZOOVGXMK_cjs.Q(e);return t.kind==="const"?chunk5FGOIDLS_cjs.n(chunkZOOVGXMK_cjs.e(t.value)):chunk5FGOIDLS_cjs.J(t)}function Ce(e){return chunk5FGOIDLS_cjs.O("SYMBOLIC_UNSUPPORTED_FUNCTION",`"${e}" cannot be applied to an expression that still contains an unknown.`)}function Ni(e,t){let n=O(e),o=O(t);return n===null||o===null?Ce("^"):_(chunkZOOVGXMK_cjs.r(n,o))}function gi(e){let t=O(e);return t===null?Ce("-"):_({kind:"neg",operand:t})}function Ri(e,t){let n=[];for(let r of t){let i=chunk5FGOIDLS_cjs.P(r);if(i)return i;let a=O(r);if(a===null)return Ce(cn[e]??`builtin ${e}`);n.push(a);}if(e===Ho&&n.length===2)return _(chunkZOOVGXMK_cjs.r(n[0],n[1]));let o=cn[e];return o===void 0?Ce(`builtin ${e}`):_(chunkZOOVGXMK_cjs.s(o,n))}function Wo(e){let t=_(e);return t.type===0&&!Number.isInteger(t.toNumber())?chunk5FGOIDLS_cjs.J(e):t}function Qo(e){return e.im===0?chunk5FGOIDLS_cjs.n(e.re):chunk5FGOIDLS_cjs.J(chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.o(chunkZOOVGXMK_cjs.d(e.re),chunkZOOVGXMK_cjs.d(e.im))))}function zo(e){switch(e.kind){case "identity":return chunk5FGOIDLS_cjs.t("true for every value");case "contradiction":return chunk5FGOIDLS_cjs.t("no solution");case "unsupported":return chunk5FGOIDLS_cjs.O("SYMBOLIC_SOLVE_UNSUPPORTED",`Cannot solve this equation: ${e.reason}.`);case "incomplete":{let t=e.exact.length+e.approximate.length;return chunk5FGOIDLS_cjs.O("SYMBOLIC_SOLVE_INCOMPLETE",`Only ${t} of this equation's ${t+e.missing} roots could be found: ${e.reason}.`)}case "roots":{let t=e.exact.map(Wo);for(let n of e.approximate)t.push(Qo(n));return t.length===0?chunk5FGOIDLS_cjs.t("no solution"):t.length===1?t[0]:chunk5FGOIDLS_cjs.C(1,t.length,t.map(n=>n.type===9?n.value:n.toNumber()))}}}function fn(e,t,n){let o=O(e),r=O(t);return o===null||r===null?chunk5FGOIDLS_cjs.O("SYMBOLIC_NONFINITE_OPERAND","An equation side has no exact value to solve with."):zo(sn(o,r,n))}function he(e,t){if(e.type===6&&t.type===6){if(e.unit===t.unit)return {lv:e.toNumber(),rv:t.toNumber(),unit:e.unit,sameMeasure:true};let n=chunkIANAMBJQ_cjs.c(e.unit),o=chunkIANAMBJQ_cjs.c(t.unit),r=chunk4BZIYU7S_cjs.c.isCurrency(e.unit)&&chunk4BZIYU7S_cjs.c.isCurrency(t.unit);if(n&&n===o){let i=chunkIANAMBJQ_cjs.e(t.toNumber(),t.unit,e.unit);return {lv:e.toNumber(),rv:i,unit:e.unit,sameMeasure:true}}if(r){let i=chunk4BZIYU7S_cjs.c.convertSync(t.toNumber(),t.unit,e.unit);if(i!==null)return {lv:e.toNumber(),rv:i,unit:e.unit,sameMeasure:true}}return {lv:e.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:false}}return e.type===6?{lv:e.toNumber(),rv:t.toNumber(),unit:e.unit,sameMeasure:true}:t.type===6?{lv:e.toNumber(),rv:t.toNumber(),unit:t.unit,sameMeasure:true}:{lv:e.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:true}}var Jo=1e-12;function er(e,t,n){let o=0;return Number.isFinite(e)&&Math.abs(e)>o&&(o=Math.abs(e)),Number.isFinite(t)&&Math.abs(t)>o&&(o=Math.abs(t)),Number.isFinite(n)&&Math.abs(n)>o&&(o=Math.abs(n)),o}function Oi(e,t){let{lv:n,rv:o,sameMeasure:r}=he(e,t);if(!r)return {lv:n,rv:o,equal:false,sameMeasure:false};if(e.type===6&&t.type===6&&e.unit!==void 0&&e.unit===t.unit&&e.exact!==void 0&&t.exact!==void 0&&chunk4BZIYU7S_cjs.c.isCurrency(e.unit))return {lv:n,rv:o,equal:chunkZOOVGXMK_cjs.qa(e.exact,t.exact)===0,sameMeasure:true};if(n===o)return {lv:n,rv:o,equal:true,sameMeasure:true};if(!Number.isFinite(n)||!Number.isFinite(o))return {lv:n,rv:o,equal:false,sameMeasure:true};let i=er(n,o,t.toNumber());return {lv:n,rv:o,equal:Math.abs(n-o)<=i*Jo,sameMeasure:true}}var tr={time:"duration",luminousIntensity:"luminous intensity"},nr=new Set(["money","data"]),or={add:"added",sub:"subtracted",mul:"multiplied",div:"divided"};function Pe(e){if(chunk4BZIYU7S_cjs.c.isCurrency(e))return "money";let t=chunkIANAMBJQ_cjs.c(e);if(t!==void 0)return tr[t]??t}function dn(e){return nr.has(e)?e:/^[aeiou]/.test(e)?`an ${e}`:`a ${e}`}function Fe(e,t,n){let o=e===void 0?void 0:Pe(e),r=t===void 0?void 0:Pe(t);if(o!==void 0&&r!==void 0&&o!==r)return `${o} and ${r} cannot be ${n}`}function rr(e){return e!==void 0?or[e]??"combined":"combined"}function _i(e,t){let n=Pe(e),o=Pe(t);if(n!==void 0&&o!==void 0&&n!==o)return `${dn(n)} cannot be converted to ${dn(o)}`}function wi(e,t){let n=e.type===6?e.unit:void 0,o=t.type===6?t.unit:void 0,r=Fe(n,o,"compared");return chunk5FGOIDLS_cjs.O("INCOMPATIBLE_UNITS",r??`Cannot compare incompatible units: ${n??"?"} and ${o??"?"}`)}function pn(e){if(e.type===2)return e.value;let t=e.toNumber();if(!Number.isInteger(t)){let n=Number.isNaN(t)?"NaN":String(t);throw chunkSOMGSIO4_cjs.c.execution("BIGINT_INEXACT_OPERAND",`A whole-number (n) value can only be combined with another whole number, and ${n} is not one`,{operand:n})}return BigInt(t)}function Di(){return chunkSOMGSIO4_cjs.c.execution("BIGINT_DIVISION_BY_ZERO","Division by zero: a whole-number (n) division is exact integer division, which has no answer at zero, unlike 1 / 0 which is Infinity")}function Ci(e,t){let n=bn(e),o=bn(t);return n===null||o===null?null:n<o?-1:n>o?1:0}function bn(e){if(e.type===2)return e.value;let t=e.toNumber();return Number.isInteger(t)?BigInt(t):null}function et(e,t){return Number.isFinite(t)?Math.pow(e,t):e===1||e===-1&&!Number.isNaN(t)?1:Math.pow(e,t)}function yn(e){return e.exact!==void 0?e.exact:chunkZOOVGXMK_cjs.ha(e.toNumber())}function ir(e,t,n){let o=e.type===6&&e.unit!==void 0&&e.exact!==void 0&&chunk4BZIYU7S_cjs.c.isCurrency(e.unit),r=t.type===6&&t.unit!==void 0&&t.exact!==void 0&&chunk4BZIYU7S_cjs.c.isCurrency(t.unit);if(!o&&!r)return null;let i,a,u;if(o&&r){if(e.unit!==t.unit||n==="div")return null;i=e.exact,a=t.exact,u=e.unit;}else if(o&&t.type!==6)i=e.exact,u=e.unit,a=yn(t);else if(r&&e.type!==6)a=t.exact,u=t.unit,i=yn(e);else return null;if(i===null||a===null)return null;let l;switch(n){case "add":l=chunkZOOVGXMK_cjs.ja(i,a);break;case "sub":l=chunkZOOVGXMK_cjs.ka(i,a);break;case "mul":l=chunkZOOVGXMK_cjs.la(i,a);break;case "div":if(chunkZOOVGXMK_cjs.na(a))return null;l=chunkZOOVGXMK_cjs.pa(i,a);break}return chunk5FGOIDLS_cjs.v(chunkZOOVGXMK_cjs.ra(l),u,l)}function Le(e){return e.rational!==void 0?e.rational:(e.type===0||e.type===1)&&typeof e.value=="number"&&Number.isInteger(e.value)?chunkZOOVGXMK_cjs.c(BigInt(e.value)):null}function Pi(e,t,n){let o=Le(e);if(o===null)return null;let r=Le(t);if(r===null||n==="div"&&chunkZOOVGXMK_cjs.l(r))return null;let i;try{switch(n){case "add":i=chunkZOOVGXMK_cjs.f(o,r);break;case "sub":i=chunkZOOVGXMK_cjs.g(o,r);break;case "mul":i=chunkZOOVGXMK_cjs.h(o,r);break;case "div":i=chunkZOOVGXMK_cjs.i(o,r);break}}catch{return null}return chunk5FGOIDLS_cjs.p(chunkZOOVGXMK_cjs.e(i),i)}function Li(e,t,n){if(e.type!==0||t.type!==0)return null;let o=e.value,r=t.value,i=e.uncertainty??0,a=t.uncertainty??0,u,l;switch(n){case "add":u=o+r,l=Math.hypot(i,a);break;case "sub":u=o-r,l=Math.hypot(i,a);break;case "mul":u=o*r,l=Math.hypot(r*i,o*a);break;case "div":u=o/r,l=Math.hypot(i/r,o*a/(r*r));break}return chunk5FGOIDLS_cjs.q(u,l)}function Fi(e,t){let n=Le(e);if(n===null)return null;let o=Le(t);return o===null?null:chunkZOOVGXMK_cjs.k(n,o)}function Ui(e,t,n,o,r){if(e.type===13)return e;if(t.type===13)return t;if(e.type===12)return e;if(t.type===12)return t;if(r&&(e.type===9||t.type===9)){let i=O(e),a=O(t);return i===null||a===null?chunk5FGOIDLS_cjs.O("SYMBOLIC_NONFINITE_OPERAND","A symbolic expression cannot combine with a value that has no exact number (NaN or infinity)."):chunk5FGOIDLS_cjs.J(chunkZOOVGXMK_cjs.Q({kind:r,left:i,right:a}))}if(e.type===0&&t.type===0)return chunk5FGOIDLS_cjs.n(n(e.value,t.value));if(e.type===2||t.type===2){let i=pn(e),a=pn(t);return o?chunk5FGOIDLS_cjs.s(o(i,a)):chunk5FGOIDLS_cjs.s(i+a)}if(e.type===6||t.type===6){if(r){let s=ir(e,t,r);if(s)return s}let{lv:i,rv:a,unit:u,sameMeasure:l}=he(e,t);if(!l){let s=e.type===6?e.unit:void 0,p=t.type===6?t.unit:void 0,h=Fe(s,p,rr(r));return chunk5FGOIDLS_cjs.O("INCOMPATIBLE_UNITS",h??`Cannot combine incompatible units: ${s??"?"} and ${p??"?"}`)}return chunk5FGOIDLS_cjs.u(n(i,a),u)}if(e.type===7&&t.type===7){let i=e.value,a=t.value;if(!chunkZOOVGXMK_cjs.V(i,a))return chunk5FGOIDLS_cjs.O("DIMENSION_MISMATCH",`Cannot combine matrices of different shapes: ${i.rows}x${i.cols} and ${a.rows}x${a.cols}`);let u=new Array(i.data.length);for(let l=0;l<i.data.length;l++)u[l]=n(i.data[l],a.data[l]);return chunk5FGOIDLS_cjs.C(i.rows,i.cols,u)}if(e.type===7){let i=e.value,a=t.toNumber(),u=i.data.map(l=>n(l,a));return chunk5FGOIDLS_cjs.C(i.rows,i.cols,u)}if(t.type===7){let i=t.value,a=e.toNumber(),u=i.data.map(l=>n(a,l));return chunk5FGOIDLS_cjs.C(i.rows,i.cols,u)}return chunk5FGOIDLS_cjs.n(n(e.toNumber(),t.toNumber()))}var hn=254,Nn=200,Ne=class{constructor(){this.handlers=new Map;this.nextOpcode=Nn+1;}register(t){this.handlers.set(t.opcode,t.handler);}unregister(t){this.handlers.delete(t);}get(t){return this.handlers.get(t)}has(t){return this.handlers.has(t)}allocateOpcode(){if(this.nextOpcode>hn)throw chunkSOMGSIO4_cjs.c.config("OPCODE_POOL_EXHAUSTED",`OpRegistry: dynamic opcode pool exhausted (max ${hn-Nn} allocations).`);return this.nextOpcode++}},qi=new Ne;var Rn=chunkZOOVGXMK_cjs.ga(1);function ge(e,t){return chunk4BZIYU7S_cjs.c.isCurrency(t)?e.exact??chunkZOOVGXMK_cjs.ha(e.toNumber()):null}function tt(e){if(!Number.isFinite(e))return null;if(Number.isInteger(e))return chunkZOOVGXMK_cjs.ga(BigInt(e));let t=String(e);return /^-?\d+\.\d+$/.test(t)?chunkZOOVGXMK_cjs.ia(t):null}function xn(e,t,n){let o=ge(e,n),r=tt(t);if(o!==null&&r!==null){let i=chunkZOOVGXMK_cjs.la(o,r);return chunk5FGOIDLS_cjs.v(chunkZOOVGXMK_cjs.ra(i),n,i)}return chunk5FGOIDLS_cjs.u(e.toNumber()*t,n)}function vn(e,t,n,o){let r=ge(e,t),i=tt(n);if(r!==null&&i!==null){let a=chunkZOOVGXMK_cjs.ja(Rn,o===1?i:chunkZOOVGXMK_cjs.ma(i)),u=chunkZOOVGXMK_cjs.la(r,a);return chunk5FGOIDLS_cjs.v(chunkZOOVGXMK_cjs.ra(u),t,u)}return chunk5FGOIDLS_cjs.u(e.toNumber()*(1+o*n),t)}function In(e){let t=tt(e);return t===null?null:chunkZOOVGXMK_cjs.ja(Rn,t)}function Mn(e,t,n){let o=ge(e,t),r=In(n);if(o===null||r===null||chunkZOOVGXMK_cjs.na(r))return null;let i=chunkZOOVGXMK_cjs.pa(o,r);return chunk5FGOIDLS_cjs.v(chunkZOOVGXMK_cjs.ra(i),t,i)}function Sn(e,t,n){let o=ge(e,t),r=In(n);if(o===null||r===null||chunkZOOVGXMK_cjs.na(r))return null;let i=chunkZOOVGXMK_cjs.ka(o,chunkZOOVGXMK_cjs.pa(o,r));return chunk5FGOIDLS_cjs.v(chunkZOOVGXMK_cjs.ra(i),t,i)}function En(e,t){let n=e.unit,o=n!==void 0&&chunk4BZIYU7S_cjs.c.isCurrency(n)?ar(e,n):null;if(o===null)return {unit:n,shares:[{value:e.toNumber()/t,count:t}]};let r=BigInt(t),i=o/r,a=o-i*r,u=Number(a<0n?-a:a),l=o<0n?-1n:1n,s=gn(i,t-u);return u===0?{unit:n,shares:[s]}:{unit:n,shares:[s,gn(i+l,u)]}}function gn(e,t){let n=chunkZOOVGXMK_cjs.fa(e,2);return {value:chunkZOOVGXMK_cjs.ra(n),exact:n,count:t}}function ar(e,t){let n=ge(e,t);return n===null?null:chunkZOOVGXMK_cjs.oa(n,2).coef}var ur=12;function An(e,t){if(e.length===0||t.length===0)return [];let n=new Array(e.length+t.length-1).fill(chunkZOOVGXMK_cjs.a);return e.forEach((o,r)=>{t.forEach((i,a)=>{n[r+a]=chunkZOOVGXMK_cjs.f(n[r+a],chunkZOOVGXMK_cjs.h(o,i));});}),n}function lr(e,t){let n=[chunkZOOVGXMK_cjs.b];for(let o=0;o<t;o++)n=An(n,e);return n}function nt(e,t){return e.map(n=>chunkZOOVGXMK_cjs.i(n,t))}function sr(e,t){let n=[],o=0;for(;o<e.length&&chunkZOOVGXMK_cjs.l(e[o]);)o++;o>0&&n.push({base:[chunkZOOVGXMK_cjs.a,chunkZOOVGXMK_cjs.b],power:o});let r=e.slice(o);if(r.length>1){let i=Qe([...r].reverse(),t);for(let a of i.factors){let u=chunkZOOVGXMK_cjs.C(a.base);if(u===null)return null;n.push({base:[...chunkZOOVGXMK_cjs.B(u,t)],power:a.power});}}return n.length>0?n:null}function cr(e){let t=[];return e.forEach((n,o)=>{let r=n.base.length-1;for(let i=1;i<=n.power;i++)for(let a=0;a<r;a++)t.push({factor:o,power:i,degree:a});}),t}function mr(e,t,n){let o=lr(t[e.factor].base,e.power),{quotient:r,remainder:i}=chunkZOOVGXMK_cjs.H(n,o);if(!chunkZOOVGXMK_cjs.G(i))return null;let a=new Array(e.degree).fill(chunkZOOVGXMK_cjs.a);return a.push(chunkZOOVGXMK_cjs.b),An(r,a)}function fr(e,t){let n=t.length;for(let o=0;o<n;o++){let r=-1;for(let i=o;i<n;i++)if(!chunkZOOVGXMK_cjs.l(e[i][o])){r=i;break}if(r===-1)return null;[e[o],e[r]]=[e[r],e[o]],[t[o],t[r]]=[t[r],t[o]];for(let i=0;i<n;i++){if(i===o||chunkZOOVGXMK_cjs.l(e[i][o]))continue;let a=chunkZOOVGXMK_cjs.i(e[i][o],e[o][o]);for(let u=o;u<n;u++)e[i][u]=chunkZOOVGXMK_cjs.g(e[i][u],chunkZOOVGXMK_cjs.h(a,e[o][u]));t[i]=chunkZOOVGXMK_cjs.g(t[i],chunkZOOVGXMK_cjs.h(a,t[o]));}}return t.map((o,r)=>chunkZOOVGXMK_cjs.i(o,e[r][r]))}function ot(e,t,n){if(t.length<2||t.length-1>ur)return null;let o=chunkZOOVGXMK_cjs.I(e,t),r=o.length>1?chunkZOOVGXMK_cjs.H(e,o).quotient:[...e],i=o.length>1?chunkZOOVGXMK_cjs.H(t,o).quotient:[...t];if(i.length===1)return {polynomial:nt(r,i[0]),terms:[]};if(i.length===0)return null;let a=i[i.length-1],u=nt(i,a),l=nt(r,a),{quotient:s,remainder:p}=chunkZOOVGXMK_cjs.H(l,u);if(chunkZOOVGXMK_cjs.G(p))return {polynomial:s,terms:[]};let h=sr(u,n);if(h===null)return null;let x=dr(h,u,p);return x===null?null:{polynomial:s,terms:x}}function dr(e,t,n){let o=cr(e),r=t.length-1;if(o.length!==r)return null;let i=[];for(let s of o){let p=mr(s,e,t);if(p===null)return null;i.push(p);}let a=[];for(let s=0;s<r;s++)a.push(i.map(p=>p[s]??chunkZOOVGXMK_cjs.a));let u=[];for(let s=0;s<r;s++)u.push(n[s]??chunkZOOVGXMK_cjs.a);let l=fr(a,u);return l===null?null:pr(o,l,e)}function pr(e,t,n){let o=new Map;e.forEach((i,a)=>{let u=`${i.factor}:${i.power}`,l=o.get(u)??[];l[i.degree]=t[a],o.set(u,l);});let r=[];for(let[i,a]of o){let[u,l]=i.split(":").map(Number),s=[...a].map(p=>p??chunkZOOVGXMK_cjs.a);s.every(chunkZOOVGXMK_cjs.l)||r.push({numerator:s,base:n[u].base,power:l});}return r}function Re(e,t){let n=new Map;return e.forEach((o,r)=>{chunkZOOVGXMK_cjs.l(o)||n.set(r===0?"":r===1?t:`${t}^${r}`,o);}),n.size===0?chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.a):chunkZOOVGXMK_cjs.E({terms:n,vars:e.length>1?[t]:[]})}function kn(e){let t=rt(e);if(t===null)return e;let n=ot(t.numerator,t.denominator,t.variable);if(n===null||n.terms.length===0)return e;let o=n.polynomial.length>0?Re(n.polynomial,t.variable):null;for(let r of n.terms){let i=Re(r.base,t.variable),a=r.power===1?i:chunkZOOVGXMK_cjs.r(i,chunkZOOVGXMK_cjs.p({n:BigInt(r.power),d:1n})),u=br(r.numerator),l=u?r.numerator.map(p=>chunkZOOVGXMK_cjs.j(p)):r.numerator,s={kind:"div",left:Re(l,t.variable),right:a};o===null?o=u?{kind:"neg",operand:s}:s:o={kind:u?"sub":"add",left:o,right:s};}return o===null?e:chunkZOOVGXMK_cjs.Q(o)}function br(e){return e.some(t=>t.n<0n)&&e.every(t=>t.n<=0n)}function rt(e){if(e.kind!=="div")return null;let t=chunkZOOVGXMK_cjs.C(e.left),n=chunkZOOVGXMK_cjs.C(e.right);if(t===null||n===null)return null;let o=chunkZOOVGXMK_cjs.A(n);return o===null||t.vars.some(r=>r!==o)?null:{numerator:chunkZOOVGXMK_cjs.B(t,o),denominator:chunkZOOVGXMK_cjs.B(n,o),variable:o}}var it=16;function Vn(){return chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.a)}function X(){return chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.b)}function yr(e,t){switch(e){case "sin":return chunkZOOVGXMK_cjs.s("cos",[t]);case "cos":return {kind:"neg",operand:chunkZOOVGXMK_cjs.s("sin",[t])};case "tan":return {kind:"div",left:X(),right:chunkZOOVGXMK_cjs.r(chunkZOOVGXMK_cjs.s("cos",[t]),chunkZOOVGXMK_cjs.p(2))};case "exp":return chunkZOOVGXMK_cjs.s("exp",[t]);case "log":return {kind:"div",left:X(),right:t};case "sqrt":return {kind:"div",left:X(),right:{kind:"mul",left:chunkZOOVGXMK_cjs.p(2),right:chunkZOOVGXMK_cjs.s("sqrt",[t])}};case "asin":return {kind:"div",left:X(),right:chunkZOOVGXMK_cjs.s("sqrt",[Tn(t)])};case "acos":return {kind:"neg",operand:{kind:"div",left:X(),right:chunkZOOVGXMK_cjs.s("sqrt",[Tn(t)])}};case "atan":return {kind:"div",left:X(),right:hr(t)};case "sinh":return chunkZOOVGXMK_cjs.s("cosh",[t]);case "cosh":return chunkZOOVGXMK_cjs.s("sinh",[t]);case "tanh":return {kind:"div",left:X(),right:chunkZOOVGXMK_cjs.r(chunkZOOVGXMK_cjs.s("cosh",[t]),chunkZOOVGXMK_cjs.p(2))};case "abs":return chunkZOOVGXMK_cjs.s("sign",[t]);default:return null}}function Tn(e){return {kind:"sub",left:X(),right:chunkZOOVGXMK_cjs.r(e,chunkZOOVGXMK_cjs.p(2))}}function hr(e){return {kind:"add",left:X(),right:chunkZOOVGXMK_cjs.r(e,chunkZOOVGXMK_cjs.p(2))}}function xe(e,t,n=1){if(n<0||!Number.isInteger(n))throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT","A derivative order must be a whole number, at least zero.");if(n>it)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT",`A derivative order above ${it} is not supported.`,{limit:it});let o=chunkZOOVGXMK_cjs.Q(e);for(let r=0;r<n;r++)o=chunkZOOVGXMK_cjs.Q(P(o,t));return o}function P(e,t){switch(e.kind){case "const":case "complex":return Vn();case "var":return e.name===t?X():Vn();case "add":return {kind:"add",left:P(e.left,t),right:P(e.right,t)};case "sub":return {kind:"sub",left:P(e.left,t),right:P(e.right,t)};case "neg":return {kind:"neg",operand:P(e.operand,t)};case "mul":return {kind:"add",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}};case "div":return {kind:"div",left:{kind:"sub",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}},right:chunkZOOVGXMK_cjs.r(e.right,chunkZOOVGXMK_cjs.p(2))};case "pow":return Nr(e,t);case "call":{if(e.args.length!==1)return at(e,t);let n=yr(e.name,e.args[0]);return n===null?at(e,t):{kind:"mul",left:n,right:P(e.args[0],t)}}}}function Nr(e,t){if(e.exponent.kind==="const"){let n=chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.g(e.exponent.value,chunkZOOVGXMK_cjs.b));return {kind:"mul",left:{kind:"mul",left:e.exponent,right:chunkZOOVGXMK_cjs.r(e.base,n)},right:P(e.base,t)}}return e.base.kind==="const"&&e.base.value.n>0n?{kind:"mul",left:{kind:"mul",left:e,right:chunkZOOVGXMK_cjs.s("log",[e.base])},right:P(e.exponent,t)}:at(e,t)}function at(e,t){return chunkZOOVGXMK_cjs.s("der",[e,chunkZOOVGXMK_cjs.q(t)])}function On(e,t){let n=chunkZOOVGXMK_cjs.C(e);if(n===null||n.vars.filter(u=>u!==t).length>0||chunkZOOVGXMK_cjs.z(n,t)>1)return null;let r=chunkZOOVGXMK_cjs.B(n,t),i=r[0]??{n:0n,d:1n},a=r[1]??{n:0n,d:1n};return chunkZOOVGXMK_cjs.l(a)?null:{slope:a,intercept:i}}function gr(e,t){let n=chunkZOOVGXMK_cjs.C(e);if(n===null)return null;let o=n.vars.filter(a=>a!==t);if(o.length>0)return {ok:false,reason:`it involves more than one unknown (${o.join(", ")})`};let r=chunkZOOVGXMK_cjs.B(n,t),i=chunkZOOVGXMK_cjs.p(0);return r.forEach((a,u)=>{if(chunkZOOVGXMK_cjs.l(a))return;let l=u+1,s=chunkZOOVGXMK_cjs.i(a,{n:BigInt(l),d:1n}),p={kind:"mul",left:chunkZOOVGXMK_cjs.p(s),right:l===1?chunkZOOVGXMK_cjs.q(t):chunkZOOVGXMK_cjs.r(chunkZOOVGXMK_cjs.q(t),chunkZOOVGXMK_cjs.p(l))};i={kind:"add",left:i,right:p};}),{ok:true,value:chunkZOOVGXMK_cjs.Q(i)}}function Rr(e,t){if(e.kind!=="call"||e.args.length!==1)return null;let n=On(e.args[0],t);if(n===null)return null;let o=e.args[0],r=i=>chunkZOOVGXMK_cjs.Q({kind:"div",left:i,right:chunkZOOVGXMK_cjs.p(n.slope)});switch(e.name){case "exp":return {ok:true,value:r(chunkZOOVGXMK_cjs.s("exp",[o]))};case "sin":return {ok:true,value:r({kind:"neg",operand:chunkZOOVGXMK_cjs.s("cos",[o])})};case "cos":return {ok:true,value:r(chunkZOOVGXMK_cjs.s("sin",[o]))};case "log":return {ok:true,value:r({kind:"sub",left:{kind:"mul",left:o,right:chunkZOOVGXMK_cjs.s("log",[o])},right:o})};default:return null}}function xr(e,t){if(e.kind!=="div"||e.left.kind!=="const"||!ut(e.left.value))return null;let n=On(e.right,t);if(n!==null)return {ok:true,value:chunkZOOVGXMK_cjs.Q({kind:"div",left:chunkZOOVGXMK_cjs.s("log",[e.right]),right:chunkZOOVGXMK_cjs.p(n.slope)})};let o=chunkZOOVGXMK_cjs.C(e.right);if(o!==null&&o.vars.length===1&&o.vars[0]===t){let r=chunkZOOVGXMK_cjs.B(o,t);if(r.length===3&&ut(r[0])&&chunkZOOVGXMK_cjs.l(r[1])&&ut(r[2]))return {ok:true,value:chunkZOOVGXMK_cjs.s("atan",[chunkZOOVGXMK_cjs.q(t)])}}return null}function ut(e){return e.n===1n&&e.d===1n}function vr(e,t){let n=rt(e);if(n===null||n.variable!==t)return null;let o=ot(n.numerator,n.denominator,t);if(o===null)return null;let r=o.polynomial.length>0?Sr(o.polynomial,t):chunkZOOVGXMK_cjs.p(0);for(let i of o.terms){let a=Ir(i,t);if(a===null)return {ok:false,reason:"its denominator has a repeated irreducible quadratic factor, which needs a reduction formula this does not have"};r={kind:"add",left:r,right:a};}return {ok:true,value:chunkZOOVGXMK_cjs.Q(r)}}function Ir(e,t){let n=e.base.length-1,o=Re(e.base,t);if(n===1){let r=e.numerator[0]??chunkZOOVGXMK_cjs.a;if(e.power===1)return {kind:"mul",left:chunkZOOVGXMK_cjs.p(r),right:chunkZOOVGXMK_cjs.s("log",[o])};let i=e.power-1,a=chunkZOOVGXMK_cjs.i(r,{n:BigInt(-i),d:1n});return {kind:"div",left:chunkZOOVGXMK_cjs.p(a),right:chunkZOOVGXMK_cjs.r(o,chunkZOOVGXMK_cjs.p({n:BigInt(i),d:1n}))}}return n!==2||e.power!==1?null:Mr(e,t,o)}function Mr(e,t,n){let o=e.numerator[0]??chunkZOOVGXMK_cjs.a,r=e.numerator[1]??chunkZOOVGXMK_cjs.a,[i,a]=e.base,u={n:1n,d:2n},l=chunkZOOVGXMK_cjs.h(a,u),s={kind:"mul",left:chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.h(r,u)),right:chunkZOOVGXMK_cjs.s("log",[n])},p=chunkZOOVGXMK_cjs.g(o,chunkZOOVGXMK_cjs.h(r,l));if(chunkZOOVGXMK_cjs.l(p))return s;let h=chunkZOOVGXMK_cjs.O(chunkZOOVGXMK_cjs.g(i,chunkZOOVGXMK_cjs.h(l,l))),x={kind:"add",left:chunkZOOVGXMK_cjs.q(t),right:chunkZOOVGXMK_cjs.p(l)},V={kind:"mul",left:{kind:"div",left:chunkZOOVGXMK_cjs.p(p),right:h},right:chunkZOOVGXMK_cjs.s("atan",[{kind:"div",left:x,right:h}])};return chunkZOOVGXMK_cjs.l(r)?V:{kind:"add",left:s,right:V}}function Sr(e,t){let n=chunkZOOVGXMK_cjs.p(0);return e.forEach((o,r)=>{if(chunkZOOVGXMK_cjs.l(o))return;let i=r+1,a=chunkZOOVGXMK_cjs.i(o,{n:BigInt(i),d:1n}),u={kind:"mul",left:chunkZOOVGXMK_cjs.p(a),right:i===1?chunkZOOVGXMK_cjs.q(t):chunkZOOVGXMK_cjs.r(chunkZOOVGXMK_cjs.q(t),chunkZOOVGXMK_cjs.p(i))};n={kind:"add",left:n,right:u};}),n}function ve(e,t){let n=chunkZOOVGXMK_cjs.Q(e);if(!chunkZOOVGXMK_cjs.u(n).has(t))return {ok:true,value:chunkZOOVGXMK_cjs.Q({kind:"mul",left:n,right:chunkZOOVGXMK_cjs.q(t)})};let o=gr(n,t);if(o!==null)return o;let r=Rr(n,t);if(r!==null)return r;let i=xr(n,t);if(i!==null)return i;let a=vr(n,t);if(a!==null)return a;if(n.kind==="add"||n.kind==="sub"){let u=ve(n.left,t);if(!u.ok)return u;let l=ve(n.right,t);return l.ok?{ok:true,value:chunkZOOVGXMK_cjs.Q({kind:n.kind,left:u.value,right:l.value})}:l}if(n.kind==="mul"&&n.left.kind==="const"){let u=ve(n.right,t);return u.ok?{ok:true,value:chunkZOOVGXMK_cjs.Q({kind:"mul",left:n.left,right:u.value})}:u}return {ok:false,reason:"no elementary antiderivative is known for this expression"}}var lt=16;function _n(e,t,n,o){if(o<0||!Number.isInteger(o)||o>lt)throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_TAYLOR_DEGREE_LIMIT",`A Taylor degree must be a whole number from 0 to ${lt}.`,{limit:lt});let r=chunkZOOVGXMK_cjs.p(n),i=1n,a=chunkZOOVGXMK_cjs.p(chunkZOOVGXMK_cjs.a);for(let u=0;u<=o;u++){u>0&&(i*=BigInt(u));let l=xe(e,t,u),s=chunkZOOVGXMK_cjs.Q(chunkZOOVGXMK_cjs.v(l,t,r));if(s.kind!=="const")throw chunkSOMGSIO4_cjs.c.execution("SYMBOLIC_TAYLOR_INEXACT",`The derivative of order ${u} does not reduce to an exact number at the expansion point, so this series cannot be computed exactly.`,{order:u});let p=chunkZOOVGXMK_cjs.i(s.value,{n:i,d:1n});if(chunkZOOVGXMK_cjs.l(p))continue;let h=chunkZOOVGXMK_cjs.l(n)?chunkZOOVGXMK_cjs.q(t):{kind:"sub",left:chunkZOOVGXMK_cjs.q(t),right:r},x=u===0?chunkZOOVGXMK_cjs.p(1):u===1?h:chunkZOOVGXMK_cjs.r(h,chunkZOOVGXMK_cjs.p(u));a={kind:"add",left:a,right:{kind:"mul",left:chunkZOOVGXMK_cjs.p(p),right:x}};}return chunkZOOVGXMK_cjs.Q(a)}function wn(e,t){return e.map(n=>t.map(o=>xe(n,o)))}function Er(){return {pluginFunctions:{},opRegistry:new Ne,pluginFunctionOwners:{}}}var Dn=Er();var Ar={1970:38.8,1971:40.5,1972:41.8,1973:44.4,1974:49.3,1975:53.8,1976:56.9,1977:60.6,1978:65.2,1979:72.6,1980:82.4,1981:90.9,1982:96.5,1983:99.6,1984:103.9,1985:107.6,1986:109.6,1987:113.6,1988:118.3,1989:124,1990:130.7,1991:136.2,1992:140.3,1993:144.5,1994:148.2,1995:152.4,1996:156.9,1997:160.5,1998:163,1999:166.6,2e3:172.2,2001:177.1,2002:179.9,2003:184,2004:188.9,2005:195.3,2006:201.6,2007:207.3,2008:215.3,2009:214.5,2010:218.1,2011:224.9,2012:229.6,2013:233,2014:236.7,2015:237,2016:240,2017:245.1,2018:251.1,2019:255.7,2020:258.8,2021:271,2022:292.7,2023:304.7,2024:313.7,2025:322.2,2026:332.7},Pn=1970,Ln=2026;function Cn(e){return Ar[Math.trunc(e)]}function st(e,t){let n=Cn(e),o=Cn(t);if(!(n===void 0||o===void 0||n===0))return o/n}function va(e,t,n){let o=st(t,n);if(o!==void 0)return e*o}var kr=0;function ct(e){if(e.type===6&&e.unit!==void 0){let t=chunkCIQOK7Q4_cjs.a[e.unit.toLowerCase()];if(t!==void 0&&t[0]===kr)return e.toNumber()*t[1]}return e.toNumber()}function Vr(e,t){if(t===1)return e;let n=`${e}s`;return chunkCIQOK7Q4_cjs.a[n.toLowerCase()]===void 0?e:n}function Fn(e,t){let n,o=false;for(let r of e){if(Number.isNaN(r.toNumber())){o=true;continue}if(n===void 0){n=r;continue}let{lv:i,rv:a,sameMeasure:u}=he(n,r);if(!u){let l=n.type===6?n.unit:void 0,s=r.type===6?r.unit:void 0,p=Fe(l,s,"compared");return chunk5FGOIDLS_cjs.O("INCOMPATIBLE_UNITS",p??`Cannot compare incompatible units: ${l??"?"} and ${s??"?"}`)}(t?a>i:a<i)&&(n=r);}return o?chunk5FGOIDLS_cjs.n(NaN):n===void 0?chunk5FGOIDLS_cjs.n(t?-1/0:1/0):n.type===6?n:chunk5FGOIDLS_cjs.n(n.toNumber())}function Ue(e,t){return e.type===6&&e.unit!==void 0?chunk5FGOIDLS_cjs.u(t,e.unit):chunk5FGOIDLS_cjs.n(t)}function Un(e,t){let n=Number.isFinite(t)?Math.min(100,Math.max(0,Math.trunc(t))):0;if(e.exact!==void 0){let a=chunkZOOVGXMK_cjs.oa(e.exact,n);return $e(e,chunkZOOVGXMK_cjs.ra(a),n,a)}let o=e.toNumber();if(!Number.isFinite(o))return $e(e,o,n);let r=Math.pow(10,n),i=o*r;return !Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER?$e(e,o,n):$e(e,Math.round(i)/r,n)}function $e(e,t,n,o){let r=e.type===6&&e.unit!==void 0?chunk5FGOIDLS_cjs.u(t,e.unit):chunk5FGOIDLS_cjs.n(t);return r.decimalPlaces=n,o!==void 0&&(r.exact=o),r}function $n(e,t,n){if(Number.isFinite(e)&&Number.isFinite(t))return null;let o=Number.isFinite(e)?t:e;return chunk5FGOIDLS_cjs.O("INVALID_INTEGER_OPERAND",`${n} needs two whole numbers, and ${Number.isNaN(o)?"one of them has no value":"one of them is infinite"}`)}function Bn(e,t){let n=e,o=t;for(;o!==0;){let r=o;o=n%o,n=r;}return n}function Tr(e){let t=e.length;if(t===0)return 0;let n=e.reduce((o,r)=>o+r,0)/t;return e.reduce((o,r)=>o+(r-n)*(r-n),0)}function Be(e,t){let n=e.length;if(n===0)return 0;let o=t?n-1:n;return o<=0?0:Tr(e)/o}var Ga={0:e=>{let t=e[0].toNumber();return t>=0?chunk5FGOIDLS_cjs.n(Math.sqrt(t)):_(chunkZOOVGXMK_cjs.s("sqrt",[chunkZOOVGXMK_cjs.p(t)]))},1:e=>e[0].type===7?chunkZOOVGXMK_cjs.ca(e[0].value):Ue(e[0],Math.abs(e[0].toNumber())),2:e=>chunk5FGOIDLS_cjs.n(Math.sin(ct(e[0]))),3:e=>chunk5FGOIDLS_cjs.n(Math.cos(ct(e[0]))),4:e=>chunk5FGOIDLS_cjs.n(Math.tan(ct(e[0]))),5:e=>chunk5FGOIDLS_cjs.n(Math.log(e[0].toNumber())),6:e=>Ue(e[0],Math.ceil(e[0].toNumber())),7:e=>Ue(e[0],Math.floor(e[0].toNumber())),8:e=>e.length>=2?Un(e[0],e[1].toNumber()):Ue(e[0],Math.round(e[0].toNumber())),9:e=>Fn(e,false),10:e=>Fn(e,true),11:e=>chunk5FGOIDLS_cjs.n(Math.asin(e[0].toNumber())),12:e=>chunk5FGOIDLS_cjs.n(Math.acos(e[0].toNumber())),13:e=>chunk5FGOIDLS_cjs.n(Math.atan(e[0].toNumber())),14:e=>chunk5FGOIDLS_cjs.n(Math.atan2(e[0].toNumber(),e[1].toNumber())),15:e=>chunk5FGOIDLS_cjs.n(Math.sinh(e[0].toNumber())),16:e=>chunk5FGOIDLS_cjs.n(Math.cosh(e[0].toNumber())),17:e=>chunk5FGOIDLS_cjs.n(Math.tanh(e[0].toNumber())),18:e=>chunk5FGOIDLS_cjs.n(Math.asinh(e[0].toNumber())),19:e=>chunk5FGOIDLS_cjs.n(Math.acosh(e[0].toNumber())),20:e=>chunk5FGOIDLS_cjs.n(Math.atanh(e[0].toNumber())),21:e=>chunk5FGOIDLS_cjs.n(Math.cbrt(e[0].toNumber())),22:e=>chunk5FGOIDLS_cjs.n(Math.clz32(e[0].toNumber())),23:e=>chunk5FGOIDLS_cjs.n(Math.expm1(e[0].toNumber())),24:e=>chunk5FGOIDLS_cjs.n(Math.exp(e[0].toNumber())),25:e=>chunk5FGOIDLS_cjs.n(Math.fround(e[0].toNumber())),26:e=>chunk5FGOIDLS_cjs.n(Math.hypot(...e.map(t=>t.toNumber()))),27:e=>chunk5FGOIDLS_cjs.n(Math.imul(e[0].toNumber(),e[1].toNumber())),28:e=>chunk5FGOIDLS_cjs.n(Math.log10(e[0].toNumber())),29:e=>chunk5FGOIDLS_cjs.n(Math.log1p(e[0].toNumber())),30:e=>chunk5FGOIDLS_cjs.n(Math.log2(e[0].toNumber())),31:e=>e[0].type===7?e[1].type!==0?chunk5FGOIDLS_cjs.O("MATRIX_POWER_UNSUPPORTED",`pow: a matrix's exponent must be a whole number, as in "pow([1,2;3,4], 2)".`):chunkZOOVGXMK_cjs.$(e[0].value,e[1].value):e[1].type===7?chunk5FGOIDLS_cjs.O("MATRIX_POWER_UNSUPPORTED",'pow: a matrix may only be the base, as in "pow([1,2;3,4], 2)".'):chunk5FGOIDLS_cjs.n(et(e[0].toNumber(),e[1].toNumber())),32:()=>chunk5FGOIDLS_cjs.n(Math.random()),33:e=>chunk5FGOIDLS_cjs.n(Math.sign(e[0].toNumber())),34:e=>chunk5FGOIDLS_cjs.n(Math.trunc(e[0].toNumber())),35:e=>chunk5FGOIDLS_cjs.n(e[0].toNumber()*Math.PI/180),36:e=>chunk5FGOIDLS_cjs.n(e[0].toNumber()*180/Math.PI),37:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return t>n?chunk5FGOIDLS_cjs.O("INVALID_RANGE",`roll: invalid range, ${t} is greater than ${n}`):chunk5FGOIDLS_cjs.n(Math.floor(Math.random()*(n-t+1))+t)},38:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n=Math.trunc(Math.abs(e[1].toNumber())),o=$n(t,n,"gcd");return o||chunk5FGOIDLS_cjs.n(Bn(t,n))},39:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n=Math.trunc(Math.abs(e[1].toNumber())),o=$n(t,n,"lcm");return o||(t===0||n===0?chunk5FGOIDLS_cjs.n(0):chunk5FGOIDLS_cjs.n(t/Bn(t,n)*n))},40:e=>{let t=Math.trunc(e[0].toNumber()),n=Math.trunc(e[1].toNumber());if(t<0||n<0||n>t)return chunk5FGOIDLS_cjs.O("INVALID_RANGE",`permutation: invalid n=${t}, r=${n} (require 0 <= r <= n)`);let o=1;for(let r=0;r<n;r++)if(o*=t-r,!Number.isFinite(o))return chunk5FGOIDLS_cjs.O("PERMUTATION_OVERFLOW",`permutation: P(${t}, ${n}) exceeds the maximum representable double (it passed it after ${r+1} of ${n} factors)`);return chunk5FGOIDLS_cjs.n(o)},41:e=>{let t=Math.trunc(e[0].toNumber()),n=Math.trunc(e[1].toNumber());if(t<0||n<0||n>t)return chunk5FGOIDLS_cjs.O("INVALID_RANGE",`combination: invalid n=${t}, r=${n} (require 0 <= r <= n)`);let o=Math.min(n,t-n),r=1;for(let i=0;i<o;i++)if(r=r*(t-i)/(i+1),!Number.isFinite(r))return chunk5FGOIDLS_cjs.O("COMBINATION_OVERFLOW",`combination: C(${t}, ${n}) exceeds the maximum representable double (it passed it after ${i+1} of ${o} steps)`);return chunk5FGOIDLS_cjs.n(Math.round(r))},42:e=>{if(e.length===0)return chunk5FGOIDLS_cjs.n(0);let t=e.reduce((n,o)=>n+o.toNumber(),0);return chunk5FGOIDLS_cjs.n(t/e.length)},43:e=>{if(e.length===0)return chunk5FGOIDLS_cjs.n(0);let t=e.map(o=>o.toNumber()).sort((o,r)=>o-r),n=Math.floor(t.length/2);return chunk5FGOIDLS_cjs.n(t.length%2===0?(t[n-1]+t[n])/2:t[n])},44:e=>chunk5FGOIDLS_cjs.n(e.reduce((t,n)=>t+n.toNumber(),0)),45:e=>chunk5FGOIDLS_cjs.n(e.length),46:e=>{let[t,n,o]=e,{lv:r,rv:i}=he(t,n);if(r===0)return chunk5FGOIDLS_cjs.O("PROPORTION_DIVIDE_BY_ZERO",`Cannot compute proportion: "${t.value}" is zero`);let a=o.toNumber()*(i/r);return o.type===6?chunk5FGOIDLS_cjs.u(a,o.unit):chunk5FGOIDLS_cjs.n(a)},47:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return n>o?chunk5FGOIDLS_cjs.O("INVALID_RANGE",`clamp: invalid range, ${n} is greater than ${o}`):chunk5FGOIDLS_cjs.n(Math.min(Math.max(t,n),o))},48:e=>chunk5FGOIDLS_cjs.r(e[0].toNumber()),49:e=>chunk5FGOIDLS_cjs.r(e[0].toNumber(),"bin"),50:e=>chunk5FGOIDLS_cjs.n(Math.trunc(e[0].toNumber())),51:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(1+n<=0)return chunk5FGOIDLS_cjs.O("INVALID_RATE",`compoundInterest: rate ${n} makes (1 + rate) non-positive`);let r=t*Math.pow(1+n,o);return e[0].type===6?chunk5FGOIDLS_cjs.u(r,e[0].unit):chunk5FGOIDLS_cjs.n(r)},52:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(1+n<=0)return chunk5FGOIDLS_cjs.O("INVALID_RATE",`interestEarned: rate ${n} makes (1 + rate) non-positive`);let r=t*(Math.pow(1+n,o)-1);return e[0].type===6?chunk5FGOIDLS_cjs.u(r,e[0].unit):chunk5FGOIDLS_cjs.n(r)},53:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0||n<=0?chunk5FGOIDLS_cjs.O("INVALID_RANGE","compoundInterestRate: principal and futureValue must both be positive"):o<=0?chunk5FGOIDLS_cjs.O("INVALID_RANGE","compoundInterestRate: years must be greater than 0"):chunk5FGOIDLS_cjs.n(Math.pow(n/t,1/o)-1)},54:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0||n<=0?chunk5FGOIDLS_cjs.O("INVALID_RANGE","compoundInterestYears: principal and futureValue must both be positive"):1+o<=0||o===0?chunk5FGOIDLS_cjs.O("INVALID_RATE",`compoundInterestYears: rate ${o} is not usable (must be > -1 and not 0)`):chunk5FGOIDLS_cjs.n(Math.log(n/t)/Math.log(1+o))},55:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","loanRepayment: principal must be positive");if(o<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","loanRepayment: years must be positive");if(n<0)return chunk5FGOIDLS_cjs.O("INVALID_RATE","loanRepayment: rate must not be negative");if(r<0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","loanRepayment: periodsPerYear must not be negative");let{totalRepayment:i}=dt(t,n,o),a=r===0?i:i/(o*r);return e[0].type===6?chunk5FGOIDLS_cjs.u(a,e[0].unit):chunk5FGOIDLS_cjs.n(a)},56:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","loanInterest: principal must be positive");if(o<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","loanInterest: years must be positive");if(n<0)return chunk5FGOIDLS_cjs.O("INVALID_RATE","loanInterest: rate must not be negative");if(r<0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","loanInterest: periodsPerYear must not be negative");let{totalInterest:i}=dt(t,n,o),a=r===0?i:i/(o*r);return e[0].type===6?chunk5FGOIDLS_cjs.u(a,e[0].unit):chunk5FGOIDLS_cjs.n(a)},57:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(t<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","monthlyPayment: principal must be positive");if(o<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","monthlyPayment: years must be positive");if(n<0)return chunk5FGOIDLS_cjs.O("INVALID_RATE","monthlyPayment: rate must not be negative");let{monthlyPayment:r}=dt(t,n,o);return e[0].type===6?chunk5FGOIDLS_cjs.u(r,e[0].unit):chunk5FGOIDLS_cjs.n(r)},58:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return e[0].type===6?vn(e[0],e[0].unit,n,1):chunk5FGOIDLS_cjs.n(t*(1+n))},59:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return 1+n<=0?chunk5FGOIDLS_cjs.O("INVALID_RATE",`taxRemove: rate ${n} makes (1 + rate) non-positive`):e[0].type===6?Mn(e[0],e[0].unit,n)??chunk5FGOIDLS_cjs.u(t/(1+n),e[0].unit):chunk5FGOIDLS_cjs.n(t/(1+n))},60:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=st(n,o);if(r===void 0)return chunk5FGOIDLS_cjs.O("INFLATION_YEAR_OUT_OF_RANGE",`inflationAdjust: fromYear ${n} or toYear ${o} is outside the bundled CPI table's range (${Pn}-${Ln})`);let i=t*r;return e[0].type===6?chunk5FGOIDLS_cjs.u(i,e[0].unit):chunk5FGOIDLS_cjs.n(i)},61:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return chunk5FGOIDLS_cjs.n(et(n,1/t))},62:e=>{let t=e[0].toNumber();if(!Number.isInteger(t)||t<0)return chunk5FGOIDLS_cjs.O("INVALID_FACTORIAL_INPUT",`fact: ${t} is not a non-negative integer`);if(t>170)return chunk5FGOIDLS_cjs.O("FACTORIAL_OVERFLOW",`fact: ${t}! exceeds the maximum representable double (170! is the largest finite factorial)`);let n=1;for(let o=2;o<=t;o++)n*=o;return chunk5FGOIDLS_cjs.n(n)},63:e=>e[0].type===7?chunkZOOVGXMK_cjs.ba(e[0].value):e[0],64:e=>e[0].type===7?chunkZOOVGXMK_cjs.ca(e[0].value):chunk5FGOIDLS_cjs.n(e[0].toNumber()),65:e=>e[0].type===7?chunkZOOVGXMK_cjs.da(e[0].value):chunk5FGOIDLS_cjs.n(1/e[0].toNumber()),66:e=>{let[t,n]=e;if(t.type===0&&n.type===0)return chunk5FGOIDLS_cjs.n(t.toNumber()*n.toNumber());let o=r=>r.type===7?r.value:{rows:1,cols:1,data:[r.toNumber()],hasSymbolic:false};return chunkZOOVGXMK_cjs._(o(t),o(n))},67:e=>{let[t]=e;return t.type!==9?t:_(chunkZOOVGXMK_cjs.F(t.value))},68:e=>{let[t]=e;return t.type!==9?t:_(zt(t.value))},69:e=>{let[t,n,o]=e;return o?.type!==3?chunk5FGOIDLS_cjs.O("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown."):fn(t,n,o.value)},70:e=>{let[t,n,o]=e,r=ft(n,"der");if(typeof r!="string")return r;let i=O(t);return i===null?chunk5FGOIDLS_cjs.O("SYMBOLIC_NONFINITE_OPERAND","der needs an expression with an exact value."):_(xe(i,r,o?.toNumber()??1))},71:e=>{let[t,n]=e,o=ft(n,"integral");if(typeof o!="string")return o;let r=O(t);if(r===null)return chunk5FGOIDLS_cjs.O("SYMBOLIC_NONFINITE_OPERAND","integral needs an expression with an exact value.");let i=ve(r,o);return i.ok?_(i.value):chunk5FGOIDLS_cjs.O("SYMBOLIC_INTEGRAL_UNSUPPORTED",`Cannot integrate this: ${i.reason}.`)},72:e=>{let[t,n,o,r]=e,i=ft(n,"taylor");if(typeof i!="string")return i;let a=O(t),u=O(o);return a===null||u===null||u.kind!=="const"?chunk5FGOIDLS_cjs.O("SYMBOLIC_NONFINITE_OPERAND","taylor needs an expression and an exact expansion point."):_(_n(a,i,u.value,r.toNumber()))},73:e=>{let t=[];for(let a of e){let u=O(a);if(u===null)return chunk5FGOIDLS_cjs.O("SYMBOLIC_NONFINITE_OPERAND","jacobian needs expressions with exact values.");t.push(u);}let n=new Set;for(let a of t)for(let u of chunkZOOVGXMK_cjs.u(a))n.add(u);let o=[...n].sort();if(o.length===0)return chunk5FGOIDLS_cjs.O("SYMBOLIC_JACOBIAN_NO_VARIABLES","jacobian needs at least one unknown to differentiate against.");let r=wn(t,o),i=[];for(let a of r)for(let u of a)i.push(chunkZOOVGXMK_cjs.W(u));return chunk5FGOIDLS_cjs.C(r.length,o.length,chunkZOOVGXMK_cjs.Y(r.length,o.length,i))},74:e=>_(chunkZOOVGXMK_cjs.w(chunkZOOVGXMK_cjs.o(chunkZOOVGXMK_cjs.a,chunkZOOVGXMK_cjs.d(e[0].toNumber())))),75:e=>mt("conj",e[0]),76:e=>mt("re",e[0]),77:e=>mt("im",e[0]),78:e=>{let t=e[0];return t.type!==9?t:_(chunkZOOVGXMK_cjs.J(t.value))},79:e=>{let t=e[0];return t.type!==9?t:_(kn(t.value))},85:e=>{let t=e[0].toNumber(),n=e[1].toNumber();if(1+n<=0)return chunk5FGOIDLS_cjs.O("INVALID_RATE",`taxIn: rate ${n} makes (1 + rate) non-positive`);let o=t-t/(1+n);return e[0].type===6?Sn(e[0],e[0].unit,n)??chunk5FGOIDLS_cjs.u(o,e[0].unit):chunk5FGOIDLS_cjs.n(o)},86:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return e[0].type===6?xn(e[0],n,e[0].unit):chunk5FGOIDLS_cjs.n(t*n)},87:e=>chunk5FGOIDLS_cjs.n(Math.sin(e[0].toNumber()*Math.PI/180)),88:e=>chunk5FGOIDLS_cjs.n(Math.cos(e[0].toNumber()*Math.PI/180)),89:e=>chunk5FGOIDLS_cjs.n(Math.tan(e[0].toNumber()*Math.PI/180)),90:e=>chunk5FGOIDLS_cjs.n(Math.asin(e[0].toNumber())*180/Math.PI),91:e=>chunk5FGOIDLS_cjs.n(Math.acos(e[0].toNumber())*180/Math.PI),92:e=>chunk5FGOIDLS_cjs.n(Math.atan(e[0].toNumber())*180/Math.PI),93:e=>chunk5FGOIDLS_cjs.u(e[0].toNumber(),"days"),94:e=>{let t=typeof e[1]?.value=="string"?e[1].value:void 0,n=typeof e[2]?.value=="string"?e[2].value:void 0;if(t===void 0||n===void 0)return chunk5FGOIDLS_cjs.O("UNKNOWN_UNIT",'both units have to be named, as in "12.5 minutes in minutes and seconds"');let o=chunkCIQOK7Q4_cjs.a[t.toLowerCase()],r=chunkCIQOK7Q4_cjs.a[n.toLowerCase()];if(o===void 0||r===void 0)return chunk5FGOIDLS_cjs.O("UNKNOWN_UNIT",`${t} and ${n}: one of these is not a unit`);if(o[0]!==r[0])return chunk5FGOIDLS_cjs.O("INCOMPATIBLE_UNITS",`${t} and ${n} measure different things`);if(r[1]>=o[1])return chunk5FGOIDLS_cjs.O("INCOMPATIBLE_UNITS",`${t} and ${n}: name the larger unit first`);let i=e[0],a=i.type===6&&i.unit!==void 0?chunkCIQOK7Q4_cjs.a[i.unit.toLowerCase()]:void 0,u=i.toNumber()*(a?.[1]??o[1]),l=Math.floor(u/o[1]),s=Math.round((u-l*o[1])/r[1]*1e3)/1e3;return chunk5FGOIDLS_cjs.t(`${l} ${t} ${s} ${n}`)},95:e=>{let t=e[0],n=String(e[1].value),o=t.type===6&&t.unit!==void 0?t.unit:"";return o.includes("/")?chunk5FGOIDLS_cjs.O("INVALID_RATE_UNIT",`${o}/${n}: that is already a rate`):chunk5FGOIDLS_cjs.u(t.toNumber(),`${o}/${n}`)},96:e=>{let t=e[0],n=e[1];if(n.type!==6||n.unit===void 0||!n.unit.includes("/"))return chunk5FGOIDLS_cjs.O("INVALID_RATE",'at: the right-hand side has to be a rate, as in "$30/hour"');let o=n.unit.indexOf("/"),r=n.unit.slice(0,o),i=n.unit.slice(o+1),a=t.type===6?t.unit:void 0,u=chunkCIQOK7Q4_cjs.a[i.toLowerCase()],l=a===void 0?void 0:chunkCIQOK7Q4_cjs.a[a.toLowerCase()];if(l!==void 0&&u!==void 0&&l[0]===u[0]){let p=t.toNumber()*l[1]/u[1]*n.toNumber();return r===""?chunk5FGOIDLS_cjs.n(p):chunk5FGOIDLS_cjs.u(p,r)}if(a!==void 0&&a===r){let s=t.toNumber()/n.toNumber();return chunk5FGOIDLS_cjs.u(s,Vr(i,s))}if(a===void 0){let s=t.toNumber()*n.toNumber();return r===""?chunk5FGOIDLS_cjs.n(s):chunk5FGOIDLS_cjs.u(s,r)}return chunk5FGOIDLS_cjs.O("INCOMPATIBLE_UNITS",`at: ${a} matches neither side of ${n.unit}`)},80:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0)return chunk5FGOIDLS_cjs.O("INVALID_RATE",`compounding: ${r} periods per year is not a period`);if(1+n/r<=0)return chunk5FGOIDLS_cjs.O("INVALID_RATE",`compounding: rate ${n} makes each period non-positive`);let i=t*Math.pow(1+n/r,r*o);return e[0].type===6?chunk5FGOIDLS_cjs.u(i,e[0].unit):chunk5FGOIDLS_cjs.n(i)},81:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0||1+n/r<=0)return chunk5FGOIDLS_cjs.O("INVALID_RATE",`compounding: rate ${n} over ${r} periods per year is not usable`);let i=t*(Math.pow(1+n/r,r*o)-1);return e[0].type===6?chunk5FGOIDLS_cjs.u(i,e[0].unit):chunk5FGOIDLS_cjs.n(i)},82:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(1+n<=0)return chunk5FGOIDLS_cjs.O("INVALID_RATE",`presentValue: rate ${n} makes (1 + rate) non-positive`);let r=t/Math.pow(1+n,o);return e[0].type===6?chunk5FGOIDLS_cjs.u(r,e[0].unit):chunk5FGOIDLS_cjs.n(r)},83:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return t===0?chunk5FGOIDLS_cjs.O("INVALID_RATE","roi: nothing was invested, so there is no return on it"):chunk5FGOIDLS_cjs.n((n-t)/t)},84:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0?chunk5FGOIDLS_cjs.O("INVALID_RATE","annual return: the amount invested must be positive"):o<=0?chunk5FGOIDLS_cjs.O("INVALID_RATE","annual return: the period must be longer than zero"):n<=0?chunk5FGOIDLS_cjs.O("INVALID_RATE","annual return: nothing was returned, so there is no annual rate"):chunk5FGOIDLS_cjs.M(Math.pow(n/t,1/o)-1)},97:e=>Un(e[0],e[1].toNumber()),98:e=>{let t=e[1].toNumber();return !Number.isInteger(t)||t<1?chunk5FGOIDLS_cjs.O("INVALID_RANGE",`split: the number of shares must be a whole number of at least 1, not ${e[1].toNumber()}.`):chunk5FGOIDLS_cjs.H(En(e[0],t))},99:e=>{let t=e[0].toNumber(),n=Or(e[1]),o=e[2].toNumber();if(n===null)return chunk5FGOIDLS_cjs.O("INVALID_RANGE",'savings goal: the duration must be in months or years, e.g. "in 2 years".');if(t<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","savings goal: the duration must be positive.");if(o<0)return chunk5FGOIDLS_cjs.O("INVALID_RATE","savings goal: the rate must not be negative.");let r=_r(t,o/12,n);return e[0].type===6?chunk5FGOIDLS_cjs.u(r,e[0].unit):chunk5FGOIDLS_cjs.n(r)},100:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber(),i=typeof e[4]?.value=="string"?e[4].value:"periods";if(t<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return chunk5FGOIDLS_cjs.O("INVALID_RANGE","savings goal: the contribution must be positive.");if(r<0)return chunk5FGOIDLS_cjs.O("INVALID_RATE","savings goal: the rate must not be negative.");let a=wr(t,n,r/o);return chunk5FGOIDLS_cjs.u(a,i)},101:e=>chunk5FGOIDLS_cjs.n(Math.sqrt(Be(e.map(t=>t.toNumber()),false))),102:e=>chunk5FGOIDLS_cjs.n(Math.sqrt(Be(e.map(t=>t.toNumber()),true))),103:e=>chunk5FGOIDLS_cjs.n(Be(e.map(t=>t.toNumber()),false)),104:e=>chunk5FGOIDLS_cjs.n(Be(e.map(t=>t.toNumber()),true)),105:e=>{if(e.length===0)return chunk5FGOIDLS_cjs.n(0);let t=e.map(n=>n.toNumber());return chunk5FGOIDLS_cjs.n(Math.max(...t)-Math.min(...t))},106:e=>{if(e.length===0)return chunk5FGOIDLS_cjs.n(0);let t=new Map,n=e[0].toNumber(),o=0;for(let r of e){let i=r.toNumber(),a=(t.get(i)??0)+1;t.set(i,a),a>o&&(o=a,n=i);}return chunk5FGOIDLS_cjs.n(n)},107:e=>{let t=0,n=0;for(let o=0;o+1<e.length;o+=2){let r=e[o].toNumber(),i=e[o+1].toNumber();t+=r*i,n+=i;}return n===0?chunk5FGOIDLS_cjs.O("WEIGHTED_AVERAGE_ZERO_WEIGHT","weighted average: the weights sum to zero, so there is nothing to divide by"):chunk5FGOIDLS_cjs.n(t/n)}};function Or(e){if(e.type!==6)return null;let t=e.unit;return t==="months"||t==="month"?e.toNumber():t==="years"||t==="year"?e.toNumber()*12:null}function _r(e,t,n){return t===0?e/n:e*t/(Math.pow(1+t,n)-1)}function wr(e,t,n){let o=n===0?e/t:Math.log(1+e*n/t)/Math.log(1+n);return Math.ceil(o-1e-9)}function mt(e,t){let n=O(t);return n===null?chunk5FGOIDLS_cjs.O("SYMBOLIC_NONFINITE_OPERAND",e+" needs a value with an exact number."):_(chunkZOOVGXMK_cjs.s(e,[n]))}function ft(e,t){return e?.type!==3?chunk5FGOIDLS_cjs.O("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown.`):e.value}function dt(e,t,n){let o=n*12,r=t/12,i=r===0?e/o:e*r/(1-Math.pow(1+r,-o)),a=i*o,u=a-e;return {monthlyPayment:i,totalRepayment:a,totalInterest:u}}var ja=Dn.pluginFunctions,qn=255,Yn=0;function Dr(){if(Yn>qn)throw chunkSOMGSIO4_cjs.c.config("PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",`allocatePluginFunctionIndex: pool exhausted (max ${qn+1} allocations).`);return Yn++}var Gn=new Map;function Ka(e){let t=Gn.get(e);return t===void 0&&(t=Dr(),Gn.set(e,t)),t}var pt=new Map;function Xa(e,t){let n=e.toLowerCase(),o=pt.get(n);o&&o!==t&&console.warn(`[asConverterRegistry] Converter name "${n}" is already registered \u2014 overwriting.`),pt.set(n,t);}function Za(e){pt.delete(e.toLowerCase());}var qe=class qe{constructor(){this.values=new Map;this.listeners=new Set;this.notifyDepth=0;}get(t){return this.values.get(t)}has(t){return this.values.has(t)}set(t,n){let o=this.values.get(t);this.values.set(t,n),!(o!==void 0&&Cr(o,n))&&this.notify(t,n);}notify(t,n){if(!(this.notifyDepth>=qe.MAX_NOTIFY_DEPTH)){this.notifyDepth++;try{for(let o of this.listeners)o(t,n);}finally{this.notifyDepth--;}}}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}clear(){this.values.clear(),this.listeners.clear(),this.notifyDepth=0;}};qe.MAX_NOTIFY_DEPTH=64;var bt=qe;function Cr(e,t){if(e.type!==t.type||e.unit!==t.unit||(e.timedOut??false)!==(t.timedOut??false))return false;let n=e.value,o=t.value;if(Array.isArray(n)||Array.isArray(o)){if(!Array.isArray(n)||!Array.isArray(o)||n.length!==o.length)return false;for(let r=0;r<n.length;r++)if(!Object.is(n[r],o[r]))return false;return true}return Object.is(n,o)}var Wa=new bt;function Qa(e){return `global:${e}`}exports.A=Ln;exports.B=va;exports.C=Ga;exports.D=ja;exports.E=Dr;exports.F=Ka;exports.G=pt;exports.H=Xa;exports.I=Za;exports.J=Wa;exports.K=Qa;exports.a=ge;exports.b=xn;exports.c=vn;exports.d=sn;exports.e=hi;exports.f=Ni;exports.g=gi;exports.h=Ri;exports.i=fn;exports.j=he;exports.k=Oi;exports.l=_i;exports.m=wi;exports.n=pn;exports.o=Di;exports.p=Ci;exports.q=et;exports.r=Pi;exports.s=Li;exports.t=Fi;exports.u=Ui;exports.v=Ne;exports.w=qi;exports.x=Er;exports.y=Dn;exports.z=Pn;//# sourceMappingURL=chunk-Z5KBBQOJ.cjs.map
2
- //# sourceMappingURL=chunk-Z5KBBQOJ.cjs.map