allyhub 0.6.0 → 0.7.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 (621) hide show
  1. package/dist/audio-text.js +1 -1
  2. package/dist/commands/add.js +2 -2
  3. package/dist/commands/cloud-tools.js +5 -5
  4. package/dist/commands/dev.js +1 -1
  5. package/dist/commands/frames/piece.js +1 -1
  6. package/dist/commands/frames/sheet.js +1 -1
  7. package/dist/commands/frames.js +8 -8
  8. package/dist/commands/index.js +1 -1
  9. package/dist/commands/inspect/common.js +1 -1
  10. package/dist/commands/inspect/layout.js +1 -1
  11. package/dist/commands/render.js +1 -1
  12. package/dist/commands/sheet.js +5 -5
  13. package/dist/commands/site.js +3 -2
  14. package/dist/commands/skills.js +3 -3
  15. package/dist/commands/slides.js +2 -2
  16. package/dist/node_modules/@allyhub-next/audio/dist/node/index.js +1 -1
  17. package/dist/node_modules/@allyhub-next/audio/dist/node/master.js +1 -1
  18. package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
  19. package/dist/node_modules/@allyhub-next/browser/dist/html.js +1 -1
  20. package/dist/node_modules/@allyhub-next/browser/package.json +1 -1
  21. package/dist/node_modules/@allyhub-next/build/dist/content.d.ts +4 -0
  22. package/dist/node_modules/@allyhub-next/build/dist/content.js +1 -1
  23. package/dist/node_modules/@allyhub-next/build/dist/index.d.ts +2 -2
  24. package/dist/node_modules/@allyhub-next/build/dist/index.js +1 -1
  25. package/dist/node_modules/@allyhub-next/build/dist/meta-worker.d.ts +2 -2
  26. package/dist/node_modules/@allyhub-next/build/dist/meta-worker.js +3 -3
  27. package/dist/node_modules/@allyhub-next/build/dist/move-refs.d.ts +1 -1
  28. package/dist/node_modules/@allyhub-next/build/dist/move-refs.js +1 -1
  29. package/dist/node_modules/@allyhub-next/build/dist/plugin.d.ts +12 -3
  30. package/dist/node_modules/@allyhub-next/build/dist/plugin.js +7 -6
  31. package/dist/node_modules/@allyhub-next/build/dist/prepare.d.ts +9 -5
  32. package/dist/node_modules/@allyhub-next/build/dist/prepare.js +2 -2
  33. package/dist/node_modules/@allyhub-next/build/dist/vite.d.ts +10 -0
  34. package/dist/node_modules/@allyhub-next/build/dist/vite.js +2 -2
  35. package/dist/node_modules/@allyhub-next/build/package.json +1 -1
  36. package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +2 -2
  37. package/dist/node_modules/@allyhub-next/chart/dist/chart.d.ts +14 -5
  38. package/dist/node_modules/@allyhub-next/chart/dist/chart.js +1 -1
  39. package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
  40. package/dist/node_modules/@allyhub-next/check/dist/check.js +3 -3
  41. package/dist/node_modules/@allyhub-next/check/package.json +1 -1
  42. package/dist/node_modules/@allyhub-next/cloud/dist/blobs.js +2 -0
  43. package/dist/node_modules/@allyhub-next/cloud/dist/call.js +4 -2
  44. package/dist/node_modules/@allyhub-next/cloud/dist/client.js +1 -1
  45. package/dist/node_modules/@allyhub-next/cloud/dist/errors.js +1 -1
  46. package/dist/node_modules/@allyhub-next/cloud/dist/hashes.js +2 -0
  47. package/dist/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
  48. package/dist/node_modules/@allyhub-next/cloud/dist/sites.js +2 -0
  49. package/dist/node_modules/@allyhub-next/cloud/dist/voice.js +1 -1
  50. package/dist/node_modules/@allyhub-next/cloud/package.json +1 -1
  51. package/dist/node_modules/@allyhub-next/components/package.json +1 -1
  52. package/dist/node_modules/@allyhub-next/components/r/caption-subtitle.json +1 -1
  53. package/dist/node_modules/@allyhub-next/components/src/caption-subtitle.ts +54 -16
  54. package/dist/node_modules/@allyhub-next/dev-server/dist/background.js +1 -1
  55. package/dist/node_modules/@allyhub-next/dev-server/dist/fonts.js +2 -0
  56. package/dist/node_modules/@allyhub-next/dev-server/dist/index.js +1 -1
  57. package/dist/node_modules/@allyhub-next/dev-server/dist/live.js +1 -1
  58. package/dist/node_modules/@allyhub-next/dev-server/dist/project.js +1 -1
  59. package/dist/node_modules/@allyhub-next/dev-server/dist/reach.js +2 -0
  60. package/dist/node_modules/@allyhub-next/dev-server/dist/record.js +2 -0
  61. package/dist/node_modules/@allyhub-next/dev-server/dist/server.js +2 -2
  62. package/dist/node_modules/@allyhub-next/dev-server/dist/tools.js +1 -1
  63. package/dist/node_modules/@allyhub-next/dev-server/dist/tree.js +2 -0
  64. package/dist/node_modules/@allyhub-next/dev-server/package.json +1 -1
  65. package/dist/node_modules/@allyhub-next/doc/package.json +1 -1
  66. package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.js +1 -1
  67. package/dist/node_modules/@allyhub-next/export/dist/export.js +5 -5
  68. package/dist/node_modules/@allyhub-next/export/dist/index.js +1 -1
  69. package/dist/node_modules/@allyhub-next/export/package.json +1 -1
  70. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.d.ts +205 -0
  71. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.js +2 -0
  72. package/dist/node_modules/@allyhub-next/formats/dist/data/script.d.ts +4 -1
  73. package/dist/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
  74. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +69 -18
  75. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +1 -1
  76. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +847 -116
  77. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
  78. package/dist/node_modules/@allyhub-next/formats/dist/data/website.d.ts +20 -0
  79. package/dist/node_modules/@allyhub-next/formats/dist/data/website.js +2 -0
  80. package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +3 -0
  81. package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
  82. package/dist/node_modules/@allyhub-next/formats/dist/items.d.ts +1 -1
  83. package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
  84. package/dist/node_modules/@allyhub-next/formats/dist/media-type.d.ts +3 -0
  85. package/dist/node_modules/@allyhub-next/formats/dist/media-type.js +2 -0
  86. package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +501 -38
  87. package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
  88. package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +2 -0
  89. package/dist/node_modules/@allyhub-next/formats/dist/strict.js +1 -1
  90. package/dist/node_modules/@allyhub-next/formats/package.json +2 -1
  91. package/dist/node_modules/@allyhub-next/measure/package.json +1 -1
  92. package/dist/node_modules/@allyhub-next/media/dist/index.d.ts +1 -1
  93. package/dist/node_modules/@allyhub-next/media/dist/index.js +1 -1
  94. package/dist/node_modules/@allyhub-next/media/dist/sheet.d.ts +2 -0
  95. package/dist/node_modules/@allyhub-next/media/dist/sheet.js +7 -7
  96. package/dist/node_modules/@allyhub-next/media/package.json +1 -1
  97. package/dist/node_modules/@allyhub-next/model/package.json +1 -1
  98. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.d.ts +31 -0
  99. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.js +2 -0
  100. package/dist/node_modules/@allyhub-next/ooxml/dist/color.d.ts +33 -0
  101. package/dist/node_modules/@allyhub-next/ooxml/dist/color.js +2 -0
  102. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.d.ts +13 -0
  103. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.js +2 -0
  104. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.d.ts +79 -0
  105. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.js +2 -0
  106. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.d.ts +132 -0
  107. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.js +2 -0
  108. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.d.ts +28 -0
  109. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.js +2 -0
  110. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.d.ts +4708 -0
  111. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.js +2 -0
  112. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.d.ts +57 -0
  113. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.js +2 -0
  114. package/dist/node_modules/@allyhub-next/ooxml/dist/index.d.ts +10 -0
  115. package/dist/node_modules/@allyhub-next/ooxml/dist/index.js +2 -0
  116. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.d.ts +12 -0
  117. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.js +2 -0
  118. package/dist/node_modules/@allyhub-next/ooxml/dist/node.d.ts +111 -0
  119. package/dist/node_modules/@allyhub-next/ooxml/dist/node.js +2 -0
  120. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.d.ts +45 -0
  121. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.js +2 -0
  122. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.d.ts +48 -0
  123. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.js +2 -0
  124. package/dist/node_modules/@allyhub-next/ooxml/dist/report.d.ts +45 -0
  125. package/dist/node_modules/@allyhub-next/ooxml/dist/report.js +2 -0
  126. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.d.ts +28 -0
  127. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.js +2 -0
  128. package/dist/node_modules/@allyhub-next/ooxml/package.json +26 -0
  129. package/dist/node_modules/@allyhub-next/project/dist/deck-keys.js +2 -0
  130. package/dist/node_modules/@allyhub-next/project/dist/deck-measure.js +2 -0
  131. package/dist/node_modules/@allyhub-next/project/dist/deck-pool.js +2 -0
  132. package/dist/node_modules/@allyhub-next/project/dist/index.js +1 -1
  133. package/dist/node_modules/@allyhub-next/project/dist/session.js +1 -1
  134. package/dist/node_modules/@allyhub-next/project/dist/stills.js +2 -0
  135. package/dist/node_modules/@allyhub-next/project/package.json +1 -1
  136. package/dist/node_modules/@allyhub-next/protocol/dist/account.d.ts +338 -0
  137. package/dist/node_modules/@allyhub-next/protocol/dist/account.js +2 -0
  138. package/dist/node_modules/@allyhub-next/protocol/dist/auth.d.ts +12 -13
  139. package/dist/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
  140. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.d.ts +35 -0
  141. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.js +2 -0
  142. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +101 -32
  143. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
  144. package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +79 -5
  145. package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
  146. package/dist/node_modules/@allyhub-next/protocol/dist/files.d.ts +2 -2
  147. package/dist/node_modules/@allyhub-next/protocol/dist/index.d.ts +6 -0
  148. package/dist/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
  149. package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +21 -0
  150. package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
  151. package/dist/node_modules/@allyhub-next/protocol/dist/open.d.ts +13 -0
  152. package/dist/node_modules/@allyhub-next/protocol/dist/open.js +2 -0
  153. package/dist/node_modules/@allyhub-next/protocol/dist/registry.d.ts +73 -59
  154. package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
  155. package/dist/node_modules/@allyhub-next/protocol/dist/routes.d.ts +1 -1
  156. package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
  157. package/dist/node_modules/@allyhub-next/protocol/dist/shares.d.ts +115 -0
  158. package/dist/node_modules/@allyhub-next/protocol/dist/shares.js +2 -0
  159. package/dist/node_modules/@allyhub-next/protocol/dist/sites.d.ts +293 -0
  160. package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +2 -0
  161. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +377 -0
  162. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +2 -0
  163. package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +27 -9
  164. package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
  165. package/dist/node_modules/@allyhub-next/protocol/dist/tools.d.ts +53 -14
  166. package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
  167. package/dist/node_modules/@allyhub-next/protocol/package.json +2 -1
  168. package/dist/node_modules/@allyhub-next/registry/package.json +1 -1
  169. package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.js +3 -2
  170. package/dist/node_modules/@allyhub-next/render/dist/doc/index.js +1 -1
  171. package/dist/node_modules/@allyhub-next/render/dist/doc/pdf.js +34 -0
  172. package/dist/node_modules/@allyhub-next/render/dist/doc/print.js +4 -4
  173. package/dist/node_modules/@allyhub-next/render/dist/exports.js +2 -2
  174. package/dist/node_modules/@allyhub-next/render/dist/pdf.js +2 -0
  175. package/dist/node_modules/@allyhub-next/render/package.json +1 -1
  176. package/dist/node_modules/@allyhub-next/runtime/dist/fonts.js +1 -1
  177. package/dist/node_modules/@allyhub-next/runtime/dist/music.js +1 -1
  178. package/dist/node_modules/@allyhub-next/runtime/package.json +1 -1
  179. package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
  180. package/dist/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +25 -5
  181. package/dist/node_modules/@allyhub-next/scaffold/dist/index.js +4 -4
  182. package/dist/node_modules/@allyhub-next/scaffold/package.json +1 -1
  183. package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
  184. package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.d.ts +10 -0
  185. package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.js +3 -3
  186. package/dist/node_modules/@allyhub-next/scenery-host/package.json +1 -1
  187. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +9 -3
  188. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +1 -1
  189. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +5 -1
  190. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +1 -1
  191. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +60 -13
  192. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +1 -1
  193. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +1 -1
  194. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.d.ts +4 -0
  195. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.js +2 -0
  196. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +1 -1
  197. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +1 -1
  198. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +1 -1
  199. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +27 -1
  200. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +1 -1
  201. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.d.ts +16 -0
  202. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.js +2 -0
  203. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +18 -1
  204. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +1 -1
  205. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +1 -1
  206. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +2 -0
  207. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +1 -1
  208. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +1 -1
  209. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +1 -1
  210. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +1 -1
  211. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +1 -1
  212. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +1 -1
  213. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.d.ts +2 -0
  214. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.js +2 -0
  215. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +1 -1
  216. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.d.ts +38 -0
  217. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.js +2 -0
  218. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.d.ts +19 -0
  219. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.js +2 -0
  220. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.d.ts +49 -0
  221. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.js +2 -0
  222. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.d.ts +82 -0
  223. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.js +2 -0
  224. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +6 -1
  225. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +1 -1
  226. package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +1 -1
  227. package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
  228. package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +15 -0
  229. package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +1 -1
  230. package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +29 -8
  231. package/dist/node_modules/@allyhub-next/sheet/dist/export.js +3 -4
  232. package/dist/node_modules/@allyhub-next/sheet/dist/file.js +2 -2
  233. package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +8 -2
  234. package/dist/node_modules/@allyhub-next/sheet/dist/format.js +1 -1
  235. package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +52 -4
  236. package/dist/node_modules/@allyhub-next/sheet/dist/html.js +43 -11
  237. package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +7 -3
  238. package/dist/node_modules/@allyhub-next/sheet/dist/index.js +1 -1
  239. package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +1 -1
  240. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.d.ts +98 -0
  241. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.js +2 -0
  242. package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
  243. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.d.ts +32 -0
  244. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.js +2 -0
  245. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.d.ts +3 -0
  246. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.js +2 -0
  247. package/dist/node_modules/@allyhub-next/sheet/dist/values.js +1 -1
  248. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +10 -1
  249. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +1 -1
  250. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +10 -1
  251. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
  252. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +14 -4
  253. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +2 -2
  254. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +11 -1
  255. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +36 -16
  256. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +3 -1
  257. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +1 -1
  258. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +42 -1
  259. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -1
  260. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.d.ts +23 -0
  261. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.js +2 -0
  262. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +2 -0
  263. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +1 -1
  264. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +6 -0
  265. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
  266. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.d.ts +40 -0
  267. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +2 -0
  268. package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
  269. package/dist/node_modules/@allyhub-next/slides-core/dist/animation.js +1 -1
  270. package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +59 -39
  271. package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +2 -2
  272. package/dist/node_modules/@allyhub-next/slides-core/dist/capabilities.js +1 -1
  273. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +27 -13
  274. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
  275. package/dist/node_modules/@allyhub-next/slides-core/dist/check.js +1 -1
  276. package/dist/node_modules/@allyhub-next/slides-core/dist/code.d.ts +33 -0
  277. package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +2 -0
  278. package/dist/node_modules/@allyhub-next/slides-core/dist/components.d.ts +31 -0
  279. package/dist/node_modules/@allyhub-next/slides-core/dist/components.js +2 -0
  280. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +179 -16
  281. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
  282. package/dist/node_modules/@allyhub-next/slides-core/dist/file.d.ts +43 -21
  283. package/dist/node_modules/@allyhub-next/slides-core/dist/file.js +3 -3
  284. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.d.ts +17 -0
  285. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.js +2 -0
  286. package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +5 -1
  287. package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
  288. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.d.ts +6 -0
  289. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.js +2 -0
  290. package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +1 -1
  291. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.d.ts +58 -0
  292. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +2 -0
  293. package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +2 -4
  294. package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +17 -1
  295. package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
  296. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +21 -5
  297. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
  298. package/dist/node_modules/@allyhub-next/slides-core/dist/script.d.ts +18 -16
  299. package/dist/node_modules/@allyhub-next/slides-core/dist/script.js +2 -2
  300. package/dist/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +51 -53
  301. package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +1 -1
  302. package/dist/node_modules/@allyhub-next/slides-core/dist/units.d.ts +27 -0
  303. package/dist/node_modules/@allyhub-next/slides-core/dist/units.js +1 -1
  304. package/dist/node_modules/@allyhub-next/slides-core/dist/values.d.ts +7 -0
  305. package/dist/node_modules/@allyhub-next/slides-core/dist/values.js +2 -0
  306. package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
  307. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/code.js +4 -0
  308. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/index.js +3 -0
  309. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/names.js +2 -0
  310. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/script.js +2 -0
  311. package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.js +1 -1
  312. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/chart.js +2 -0
  313. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/common.js +2 -0
  314. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/index.js +4 -0
  315. package/dist/{site.js → node_modules/@allyhub-next/slides-pptx/dist/read/model.js} +1 -1
  316. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/shapes.js +2 -0
  317. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/table.js +2 -0
  318. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/text.js +2 -0
  319. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/timing.js +2 -0
  320. package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.js +1 -1
  321. package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.js +1 -1
  322. package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.js +1 -1
  323. package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.js +1 -1
  324. package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.js +2 -2
  325. package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.js +2 -2
  326. package/dist/node_modules/@allyhub-next/slides-pptx/package.json +1 -1
  327. package/dist/node_modules/@allyhub-next/slides-runtime/dist/component.js +2 -0
  328. package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.js +2 -2
  329. package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.js +1 -1
  330. package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.js +5 -5
  331. package/dist/node_modules/@allyhub-next/slides-runtime/package.json +5 -1
  332. package/dist/node_modules/@allyhub-next/stage/dist/index.js +1 -1
  333. package/dist/node_modules/@allyhub-next/stage/dist/page.js +22 -12
  334. package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.js +5 -5
  335. package/dist/node_modules/@allyhub-next/stage/dist/server.js +1 -1
  336. package/dist/node_modules/@allyhub-next/stage/package.json +1 -1
  337. package/dist/node_modules/@allyhub-next/stage-page/dist/host.js +1 -20
  338. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/probe.html +8 -0
  339. package/dist/{astro.js → node_modules/@allyhub-next/stage-page/dist/runtime/probe.js} +1 -1
  340. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/runtime.js +79 -0
  341. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.html +21 -0
  342. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.js +3 -0
  343. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.html +9 -0
  344. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.js +3 -0
  345. package/dist/node_modules/@allyhub-next/stage-page/package.json +2 -3
  346. package/dist/node_modules/@allyhub-next/video-core/dist/captions.js +6 -6
  347. package/dist/node_modules/@allyhub-next/video-core/dist/fact.d.ts +47 -8
  348. package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
  349. package/dist/node_modules/@allyhub-next/video-core/dist/index.d.ts +1 -0
  350. package/dist/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
  351. package/dist/node_modules/@allyhub-next/video-core/dist/marks.d.ts +14 -0
  352. package/dist/node_modules/@allyhub-next/video-core/dist/marks.js +1 -1
  353. package/dist/node_modules/@allyhub-next/video-core/dist/music.d.ts +2 -1
  354. package/dist/node_modules/@allyhub-next/video-core/dist/piece.d.ts +11 -2
  355. package/dist/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
  356. package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
  357. package/dist/node_modules/@allyhub-next/video-core/dist/schema.d.ts +2 -2
  358. package/dist/node_modules/@allyhub-next/video-core/dist/schema.js +1 -1
  359. package/dist/node_modules/@allyhub-next/video-core/dist/script.d.ts +2 -1
  360. package/dist/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
  361. package/dist/node_modules/@allyhub-next/video-core/dist/source.d.ts +7 -0
  362. package/dist/node_modules/@allyhub-next/video-core/dist/source.js +2 -0
  363. package/dist/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +10 -33
  364. package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
  365. package/dist/node_modules/@allyhub-next/website/LICENSE +241 -0
  366. package/dist/node_modules/@allyhub-next/website/dist/index.js +2 -0
  367. package/dist/node_modules/@allyhub-next/website/dist/publish.js +3 -0
  368. package/dist/node_modules/@allyhub-next/website/dist/rules.js +2 -0
  369. package/dist/node_modules/@allyhub-next/website/dist/website.js +4 -0
  370. package/dist/node_modules/@allyhub-next/website/package.json +13 -0
  371. package/dist/text/facts-text.js +4 -4
  372. package/dist/works.js +1 -1
  373. package/editor-web/assets/calc-worker-Bz9r26p1.js +158 -0
  374. package/editor-web/assets/dist-0emakyZE.js +36 -0
  375. package/editor-web/assets/dist-B3UoDUa5.js +37 -0
  376. package/editor-web/assets/dist-B6KzR3pN.js +10 -0
  377. package/editor-web/assets/dist-Bc5iA5k1.js +1 -0
  378. package/editor-web/assets/dist-CTQIm8Im.js +10 -0
  379. package/editor-web/assets/dist-CiHNHwyq.js +2 -0
  380. package/editor-web/assets/dist-DNZ8PQ-E.js +224 -0
  381. package/editor-web/assets/index-CFt3ovRY.js +69 -0
  382. package/editor-web/assets/index-ujKjdu_s.css +2 -0
  383. package/editor-web/assets/minus-BhoPZC5P.js +1 -0
  384. package/editor-web/assets/react-C_-rEEBU.js +101 -0
  385. package/editor-web/assets/tabs-Den4gHrU.js +105 -0
  386. package/editor-web/assets/text-align-start-CsW4nqqL.js +1 -0
  387. package/editor-web/index.html +5 -5
  388. package/package.json +8 -14
  389. package/dist/astro.d.ts +0 -2
  390. package/dist/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +0 -52
  391. package/dist/node_modules/@allyhub-next/audio/dist/decode.d.ts +0 -33
  392. package/dist/node_modules/@allyhub-next/audio/dist/envelope.d.ts +0 -37
  393. package/dist/node_modules/@allyhub-next/audio/dist/index.d.ts +0 -17
  394. package/dist/node_modules/@allyhub-next/audio/dist/levels.d.ts +0 -97
  395. package/dist/node_modules/@allyhub-next/audio/dist/master.d.ts +0 -29
  396. package/dist/node_modules/@allyhub-next/audio/dist/music.d.ts +0 -11
  397. package/dist/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +0 -39
  398. package/dist/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +0 -25
  399. package/dist/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +0 -31
  400. package/dist/node_modules/@allyhub-next/audio/dist/node/index.d.ts +0 -8
  401. package/dist/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +0 -18
  402. package/dist/node_modules/@allyhub-next/audio/dist/node/master.d.ts +0 -42
  403. package/dist/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +0 -60
  404. package/dist/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +0 -31
  405. package/dist/node_modules/@allyhub-next/audio/dist/plan.d.ts +0 -143
  406. package/dist/node_modules/@allyhub-next/audio/dist/recorded.d.ts +0 -26
  407. package/dist/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +0 -47
  408. package/dist/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +0 -89
  409. package/dist/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +0 -64
  410. package/dist/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +0 -26
  411. package/dist/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +0 -42
  412. package/dist/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +0 -56
  413. package/dist/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +0 -10
  414. package/dist/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +0 -12
  415. package/dist/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +0 -67
  416. package/dist/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +0 -32
  417. package/dist/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +0 -27
  418. package/dist/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +0 -64
  419. package/dist/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +0 -78
  420. package/dist/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +0 -111
  421. package/dist/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +0 -3
  422. package/dist/node_modules/@allyhub-next/audio/dist/render.d.ts +0 -26
  423. package/dist/node_modules/@allyhub-next/audio/dist/sfx.d.ts +0 -10
  424. package/dist/node_modules/@allyhub-next/audio/dist/shape.d.ts +0 -118
  425. package/dist/node_modules/@allyhub-next/audio/dist/voice.d.ts +0 -45
  426. package/dist/node_modules/@allyhub-next/browser/dist/browser.d.ts +0 -24
  427. package/dist/node_modules/@allyhub-next/browser/dist/capture.d.ts +0 -61
  428. package/dist/node_modules/@allyhub-next/browser/dist/cdp.d.ts +0 -51
  429. package/dist/node_modules/@allyhub-next/browser/dist/flags.d.ts +0 -13
  430. package/dist/node_modules/@allyhub-next/browser/dist/frames.d.ts +0 -35
  431. package/dist/node_modules/@allyhub-next/browser/dist/html.d.ts +0 -19
  432. package/dist/node_modules/@allyhub-next/browser/dist/index.d.ts +0 -10
  433. package/dist/node_modules/@allyhub-next/browser/dist/launch.d.ts +0 -35
  434. package/dist/node_modules/@allyhub-next/browser/dist/page.d.ts +0 -67
  435. package/dist/node_modules/@allyhub-next/browser/dist/server.d.ts +0 -26
  436. package/dist/node_modules/@allyhub-next/check/dist/cache.d.ts +0 -46
  437. package/dist/node_modules/@allyhub-next/check/dist/check.d.ts +0 -142
  438. package/dist/node_modules/@allyhub-next/check/dist/generated.d.ts +0 -22
  439. package/dist/node_modules/@allyhub-next/check/dist/index.d.ts +0 -7
  440. package/dist/node_modules/@allyhub-next/check/dist/plans.d.ts +0 -111
  441. package/dist/node_modules/@allyhub-next/check/dist/result.d.ts +0 -12
  442. package/dist/node_modules/@allyhub-next/check/dist/scenery.d.ts +0 -23
  443. package/dist/node_modules/@allyhub-next/dev-server/dist/background.d.ts +0 -50
  444. package/dist/node_modules/@allyhub-next/dev-server/dist/card.d.ts +0 -17
  445. package/dist/node_modules/@allyhub-next/dev-server/dist/exports.d.ts +0 -18
  446. package/dist/node_modules/@allyhub-next/dev-server/dist/index.d.ts +0 -11
  447. package/dist/node_modules/@allyhub-next/dev-server/dist/live.d.ts +0 -77
  448. package/dist/node_modules/@allyhub-next/dev-server/dist/mime.d.ts +0 -2
  449. package/dist/node_modules/@allyhub-next/dev-server/dist/mime.js +0 -2
  450. package/dist/node_modules/@allyhub-next/dev-server/dist/paths.d.ts +0 -27
  451. package/dist/node_modules/@allyhub-next/dev-server/dist/project.d.ts +0 -153
  452. package/dist/node_modules/@allyhub-next/dev-server/dist/reveal.d.ts +0 -6
  453. package/dist/node_modules/@allyhub-next/dev-server/dist/server.d.ts +0 -47
  454. package/dist/node_modules/@allyhub-next/dev-server/dist/sound.d.ts +0 -21
  455. package/dist/node_modules/@allyhub-next/dev-server/dist/stage.d.ts +0 -82
  456. package/dist/node_modules/@allyhub-next/dev-server/dist/stage.js +0 -121
  457. package/dist/node_modules/@allyhub-next/dev-server/dist/tools.d.ts +0 -24
  458. package/dist/node_modules/@allyhub-next/dev-server/dist/validate.d.ts +0 -6
  459. package/dist/node_modules/@allyhub-next/dev-server/dist/watcher.d.ts +0 -47
  460. package/dist/node_modules/@allyhub-next/dev-server/dist/writer.d.ts +0 -51
  461. package/dist/node_modules/@allyhub-next/export/dist/batch.d.ts +0 -70
  462. package/dist/node_modules/@allyhub-next/export/dist/deck-fonts.d.ts +0 -24
  463. package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.d.ts +0 -12
  464. package/dist/node_modules/@allyhub-next/export/dist/export.d.ts +0 -123
  465. package/dist/node_modules/@allyhub-next/export/dist/index.d.ts +0 -5
  466. package/dist/node_modules/@allyhub-next/export/dist/names.d.ts +0 -36
  467. package/dist/node_modules/@allyhub-next/measure/dist/compare.d.ts +0 -195
  468. package/dist/node_modules/@allyhub-next/measure/dist/contrast.d.ts +0 -14
  469. package/dist/node_modules/@allyhub-next/measure/dist/cut-sheet.d.ts +0 -90
  470. package/dist/node_modules/@allyhub-next/measure/dist/cuts.d.ts +0 -108
  471. package/dist/node_modules/@allyhub-next/measure/dist/facts.d.ts +0 -60
  472. package/dist/node_modules/@allyhub-next/measure/dist/fidelity.d.ts +0 -40
  473. package/dist/node_modules/@allyhub-next/measure/dist/flat.d.ts +0 -42
  474. package/dist/node_modules/@allyhub-next/measure/dist/index.d.ts +0 -24
  475. package/dist/node_modules/@allyhub-next/measure/dist/loop.d.ts +0 -22
  476. package/dist/node_modules/@allyhub-next/measure/dist/overlay.d.ts +0 -57
  477. package/dist/node_modules/@allyhub-next/measure/dist/recording-report.d.ts +0 -66
  478. package/dist/node_modules/@allyhub-next/measure/dist/reference/compare.d.ts +0 -118
  479. package/dist/node_modules/@allyhub-next/measure/dist/reference/folder.d.ts +0 -75
  480. package/dist/node_modules/@allyhub-next/measure/dist/reference/interpret.d.ts +0 -39
  481. package/dist/node_modules/@allyhub-next/measure/dist/reference/piece.d.ts +0 -53
  482. package/dist/node_modules/@allyhub-next/measure/dist/reference/sections.d.ts +0 -53
  483. package/dist/node_modules/@allyhub-next/measure/dist/reference/sets.d.ts +0 -84
  484. package/dist/node_modules/@allyhub-next/measure/dist/reference/text.d.ts +0 -27
  485. package/dist/node_modules/@allyhub-next/measure/dist/reference/video.d.ts +0 -55
  486. package/dist/node_modules/@allyhub-next/measure/dist/seams.d.ts +0 -46
  487. package/dist/node_modules/@allyhub-next/measure/dist/sound-measures.d.ts +0 -74
  488. package/dist/node_modules/@allyhub-next/measure/dist/sound-report.d.ts +0 -156
  489. package/dist/node_modules/@allyhub-next/measure/dist/still.d.ts +0 -58
  490. package/dist/node_modules/@allyhub-next/measure/dist/version-voice.d.ts +0 -12
  491. package/dist/node_modules/@allyhub-next/project/dist/console.d.ts +0 -34
  492. package/dist/node_modules/@allyhub-next/project/dist/digest.d.ts +0 -9
  493. package/dist/node_modules/@allyhub-next/project/dist/index.d.ts +0 -11
  494. package/dist/node_modules/@allyhub-next/project/dist/ledger.d.ts +0 -17
  495. package/dist/node_modules/@allyhub-next/project/dist/media-index.d.ts +0 -27
  496. package/dist/node_modules/@allyhub-next/project/dist/page.d.ts +0 -119
  497. package/dist/node_modules/@allyhub-next/project/dist/says.d.ts +0 -15
  498. package/dist/node_modules/@allyhub-next/project/dist/scenery.d.ts +0 -35
  499. package/dist/node_modules/@allyhub-next/project/dist/session.d.ts +0 -37
  500. package/dist/node_modules/@allyhub-next/project/dist/stretch.d.ts +0 -38
  501. package/dist/node_modules/@allyhub-next/project/dist/version.d.ts +0 -114
  502. package/dist/node_modules/@allyhub-next/render/dist/cap.d.ts +0 -41
  503. package/dist/node_modules/@allyhub-next/render/dist/capture.d.ts +0 -78
  504. package/dist/node_modules/@allyhub-next/render/dist/clip.d.ts +0 -27
  505. package/dist/node_modules/@allyhub-next/render/dist/composite.d.ts +0 -106
  506. package/dist/node_modules/@allyhub-next/render/dist/delivery.d.ts +0 -18
  507. package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.d.ts +0 -3
  508. package/dist/node_modules/@allyhub-next/render/dist/doc/index.d.ts +0 -3
  509. package/dist/node_modules/@allyhub-next/render/dist/doc/print.d.ts +0 -51
  510. package/dist/node_modules/@allyhub-next/render/dist/encode.d.ts +0 -111
  511. package/dist/node_modules/@allyhub-next/render/dist/errors.d.ts +0 -15
  512. package/dist/node_modules/@allyhub-next/render/dist/exports.d.ts +0 -67
  513. package/dist/node_modules/@allyhub-next/render/dist/ffmpeg.d.ts +0 -75
  514. package/dist/node_modules/@allyhub-next/render/dist/footage.d.ts +0 -169
  515. package/dist/node_modules/@allyhub-next/render/dist/image.d.ts +0 -16
  516. package/dist/node_modules/@allyhub-next/render/dist/index.d.ts +0 -26
  517. package/dist/node_modules/@allyhub-next/render/dist/junction.d.ts +0 -70
  518. package/dist/node_modules/@allyhub-next/render/dist/look.d.ts +0 -21
  519. package/dist/node_modules/@allyhub-next/render/dist/page.d.ts +0 -178
  520. package/dist/node_modules/@allyhub-next/render/dist/parts.d.ts +0 -140
  521. package/dist/node_modules/@allyhub-next/render/dist/png.d.ts +0 -37
  522. package/dist/node_modules/@allyhub-next/render/dist/pool.d.ts +0 -54
  523. package/dist/node_modules/@allyhub-next/render/dist/post-probe.d.ts +0 -27
  524. package/dist/node_modules/@allyhub-next/render/dist/post.d.ts +0 -27
  525. package/dist/node_modules/@allyhub-next/render/dist/render.d.ts +0 -151
  526. package/dist/node_modules/@allyhub-next/render/dist/segments.d.ts +0 -40
  527. package/dist/node_modules/@allyhub-next/render/dist/sound.d.ts +0 -24
  528. package/dist/node_modules/@allyhub-next/render/dist/stills.d.ts +0 -41
  529. package/dist/node_modules/@allyhub-next/render/dist/tools.d.ts +0 -25
  530. package/dist/node_modules/@allyhub-next/render/dist/webp.d.ts +0 -17
  531. package/dist/node_modules/@allyhub-next/runtime/dist/bridge.d.ts +0 -211
  532. package/dist/node_modules/@allyhub-next/runtime/dist/captions.d.ts +0 -24
  533. package/dist/node_modules/@allyhub-next/runtime/dist/clock.d.ts +0 -32
  534. package/dist/node_modules/@allyhub-next/runtime/dist/compose.d.ts +0 -149
  535. package/dist/node_modules/@allyhub-next/runtime/dist/console.d.ts +0 -21
  536. package/dist/node_modules/@allyhub-next/runtime/dist/contrast.d.ts +0 -13
  537. package/dist/node_modules/@allyhub-next/runtime/dist/embed.d.ts +0 -50
  538. package/dist/node_modules/@allyhub-next/runtime/dist/env.d.ts +0 -101
  539. package/dist/node_modules/@allyhub-next/runtime/dist/errors.d.ts +0 -21
  540. package/dist/node_modules/@allyhub-next/runtime/dist/facade.d.ts +0 -42
  541. package/dist/node_modules/@allyhub-next/runtime/dist/fonts.d.ts +0 -110
  542. package/dist/node_modules/@allyhub-next/runtime/dist/footage.d.ts +0 -52
  543. package/dist/node_modules/@allyhub-next/runtime/dist/frame.d.ts +0 -61
  544. package/dist/node_modules/@allyhub-next/runtime/dist/guards.d.ts +0 -32
  545. package/dist/node_modules/@allyhub-next/runtime/dist/index.d.ts +0 -14
  546. package/dist/node_modules/@allyhub-next/runtime/dist/inspect.d.ts +0 -112
  547. package/dist/node_modules/@allyhub-next/runtime/dist/locate.d.ts +0 -11
  548. package/dist/node_modules/@allyhub-next/runtime/dist/measure.d.ts +0 -41
  549. package/dist/node_modules/@allyhub-next/runtime/dist/mix-plan.d.ts +0 -42
  550. package/dist/node_modules/@allyhub-next/runtime/dist/music.d.ts +0 -29
  551. package/dist/node_modules/@allyhub-next/runtime/dist/output.d.ts +0 -5
  552. package/dist/node_modules/@allyhub-next/runtime/dist/pictures.d.ts +0 -39
  553. package/dist/node_modules/@allyhub-next/runtime/dist/piece.d.ts +0 -34
  554. package/dist/node_modules/@allyhub-next/runtime/dist/player/clips.d.ts +0 -41
  555. package/dist/node_modules/@allyhub-next/runtime/dist/player/cutout.d.ts +0 -57
  556. package/dist/node_modules/@allyhub-next/runtime/dist/player/player.d.ts +0 -78
  557. package/dist/node_modules/@allyhub-next/runtime/dist/reads.d.ts +0 -132
  558. package/dist/node_modules/@allyhub-next/runtime/dist/sound.d.ts +0 -22
  559. package/dist/node_modules/@allyhub-next/runtime/dist/speech.d.ts +0 -107
  560. package/dist/node_modules/@allyhub-next/runtime/dist/stage-kit.d.ts +0 -12
  561. package/dist/node_modules/@allyhub-next/runtime/dist/stage.d.ts +0 -34
  562. package/dist/node_modules/@allyhub-next/runtime/dist/styles.d.ts +0 -35
  563. package/dist/node_modules/@allyhub-next/runtime/dist/takes.d.ts +0 -72
  564. package/dist/node_modules/@allyhub-next/runtime/dist/titles.d.ts +0 -10
  565. package/dist/node_modules/@allyhub-next/runtime/dist/transitions.d.ts +0 -26
  566. package/dist/node_modules/@allyhub-next/site/dist/assets.d.ts +0 -59
  567. package/dist/node_modules/@allyhub-next/site/dist/assets.js +0 -2
  568. package/dist/node_modules/@allyhub-next/site/dist/astro.d.ts +0 -22
  569. package/dist/node_modules/@allyhub-next/site/dist/astro.js +0 -3
  570. package/dist/node_modules/@allyhub-next/site/dist/lockfile.d.ts +0 -40
  571. package/dist/node_modules/@allyhub-next/site/dist/lockfile.js +0 -3
  572. package/dist/node_modules/@allyhub-next/site/dist/media.d.ts +0 -24
  573. package/dist/node_modules/@allyhub-next/site/dist/media.js +0 -4
  574. package/dist/node_modules/@allyhub-next/site/package.json +0 -25
  575. package/dist/node_modules/@allyhub-next/slides-core/dist/preset.d.ts +0 -5
  576. package/dist/node_modules/@allyhub-next/slides-core/dist/preset.js +0 -2
  577. package/dist/node_modules/@allyhub-next/slides-pptx/dist/charts.d.ts +0 -6
  578. package/dist/node_modules/@allyhub-next/slides-pptx/dist/fonts.d.ts +0 -45
  579. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.d.ts +0 -18
  580. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.js +0 -3
  581. package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.d.ts +0 -5
  582. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.d.ts +0 -56
  583. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.js +0 -4
  584. package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.d.ts +0 -72
  585. package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.d.ts +0 -32
  586. package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.d.ts +0 -4
  587. package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.d.ts +0 -32
  588. package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.d.ts +0 -32
  589. package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.d.ts +0 -32
  590. package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.d.ts +0 -43
  591. package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.d.ts +0 -4
  592. package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.js +0 -2
  593. package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.d.ts +0 -4
  594. package/dist/node_modules/@allyhub-next/slides-runtime/dist/ink.d.ts +0 -10
  595. package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.d.ts +0 -6
  596. package/dist/node_modules/@allyhub-next/stage/dist/bakes.d.ts +0 -42
  597. package/dist/node_modules/@allyhub-next/stage/dist/graphics.d.ts +0 -7
  598. package/dist/node_modules/@allyhub-next/stage/dist/identity.d.ts +0 -2
  599. package/dist/node_modules/@allyhub-next/stage/dist/index.d.ts +0 -9
  600. package/dist/node_modules/@allyhub-next/stage/dist/page.d.ts +0 -87
  601. package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.d.ts +0 -69
  602. package/dist/node_modules/@allyhub-next/stage/dist/scenery-solve.d.ts +0 -49
  603. package/dist/node_modules/@allyhub-next/stage/dist/scenery.d.ts +0 -8
  604. package/dist/node_modules/@allyhub-next/stage/dist/server.d.ts +0 -21
  605. package/dist/node_modules/@allyhub-next/stage-page/dist/host.d.ts +0 -22
  606. package/dist/node_modules/@allyhub-next/stage-page/dist/page.js +0 -79
  607. package/dist/site.d.ts +0 -2
  608. package/editor-web/assets/dist-BW2s9FMO.js +0 -4
  609. package/editor-web/assets/dist-C-6JmebI.js +0 -233
  610. package/editor-web/assets/dist-CCYMLMKN.js +0 -6
  611. package/editor-web/assets/dist-CHzurjMx.js +0 -33
  612. package/editor-web/assets/dist-DF7H1dxw.js +0 -1
  613. package/editor-web/assets/dist-Da5AUSKX.js +0 -2
  614. package/editor-web/assets/index-B7S9RZhL.css +0 -2
  615. package/editor-web/assets/index-CovQYWvD.js +0 -69
  616. package/editor-web/assets/minus-BrvjaJyO.js +0 -1
  617. package/editor-web/assets/react-DV5fPdiH.js +0 -101
  618. package/editor-web/assets/textarea-B0vCGdZI.js +0 -105
  619. package/editor-web/assets/trash-2-B0dvc1cZ.js +0 -1
  620. package/editor-web/assets/undo-2-A1EPubPO.js +0 -1
  621. /package/dist/node_modules/@allyhub-next/{site → ooxml}/LICENSE +0 -0
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as s,ERR as c}from"../../values.js";import{compare as U,toText as E}from"../coerce.js";import{FUNCTIONS as p,cellsOf as h,raw as u}from"./define.js";import{criterion as T}from"./criteria.js";function w(n,e){const t=[];for(let o=0;o<n.cols;o++){const f=E(n.at(0,o));if(f instanceof s)return f;t.push(f.toLowerCase())}const r=[];for(let o=1;o<n.rows;o++){let f=e.rows<2;for(let i=1;i<e.rows&&!f;i++){let l=!0;for(let m=0;m<e.cols&&l;m++){const D=e.at(i,m);if(D===null||D==="")continue;const d=E(e.at(0,m));if(d instanceof s)return d;const V=t.indexOf(d.toLowerCase());if(V<0){l=!1;continue}const A=T(D);if(A instanceof s)return A;A.test(n.at(o,V))||(l=!1)}l&&(f=!0)}f&&r.push(o)}return r}function R(n,e){if(typeof e=="number"){const r=Math.trunc(e)-1;return r<0||r>=n.cols?c.VALUE:r}const t=E(e);if(t instanceof s)return t;for(let r=0;r<n.cols;r++){const o=n.at(0,r);if(typeof o=="string"&&U(o,t)===0)return r}return c.VALUE}function a(n,e){const t=h(n[0],e);if(t instanceof s)return t;const r=h(n[2],e);if(r instanceof s)return r;const o=w(t,r);if(o instanceof s)return o;const f=n[1];if(f===void 0)return{list:o.map(()=>null),db:t};const i=R(t,e.calc.scalar(f,e.frame));return i instanceof s?i:{list:o.map(l=>t.at(l,i)),db:t}}function S(n,e){u(n,3,3,(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return f.call([...i.length>0?i:[0]],r)})}for(const[n,e]of[["DSUM","SUM"],["DMAX","MAX"],["DMIN","MIN"],["DPRODUCT","PRODUCT"]])S(n,e);for(const[n,e]of[["DAVERAGE","AVERAGE"],["DSTDEV","STDEV.S"],["DSTDEVP","STDEV.P"],["DVAR","VAR.S"],["DVARP","VAR.P"]])u(n,3,3,(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return i.length===0?c.DIV0:f.call(i,r)});u("DCOUNT",2,3,(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>typeof r=="number").length}),u("DCOUNTA",2,3,(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>r!==null).length}),u("DGET",3,3,(n,e)=>{const t=a(n,e);return t instanceof s?t:t.list.length===0?c.VALUE:t.list.length>1?c.NUM:t.list[0]??null});
2
+ import{CellError as s,ERR as c}from"../../values.js";import{compare as U,toText as E}from"../coerce.js";import{FUNCTIONS as p,cellsOf as h,raw as u}from"./define.js";import{criterion as T}from"./criteria.js";function w(n,e){const t=[];for(let o=0;o<n.cols;o++){const f=E(n.at(0,o));if(f instanceof s)return f;t.push(f.toLowerCase())}const r=[];for(let o=1;o<n.rows;o++){let f=e.rows<2;for(let i=1;i<e.rows&&!f;i++){let l=!0;for(let m=0;m<e.cols&&l;m++){const D=e.at(i,m);if(D===null||D==="")continue;const d=E(e.at(0,m));if(d instanceof s)return d;const V=t.indexOf(d.toLowerCase());if(V<0){l=!1;continue}const A=T(D);if(A instanceof s)return A;A.test(n.at(o,V))||(l=!1)}l&&(f=!0)}f&&r.push(o)}return r}function R(n,e){if(typeof e=="number"){const r=Math.trunc(e)-1;return r<0||r>=n.cols?c.VALUE:r}const t=E(e);if(t instanceof s)return t;for(let r=0;r<n.cols;r++){const o=n.at(0,r);if(typeof o=="string"&&U(o,t)===0)return r}return c.VALUE}function a(n,e){const t=h(n[0],e);if(t instanceof s)return t;const r=h(n[2],e);if(r instanceof s)return r;const o=w(t,r);if(o instanceof s)return o;const f=n[1];if(f===void 0)return{list:o.map(()=>null),db:t};const i=R(t,e.calc.scalar(f,e.frame));return i instanceof s?i:{list:o.map(l=>t.at(l,i)),db:t}}function S(n,e){u(n,"rvr",(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return f.call([...i.length>0?i:[0]],r)})}for(const[n,e]of[["DSUM","SUM"],["DMAX","MAX"],["DMIN","MIN"],["DPRODUCT","PRODUCT"]])S(n,e);for(const[n,e]of[["DAVERAGE","AVERAGE"],["DSTDEV","STDEV.S"],["DSTDEVP","STDEV.P"],["DVAR","VAR.S"],["DVARP","VAR.P"]])u(n,"rvr",(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return i.length===0?c.DIV0:f.call(i,r)});u("DCOUNT","rv?r",(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>typeof r=="number").length}),u("DCOUNTA","rv?r",(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>r!==null).length}),u("DGET","rvr",(n,e)=>{const t=a(n,e);return t instanceof s?t:t.list.length===0?c.VALUE:t.list.length>1?c.NUM:t.list[0]??null});
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{parseDate as B,parseTime as H,parseValue as I}from"numfmt";import{CellError as c,ERR as i,dateOf as h,serialOf as U}from"../../values.js";import{toBool as X,toNumber as m,toText as Y}from"../coerce.js";import{Missing as O}from"../types.js";import{number as V,numbersOf as b,raw as p,scalar as l}from"./define.js";const d=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.floor(n)},R=r=>r%4===0&&r%100!==0||r%400===0,A=(r,n)=>n===2?R(r)?29:28:[4,6,9,11].includes(n)?30:31,W=r=>r.month===2&&r.day===A(r.year,2);l("DATE",3,3,V((r=0,n=1,e=1)=>{const t=Math.trunc(r);if(t<0||t>9999)return i.NUM;const o=U(t<1900?t+1900:t,Math.trunc(n),Math.trunc(e));return o<0?i.NUM:o})),l("TIME",3,3,V((r=0,n=0,e=0)=>{const t=Math.trunc(r)*3600+Math.trunc(n)*60+Math.trunc(e);return t<0?i.NUM:t%86400/86400})),l("YEAR",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).year}),l("MONTH",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).month}),l("DAY",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).day});const L=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.round((n-Math.floor(n))*86400)%86400};l("HOUR",1,1,r=>{const n=L(r);return n instanceof c?n:Math.floor(n/3600)}),l("MINUTE",1,1,r=>{const n=L(r);return n instanceof c?n:Math.floor(n/60)%60}),l("SECOND",1,1,r=>{const n=L(r);return n instanceof c?n:n%60}),l("DATEVALUE",1,1,r=>{const n=Y(r);if(n instanceof c)return n;const e=B(n)??I(n);return typeof e?.value=="number"?Math.floor(e.value):i.VALUE}),l("TIMEVALUE",1,1,r=>{const n=Y(r);if(n instanceof c)return n;const e=H(n)??I(n);return typeof e?.value!="number"?i.VALUE:e.value-Math.floor(e.value)});const D=r=>(r%7+6)%7;l("WEEKDAY",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;const o=D(e);return t===1?o+1:t===2?(o+6)%7+1:t===3?(o+6)%7:t>=11&&t<=17?(o+7-(t-10)%7)%7+1:i.NUM});const k=r=>{const n=(D(r)+6)%7,e=r-n+3,{year:t}=h(e);return Math.floor((e-U(t,1,1))/7)+1};l("ISOWEEKNUM",1,1,r=>{const n=d(r);return n instanceof c?n:k(n)}),l("WEEKNUM",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;if(t===21)return k(e);const o=t===1?0:t===2?1:t>=11&&t<=17?(t-10)%7:-1;if(o<0)return i.NUM;const a=U(h(e).year,1,1),s=(D(a)+7-o)%7;return Math.floor((e-a+s)/7)+1});const S=(r,n)=>{const{year:e,month:t,day:o}=h(r),a=e*12+t-1+n,s=Math.floor(a/12),f=a-s*12+1;return U(s,f,Math.min(o,A(s,f)))};l("EDATE",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=S(e,Math.trunc(t));return o<0?i.NUM:o}),l("EOMONTH",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=h(S(e,Math.trunc(t))),a=U(o.year,o.month,A(o.year,o.month));return a<0?i.NUM:a}),l("DAYS",2,2,(r,n)=>{const e=d(r),t=d(n);return e instanceof c?e:t instanceof c?t:e-t}),l("DATEDIF",3,3,(r,n,e)=>{const t=d(r),o=d(n),a=Y(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;if(t>o)return i.NUM;const s=h(t),f=h(o),u=(f.year-s.year)*12+f.month-s.month-(f.day<s.day?1:0);switch(a.toUpperCase()){case"D":return o-t;case"M":return u;case"Y":return Math.floor(u/12);case"YM":return u%12;case"MD":{if(f.day>=s.day)return f.day-s.day;const y=f.month===1?12:f.month-1,N=f.month===1?f.year-1:f.year;return A(N,y)-s.day+f.day}case"YD":{const y=f.year-s.year-(u%12<0?1:0),N=Math.floor(u/12),M=S(t,N*12);return y>=0?o-M:i.NUM}default:return i.NUM}});function K(r,n,e){const t=h(r),o=h(n);let a=t.day,s=o.day,f=o.month,u=o.year;return e?(a=Math.min(a,30),s=Math.min(s,30)):(a===A(t.year,t.month)&&(a=30),s===31&&(a<30?(s=1,f+=1,f>12&&(f=1,u+=1)):s=30)),(u-t.year)*360+(f-t.month)*30+s-a}l("DAYS360",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e===void 0?!1:X(e);return t instanceof c?t:o instanceof c?o:a instanceof c?a:K(t,o,a)});export function yearFrac(r,n,e){const[t,o]=r<=n?[r,n]:[n,r],a=h(t),s=h(o),f=o-t;switch(e){case 0:{let u=a.day,y=s.day;return W(a)&&(W(s)&&(y=30),u=30),y===31&&u>=30&&(y=30),u===31&&(u=30),((s.year-a.year)*360+(s.month-a.month)*30+y-u)/360}case 2:return f/360;case 3:return f/365;case 4:return K(t,o,!0)/360;default:{if(a.year===s.year||s.year===a.year+1&&(a.month>s.month||a.month===s.month&&a.day>=s.day)){let M;if(a.year===s.year)M=R(a.year);else{const E=w=>R(w)?U(w,2,29):1/0;M=E(a.year)>=t&&E(a.year)<=o||E(s.year)>=t&&E(s.year)<=o}return f/(M?366:365)}const y=s.year-a.year+1,N=U(s.year+1,1,1)-U(a.year,1,1);return f/(N/y)}}}l("YEARFRAC",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e==null?0:m(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;const s=Math.trunc(a);return s<0||s>4?i.NUM:yearFrac(t,o,s)});function x(r){const n=(...t)=>[0,1,2,3,4,5,6].map(o=>t.includes(o));if(r==null)return n(0,6);if(typeof r=="string"){if(!/^[01]{7}$/u.test(r)||r==="1111111")return i.VALUE;const t=r.split("").map(o=>o==="1");return[t[6]??!1,...t.slice(0,6)]}const e=m(r);return e instanceof c?e:e>=1&&e<=7?n((e+5)%7,(e+6)%7):e>=11&&e<=17?n(e-11):i.NUM}function _(r,n){if(r===void 0||r instanceof O)return new Set;const e=b([r],n);return e instanceof c?e:new Set(e.map(t=>Math.floor(t)))}function j(r,n,e,t){const o=r<=n?1:-1;let a=0;for(let s=r;o>0?s<=n:s>=n;s+=o)e[D(s)]!==!0&&!t.has(s)&&(a+=o);return a}function P(r,n,e,t){if(e.every(Boolean))return i.VALUE;const o=n<0?-1:1;let a=r;for(let s=Math.abs(n);s>0;)a+=o,e[D(a)]!==!0&&!t.has(a)&&(s-=1);return a<0?i.NUM:a}const v=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=d(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=x(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=_(n[r?3:2],e);return f instanceof c?f:j(t,o,s,f)},F=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=m(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=x(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=_(n[r?3:2],e);return f instanceof c?f:P(t,Math.trunc(o),s,f)};p("NETWORKDAYS",2,3,v(!1)),p("NETWORKDAYS.INTL",2,4,v(!0)),p("WORKDAY",2,3,F(!1)),p("WORKDAY.INTL",2,4,F(!0)),p("NOW",0,0,(r,n)=>n.calc.nowSerial(),{volatile:!0}),p("TODAY",0,0,(r,n)=>Math.floor(n.calc.nowSerial()),{volatile:!0});function $(r,n,e){const t=e[0]??0;let o=0;return n.forEach((a,s)=>{o+=a/(1+r)**(((e[s]??t)-t)/365)}),o}const C=(r,n)=>{const e=b([r[0]],n);if(e instanceof c)return e;const t=b([r[1]],n);return t instanceof c?t:e.length!==t.length||e.length===0?i.NUM:{values:e,dates:t.map(Math.floor)}};p("XNPV",3,3,(r,n)=>{const e=m(n.calc.scalar(r[0],n.frame));if(e instanceof c)return e;const t=C(r.slice(1),n);return t instanceof c?t:e<=0?i.NUM:$(e,t.values,t.dates)}),p("XIRR",2,3,(r,n)=>{const e=C(r,n);if(e instanceof c)return e;const{values:t,dates:o}=e;if(!t.some(u=>u>0)||!t.some(u=>u<0))return i.NUM;const a=r[2]===void 0||r[2]instanceof O?.1:m(n.calc.scalar(r[2],n.frame));if(a instanceof c)return a;const s=o[0]??0;let f=a;for(let u=0;u<100;u++){let y=0,N=0;t.forEach((E,w)=>{const T=((o[w]??s)-s)/365;y+=E/(1+f)**T,N-=T*E/(1+f)**(T+1)});const M=f-y/N;if(!Number.isFinite(M))return i.NUM;if(Math.abs(M-f)<1e-10)return M;f=M<=-1?(f-1)/2:M}return i.NUM});
2
+ import{parseDate as B,parseTime as H,parseValue as S}from"numfmt";import{CellError as c,ERR as i,dateOf as h,serialOf as U}from"../../values.js";import{toBool as X,toNumber as m,toText as T}from"../coerce.js";import{Missing as O}from"../types.js";import{number as I,numbersOf as Y,raw as p,scalar as l}from"./define.js";const j=2958465,d=r=>{const n=m(r);return n instanceof c?n:n<0||n>=j+1?i.NUM:Math.floor(n)},b=r=>r%4===0&&r%100!==0||r%400===0,A=(r,n)=>n===2?b(r)?29:28:[4,6,9,11].includes(n)?30:31,V=r=>r.month===2&&r.day===A(r.year,2);l("DATE",3,3,I((r=0,n=1,e=1)=>{const t=Math.trunc(r);if(t<0||t>9999)return i.NUM;const o=U(t<1900?t+1900:t,Math.trunc(n),Math.trunc(e));return o<0?i.NUM:o})),l("TIME",3,3,I((r=0,n=0,e=0)=>{const t=Math.trunc(r)*3600+Math.trunc(n)*60+Math.trunc(e);return t<0?i.NUM:t%86400/86400})),l("YEAR",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).year}),l("MONTH",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).month}),l("DAY",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).day});const R=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.round((n-Math.floor(n))*86400)%86400};l("HOUR",1,1,r=>{const n=R(r);return n instanceof c?n:Math.floor(n/3600)}),l("MINUTE",1,1,r=>{const n=R(r);return n instanceof c?n:Math.floor(n/60)%60}),l("SECOND",1,1,r=>{const n=R(r);return n instanceof c?n:n%60}),l("DATEVALUE",1,1,r=>{const n=T(r);if(n instanceof c)return n;const e=B(n)??S(n);return typeof e?.value=="number"?Math.floor(e.value):i.VALUE}),l("TIMEVALUE",1,1,r=>{const n=T(r);if(n instanceof c)return n;const e=H(n)??S(n);return typeof e?.value!="number"?i.VALUE:e.value-Math.floor(e.value)});const D=r=>(r%7+6)%7;l("WEEKDAY",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;const o=D(e);return t===1?o+1:t===2?(o+6)%7+1:t===3?(o+6)%7:t>=11&&t<=17?(o+7-(t-10)%7)%7+1:i.NUM});const W=r=>{const n=(D(r)+6)%7,e=r-n+3,{year:t}=h(e);return Math.floor((e-U(t,1,1))/7)+1};l("ISOWEEKNUM",1,1,r=>{const n=d(r);return n instanceof c?n:W(n)}),l("WEEKNUM",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;if(t===21)return W(e);const o=t===1?0:t===2?1:t>=11&&t<=17?(t-10)%7:-1;if(o<0)return i.NUM;const a=U(h(e).year,1,1),s=(D(a)+7-o)%7;return Math.floor((e-a+s)/7)+1});const L=(r,n)=>{const{year:e,month:t,day:o}=h(r),a=e*12+t-1+n,s=Math.floor(a/12),f=a-s*12+1;return U(s,f,Math.min(o,A(s,f)))};l("EDATE",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=L(e,Math.trunc(t));return o<0?i.NUM:o}),l("EOMONTH",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=h(L(e,Math.trunc(t))),a=U(o.year,o.month,A(o.year,o.month));return a<0?i.NUM:a}),l("DAYS",2,2,(r,n)=>{const e=d(r),t=d(n);return e instanceof c?e:t instanceof c?t:e-t}),l("DATEDIF",3,3,(r,n,e)=>{const t=d(r),o=d(n),a=T(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;if(t>o)return i.NUM;const s=h(t),f=h(o),u=(f.year-s.year)*12+f.month-s.month-(f.day<s.day?1:0);switch(a.toUpperCase()){case"D":return o-t;case"M":return u;case"Y":return Math.floor(u/12);case"YM":return u%12;case"MD":{if(f.day>=s.day)return f.day-s.day;const y=f.month===1?12:f.month-1,N=f.month===1?f.year-1:f.year;return A(N,y)-s.day+f.day}case"YD":{const y=f.year-s.year-(u%12<0?1:0),N=Math.floor(u/12),M=L(t,N*12);return y>=0?o-M:i.NUM}default:return i.NUM}});function _(r,n,e){const t=h(r),o=h(n);let a=t.day,s=o.day,f=o.month,u=o.year;return e?(a=Math.min(a,30),s=Math.min(s,30)):(a===A(t.year,t.month)&&(a=30),s===31&&(a<30?(s=1,f+=1,f>12&&(f=1,u+=1)):s=30)),(u-t.year)*360+(f-t.month)*30+s-a}l("DAYS360",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e===void 0?!1:X(e);return t instanceof c?t:o instanceof c?o:a instanceof c?a:_(t,o,a)});export function yearFrac(r,n,e){const[t,o]=r<=n?[r,n]:[n,r],a=h(t),s=h(o),f=o-t;switch(e){case 0:{let u=a.day,y=s.day;return V(a)&&(V(s)&&(y=30),u=30),y===31&&u>=30&&(y=30),u===31&&(u=30),((s.year-a.year)*360+(s.month-a.month)*30+y-u)/360}case 2:return f/360;case 3:return f/365;case 4:return _(t,o,!0)/360;default:{if(a.year===s.year||s.year===a.year+1&&(a.month>s.month||a.month===s.month&&a.day>=s.day)){let M;if(a.year===s.year)M=b(a.year);else{const E=w=>b(w)?U(w,2,29):1/0;M=E(a.year)>=t&&E(a.year)<=o||E(s.year)>=t&&E(s.year)<=o}return f/(M?366:365)}const y=s.year-a.year+1,N=U(s.year+1,1,1)-U(a.year,1,1);return f/(N/y)}}}l("YEARFRAC",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e==null?0:m(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;const s=Math.trunc(a);return s<0||s>4?i.NUM:yearFrac(t,o,s)});function k(r){const n=(...t)=>[0,1,2,3,4,5,6].map(o=>t.includes(o));if(r==null)return n(0,6);if(typeof r=="string"){if(!/^[01]{7}$/u.test(r)||r==="1111111")return i.VALUE;const t=r.split("").map(o=>o==="1");return[t[6]??!1,...t.slice(0,6)]}const e=m(r);return e instanceof c?e:e>=1&&e<=7?n((e+5)%7,(e+6)%7):e>=11&&e<=17?n(e-11):i.NUM}function K(r,n){if(r===void 0||r instanceof O)return new Set;const e=Y([r],n);return e instanceof c?e:new Set(e.map(t=>Math.floor(t)))}function P(r,n,e,t){const o=r<=n?1:-1;let a=0;for(let s=r;o>0?s<=n:s>=n;s+=o)e[D(s)]!==!0&&!t.has(s)&&(a+=o);return a}function $(r,n,e,t){if(e.every(Boolean))return i.VALUE;const o=n<0?-1:1;let a=r;for(let s=Math.abs(n);s>0;)a+=o,e[D(a)]!==!0&&!t.has(a)&&(s-=1);return a<0?i.NUM:a}const x=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=d(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=k(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=K(n[r?3:2],e);return f instanceof c?f:P(t,o,s,f)},F=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=m(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=k(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=K(n[r?3:2],e);return f instanceof c?f:$(t,Math.trunc(o),s,f)};p("NETWORKDAYS","vv?r",x(!1)),p("NETWORKDAYS.INTL","vv?vr",x(!0)),p("WORKDAY","vv?r",F(!1)),p("WORKDAY.INTL","vv?vr",F(!0)),p("NOW","",(r,n)=>n.calc.nowSerial(),{volatile:!0}),p("TODAY","",(r,n)=>Math.floor(n.calc.nowSerial()),{volatile:!0});function g(r,n,e){const t=e[0]??0;let o=0;return n.forEach((a,s)=>{o+=a/(1+r)**(((e[s]??t)-t)/365)}),o}const C=(r,n)=>{const e=Y([r[0]],n);if(e instanceof c)return e;const t=Y([r[1]],n);return t instanceof c?t:e.length!==t.length||e.length===0?i.NUM:{values:e,dates:t.map(Math.floor)}};p("XNPV","vrr",(r,n)=>{const e=m(n.calc.scalar(r[0],n.frame));if(e instanceof c)return e;const t=C(r.slice(1),n);return t instanceof c?t:e<=0?i.NUM:g(e,t.values,t.dates)}),p("XIRR","rr?v",(r,n)=>{const e=C(r,n);if(e instanceof c)return e;const{values:t,dates:o}=e;if(!t.some(u=>u>0)||!t.some(u=>u<0))return i.NUM;const a=r[2]===void 0||r[2]instanceof O?.1:m(n.calc.scalar(r[2],n.frame));if(a instanceof c)return a;const s=o[0]??0;let f=a;for(let u=0;u<100;u++){let y=0,N=0;t.forEach((E,w)=>{const v=((o[w]??s)-s)/365;y+=E/(1+f)**v,N-=v*E/(1+f)**(v+1)});const M=f-y/N;if(!Number.isFinite(M))return i.NUM;if(Math.abs(M-f)<1e-10)return M;f=M<=-1?(f-1)/2:M}return i.NUM});
@@ -15,6 +15,15 @@ interface Base {
15
15
  /** Where it comes from: this repository, or @formulajs/formulajs. */
16
16
  from: "allyhub" | "formulajs";
17
17
  }
18
+ /** How a parameter is taken: a single value, lifted over an array given to it, or the value whole. */
19
+ export type ParamKind = "value" | "whole";
20
+ /** A raw function's parameters, read from its signature (`params`). */
21
+ export interface Params {
22
+ /** The parameters in order, before any that repeat. */
23
+ readonly fixed: readonly ParamKind[];
24
+ /** Parameters that repeat after the fixed ones, as SUMIFS's range and criterion. */
25
+ readonly group: readonly ParamKind[];
26
+ }
18
27
  export type FunctionDef = Base & ({
19
28
  kind: "scalar";
20
29
  call: (...args: (Scalar | undefined)[]) => Scalar;
@@ -22,6 +31,8 @@ export type FunctionDef = Base & ({
22
31
  errors?: boolean;
23
32
  } | {
24
33
  kind: "raw";
34
+ params: Params;
35
+ /** A parameter taken as a single value arrives as a Scalar, or Missing when left empty. */
25
36
  call: (args: readonly Value[], c: Call) => Value;
26
37
  } | {
27
38
  kind: "lazy";
@@ -30,12 +41,27 @@ export type FunctionDef = Base & ({
30
41
  export declare const FUNCTIONS: Map<string, FunctionDef>;
31
42
  /** A function that takes any number of arguments from `min`. */
32
43
  export declare const many = 255;
44
+ /**
45
+ * A signature, a letter per parameter: `v` a single value, `r` the value
46
+ * whole. A `?` marks where the optional ones start; a group in parentheses
47
+ * at the end repeats, once at least unless a `?` comes before it. SUMIFS is
48
+ * `r(rv)`, VLOOKUP `vrv?v`, CONCAT `(r)`, NOW ``.
49
+ */
50
+ export declare function signature(text: string): Params & {
51
+ min: number;
52
+ max: number;
53
+ };
54
+ /** How the parameter at `i` is taken. */
55
+ export declare function paramAt(p: Params, i: number): ParamKind;
56
+ /** Whether `count` arguments fill a repeating group whole, as Excel asks. */
57
+ export declare function fillsGroup(p: Params, count: number): boolean;
33
58
  export declare function scalar(name: string, min: number, max: number, call: (...args: (Scalar | undefined)[]) => Scalar, o?: {
34
59
  errors?: boolean;
35
60
  volatile?: boolean;
36
61
  from?: Base["from"];
37
62
  }): void;
38
- export declare function raw(name: string, min: number, max: number, call: (args: readonly Value[], c: Call) => Value, o?: {
63
+ /** A function that takes some arguments whole, by its signature (`signature`). */
64
+ export declare function raw(name: string, params: string, call: (args: readonly Value[], c: Call) => Value, o?: {
39
65
  volatile?: boolean;
40
66
  from?: Base["from"];
41
67
  }): void;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as a,ERR as c,Matrix as u}from"../../values.js";import{toBool as h,toNumber as l,toText as b}from"../coerce.js";import{Lambda as i,Missing as p,Reference as m,Union as x}from"../types.js";export const FUNCTIONS=new Map;const d=255;export const many=d;export function scalar(e,r,o,n,t={}){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"scalar",call:n,from:t.from??"allyhub",...t.errors===!0?{errors:!0}:{},...t.volatile===!0?{volatile:!0}:{}})}export function raw(e,r,o,n,t={}){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"raw",call:n,from:t.from??"allyhub",...t.volatile===!0?{volatile:!0}:{}})}export function lazy(e,r,o,n){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"lazy",call:n,from:"allyhub"})}export function alias(e,r){const o=FUNCTIONS.get(r);o&&FUNCTIONS.set(e,{...o,name:e})}export function cellsOf(e,r){if(e instanceof a)return e;if(e instanceof x)return c.VALUE;if(e instanceof m){const n=Math.min(e.bottom,e.sheet.lastRow);return{rows:Math.max(0,n-e.top+1),cols:e.cols,at:(t,f)=>r.calc.read(e.sheet,e.top+t,e.left+f),reference:e}}if(e instanceof u)return{rows:e.rows,cols:e.cols,at:(n,t)=>e.at(n,t)};if(e instanceof i)return c.VALUE;const o=e instanceof p?null:e;return{rows:1,cols:1,at:()=>o}}export function eachArg(e,r,o){for(const n of e)if(n instanceof m)r.calc.each(n,t=>{o(t,!1)});else if(n instanceof x)for(const t of n.parts)r.calc.each(t,f=>{o(f,!1)});else if(n instanceof u)for(const t of n.data)t!==null&&o(t,!1);else n instanceof p?o(null,!0):n instanceof i?o(c.VALUE,!0):o(n,!0)}export function eachRow(e,r,o){const n=t=>{for(const f of r.calc.matrix(t).data)o(f,!1)};for(const t of e)if(t instanceof m)n(t);else if(t instanceof x)t.parts.forEach(n);else if(t instanceof u)for(const f of t.data)o(f,!1);else t instanceof p?o(null,!0):t instanceof i?o(c.VALUE,!0):o(t,!0)}export function numbersOf(e,r){const o=[];let n;return eachArg(e,r,(t,f)=>{if(!n){if(t instanceof a)n=t;else if(typeof t=="number")o.push(t);else if(f){const s=l(t);s instanceof a?n=s:o.push(s)}}}),n??o}export function numbersOfA(e,r){const o=[];let n;return eachArg(e,r,(t,f)=>{if(!n)if(t instanceof a)n=t;else if(typeof t=="number")o.push(t);else if(typeof t=="boolean")o.push(t?1:0);else if(f){const s=l(t);s instanceof a?n=s:o.push(s)}else typeof t=="string"&&o.push(0)}),n??o}export const number=e=>(...r)=>{const o=[];for(const n of r){const t=l(n);if(t instanceof a)return t;o.push(t)}return e(...o)};export function textArg(e){return b(e)}export function boolArg(e,r){return e==null?r:h(e)}export function numberArg(e,r){return e===void 0?r:l(e)}
2
+ import{CellError as l,ERR as a,Matrix as i}from"../../values.js";import{toBool as w,toNumber as c,toText as A}from"../coerce.js";import{Lambda as h,Missing as p,Reference as g,Union as x}from"../types.js";export const FUNCTIONS=new Map;const d=255;export const many=d;export function signature(e){const r=/^([vr?]*)(?:\(([vr]+)\))?$/u.exec(e),t=r?.[1];if(t===void 0||(t.match(/\?/gu)??[]).length>1)throw new Error(`"${e}" is not a signature.`);const o=m=>Array.from({length:m.length},(y,b)=>m.charAt(b)==="v"?"value":"whole"),n=o(t.replace("?","")),f=o(r?.[2]??""),s=t.indexOf("?"),u=s>=0?s:n.length+f.length;return{fixed:n,group:f,min:u,max:f.length>0?d:n.length}}export function paramAt(e,r){return r<e.fixed.length?e.fixed[r]??"whole":e.group.length===0?"whole":e.group[(r-e.fixed.length)%e.group.length]??"whole"}export function fillsGroup(e,r){return e.group.length===0||r<=e.fixed.length?!0:(r-e.fixed.length)%e.group.length===0}export function scalar(e,r,t,o,n={}){FUNCTIONS.set(e,{name:e,min:r,max:t,kind:"scalar",call:o,from:n.from??"allyhub",...n.errors===!0?{errors:!0}:{},...n.volatile===!0?{volatile:!0}:{}})}export function raw(e,r,t,o={}){const{min:n,max:f,fixed:s,group:u}=signature(r);FUNCTIONS.set(e,{name:e,min:n,max:f,kind:"raw",params:{fixed:s,group:u},call:t,from:o.from??"allyhub",...o.volatile===!0?{volatile:!0}:{}})}export function lazy(e,r,t,o){FUNCTIONS.set(e,{name:e,min:r,max:t,kind:"lazy",call:o,from:"allyhub"})}export function alias(e,r){const t=FUNCTIONS.get(r);t&&FUNCTIONS.set(e,{...t,name:e})}export function cellsOf(e,r){if(e instanceof l)return e;if(e instanceof x)return a.VALUE;if(e instanceof g){const o=Math.min(e.bottom,e.sheet.lastRow);return{rows:Math.max(0,o-e.top+1),cols:e.cols,at:(n,f)=>r.calc.read(e.sheet,e.top+n,e.left+f),reference:e}}if(e instanceof i)return{rows:e.rows,cols:e.cols,at:(o,n)=>e.at(o,n)};if(e instanceof h)return a.VALUE;const t=e instanceof p?null:e;return{rows:1,cols:1,at:()=>t}}export function eachArg(e,r,t){for(const o of e)if(o instanceof g)r.calc.each(o,n=>{t(n,!1)});else if(o instanceof x)for(const n of o.parts)r.calc.each(n,f=>{t(f,!1)});else if(o instanceof i)for(const n of o.data)n!==null&&t(n,!1);else o instanceof p?t(null,!0):o instanceof h?t(a.VALUE,!0):t(o,!0)}export function eachRow(e,r,t){const o=n=>{for(const f of r.calc.matrix(n).data)t(f,!1)};for(const n of e)if(n instanceof g)o(n);else if(n instanceof x)n.parts.forEach(o);else if(n instanceof i)for(const f of n.data)t(f,!1);else n instanceof p?t(null,!0):n instanceof h?t(a.VALUE,!0):t(n,!0)}export function numbersOf(e,r){const t=[];let o;return eachArg(e,r,(n,f)=>{if(!o){if(n instanceof l)o=n;else if(typeof n=="number")t.push(n);else if(f){const s=c(n);s instanceof l?o=s:t.push(s)}}}),o??t}export function numbersOfA(e,r){const t=[];let o;return eachArg(e,r,(n,f)=>{if(!o)if(n instanceof l)o=n;else if(typeof n=="number")t.push(n);else if(typeof n=="boolean")t.push(n?1:0);else if(f){const s=c(n);s instanceof l?o=s:t.push(s)}else typeof n=="string"&&t.push(0)}),o??t}export const number=e=>(...r)=>{const t=[];for(const o of r){const n=c(o);if(n instanceof l)return n;t.push(n)}return e(...t)};export function textArg(e){return A(e)}export function boolArg(e,r){return e==null?r:w(e)}export function numberArg(e,r){return e===void 0?r:c(e)}
@@ -0,0 +1,16 @@
1
+ import { CellError } from "../../values.js";
2
+ import { type Value } from "../types.js";
3
+ import { type Call } from "./define.js";
4
+ /** Case changed a letter at a time, so a place in the result is the same place in the text: ß stays ß, where toUpperCase makes SS. */
5
+ export declare const eachLetter: (s: string, change: (c: string) => string) => string;
6
+ export declare const lowerLetters: (s: string) => string;
7
+ /** The delimiters given: a text, or every text of a range or an array, row by row; empty cells are none. */
8
+ export declare function delimiters(v: Value | undefined, c: Call): string[] | CellError;
9
+ /** Where any of the delimiters occurs in the text, left to right without overlapping; at one place the longest. */
10
+ export declare function occurrences(text: string, by: readonly string[], ignoreCase: boolean): {
11
+ at: number;
12
+ length: number;
13
+ }[];
14
+ /** Text apart at any of the delimiters. */
15
+ export declare function splitAt(text: string, by: readonly string[], ignoreCase: boolean): string[];
16
+ //# sourceMappingURL=delimiters.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{CellError as c}from"../../values.js";import{toText as u}from"../coerce.js";import{Missing as h}from"../types.js";import{cellsOf as p}from"./define.js";export const eachLetter=(t,s)=>Array.from(t,e=>{const n=s(e);return n.length===e.length?n:e}).join(""),lowerLetters=t=>eachLetter(t,s=>s.toLowerCase());export function delimiters(t,s){if(t===void 0||t instanceof h)return[];const e=p(t,s);if(e instanceof c)return e;const n=[];for(let i=0;i<e.rows;i++)for(let o=0;o<e.cols;o++){const l=e.at(i,o);if(l===null)continue;const r=u(l);if(r instanceof c)return r;n.push(r)}return n}export function occurrences(t,s,e){const n=e?lowerLetters(t):t,i=(e?s.map(lowerLetters):[...s]).filter(r=>r!=="").sort((r,f)=>f.length-r.length),o=[];if(i.length===0)return o;let l=0;for(;l<t.length;){const r=i.find(f=>n.startsWith(f,l));r===void 0?l+=1:(o.push({at:l,length:r.length}),l+=r.length)}return o}export function splitAt(t,s,e){const n=[];let i=0;for(const o of occurrences(t,s,e))n.push(t.slice(i,o.at)),i=o.at+o.length;return n.push(t.slice(i)),n}
@@ -1,2 +1,19 @@
1
- export {};
1
+ import { CellError, Matrix, type Scalar } from "../../values.js";
2
+ import { type Value } from "../types.js";
3
+ import { type Call, type Cells } from "./define.js";
4
+ export declare const rowsOfCells: (m: Cells) => Scalar[][];
5
+ export declare const matrixOf: (rows: readonly (readonly Scalar[])[]) => Matrix;
6
+ export declare const transposed: (rows: readonly (readonly Scalar[])[]) => Scalar[][];
7
+ export declare function numberOf(v: Value | undefined, c: Call, otherwise: number): number | CellError;
8
+ export declare function boolOf(v: Value | undefined, c: Call, otherwise: boolean): boolean | CellError;
9
+ /** A list of whole numbers: one, or a row or a column of them. */
10
+ export declare function indexes(v: Value | undefined, c: Call, otherwise: number): number[] | CellError;
11
+ /** Two lines in Excel's order: blanks last either way. */
12
+ export declare function compareBy(a: Scalar, b: Scalar, descending: boolean): number;
13
+ /** Whether a value keeps its row or column in FILTER. */
14
+ export declare function included(v: Scalar): boolean | CellError;
15
+ /** A value as a key: Excel's UNIQUE takes letters whatever their case. */
16
+ export declare const keyOf: (v: Scalar) => string;
17
+ /** What a LAMBDA gave for one cell: a single value. */
18
+ export declare const oneOf: (v: Value, c: Call) => Scalar;
2
19
  //# sourceMappingURL=dynamic.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{MAX_COLUMNS as Q,MAX_ROWS as j}from"../../address.js";import{compareForSort as q}from"../../sort.js";import{CellError as u,ERR as a,Matrix as E}from"../../values.js";import{toBool as G,toNumber as k,toText as z}from"../coerce.js";import{Lambda as x,Missing as N}from"../types.js";import{cellsOf as m,many as M,raw as w}from"./define.js";const J=5e6,C=n=>Array.from({length:n.rows},(o,e)=>Array.from({length:n.cols},(t,r)=>n.at(e,r))),U=n=>{const o=n[0]?.length??0;return new E(n.length,o,n.flat())},L=n=>{const o=n[0]?.length??0;return Array.from({length:o},(e,t)=>n.map(r=>r[t]??null))};function O(n,o){if(!(n===void 0||n instanceof N))return o.calc.scalar(n,o.frame)}function A(n,o,e){const t=O(n,o);return t==null?e:k(t)}function S(n,o,e){const t=O(n,o);return t==null?e:G(t)}function g(n,o,e){if(n===void 0||n instanceof N)return[e];const t=m(n,o);if(t instanceof u)return t;const r=[];for(let s=0;s<t.rows;s++)for(let f=0;f<t.cols;f++){const i=k(t.at(s,f));if(i instanceof u)return i;r.push(Math.trunc(i))}return r}const T=n=>n===null||n==="";function W(n,o,e){if(T(n)||T(o))return T(n)&&T(o)?0:T(n)?1:-1;const t=q(n,o);return e?-t:t}function Z(n){return n instanceof u?n:n===null?!1:typeof n=="boolean"?n:typeof n=="number"?n!==0:a.VALUE}w("FILTER",2,3,(n,o)=>{const e=m(n[0],o),t=m(n[1],o);if(e instanceof u)return e;if(t instanceof u)return t;if(t.rows>1&&t.cols>1)return a.VALUE;const r=t.cols===1&&t.rows===e.rows?!0:t.rows===1&&t.cols===e.cols?!1:void 0;if(r===void 0)return a.VALUE;const s=C(e),f=r?s:L(s),i=[];for(let c=0;c<f.length;c++){const l=Z(r?t.at(c,0):t.at(0,c));if(l instanceof u)return l;l&&i.push(f[c]??[])}return i.length===0?n[2]===void 0||n[2]instanceof N?a.CALC:n[2]:U(r?i:L(i))}),w("SORT",1,4,(n,o)=>{const e=m(n[0],o);if(e instanceof u)return e;const t=g(n[1],o,1);if(t instanceof u)return t;const r=g(n[2],o,1);if(r instanceof u)return r;const s=S(n[3],o,!1);if(s instanceof u)return s;const f=C(e),i=s?L(f):f,c=i[0]?.length??0;if(r.length!==1&&r.length!==t.length)return a.VALUE;if(t.some(h=>h<1||h>c))return a.VALUE;if(r.some(h=>h!==1&&h!==-1))return a.VALUE;const l=i.map((h,d)=>({line:h,index:d})).sort((h,d)=>{for(const[y,p]of t.entries()){const R=r[r.length===1?0:y]??1,V=W(h.line[p-1]??null,d.line[p-1]??null,R<0);if(V!==0)return V}return h.index-d.index}).map(h=>h.line);return U(s?L(l):l)}),w("SORTBY",2,M,(n,o)=>{const e=m(n[0],o);if(e instanceof u)return e;const t=[];let r;for(let c=1;c<n.length;c+=2){const l=m(n[c],o);if(l instanceof u)return l;if(l.rows>1&&l.cols>1)return a.VALUE;const h=l.cols===1&&l.rows===e.rows,d=l.rows===1&&l.cols===e.cols;if(!h&&!d)return a.VALUE;const y=r??h;if(y?!h:!d)return a.VALUE;r=y;const p=A(n[c+1],o,1);if(p instanceof u)return p;if(p!==1&&p!==-1)return a.VALUE;t.push({values:C(l).flat(),descending:p<0})}const s=C(e),i=(r===!1?L(s):s).map((c,l)=>({line:c,index:l})).sort((c,l)=>{for(const{values:h,descending:d}of t){const y=W(h[c.index]??null,h[l.index]??null,d);if(y!==0)return y}return c.index-l.index}).map(c=>c.line);return U(r===!1?L(i):i)});const v=n=>n instanceof u?`e${n.code}`:typeof n=="string"?`s${n.toLowerCase()}`:`${typeof n}${String(n)}`;w("UNIQUE",1,3,(n,o)=>{const e=m(n[0],o);if(e instanceof u)return e;const t=S(n[1],o,!1);if(t instanceof u)return t;const r=S(n[2],o,!1);if(r instanceof u)return r;const s=C(e),f=t?L(s):s,i=new Map;for(const l of f){const h=l.map(v).join("\0"),d=i.get(h);d?d.count+=1:i.set(h,{line:l,count:1})}const c=[...i.values()].filter(l=>!r||l.count===1).map(l=>l.line);return c.length===0?a.CALC:U(t?L(c):c)});function _(n,o){if(n instanceof u)return n;if(o instanceof u)return o;const e=Math.trunc(n),t=Math.trunc(o);return e<0||t<0?a.VALUE:e===0||t===0?a.CALC:e>j||t>Q||e*t>J?a.VALUE:{rows:e,cols:t}}w("SEQUENCE",1,4,(n,o)=>{const e=_(A(n[0],o,1),A(n[1],o,1));if(e instanceof u)return e;const t=A(n[2],o,1);if(t instanceof u)return t;const r=A(n[3],o,1);if(r instanceof u)return r;const s=new Array(e.rows*e.cols);for(let f=0;f<s.length;f++)s[f]=t+f*r;return new E(e.rows,e.cols,s)}),w("RANDARRAY",0,5,(n,o)=>{const e=_(A(n[0],o,1),A(n[1],o,1));if(e instanceof u)return e;const t=A(n[2],o,0);if(t instanceof u)return t;const r=A(n[3],o,1);if(r instanceof u)return r;const s=S(n[4],o,!1);if(s instanceof u)return s;if(t>r)return a.VALUE;if(s&&(!Number.isInteger(t)||!Number.isInteger(r)))return a.VALUE;const f=new Array(e.rows*e.cols);for(let i=0;i<f.length;i++){const c=o.calc.random();f[i]=s?t+Math.floor(c*(r-t+1)):t+c*(r-t)}return new E(e.rows,e.cols,f)},{volatile:!0});function P(n,o){if(n===void 0||n instanceof N)return[];const e=m(n,o);if(e instanceof u)return e;const t=[];for(const r of C(e).flat()){if(r===null)continue;const s=z(r);if(s instanceof u)return s;t.push(s)}return t}function B(n,o,e){const t=e?n.toLowerCase():n,r=(e?o.map(c=>c.toLowerCase()):[...o]).sort((c,l)=>l.length-c.length),s=[];let f=0,i=0;for(;i<n.length;){const c=r.find(l=>l!==""&&t.startsWith(l,i));c===void 0?i+=1:(s.push(n.slice(f,i)),i+=c.length,f=i)}return s.push(n.slice(f)),s}w("TEXTSPLIT",2,6,(n,o)=>{const e=O(n[0],o);if(e instanceof u)return e;const t=z(e??"");if(t instanceof u)return t;const r=P(n[1],o);if(r instanceof u)return r;const s=P(n[2],o);if(s instanceof u)return s;if(r.length===0&&s.length===0)return a.VALUE;if(r.includes("")||s.includes(""))return a.VALUE;const f=S(n[3],o,!1);if(f instanceof u)return f;const i=A(n[4],o,0);if(i instanceof u)return i;const c=O(n[5],o)??a.NA,l=i===1,d=(s.length===0?[t]:B(t,s,l)).filter(p=>!(f&&p==="")).map(p=>{const R=r.length===0?[p]:B(p,r,l);return f?R.filter(V=>V!==""):R}),y=Math.max(0,...d.map(p=>p.length));return d.length===0||y===0?a.CALC:U(d.map(p=>Array.from({length:y},(R,V)=>p[V]??c)))});const b=(n,o)=>{const e=o.calc.flat(n);return e instanceof E?e.at(0,0):e};w("MAP",2,M,(n,o)=>{const e=n[n.length-1];if(!(e instanceof x))return a.VALUE;const t=[];for(const c of n.slice(0,-1)){const l=m(c,o);if(l instanceof u)return l;t.push(l)}const r=t[0];if(!r)return a.VALUE;const{rows:s,cols:f}=r;if(t.some(c=>c.rows!==s||c.cols!==f))return a.VALUE;const i=new Array(s*f);for(let c=0;c<s;c++)for(let l=0;l<f;l++)i[c*f+l]=b(o.calc.apply(e,t.map(h=>h.at(c,l))),o);return new E(s,f,i)});function I(n,o){const e=n.length===3,t=n[n.length-1];if(!(t instanceof x))return a.VALUE;const r=m(n[e?1:0],o);return r instanceof u?r:{start:e?O(n[0],o)??null:r.at(0,0),cells:r,fn:t}}w("REDUCE",2,3,(n,o)=>{const e=I(n,o);if(e instanceof u)return e;const{cells:t,fn:r}=e,s=n.length===3?0:1;let f=e.start;for(let i=s;i<t.rows*t.cols;i++)f=b(o.calc.apply(r,[f,t.at(Math.floor(i/t.cols),i%t.cols)]),o);return f}),w("SCAN",2,3,(n,o)=>{const e=I(n,o);if(e instanceof u)return e;const{cells:t,fn:r}=e,s=t.rows*t.cols,f=n.length===3?0:1,i=new Array(s);let c=e.start;f===1&&(i[0]=c);for(let l=f;l<s;l++)c=b(o.calc.apply(r,[c,t.at(Math.floor(l/t.cols),l%t.cols)]),o),i[l]=c;return new E(t.rows,t.cols,i)});const Y=n=>(o,e)=>{const t=m(o[0],e);if(t instanceof u)return t;const r=o[1];if(!(r instanceof x))return a.VALUE;const s=C(t),i=(n?s:L(s)).map(c=>b(e.calc.apply(r,[n?new E(1,c.length,c):new E(c.length,1,c)]),e));return n?new E(i.length,1,i):new E(1,i.length,i)};w("BYROW",2,2,Y(!0)),w("BYCOL",2,2,Y(!1)),w("MAKEARRAY",3,3,(n,o)=>{const e=_(A(n[0],o,1),A(n[1],o,1));if(e instanceof u)return e;const t=n[2];if(!(t instanceof x))return a.VALUE;const r=new Array(e.rows*e.cols);for(let s=0;s<e.rows;s++)for(let f=0;f<e.cols;f++)r[s*e.cols+f]=b(o.calc.apply(t,[s+1,f+1]),o);return new E(e.rows,e.cols,r)});function D(n){return(o,e)=>{const t=[];for(const f of o){const i=m(f,e);if(i instanceof u)return i;const c=C(i);t.push(n?c:L(c))}const r=Math.max(0,...t.map(f=>f[0]?.length??0)),s=t.flatMap(f=>f.map(i=>Array.from({length:r},(c,l)=>l<i.length?i[l]??null:a.NA)));return s.length===0?a.CALC:U(n?s:L(s))}}w("VSTACK",1,M,D(!0)),w("HSTACK",1,M,D(!1));function K(n,o,e){const t=Math.min(n,Math.abs(o));return e?o>=0?[0,t]:[n-t,n]:o>=0?[t,n]:[0,n-t]}function X(n){return(o,e)=>{const t=m(o[0],e);if(t instanceof u)return t;const r=d=>d===void 0||d instanceof N,s=A(o[1],e,n?t.rows:0);if(s instanceof u)return s;const f=A(o[2],e,n?t.cols:0);if(f instanceof u)return f;if(n&&!r(o[1])&&Math.trunc(s)===0)return a.CALC;if(n&&!r(o[2])&&Math.trunc(f)===0)return a.CALC;const[i,c]=K(t.rows,Math.trunc(s),n),[l,h]=K(t.cols,Math.trunc(f),n);return c<=i||h<=l?a.CALC:U(C(t).slice(i,c).map(d=>d.slice(l,h)))}}w("TAKE",2,3,X(!0)),w("DROP",2,3,X(!1));function $(n){return(o,e)=>{const t=m(o[0],e);if(t instanceof u)return t;const r=A(o[1],e,0);if(r instanceof u)return r;const s=S(o[2],e,!1);if(s instanceof u)return s;if(![0,1,2,3].includes(r))return a.VALUE;const f=C(t),c=(s?L(f):f).flat().filter(l=>!((r===1||r===3)&&l===null||(r===2||r===3)&&l instanceof u));return c.length===0?a.CALC:n?new E(c.length,1,c):new E(1,c.length,c)}}w("TOCOL",1,3,$(!0)),w("TOROW",1,3,$(!1));function H(n){return(o,e)=>{const t=m(o[0],e);if(t instanceof u)return t;const r=C(t),s=n?r:L(r),f=[];for(const i of o.slice(1)){const c=g(i,e,1);if(c instanceof u)return c;for(const l of c){const h=s[l>0?l-1:s.length+l];if(l===0||!h)return a.VALUE;f.push(h)}}return U(n?f:L(f))}}w("CHOOSEROWS",2,M,H(!0)),w("CHOOSECOLS",2,M,H(!1)),w("EXPAND",2,4,(n,o)=>{const e=m(n[0],o);if(e instanceof u)return e;const t=_(A(n[1],o,e.rows),A(n[2],o,e.cols));if(t instanceof u)return t;if(t.rows<e.rows||t.cols<e.cols)return a.VALUE;const r=O(n[3],o)??a.NA,s=new Array(t.rows*t.cols);for(let f=0;f<t.rows;f++)for(let i=0;i<t.cols;i++)s[f*t.cols+i]=f<e.rows&&i<e.cols?e.at(f,i):r;return new E(t.rows,t.cols,s)});function F(n){return(o,e)=>{const t=m(o[0],e);if(t instanceof u)return t;if(t.rows>1&&t.cols>1)return a.VALUE;const r=A(o[1],e,1);if(r instanceof u)return r;const s=Math.trunc(r);if(s<1)return a.NUM;const f=O(o[2],e)??a.NA,i=C(t).flat(),c=[];for(let l=0;l<i.length;l+=s)c.push(Array.from({length:s},(h,d)=>l+d<i.length?i[l+d]??null:f));return U(n?c:L(c))}}w("WRAPROWS",2,3,F(!0)),w("WRAPCOLS",2,3,F(!1));
2
+ import{MAX_COLUMNS as P,MAX_ROWS as B}from"../../address.js";import{compareForSort as I}from"../../sort.js";import{CellError as u,ERR as a,Matrix as m}from"../../values.js";import{toBool as Y,toNumber as x,toText as D}from"../coerce.js";import{Lambda as O,Missing as V}from"../types.js";import{cellsOf as w,raw as p}from"./define.js";import{delimiters as S,splitAt as R}from"./delimiters.js";const K=5e6;export const rowsOfCells=n=>Array.from({length:n.rows},(e,r)=>Array.from({length:n.cols},(t,o)=>n.at(r,o))),matrixOf=n=>{const e=n[0]?.length??0;return new m(n.length,e,n.flat())},transposed=n=>{const e=n[0]?.length??0;return Array.from({length:e},(r,t)=>n.map(o=>o[t]??null))};function E(n,e){if(!(n===void 0||n instanceof V))return e.calc.scalar(n,e.frame)}export function numberOf(n,e,r){const t=E(n,e);return t==null?r:x(t)}export function boolOf(n,e,r){const t=E(n,e);return t==null?r:Y(t)}export function indexes(n,e,r){if(n===void 0||n instanceof V)return[r];const t=w(n,e);if(t instanceof u)return t;const o=[];for(let s=0;s<t.rows;s++)for(let c=0;c<t.cols;c++){const i=x(t.at(s,c));if(i instanceof u)return i;o.push(Math.trunc(i))}return o}const U=n=>n===null||n==="";export function compareBy(n,e,r){if(U(n)||U(e))return U(n)&&U(e)?0:U(n)?1:-1;const t=I(n,e);return r?-t:t}export function included(n){return n instanceof u?n:n===null?!1:typeof n=="boolean"?n:typeof n=="number"?n!==0:a.VALUE}p("FILTER","rr?r",(n,e)=>{const r=w(n[0],e),t=w(n[1],e);if(r instanceof u)return r;if(t instanceof u)return t;if(t.rows>1&&t.cols>1)return a.VALUE;const o=t.cols===1&&t.rows===r.rows?!0:t.rows===1&&t.cols===r.cols?!1:void 0;if(o===void 0)return a.VALUE;const s=rowsOfCells(r),c=o?s:transposed(s),i=[];for(let f=0;f<c.length;f++){const l=included(o?t.at(f,0):t.at(0,f));if(l instanceof u)return l;l&&i.push(c[f]??[])}return i.length===0?n[2]===void 0||n[2]instanceof V?a.CALC:n[2]:matrixOf(o?i:transposed(i))}),p("SORT","r?rrr",(n,e)=>{const r=w(n[0],e);if(r instanceof u)return r;const t=indexes(n[1],e,1);if(t instanceof u)return t;const o=indexes(n[2],e,1);if(o instanceof u)return o;const s=boolOf(n[3],e,!1);if(s instanceof u)return s;const c=rowsOfCells(r),i=s?transposed(c):c,f=i[0]?.length??0;if(o.length!==1&&o.length!==t.length)return a.VALUE;if(t.some(h=>h<1||h>f))return a.VALUE;if(o.some(h=>h!==1&&h!==-1))return a.VALUE;const l=i.map((h,A)=>({line:h,index:A})).sort((h,A)=>{for(const[L,d]of t.entries()){const y=o[o.length===1?0:L]??1,C=compareBy(h.line[d-1]??null,A.line[d-1]??null,y<0);if(C!==0)return C}return h.index-A.index}).map(h=>h.line);return matrixOf(s?transposed(l):l)}),p("SORTBY","r(r)",(n,e)=>{const r=w(n[0],e);if(r instanceof u)return r;const t=[];let o;for(let f=1;f<n.length;f+=2){const l=w(n[f],e);if(l instanceof u)return l;if(l.rows>1&&l.cols>1)return a.VALUE;const h=l.cols===1&&l.rows===r.rows,A=l.rows===1&&l.cols===r.cols;if(!h&&!A)return a.VALUE;const L=o??h;if(L?!h:!A)return a.VALUE;o=L;const d=numberOf(n[f+1],e,1);if(d instanceof u)return d;if(d!==1&&d!==-1)return a.VALUE;t.push({values:rowsOfCells(l).flat(),descending:d<0})}const s=rowsOfCells(r),i=(o===!1?transposed(s):s).map((f,l)=>({line:f,index:l})).sort((f,l)=>{for(const{values:h,descending:A}of t){const L=compareBy(h[f.index]??null,h[l.index]??null,A);if(L!==0)return L}return f.index-l.index}).map(f=>f.line);return matrixOf(o===!1?transposed(i):i)});export const keyOf=n=>n instanceof u?`e${n.code}`:typeof n=="string"?`s${n.toLowerCase()}`:`${typeof n}${String(n)}`;p("UNIQUE","r?rr",(n,e)=>{const r=w(n[0],e);if(r instanceof u)return r;const t=boolOf(n[1],e,!1);if(t instanceof u)return t;const o=boolOf(n[2],e,!1);if(o instanceof u)return o;const s=rowsOfCells(r),c=t?transposed(s):s,i=new Map;for(const l of c){const h=l.map(keyOf).join("\0"),A=i.get(h);A?A.count+=1:i.set(h,{line:l,count:1})}const f=[...i.values()].filter(l=>!o||l.count===1).map(l=>l.line);return f.length===0?a.CALC:matrixOf(t?transposed(f):f)});function M(n,e){if(n instanceof u)return n;if(e instanceof u)return e;const r=Math.trunc(n),t=Math.trunc(e);return r<0||t<0?a.VALUE:r===0||t===0?a.CALC:r>B||t>P||r*t>K?a.VALUE:{rows:r,cols:t}}p("SEQUENCE","r?rrr",(n,e)=>{const r=M(numberOf(n[0],e,1),numberOf(n[1],e,1));if(r instanceof u)return r;const t=numberOf(n[2],e,1);if(t instanceof u)return t;const o=numberOf(n[3],e,1);if(o instanceof u)return o;const s=new Array(r.rows*r.cols);for(let c=0;c<s.length;c++)s[c]=t+c*o;return new m(r.rows,r.cols,s)}),p("RANDARRAY","?rrrrr",(n,e)=>{const r=M(numberOf(n[0],e,1),numberOf(n[1],e,1));if(r instanceof u)return r;const t=numberOf(n[2],e,0);if(t instanceof u)return t;const o=numberOf(n[3],e,1);if(o instanceof u)return o;const s=boolOf(n[4],e,!1);if(s instanceof u)return s;if(t>o)return a.VALUE;if(s&&(!Number.isInteger(t)||!Number.isInteger(o)))return a.VALUE;const c=new Array(r.rows*r.cols);for(let i=0;i<c.length;i++){const f=e.calc.random();c[i]=s?t+Math.floor(f*(o-t+1)):t+f*(o-t)}return new m(r.rows,r.cols,c)},{volatile:!0}),p("TEXTSPLIT","vr?rvvv",(n,e)=>{const r=E(n[0],e);if(r instanceof u)return r;const t=D(r??"");if(t instanceof u)return t;const o=S(n[1],e);if(o instanceof u)return o;const s=S(n[2],e);if(s instanceof u)return s;if(o.length===0&&s.length===0)return a.VALUE;if(o.includes("")||s.includes(""))return a.VALUE;const c=boolOf(n[3],e,!1);if(c instanceof u)return c;const i=numberOf(n[4],e,0);if(i instanceof u)return i;const f=E(n[5],e)??a.NA,l=i===1,A=(s.length===0?[t]:R(t,s,l)).filter(d=>!(c&&d==="")).map(d=>{const y=o.length===0?[d]:R(d,o,l);return c?y.filter(C=>C!==""):y}),L=Math.max(0,...A.map(d=>d.length));return A.length===0||L===0?a.CALC:matrixOf(A.map(d=>Array.from({length:L},(y,C)=>d[C]??f)))});export const oneOf=(n,e)=>{const r=e.calc.flat(n);return r instanceof m?r.at(0,0):r};p("MAP","r(r)",(n,e)=>{const r=n[n.length-1];if(!(r instanceof O))return a.VALUE;const t=[];for(const f of n.slice(0,-1)){const l=w(f,e);if(l instanceof u)return l;t.push(l)}const o=t[0];if(!o)return a.VALUE;const{rows:s,cols:c}=o;if(t.some(f=>f.rows!==s||f.cols!==c))return a.VALUE;const i=new Array(s*c);for(let f=0;f<s;f++)for(let l=0;l<c;l++)i[f*c+l]=oneOf(e.calc.apply(r,t.map(h=>h.at(f,l))),e);return new m(s,c,i)});function N(n,e){const r=n.length===3,t=n[n.length-1];if(!(t instanceof O))return a.VALUE;const o=w(n[r?1:0],e);return o instanceof u?o:{start:r?E(n[0],e)??null:o.at(0,0),cells:o,fn:t}}p("REDUCE","rr?r",(n,e)=>{const r=N(n,e);if(r instanceof u)return r;const{cells:t,fn:o}=r,s=n.length===3?0:1;let c=r.start;for(let i=s;i<t.rows*t.cols;i++)c=oneOf(e.calc.apply(o,[c,t.at(Math.floor(i/t.cols),i%t.cols)]),e);return c}),p("SCAN","rr?r",(n,e)=>{const r=N(n,e);if(r instanceof u)return r;const{cells:t,fn:o}=r,s=t.rows*t.cols,c=n.length===3?0:1,i=new Array(s);let f=r.start;c===1&&(i[0]=f);for(let l=c;l<s;l++)f=oneOf(e.calc.apply(o,[f,t.at(Math.floor(l/t.cols),l%t.cols)]),e),i[l]=f;return new m(t.rows,t.cols,i)});const T=n=>(e,r)=>{const t=w(e[0],r);if(t instanceof u)return t;const o=e[1];if(!(o instanceof O))return a.VALUE;const s=rowsOfCells(t),i=(n?s:transposed(s)).map(f=>oneOf(r.calc.apply(o,[n?new m(1,f.length,f):new m(f.length,1,f)]),r));return n?new m(i.length,1,i):new m(1,i.length,i)};p("BYROW","rr",T(!0)),p("BYCOL","rr",T(!1)),p("MAKEARRAY","rrr",(n,e)=>{const r=M(numberOf(n[0],e,1),numberOf(n[1],e,1));if(r instanceof u)return r;const t=n[2];if(!(t instanceof O))return a.VALUE;const o=new Array(r.rows*r.cols);for(let s=0;s<r.rows;s++)for(let c=0;c<r.cols;c++)o[s*r.cols+c]=oneOf(e.calc.apply(t,[s+1,c+1]),e);return new m(r.rows,r.cols,o)});function b(n){return(e,r)=>{const t=[];for(const c of e){const i=w(c,r);if(i instanceof u)return i;const f=rowsOfCells(i);t.push(n?f:transposed(f))}const o=Math.max(0,...t.map(c=>c[0]?.length??0)),s=t.flatMap(c=>c.map(i=>Array.from({length:o},(f,l)=>l<i.length?i[l]??null:a.NA)));return s.length===0?a.CALC:matrixOf(n?s:transposed(s))}}p("VSTACK","(r)",b(!0)),p("HSTACK","(r)",b(!1));function _(n,e,r){const t=Math.min(n,Math.abs(e));return r?e>=0?[0,t]:[n-t,n]:e>=0?[t,n]:[0,n-t]}function k(n){return(e,r)=>{const t=w(e[0],r);if(t instanceof u)return t;const o=A=>A===void 0||A instanceof V,s=numberOf(e[1],r,n?t.rows:0);if(s instanceof u)return s;const c=numberOf(e[2],r,n?t.cols:0);if(c instanceof u)return c;if(n&&!o(e[1])&&Math.trunc(s)===0)return a.CALC;if(n&&!o(e[2])&&Math.trunc(c)===0)return a.CALC;const[i,f]=_(t.rows,Math.trunc(s),n),[l,h]=_(t.cols,Math.trunc(c),n);return f<=i||h<=l?a.CALC:matrixOf(rowsOfCells(t).slice(i,f).map(A=>A.slice(l,h)))}}p("TAKE","rr?r",k(!0)),p("DROP","rr?r",k(!1));function z(n){return(e,r)=>{const t=w(e[0],r);if(t instanceof u)return t;const o=numberOf(e[1],r,0);if(o instanceof u)return o;const s=boolOf(e[2],r,!1);if(s instanceof u)return s;if(![0,1,2,3].includes(o))return a.VALUE;const c=rowsOfCells(t),f=(s?transposed(c):c).flat().filter(l=>!((o===1||o===3)&&l===null||(o===2||o===3)&&l instanceof u));return f.length===0?a.CALC:n?new m(f.length,1,f):new m(1,f.length,f)}}p("TOCOL","r?rr",z(!0)),p("TOROW","r?rr",z(!1));function g(n){return(e,r)=>{const t=w(e[0],r);if(t instanceof u)return t;const o=rowsOfCells(t),s=n?o:transposed(o),c=[];for(const i of e.slice(1)){const f=indexes(i,r,1);if(f instanceof u)return f;for(const l of f){const h=s[l>0?l-1:s.length+l];if(l===0||!h)return a.VALUE;c.push(h)}}return matrixOf(n?c:transposed(c))}}p("CHOOSEROWS","r(r)",g(!0)),p("CHOOSECOLS","r(r)",g(!1)),p("EXPAND","rr?rr",(n,e)=>{const r=w(n[0],e);if(r instanceof u)return r;const t=M(numberOf(n[1],e,r.rows),numberOf(n[2],e,r.cols));if(t instanceof u)return t;if(t.rows<r.rows||t.cols<r.cols)return a.VALUE;const o=E(n[3],e)??a.NA,s=new Array(t.rows*t.cols);for(let c=0;c<t.rows;c++)for(let i=0;i<t.cols;i++)s[c*t.cols+i]=c<r.rows&&i<r.cols?r.at(c,i):o;return new m(t.rows,t.cols,s)});function W(n){return(e,r)=>{const t=w(e[0],r);if(t instanceof u)return t;if(t.rows>1&&t.cols>1)return a.VALUE;const o=numberOf(e[1],r,1);if(o instanceof u)return o;const s=Math.trunc(o);if(s<1)return a.NUM;const c=E(e[2],r)??a.NA,i=rowsOfCells(t).flat(),f=[];for(let l=0;l<i.length;l+=s)f.push(Array.from({length:s},(h,A)=>l+A<i.length?i[l+A]??null:c));return matrixOf(n?f:transposed(f))}}p("WRAPROWS","rr?r",W(!0)),p("WRAPCOLS","rr?r",W(!1));
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as I,ERR as N,dateOf as g,serialOf as x}from"../../values.js";import{toBool as B,toNumber as H}from"../coerce.js";import{yearFrac as C}from"./date.js";import{number as J,scalar as O}from"./define.js";const F=(o,e)=>g(x(o,e+1,0)).day,T=(o,e,n)=>n===0||n===4?Math.round(C(o,e,n)*360):e-o;function A(o,e,n){const t=g(o),c=t.year*12+t.month-1+e,s=Math.floor(c/12),i=c-s*12+1,u=F(s,i);return x(s,i,n?u:Math.min(t.day,u))}const S=o=>{const e=g(o);return e.day===F(e.year,e.month)};function w(o,e,n,t){const c=12/n,s=S(e);let i=0,u=e;for(;u>o;)i+=1,u=A(e,-c*i,s);const a=A(e,-c*(i-1),s),l=t===1?a-u:t===3?365/n:360/n,f=T(u,o,t);return{previous:u,next:a,count:i,period:l,since:f,until:t===0||t===4?l-f:a-o}}function R(o,e){const n=[];for(const[t,c]of e.entries()){const s=o[t],i=s==null?c??0:H(s);if(i instanceof I)return i;n.push(i)}return n}const P=o=>Number.isInteger(o)&&o>=0&&o<=4,L=o=>o===1||o===2||o===4;function D(o,e,n,t){O(o,e,n.length,(...c)=>{const s=R(c,n);if(s instanceof I)return s;const[i=0,u=0,...a]=s,l=Math.trunc(i),f=Math.trunc(u),h=Math.trunc(a[a.length-1]??0);return l>=f||!P(h)?N.NUM:t(l,f,...a.slice(0,-1),h)})}const r=void 0;for(const[o,e]of[["COUPDAYBS",n=>n.since],["COUPDAYS",n=>n.period],["COUPDAYSNC",n=>n.until],["COUPNCD",n=>n.next],["COUPNUM",n=>n.count],["COUPPCD",n=>n.previous]])D(o,3,[r,r,r,0],(n,t,c=0,s=0)=>L(c)?e(w(n,t,c,s)):N.NUM);function Y(o,e,n,t,c,s,i){const u=w(o,e,s,i),a=100*n/s,l=u.until/u.period;if(u.count===1)return(c+a)/(1+l*t/s)-a*u.since/u.period;let f=c/(1+t/s)**(u.count-1+l);for(let h=1;h<=u.count;h++)f+=a/(1+t/s)**(h-1+l);return f-a*u.since/u.period}D("PRICE",6,[r,r,r,r,r,r,0],(o,e,n=0,t=0,c=0,s=0,i=0)=>n<0||t<0||c<=0||!L(s)?N.NUM:Y(o,e,n,t,c,s,i)),D("YIELD",6,[r,r,r,r,r,r,0],(o,e,n=0,t=0,c=0,s=0,i=0)=>{if(n<0||t<=0||c<=0||!L(s))return N.NUM;let u=-.99,a=1;for(;Y(o,e,n,a,c,s,i)>t&&a<1e6;)a*=2;for(let l=0;l<200;l++){const f=(u+a)/2;Y(o,e,n,f,c,s,i)>t?u=f:a=f}return(u+a)/2});function b(o,e,n,t,c,s){const i=w(o,e,c,s),u=i.until/i.period;let a=0,l=0;for(let f=1;f<=i.count;f++){const h=f-1+u,M=(100*n/c+(f===i.count?100:0))/(1+t/c)**h;a+=h*M,l+=M}return a/l/c}D("DURATION",5,[r,r,r,r,r,0],(o,e,n=0,t=0,c=0,s=0)=>n<0||t<0||!L(c)?N.NUM:b(o,e,n,t,c,s)),D("MDURATION",5,[r,r,r,r,r,0],(o,e,n=0,t=0,c=0,s=0)=>n<0||t<0||!L(c)?N.NUM:b(o,e,n,t,c,s)/(1+t/c)),D("DISC",4,[r,r,r,r,0],(o,e,n=0,t=0,c=0)=>n<=0||t<=0?N.NUM:(t-n)/t/C(o,e,c)),D("INTRATE",4,[r,r,r,r,0],(o,e,n=0,t=0,c=0)=>n<=0||t<=0?N.NUM:(t-n)/n/C(o,e,c)),D("RECEIVED",4,[r,r,r,r,0],(o,e,n=0,t=0,c=0)=>{const s=1-t*C(o,e,c);return n<=0||t<=0||s<=0?N.NUM:n/s}),D("PRICEDISC",4,[r,r,r,r,0],(o,e,n=0,t=0,c=0)=>n<=0||t<=0?N.NUM:t*(1-n*C(o,e,c))),D("YIELDDISC",4,[r,r,r,r,0],(o,e,n=0,t=0,c=0)=>n<=0||t<=0?N.NUM:(t-n)/n/C(o,e,c));function v(o,e){O(o,3,3,J((n=0,t=0,c=0)=>{const s=Math.trunc(n),i=Math.trunc(t);return s>=i||c<=0||i>A(s,12,!1)?N.NUM:e(i-s,c)}))}v("TBILLPRICE",(o,e)=>{const n=100*(1-e*o/360);return n<=0?N.NUM:n}),v("TBILLYIELD",(o,e)=>(100-e)/e*360/o),v("TBILLEQ",(o,e)=>{if(o<=182)return 365*e/(360-e*o);const n=100*(1-e*o/360),t=o/365,c=t*t-(2*t-1)*(1-100/n);return(-t+Math.sqrt(c))/(t-.5)}),O("ACCRINTM",3,5,(...o)=>{const e=R(o,[r,r,r,1e3,0]);if(e instanceof I)return e;const[n=0,t=0,c=0,s=0,i=0]=e,u=Math.trunc(n),a=Math.trunc(t);return u>=a||c<=0||s<=0||!P(i)?N.NUM:s*c*C(u,a,i)}),O("ACCRINT",6,8,(...o)=>{const e=R(o.slice(0,7),[r,r,r,r,1e3,r,0]);if(e instanceof I)return e;const[n=0,t=0,c=0,s=0,i=0,u=0,a=0]=e,l=o[7]===void 0?!0:B(o[7]);if(l instanceof I)return l;const f=Math.trunc(n),h=Math.trunc(c),M=Math.trunc(t);if(f>=h||s<=0||i<=0||!L(u)||!P(a))return N.NUM;const m=12/u;let d=M,U=M;for(let E=1;d>f;E++)d=A(M,-m*E,!1);let p=0;for(;d<h;){U=A(d,m,!1);const E=l?Math.max(f,d):Math.max(d,M<=h?M:f),k=Math.min(h,U),z=a===1?U-d:a===3?365/u:360/u;k>E&&(p+=T(E,k,a)/z),d=U}return i*s*p/u}),O("VDB",5,7,(...o)=>{const e=R(o.slice(0,6),[r,r,r,r,r,2]);if(e instanceof I)return e;const[n=0,t=0,c=0,s=0,i=0,u=0]=e,a=o[6]===void 0?!1:B(o[6]);if(a instanceof I)return a;if(n<0||t<0||c<=0||s<0||i>c||s>i||u<=0)return N.NUM;let l=n,f=0;const h=Math.ceil(i);for(let M=1;M<=h;M++){const m=Math.min(l*u/c,Math.max(0,l-t)),d=c-M+1,U=(l-t)/d,p=a?m:Math.max(m,U),E=Math.min(i,M)-Math.max(s,M-1);E>0&&(f+=p*E),l-=p}return f});const V=(o,e,n,t,c)=>({whole:C(n,e,c),accrued:C(n,o,c),left:C(o,e,c),rate:t});D("PRICEMAT",5,[r,r,r,r,r,0],(o,e,n=0,t=0,c=0,s=0)=>{const i=Math.trunc(n);if(i>=o||t<0||c<0)return N.NUM;const{whole:u,accrued:a,left:l}=V(o,e,i,t,s);return(100+u*t*100)/(1+l*c)-a*t*100}),D("YIELDMAT",5,[r,r,r,r,r,0],(o,e,n=0,t=0,c=0,s=0)=>{const i=Math.trunc(n);if(i>=o||t<0||c<=0)return N.NUM;const{whole:u,accrued:a,left:l}=V(o,e,i,t,s);return((1+u*t)/(c/100+a*t)-1)/l});function G(o,e,n,t,c){const s=12/t,i=S(e),u={held:0,accrued:0,left:0,count:0};let a=0,l=e;for(;l>o;){a+=1;const f=A(e,-s*a,i),h=c===1?l-f:c===3?365/t:360/t,M=Math.max(f,o),m=l,d=(U,p)=>p>U?T(U,p,c)/h:0;u.held+=d(M,m),u.accrued+=d(M,Math.min(n,m)),u.left+=d(Math.max(n,M),m),u.count+=1,l=f}return u}function K(o,e,n,t,c,s,i,u,a){const l=100*c/u,f=w(t,e,u,a).count+1,h=G(n,t,o,u,a),M=1+s/u,m=h.left;let d=i/M**(f-1+m);d+=l*h.held/M**m;for(let U=2;U<=f;U++)d+=l/M**(U-1+m);return d-l*h.accrued}function W(o,e,n){let t=n;for(let c=0;c<100;c++){const s=o(t),i=s-e;if(Math.abs(i)<1e-10)return t;const u=(o(t+1e-6)-s)/1e-6;if(u===0||!Number.isFinite(u))return;t-=i/u,t<=-1&&(t=-.99)}}function Q(o,e){O(o,8,9,(...n)=>{const t=R(n,[r,r,r,r,r,r,r,r,0]);if(t instanceof I)return t;const[c=0,s=0,i=0,u=0,a=0,l=0,f=0,h=0]=t,M=Math.trunc(t[8]??0),m=Math.trunc(c),d=Math.trunc(s),U=Math.trunc(i),p=Math.trunc(u);return!P(M)||!L(h)||!(d>p&&p>m&&m>U)||a<0||l<0||f<=0?N.NUM:e(E=>K(m,d,U,p,a,E,f,h,M),l)})}Q("ODDFPRICE",(o,e)=>o(e)),Q("ODDFYIELD",(o,e)=>W(o,e,.1)??N.NUM);function j(o,e){O(o,7,8,(...n)=>{const t=R(n,[r,r,r,r,r,r,r,0]);if(t instanceof I)return t;const[c=0,s=0,i=0,u=0,a=0,l=0,f=0]=t,h=Math.trunc(t[7]??0),M=Math.trunc(c),m=Math.trunc(s),d=Math.trunc(i);return!P(h)||!L(f)||!(m>M&&M>d)||u<0||a<0||l<=0?N.NUM:e({odd:G(d,m,M,f,h),coupon:100*u/f,last:a,red:l,f})})}j("ODDLPRICE",({odd:o,coupon:e,last:n,red:t,f:c})=>(t+o.held*e)/(1+o.left*n/c)-o.accrued*e),j("ODDLYIELD",({odd:o,coupon:e,last:n,red:t,f:c})=>{const s=n+o.accrued*e;return(t+o.held*e-s)/s*c/o.left}),O("AMORLINC",6,7,(...o)=>{const e=R(o,[r,r,r,r,r,r,0]);if(e instanceof I)return e;const[n=0,t=0,c=0,s=0,i=0,u=0]=e,a=Math.trunc(e[6]??0),l=Math.trunc(i);if(!P(a)||a===2||n<0||s<0||s>n||l<0||u<=0||t>c)return N.NUM;const f=n*u,h=C(Math.trunc(t),Math.trunc(c),a)*f,M=Math.trunc((n-s-h)/f);return l===0?h:l<=M?f:l===M+1?n-s-f*M-h:0}),O("AMORDEGRC",6,7,(...o)=>{const e=R(o,[r,r,r,r,r,r,0]);if(e instanceof I)return e;const[n=0,t=0,c=0,s=0,i=0,u=0]=e,a=Math.trunc(e[6]??0),l=Math.trunc(i);if(!P(a)||a===2||n<0||s<0||s>n||l<0||u<=0||t>c)return N.NUM;const f=1/u,h=f<3?1:f<5?1.5:f<=6?2:2.5,M=u*h;let m=Math.round(C(Math.trunc(t),Math.trunc(c),a)*M*n);if(l===0)return m;let d=n-m,U=d-s;for(let p=0;p<l;p++){if(m=Math.round(M*d),U-=m,U<0)return l-p<=1?Math.round(d*.5):0;d-=m}return m});
2
+ import{CellError as C,ERR as N,dateOf as F,serialOf as G}from"../../values.js";import{toBool as Q,toNumber as $}from"../coerce.js";import{yearFrac as E}from"./date.js";import{number as A,scalar as D}from"./define.js";const j=(t,r)=>F(G(t,r+1,0)).day,B=(t,r,o)=>o===0||o===4?Math.round(E(t,r,o)*360):r-t;function w(t,r,o){const n=F(t),c=n.year*12+n.month-1+r,e=Math.floor(c/12),i=c-e*12+1,u=j(e,i);return G(e,i,o?u:Math.min(n.day,u))}const v=t=>{const r=F(t);return r.day===j(r.year,r.month)};function g(t,r,o,n){const c=12/o,e=v(r);let i=0,u=r;for(;u>t;)i+=1,u=w(r,-c*i,e);const a=w(r,-c*(i-1),e),l=n===1?a-u:n===3?365/o:360/o,f=B(u,t,n);return{previous:u,next:a,count:i,period:l,since:f,until:n===0||n===4?l-f:a-t}}function R(t,r){const o=[];for(const[n,c]of r.entries()){const e=t[n],i=e==null?c??0:$(e);if(i instanceof C)return i;o.push(i)}return o}const L=t=>Number.isInteger(t)&&t>=0&&t<=4,p=t=>t===1||t===2||t===4;function P(t,r,o,n){D(t,r,o.length,(...c)=>{const e=R(c,o);if(e instanceof C)return e;const[i=0,u=0,...a]=e,l=Math.trunc(i),f=Math.trunc(u),h=Math.trunc(a[a.length-1]??0);return l>=f||!L(h)?N.NUM:n(l,f,...a.slice(0,-1),h)})}const s=void 0;for(const[t,r]of[["COUPDAYBS",o=>o.since],["COUPDAYS",o=>o.period],["COUPDAYSNC",o=>o.until],["COUPNCD",o=>o.next],["COUPNUM",o=>o.count],["COUPPCD",o=>o.previous]])P(t,3,[s,s,s,0],(o,n,c=0,e=0)=>p(c)?r(g(o,n,c,e)):N.NUM);function S(t,r,o,n,c,e,i){const u=g(t,r,e,i),a=100*o/e,l=u.until/u.period;if(u.count===1)return(c+a)/(1+l*n/e)-a*u.since/u.period;let f=c/(1+n/e)**(u.count-1+l);for(let h=1;h<=u.count;h++)f+=a/(1+n/e)**(h-1+l);return f-a*u.since/u.period}P("PRICE",6,[s,s,s,s,s,s,0],(t,r,o=0,n=0,c=0,e=0,i=0)=>o<0||n<0||c<=0||!p(e)?N.NUM:S(t,r,o,n,c,e,i)),P("YIELD",6,[s,s,s,s,s,s,0],(t,r,o=0,n=0,c=0,e=0,i=0)=>{if(o<0||n<=0||c<=0||!p(e))return N.NUM;let u=-.99,a=1;for(;S(t,r,o,a,c,e,i)>n&&a<1e6;)a*=2;for(let l=0;l<200;l++){const f=(u+a)/2;S(t,r,o,f,c,e,i)>n?u=f:a=f}return(u+a)/2});function z(t,r,o,n,c,e){const i=g(t,r,c,e),u=i.until/i.period;let a=0,l=0;for(let f=1;f<=i.count;f++){const h=f-1+u,M=(100*o/c+(f===i.count?100:0))/(1+n/c)**h;a+=h*M,l+=M}return a/l/c}P("DURATION",5,[s,s,s,s,s,0],(t,r,o=0,n=0,c=0,e=0)=>o<0||n<0||!p(c)?N.NUM:z(t,r,o,n,c,e)),P("MDURATION",5,[s,s,s,s,s,0],(t,r,o=0,n=0,c=0,e=0)=>o<0||n<0||!p(c)?N.NUM:z(t,r,o,n,c,e)/(1+n/c)),P("DISC",4,[s,s,s,s,0],(t,r,o=0,n=0,c=0)=>o<=0||n<=0?N.NUM:(n-o)/n/E(t,r,c)),P("INTRATE",4,[s,s,s,s,0],(t,r,o=0,n=0,c=0)=>o<=0||n<=0?N.NUM:(n-o)/o/E(t,r,c)),P("RECEIVED",4,[s,s,s,s,0],(t,r,o=0,n=0,c=0)=>{const e=1-n*E(t,r,c);return o<=0||n<=0||e<=0?N.NUM:o/e}),P("PRICEDISC",4,[s,s,s,s,0],(t,r,o=0,n=0,c=0)=>o<=0||n<=0?N.NUM:n*(1-o*E(t,r,c))),P("YIELDDISC",4,[s,s,s,s,0],(t,r,o=0,n=0,c=0)=>o<=0||n<=0?N.NUM:(n-o)/o/E(t,r,c));function k(t,r){D(t,3,3,A((o=0,n=0,c=0)=>{const e=Math.trunc(o),i=Math.trunc(n);return e>=i||c<=0||i>w(e,12,!1)?N.NUM:r(i-e,c)}))}k("TBILLPRICE",(t,r)=>{const o=100*(1-r*t/360);return o<=0?N.NUM:o}),k("TBILLYIELD",(t,r)=>(100-r)/r*360/t),k("TBILLEQ",(t,r)=>{if(t<=182)return 365*r/(360-r*t);const o=100*(1-r*t/360),n=t/365,c=n*n-(2*n-1)*(1-100/o);return(-n+Math.sqrt(c))/(n-.5)}),D("ACCRINTM",3,5,(...t)=>{const r=R(t,[s,s,s,1e3,0]);if(r instanceof C)return r;const[o=0,n=0,c=0,e=0,i=0]=r,u=Math.trunc(o),a=Math.trunc(n);return u>=a||c<=0||e<=0||!L(i)?N.NUM:e*c*E(u,a,i)}),D("ACCRINT",6,8,(...t)=>{const r=R(t.slice(0,7),[s,s,s,s,1e3,s,0]);if(r instanceof C)return r;const[o=0,n=0,c=0,e=0,i=0,u=0,a=0]=r,l=t[7]===void 0?!0:Q(t[7]);if(l instanceof C)return l;const f=Math.trunc(o),h=Math.trunc(c),M=Math.trunc(n);if(f>=h||e<=0||i<=0||!p(u)||!L(a))return N.NUM;const m=12/u;let d=M,U=M;for(let O=1;d>f;O++)d=w(M,-m*O,!1);let I=0;for(;d<h;){U=w(d,m,!1);const O=l?Math.max(f,d):Math.max(d,M<=h?M:f),V=Math.min(h,U),_=a===1?U-d:a===3?365/u:360/u;V>O&&(I+=B(O,V,a)/_),d=U}return i*e*I/u});const H=(t,r)=>(1+t)**r,Y=t=>t!==0?1:0,T=t=>Number.isFinite(t)?t:N.NUM;function b(t,r,o,n,c){if(t===0)return-(o+n)/r;const e=H(t,r);return-(o*e+n)*t/((1+t*c)*(e-1))}function x(t,r,o,n,c){if(t===0)return-(n+o*r);const e=H(t,r);return-(n*e+o*(1+t*c)*(e-1)/t)}function J(t,r,o,n,c,e){if(r<1||r>o)return N.NUM;if(e===1&&r===1)return 0;const i=b(t,o,n,c,e),u=e===1?x(t,r-2,i,n,1)-i:x(t,r-1,i,n,0);return T(u*t)}D("PMT",3,5,A((t,r,o,n=0,c=0)=>r===0?N.NUM:T(b(t,r,o,n,Y(c))))),D("FV",3,5,A((t,r,o,n=0,c=0)=>T(x(t,r,o,n,Y(c))))),D("IPMT",4,6,A((t,r,o,n,c=0,e=0)=>J(t,r,o,n,c,Y(e)))),D("PPMT",4,6,A((t,r,o,n,c=0,e=0)=>{const i=Y(e),u=J(t,r,o,n,c,i);return u instanceof C?u:T(b(t,o,n,c,i)-u)})),D("DB",4,5,A((t,r,o,n,c=12)=>{const e=Math.trunc(n);if(t<0||r<0||o<=0||e<=0)return N.NUM;if(c<=0||c>12||e>o+1)return N.NUM;const i=t===0?0:Math.round((1-(r/t)**(1/o))*1e3)/1e3;let u=0,a=0;for(let l=1;l<=e;l++)a=l===1?t*i*c/12:l===o+1?(t-u)*i*(12-c)/12:(t-u)*i,u+=a;return T(a)})),D("VDB",5,7,(...t)=>{const r=R(t.slice(0,6),[s,s,s,s,s,2]);if(r instanceof C)return r;const[o=0,n=0,c=0,e=0,i=0,u=0]=r,a=t[6]===void 0?!1:Q(t[6]);if(a instanceof C)return a;if(o<0||n<0||c<=0||e<0||i>c||e>i||u<=0)return N.NUM;let l=o,f=0;const h=Math.ceil(i);for(let M=1;M<=h;M++){const m=Math.min(l*u/c,Math.max(0,l-n)),d=c-M+1,U=(l-n)/d,I=a?m:Math.max(m,U),O=Math.min(i,M)-Math.max(e,M-1);O>0&&(f+=I*O),l-=I}return f});const K=(t,r,o,n,c)=>({whole:E(o,r,c),accrued:E(o,t,c),left:E(t,r,c),rate:n});P("PRICEMAT",5,[s,s,s,s,s,0],(t,r,o=0,n=0,c=0,e=0)=>{const i=Math.trunc(o);if(i>=t||n<0||c<0)return N.NUM;const{whole:u,accrued:a,left:l}=K(t,r,i,n,e);return(100+u*n*100)/(1+l*c)-a*n*100}),P("YIELDMAT",5,[s,s,s,s,s,0],(t,r,o=0,n=0,c=0,e=0)=>{const i=Math.trunc(o);if(i>=t||n<0||c<=0)return N.NUM;const{whole:u,accrued:a,left:l}=K(t,r,i,n,e);return((1+u*n)/(c/100+a*n)-1)/l});function W(t,r,o,n,c){const e=12/n,i=v(r),u={held:0,accrued:0,left:0,count:0};let a=0,l=r;for(;l>t;){a+=1;const f=w(r,-e*a,i),h=c===1?l-f:c===3?365/n:360/n,M=Math.max(f,t),m=l,d=(U,I)=>I>U?B(U,I,c)/h:0;u.held+=d(M,m),u.accrued+=d(M,Math.min(o,m)),u.left+=d(Math.max(o,M),m),u.count+=1,l=f}return u}function q(t,r,o,n,c,e,i,u,a){const l=100*c/u,f=g(n,r,u,a).count+1,h=W(o,n,t,u,a),M=1+e/u,m=h.left;let d=i/M**(f-1+m);d+=l*h.held/M**m;for(let U=2;U<=f;U++)d+=l/M**(U-1+m);return d-l*h.accrued}function y(t,r,o){let n=o;for(let c=0;c<100;c++){const e=t(n),i=e-r;if(Math.abs(i)<1e-10)return n;const u=(t(n+1e-6)-e)/1e-6;if(u===0||!Number.isFinite(u))return;n-=i/u,n<=-1&&(n=-.99)}}function X(t,r){D(t,8,9,(...o)=>{const n=R(o,[s,s,s,s,s,s,s,s,0]);if(n instanceof C)return n;const[c=0,e=0,i=0,u=0,a=0,l=0,f=0,h=0]=n,M=Math.trunc(n[8]??0),m=Math.trunc(c),d=Math.trunc(e),U=Math.trunc(i),I=Math.trunc(u);return!L(M)||!p(h)||!(d>I&&I>m&&m>U)||a<0||l<0||f<=0?N.NUM:r(O=>q(m,d,U,I,a,O,f,h,M),l)})}X("ODDFPRICE",(t,r)=>t(r)),X("ODDFYIELD",(t,r)=>y(t,r,.1)??N.NUM);function Z(t,r){D(t,7,8,(...o)=>{const n=R(o,[s,s,s,s,s,s,s,0]);if(n instanceof C)return n;const[c=0,e=0,i=0,u=0,a=0,l=0,f=0]=n,h=Math.trunc(n[7]??0),M=Math.trunc(c),m=Math.trunc(e),d=Math.trunc(i);return!L(h)||!p(f)||!(m>M&&M>d)||u<0||a<0||l<=0?N.NUM:r({odd:W(d,m,M,f,h),coupon:100*u/f,last:a,red:l,f})})}Z("ODDLPRICE",({odd:t,coupon:r,last:o,red:n,f:c})=>(n+t.held*r)/(1+t.left*o/c)-t.accrued*r),Z("ODDLYIELD",({odd:t,coupon:r,last:o,red:n,f:c})=>{const e=o+t.accrued*r;return(n+t.held*r-e)/e*c/t.left}),D("AMORLINC",6,7,(...t)=>{const r=R(t,[s,s,s,s,s,s,0]);if(r instanceof C)return r;const[o=0,n=0,c=0,e=0,i=0,u=0]=r,a=Math.trunc(r[6]??0),l=Math.trunc(i);if(!L(a)||a===2||o<0||e<0||e>o||l<0||u<=0||n>c)return N.NUM;const f=o*u,h=E(Math.trunc(n),Math.trunc(c),a)*f,M=Math.trunc((o-e-h)/f);return l===0?h:l<=M?f:l===M+1?o-e-f*M-h:0}),D("AMORDEGRC",6,7,(...t)=>{const r=R(t,[s,s,s,s,s,s,0]);if(r instanceof C)return r;const[o=0,n=0,c=0,e=0,i=0,u=0]=r,a=Math.trunc(r[6]??0),l=Math.trunc(i);if(!L(a)||a===2||o<0||e<0||e>o||l<0||u<=0||n>c)return N.NUM;const f=1/u,h=f<3?1:f<5?1.5:f<=6?2:2.5,M=u*h;let m=Math.round(E(Math.trunc(n),Math.trunc(c),a)*M*o);if(l===0)return m;let d=o-m,U=d-e;for(let I=0;I<l;I++){if(m=Math.round(M*d),U-=m,U<0)return l-I<=1?Math.round(d*.5):0;d-=m}return m});
@@ -8,6 +8,8 @@ import "./info.js";
8
8
  import "./kernels.js";
9
9
  import "./distributions.js";
10
10
  import "./maths.js";
11
+ import "./convert.js";
12
+ import "./modern.js";
11
13
  import "./finance.js";
12
14
  import "./database.js";
13
15
  import "./dynamic.js";
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import"./logical.js";import"./aggregate.js";import"./criteria.js";import"./lookup.js";import"./text.js";import"./date.js";import"./info.js";import"./kernels.js";import"./distributions.js";import"./maths.js";import"./finance.js";import"./database.js";import"./dynamic.js";export{FUNCTIONS}from"./define.js";
2
+ import"./logical.js";import"./aggregate.js";import"./criteria.js";import"./lookup.js";import"./text.js";import"./date.js";import"./info.js";import"./kernels.js";import"./distributions.js";import"./maths.js";import"./convert.js";import"./modern.js";import"./finance.js";import"./database.js";import"./dynamic.js";export{FUNCTIONS}from"./define.js";
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{cellName as N}from"../../address.js";import{CellError as s,ERR as n,Matrix as R}from"../../values.js";import{FormulaCell as p}from"../../workbook.js";import{toNumber as L,toText as d}from"../coerce.js";import{Lambda as I,Reference as l,Union as y}from"../types.js";import{lazy as u,raw as m,scalar as c}from"./define.js";const f=(e,t)=>{c(e,1,1,r=>t(r),{errors:!0})};f("ISBLANK",e=>e==null),f("ISNUMBER",e=>typeof e=="number"),f("ISTEXT",e=>typeof e=="string"),f("ISNONTEXT",e=>typeof e!="string"),f("ISLOGICAL",e=>typeof e=="boolean"),f("ISERROR",e=>e instanceof s),f("ISERR",e=>e instanceof s&&e!==n.NA),f("ISNA",e=>e===n.NA);const E=(e,t)=>{const r=L(e);return r instanceof s?r:Math.abs(Math.trunc(r))%2===t};c("ISEVEN",1,1,e=>E(e,0)),c("ISODD",1,1,e=>E(e,1)),c("N",1,1,e=>typeof e=="number"?e:typeof e=="boolean"?e?1:0:e instanceof s?e:0,{errors:!0}),m("NA",0,0,()=>n.NA),m("TYPE",1,1,(e,t)=>{const r=t.calc.flat(e[0]);return r instanceof R?64:typeof r=="number"||r===null?1:typeof r=="string"?2:typeof r=="boolean"?4:16});const S=[n.NULL,n.DIV0,n.VALUE,n.REF,n.NAME,n.NUM,n.NA];c("ERROR.TYPE",1,1,e=>{const t=e instanceof s?S.indexOf(e):-1;return t<0?n.NA:t+1},{errors:!0}),u("ISREF",1,1,(e,t)=>{const r=e[0];if(!r)return!1;const o=t.calc.eval(r,t.frame);return o instanceof l||o instanceof y});const A=e=>e instanceof l?e.sheet.at(e.top,e.left):void 0;u("ISFORMULA",1,1,(e,t)=>{const r=e[0];if(!r)return n.VALUE;const o=t.calc.eval(r,t.frame);return o instanceof I?n.VALUE:A(o)instanceof p}),u("FORMULATEXT",1,1,(e,t)=>{const r=e[0];if(!r)return n.VALUE;const o=A(t.calc.eval(r,t.frame));return o instanceof p?o.text:n.NA}),m("CELL",1,2,(e,t)=>{const r=d(t.calc.scalar(e[0],t.frame));if(r instanceof s)return r;const o=e[1],a=o instanceof l?o:new l(t.frame.sheet,t.frame.row,t.frame.col,t.frame.row,t.frame.col),i=t.calc.read(a.sheet,a.top,a.left);switch(r.toLowerCase()){case"row":return a.top+1;case"col":return a.left+1;case"address":return N({row:a.top,col:a.left}).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2");case"contents":return i;case"type":return i===null?"b":typeof i=="string"?"l":"v";default:return n.VALUE}});
2
+ import{cellName as N}from"../../address.js";import{CellError as s,ERR as n,Matrix as R}from"../../values.js";import{FormulaCell as p}from"../../workbook.js";import{toNumber as L,toText as d}from"../coerce.js";import{Lambda as I,Reference as l,Union as y}from"../types.js";import{lazy as u,raw as m,scalar as c}from"./define.js";const f=(e,r)=>{c(e,1,1,t=>r(t),{errors:!0})};f("ISBLANK",e=>e==null),f("ISNUMBER",e=>typeof e=="number"),f("ISTEXT",e=>typeof e=="string"),f("ISNONTEXT",e=>typeof e!="string"),f("ISLOGICAL",e=>typeof e=="boolean"),f("ISERROR",e=>e instanceof s),f("ISERR",e=>e instanceof s&&e!==n.NA),f("ISNA",e=>e===n.NA);const E=(e,r)=>{const t=L(e);return t instanceof s?t:Math.abs(Math.trunc(t))%2===r};c("ISEVEN",1,1,e=>E(e,0)),c("ISODD",1,1,e=>E(e,1)),c("N",1,1,e=>typeof e=="number"?e:typeof e=="boolean"?e?1:0:e instanceof s?e:0,{errors:!0}),m("NA","",()=>n.NA),m("TYPE","r",(e,r)=>{const t=r.calc.flat(e[0]);return t instanceof R?64:typeof t=="number"||t===null?1:typeof t=="string"?2:typeof t=="boolean"?4:16});const S=[n.NULL,n.DIV0,n.VALUE,n.REF,n.NAME,n.NUM,n.NA];c("ERROR.TYPE",1,1,e=>{const r=e instanceof s?S.indexOf(e):-1;return r<0?n.NA:r+1},{errors:!0}),u("ISREF",1,1,(e,r)=>{const t=e[0];if(!t)return!1;const o=r.calc.eval(t,r.frame);return o instanceof l||o instanceof y});const A=e=>e instanceof l?e.sheet.at(e.top,e.left):void 0;u("ISFORMULA",1,1,(e,r)=>{const t=e[0];if(!t)return n.VALUE;const o=r.calc.eval(t,r.frame);return o instanceof I?n.VALUE:A(o)instanceof p}),u("FORMULATEXT",1,1,(e,r)=>{const t=e[0];if(!t)return n.VALUE;const o=A(r.calc.eval(t,r.frame));return o instanceof p?o.text:n.NA}),m("CELL","v?r",(e,r)=>{const t=d(r.calc.scalar(e[0],r.frame));if(t instanceof s)return t;const o=e[1],a=o instanceof l?o:new l(r.frame.sheet,r.frame.row,r.frame.col,r.frame.row,r.frame.col),i=r.calc.read(a.sheet,a.top,a.left);switch(t.toLowerCase()){case"row":return a.top+1;case"col":return a.left+1;case"address":return N({row:a.top,col:a.left}).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2");case"contents":return i;case"type":return i===null?"b":typeof i=="string"?"l":"v";default:return n.VALUE}});
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import*as k from"@formulajs/formulajs";import{CellError as A,ERR as R,errorOf as y,numberText as b}from"../../values.js";import{Missing as w}from"../types.js";import{toBool as X,toNumber as P,toText as d}from"../coerce.js";import{alias as D,cellsOf as F,many as B,numbersOf as G,numbersOfA as x,raw as V,scalar as U}from"./define.js";const j=k;function L(n){const t=n.split(".").reduce((E,f)=>E?.[f],j);if(typeof t!="function")throw new Error(`@formulajs/formulajs has no ${n}.`);return t}function K(n){return typeof n=="number"?Number.isFinite(n)?n:R.NUM:n instanceof Error?y(n.message)??R.VALUE:typeof n=="boolean"||typeof n=="string"?n:R.VALUE}const m=(n,t)=>{try{return K(n(...t))}catch{return R.VALUE}};function Q(n,t){return G([n],t)}function W(n,t){const E=F(n,t);if(E instanceof A)return E;const f=[];for(let s=0;s<E.rows;s++){const e=[];for(let c=0;c<E.cols;c++){const o=E.at(s,c);if(o instanceof A)return o;e.push(typeof o=="number"?o:0)}f.push(e)}return f}function r(n,t,E){const f=t.split("?")[0]?.length??0,s=t.replace("?",""),e=L(E);U(n,f,s.length,(...c)=>{const o=[];for(const[i,I]of c.entries()){if(I===void 0){o.push(void 0);continue}const N=s.charAt(i),u=N==="n"?P(I):N==="b"?X(I):d(I);if(u instanceof A)return u;o.push(u)}return m(e,o)},{from:"formulajs"})}function a(n,t,E){const f=t.split("?")[0]?.length??0,s=t.replace("?",""),e=s.endsWith("r"),c=L(E);V(n,f,e?B:s.length,(o,i)=>{const I=[];for(const[N,u]of o.entries()){const O=e&&N>=s.length-1?"r":s.charAt(N);if(O==="r"){const C=G(o.slice(N),i);if(C instanceof A)return C;I.push(C);break}if(u instanceof w){I.push(void 0);continue}let T;if(O==="l")T=Q(u,i);else if(O==="m")T=W(u,i);else{const C=i.calc.scalar(u,i.frame);T=O==="n"?P(C):O==="b"?X(C):d(C)}if(T instanceof A)return T;I.push(T)}return m(c,I)},{from:"formulajs"})}function M(n,t,E="",f=1){const s=L(t),e=E.length;V(n,e+2,e+2,(c,o)=>{const i=[];for(const C of c.slice(0,e)){const S=P(o.calc.scalar(C,o.frame));if(S instanceof A)return S;i.push(S)}const I=F(c[e],o),N=F(c[e+1],o);if(I instanceof A)return I;if(N instanceof A)return N;if(I.rows*I.cols!==N.rows*N.cols)return R.NA;const u=[],O=[];for(let C=0;C<I.rows;C++)for(let S=0;S<I.cols;S++){const p=I.at(C,S),h=N.rows===I.rows?N.at(C,S):N.at(S,C);if(p instanceof A)return p;if(h instanceof A)return h;typeof p=="number"&&typeof h=="number"&&(u.push(p),O.push(h))}if(u.length<f)return R.DIV0;const T=m(s,[...i,u,O]);return T===R.NUM?R.DIV0:T},{from:"formulajs"})}function l(n,t,E=!1,f=1,s=R.DIV0){const e=L(t);V(n,1,B,(c,o)=>{const i=E?x(c,o):G(c,o);if(i instanceof A)return i;if(i.length<f)return s;const I=m(e,[i]);return I===R.NUM&&s===R.DIV0?R.DIV0:I},{from:"formulajs"})}function g(n){const t=/^([+-]?[\d.]+(?:e[+-]?\d+)?)?(?:([+-]?)([\d.]+(?:e[+-]?\d+)?)?([ij]))?$/iu.exec(n);if(!t)return n;const[,E,f,s,e]=t,c=E===void 0?"":b(Number(E));if(e===void 0)return c;const o=s===void 0?"":b(Number(s));return`${c}${f??""}${o==="1"?"":o}${e}`}function H(n,t){const E=L(n);U(n,t.length,t.length,(...f)=>{const s=[];for(const[c,o]of f.entries()){const i=t.charAt(c)==="n"?P(o):d(o);if(i instanceof A)return i;s.push(i)}const e=m(E,s);return typeof e=="string"?g(e):e},{from:"formulajs"})}for(const n of["ABS","ACOS","ACOSH","ACOT","ACOTH","ASIN","ASINH","ATAN","ATANH","COS","COSH","COT","COTH","CSC","CSCH","DEGREES","EVEN","EXP","FACT","FACTDOUBLE","INT","LN","LOG10","ODD","RADIANS","SEC","SECH","SIGN","SIN","SINH","SQRT","SQRTPI","TAN","TANH"])r(n,"n",n);for(const n of["ATAN2","COMBIN","COMBINA","MROUND","PERMUT","PERMUTATIONA","POWER"])r(n,"nn",n);r("TRUNC","n?n","TRUNC"),r("CEILING","nn","CEILING"),r("FLOOR","nn","FLOOR"),r("CEILING.MATH","n?nn","CEILINGMATH"),r("FLOOR.MATH","n?nn","FLOORMATH"),r("CEILING.PRECISE","n?n","CEILINGPRECISE"),r("FLOOR.PRECISE","n?n","FLOORPRECISE"),D("ISO.CEILING","CEILING.PRECISE"),U("PI",0,0,()=>Math.PI),V("RAND",0,0,(n,t)=>t.calc.random(),{volatile:!0}),V("RANDBETWEEN",2,2,(n,t)=>{const E=P(t.calc.scalar(n[0],t.frame)),f=P(t.calc.scalar(n[1],t.frame));if(E instanceof A)return E;if(f instanceof A)return f;const s=Math.ceil(E),e=Math.floor(f);return s>e?R.NUM:s+Math.floor(t.calc.random()*(e-s+1))},{volatile:!0}),l("MULTINOMIAL","MULTINOMIAL"),l("AVEDEV","AVEDEV",!1,1,R.NUM),l("DEVSQ","DEVSQ",!1,1,R.NUM),l("MEDIAN","MEDIAN",!1,1,R.NUM),l("SKEW","SKEW",!1,3),l("SKEW.P","SKEW.P",!1,3),l("STDEV.S","STDEV.S",!1,2),l("STDEV.P","STDEV.P",!1,1),l("VAR.S","VAR.S",!1,2),l("VAR.P","VAR.P",!1,1),l("STDEVA","STDEVA",!0,2),l("STDEVPA","STDEVPA",!0,1),l("VARA","VARA",!0,2),l("VARPA","VARPA",!0,1);for(const[n,t]of[["STDEV","STDEV.S"],["STDEVP","STDEV.P"],["VAR","VAR.S"],["VARP","VAR.P"]])D(n,t);a("LARGE","ln","LARGE"),a("SMALL","ln","SMALL"),a("PERCENTILE.INC","ln","PERCENTILE.INC"),a("PERCENTILE.EXC","ln","PERCENTILE.EXC"),a("PERCENTRANK.INC","ln?n","PERCENTRANK.INC"),a("PERCENTRANK.EXC","ln?n","PERCENTRANK.EXC"),a("QUARTILE.EXC","ln","QUARTILE.EXC"),a("TRIMMEAN","ln","TRIMMEAN"),D("PERCENTILE","PERCENTILE.INC"),D("PERCENTRANK","PERCENTRANK.INC"),M("CORREL","CORREL"),M("PEARSON","PEARSON"),M("RSQ","RSQ"),M("SLOPE","SLOPE"),M("INTERCEPT","INTERCEPT"),M("STEYX","STEYX","",3),M("COVARIANCE.P","COVARIANCE.P"),M("COVARIANCE.S","COVARIANCE.S","",2),M("FORECAST","FORECAST","n"),D("FORECAST.LINEAR","FORECAST"),D("COVAR","COVARIANCE.P"),r("PMT","nnn?nn","PMT"),r("PPMT","nnnn?nn","PPMT"),r("IPMT","nnnn?nn","IPMT"),r("FV","nnn?nn","FV"),r("PV","nnn?nn","PV"),r("NPER","nnn?nn","NPER"),r("RATE","nnn?nnn","RATE"),r("SYD","nnnn","SYD"),r("DB","nnnn?n","DB"),r("DDB","nnnn?n","DDB"),r("ISPMT","nnnn","ISPMT"),r("EFFECT","nn","EFFECT"),r("NOMINAL","nn","NOMINAL"),r("CUMIPMT","nnnnnn","CUMIPMT"),r("CUMPRINC","nnnnnn","CUMPRINC"),r("DOLLARDE","nn","DOLLARDE"),r("DOLLARFR","nn","DOLLARFR"),r("PDURATION","nnn","PDURATION"),r("RRI","nnn","RRI"),a("IRR","l?n","IRR"),a("MIRR","lnn","MIRR"),a("NPV","nr","NPV"),a("FVSCHEDULE","nl","FVSCHEDULE");for(const n of["BIN2DEC","HEX2DEC","OCT2DEC","IMABS","IMAGINARY","IMARGUMENT","IMREAL"])r(n,"t",n);for(const n of["IMCONJUGATE","IMCOS","IMCOSH","IMCOT","IMCSC","IMCSCH","IMEXP","IMLN","IMLOG10","IMLOG2","IMSEC","IMSECH","IMSIN","IMSINH","IMSQRT","IMTAN"])H(n,"t");for(const n of["BIN2OCT","HEX2BIN","HEX2OCT","OCT2BIN"])r(n,"t?n",n);for(const n of["DEC2BIN","DEC2OCT"])r(n,"n?n",n);for(const[n,t]of[["BIN2HEX","t"],["OCT2HEX","t"],["DEC2HEX","n"]]){const E=L(n);U(n,1,2,(f,s)=>{const e=t==="n"?P(f):d(f);if(e instanceof A)return e;const c=s===void 0?void 0:P(s);if(c instanceof A)return c;const o=m(E,[e,c]);return typeof o=="string"?o.toUpperCase():o},{from:"formulajs"})}H("IMDIV","tt"),H("IMSUB","tt"),H("IMPOWER","tn"),r("COMPLEX","nn?t","COMPLEX"),r("DECIMAL","tn","DECIMAL"),r("ARABIC","t","ARABIC");for(const n of["IMSUM","IMPRODUCT"]){const t=L(n);V(n,1,B,(E,f)=>{const s=[];for(const c of E){const o=d(f.calc.scalar(c,f.frame));if(o instanceof A)return o;s.push(o)}const e=m(t,s);return typeof e=="string"?g(e):e},{from:"formulajs"})}r("CONVERT","ntt","CONVERT"),r("DELTA","n?n","DELTA"),r("GESTEP","n?n","GESTEP");
2
+ import*as k from"@formulajs/formulajs";import{CellError as A,ERR as R,errorOf as g,numberText as B}from"../../values.js";import{Missing as y}from"../types.js";import{toBool as G,toNumber as P,toText as d}from"../coerce.js";import{alias as D,cellsOf as F,eachArg as j,numbersOf as b,numbersOfA as w,raw as V,scalar as U}from"./define.js";const x=k;function m(n){const r=n.split(".").reduce((E,f)=>E?.[f],x);if(typeof r!="function")throw new Error(`@formulajs/formulajs has no ${n}.`);return r}function K(n){return typeof n=="number"?Number.isFinite(n)?n:R.NUM:n instanceof Error?g(n.message)??R.VALUE:typeof n=="boolean"||typeof n=="string"?n:R.VALUE}const L=(n,r)=>{try{return K(n(...r))}catch{return R.VALUE}};function v(n,r){return b([n],r)}function Q(n,r){const E=F(n,r);if(E instanceof A)return E;const f=[];for(let s=0;s<E.rows;s++){const e=[];for(let c=0;c<E.cols;c++){const t=E.at(s,c);if(t instanceof A)return t;e.push(typeof t=="number"?t:0)}f.push(e)}return f}function o(n,r,E){const f=r.split("?")[0]?.length??0,s=r.replace("?",""),e=m(E);U(n,f,s.length,(...c)=>{const t=[];for(const[I,i]of c.entries()){if(i===void 0){t.push(void 0);continue}const l=s.charAt(I),N=l==="n"?P(i):l==="b"?G(i):d(i);if(N instanceof A)return N;t.push(N)}return L(e,t)},{from:"formulajs"})}function a(n,r,E){const f=r.replace("?",""),s=f.endsWith("r"),e=m(E),c=Array.from({length:r.length},(t,I)=>{const i=r.charAt(I);return i==="?"?"?":s&&I===r.length-1?"(r)":"lm".includes(i)?"r":"v"}).join("");V(n,c,(t,I)=>{const i=[];for(const[l,N]of t.entries()){const M=s&&l>=f.length-1?"r":f.charAt(l);if(M==="r"){const C=b(t.slice(l),I);if(C instanceof A)return C;i.push(C);break}if(N instanceof y){i.push(void 0);continue}let T;if(M==="l")T=v(N,I);else if(M==="m")T=Q(N,I);else{const C=I.calc.scalar(N,I.frame);T=M==="n"?P(C):M==="b"?G(C):d(C)}if(T instanceof A)return T;i.push(T)}return L(e,i)},{from:"formulajs"})}function O(n,r,E="",f=1){const s=m(r),e=E.length;V(n,`${"v".repeat(e)}rr`,(c,t)=>{const I=[];for(const C of c.slice(0,e)){const S=P(t.calc.scalar(C,t.frame));if(S instanceof A)return S;I.push(S)}const i=F(c[e],t),l=F(c[e+1],t);if(i instanceof A)return i;if(l instanceof A)return l;if(i.rows*i.cols!==l.rows*l.cols)return R.NA;const N=[],M=[];for(let C=0;C<i.rows;C++)for(let S=0;S<i.cols;S++){const h=i.at(C,S),p=l.rows===i.rows?l.at(C,S):l.at(S,C);if(h instanceof A)return h;if(p instanceof A)return p;typeof h=="number"&&typeof p=="number"&&(N.push(h),M.push(p))}if(N.length<f)return R.DIV0;const T=L(s,[...I,N,M]);return T===R.NUM?R.DIV0:T},{from:"formulajs"})}function u(n,r,E=!1,f=1,s=R.DIV0){const e=m(r);V(n,"(r)",(c,t)=>{const I=E?w(c,t):b(c,t);if(I instanceof A)return I;if(I.length<f)return s;const i=L(e,[I]);return i===R.NUM&&s===R.DIV0?R.DIV0:i},{from:"formulajs"})}function X(n){const r=/^([+-]?[\d.]+(?:e[+-]?\d+)?)?(?:([+-]?)([\d.]+(?:e[+-]?\d+)?)?([ij]))?$/iu.exec(n);if(!r)return n;const[,E,f,s,e]=r,c=E===void 0?"":B(Number(E));if(e===void 0)return c;const t=s===void 0?"":B(Number(s));return`${c}${f??""}${t==="1"?"":t}${e}`}function H(n,r){const E=m(n);U(n,r.length,r.length,(...f)=>{const s=[];for(const[c,t]of f.entries()){const I=r.charAt(c)==="n"?P(t):d(t);if(I instanceof A)return I;s.push(I)}const e=L(E,s);return typeof e=="string"?X(e):e},{from:"formulajs"})}for(const n of["ABS","ACOS","ACOSH","ACOT","ACOTH","ASIN","ASINH","ATAN","ATANH","COS","COSH","COT","COTH","CSC","CSCH","DEGREES","EVEN","EXP","INT","LN","LOG10","ODD","RADIANS","SEC","SECH","SIGN","SIN","SINH","SQRT","SQRTPI","TAN","TANH"])o(n,"n",n);for(const n of["COMBIN","COMBINA","MROUND","PERMUT","PERMUTATIONA","POWER"])o(n,"nn",n);o("TRUNC","n?n","TRUNC"),o("CEILING","nn","CEILING"),o("FLOOR","nn","FLOOR"),o("CEILING.MATH","n?nn","CEILINGMATH"),o("FLOOR.MATH","n?nn","FLOORMATH"),o("CEILING.PRECISE","n?n","CEILINGPRECISE"),o("FLOOR.PRECISE","n?n","FLOORPRECISE"),D("ISO.CEILING","CEILING.PRECISE"),U("PI",0,0,()=>Math.PI),V("RAND","",(n,r)=>r.calc.random(),{volatile:!0}),V("RANDBETWEEN","vv",(n,r)=>{const E=P(r.calc.scalar(n[0],r.frame)),f=P(r.calc.scalar(n[1],r.frame));if(E instanceof A)return E;if(f instanceof A)return f;const s=Math.ceil(E),e=Math.floor(f);return s>e?R.NUM:s+Math.floor(r.calc.random()*(e-s+1))},{volatile:!0}),u("MULTINOMIAL","MULTINOMIAL"),u("AVEDEV","AVEDEV",!1,1,R.NUM),u("DEVSQ","DEVSQ",!1,1,R.NUM),u("MEDIAN","MEDIAN",!1,1,R.NUM),u("SKEW","SKEW",!1,3),u("SKEW.P","SKEW.P",!1,3),u("STDEV.S","STDEV.S",!1,2),u("STDEV.P","STDEV.P",!1,1),u("VAR.S","VAR.S",!1,2),u("VAR.P","VAR.P",!1,1),u("STDEVA","STDEVA",!0,2),u("STDEVPA","STDEVPA",!0,1),u("VARA","VARA",!0,2),u("VARPA","VARPA",!0,1);for(const[n,r]of[["STDEV","STDEV.S"],["STDEVP","STDEV.P"],["VAR","VAR.S"],["VARP","VAR.P"]])D(n,r);a("PERCENTILE.INC","ln","PERCENTILE.INC"),a("PERCENTILE.EXC","ln","PERCENTILE.EXC"),a("PERCENTRANK.INC","ln?n","PERCENTRANK.INC"),a("PERCENTRANK.EXC","ln?n","PERCENTRANK.EXC"),a("QUARTILE.EXC","ln","QUARTILE.EXC"),a("TRIMMEAN","ln","TRIMMEAN"),D("PERCENTILE","PERCENTILE.INC"),D("PERCENTRANK","PERCENTRANK.INC"),O("CORREL","CORREL"),O("PEARSON","PEARSON"),O("RSQ","RSQ"),O("SLOPE","SLOPE"),O("INTERCEPT","INTERCEPT"),O("STEYX","STEYX","",3),O("COVARIANCE.P","COVARIANCE.P"),O("COVARIANCE.S","COVARIANCE.S","",2),O("FORECAST","FORECAST","n"),D("FORECAST.LINEAR","FORECAST"),D("COVAR","COVARIANCE.P"),o("PV","nnn?nn","PV"),o("NPER","nnn?nn","NPER"),o("RATE","nnn?nnn","RATE"),o("SYD","nnnn","SYD"),o("DDB","nnnn?n","DDB"),o("ISPMT","nnnn","ISPMT"),o("EFFECT","nn","EFFECT"),o("NOMINAL","nn","NOMINAL"),o("CUMIPMT","nnnnnn","CUMIPMT"),o("CUMPRINC","nnnnnn","CUMPRINC"),o("DOLLARDE","nn","DOLLARDE"),o("DOLLARFR","nn","DOLLARFR"),o("PDURATION","nnn","PDURATION"),o("RRI","nnn","RRI"),a("IRR","l?n","IRR"),a("MIRR","lnn","MIRR"),a("NPV","nr","NPV"),a("FVSCHEDULE","nl","FVSCHEDULE");for(const n of["BIN2DEC","HEX2DEC","OCT2DEC","IMABS","IMAGINARY","IMARGUMENT","IMREAL"])o(n,"t",n);for(const n of["IMCONJUGATE","IMCOS","IMCOSH","IMCOT","IMCSC","IMCSCH","IMEXP","IMLN","IMLOG10","IMLOG2","IMSEC","IMSECH","IMSIN","IMSINH","IMSQRT","IMTAN"])H(n,"t");for(const n of["BIN2OCT","HEX2BIN","HEX2OCT","OCT2BIN"])o(n,"t?n",n);for(const n of["DEC2BIN","DEC2OCT"])o(n,"n?n",n);for(const[n,r]of[["BIN2HEX","t"],["OCT2HEX","t"],["DEC2HEX","n"]]){const E=m(n);U(n,1,2,(f,s)=>{const e=r==="n"?P(f):d(f);if(e instanceof A)return e;const c=s===void 0?void 0:P(s);if(c instanceof A)return c;const t=L(E,[e,c]);return typeof t=="string"?t.toUpperCase():t},{from:"formulajs"})}H("IMDIV","tt"),H("IMSUB","tt"),H("IMPOWER","tn"),o("COMPLEX","nn?t","COMPLEX"),o("DECIMAL","tn","DECIMAL"),o("ARABIC","t","ARABIC");for(const n of["IMSUM","IMPRODUCT"]){const r=m(n);V(n,"(r)",(E,f)=>{const s=[];let e;if(j(E,f,t=>{if(e||t===null)return;const I=d(t);I instanceof A?e=I:s.push(I)}),e)return e;const c=L(r,s);return typeof c=="string"?X(c):c},{from:"formulajs"})}o("DELTA","n?n","DELTA"),o("GESTEP","n?n","GESTEP");
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as s,ERR as i,Matrix as A}from"../../values.js";import{compare as N,toBool as E,toNumber as U}from"../coerce.js";import{Lambda as R,Missing as b}from"../types.js";import{eachArg as O,lazy as m,many as p,raw as d,scalar as k}from"./define.js";const l=(t,n)=>t?n.calc.eval(t,n.frame):!1;function V(t,n,e){if(!(t instanceof A))return t;const r=t.rows===1?0:n,o=t.cols===1?0:e;return r<t.rows&&o<t.cols?t.at(r,o):i.NA}function L(t,n,e){const r=[t,...n].filter(c=>c instanceof A),o=Math.max(...r.map(c=>c.rows)),f=Math.max(...r.map(c=>c.cols)),a=new Array(o*f);for(let c=0;c<o;c++)for(let u=0;u<f;u++){const h=e(V(t,c,u));a[c*f+u]=h instanceof s?h:V(n[h]??i.VALUE,c,u)}return new A(o,f,a)}m("IF",1,3,(t,n)=>{const e=n.calc.flat(l(t[0],n)),r=f=>{const a=t[f];if(a===void 0)return f===1;const c=n.calc.eval(a,n.frame);return c instanceof b?0:c};if(e instanceof A){const f=a=>a<t.length?n.calc.flat(r(a)):!1;return L(e,[f(1),f(2)],a=>{const c=E(a);return c instanceof s?c:c?0:1})}const o=E(e);return o instanceof s?o:r(o?1:2)}),m("IFS",2,p,(t,n)=>{for(let e=0;e+1<t.length;e+=2){const r=E(n.calc.scalar(l(t[e],n),n.frame));if(r instanceof s)return r;if(r)return l(t[e+1],n)}return i.NA});const M=t=>(n,e)=>{const r=e.calc.flat(l(n[0],e)),o=a=>a instanceof s&&(t===void 0||a===t),f=()=>n[1]?e.calc.flat(e.calc.eval(n[1],e.frame)):"";return r instanceof A?L(r,[r,f()],a=>o(a)?1:0):o(r)?f():r};m("IFERROR",2,2,M()),m("IFNA",2,2,M(i.NA)),m("CHOOSE",2,255,(t,n)=>{const e=n.calc.flat(l(t[0],n));if(e instanceof A){const a=t.slice(1).map(c=>n.calc.flat(n.calc.eval(c,n.frame)));return L(e,a,c=>{const u=U(c);if(u instanceof s)return u;const h=Math.trunc(u)-1;return h<0||h>=a.length?i.VALUE:h})}const r=U(e);if(r instanceof s)return r;const o=Math.trunc(r),f=t[o];return o<1||f===void 0?i.VALUE:n.calc.eval(f,n.frame)}),m("SWITCH",3,p,(t,n)=>{const e=n.calc.scalar(l(t[0],n),n.frame);if(e instanceof s)return e;let r=1;for(;r+1<t.length;r+=2){const o=n.calc.scalar(l(t[r],n),n.frame);if(o instanceof s)return o;if(N(e,o)===0)return l(t[r+1],n)}return r<t.length?l(t[r],n):i.NA});function w(t,n){const e=[];let r;return O(t,n,(o,f)=>{if(r)return;if(o instanceof s){r=o;return}if(typeof o=="string"&&!f||o===null)return;const a=E(o);a instanceof s?r=a:e.push(a)}),r||(e.length===0?i.VALUE:e)}d("AND",1,p,(t,n)=>{const e=w(t,n);return e instanceof s?e:e.every(Boolean)}),d("OR",1,p,(t,n)=>{const e=w(t,n);return e instanceof s?e:e.some(Boolean)}),d("XOR",1,p,(t,n)=>{const e=w(t,n);return e instanceof s?e:e.filter(Boolean).length%2===1}),k("NOT",1,1,t=>{const n=E(t);return n instanceof s?n:!n}),d("TRUE",0,0,()=>!0),d("FALSE",0,0,()=>!1);const y=(t,n)=>n?{names:t,parent:n}:{names:t};m("LET",3,p,(t,n)=>{if(t.length%2===0)return i.VALUE;const e=new Map,r={...n.frame,scope:y(e,n.frame.scope)};for(let o=0;o+1<t.length;o+=2){const f=t[o];if(f?.kind!=="name")return i.VALUE;e.set(f.name.toLowerCase(),l(t[o+1],{...n,frame:r}))}return l(t[t.length-1],{...n,frame:r})}),m("LAMBDA",1,254,(t,n)=>{const e=[];for(const o of t.slice(0,-1)){if(o.kind!=="name")return i.VALUE;e.push(o.name.toLowerCase())}const r=t[t.length-1];return r?new R(e,r,n.frame):i.VALUE});
2
+ import{CellError as s,ERR as i,Matrix as A}from"../../values.js";import{compare as N,toBool as p,toNumber as U}from"../coerce.js";import{Lambda as R,Missing as b}from"../types.js";import{eachArg as O,lazy as m,many as d,raw as E,scalar as k}from"./define.js";const l=(t,n)=>t?n.calc.eval(t,n.frame):!1;function V(t,n,e){if(!(t instanceof A))return t;const r=t.rows===1?0:n,o=t.cols===1?0:e;return r<t.rows&&o<t.cols?t.at(r,o):i.NA}function L(t,n,e){const r=[t,...n].filter(c=>c instanceof A),o=Math.max(...r.map(c=>c.rows)),f=Math.max(...r.map(c=>c.cols)),a=new Array(o*f);for(let c=0;c<o;c++)for(let u=0;u<f;u++){const h=e(V(t,c,u));a[c*f+u]=h instanceof s?h:V(n[h]??i.VALUE,c,u)}return new A(o,f,a)}m("IF",1,3,(t,n)=>{const e=n.calc.flat(l(t[0],n)),r=f=>{const a=t[f];if(a===void 0)return f===1;const c=n.calc.eval(a,n.frame);return c instanceof b?0:c};if(e instanceof A){const f=a=>a<t.length?n.calc.flat(r(a)):!1;return L(e,[f(1),f(2)],a=>{const c=p(a);return c instanceof s?c:c?0:1})}const o=p(e);return o instanceof s?o:r(o?1:2)}),m("IFS",2,d,(t,n)=>{for(let e=0;e+1<t.length;e+=2){const r=p(n.calc.scalar(l(t[e],n),n.frame));if(r instanceof s)return r;if(r)return l(t[e+1],n)}return i.NA});const M=t=>(n,e)=>{const r=e.calc.flat(l(n[0],e)),o=a=>a instanceof s&&(t===void 0||a===t),f=()=>n[1]?e.calc.flat(e.calc.eval(n[1],e.frame)):"";return r instanceof A?L(r,[r,f()],a=>o(a)?1:0):o(r)?f():r};m("IFERROR",2,2,M()),m("IFNA",2,2,M(i.NA)),m("CHOOSE",2,255,(t,n)=>{const e=n.calc.flat(l(t[0],n));if(e instanceof A){const a=t.slice(1).map(c=>n.calc.flat(n.calc.eval(c,n.frame)));return L(e,a,c=>{const u=U(c);if(u instanceof s)return u;const h=Math.trunc(u)-1;return h<0||h>=a.length?i.VALUE:h})}const r=U(e);if(r instanceof s)return r;const o=Math.trunc(r),f=t[o];return o<1||f===void 0?i.VALUE:n.calc.eval(f,n.frame)}),m("SWITCH",3,d,(t,n)=>{const e=n.calc.scalar(l(t[0],n),n.frame);if(e instanceof s)return e;let r=1;for(;r+1<t.length;r+=2){const o=n.calc.scalar(l(t[r],n),n.frame);if(o instanceof s)return o;if(N(e,o)===0)return l(t[r+1],n)}return r<t.length?l(t[r],n):i.NA});function w(t,n){const e=[];let r;return O(t,n,(o,f)=>{if(r)return;if(o instanceof s){r=o;return}if(typeof o=="string"&&!f||o===null)return;const a=p(o);a instanceof s?r=a:e.push(a)}),r||(e.length===0?i.VALUE:e)}E("AND","(r)",(t,n)=>{const e=w(t,n);return e instanceof s?e:e.every(Boolean)}),E("OR","(r)",(t,n)=>{const e=w(t,n);return e instanceof s?e:e.some(Boolean)}),E("XOR","(r)",(t,n)=>{const e=w(t,n);return e instanceof s?e:e.filter(Boolean).length%2===1}),k("NOT",1,1,t=>{const n=p(t);return n instanceof s?n:!n}),E("TRUE","",()=>!0),E("FALSE","",()=>!1);const y=(t,n)=>n?{names:t,parent:n}:{names:t};m("LET",3,d,(t,n)=>{if(t.length%2===0)return i.VALUE;const e=new Map,r={...n.frame,scope:y(e,n.frame.scope)};for(let o=0;o+1<t.length;o+=2){const f=t[o];if(f?.kind!=="name")return i.VALUE;e.set(f.name.toLowerCase(),l(t[o+1],{...n,frame:r}))}return l(t[t.length-1],{...n,frame:r})}),m("LAMBDA",1,254,(t,n)=>{const e=[];for(const o of t.slice(0,-1)){if(o.kind!=="name")return i.VALUE;e.push(o.name.toLowerCase())}const r=t[t.length-1];return r?new R(e,r,n.frame):i.VALUE});
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as a,ERR as w,Matrix as O}from"../../values.js";import{cellName as V,columnLetter as g,MAX_COLUMNS as H,MAX_ROWS as K}from"../../address.js";import{sheetPrefix as q}from"../../formula/print.js";import{parseFormula as G}from"../../formula/parse.js";import{compare as $,toBool as U,toNumber as b,toText as W}from"../coerce.js";import{Missing as k,Reference as R,Union as F}from"../types.js";import{cellsOf as x,lazy as J,raw as E,scalar as Q}from"./define.js";import{hasWildcard as Y,indexKey as C,wildcard as Z}from"./criteria.js";const X=(n,t)=>typeof n==typeof t&&!(n instanceof a)&&n!==null;function T(n){if(n.rows===1)return{length:n.cols,at:t=>n.at(0,t)};if(n.cols===1)return{length:n.rows,at:t=>n.at(t,0)}}function P(n,t,e,o,r,s=0,c=1){const i=typeof n=="string"?n:void 0;if(r&&i!==void 0&&Y(i)){const u=Z(i);for(let d=s;d>=0&&d<t.length;d+=c){const m=t.at(d);if(typeof m=="string"&&u(m))return d}return-1}const f=C(n);if(f===void 0)return-1;const l=e.reference;if(l&&t.length>=64&&s===0&&c===1){const u=`find:${l.key}`;let d=o.calc.indexes.get(u);if(!d){d=new Map;for(let m=t.length-1;m>=0;m--){const h=C(t.at(m));h!==void 0&&d.set(h,[m])}o.calc.indexes.set(u,d)}return d.get(f)?.[0]??-1}for(let u=s;u>=0&&u<t.length;u+=c)if(C(t.at(u))===f)return u;return-1}function S(n,t,e=!1){let o=0,r=t.length-1,s=-1;for(;o<=r;){const c=o+r>>1;let i=c;for(;i>=o&&!X(t.at(i),n);)i-=1;if(i<o){o=c+1;continue}const f=$(t.at(i),n);(e?f>=0:f<=0)?(s=i,o=c+1):r=i-1}return s}const N=(n,t)=>t.calc.scalar(n??null,t.frame),v=(n,t,e)=>n===void 0||n instanceof k?e:U(t.calc.scalar(n,t.frame));function D(n){return(t,e)=>{const o=N(t[0],e);if(o instanceof a)return o;const r=x(t[1],e);if(r instanceof a)return r;const s=b(e.calc.scalar(t[2],e.frame));if(s instanceof a)return s;const c=Math.trunc(s);if(c<1)return w.VALUE;if(c>(n?r.cols:r.rows))return w.REF;const i=v(t[3],e,!0);if(i instanceof a)return i;const f={length:n?r.rows:r.cols,at:d=>n?r.at(d,0):r.at(0,d)},l={rows:n?r.rows:1,cols:n?1:r.cols,at:(d,m)=>r.at(d,m),...r.reference?{reference:new R(r.reference.sheet,r.reference.top,r.reference.left,n?r.reference.bottom:r.reference.top,n?r.reference.left:r.reference.right)}:{}},u=i?S(o,f):P(o,f,l,e,!0);return u<0?w.NA:n?r.at(u,c-1):r.at(c-1,u)}}E("VLOOKUP",3,4,D(!0)),E("HLOOKUP",3,4,D(!1)),E("MATCH",2,3,(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=x(n[1],t);if(o instanceof a)return o;const r=T(o);if(!r)return w.NA;const s=n[2]===void 0||n[2]instanceof k?1:b(t.calc.scalar(n[2],t.frame));if(s instanceof a)return s;const c=s===0?P(e,r,o,t,!0):S(e,r,s<0);return c<0?w.NA:c+1}),E("LOOKUP",2,3,(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=x(n[1],t);if(o instanceof a)return o;const r=o.rows>=o.cols,s={length:r?o.rows:o.cols,at:l=>r?o.at(l,0):o.at(0,l)},c=S(e,s);if(c<0)return w.NA;if(n[2]===void 0)return r?o.at(c,o.cols-1):o.at(o.rows-1,c);const i=x(n[2],t);if(i instanceof a)return i;const f=T(i);return f?f.at(c):w.NA});function _(n,t,e,o,r){const s=T(t);if(!s)return-1;const c=r===-1;if(Math.abs(r)===2){const u=S(n,s,r<0);if(u>=0&&$(s.at(u),n)===0)return u;if(o===0)return-1}const f=P(n,s,t,e,o===2,c?s.length-1:0,c?-1:1);if(f>=0||o===0||o===2)return f;let l=-1;for(let u=0;u<s.length;u++){const d=s.at(u);if(!X(d,n))continue;const m=$(d,n),h=l<0||(o<0?$(d,s.at(l))>0:$(d,s.at(l))<0);(o<0?m<0:m>0)&&h&&(l=u)}return l}const I=(n,t,e)=>{const o=(c,i)=>c===void 0||c instanceof k?i:b(e.calc.scalar(c,e.frame)),r=o(n,0);if(r instanceof a)return r;const s=o(t,1);return s instanceof a?s:[r,s]};E("XLOOKUP",3,6,(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=x(n[1],t);if(o instanceof a)return o;const r=x(n[2],t);if(r instanceof a)return r;const s=I(n[4],n[5],t);if(s instanceof a)return s;const c=_(e,o,t,s[0],s[1]);if(c<0){const f=n[3];return f===void 0||f instanceof k?w.NA:t.calc.flat(f)}if(o.cols===1){if(r.cols===1)return r.at(c,0);const f=[];for(let l=0;l<r.cols;l++)f.push(r.at(c,l));return new O(1,r.cols,f)}if(r.rows===1)return r.at(0,c);const i=[];for(let f=0;f<r.rows;f++)i.push(r.at(f,c));return new O(r.rows,1,i)}),E("XMATCH",2,4,(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=x(n[1],t);if(o instanceof a)return o;const r=I(n[2],n[3],t);if(r instanceof a)return r;const s=_(e,o,t,r[0],r[1]);return s<0?w.NA:s+1}),E("INDEX",2,4,(n,t)=>{let e=n[0];const o=h=>{if(h===void 0||h instanceof k)return 0;const p=b(t.calc.scalar(h,t.frame));return p instanceof a?p:Math.trunc(p)};if(e instanceof F){const h=o(n[3]??1);if(h instanceof a)return h;const p=e.parts[h-1];if(!p)return w.REF;e=p}if(e instanceof a)return e;const r=o(n[1]);if(r instanceof a)return r;const s=o(n[2]);if(s instanceof a)return s;if(r<0||s<0)return w.VALUE;if(e instanceof R){const h=n[2]===void 0&&e.rows===1,p=h?1:r,A=h?r:s;return p>e.rows||A>e.cols?w.REF:new R(e.sheet,p===0?e.top:e.top+p-1,A===0?e.left:e.left+A-1,p===0?e.bottom:e.top+p-1,A===0?e.right:e.left+A-1)}const c=x(e,t);if(c instanceof a)return c;const i=n[2]===void 0&&c.rows===1,f=i?1:r,l=i?r:s===0&&c.cols===1?1:s;if(f>c.rows||l>c.cols)return w.REF;if(f>0&&l>0)return c.at(f-1,l-1);const u=f===0?c.rows:1,d=l===0?c.cols:1,m=[];for(let h=0;h<u;h++)for(let p=0;p<d;p++)m.push(c.at(f===0?h:f-1,l===0?p:l-1));return new O(u,d,m)}),E("OFFSET",3,5,(n,t)=>{const e=n[0];if(e instanceof a)return e;if(!(e instanceof R))return w.VALUE;const o=(M,B)=>{if(M===void 0||M instanceof k)return B;const L=b(t.calc.scalar(M,t.frame));return L instanceof a?L:Math.trunc(L)},r=o(n[1],0),s=o(n[2],0),c=o(n[3],e.rows),i=o(n[4],e.cols);for(const M of[r,s,c,i])if(M instanceof a)return M;const[f,l,u,d]=[r,s,c,i];if(u===0||d===0)return w.REF;const m=e.top+(f??0),h=e.left+(l??0),p=m+(u??1)-1,A=h+(d??1)-1;return Math.min(m,p)<0||Math.min(h,A)<0||Math.max(m,p)>=K||Math.max(h,A)>=H?w.REF:new R(e.sheet,Math.min(m,p),Math.min(h,A),Math.max(m,p),Math.max(h,A))},{volatile:!0});const nn=/^(?:(.*)!)?R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?(?::R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?)?$/iu,y=(n,t)=>n===void 0?t:n.startsWith("[")?t+Number(n.slice(1,-1)):Number(n)-1;function tn(n,t,e){const o=nn.exec(n.trim());if(!o)return;const[,r,s,c,i,f]=o,l={row:y(s,t),col:y(c,e)};if(l.row<0||l.col<0)return;const u=V(l),d=r===void 0?"":`${r}!`;if(i===void 0&&f===void 0)return`${d}${u}`;const m={row:y(i,t),col:y(f,e)};return m.row<0||m.col<0?void 0:`${d}${u}:${V(m)}`}E("INDIRECT",1,2,(n,t)=>{const e=W(t.calc.scalar(n[0],t.frame));if(e instanceof a)return e;const o=n[1]===void 0?!0:U(t.calc.scalar(n[1],t.frame));if(o instanceof a)return o;const r=o?e:tn(e,t.frame.row,t.frame.col);if(r===void 0)return w.REF;const s=G(r);if(!s.ok)return w.REF;const{node:c}=s;if(c.kind!=="ref"&&c.kind!=="structured"&&c.kind!=="name"&&!(c.kind==="binary"&&c.op===":"))return w.REF;const i=t.calc.eval(c,{...t.frame,dr:0,dc:0});return i instanceof R||i instanceof F?i:w.REF},{volatile:!0});const j=(n,t,e)=>{if(n===void 0||n instanceof k)return t+1;if(n instanceof a)return n;if(!(n instanceof R))return w.VALUE;const[o,r]=e(n);if(r<=1)return o+1;const s=Array.from({length:r},(c,i)=>o+i+1);return e===z?new O(r,1,s):new O(1,r,s)},z=n=>[n.top,Math.min(n.rows,n.sheet.lastRow-n.top+1)],en=n=>[n.left,n.cols];E("ROW",0,1,(n,t)=>j(n[0],t.frame.row,z)),E("COLUMN",0,1,(n,t)=>j(n[0],t.frame.col,en)),E("ROWS",1,1,(n,t)=>{const e=n[0];if(e instanceof R)return e.rows;const o=x(e,t);return o instanceof a?o:o.rows}),E("COLUMNS",1,1,(n,t)=>{const e=n[0];if(e instanceof R)return e.cols;const o=x(e,t);return o instanceof a?o:o.cols}),E("AREAS",1,1,n=>{const t=n[0];return t instanceof R?1:t instanceof F?t.parts.length:w.VALUE}),Q("ADDRESS",2,5,(n,t,e,o,r)=>{const s=b(n),c=b(t),i=e==null?1:b(e);for(const M of[s,c,i])if(M instanceof a)return M;const[f,l,u]=[s,c,i];if((f??0)<1||(l??0)<1||(f??0)>K||(l??0)>H)return w.VALUE;const d=o==null?!0:U(o);if(d instanceof a)return d;const m=u===1||u===2,h=u===1||u===3,p=d?`${h?"$":""}${g((l??1)-1)}${m?"$":""}${String(f)}`:`R${m?String(f):`[${String(f)}]`}C${h?String(l):`[${String(l)}]`}`;if(r==null)return p;const A=W(r);return A instanceof a?A:`${q(A)}${p}`}),E("TRANSPOSE",1,1,(n,t)=>{const e=x(n[0],t);if(e instanceof a)return e;const o=[];for(let r=0;r<e.cols;r++)for(let s=0;s<e.rows;s++)o.push(e.at(s,r));return new O(e.cols,e.rows,o)}),J("SHEET",0,1,(n,t)=>{const e=n[0];if(e===void 0)return t.frame.sheet.index+1;const o=t.calc.eval(e,t.frame);if(o instanceof R)return o.sheet.index+1;const r=t.calc.scalar(o,t.frame);if(typeof r!="string")return w.NA;const s=t.calc.wb.sheet(r);return s?s.index+1:w.NA}),E("SHEETS",0,1,(n,t)=>t.calc.wb.sheets.length);
2
+ import{CellError as a,ERR as w,Matrix as k}from"../../values.js";import{cellName as P,columnLetter as B,MAX_COLUMNS as V,MAX_ROWS as K}from"../../address.js";import{sheetPrefix as q}from"../../formula/print.js";import{parseFormula as G}from"../../formula/parse.js";import{compare as v,toBool as L,toNumber as b,toText as H}from"../coerce.js";import{Missing as O,Reference as x,Union as U}from"../types.js";import{cellsOf as R,lazy as J,raw as E,scalar as Q}from"./define.js";import{indexKeyOf as Y}from"../indexes.js";import{hasWildcard as Z,indexKey as F,wildcard as g}from"./criteria.js";const W=(n,t)=>typeof n==typeof t&&!(n instanceof a)&&n!==null;function C(n){if(n.rows===1)return{length:n.cols,at:t=>n.at(0,t)};if(n.cols===1)return{length:n.rows,at:t=>n.at(t,0)}}function T(n,t,e,o,r,s=0,c=1){const i=typeof n=="string"?n:void 0;if(r&&i!==void 0&&Z(i)){const l=g(i);for(let d=s;d>=0&&d<t.length;d+=c){const m=t.at(d);if(typeof m=="string"&&l(m))return d}return-1}const f=F(n);if(f===void 0)return-1;const u=e.reference;if(u&&t.length>=64&&s===0&&c===1)return o.calc.indexes.of(Y("find",u),[u],()=>{const d=new Map;for(let m=t.length-1;m>=0;m--){const h=F(t.at(m));h!==void 0&&d.set(h,[m])}return d}).get(f)?.[0]??-1;for(let l=s;l>=0&&l<t.length;l+=c)if(F(t.at(l))===f)return l;return-1}function $(n,t,e=!1){let o=0,r=t.length-1,s=-1;for(;o<=r;){const c=o+r>>1;let i=c;for(;i>=o&&!W(t.at(i),n);)i-=1;if(i<o){o=c+1;continue}const f=v(t.at(i),n);(e?f>=0:f<=0)?(s=i,o=c+1):r=i-1}return s}const N=(n,t)=>t.calc.scalar(n??null,t.frame),nn=(n,t,e)=>n===void 0||n instanceof O?e:L(t.calc.scalar(n,t.frame));function X(n){return(t,e)=>{const o=N(t[0],e);if(o instanceof a)return o;const r=R(t[1],e);if(r instanceof a)return r;const s=b(e.calc.scalar(t[2],e.frame));if(s instanceof a)return s;const c=Math.trunc(s);if(c<1)return w.VALUE;if(c>(n?r.cols:r.rows))return w.REF;const i=nn(t[3],e,!0);if(i instanceof a)return i;const f={length:n?r.rows:r.cols,at:d=>n?r.at(d,0):r.at(0,d)},u={rows:n?r.rows:1,cols:n?1:r.cols,at:(d,m)=>r.at(d,m),...r.reference?{reference:new x(r.reference.sheet,r.reference.top,r.reference.left,n?r.reference.bottom:r.reference.top,n?r.reference.left:r.reference.right)}:{}},l=i?$(o,f):T(o,f,u,e,!0);return l<0?w.NA:n?r.at(l,c-1):r.at(c-1,l)}}E("VLOOKUP","vrv?v",X(!0)),E("HLOOKUP","vrv?v",X(!1)),E("MATCH","vr?v",(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=R(n[1],t);if(o instanceof a)return o;const r=C(o);if(!r)return w.NA;const s=n[2]===void 0||n[2]instanceof O?1:b(t.calc.scalar(n[2],t.frame));if(s instanceof a)return s;const c=s===0?T(e,r,o,t,!0):$(e,r,s<0);return c<0?w.NA:c+1}),E("LOOKUP","vr?r",(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=R(n[1],t);if(o instanceof a)return o;const r=o.rows>=o.cols,s={length:r?o.rows:o.cols,at:u=>r?o.at(u,0):o.at(0,u)},c=$(e,s);if(c<0)return w.NA;if(n[2]===void 0)return r?o.at(c,o.cols-1):o.at(o.rows-1,c);const i=R(n[2],t);if(i instanceof a)return i;const f=C(i);return f?f.at(c):w.NA});function D(n,t,e,o,r){const s=C(t);if(!s)return-1;const c=r===-1;if(Math.abs(r)===2){const l=$(n,s,r<0);if(l>=0&&v(s.at(l),n)===0)return l;if(o===0)return-1}const f=T(n,s,t,e,o===2,c?s.length-1:0,c?-1:1);if(f>=0||o===0||o===2)return f;let u=-1;for(let l=0;l<s.length;l++){const d=s.at(l);if(!W(d,n))continue;const m=v(d,n),h=u<0||(o<0?v(d,s.at(u))>0:v(d,s.at(u))<0);(o<0?m<0:m>0)&&h&&(u=l)}return u}const _=(n,t,e)=>{const o=(c,i)=>c===void 0||c instanceof O?i:b(e.calc.scalar(c,e.frame)),r=o(n,0);if(r instanceof a)return r;const s=o(t,1);return s instanceof a?s:[r,s]};E("XLOOKUP","vrr?rvv",(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=R(n[1],t);if(o instanceof a)return o;const r=R(n[2],t);if(r instanceof a)return r;const s=_(n[4],n[5],t);if(s instanceof a)return s;const c=D(e,o,t,s[0],s[1]);if(c<0){const f=n[3];return f===void 0||f instanceof O?w.NA:t.calc.flat(f)}if(o.cols===1){if(r.cols===1)return r.at(c,0);const f=[];for(let u=0;u<r.cols;u++)f.push(r.at(c,u));return new k(1,r.cols,f)}if(r.rows===1)return r.at(0,c);const i=[];for(let f=0;f<r.rows;f++)i.push(r.at(f,c));return new k(r.rows,1,i)}),E("XMATCH","vr?vv",(n,t)=>{const e=N(n[0],t);if(e instanceof a)return e;const o=R(n[1],t);if(o instanceof a)return o;const r=_(n[2],n[3],t);if(r instanceof a)return r;const s=D(e,o,t,r[0],r[1]);return s<0?w.NA:s+1}),E("INDEX","rv?vv",(n,t)=>{let e=n[0];const o=h=>{if(h===void 0||h instanceof O)return 0;const p=b(t.calc.scalar(h,t.frame));return p instanceof a?p:Math.trunc(p)};if(e instanceof U){const h=o(n[3]??1);if(h instanceof a)return h;const p=e.parts[h-1];if(!p)return w.REF;e=p}if(e instanceof a)return e;const r=o(n[1]);if(r instanceof a)return r;const s=o(n[2]);if(s instanceof a)return s;if(r<0||s<0)return w.VALUE;if(e instanceof x){const h=n[2]===void 0&&e.rows===1,p=h?1:r,A=h?r:s;return p>e.rows||A>e.cols?w.REF:new x(e.sheet,p===0?e.top:e.top+p-1,A===0?e.left:e.left+A-1,p===0?e.bottom:e.top+p-1,A===0?e.right:e.left+A-1)}const c=R(e,t);if(c instanceof a)return c;const i=n[2]===void 0&&c.rows===1,f=i?1:r,u=i?r:s===0&&c.cols===1?1:s;if(f>c.rows||u>c.cols)return w.REF;if(f>0&&u>0)return c.at(f-1,u-1);const l=f===0?c.rows:1,d=u===0?c.cols:1,m=[];for(let h=0;h<l;h++)for(let p=0;p<d;p++)m.push(c.at(f===0?h:f-1,u===0?p:u-1));return new k(l,d,m)}),E("OFFSET","rvv?vv",(n,t)=>{const e=n[0];if(e instanceof a)return e;if(!(e instanceof x))return w.VALUE;const o=(M,z)=>{if(M===void 0||M instanceof O)return z;const y=b(t.calc.scalar(M,t.frame));return y instanceof a?y:Math.trunc(y)},r=o(n[1],0),s=o(n[2],0),c=o(n[3],e.rows),i=o(n[4],e.cols);for(const M of[r,s,c,i])if(M instanceof a)return M;const[f,u,l,d]=[r,s,c,i];if(l===0||d===0)return w.REF;const m=e.top+(f??0),h=e.left+(u??0),p=m+(l??1)-1,A=h+(d??1)-1;return Math.min(m,p)<0||Math.min(h,A)<0||Math.max(m,p)>=K||Math.max(h,A)>=V?w.REF:new x(e.sheet,Math.min(m,p),Math.min(h,A),Math.max(m,p),Math.max(h,A))},{volatile:!0});const tn=/^(?:(.*)!)?R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?(?::R(\[-?\d+\]|\d+)?C(\[-?\d+\]|\d+)?)?$/iu,S=(n,t)=>n===void 0?t:n.startsWith("[")?t+Number(n.slice(1,-1)):Number(n)-1;function en(n,t,e){const o=tn.exec(n.trim());if(!o)return;const[,r,s,c,i,f]=o,u={row:S(s,t),col:S(c,e)};if(u.row<0||u.col<0)return;const l=P(u),d=r===void 0?"":`${r}!`;if(i===void 0&&f===void 0)return`${d}${l}`;const m={row:S(i,t),col:S(f,e)};return m.row<0||m.col<0?void 0:`${d}${l}:${P(m)}`}E("INDIRECT","v?v",(n,t)=>{const e=H(t.calc.scalar(n[0],t.frame));if(e instanceof a)return e;const o=n[1]===void 0?!0:L(t.calc.scalar(n[1],t.frame));if(o instanceof a)return o;const r=o?e:en(e,t.frame.row,t.frame.col);if(r===void 0)return w.REF;const s=G(r);if(!s.ok)return w.REF;const{node:c}=s;if(c.kind!=="ref"&&c.kind!=="structured"&&c.kind!=="name"&&!(c.kind==="binary"&&c.op===":"))return w.REF;const i=t.calc.eval(c,{...t.frame,dr:0,dc:0});return i instanceof x||i instanceof U?i:w.REF},{volatile:!0});const I=(n,t,e)=>{if(n===void 0||n instanceof O)return t+1;if(n instanceof a)return n;if(!(n instanceof x))return w.VALUE;const[o,r]=e(n);if(r<=1)return o+1;const s=Array.from({length:r},(c,i)=>o+i+1);return e===j?new k(r,1,s):new k(1,r,s)},j=n=>[n.top,Math.min(n.rows,n.sheet.lastRow-n.top+1)],rn=n=>[n.left,n.cols];E("ROW","?r",(n,t)=>I(n[0],t.frame.row,j)),E("COLUMN","?r",(n,t)=>I(n[0],t.frame.col,rn)),E("ROWS","r",(n,t)=>{const e=n[0];if(e instanceof x)return e.rows;const o=R(e,t);return o instanceof a?o:o.rows}),E("COLUMNS","r",(n,t)=>{const e=n[0];if(e instanceof x)return e.cols;const o=R(e,t);return o instanceof a?o:o.cols}),E("AREAS","r",n=>{const t=n[0];return t instanceof x?1:t instanceof U?t.parts.length:w.VALUE}),Q("ADDRESS",2,5,(n,t,e,o,r)=>{const s=b(n),c=b(t),i=e==null?1:b(e);for(const M of[s,c,i])if(M instanceof a)return M;const[f,u,l]=[s,c,i];if((f??0)<1||(u??0)<1||(f??0)>K||(u??0)>V)return w.VALUE;const d=o==null?!0:L(o);if(d instanceof a)return d;const m=l===1||l===2,h=l===1||l===3,p=d?`${h?"$":""}${B((u??1)-1)}${m?"$":""}${String(f)}`:`R${m?String(f):`[${String(f)}]`}C${h?String(u):`[${String(u)}]`}`;if(r==null)return p;const A=H(r);return A instanceof a?A:`${q(A)}${p}`}),E("TRANSPOSE","r",(n,t)=>{const e=R(n[0],t);if(e instanceof a)return e;const o=[];for(let r=0;r<e.cols;r++)for(let s=0;s<e.rows;s++)o.push(e.at(s,r));return new k(e.cols,e.rows,o)}),J("SHEET",0,1,(n,t)=>{const e=n[0];if(e===void 0)return t.frame.sheet.index+1;const o=t.calc.eval(e,t.frame);if(o instanceof x)return o.sheet.index+1;const r=t.calc.scalar(o,t.frame);if(typeof r!="string")return w.NA;const s=t.calc.wb.sheet(r);return s?s.index+1:w.NA}),E("SHEETS","?r",(n,t)=>t.calc.wb.sheets.length);
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as a,ERR as l,Matrix as R}from"../../values.js";import{toBool as q,toNumber as A}from"../coerce.js";import{Reference as P,Union as ot}from"../types.js";import{FUNCTIONS as ct,alias as O,cellsOf as B,eachRow as ft,many as y,number as U,numbersOf as T,raw as N,scalar as S}from"./define.js";import{besselI as it,besselJ as at,besselK as ut,besselY as lt,betaI as K,gammaQ as ht,normalCdf as mt}from"./special.js";const X=2**48;function H(e,r){const[t="0",n="0"]=e.toExponential().split("e");return+`${t}e${String(Number(n)+r)}`}const Mt=e=>Number(e.toPrecision(15));function G(e,r,t){const n=Math.trunc(r),s=Math.abs(Mt(e)),o=H(s,n);if(o>=2**53)return e;const c=H(t(o),-n);return e<0?-c:c}S("ROUND",2,2,U((e=0,r=0)=>G(e,r,t=>Math.floor(t+.5)))),S("ROUNDUP",2,2,U((e=0,r=0)=>G(e,r,Math.ceil))),S("ROUNDDOWN",2,2,U((e=0,r=0)=>G(e,r,Math.floor))),S("MOD",2,2,U((e=0,r=0)=>{if(r===0)return l.DIV0;const t=e%r;return t!==0&&t<0!=r<0?t+r:t})),S("QUOTIENT",2,2,U((e=0,r=0)=>r===0?l.DIV0:Math.trunc(e/r))),S("POWER",2,2,U((e=0,r=0)=>{if(e===0&&r===0)return l.NUM;if(e===0&&r<0)return l.DIV0;const t=e**r;return Number.isFinite(t)?t:l.NUM})),S("LOG",1,2,(e,r)=>{const t=A(e),n=r==null?10:A(r);return t instanceof a?t:n instanceof a?n:t<=0||n<=0?l.NUM:n===1?l.DIV0:n===10?Math.log10(t):n===2?Math.log2(t):Math.log(t)/Math.log(n)});function v(e,r){let[t,n]=[e,r];for(;n!==0;)[t,n]=[n,t%n];return t}function Y(e,r){const t=T(e,r);if(t instanceof a)return t;const n=t.map(Math.trunc);return n.some(s=>s<0||s>=2**53)?l.NUM:n}N("GCD",1,y,(e,r)=>{const t=Y(e,r);return t instanceof a?t:t.reduce(v,0)}),N("LCM",1,y,(e,r)=>{const t=Y(e,r);if(t instanceof a)return t;if(t.includes(0))return 0;const n=t.reduce((s,o)=>s*o/v(s,o),1);return Number.isFinite(n)?n:l.NUM}),S("BASE",2,3,U((e=0,r=0,t=Number.NaN)=>{const n=Math.trunc(e),s=Math.trunc(r),o=Number.isNaN(t)?0:Math.trunc(t);return n<0||n>=2**53||s<2||s>36||o<0||o>255?l.NUM:n.toString(s).toUpperCase().padStart(o,"0")}));const dt="MDCLXVI",z=[1e3,500,100,50,10,5,1];function Nt(e,r){const t=i=>z[i]??1,n=i=>dt.charAt(i),s=z.length-1;let o=e,c="";for(let i=0;i<=s/2;i++){const f=2*i,u=Math.floor(o/t(f));if(u%5===4){const h=u===4?f-1:f-2;let m=f,M=0;for(;M<r&&m<s;)M+=1,t(h)-t(m+1)<=o?m+=1:M=r;c+=n(m)+n(h),o+=t(m)-t(h)}else u>4&&(c+=n(f-1)),c+=n(f).repeat(u%5),o%=t(f)}return c}S("ROMAN",1,2,(e,r)=>{const t=A(e);if(t instanceof a)return t;let n=0;if(typeof r=="boolean")n=r?0:4;else if(r!=null){const o=A(r);if(o instanceof a)return o;n=Math.trunc(o)}const s=Math.trunc(t);return s<0||s>3999||n<0||n>4?l.VALUE:Nt(s,n)});function k(e){return!Number.isInteger(e)||e<0||e>=X?l.NUM:BigInt(e)}for(const[e,r]of[["BITAND",(t,n)=>t&n],["BITOR",(t,n)=>t|n],["BITXOR",(t,n)=>t^n]])S(e,2,2,U((t=0,n=0)=>{const s=k(t),o=k(n);return s instanceof a?s:o instanceof a?o:Number(r(s,o))}));for(const[e,r]of[["BITLSHIFT",1],["BITRSHIFT",-1]])S(e,2,2,U((t=0,n=0)=>{const s=k(t);if(s instanceof a)return s;const o=Math.trunc(n)*r;if(Math.abs(o)>53)return l.NUM;const c=o>=0?s<<BigInt(o):s>>BigInt(-o);return c>=BigInt(X)?l.NUM:Number(c)}));for(const[e,r,t]of[["BESSELJ",at,!1],["BESSELI",it,!1],["BESSELY",lt,!0],["BESSELK",ut,!0]])S(e,2,2,U((n=0,s=0)=>{const o=Math.trunc(s);if(o<0||t&&n<=0)return l.NUM;const c=r(o,n);return Number.isFinite(c)?c:l.NUM}));S("SLN",3,3,U((e=0,r=0,t=0)=>t===0?l.DIV0:(e-r)/t)),N("GEOMEAN",1,y,(e,r)=>{const t=T(e,r);return t instanceof a?t:t.length===0||t.some(n=>n<=0)?l.NUM:Math.exp(t.reduce((n,s)=>n+Math.log(s),0)/t.length)}),N("HARMEAN",1,y,(e,r)=>{const t=T(e,r);return t instanceof a?t:t.length===0||t.some(n=>n<=0)?l.NUM:t.length/t.reduce((n,s)=>n+1/s,0)}),N("KURT",1,y,(e,r)=>{const t=T(e,r);if(t instanceof a)return t;const n=t.length;if(n<4)return l.DIV0;const s=t.reduce((i,f)=>i+f,0)/n,o=t.reduce((i,f)=>i+(f-s)**2,0)/(n-1);if(o===0)return l.DIV0;const c=t.reduce((i,f)=>i+(f-s)**4,0)/o**2;return n*(n+1)/((n-1)*(n-2)*(n-3))*c-3*(n-1)**2/((n-2)*(n-3))});function W(e,r){const t=[];let n;return ft(e,r,(s,o)=>{if(!n){if(s instanceof a)n=s;else if(typeof s=="number")t.push(s);else if(o&&s!==null){const c=A(s);c instanceof a?n=c:t.push(c)}}}),n??t}N("MODE.SNGL",1,y,(e,r)=>{const t=W(e,r);if(t instanceof a)return t;const n=new Map;for(const c of t)n.set(c,(n.get(c)??0)+1);let s,o=1;for(const[c,i]of n)i>o&&(s=c,o=i);return s??l.NA}),O("MODE","MODE.SNGL"),N("MODE.MULT",1,y,(e,r)=>{const t=W(e,r);if(t instanceof a)return t;const n=new Map;for(const c of t)n.set(c,(n.get(c)??0)+1);let s=0;for(const c of n.values())s=Math.max(s,c);if(s<2)return l.NA;const o=[...n].filter(([,c])=>c===s).map(([c])=>c);return new R(o.length,1,o)});function pt(e,r){const t=r*(e.length-1),n=Math.floor(t),s=e[n]??0,o=e[n+1]??s;return s+(t-n)*(o-s)}N("QUARTILE.INC",2,2,(e,r)=>{const t=T([e[0]],r);if(t instanceof a)return t;const n=A(r.calc.scalar(e[1],r.frame));if(n instanceof a)return n;const s=Math.trunc(n);return t.length===0||s<0||s>4?l.NUM:pt([...t].sort((o,c)=>o-c),s/4)}),O("QUARTILE","QUARTILE.INC");function Z(e,r){const t=A(r.calc.scalar(e[0],r.frame));if(t instanceof a)return t;const n=T([e[1]],r);if(n instanceof a)return n;const s=e[2]===void 0?0:A(r.calc.scalar(e[2],r.frame));if(s instanceof a)return s;const o=n.filter(c=>c===t).length;return o===0?l.NA:{before:n.filter(c=>s===0?c>t:c<t).length,ties:o}}N("RANK.EQ",2,3,(e,r)=>{const t=Z(e,r);return t instanceof a?t:t.before+1}),N("RANK.AVG",2,3,(e,r)=>{const t=Z(e,r);return t instanceof a?t:t.before+(t.ties+1)/2}),O("RANK","RANK.EQ");function w(e,r){const t=B(e,r);if(t instanceof a)return t;const n=[];for(let s=0;s<t.rows;s++){const o=[];for(let c=0;c<t.cols;c++){const i=t.at(s,c);if(i instanceof a)return i;if(typeof i!="number")return l.VALUE;o.push(i)}n.push(o)}return n}const _=e=>new R(e.length,e[0]?.length??0,e.flat());function Et(e,r){const t=r[0]?.length??0;return e.map(n=>Array.from({length:t},(s,o)=>n.reduce((c,i,f)=>c+i*(r[f]?.[o]??0),0)))}N("MMULT",2,2,(e,r)=>{const t=w(e[0],r),n=w(e[1],r);return t instanceof a?t:n instanceof a?n:(t[0]?.length??0)!==n.length?l.VALUE:_(Et(t,n))});function x(e){const r=e.length,t=e.map((o,c)=>[...o,...Array.from({length:r},(i,f)=>c===f?1:0)]),n=(o,c)=>t[o]?.[c]??0;let s=1;for(let o=0;o<r;o++){let c=o;for(let f=o+1;f<r;f++)Math.abs(n(f,o))>Math.abs(n(c,o))&&(c=f);if(n(c,o)===0)return{determinant:0};if(c!==o){const[f=[],u=[]]=[t[o],t[c]];t[o]=u,t[c]=f,s=-s}const i=n(o,o);s*=i,t[o]=(t[o]??[]).map(f=>f/i);for(let f=0;f<r;f++){if(f===o)continue;const u=n(f,o),h=t[o]??[];t[f]=(t[f]??[]).map((m,M)=>m-u*(h[M]??0))}}return{determinant:s,inverse:t.map(o=>o.slice(r))}}const J=e=>e.length>0&&e.every(r=>r.length===e.length);N("MDETERM",1,1,(e,r)=>{const t=w(e[0],r);return t instanceof a?t:J(t)?x(t).determinant:l.VALUE}),N("MINVERSE",1,1,(e,r)=>{const t=w(e[0],r);if(t instanceof a)return t;if(!J(t))return l.VALUE;const{inverse:n}=x(t);return n?_(n):l.NUM}),S("MUNIT",1,1,U((e=0)=>{const r=Math.trunc(e);return r<1||r>73?l.VALUE:_(Array.from({length:r},(t,n)=>Array.from({length:r},(s,o)=>n===o?1:0)))}));function F(e,r,t){const n=B(e,t),s=B(r,t);if(n instanceof a)return n;if(s instanceof a)return s;if(n.rows*n.cols!==s.rows*s.cols)return l.NA;const o=[],c=[];for(let i=0;i<n.rows;i++)for(let f=0;f<n.cols;f++){const u=n.at(i,f),h=s.rows===n.rows?s.at(i,f):s.at(f,i);if(u instanceof a)return u;if(h instanceof a)return h;typeof u=="number"&&typeof h=="number"&&(o.push(u),c.push(h))}return{xs:o,ys:c}}for(const[e,r]of[["SUMX2MY2",(t,n)=>t*t-n*n],["SUMX2PY2",(t,n)=>t*t+n*n],["SUMXMY2",(t,n)=>(t-n)**2]])N(e,2,2,(t,n)=>{const s=F(t[0],t[1],n);return s instanceof a?s:s.xs.length===0?l.DIV0:s.xs.reduce((o,c,i)=>o+r(c,s.ys[i]??0),0)});N("SERIESSUM",4,4,(e,r)=>{const[t,n,s]=e.slice(0,3).map(c=>A(r.calc.scalar(c,r.frame)));if(t instanceof a)return t;if(n instanceof a)return n;if(s instanceof a)return s;const o=T([e[3]],r);return o instanceof a?o:o.reduce((c,i,f)=>c+i*(t??0)**((n??0)+f*(s??0)),0)}),N("FREQUENCY",2,2,(e,r)=>{const t=T([e[0]],r),n=T([e[1]],r);if(t instanceof a)return t;if(n instanceof a)return n;const s=n.map((c,i)=>({b:c,i})).sort((c,i)=>c.b-i.b),o=new Array(n.length+1).fill(0);for(const c of t){const i=s.find(u=>c<=u.b),f=i?i.i:n.length;o[f]=(o[f]??0)+1}return new R(o.length,1,o)}),N("PROB",3,4,(e,r)=>{const t=F(e[0],e[1],r);if(t instanceof a)return t;const n=A(r.calc.scalar(e[2],r.frame));if(n instanceof a)return n;const s=e[3]===void 0?n:A(r.calc.scalar(e[3],r.frame));if(s instanceof a)return s;const o=t.ys.reduce((c,i)=>c+i,0);return t.ys.some(c=>c<=0||c>1)||Math.abs(o-1)>1e-12?l.NUM:t.xs.reduce((c,i,f)=>i>=n&&i<=s?c+(t.ys[f]??0):c,0)});const $=e=>e.reduce((r,t)=>r+t,0);function j(e,r,t){const n=r.map(u=>t?[...u,1]:[...u]),s=n[0]?.length??0,o=Array.from({length:s},(u,h)=>Array.from({length:s},(m,M)=>n.reduce((E,g)=>E+(g[h]??0)*(g[M]??0),0))),{inverse:c}=x(o);if(!c)return;const i=Array.from({length:s},(u,h)=>n.reduce((m,M,E)=>m+(M[h]??0)*(e[E]??0),0)),f=c.map(u=>u.reduce((h,m,M)=>h+m*(i[M]??0),0));return t?f:[...f,0]}function tt(e,r,t){const n=w(e[0],r);if(n instanceof a)return n;const s=n.length===1,o=n.flat();if(t&&o.some(h=>h<=0))return l.NUM;const c=t?o.map(Math.log):o,i=e[1];if(i===void 0||!C(i))return{ys:c,xs:o.map((h,m)=>[m+1]),byRow:s};const f=w(i,r);if(f instanceof a)return f;const u=f[0]?.length??0;return s?u!==c.length?l.REF:{ys:c,xs:Array.from({length:u},(h,m)=>f.map(M=>M[m]??0)),byRow:s}:f.length!==c.length?l.REF:{ys:c,xs:f,byRow:s}}const C=e=>e instanceof P||e instanceof R||typeof e=="number",nt=(e,r)=>e===void 0||!C(e)&&typeof e!="boolean"?!0:q(r.calc.scalar(e,r.frame));function et(e){return(r,t)=>{const n=tt(r,t,e);if(n instanceof a)return n;const s=nt(r[3],t);if(s instanceof a)return s;const o=j(n.ys,n.xs,s);if(!o)return l.NUM;const c=r[2];let i=n.xs;if(c!==void 0&&C(c)){const u=w(c,t);if(u instanceof a)return u;const h=n.xs[0]?.length??1,m=u[0]?.length??0;i=n.byRow||h===1&&u.length===1?Array.from({length:m},(M,E)=>u.map(g=>g[E]??0)):u}const f=i.map(u=>{const h=u.reduce((m,M,E)=>m+M*(o[E]??0),0)+(o[u.length]??0);return e?Math.exp(h):h});return n.byRow?new R(1,f.length,f):new R(f.length,1,f)}}N("TREND",1,4,et(!1)),N("GROWTH",1,4,et(!0));function gt(e,r,t,n){const s=r.map(p=>n?[...p,1]:[...p]),o=s[0]?.length??0,{inverse:c}=x(Array.from({length:o},(p,d)=>Array.from({length:o},(b,D)=>s.reduce((st,Q)=>st+(Q[d]??0)*(Q[D]??0),0))));if(!c)return;const i=r.map(p=>p.reduce((d,b,D)=>d+b*(t[D]??0),0)+(t[p.length]??0)),f=e.reduce((p,d,b)=>p+(d-(i[b]??0))**2,0),u=n?$(e)/e.length:0,h=e.reduce((p,d)=>p+(d-u)**2,0),m=h-f,M=e.length-o,E=M>0?f/M:0,g=c.map((p,d)=>Math.sqrt(Math.max(0,(p[d]??0)*E))),I=r[0]?.length??0;return{errors:g,r2:h===0?1:m/h,sey:Math.sqrt(E),f:M>0&&f>0?m/I/(f/M):0,df:M,ssreg:m,ssresid:f}}function rt(e){return(r,t)=>{const n=tt(r,t,e);if(n instanceof a)return n;const s=nt(r[2],t);if(s instanceof a)return s;const o=j(n.ys,n.xs,s);if(!o)return l.NUM;const i=[...o.slice(0,-1).reverse(),o[o.length-1]??0],f=e?i.map(Math.exp):i,u=r[3],h=u===void 0||!At(u)?!1:q(t.calc.scalar(u,t.frame));if(h instanceof a)return h;if(!h)return new R(1,f.length,f);const m=gt(n.ys,n.xs,o,s);if(!m)return l.NUM;const M=f.length,E=I=>[...I,...new Array(M-I.length).fill(l.NA)],g=s?[...m.errors.slice(0,-1).reverse(),m.errors[m.errors.length-1]??0]:[...[...m.errors].reverse(),l.NA];return new R(5,M,[...f,...g,...E([m.r2,m.sey]),...E([m.f,m.df]),...E([m.ssreg,m.ssresid])])}}const At=e=>C(e)||typeof e=="boolean";N("LINEST",1,4,rt(!1)),N("LOGEST",1,4,rt(!0));const V=e=>$(e)/e.length,L=e=>{const r=V(e);return e.reduce((t,n)=>t+(n-r)**2,0)/(e.length-1)};N("CHISQ.TEST",2,2,(e,r)=>{const t=w(e[0],r),n=w(e[1],r);if(t instanceof a)return t;if(n instanceof a)return n;const s=t.length,o=t[0]?.length??0;if(n.length!==s||(n[0]?.length??0)!==o)return l.NA;if(s*o<2)return l.NA;let c=0;for(let f=0;f<s;f++)for(let u=0;u<o;u++){const h=n[f]?.[u]??0;if(h<0)return l.NUM;if(h===0)return l.DIV0;c+=((t[f]?.[u]??0)-h)**2/h}const i=s>1&&o>1?(s-1)*(o-1):s>1?s-1:o-1;return ht(i/2,c/2)}),O("CHITEST","CHISQ.TEST"),N("T.TEST",4,4,(e,r)=>{const t=A(r.calc.scalar(e[2],r.frame)),n=A(r.calc.scalar(e[3],r.frame));if(t instanceof a)return t;if(n instanceof a)return n;const s=Math.trunc(t),o=Math.trunc(n);if(s!==1&&s!==2||o<1||o>3)return l.NUM;let c,i;if(o===1){const u=F(e[0],e[1],r);if(u instanceof a)return u;const h=u.xs.map((m,M)=>m-(u.ys[M]??0));if(h.length<2)return l.DIV0;c=V(h)/Math.sqrt(L(h)/h.length),i=h.length-1}else{const u=T([e[0]],r),h=T([e[1]],r);if(u instanceof a)return u;if(h instanceof a)return h;if(u.length<2||h.length<2)return l.DIV0;const[m,M,E,g]=[L(u),L(h),u.length,h.length],I=Math.abs(V(u)-V(h));if(o===2){i=E+g-2;const p=((E-1)*m+(g-1)*M)/i;c=I/Math.sqrt(p*(1/E+1/g))}else{const p=m/E,d=M/g;c=I/Math.sqrt(p+d),i=(p+d)**2/(p**2/(E-1)+d**2/(g-1))}}return Number.isFinite(c)?K(i/2,.5,i/(i+c*c))*s/2:l.DIV0}),O("TTEST","T.TEST"),N("F.TEST",2,2,(e,r)=>{const t=T([e[0]],r),n=T([e[1]],r);if(t instanceof a)return t;if(n instanceof a)return n;if(t.length<2||n.length<2)return l.DIV0;const[s,o]=[L(t),L(n)];if(s===0||o===0)return l.DIV0;const c=s/o,[i,f]=[t.length-1,n.length-1],u=K(f/2,i/2,f/(i*c+f));return 2*Math.min(u,1-u)}),O("FTEST","F.TEST"),N("Z.TEST",2,3,(e,r)=>{const t=T([e[0]],r);if(t instanceof a)return t;const n=A(r.calc.scalar(e[1],r.frame));if(n instanceof a)return n;if(t.length===0)return l.NA;const s=e[2]===void 0?t.length<2?l.DIV0:Math.sqrt(L(t)):A(r.calc.scalar(e[2],r.frame));return s instanceof a?s:s===0?l.DIV0:1-mt((V(t)-n)/(s/Math.sqrt(t.length)))}),O("ZTEST","Z.TEST");const Tt={1:"AVERAGE",2:"COUNT",3:"COUNTA",4:"MAX",5:"MIN",6:"PRODUCT",7:"STDEV.S",8:"STDEV.P",9:"SUM",10:"VAR.S",11:"VAR.P",12:"MEDIAN",13:"MODE.SNGL",14:"LARGE",15:"SMALL",16:"PERCENTILE.INC",17:"QUARTILE.INC",18:"PERCENTILE.EXC",19:"QUARTILE.EXC"};N("AGGREGATE",3,y,(e,r)=>{const t=A(r.calc.scalar(e[0],r.frame)),n=A(r.calc.scalar(e[1],r.frame));if(t instanceof a)return t;if(n instanceof a)return n;const s=Tt[Math.trunc(t)],o=s===void 0?void 0:ct.get(s);if(o?.kind!=="raw")return l.VALUE;const c=![2,3,6,7].includes(Math.trunc(n)),i=[1,3,5,7].includes(Math.trunc(n)),f=M=>{const E=M instanceof ot?M.parts:[M],g=[];for(const p of E)if(p instanceof P){const d=p;for(let b=d.top;b<=Math.min(d.bottom,d.sheet.lastRow);b++)if(!(i&&(d.sheet.spec.rows?.[String(b+1)]?.hidden===!0||r.calc.filtered(d.sheet).has(b))))for(let D=d.left;D<=d.right;D++)g.push(r.calc.read(d.sheet,b,D))}else{const d=r.calc.flat(p);d instanceof R?g.push(...d.data):g.push(d)}const I=c?g:g.filter(p=>!(p instanceof a));return new R(I.length,1,I)},u=Math.trunc(t)>=14,h=e.slice(2),m=u?[f(h[0]),...h.slice(1)]:h.map(f);return o.call(m,r)});
2
+ import{CellError as a,ERR as l,Matrix as R}from"../../values.js";import{toBool as _,toNumber as A}from"../coerce.js";import{Reference as Q,Union as st}from"../types.js";import{FUNCTIONS as ot,alias as O,cellsOf as v,eachRow as ct,number as U,numbersOf as S,raw as N,scalar as T}from"./define.js";import{besselI as it,besselJ as ft,besselK as at,besselY as ut,betaI as q,gammaQ as lt,normalCdf as ht}from"./special.js";const P=2**48;function K(e,r){const[t="0",n="0"]=e.toExponential().split("e");return+`${t}e${String(Number(n)+r)}`}const Mt=e=>Number(e.toPrecision(15));function C(e,r,t){const n=Math.trunc(r),s=Math.abs(Mt(e)),o=K(s,n);if(o>=2**53)return e;const c=K(t(o),-n);return e<0?-c:c}T("ROUND",2,2,U((e=0,r=0)=>C(e,r,t=>Math.floor(t+.5)))),T("ROUNDUP",2,2,U((e=0,r=0)=>C(e,r,Math.ceil))),T("ROUNDDOWN",2,2,U((e=0,r=0)=>C(e,r,Math.floor))),T("MOD",2,2,U((e=0,r=0)=>{if(r===0)return l.DIV0;const t=e%r;return t!==0&&t<0!=r<0?t+r:t})),T("QUOTIENT",2,2,U((e=0,r=0)=>r===0?l.DIV0:Math.trunc(e/r))),T("POWER",2,2,U((e=0,r=0)=>{if(e===0&&r===0)return l.NUM;if(e===0&&r<0)return l.DIV0;const t=e**r;return Number.isFinite(t)?t:l.NUM})),T("LOG",1,2,(e,r)=>{const t=A(e),n=r==null?10:A(r);return t instanceof a?t:n instanceof a?n:t<=0||n<=0?l.NUM:n===1?l.DIV0:n===10?Math.log10(t):n===2?Math.log2(t):Math.log(t)/Math.log(n)});function X(e,r){let[t,n]=[e,r];for(;n!==0;)[t,n]=[n,t%n];return t}function H(e,r){const t=S(e,r);if(t instanceof a)return t;const n=t.map(Math.trunc);return n.some(s=>s<0||s>=2**53)?l.NUM:n}N("GCD","(r)",(e,r)=>{const t=H(e,r);return t instanceof a?t:t.reduce(X,0)}),N("LCM","(r)",(e,r)=>{const t=H(e,r);if(t instanceof a)return t;if(t.includes(0))return 0;const n=t.reduce((s,o)=>s*o/X(s,o),1);return Number.isFinite(n)?n:l.NUM}),T("BASE",2,3,U((e=0,r=0,t=Number.NaN)=>{const n=Math.trunc(e),s=Math.trunc(r),o=Number.isNaN(t)?0:Math.trunc(t);return n<0||n>=2**53||s<2||s>36||o<0||o>255?l.NUM:n.toString(s).toUpperCase().padStart(o,"0")}));const mt="MDCLXVI",Y=[1e3,500,100,50,10,5,1];function Nt(e,r){const t=f=>Y[f]??1,n=f=>mt.charAt(f),s=Y.length-1;let o=e,c="";for(let f=0;f<=s/2;f++){const i=2*f,u=Math.floor(o/t(i));if(u%5===4){const h=u===4?i-1:i-2;let M=i,m=0;for(;m<r&&M<s;)m+=1,t(h)-t(M+1)<=o?M+=1:m=r;c+=n(M)+n(h),o+=t(M)-t(h)}else u>4&&(c+=n(i-1)),c+=n(i).repeat(u%5),o%=t(i)}return c}T("ROMAN",1,2,(e,r)=>{const t=A(e);if(t instanceof a)return t;let n=0;if(typeof r=="boolean")n=r?0:4;else if(r!=null){const o=A(r);if(o instanceof a)return o;n=Math.trunc(o)}const s=Math.trunc(t);return s<0||s>3999||n<0||n>4?l.VALUE:Nt(s,n)});function B(e){return!Number.isInteger(e)||e<0||e>=P?l.NUM:BigInt(e)}for(const[e,r]of[["BITAND",(t,n)=>t&n],["BITOR",(t,n)=>t|n],["BITXOR",(t,n)=>t^n]])T(e,2,2,U((t=0,n=0)=>{const s=B(t),o=B(n);return s instanceof a?s:o instanceof a?o:Number(r(s,o))}));for(const[e,r]of[["BITLSHIFT",1],["BITRSHIFT",-1]])T(e,2,2,U((t=0,n=0)=>{const s=B(t);if(s instanceof a)return s;const o=Math.trunc(n)*r;if(Math.abs(o)>53)return l.NUM;const c=o>=0?s<<BigInt(o):s>>BigInt(-o);return c>=BigInt(P)?l.NUM:Number(c)}));for(const[e,r,t]of[["BESSELJ",ft,!1],["BESSELI",it,!1],["BESSELY",ut,!0],["BESSELK",at,!0]])T(e,2,2,U((n=0,s=0)=>{const o=Math.trunc(s);if(o<0||t&&n<=0)return l.NUM;const c=r(o,n);return Number.isFinite(c)?c:l.NUM}));T("SLN",3,3,U((e=0,r=0,t=0)=>t===0?l.DIV0:(e-r)/t)),N("GEOMEAN","(r)",(e,r)=>{const t=S(e,r);return t instanceof a?t:t.length===0||t.some(n=>n<=0)?l.NUM:Math.exp(t.reduce((n,s)=>n+Math.log(s),0)/t.length)}),N("HARMEAN","(r)",(e,r)=>{const t=S(e,r);return t instanceof a?t:t.length===0||t.some(n=>n<=0)?l.NUM:t.length/t.reduce((n,s)=>n+1/s,0)}),N("KURT","(r)",(e,r)=>{const t=S(e,r);if(t instanceof a)return t;const n=t.length;if(n<4)return l.DIV0;const s=t.reduce((f,i)=>f+i,0)/n,o=t.reduce((f,i)=>f+(i-s)**2,0)/(n-1);if(o===0)return l.DIV0;const c=t.reduce((f,i)=>f+(i-s)**4,0)/o**2;return n*(n+1)/((n-1)*(n-2)*(n-3))*c-3*(n-1)**2/((n-2)*(n-3))});function z(e,r){const t=[];let n;return ct(e,r,(s,o)=>{if(!n){if(s instanceof a)n=s;else if(typeof s=="number")t.push(s);else if(o&&s!==null){const c=A(s);c instanceof a?n=c:t.push(c)}}}),n??t}N("MODE.SNGL","(r)",(e,r)=>{const t=z(e,r);if(t instanceof a)return t;const n=new Map;for(const c of t)n.set(c,(n.get(c)??0)+1);let s,o=1;for(const[c,f]of n)f>o&&(s=c,o=f);return s??l.NA}),O("MODE","MODE.SNGL"),N("MODE.MULT","(r)",(e,r)=>{const t=z(e,r);if(t instanceof a)return t;const n=new Map;for(const c of t)n.set(c,(n.get(c)??0)+1);let s=0;for(const c of n.values())s=Math.max(s,c);if(s<2)return l.NA;const o=[...n].filter(([,c])=>c===s).map(([c])=>c);return new R(o.length,1,o)});function dt(e,r){const t=r*(e.length-1),n=Math.floor(t),s=e[n]??0,o=e[n+1]??s;return s+(t-n)*(o-s)}N("QUARTILE.INC","rv",(e,r)=>{const t=S([e[0]],r);if(t instanceof a)return t;const n=A(r.calc.scalar(e[1],r.frame));if(n instanceof a)return n;const s=Math.trunc(n);return t.length===0||s<0||s>4?l.NUM:dt([...t].sort((o,c)=>o-c),s/4)}),O("QUARTILE","QUARTILE.INC");function W(e,r){const t=A(r.calc.scalar(e[0],r.frame));if(t instanceof a)return t;const n=S([e[1]],r);if(n instanceof a)return n;const s=e[2]===void 0?0:A(r.calc.scalar(e[2],r.frame));if(s instanceof a)return s;const o=n.filter(c=>c===t).length;return o===0?l.NA:{before:n.filter(c=>s===0?c>t:c<t).length,ties:o}}N("RANK.EQ","vr?v",(e,r)=>{const t=W(e,r);return t instanceof a?t:t.before+1}),N("RANK.AVG","vr?v",(e,r)=>{const t=W(e,r);return t instanceof a?t:t.before+(t.ties+1)/2}),O("RANK","RANK.EQ");function L(e,r){const t=v(e,r);if(t instanceof a)return t;const n=[];for(let s=0;s<t.rows;s++){const o=[];for(let c=0;c<t.cols;c++){const f=t.at(s,c);if(f instanceof a)return f;if(typeof f!="number")return l.VALUE;o.push(f)}n.push(o)}return n}const F=e=>new R(e.length,e[0]?.length??0,e.flat());function pt(e,r){const t=r[0]?.length??0;return e.map(n=>Array.from({length:t},(s,o)=>n.reduce((c,f,i)=>c+f*(r[i]?.[o]??0),0)))}N("MMULT","rr",(e,r)=>{const t=L(e[0],r),n=L(e[1],r);return t instanceof a?t:n instanceof a?n:(t[0]?.length??0)!==n.length?l.VALUE:F(pt(t,n))});function V(e){const r=e.length,t=e.map((o,c)=>[...o,...Array.from({length:r},(f,i)=>c===i?1:0)]),n=(o,c)=>t[o]?.[c]??0;let s=1;for(let o=0;o<r;o++){let c=o;for(let i=o+1;i<r;i++)Math.abs(n(i,o))>Math.abs(n(c,o))&&(c=i);if(n(c,o)===0)return{determinant:0};if(c!==o){const[i=[],u=[]]=[t[o],t[c]];t[o]=u,t[c]=i,s=-s}const f=n(o,o);s*=f,t[o]=(t[o]??[]).map(i=>i/f);for(let i=0;i<r;i++){if(i===o)continue;const u=n(i,o),h=t[o]??[];t[i]=(t[i]??[]).map((M,m)=>M-u*(h[m]??0))}}return{determinant:s,inverse:t.map(o=>o.slice(r))}}const Z=e=>e.length>0&&e.every(r=>r.length===e.length);N("MDETERM","r",(e,r)=>{const t=L(e[0],r);return t instanceof a?t:Z(t)?V(t).determinant:l.VALUE}),N("MINVERSE","r",(e,r)=>{const t=L(e[0],r);if(t instanceof a)return t;if(!Z(t))return l.VALUE;const{inverse:n}=V(t);return n?F(n):l.NUM}),T("MUNIT",1,1,U((e=0)=>{const r=Math.trunc(e);return r<1||r>73?l.VALUE:F(Array.from({length:r},(t,n)=>Array.from({length:r},(s,o)=>n===o?1:0)))}));function G(e,r,t){const n=v(e,t),s=v(r,t);if(n instanceof a)return n;if(s instanceof a)return s;if(n.rows*n.cols!==s.rows*s.cols)return l.NA;const o=[],c=[];for(let f=0;f<n.rows;f++)for(let i=0;i<n.cols;i++){const u=n.at(f,i),h=s.rows===n.rows?s.at(f,i):s.at(i,f);if(u instanceof a)return u;if(h instanceof a)return h;typeof u=="number"&&typeof h=="number"&&(o.push(u),c.push(h))}return{xs:o,ys:c}}for(const[e,r]of[["SUMX2MY2",(t,n)=>t*t-n*n],["SUMX2PY2",(t,n)=>t*t+n*n],["SUMXMY2",(t,n)=>(t-n)**2]])N(e,"rr",(t,n)=>{const s=G(t[0],t[1],n);return s instanceof a?s:s.xs.length===0?l.DIV0:s.xs.reduce((o,c,f)=>o+r(c,s.ys[f]??0),0)});N("SERIESSUM","vvvr",(e,r)=>{const[t,n,s]=e.slice(0,3).map(c=>A(r.calc.scalar(c,r.frame)));if(t instanceof a)return t;if(n instanceof a)return n;if(s instanceof a)return s;const o=S([e[3]],r);return o instanceof a?o:o.reduce((c,f,i)=>c+f*(t??0)**((n??0)+i*(s??0)),0)}),N("FREQUENCY","rr",(e,r)=>{const t=S([e[0]],r),n=S([e[1]],r);if(t instanceof a)return t;if(n instanceof a)return n;const s=n.map((c,f)=>({b:c,i:f})).sort((c,f)=>c.b-f.b),o=new Array(n.length+1).fill(0);for(const c of t){const f=s.find(u=>c<=u.b),i=f?f.i:n.length;o[i]=(o[i]??0)+1}return new R(o.length,1,o)}),N("PROB","rrv?v",(e,r)=>{const t=G(e[0],e[1],r);if(t instanceof a)return t;const n=A(r.calc.scalar(e[2],r.frame));if(n instanceof a)return n;const s=e[3]===void 0?n:A(r.calc.scalar(e[3],r.frame));if(s instanceof a)return s;const o=t.ys.reduce((c,f)=>c+f,0);return t.ys.some(c=>c<=0||c>1)||Math.abs(o-1)>1e-12?l.NUM:t.xs.reduce((c,f,i)=>f>=n&&f<=s?c+(t.ys[i]??0):c,0)});const J=e=>e.reduce((r,t)=>r+t,0);function $(e,r,t){const n=r.map(u=>t?[...u,1]:[...u]),s=n[0]?.length??0,o=Array.from({length:s},(u,h)=>Array.from({length:s},(M,m)=>n.reduce((E,g)=>E+(g[h]??0)*(g[m]??0),0))),{inverse:c}=V(o);if(!c)return;const f=Array.from({length:s},(u,h)=>n.reduce((M,m,E)=>M+(m[h]??0)*(e[E]??0),0)),i=c.map(u=>u.reduce((h,M,m)=>h+M*(f[m]??0),0));return t?i:[...i,0]}function j(e,r,t){const n=L(e[0],r);if(n instanceof a)return n;const s=n.length===1,o=n.flat();if(t&&o.some(h=>h<=0))return l.NUM;const c=t?o.map(Math.log):o,f=e[1];if(f===void 0||!x(f))return{ys:c,xs:o.map((h,M)=>[M+1]),byRow:s};const i=L(f,r);if(i instanceof a)return i;const u=i[0]?.length??0;return s?u!==c.length?l.REF:{ys:c,xs:Array.from({length:u},(h,M)=>i.map(m=>m[M]??0)),byRow:s}:i.length!==c.length?l.REF:{ys:c,xs:i,byRow:s}}const x=e=>e instanceof Q||e instanceof R||typeof e=="number",tt=(e,r)=>e===void 0||!x(e)&&typeof e!="boolean"?!0:_(r.calc.scalar(e,r.frame));function nt(e){return(r,t)=>{const n=j(r,t,e);if(n instanceof a)return n;const s=tt(r[3],t);if(s instanceof a)return s;const o=$(n.ys,n.xs,s);if(!o)return l.NUM;const c=r[2];let f=n.xs;if(c!==void 0&&x(c)){const u=L(c,t);if(u instanceof a)return u;const h=n.xs[0]?.length??1,M=u[0]?.length??0;f=n.byRow||h===1&&u.length===1?Array.from({length:M},(m,E)=>u.map(g=>g[E]??0)):u}const i=f.map(u=>{const h=u.reduce((M,m,E)=>M+m*(o[E]??0),0)+(o[u.length]??0);return e?Math.exp(h):h});return n.byRow?new R(1,i.length,i):new R(i.length,1,i)}}N("TREND","r?rrv",nt(!1)),N("GROWTH","r?rrv",nt(!0));function Et(e,r,t,n){const s=r.map(p=>n?[...p,1]:[...p]),o=s[0]?.length??0,{inverse:c}=V(Array.from({length:o},(p,d)=>Array.from({length:o},(b,D)=>s.reduce((rt,k)=>rt+(k[d]??0)*(k[D]??0),0))));if(!c)return;const f=r.map(p=>p.reduce((d,b,D)=>d+b*(t[D]??0),0)+(t[p.length]??0)),i=e.reduce((p,d,b)=>p+(d-(f[b]??0))**2,0),u=n?J(e)/e.length:0,h=e.reduce((p,d)=>p+(d-u)**2,0),M=h-i,m=e.length-o,E=m>0?i/m:0,g=c.map((p,d)=>Math.sqrt(Math.max(0,(p[d]??0)*E))),I=r[0]?.length??0;return{errors:g,r2:h===0?1:M/h,sey:Math.sqrt(E),f:m>0&&i>0?M/I/(i/m):0,df:m,ssreg:M,ssresid:i}}function et(e){return(r,t)=>{const n=j(r,t,e);if(n instanceof a)return n;const s=tt(r[2],t);if(s instanceof a)return s;const o=$(n.ys,n.xs,s);if(!o)return l.NUM;const f=[...o.slice(0,-1).reverse(),o[o.length-1]??0],i=e?f.map(Math.exp):f,u=r[3],h=u===void 0||!gt(u)?!1:_(t.calc.scalar(u,t.frame));if(h instanceof a)return h;if(!h)return new R(1,i.length,i);const M=Et(n.ys,n.xs,o,s);if(!M)return l.NUM;const m=i.length,E=I=>[...I,...new Array(m-I.length).fill(l.NA)],g=s?[...M.errors.slice(0,-1).reverse(),M.errors[M.errors.length-1]??0]:[...[...M.errors].reverse(),l.NA];return new R(5,m,[...i,...g,...E([M.r2,M.sey]),...E([M.f,M.df]),...E([M.ssreg,M.ssresid])])}}const gt=e=>x(e)||typeof e=="boolean";N("LINEST","r?rvv",et(!1)),N("LOGEST","r?rvv",et(!0));const y=e=>J(e)/e.length,w=e=>{const r=y(e);return e.reduce((t,n)=>t+(n-r)**2,0)/(e.length-1)};N("CHISQ.TEST","rr",(e,r)=>{const t=L(e[0],r),n=L(e[1],r);if(t instanceof a)return t;if(n instanceof a)return n;const s=t.length,o=t[0]?.length??0;if(n.length!==s||(n[0]?.length??0)!==o)return l.NA;if(s*o<2)return l.NA;let c=0;for(let i=0;i<s;i++)for(let u=0;u<o;u++){const h=n[i]?.[u]??0;if(h<0)return l.NUM;if(h===0)return l.DIV0;c+=((t[i]?.[u]??0)-h)**2/h}const f=s>1&&o>1?(s-1)*(o-1):s>1?s-1:o-1;return lt(f/2,c/2)}),O("CHITEST","CHISQ.TEST"),N("T.TEST","rrvv",(e,r)=>{const t=A(r.calc.scalar(e[2],r.frame)),n=A(r.calc.scalar(e[3],r.frame));if(t instanceof a)return t;if(n instanceof a)return n;const s=Math.trunc(t),o=Math.trunc(n);if(s!==1&&s!==2||o<1||o>3)return l.NUM;let c,f;if(o===1){const u=G(e[0],e[1],r);if(u instanceof a)return u;const h=u.xs.map((M,m)=>M-(u.ys[m]??0));if(h.length<2)return l.DIV0;c=y(h)/Math.sqrt(w(h)/h.length),f=h.length-1}else{const u=S([e[0]],r),h=S([e[1]],r);if(u instanceof a)return u;if(h instanceof a)return h;if(u.length<2||h.length<2)return l.DIV0;const[M,m,E,g]=[w(u),w(h),u.length,h.length],I=Math.abs(y(u)-y(h));if(o===2){f=E+g-2;const p=((E-1)*M+(g-1)*m)/f;c=I/Math.sqrt(p*(1/E+1/g))}else{const p=M/E,d=m/g;c=I/Math.sqrt(p+d),f=(p+d)**2/(p**2/(E-1)+d**2/(g-1))}}return Number.isFinite(c)?q(f/2,.5,f/(f+c*c))*s/2:l.DIV0}),O("TTEST","T.TEST"),N("F.TEST","rr",(e,r)=>{const t=S([e[0]],r),n=S([e[1]],r);if(t instanceof a)return t;if(n instanceof a)return n;if(t.length<2||n.length<2)return l.DIV0;const[s,o]=[w(t),w(n)];if(s===0||o===0)return l.DIV0;const c=s/o,[f,i]=[t.length-1,n.length-1],u=q(i/2,f/2,i/(f*c+i));return 2*Math.min(u,1-u)}),O("FTEST","F.TEST"),N("Z.TEST","rv?v",(e,r)=>{const t=S([e[0]],r);if(t instanceof a)return t;const n=A(r.calc.scalar(e[1],r.frame));if(n instanceof a)return n;if(t.length===0)return l.NA;const s=e[2]===void 0?t.length<2?l.DIV0:Math.sqrt(w(t)):A(r.calc.scalar(e[2],r.frame));return s instanceof a?s:s===0?l.DIV0:1-ht((y(t)-n)/(s/Math.sqrt(t.length)))}),O("ZTEST","Z.TEST");const At={1:"AVERAGE",2:"COUNT",3:"COUNTA",4:"MAX",5:"MIN",6:"PRODUCT",7:"STDEV.S",8:"STDEV.P",9:"SUM",10:"VAR.S",11:"VAR.P",12:"MEDIAN",13:"MODE.SNGL",14:"LARGE",15:"SMALL",16:"PERCENTILE.INC",17:"QUARTILE.INC",18:"PERCENTILE.EXC",19:"QUARTILE.EXC"};N("AGGREGATE","vv(r)",(e,r)=>{const t=A(r.calc.scalar(e[0],r.frame)),n=A(r.calc.scalar(e[1],r.frame));if(t instanceof a)return t;if(n instanceof a)return n;const s=At[Math.trunc(t)],o=s===void 0?void 0:ot.get(s);if(o===void 0)return l.VALUE;const c=![2,3,6,7].includes(Math.trunc(n)),f=[1,3,5,7].includes(Math.trunc(n)),i=m=>{const E=m instanceof st?m.parts:[m],g=[];for(const p of E)if(p instanceof Q){const d=p;for(let b=d.top;b<=Math.min(d.bottom,d.sheet.lastRow);b++)if(!(f&&(d.sheet.spec.rows?.[String(b+1)]?.hidden===!0||r.calc.filtered(d.sheet).has(b))))for(let D=d.left;D<=d.right;D++)g.push(r.calc.read(d.sheet,b,D))}else{const d=r.calc.flat(p);d instanceof R?g.push(...d.data):g.push(d)}const I=c?g:g.filter(p=>!(p instanceof a));return new R(I.length,1,I)},u=Math.trunc(t)>=14,h=e.slice(2),M=u?[i(h[0]),...h.slice(1)]:h.map(i);return r.calc.applyFunction(o,M,r.frame)}),T("FACT",1,1,U(e=>{if(e<0)return l.NUM;let r=1;for(let t=2;t<=Math.trunc(e);t++)r*=t;return Number.isFinite(r)?r:l.NUM})),T("FACTDOUBLE",1,1,U(e=>{if(e<0)return l.NUM;let r=1;for(let t=Math.trunc(e);t>1;t-=2)r*=t;return Number.isFinite(r)?r:l.NUM})),T("ATAN2",2,2,U((e,r)=>e===0&&r===0?l.DIV0:Math.atan2(r,e)));for(const[e,r]of[["LARGE",!0],["SMALL",!1]])N(e,"rv",(t,n)=>{const s=S([t[0]],n);if(s instanceof a)return s;const o=A(t[1]);if(o instanceof a)return o;const c=Math.ceil(o);return c<1||c>s.length?l.NUM:(s.sort((f,i)=>r?i-f:f-i),s[c-1]??l.NUM)});