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
@@ -76,7 +76,12 @@
76
76
  "unpack": {
77
77
  "default": "none",
78
78
  "type": "string",
79
- "enum": ["none", "zip", "tgz"]
79
+ "enum": [
80
+ "none",
81
+ "zip",
82
+ "tgz",
83
+ "dmg"
84
+ ]
80
85
  },
81
86
  "name": {
82
87
  "type": "string",
@@ -97,7 +102,10 @@
97
102
  "pattern": "^[0-9a-f]{64}$"
98
103
  }
99
104
  },
100
- "required": ["path", "sha256"],
105
+ "required": [
106
+ "path",
107
+ "sha256"
108
+ ],
101
109
  "additionalProperties": false
102
110
  }
103
111
  },
@@ -118,17 +126,29 @@
118
126
  }
119
127
  }
120
128
  },
121
- "required": ["url", "sha256", "size"],
129
+ "required": [
130
+ "url",
131
+ "sha256",
132
+ "size"
133
+ ],
122
134
  "additionalProperties": false
123
135
  }
124
136
  }
125
137
  }
126
138
  },
127
- "required": ["about", "version", "license", "platforms"],
139
+ "required": [
140
+ "about",
141
+ "version",
142
+ "license",
143
+ "platforms"
144
+ ],
128
145
  "additionalProperties": false
129
146
  }
130
147
  }
131
148
  },
132
- "required": ["version", "runtimes"],
149
+ "required": [
150
+ "version",
151
+ "runtimes"
152
+ ],
133
153
  "additionalProperties": false
134
154
  }
@@ -2,15 +2,15 @@
2
2
  import{mkdir as c,readFile as y,writeFile as d}from"node:fs/promises";import{basename as f,join as a,resolve as h}from"node:path";export const PROJECT_PACKAGES={cli:"allyhub",sdk:"@allyhub/sdk"},PROJECT_TYPESCRIPT="~5.9.3",PROJECT_GITIGNORE=`node_modules/
3
3
  .allyhub/
4
4
  .playwright-cli/
5
- `,SDK_DOCS=[["project.md","folders, items and entry files, imports, scripts and shared text, allyhub.config.ts, fonts"],["contract.md","a frame drawn from its time alone, drawn offline, problems and their rules"],["video.md","video(), formats, part(), layers and stacking, transitions, the look, capture, post"],["layers.md","defineComponent(), custom(), the layer's ctx, DOM, animation, path, noise and input helpers, starter components"],["speech.md","take(), say(), word references, anchors, shown and said, captions, edits files"],["sound.md","music, sound effects, the mix, the master, mic"],["footage.md","footage(): placing, cropping, reframing, faces and mattes, a video item inside another"],["slides.md","slides(), layouts, slides.yaml's pages and what is placed on them, steps, speaker notes"],["batches.md","the matrix: dimensions, slots, pools, rules, combos"],["scenery.md","3D sceneries: defineScenery(), cameras and moves, the scenery() layer, screens"],["modeling.md","props modelled in code with @allyhub-next/model"],["docs.md","a doc (doc.mdx): its title, the Markdown and tags it reads, pictures and links, comments"],["sheets.md","a sheet (sheet.yaml and CSV): Excel's model as text, the openpyxl API, formulas, tables, names, checks, sheet.ts, scenarios, calc, trace, render"],["defaults.md","every default of the piece API and the option that changes it"]],REGISTRY="https://allyhub.com/r",MASTER_SKILL="allyhub";export function workSkills(t){return t.filter(e=>e.type==="allyhub:skill"&&e.name!==MASTER_SKILL).map(e=>({name:e.name,description:e.description.replaceAll(/\s+/gu," ").trim()}))}export const AGENT_RULES_BEGIN="<!-- BEGIN:allyhub-agent-rules -->",AGENT_RULES_END="<!-- END:allyhub-agent-rules -->";export function agentRules(){return[AGENT_RULES_BEGIN,"",`Before writing or changing a video, a deck, a doc, a sheet, a 3D scenery or a 3D model, read the files it needs in the SDK's docs, for the version this project builds with: \`node_modules/${PROJECT_PACKAGES.sdk}/docs/\` once the project has installed it; without it, \`allyhub help\` says where they are (the SDK the CLI lends). The API has changed from what you may know; the docs and the SDK's types are right.`,"",...SDK_DOCS.map(([t,e])=>`- ${t}: ${e}`),"","`allyhub help` lists AllyHub's commands (`npx allyhub help` once the project has installed it); `allyhub help <command>` says what one does.","","`allyhub skills` lists AllyHub's work skills, each how to make one kind of work; `allyhub skills show <name>` prints one, `allyhub add skill/<name>` adds it to this project.","",AGENT_RULES_END].join(`
5
+ `,SDK_DOCS=[["project.md","folders, items and entry files, imports, scripts and shared text, allyhub.config.ts, fonts"],["contract.md","a frame drawn from its time alone, drawn offline, problems and their rules"],["video.md","video(), formats, part(), layers and stacking, transitions, the look, capture, post"],["layers.md","defineComponent(), custom(), the layer's ctx, DOM, animation, path, noise and input helpers, starter components"],["speech.md","take(), say(), word references, anchors, shown and said, captions, edits files"],["sound.md","music, sound effects, the mix, the master, mic"],["footage.md","footage(): placing, cropping, reframing, faces and mattes, a video item inside another"],["slides.md","slides(), layouts, slides.yaml's pages and what is placed on them, steps, speaker notes"],["batches.md","the matrix: dimensions, slots, pools, rules, combos"],["scenery.md","3D sceneries: defineScenery(), cameras and moves, the scenery() layer, screens"],["modeling.md","props modelled in code with @allyhub-next/model"],["docs.md","a doc (doc.mdx): its title, the Markdown and tags it reads, pictures and links, comments"],["sheets.md","a sheet (sheet.yaml and CSV): Excel's model as text, the openpyxl API, formulas, tables, names, checks, sheet.ts, scenarios, calc, trace, render"],["websites.md","a website, any web project with website.json: how Studio serves it ($PORT, $HOST, the preview hosts), videos in its pages, its build"],["defaults.md","every default of the piece API and the option that changes it"]],REGISTRY="https://allyhub.com/r",MASTER_SKILL="allyhub";export function workSkills(t){return t.filter(e=>e.type==="allyhub:skill"&&e.name!==MASTER_SKILL).map(e=>({name:e.name,description:e.description.replaceAll(/\s+/gu," ").trim()}))}export const AGENT_RULES_BEGIN="<!-- BEGIN:allyhub-agent-rules -->",AGENT_RULES_END="<!-- END:allyhub-agent-rules -->";export function agentRules(){return[AGENT_RULES_BEGIN,"",`Before writing or changing a video, a deck, a doc, a sheet, a 3D scenery or a 3D model, read the files it needs in the SDK's docs, for the version this project builds with: \`node_modules/${PROJECT_PACKAGES.sdk}/docs/\` once the project has installed it; without it, \`allyhub help\` says where they are (the SDK the CLI lends). The API has changed from what you may know; the docs and the SDK's types are right.`,"",...SDK_DOCS.map(([t,e])=>`- ${t}: ${e}`),"","`allyhub help` lists AllyHub's commands (`npx allyhub help` once the project has installed it); `allyhub help <command>` says what one does.","","`allyhub skills` lists AllyHub's work skills, each how to make one kind of work; `allyhub skills show <name>` prints one, `allyhub add skill/<name>` adds it to this project.","",AGENT_RULES_END].join(`
6
6
  `)}export function projectAgents(){return`# AllyHub project
7
7
 
8
- This folder is an AllyHub project. Videos, 3D sceneries and 3D models are TypeScript, docs MDX, sheets YAML and CSV: each is a folder with its entry file (\`video.ts\`, \`scenery.ts\`, \`model.ts\`, \`doc.mdx\`, \`sheet.yaml\`), wherever it suits the project; a model is made once and put in any scenery that imports it.
8
+ This folder is an AllyHub project. Videos, 3D sceneries and 3D models are TypeScript, docs MDX, sheets YAML and CSV, and a website any web project: each is a folder with its entry file (\`video.ts\`, \`scenery.ts\`, \`model.ts\`, \`doc.mdx\`, \`sheet.yaml\`, a website's \`website.json\`), wherever it suits the project; a model is made once and put in any scenery that imports it.
9
9
 
10
10
  - A video or a scenery is code: where the project has no package.json yet, \`npm create allyhub@latest .\` then \`npm install\`.
11
11
 
12
12
  ${agentRules()}
13
13
  `}export const PROJECT_CLAUDE=`@AGENTS.md
14
14
  `,PROJECT_TSCONFIG=`${JSON.stringify({compilerOptions:{target:"ES2022",module:"ESNext",moduleResolution:"Bundler",lib:["ES2022","DOM","DOM.Iterable"],types:[`${PROJECT_PACKAGES.sdk}/client`,`${PROJECT_PACKAGES.cli}/client`],strict:!0,noEmit:!0,skipLibCheck:!0,verbatimModuleSyntax:!0,allowImportingTsExtensions:!0},include:["**/*.ts",".allyhub/cache/types"],exclude:["node_modules"]},null,2)}
15
- `;export function packageName(t){const e=t.toLowerCase().normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^\w.-]+/gu,"-").replace(/^[-._]+|[-._]+$/gu,"").slice(0,214);return e===""?"allyhub-project":e}const l=t=>y(t).then(()=>!0,()=>!1);export async function writeAgentFiles(t){const e=h(t);await c(e,{recursive:!0});const s=[];for(const[n,r]of[["AGENTS.md",projectAgents()],["CLAUDE.md",PROJECT_CLAUDE]])await l(a(e,n))||(await d(a(e,n),r,{flag:"wx"}),s.push(n));return s}export async function startProject(t,e){const s=h(t);if(await l(a(s,"package.json")))throw new Error(`${s} already has a package.json: add AllyHub to it with npm install ${PROJECT_PACKAGES.cli} ${PROJECT_PACKAGES.sdk}.`);const n=packageName(f(s)),r=o=>e.packages?.[o]??e.version,p={name:n,version:"0.0.0",private:!0,type:"module",scripts:{dev:"allyhub dev",check:"allyhub check",render:"allyhub render",typecheck:"tsc --noEmit"},dependencies:{[PROJECT_PACKAGES.cli]:r(PROJECT_PACKAGES.cli),[PROJECT_PACKAGES.sdk]:r(PROJECT_PACKAGES.sdk)},devDependencies:{typescript:PROJECT_TYPESCRIPT}},m=[["package.json",`${JSON.stringify(p,null,2)}
16
- `],["tsconfig.json",PROJECT_TSCONFIG],[".gitignore",PROJECT_GITIGNORE]];await c(s,{recursive:!0});const i=[];for(const[o,u]of m)await l(a(s,o))||(await d(a(s,o),u,{flag:"wx"}),i.push(o));return i.push(...await writeAgentFiles(s)),{folder:s,name:n,files:i}}
15
+ `;export function packageName(t){const e=t.toLowerCase().normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^\w.-]+/gu,"-").replace(/^[-._]+|[-._]+$/gu,"").slice(0,214);return e===""?"allyhub-project":e}const l=t=>y(t).then(()=>!0,()=>!1);export async function writeAgentFiles(t){const e=h(t);await c(e,{recursive:!0});const s=[];for(const[n,i]of[["AGENTS.md",projectAgents()],["CLAUDE.md",PROJECT_CLAUDE]])await l(a(e,n))||(await d(a(e,n),i,{flag:"wx"}),s.push(n));return s}export async function startProject(t,e){const s=h(t);if(await l(a(s,"package.json")))throw new Error(`${s} already has a package.json: add AllyHub to it with npm install ${PROJECT_PACKAGES.cli} ${PROJECT_PACKAGES.sdk}.`);const n=packageName(f(s)),i=o=>e.packages?.[o]??e.version,p={name:n,version:"0.0.0",private:!0,type:"module",scripts:{dev:"allyhub dev",check:"allyhub check",render:"allyhub render",typecheck:"tsc --noEmit"},dependencies:{[PROJECT_PACKAGES.cli]:i(PROJECT_PACKAGES.cli),[PROJECT_PACKAGES.sdk]:i(PROJECT_PACKAGES.sdk)},devDependencies:{typescript:PROJECT_TYPESCRIPT}},m=[["package.json",`${JSON.stringify(p,null,2)}
16
+ `],["tsconfig.json",PROJECT_TSCONFIG],[".gitignore",PROJECT_GITIGNORE]];await c(s,{recursive:!0});const r=[];for(const[o,u]of m)await l(a(s,o))||(await d(a(s,o),u,{flag:"wx"}),r.push(o));return r.push(...await writeAgentFiles(s)),{folder:s,name:n,files:r}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/scaffold",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/scenery",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -40,6 +40,14 @@ export declare function hostResolve(): Plugin;
40
40
  export declare function sceneryModules(opts: {
41
41
  root: string;
42
42
  }): Plugin;
43
+ /** The folder of a scenery build that a stage serves as the tree's `scenery/`. */
44
+ export declare const SCENERY_STAGE = "stage";
45
+ /**
46
+ * A path of a scenery bundle (as SceneryBundle names it) from the tree's
47
+ * `scenery/` folder: its modules are one folder below it, as a piece's
48
+ * are below `build/`, so they reach the tree's `media/` the same way.
49
+ */
50
+ export declare const sceneryHref: (path: string) => string;
43
51
  export interface SceneryBundle {
44
52
  /** The bundle's file, relative to the build folder. */
45
53
  module: string;
@@ -51,6 +59,8 @@ export interface SceneryBundle {
51
59
  xatlasWasm: string;
52
60
  /** The project's files bundled into it (project paths). */
53
61
  files: string[];
62
+ /** What this bundle wrote that a page loads (its chunks, stylesheets and assets), named as `module` is. */
63
+ output: string[];
54
64
  }
55
65
  /**
56
66
  * Bundles a scenery module (a project path) with this package's page half
@@ -1,6 +1,6 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{realpathSync as _}from"node:fs";import{cp as S,copyFile as d,mkdir as y,writeFile as v}from"node:fs/promises";import{createRequire as W}from"node:module";import{dirname as l,join as o,relative as j,sep as p}from"node:path";import{fileURLToPath as c}from"node:url";import{bundleForStage as D}from"@allyhub-next/build";import{entryKind as F}from"@allyhub-next/formats";import{manifoldFiles as h}from"@allyhub-next/model/build";export{stageCameras,writeModelStage}from"./model-stage.js";export const THREE_LIBS="three-libs",WASM_DIR="wasm";const i="@allyhub-next/scenery-host",O="manifold-3d/manifold",k=new Set(["three"]),E=W(import.meta.url);export function threeLibsDir(){return l(l(c(import.meta.resolve("three/addons/libs/draco/draco_decoder.wasm"))))}export async function manifoldWasmFile(){return(await h()).wasm}export function xatlasWasmFile(){return E.resolve("xatlas-web/dist/xatlas-web.wasm")}export async function copyDecoders(e){const r=threeLibsDir();for(const t of["draco","basis"])await S(o(r,t),o(e,THREE_LIBS,t),{recursive:!0})}function M(e){const r=e.split("/");return e.startsWith("@")?r.slice(0,2).join("/"):r[0]??e}export function lendThree(e){return{name:"allyhub-scenery-three",enforce:"pre",resolveId(r){const t=M(r);if(!k.has(t)||e.dependencies.has(t))return null;try{return c(import.meta.resolve(r))}catch{return null}}}}export function lendManifold(){return{name:"allyhub-scenery-manifold",enforce:"pre",async resolveId(e){return e===O?(await h()).js:null}}}export function hostResolve(){return{name:"allyhub-scenery-host",enforce:"pre",resolveId(e){return e!==i&&!e.startsWith(`${i}/`)?null:c(import.meta.resolve(e))}}}const w=/(^|\n)export default\s+/;function b(e){let r=e;try{r=_(e)}catch{}return t=>{for(const a of[r,e]){const n=j(a,t).split(p).join("/");if(!n.startsWith("..")&&!n.startsWith("/"))return n}}}export function sceneryModules(e){const r=b(e.root);return{name:"allyhub-scenery-modules",enforce:"post",transform(t,a){const n=r(a.replace(/[?#].*$/,""));return n===void 0||F(n)!=="scenery"||!w.test(t)?null:{code:`${t.replace(w,"$1const __allyhubScenery = ")}
2
+ import{realpathSync as g}from"node:fs";import{cp as S,copyFile as p,mkdir as y,writeFile as v}from"node:fs/promises";import{createRequire as W}from"node:module";import{dirname as u,join as o,relative as E,sep as h}from"node:path";import{fileURLToPath as f}from"node:url";import{bundleForStage as j}from"@allyhub-next/build";import{entryKind as D}from"@allyhub-next/formats";import{manifoldFiles as w}from"@allyhub-next/model/build";export{stageCameras,writeModelStage}from"./model-stage.js";export const THREE_LIBS="three-libs",WASM_DIR="wasm";const i="@allyhub-next/scenery-host",F="manifold-3d/manifold",N=new Set(["three"]),O=W(import.meta.url);export function threeLibsDir(){return u(u(f(import.meta.resolve("three/addons/libs/draco/draco_decoder.wasm"))))}export async function manifoldWasmFile(){return(await w()).wasm}export function xatlasWasmFile(){return O.resolve("xatlas-web/dist/xatlas-web.wasm")}export async function copyDecoders(e){const r=threeLibsDir();for(const t of["draco","basis"])await S(o(r,t),o(e,THREE_LIBS,t),{recursive:!0})}function T(e){const r=e.split("/");return e.startsWith("@")?r.slice(0,2).join("/"):r[0]??e}export function lendThree(e){return{name:"allyhub-scenery-three",enforce:"pre",resolveId(r){const t=T(r);if(!N.has(t)||e.dependencies.has(t))return null;try{return f(import.meta.resolve(r))}catch{return null}}}}export function lendManifold(){return{name:"allyhub-scenery-manifold",enforce:"pre",async resolveId(e){return e===F?(await w()).js:null}}}export function hostResolve(){return{name:"allyhub-scenery-host",enforce:"pre",resolveId(e){return e!==i&&!e.startsWith(`${i}/`)?null:f(import.meta.resolve(e))}}}const $=/(^|\n)export default\s+/;function b(e){let r=e;try{r=g(e)}catch{}return t=>{for(const a of[r,e]){const n=E(a,t).split(h).join("/");if(!n.startsWith("..")&&!n.startsWith("/"))return n}}}export function sceneryModules(e){const r=b(e.root);return{name:"allyhub-scenery-modules",enforce:"post",transform(t,a){const n=r(a.replace(/[?#].*$/,""));return n===void 0||D(n)!=="scenery"||!$.test(t)?null:{code:`${t.replace($,"$1const __allyhubScenery = ")}
3
3
  import { markScenery as __allyhubMark } from ${JSON.stringify(`${i}/module`)};
4
4
  export default __allyhubMark(__allyhubScenery, ${JSON.stringify(n)});
5
- `,map:null}}}}const N=e=>e.replace(/\.[^.]+$/,"").replace(/[^A-Za-z0-9]+/g,"_").replace(/^_+|_+$/g,"");export async function bundleScenery(e){const r=`scenery__${N(e.file)}`,t=o(e.outDir,"sceneries",`${r}.entry.js`);await y(l(t),{recursive:!0});const a=o(e.root,e.file).split(p).join("/");await v(t,["// Written by allyhub for a scenery page: the scenery and its host, one bundle.",`export { default as scenery } from ${JSON.stringify(a)};`,`export * from ${JSON.stringify(i)};`,""].join(`
6
- `));const n=o(e.outDir,"stage"),u=await D({root:e.root,entries:{[r]:t},outDir:n,plugins:[hostResolve(),lendManifold(),lendThree({dependencies:e.dependencies}),sceneryModules({root:e.root}),...e.plugins],...e.user?{user:e.user}:{}}),f=u.entries[r];if(!f)throw new Error(`The scenery ${e.file} did not bundle.`);const x=b(e.root),m=new Set;for(const g of Object.values(u.chunks))for(const $ of g.modules){const s=x($.replace(/[?#].*$/,""));s!==void 0&&!s.includes("node_modules")&&!s.startsWith(".allyhub/")&&m.add(s)}return await y(o(n,WASM_DIR),{recursive:!0}),await d(await manifoldWasmFile(),o(n,WASM_DIR,"manifold.wasm")),await d(xatlasWasmFile(),o(n,WASM_DIR,"xatlas.wasm")),await copyDecoders(n),{module:`stage/${f.file}`,decoders:`stage/${THREE_LIBS}/`,manifoldWasm:`stage/${WASM_DIR}/manifold.wasm`,xatlasWasm:`stage/${WASM_DIR}/xatlas.wasm`,files:[...m].sort()}}
5
+ `,map:null}}}}export const SCENERY_STAGE="stage",sceneryHref=e=>e.startsWith(`${SCENERY_STAGE}/`)?e.slice(SCENERY_STAGE.length+1):e;const k=e=>e.replace(/\.[^.]+$/,"").replace(/[^A-Za-z0-9]+/g,"_").replace(/^_+|_+$/g,"");export async function bundleScenery(e){const r=`scenery__${k(e.file)}`,t=o(e.outDir,"sceneries",`${r}.entry.js`);await y(u(t),{recursive:!0});const a=o(e.root,e.file).split(h).join("/");await v(t,["// Written by allyhub for a scenery page: the scenery and its host, one bundle.",`export { default as scenery } from ${JSON.stringify(a)};`,`export * from ${JSON.stringify(i)};`,""].join(`
6
+ `));const n=o(e.outDir,SCENERY_STAGE),l=await j({root:e.root,entries:{[r]:t},outDir:n,plugins:[hostResolve(),lendManifold(),lendThree({dependencies:e.dependencies}),sceneryModules({root:e.root}),...e.plugins],...e.user?{user:e.user}:{}}),m=l.entries[r];if(!m)throw new Error(`The scenery ${e.file} did not bundle.`);const x=b(e.root),d=new Set;for(const c of Object.values(l.chunks))for(const _ of c.modules){const s=x(_.replace(/[?#].*$/,""));s!==void 0&&!s.includes("node_modules")&&!s.startsWith(".allyhub/")&&d.add(s)}return await y(o(n,WASM_DIR),{recursive:!0}),await p(await manifoldWasmFile(),o(n,WASM_DIR,"manifold.wasm")),await p(xatlasWasmFile(),o(n,WASM_DIR,"xatlas.wasm")),await copyDecoders(n),{module:`${SCENERY_STAGE}/${m.file}`,decoders:`${SCENERY_STAGE}/${THREE_LIBS}/`,manifoldWasm:`${SCENERY_STAGE}/${WASM_DIR}/manifold.wasm`,xatlasWasm:`${SCENERY_STAGE}/${WASM_DIR}/xatlas.wasm`,files:[...d].sort(),output:l.files.map(c=>`${SCENERY_STAGE}/${c}`)}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/scenery-host",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,5 +1,5 @@
1
1
  import type { RefNode, StructuredNode } from "../formula/ast.js";
2
- import type { SharedFormula, Workbook } from "../workbook.js";
2
+ import type { SharedFormula, Workbook, Worksheet } from "../workbook.js";
3
3
  export interface Analysis {
4
4
  reads: (RefNode | StructuredNode)[];
5
5
  /** Defined names, in lower case. */
@@ -9,13 +9,19 @@ export interface Analysis {
9
9
  unknownNames: string[];
10
10
  /** Functions that are nothing here. */
11
11
  unknownFunctions: string[];
12
- /** Functions given too few or too many arguments. */
12
+ /** Functions given too few or too many arguments, or a repeating group of them left short (`group`, its size). */
13
13
  arguments: {
14
14
  name: string;
15
15
  given: number;
16
16
  min: number;
17
17
  max: number;
18
+ group?: number;
18
19
  }[];
19
20
  }
20
- export declare function analyse(wb: Workbook, shared: SharedFormula): Analysis;
21
+ /**
22
+ * A formula's analysis. `sheet`: the sheet it is on, whose own names come
23
+ * before the workbook's; without it every sheet's name of a spelling counts,
24
+ * so what a formula can read is never less than it reads.
25
+ */
26
+ export declare function analyse(wb: Workbook, shared: SharedFormula, sheet?: Worksheet): Analysis;
21
27
  //# sourceMappingURL=analyse.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{FUNCTIONS as g}from"./functions/index.js";export function analyse(o,f){const s={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},m=new Set,c=(e,t)=>{const n=e.toLowerCase();if(t.has(n))return!0;const a=o.name(n);if(a)return s.names.add(n),m.has(n)||(m.add(n),a.formula?.node&&r(a.formula.node,new Set)),!0;const u=o.table(n);return u?(s.reads.push({kind:"structured",table:u.name,sections:[],columns:[],thisRow:!1}),!0):!1},r=(e,t)=>{switch(e.kind){case"ref":case"structured":s.reads.push(e);return;case"name":c(e.name,t)||s.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":r(e.arg,t);return;case"binary":r(e.left,t),r(e.right,t);return;case"array":return;case"invoke":r(e.callee,t);for(const n of e.args)r(n,t);return;case"call":{const n=g.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const a=new Set(t),u=e.args[e.args.length-1];e.args.forEach((i,d)=>{if(i!==u){if(e.name==="LET"&&d%2===1){r(i,a);return}i.kind==="name"&&a.add(i.name.toLowerCase())}}),u&&r(u,a);return}n?(n.volatile===!0&&(s.volatile=!0),(e.args.length<n.min||e.args.length>n.max)&&s.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max})):c(e.written,t)||s.unknownFunctions.push(e.name);for(const a of e.args)r(a,t);return}default:return}};return f.node&&r(f.node,new Set),s}
2
+ import{FUNCTIONS as p}from"./functions/index.js";import{fillsGroup as w}from"./functions/define.js";export function analyse(i,c,l){const a={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},d=new Set,g=(e,t,n)=>{const r=e.toLowerCase();if(n===void 0&&t.has(r))return!0;const u=n===void 0?l:i.sheet(n),o=u?[i.name(r,u)]:i.definitions(r);if(o.some(m=>m!==void 0)){a.names.add(r);const m=`${n??""}!${r}`;if(!d.has(m)){d.add(m);for(const h of o)h?.formula?.node&&s(h.formula.node,new Set)}return!0}if(p.has(e.toUpperCase()))return!0;const f=i.table(r);return f?(a.reads.push({kind:"structured",table:f.name,sections:[],columns:[],thisRow:!1}),!0):!1},s=(e,t)=>{switch(e.kind){case"ref":case"structured":a.reads.push(e);return;case"name":g(e.name,t,e.sheet)||a.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":s(e.arg,t);return;case"binary":s(e.left,t),s(e.right,t);return;case"array":return;case"invoke":s(e.callee,t);for(const n of e.args)s(n,t);return;case"call":{const n=p.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const r=new Set(t),u=e.args[e.args.length-1];e.args.forEach((o,f)=>{if(o!==u){if(e.name==="LET"&&f%2===1){s(o,r);return}o.kind==="name"&&r.add(o.name.toLowerCase())}}),u&&s(u,r);return}if(!n)g(e.written,t)||a.unknownFunctions.push(e.name);else{n.volatile===!0&&(a.volatile=!0);const r=n.kind==="raw"&&!w(n.params,e.args.length);(e.args.length<n.min||e.args.length>n.max||r)&&a.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max,...r?{group:n.params.group.length}:{}})}for(const r of e.args)s(r,t);return}default:return}};return c.node&&s(c.node,new Set),a}
@@ -4,7 +4,11 @@ export declare function numberOfText(text: string): number | undefined;
4
4
  export declare function toNumber(v: Scalar | undefined): number | CellError;
5
5
  export declare function toText(v: Scalar | undefined): string | CellError;
6
6
  export declare function toBool(v: Scalar | undefined): boolean | CellError;
7
- /** Equal to 15 significant digits, as Excel compares numbers. */
7
+ /**
8
+ * Equal to 15 significant digits, as Excel compares numbers. Two numbers that
9
+ * round to the same 15 digits are within 1e-13 of each other relatively, so
10
+ * any further apart are told apart without rounding either.
11
+ */
8
12
  export declare const sameNumber: (a: number, b: number) => boolean;
9
13
  /** Excel's order of two values that are not errors: numbers, then text, then TRUE and FALSE. */
10
14
  export declare function compare(a: Scalar, b: Scalar): number;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as b}from"../values.js";export function numberOfText(e){const r=b(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r||Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
2
+ import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as M}from"../values.js";export function numberOfText(e){if(!/\d/u.test(e))return;const r=M(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r?!0:Math.abs(e-r)>1e-13*Math.max(Math.abs(e),Math.abs(r))?!1:Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
@@ -1,12 +1,27 @@
1
1
  import type { Node, RefNode, StructuredNode } from "../formula/ast.js";
2
2
  import { CellError, Matrix, type Scalar } from "../values.js";
3
3
  import { FormulaCell, SharedFormula, type Slot, type Workbook, type Worksheet } from "../workbook.js";
4
+ import { type Computed } from "./remote.js";
5
+ import { RangeCache, type Index } from "./indexes.js";
6
+ import { type FunctionDef } from "./functions/index.js";
4
7
  import { Lambda, Reference, Union, type Frame, type Value } from "./types.js";
5
8
  export interface CalcOptions {
6
9
  /** The moment NOW and TODAY read. Default: the clock. */
7
10
  now?: Date;
8
11
  /** What RAND reads, values from 0 up to 1. Default: Math.random. */
9
12
  random?: () => number;
13
+ /**
14
+ * Keeps what each pass settles for `takeComputed`: a calculation in a
15
+ * worker, which sends it to the model the page reads.
16
+ */
17
+ report?: boolean;
18
+ /**
19
+ * Computes nothing: a model the page reads while a calculation elsewhere
20
+ * works. What is typed shows at once; what formulas give arrives by
21
+ * `receive`, and a formula reads as it last did until then. A formula
22
+ * given to `evaluate` (a rule's, a validation's) is worked out over that.
23
+ */
24
+ replica?: boolean;
10
25
  }
11
26
  /**
12
27
  * Random numbers that are the same for the same seed, for a result that must
@@ -31,12 +46,15 @@ export declare class Calc {
31
46
  private readonly stack;
32
47
  private readonly inCycle;
33
48
  private readonly namesAt;
34
- private readonly dependents;
35
- private readonly watches;
36
- /** Watches by the column they are on, and those too wide to list by column. */
37
- private readonly watchesAt;
38
- private readonly wideWatches;
39
- private graph;
49
+ /** Who reads whom: made the first time something changes. */
50
+ private readonly graph;
51
+ private graphMade;
52
+ /** Keeps what each pass settles, for `takeComputed`. */
53
+ private readonly reports;
54
+ /** Computes nothing; results arrive by `receive`. */
55
+ readonly replica: boolean;
56
+ /** What passes settled since `takeComputed` was last asked. */
57
+ private readonly settled;
40
58
  /** What spills changed since it was last looked at. */
41
59
  private moved;
42
60
  /** Formula cells whose spill's size turned out to depend on itself. */
@@ -44,8 +62,10 @@ export declare class Calc {
44
62
  private readonly hiddenBy;
45
63
  /** What reads what no reference shows (OFFSET, INDIRECT) or changes by itself (NOW, RAND): computed with every change, as Excel's are. */
46
64
  private volatiles;
47
- /** Lookup indexes of ranges, while nothing has changed. */
48
- readonly indexes: Map<string, Map<string, number[]>>;
65
+ /** Lookup and criteria indexes of ranges, each kept until its range changes. */
66
+ readonly indexes: RangeCache<Index>;
67
+ /** Criteria functions' results over ranges, each kept until a range it read changes. */
68
+ readonly results: RangeCache<Scalar>;
49
69
  readonly wb: Workbook;
50
70
  constructor(wb: Workbook, o?: CalcOptions);
51
71
  private allCells;
@@ -65,6 +85,8 @@ export declare class Calc {
65
85
  /** What an empty place reads: nothing, or the value a formula spilled into it. */
66
86
  private ghost;
67
87
  private circular;
88
+ /** What was worked out over ranges that hold changed cells is worked out again. */
89
+ private forget;
68
90
  private run;
69
91
  /**
70
92
  * What reads a spill's cells computed again until nothing moves: who reads
@@ -79,6 +101,8 @@ export declare class Calc {
79
101
  private analysisOf;
80
102
  /** What a formula cell reads, by what evaluating its references gives. */
81
103
  private readsOf;
104
+ /** What a formula reads evaluated at a place, an entry a reference (each place of a union its own); undefined where one gives no place. */
105
+ private readsAt;
82
106
  /** What a formula that is in no cell reads: a chart's, a rule's, a check's. */
83
107
  readsOfFormula(shared: SharedFormula, sheet: Worksheet): Reference[];
84
108
  /** `seeds`, and what they read that is to be computed, each after what it reads. */
@@ -103,6 +127,7 @@ export declare class Calc {
103
127
  private bound;
104
128
  resolveRef(n: RefNode, f: Frame): Reference | Union | CellError;
105
129
  structured(n: StructuredNode, f: Frame): Reference | Union | CellError;
130
+ /** A name's value: a LET's or a LAMBDA's, else the sheet's own (`sheet` when it is written Sheet1!name), else the workbook's. */
106
131
  private nameValue;
107
132
  private intersect;
108
133
  private unary;
@@ -115,17 +140,31 @@ export declare class Calc {
115
140
  /** A LAMBDA given its arguments' values. */
116
141
  apply(l: Lambda, args: readonly Value[]): Value;
117
142
  private call;
118
- /** A function of single values given ranges or arrays: over each of their cells. */
119
- private lifted;
143
+ /**
144
+ * A function given its arguments' values: every function call goes through
145
+ * here, a function's own call of another (AGGREGATE's) too, so each is
146
+ * lifted over arrays as its parameters say.
147
+ */
148
+ applyFunction(def: FunctionDef, values: readonly Value[], f: Frame): Value;
149
+ /**
150
+ * A function over its arguments, as Excel lifts one: where a single value
151
+ * goes and an array or a range of several cells is given, the function is
152
+ * applied over each of its cells and the results are an array. Arrays of
153
+ * different sizes are stretched along a side of one, and give #N/A past the
154
+ * end of a shorter one. Every argument taken as a single value is given as
155
+ * one (a Scalar, or Missing when left empty).
156
+ */
157
+ private over;
158
+ /** One cell of a lifted function's array: what one call gave, as a single value. */
159
+ private element;
120
160
  /** One scalar from a value: a range in a place for one gives the cell in the formula's row or column. */
121
161
  scalar(v: Value, f: Frame): Scalar;
122
162
  /** Lets NOW, TODAY, RAND and whatever else is volatile change on the next pass. */
123
163
  recalculate(): this;
124
- private key;
125
- private addEdges;
126
- private removeEdges;
127
164
  /** The graph of who reads whom: made the first time something changes. */
128
165
  private build;
166
+ private addEdges;
167
+ private removeEdges;
129
168
  /** Who reads any place of an area. */
130
169
  private readersIn;
131
170
  /** Who reads a place. */
@@ -146,6 +185,14 @@ export declare class Calc {
146
185
  change(cells: readonly CellChange[]): void;
147
186
  /** Sets a defined name's constant (a scenario's) and computes what reads it. */
148
187
  setName(name: string, value: Scalar): void;
188
+ /** What passes settled since this was last asked, for the model the page reads (`receive`). */
189
+ takeComputed(): Computed;
190
+ /**
191
+ * What a calculation elsewhere computed, put in this model: each formula
192
+ * cell's value and spill. A cell no longer a formula, or another formula
193
+ * now, is left as it is: what was typed there since is newer.
194
+ */
195
+ receive(computed: Computed): void;
149
196
  /** Numbers of a value, for code outside a formula. */
150
197
  numberOf(v: Scalar): number | CellError;
151
198
  }
@@ -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 A,MAX_ROWS as M,overlaps as L}from"../address.js";import{CellError as m,ERR as f,Matrix as d,serialOfDate as U}from"../values.js";import{filteredRows as N}from"../filter.js";import{FormulaCell as b,SharedFormula as F,placeKey as _}from"../workbook.js";import{analyse as V}from"./analyse.js";import{binary as k,mapBoth as I,toNumber as T}from"./coerce.js";import{FUNCTIONS as B}from"./functions/index.js";import{Lambda as S,MISSING as O,Missing as x,Reference as u,Union as g}from"./types.js";export function seededRandom(h){let t=2166136261;for(let e=0;e<h.length;e++)t=Math.imul(t^h.charCodeAt(e),16777619);return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const $=new Set,W=/\b(?:SUBTOTAL|AGGREGATE)\(/iu,D=2e3,z=32,R=12,G=(h,t)=>!h||!t?h===t:h.rows!==t.rows||h.cols!==t.cols?!1:h.data.every((e,s)=>e===t.data[s]),H=(h,t)=>h.row<t.row||h.row===t.row&&h.col<t.col;class P{cells=new Set;reference;constructor(t){this.reference=t}}export class Calc{cycles=[];computed=0;nowSerial;random;pass=0;stack=[];inCycle=new Set;namesAt=new Set;dependents=new Map;watches=new Map;watchesAt=new Map;wideWatches=[];graph=!1;moved=[];unsettled=new Set;hiddenBy=new Map;volatiles=new Set;indexes=new Map;wb;constructor(t,e={}){this.wb=t;const{now:s,random:n}=e;this.nowSerial=()=>U(s??new Date),this.random=n??Math.random;for(const o of t.sheets)o.expand()}allCells(){return this.wb.sheets.flatMap(t=>[...t.formulas])}filtered(t){return this.hiddenBy.get(t)??$}calculate(){this.hiddenBy.clear();for(const e of this.wb.sheets)e.clearSpills();this.moved=[],this.unsettled.clear();const t=this.allCells();for(const e of t)e.state=1;return this.cycles=[],this.inCycle.clear(),this.run(t),this.applyFilters(t),this}applyFilters(t){for(const e of this.wb.sheets){if(e.filters.every(n=>n.columns.size===0))continue;const s=N(e,this);s.size>0&&this.hiddenBy.set(e,s)}if(this.hiddenBy.size!==0&&t.some(e=>W.test(e.shared.text))){for(const e of t)e.state=1;this.cycles=[],this.inCycle.clear(),this.run([...t])}}value(t,e,s){return this.read(t,e,s)}read(t,e,s){const n=t.at(e,s);return n===void 0?this.ghost(t,e,s):typeof n!="object"||n instanceof m?n:(n.state===1?this.compute(n):n.state===2&&this.circular(n),n.value)}ghost(t,e,s){const n=t.spillAt(e,s);if(!n)return null;if(n.state===1)this.compute(n);else if(n.state===2)return this.circular(n),null;const{array:o}=n;return o&&t.spillAt(e,s)===n?o.at(e-n.row,s-n.col):null}circular(t){const e=this.stack.indexOf(t),s=e<0?[t]:this.stack.slice(e);s.some(n=>this.inCycle.has(n))||this.cycles.push(s);for(const n of s)this.inCycle.add(n)}run(t){this.indexes.clear(),this.computed=0;for(const e of this.order(t))e.state===1&&this.compute(e);this.spread()}spread(){for(let t=0;this.moved.length>0;t++){const e=this.moved;if(this.moved=[],t>=R*2)break;if(t>=R)for(const{sheet:o,area:r}of e)for(const i of o.spillsIn(r))this.unsettled.add(i);this.build();const s=new Set,n=[...this.unsettled];for(const{sheet:o,area:r}of e)n.push(...this.readersIn(o,r),...o.blockedBy(r));for(;;){const o=n.pop();if(!o)break;s.has(o)||(s.add(o),n.push(...this.readers(o.sheet,o.row,o.col)))}if(s.size!==0){for(const o of s)o.state=1,this.inCycle.delete(o);this.cycles=this.cycles.filter(o=>!o.some(r=>s.has(r))),this.indexes.clear();for(const o of this.order([...s]))o.state===1&&this.compute(o)}}for(const t of this.wb.sheets)t.tighten()}spillOut(t,e){const{sheet:s,row:n,col:o}=t,r={top:n,left:o,bottom:n+e.rows-1,right:o+e.cols-1},i=s.spillsIn(r).filter(c=>c!==t);if(r.bottom>=M||r.right>=A||s.holds(r,t)||s.tables.some(c=>L(c.area,r))||s.merges.some(c=>L(c,r))||i.some(c=>H(c,t)))return s.blockSpill(t,r),!1;for(const c of i)this.evict(c,r);return s.placeSpill(t,r),!0}evict(t,e){const{sheet:s,spill:n}=t;n&&(s.clearSpill(t),s.blockSpill(t,e),t.array=void 0,t.value=f.SPILL,this.moved.push({sheet:s,area:n}))}analysisOf(t){return t.analysis??=V(this.wb,t)}readsOf(t){const e=[],s=v(t);for(const n of this.analysisOf(t.shared).reads){const o=n.kind==="ref"?this.resolveRef(n,s):this.structured(n,s);o instanceof u?e.push(o):o instanceof g&&e.push(...o.parts)}return e}readsOfFormula(t,e){const s=[],n={sheet:e,row:t.row,col:t.col,dr:0,dc:0};for(const o of this.analysisOf(t).reads){const r=o.kind==="ref"?this.resolveRef(o,n):this.structured(o,n);r instanceof u?s.push(r):r instanceof g&&s.push(...r.parts)}return s}order(t){this.pass+=1;const{pass:e}=this,s=[],n=new Set,o=[],r=i=>{i.mark=e,o.push({cell:i,reads:this.pending(i,n),next:0})};for(const i of t)if(i.mark!==e)for(r(i);;){const a=o[o.length-1];if(!a)break;const c=a.reads[a.next];a.next+=1,c===void 0?(s.push(a.cell),o.pop()):c.mark!==e&&c.state===1&&r(c)}return s}pending(t,e){const s=[];for(const n of this.readsOf(t)){const{sheet:o}=n;if(n.single){const i=o.at(n.top,n.left);i instanceof b&&s.push(i);continue}if(e.has(n.key))continue;e.add(n.key);const r=Math.min(n.right,o.columnsUsed-1);for(let i=n.left;i<=r;i++){if(!o.hasFormulas(i))continue;const[a,c]=o.span(i,n.top,n.bottom);for(let l=a;l<=c;l++){const p=o.at(l,i);p instanceof b&&s.push(p)}}}return s}compute(t){if(this.stack.length>=D){t.value=f.CALC,t.state=0;return}t.state=2,this.stack.push(t),this.computed+=1;const{node:e}=t.shared,s=e?this.top(this.eval(e,v(t))):f.NAME;this.stack.pop(),this.unsettled.has(t)&&!this.inCycle.has(t)&&(this.inCycle.add(t),this.cycles.push([t])),this.settleResult(t,s),t.state=0}settleResult(t,e){const{sheet:s}=t,n=t.spill,o=t.array;if(s.clearSpill(t),t.array=void 0,e instanceof d){const i=j(e);i.rows*i.cols<=1||this.spillOut(t,i)?(t.array=i,t.value=i.at(0,0)??0):t.value=f.SPILL}else t.value=e;this.inCycle.has(t)&&(s.clearSpill(t),t.value=f.CYCLE,t.array=void 0);const r=t.spill;(!G(o,t.array)||!q(n,r))&&(n&&this.moved.push({sheet:s,area:n}),r&&this.moved.push({sheet:s,area:r}))}top(t){const e=this.flat(t);return e===null?0:e}flat(t){return t instanceof u?t.single?this.read(t.sheet,t.top,t.left):this.matrix(t):t instanceof g?f.VALUE:t instanceof S?f.CALC:t instanceof x?null:t}matrix(t){const e=t.bottom===M-1?Math.min(t.bottom,t.sheet.lastRow):t.bottom,s=t.right===A-1?Math.min(t.right,t.sheet.columnsUsed-1):t.right,n=Math.max(0,e-t.top+1),o=Math.max(0,s-t.left+1),r=new Array(n*o);for(let i=0;i<n;i++)for(let a=0;a<o;a++)r[i*o+a]=this.read(t.sheet,t.top+i,t.left+a);return new d(n,o,r)}each(t,e){const{sheet:s}=t,n=Math.min(t.right,s.columnsUsed-1);for(let o=t.left;o<=n;o++){const[r,i]=s.span(o,t.top,t.bottom);for(let a=r;a<=i;a++){const c=s.at(a,o);if(c===void 0){s.spillAt(a,o)&&e(this.read(s,a,o),a,o);continue}e(typeof c=="object"&&!(c instanceof m)?this.read(s,a,o):c,a,o)}}}evaluate(t,e){const{node:s}=t;return s?this.top(this.eval(s,{sheet:e,row:t.row,col:t.col,dr:0,dc:0})):f.NAME}evaluateAt(t,e,s,n){const{node:o}=t;return o?this.top(this.eval(o,{sheet:e,row:s,col:n,dr:s-t.row,dc:n-t.col})):f.NAME}bound(t,e,s){const n=t.abs?t.index:t.index+e;return n<0||n>=s?void 0:n}resolveRef(t,e){const s=t.sheet===void 0?e.sheet:this.wb.sheet(t.sheet);if(!s)return f.REF;let n=0,o=A-1,r=0,i=M-1;if(t.col){const a=this.bound(t.col,e.dc,A),c=this.bound(t.col2??t.col,e.dc,A);if(a===void 0||c===void 0)return f.REF;n=Math.min(a,c),o=Math.max(a,c)}if(t.row){const a=this.bound(t.row,e.dr,M),c=this.bound(t.row2??t.row,e.dr,M);if(a===void 0||c===void 0)return f.REF;r=Math.min(a,c),i=Math.max(a,c)}if(t.lastSheet!==void 0){const a=this.wb.sheet(t.lastSheet);if(!a)return f.REF;const[c,l]=[Math.min(s.index,a.index),Math.max(s.index,a.index)];return new g(this.wb.sheets.slice(c,l+1).map(p=>new u(p,r,n,i,o)))}return new u(s,r,n,i,o)}structured(t,e){const s=t.table===void 0?e.sheet.tableAt(e.row,e.col):this.wb.table(t.table);return s?X(s,t,e):t.table===void 0?f.REF:f.NAME}nameValue(t,e){const s=t.toLowerCase();for(let r=e.scope;r;r=r.parent){const i=r.names.get(s);if(i!==void 0)return i}const n=this.wb.name(t);if(n){if(!n.formula)return n.value??null;const{node:r}=n.formula;if(!r)return f.NAME;if(this.namesAt.has(s))return f.CYCLE;this.namesAt.add(s);try{return this.eval(r,{sheet:e.sheet,row:0,col:0,dr:0,dc:0})}finally{this.namesAt.delete(s)}}const o=this.wb.table(t);if(o){const{top:r,left:i,bottom:a,right:c}=o.data;return new u(o.sheet,r,i,a,c)}return f.NAME}intersect(t,e){return!(t instanceof u)||t.single?t:t.cols===1&&e.row>=t.top&&e.row<=t.bottom?new u(t.sheet,e.row,t.left,e.row,t.left):t.rows===1&&e.col>=t.left&&e.col<=t.right?new u(t.sheet,t.top,e.col,t.top,e.col):f.VALUE}unary(t,e){const s=this.flat(t);return s instanceof d?new d(s.rows,s.cols,s.data.map(e)):e(s)}operate(t,e,s){const n=this.flat(e),o=this.flat(s);if(n instanceof d||o instanceof d){const r=(i,a)=>k(t,i,a);return I(n instanceof d?n:new d(1,1,[n]),o instanceof d?o:new d(1,1,[o]),r)}return k(t,n,o)}rangeOf(t,e){return t instanceof m?t:e instanceof m?e:!(t instanceof u)||!(e instanceof u)||t.sheet!==e.sheet?f.REF:new u(t.sheet,Math.min(t.top,e.top),Math.min(t.left,e.left),Math.max(t.bottom,e.bottom),Math.max(t.right,e.right))}intersection(t,e){if(t instanceof m)return t;if(e instanceof m)return e;if(!(t instanceof u)||!(e instanceof u))return f.REF;const s=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.bottom,e.bottom),r=Math.min(t.right,e.right);return t.sheet!==e.sheet||s>o||n>r?f.NULL:new u(t.sheet,s,n,o,r)}union(t,e){if(t instanceof m)return t;if(e instanceof m)return e;const s=o=>o instanceof u?[o]:o instanceof g?o.parts:[],n=[...s(t),...s(e)];return n.length===0?f.VALUE:new g(n)}eval(t,e){switch(t.kind){case"number":case"string":case"boolean":return t.value;case"error":return m.of(t.code);case"missing":return O;case"ref":return this.resolveRef(t,e);case"structured":return this.structured(t,e);case"name":return this.nameValue(t.name,e);case"paren":return this.eval(t.arg,e);case"unary":{const s=this.eval(t.arg,e);return t.op==="@"?this.intersect(s,e):t.op==="+"?s:this.unary(s,n=>k("*",n,-1))}case"postfix":{const s=this.eval(t.arg,e);if(t.op==="%")return this.unary(s,n=>k("/",n,100));if(s instanceof u&&s.single){const n=s.sheet.at(s.top,s.left);if(n instanceof b){this.read(s.sheet,s.top,s.left);const{spill:o}=n;if(o)return new u(s.sheet,o.top,o.left,o.bottom,o.right);if(n.array)return s}}return f.REF}case"binary":{const s=this.eval(t.left,e),n=this.eval(t.right,e);return t.op===":"?this.rangeOf(s,n):t.op===" "?this.intersection(s,n):t.op===","?this.union(s,n):this.operate(t.op,s,n)}case"array":return new d(t.rows.length,t.rows[0]?.length??0,t.rows.flatMap(s=>s.map(n=>{const o=this.eval(n,e);return o instanceof d||o instanceof u||o instanceof g||o instanceof S||o instanceof x?f.VALUE:o})));case"invoke":{const s=this.eval(t.callee,e);return s instanceof S?this.invoke(s,t.args,e):s instanceof m?s:f.VALUE}case"call":return this.call(t.name,t.args,e)}}invoke(t,e,s){return this.apply(t,e.map(n=>this.eval(n,s)))}apply(t,e){if(e.length>t.params.length)return f.VALUE;const s=new Map;return t.params.forEach((n,o)=>{s.set(n,e[o]??O)}),this.eval(t.body,{...t.frame,scope:{names:s,...t.frame.scope?{parent:t.frame.scope}:{}}})}call(t,e,s){const n=B.get(t);if(!n){const i=this.nameValue(t,s);return i instanceof S?this.invoke(i,e,s):f.NAME}const o={calc:this,frame:s};if(e.length<n.min||e.length>n.max)return f.VALUE;if(n.kind==="lazy")return n.call(e,o);const r=e.map(i=>this.eval(i,s));return n.kind==="raw"?n.call(r,o):this.lifted(n.call,n.errors===!0,r)}lifted(t,e,s){const n=s.map(l=>l instanceof x?void 0:this.flat(l)),o=l=>{if(!e){for(const p of l)if(p instanceof m)return p}return t(...l)};if(!n.some(l=>l instanceof d))return o(n);const r=n.filter(l=>l instanceof d),i=Math.max(...r.map(l=>l.rows)),a=Math.max(...r.map(l=>l.cols)),c=new Array(i*a);for(let l=0;l<i;l++)for(let p=0;p<a;p++)c[l*a+p]=o(n.map(w=>{if(!(w instanceof d))return w;const E=w.rows===1?0:l,y=w.cols===1?0:p;return E<w.rows&&y<w.cols?w.at(E,y):f.NA}));return new d(i,a,c)}scalar(t,e){if(t instanceof x)return null;if(t instanceof u){const s=this.intersect(t,e);return s instanceof u?this.read(s.sheet,s.top,s.left):f.VALUE}return t instanceof d?t.at(0,0):t instanceof g||t instanceof S?f.VALUE:t}recalculate(){const t=this.allCells().filter(e=>this.analysisOf(e.shared).volatile);return this.mark(t),this}key(t,e,s){return`${String(t.index)}:${String(_(e,s))}`}addEdges(t){this.analysisOf(t.shared).volatile&&this.volatiles.add(t);for(const e of this.readsOf(t))if(e.single){const s=this.key(e.sheet,e.top,e.left);let n=this.dependents.get(s);n||(n=new Set,this.dependents.set(s,n)),n.add(t)}else{let s=this.watches.get(e.key);if(!s)if(s=new P(e),this.watches.set(e.key,s),e.cols>z)this.wideWatches.push(s);else for(let n=e.left;n<=e.right;n++){const o=`${String(e.sheet.index)}:${String(n)}`,r=this.watchesAt.get(o);r?r.push(s):this.watchesAt.set(o,[s])}s.cells.add(t)}}removeEdges(t){this.volatiles.delete(t);for(const e of this.readsOf(t))e.single?this.dependents.get(this.key(e.sheet,e.top,e.left))?.delete(t):this.watches.get(e.key)?.cells.delete(t)}build(){if(!this.graph){this.graph=!0;for(const t of this.allCells())this.addEdges(t)}}readersIn(t,e){const s=new Set,n=e.right;for(let i=e.top;i<=e.bottom;i++)for(let a=e.left;a<=n;a++)for(const c of this.dependents.get(this.key(t,i,a))??[])s.add(c);const o=new Set,r=i=>{if(o.has(i))return;o.add(i);const{reference:a,cells:c}=i;if(a.sheet===t&&L(a,e))for(const l of c)s.add(l)};this.wideWatches.forEach(r);for(let i=e.left;i<=n;i++)this.watchesAt.get(`${String(t.index)}:${String(i)}`)?.forEach(r);return[...s]}readers(t,e,s){this.build();const n=new Set(this.dependents.get(this.key(t,e,s))),o=`${String(t.index)}:${String(s)}`,r=this.watchesAt.get(o)??[];for(const i of[r,this.wideWatches])for(const{reference:a,cells:c}of i)if(a.sheet===t&&e>=a.top&&e<=a.bottom&&s>=a.left&&s<=a.right)for(const l of c)n.add(l);return[...n]}precedents(t){return this.readsOf(t)}mark(t){this.build();const e=new Set(t),s=[...t];for(;;){const n=s.pop();if(!n)break;for(const o of this.readers(n.sheet,n.row,n.col))e.has(o)||(e.add(o),s.push(o))}this.settle(e)}settle(t){for(const e of t)e.state=1,this.inCycle.delete(e);this.cycles=this.cycles.filter(e=>!e.some(s=>t.has(s))),this.run([...t])}set(t,e,s,n){const o=typeof n=="string"&&n.length>1&&n.startsWith("=")?new b(new F(n,e,s,{file:""}),t,e,s):void 0;this.change([{sheet:t,row:e,col:s,slot:o??n??void 0}])}prepare(){this.build()}change(t){this.build();const e=new Set,s=[...this.unsettled];this.unsettled.clear();for(const{sheet:n,row:o,col:r,slot:i}of t){const a=n.at(o,r);a instanceof b&&(this.removeEdges(a),e.delete(a),a.spill&&this.moved.push({sheet:n,area:a.spill}),n.clearSpill(a));const c=n.spillAt(o,r);c&&s.push(c),s.push(...n.blockedBy({top:o,left:r,bottom:o,right:r})),n.replace(o,r,i),i instanceof b&&(this.addEdges(i),e.add(i))}for(const{sheet:n,row:o,col:r}of t)s.push(...this.readers(n,o,r));for(s.push(...this.volatiles);;){const n=s.pop();if(!n)break;e.has(n)||(e.add(n),s.push(...this.readers(n.sheet,n.row,n.col)))}this.settle(e)}setName(t,e){const s=this.wb.name(t);if(!s)throw new Error(`There is no name ${t}.`);s.value=e,delete s.formula;const n=t.toLowerCase();this.mark(this.allCells().filter(o=>this.analysisOf(o.shared).names.has(n)))}numberOf(t){return T(t)}}const q=(h,t)=>h?.top===t?.top&&h?.left===t?.left&&h?.bottom===t?.bottom&&h?.right===t?.right;function j(h){return h.data.some(t=>t===null)?new d(h.rows,h.cols,h.data.map(t=>t??0)):h}function v(h){return{sheet:h.sheet,row:h.row,col:h.col,dr:h.row-h.shared.row,dc:h.col-h.shared.col}}function X(h,t,e){const{sheet:s}=h,n=h.area;let o=n.left,r=n.right;const[i,a]=t.columns;if(i!==void 0){const y=h.column(i),C=a===void 0?y:h.column(a);if(!y||!C)return f.REF;o=n.left+Math.min(y.index,C.index),r=n.left+Math.max(y.index,C.index)}if(t.thisRow)return e.sheet!==s||e.row<=n.top||e.row>n.bottom?f.VALUE:new u(s,e.row,o,e.row,r);const c=t.sections;if(c.includes("#Totals"))return f.REF;const l=c.includes("#All")||c.includes("#Headers"),p=c.length===0||c.includes("#All")||c.includes("#Data"),w=l?n.top:n.top+1,E=p?n.bottom:n.top;return new u(s,w,o,E,r)}
2
+ import{MAX_COLUMNS as E,MAX_ROWS as k,overlaps as O}from"../address.js";import{CellError as m,ERR as h,Matrix as p,serialOfDate as _}from"../values.js";import{filteredRows as B}from"../filter.js";import{FormulaCell as y,SharedFormula as I}from"../workbook.js";import{analyse as z}from"./analyse.js";import{Graph as T}from"./graph.js";import{fromWire as G,matrixFromWire as D,matrixToWire as W,toWire as P}from"./remote.js";import{RangeCache as U}from"./indexes.js";import{binary as S,mapBoth as H,toNumber as q}from"./coerce.js";import{FUNCTIONS as v}from"./functions/index.js";import{fillsGroup as j,paramAt as X}from"./functions/define.js";import{Lambda as M,MISSING as F,Missing as x,Reference as u,Union as b}from"./types.js";export function seededRandom(l){let t=2166136261;for(let e=0;e<l.length;e++)t=Math.imul(t^l.charCodeAt(e),16777619);return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const Y=new Set,Z=/\b(?:SUBTOTAL|AGGREGATE)\(/iu,$=2e3,N=12,J=(l,t)=>!l||!t?l===t:l.rows!==t.rows||l.cols!==t.cols?!1:l.data.every((e,s)=>e===t.data[s]),K=(l,t)=>l.row<t.row||l.row===t.row&&l.col<t.col;export class Calc{cycles=[];computed=0;nowSerial;random;pass=0;stack=[];inCycle=new Set;namesAt=new Set;graph=new T({readsOf:t=>this.readsOf(t),readsAt:(t,e,s,n)=>this.readsAt(t,e,s,n)});graphMade=!1;reports;replica;settled=new Set;moved=[];unsettled=new Set;hiddenBy=new Map;volatiles=new Set;indexes=new U;results=new U;wb;constructor(t,e={}){this.wb=t;const{now:s,random:n}=e;this.reports=e.report===!0,this.replica=e.replica===!0,this.nowSerial=()=>_(s??new Date),this.random=n??Math.random;for(const o of t.sheets)o.expand()}allCells(){return this.wb.sheets.flatMap(t=>[...t.formulas])}filtered(t){return this.hiddenBy.get(t)??Y}calculate(){if(this.replica){for(const e of this.wb.sheets)e.clearSpills();for(const e of this.allCells())e.state=0;return this}this.hiddenBy.clear(),this.indexes.clear(),this.results.clear();for(const e of this.wb.sheets)e.clearSpills();this.moved=[],this.unsettled.clear();const t=this.allCells();for(const e of t)e.state=1;return this.cycles=[],this.inCycle.clear(),this.run(t),this.applyFilters(t),this}applyFilters(t){for(const e of this.wb.sheets){if(e.filters.every(n=>n.columns.size===0))continue;const s=B(e,this);s.size>0&&this.hiddenBy.set(e,s)}if(this.hiddenBy.size!==0&&t.some(e=>Z.test(e.shared.text))){for(const e of t)e.state=1;this.cycles=[],this.inCycle.clear(),this.run([...t])}}value(t,e,s){return this.read(t,e,s)}read(t,e,s){const n=t.at(e,s);return n===void 0?this.ghost(t,e,s):typeof n!="object"||n instanceof m?n:(n.state===1?this.compute(n):n.state===2&&this.circular(n),n.value)}ghost(t,e,s){const n=t.spillAt(e,s);if(!n)return null;if(n.state===1)this.compute(n);else if(n.state===2)return this.circular(n),null;const{array:o}=n;return o&&t.spillAt(e,s)===n?o.at(e-n.row,s-n.col):null}circular(t){const e=this.stack.indexOf(t),s=e<0?[t]:this.stack.slice(e);s.some(n=>this.inCycle.has(n))||this.cycles.push(s);for(const n of s)this.inCycle.add(n)}forget(t,e){this.indexes.changed(t,e),this.results.changed(t,e)}run(t){for(const e of t){const{sheet:s,row:n,col:o}=e;this.forget(s,{top:n,left:o,bottom:n,right:o}),e.spill&&this.forget(s,e.spill)}this.computed=0;for(const e of this.order(t))e.state===1&&this.compute(e);this.spread()}spread(){for(let t=0;this.moved.length>0;t++){const e=this.moved;if(this.moved=[],t>=N*2)break;if(t>=N)for(const{sheet:o,area:r}of e)for(const i of o.spillsIn(r))this.unsettled.add(i);this.build();const s=new Set,n=[...this.unsettled];for(const{sheet:o,area:r}of e)n.push(...this.readersIn(o,r),...o.blockedBy(r));for(;;){const o=n.pop();if(!o)break;s.has(o)||(s.add(o),n.push(...this.readers(o.sheet,o.row,o.col)))}if(s.size!==0){for(const o of s)o.state=1,this.inCycle.delete(o);this.cycles=this.cycles.filter(o=>!o.some(r=>s.has(r))),this.indexes.clear(),this.results.clear();for(const o of this.order([...s]))o.state===1&&this.compute(o)}}for(const t of this.wb.sheets)t.tighten()}spillOut(t,e){const{sheet:s,row:n,col:o}=t,r={top:n,left:o,bottom:n+e.rows-1,right:o+e.cols-1},i=s.spillsIn(r).filter(c=>c!==t);if(r.bottom>=k||r.right>=E||s.holds(r,t)||s.tables.some(c=>O(c.area,r))||s.merges.some(c=>O(c,r))||i.some(c=>K(c,t)))return s.blockSpill(t,r),!1;for(const c of i)this.evict(c,r);return s.placeSpill(t,r),!0}evict(t,e){const{sheet:s,spill:n}=t;n&&(s.clearSpill(t),s.blockSpill(t,e),t.array=void 0,t.value=h.SPILL,this.moved.push({sheet:s,area:n}),this.reports&&this.settled.add(t))}analysisOf(t){return t.analysis??=z(this.wb,t)}readsOf(t){const e=[],s=V(t);for(const n of this.analysisOf(t.shared).reads){const o=n.kind==="ref"?this.resolveRef(n,s):this.structured(n,s);o instanceof u?e.push(o):o instanceof b&&e.push(...o.parts)}return e}readsAt(t,e,s,n){const o={sheet:e,row:s,col:n,dr:s-t.row,dc:n-t.col},r=[];for(const i of this.analysisOf(t).reads){const a=i.kind==="ref"?this.resolveRef(i,o):this.structured(i,o);a instanceof u?r.push(a):a instanceof b?r.push(...a.parts):r.push(void 0)}return r}readsOfFormula(t,e){const s=[],n={sheet:e,row:t.row,col:t.col,dr:0,dc:0};for(const o of this.analysisOf(t).reads){const r=o.kind==="ref"?this.resolveRef(o,n):this.structured(o,n);r instanceof u?s.push(r):r instanceof b&&s.push(...r.parts)}return s}order(t){this.pass+=1;const{pass:e}=this,s=[],n=new Set,o=[],r=i=>{i.mark=e,o.push({cell:i,reads:this.pending(i,n),next:0})};for(const i of t)if(i.mark!==e)for(r(i);;){const a=o[o.length-1];if(!a)break;const c=a.reads[a.next];a.next+=1,c===void 0?(s.push(a.cell),o.pop()):c.mark!==e&&c.state===1&&r(c)}return s}pending(t,e){const s=[];for(const n of this.readsOf(t)){const{sheet:o}=n;if(n.single){const i=o.at(n.top,n.left);i instanceof y&&s.push(i);continue}if(e.has(n.key))continue;e.add(n.key);const r=Math.min(n.right,o.columnsUsed-1);for(let i=n.left;i<=r;i++){if(!o.hasFormulas(i))continue;const[a,c]=o.span(i,n.top,n.bottom);for(let f=a;f<=c;f++){const d=o.at(f,i);d instanceof y&&s.push(d)}}}return s}compute(t){if(this.stack.length>=$){t.value=h.CALC,t.state=0;return}t.state=2,this.stack.push(t),this.computed+=1;const{node:e}=t.shared,s=e?this.top(this.eval(e,V(t))):h.NAME;this.stack.pop(),this.unsettled.has(t)&&!this.inCycle.has(t)&&(this.inCycle.add(t),this.cycles.push([t])),this.settleResult(t,s),t.state=0,this.reports&&this.settled.add(t)}settleResult(t,e){const{sheet:s}=t,n=t.spill,o=t.array;if(s.clearSpill(t),t.array=void 0,e instanceof p){const i=tt(e);i.rows*i.cols<=1||this.spillOut(t,i)?(t.array=i,t.value=i.at(0,0)??0):t.value=h.SPILL}else t.value=e;this.inCycle.has(t)&&(s.clearSpill(t),t.value=h.CYCLE,t.array=void 0);const r=t.spill;(!J(o,t.array)||!Q(n,r))&&(n&&this.moved.push({sheet:s,area:n}),r&&this.moved.push({sheet:s,area:r}))}top(t){const e=this.flat(t);return e===null?0:e}flat(t){return t instanceof u?t.single?this.read(t.sheet,t.top,t.left):this.matrix(t):t instanceof b?h.VALUE:t instanceof M?h.CALC:t instanceof x?null:t}matrix(t){const e=t.bottom===k-1?Math.min(t.bottom,t.sheet.lastRow):t.bottom,s=t.right===E-1?Math.min(t.right,t.sheet.columnsUsed-1):t.right,n=Math.max(0,e-t.top+1),o=Math.max(0,s-t.left+1),r=new Array(n*o);for(let i=0;i<n;i++)for(let a=0;a<o;a++)r[i*o+a]=this.read(t.sheet,t.top+i,t.left+a);return new p(n,o,r)}each(t,e){const{sheet:s}=t,n=Math.min(t.right,s.columnsUsed-1);for(let o=t.left;o<=n;o++){const[r,i]=s.span(o,t.top,t.bottom);for(let a=r;a<=i;a++){const c=s.at(a,o);if(c===void 0){s.spillAt(a,o)&&e(this.read(s,a,o),a,o);continue}e(typeof c=="object"&&!(c instanceof m)?this.read(s,a,o):c,a,o)}}}evaluate(t,e){const{node:s}=t;return s?this.top(this.eval(s,{sheet:e,row:t.row,col:t.col,dr:0,dc:0})):h.NAME}evaluateAt(t,e,s,n){const{node:o}=t;return o?this.top(this.eval(o,{sheet:e,row:s,col:n,dr:s-t.row,dc:n-t.col})):h.NAME}bound(t,e,s){const n=t.abs?t.index:t.index+e;return n<0||n>=s?void 0:n}resolveRef(t,e){const s=t.sheet===void 0?e.sheet:this.wb.sheet(t.sheet);if(!s)return h.REF;let n=0,o=E-1,r=0,i=k-1;if(t.col){const a=this.bound(t.col,e.dc,E),c=this.bound(t.col2??t.col,e.dc,E);if(a===void 0||c===void 0)return h.REF;n=Math.min(a,c),o=Math.max(a,c)}if(t.row){const a=this.bound(t.row,e.dr,k),c=this.bound(t.row2??t.row,e.dr,k);if(a===void 0||c===void 0)return h.REF;r=Math.min(a,c),i=Math.max(a,c)}if(t.lastSheet!==void 0){const a=this.wb.sheet(t.lastSheet);if(!a)return h.REF;const[c,f]=[Math.min(s.index,a.index),Math.max(s.index,a.index)];return new b(this.wb.sheets.slice(c,f+1).map(d=>new u(d,r,n,i,o)))}return new u(s,r,n,i,o)}structured(t,e){const s=t.table===void 0?e.sheet.tableAt(e.row,e.col):this.wb.table(t.table);return s?et(s,t,e):t.table===void 0?h.REF:h.NAME}nameValue(t,e,s){const n=t.toLowerCase();if(s===void 0)for(let c=e.scope;c;c=c.parent){const f=c.names.get(n);if(f!==void 0)return f}const o=s===void 0?e.sheet:this.wb.sheet(s);if(!o)return h.REF;const r=this.wb.name(t,o);if(r){if(!r.formula)return r.value??null;const{node:c}=r.formula;if(!c)return h.NAME;if(this.namesAt.has(n))return h.CYCLE;this.namesAt.add(n);try{return this.eval(c,{sheet:e.sheet,row:0,col:0,dr:0,dc:0})}finally{this.namesAt.delete(n)}}const i=this.wb.table(t);if(i){const{top:c,left:f,bottom:d,right:g}=i.data;return new u(i.sheet,c,f,d,g)}const a=v.get(t.toUpperCase());return a&&a.kind!=="lazy"?st(a,t,e):h.NAME}intersect(t,e){return!(t instanceof u)||t.single?t:t.cols===1&&e.row>=t.top&&e.row<=t.bottom?new u(t.sheet,e.row,t.left,e.row,t.left):t.rows===1&&e.col>=t.left&&e.col<=t.right?new u(t.sheet,t.top,e.col,t.top,e.col):h.VALUE}unary(t,e){const s=this.flat(t);return s instanceof p?new p(s.rows,s.cols,s.data.map(e)):e(s)}operate(t,e,s){const n=this.flat(e),o=this.flat(s);if(n instanceof p||o instanceof p){const r=(i,a)=>S(t,i,a);return H(n instanceof p?n:new p(1,1,[n]),o instanceof p?o:new p(1,1,[o]),r)}return S(t,n,o)}rangeOf(t,e){return t instanceof m?t:e instanceof m?e:!(t instanceof u)||!(e instanceof u)||t.sheet!==e.sheet?h.REF:new u(t.sheet,Math.min(t.top,e.top),Math.min(t.left,e.left),Math.max(t.bottom,e.bottom),Math.max(t.right,e.right))}intersection(t,e){if(t instanceof m)return t;if(e instanceof m)return e;if(!(t instanceof u)||!(e instanceof u))return h.REF;const s=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.bottom,e.bottom),r=Math.min(t.right,e.right);return t.sheet!==e.sheet||s>o||n>r?h.NULL:new u(t.sheet,s,n,o,r)}union(t,e){if(t instanceof m)return t;if(e instanceof m)return e;const s=o=>o instanceof u?[o]:o instanceof b?o.parts:[],n=[...s(t),...s(e)];return n.length===0?h.VALUE:new b(n)}eval(t,e){switch(t.kind){case"number":case"string":case"boolean":return t.value;case"error":return m.of(t.code);case"missing":return F;case"ref":return this.resolveRef(t,e);case"structured":return this.structured(t,e);case"name":return this.nameValue(t.name,e,t.sheet);case"paren":return this.eval(t.arg,e);case"unary":{const s=this.eval(t.arg,e);return t.op==="@"?this.intersect(s,e):t.op==="+"?s:this.unary(s,n=>S("*",n,-1))}case"postfix":{const s=this.eval(t.arg,e);if(t.op==="%")return this.unary(s,n=>S("/",n,100));if(s instanceof u&&s.single){const n=s.sheet.at(s.top,s.left);if(n instanceof y){this.read(s.sheet,s.top,s.left);const{spill:o}=n;if(o)return new u(s.sheet,o.top,o.left,o.bottom,o.right);if(n.array)return s}}return h.REF}case"binary":{const s=this.eval(t.left,e),n=this.eval(t.right,e);return t.op===":"?this.rangeOf(s,n):t.op===" "?this.intersection(s,n):t.op===","?this.union(s,n):this.operate(t.op,s,n)}case"array":return new p(t.rows.length,t.rows[0]?.length??0,t.rows.flatMap(s=>s.map(n=>{const o=this.eval(n,e);return o instanceof p||o instanceof u||o instanceof b||o instanceof M||o instanceof x?h.VALUE:o})));case"invoke":{const s=this.eval(t.callee,e);return s instanceof M?this.invoke(s,t.args,e):s instanceof m?s:h.VALUE}case"call":return this.call(t.name,t.args,e)}}invoke(t,e,s){return this.apply(t,e.map(n=>this.eval(n,s)))}apply(t,e){if(t.named!==void 0){const n=v.get(t.named);return!n||n.kind==="lazy"?h.NAME:e.length<n.min||e.length>n.max?h.VALUE:this.applyFunction(n,e,t.frame)}if(e.length>t.params.length)return h.VALUE;const s=new Map;return t.params.forEach((n,o)=>{s.set(n,e[o]??F)}),this.eval(t.body,{...t.frame,scope:{names:s,...t.frame.scope?{parent:t.frame.scope}:{}}})}call(t,e,s){const n=v.get(t);if(!n){const o=this.nameValue(t,s);return o instanceof M?this.invoke(o,e,s):h.NAME}return e.length<n.min||e.length>n.max?h.VALUE:n.kind==="lazy"?n.call(e,{calc:this,frame:s}):this.applyFunction(n,e.map(o=>this.eval(o,s)),s)}applyFunction(t,e,s){const n={calc:this,frame:s};if(t.kind==="lazy")return h.VALUE;if(t.kind==="raw")return j(t.params,e.length)?this.over(e,r=>X(t.params,r)==="value",r=>t.call(r,n)):h.VALUE;const o=t.errors===!0;return this.over(e,()=>!0,r=>{const i=r.map(a=>a instanceof x?void 0:a);if(!o){for(const a of i)if(a instanceof m)return a}return t.call(...i)})}over(t,e,s){const n=[],o=new Map;for(const[f,d]of t.entries()){if(!e(f)||d instanceof x){n.push(d);continue}const g=this.flat(d);g instanceof p&&o.set(f,g),n.push(g)}if(o.size===0)return s(n);const r=[...o.values()],i=Math.max(...r.map(f=>f.rows)),a=Math.max(...r.map(f=>f.cols));if(i===0||a===0)return h.CALC;const c=new Array(i*a);for(let f=0;f<i;f++)for(let d=0;d<a;d++){const g=n.map((C,A)=>{const w=o.get(A);if(!w)return C;const L=w.rows===1?0:f,R=w.cols===1?0:d;return L<w.rows&&R<w.cols?w.at(L,R):h.NA});c[f*a+d]=this.element(s(g))}return new p(i,a,c)}element(t){const e=this.flat(t);return e instanceof p?e.rows>0&&e.cols>0?e.at(0,0):h.CALC:e}scalar(t,e){if(t instanceof x)return null;if(t instanceof u){const s=this.intersect(t,e);return s instanceof u?this.read(s.sheet,s.top,s.left):h.VALUE}return t instanceof p?t.at(0,0):t instanceof b||t instanceof M?h.VALUE:t}recalculate(){if(this.replica)return this;const t=this.allCells().filter(e=>this.analysisOf(e.shared).volatile);return this.mark(t),this}build(){if(this.graphMade)return;this.graphMade=!0;const t=this.allCells();for(const e of t)this.analysisOf(e.shared).volatile&&this.volatiles.add(e);this.graph.build(t)}addEdges(t){this.analysisOf(t.shared).volatile&&this.volatiles.add(t),this.graph.add(t)}removeEdges(t){this.volatiles.delete(t),this.graph.remove(t)}readersIn(t,e){return this.graph.readersIn(t,e)}readers(t,e,s){return this.build(),this.graph.readers(t,e,s)}precedents(t){return this.readsOf(t)}mark(t){this.build();const e=new Set(t),s=[...t];for(;;){const n=s.pop();if(!n)break;for(const o of this.readers(n.sheet,n.row,n.col))e.has(o)||(e.add(o),s.push(o))}this.settle(e)}settle(t){for(const e of t)e.state=1,this.inCycle.delete(e);this.cycles=this.cycles.filter(e=>!e.some(s=>t.has(s))),this.run([...t])}set(t,e,s,n){const o=typeof n=="string"&&n.length>1&&n.startsWith("=")?new y(new I(n,e,s,{file:""}),t,e,s):void 0;this.change([{sheet:t,row:e,col:s,slot:o??n??void 0}])}prepare(){this.build()}change(t){if(this.replica){for(const{sheet:o,row:r,col:i,slot:a}of t){const c=o.at(r,i);c instanceof y&&o.clearSpill(c),o.replace(r,i,a),a instanceof y&&(a.state=0)}return}this.build();const e=new Set,s=[...this.unsettled];this.unsettled.clear();const n=new Set;for(const{sheet:o,row:r,col:i,slot:a}of t){const c=o.at(r,i);c instanceof y&&(n.add(c),this.inCycle.delete(c),this.removeEdges(c),e.delete(c),c.spill&&this.moved.push({sheet:o,area:c.spill}),o.clearSpill(c));const f=o.spillAt(r,i);f&&s.push(f),s.push(...o.blockedBy({top:r,left:i,bottom:r,right:i})),o.replace(r,i,a),this.forget(o,{top:r,left:i,bottom:r,right:i}),a instanceof y&&(this.addEdges(a),e.add(a))}n.size>0&&(this.cycles=this.cycles.filter(o=>!o.some(r=>n.has(r))));for(const{sheet:o,row:r,col:i}of t)s.push(...this.readers(o,r,i));for(s.push(...this.volatiles);;){const o=s.pop();if(!o)break;e.has(o)||(e.add(o),s.push(...this.readers(o.sheet,o.row,o.col)))}this.settle(e)}setName(t,e){const s=this.wb.name(t);if(!s)throw new Error(`There is no name ${t}.`);s.value=e,delete s.formula;const n=t.toLowerCase();this.mark(this.allCells().filter(o=>this.analysisOf(o.shared).names.has(n)))}takeComputed(){const t=[];for(const e of this.settled)t.push({sheet:e.sheet.index,row:e.row,col:e.col,value:P(e.value),...e.array?{array:W(e.array)}:{},...e.spill?{spill:e.spill}:{},...e.blocked?{blocked:e.blocked}:{}});return this.settled.clear(),{cells:t,cycles:this.cycles.map(e=>e.map(s=>({sheet:s.sheet.index,row:s.row,col:s.col}))),hidden:[...this.hiddenBy].map(([e,s])=>({sheet:e.index,rows:[...s]}))}}receive(t){for(const s of t.cells){const n=this.wb.sheets[s.sheet],o=n?.at(s.row,s.col);!n||!(o instanceof y)||(n.clearSpill(o),o.value=G(s.value),o.array=s.array?D(s.array):void 0,s.spill&&n.placeSpill(o,s.spill),s.blocked&&n.blockSpill(o,s.blocked),o.state=0)}this.cycles=t.cycles.flatMap(s=>{const n=s.flatMap(o=>{const r=this.wb.sheets[o.sheet]?.at(o.row,o.col);return r instanceof y?[r]:[]});return n.length>0?[n]:[]});const e=new Map(this.hiddenBy);this.hiddenBy.clear();for(const{sheet:s,rows:n}of t.hidden){const o=this.wb.sheets[s];if(!o)continue;const r=e.get(o),i=r?.size===n.length&&n.every(a=>r.has(a));this.hiddenBy.set(o,i?r:new Set(n))}for(const s of this.wb.sheets)s.tighten()}numberOf(t){return q(t)}}const Q=(l,t)=>l?.top===t?.top&&l?.left===t?.left&&l?.bottom===t?.bottom&&l?.right===t?.right;function tt(l){return l.data.some(t=>t===null)?new p(l.rows,l.cols,l.data.map(t=>t??0)):l}function V(l){return{sheet:l.sheet,row:l.row,col:l.col,dr:l.row-l.shared.row,dc:l.col-l.shared.col}}function et(l,t,e){const{sheet:s}=l,n=l.area;let o=n.left,r=n.right;const[i,a]=t.columns;if(i!==void 0){const A=l.column(i),w=a===void 0?A:l.column(a);if(!A||!w)return h.REF;o=n.left+Math.min(A.index,w.index),r=n.left+Math.max(A.index,w.index)}if(t.thisRow)return e.sheet!==s||e.row<=n.top||e.row>n.bottom?h.VALUE:new u(s,e.row,o,e.row,r);const c=t.sections;if(c.includes("#Totals"))return h.REF;const f=c.includes("#All")||c.includes("#Headers"),d=c.length===0||c.includes("#All")||c.includes("#Data"),g=f?n.top:n.top+1,C=d?n.bottom:n.top;return new u(s,g,o,C,r)}function st(l,t,e){return new M([],{kind:"call",name:l.name,written:t,args:[]},e,l.name)}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{MAX_ROWS as b}from"../../address.js";import{CellError as s,ERR as m,Matrix as g}from"../../values.js";import{FormulaCell as D}from"../../workbook.js";import{finite as E,snap as w}from"../coerce.js";import{Reference as R,Union as y}from"../types.js";import{FUNCTIONS as I,cellsOf as P,eachArg as O,many as c,numbersOf as h,numbersOfA as M,raw as i}from"./define.js";function V(n){let t=0;for(const e of n)t=w(t+e,t,e);return t}i("SUM",1,c,(n,t)=>{let e=0,o;return O(n,t,(f,l)=>{if(!o){if(typeof f=="number")e=w(e+f,e,f);else if(f instanceof s)o=f;else if(l){const a=h([f],t);a instanceof s?o=a:e+=a[0]??0}}}),o??E(e)}),i("AVERAGE",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?m.DIV0:V(e)/e.length}),i("AVERAGEA",1,c,(n,t)=>{const e=M(n,t);return e instanceof s?e:e.length===0?m.DIV0:V(e)/e.length}),i("COUNT",1,c,(n,t)=>{let e=0;return O(n,t,(o,f)=>{typeof o=="number"?e+=1:f&&!(o instanceof s)&&o!==null&&(h([o],t)instanceof s||(e+=1))}),e}),i("COUNTA",1,c,(n,t)=>{let e=0;return O(n,t,()=>{e+=1}),e}),i("COUNTBLANK",1,1,(n,t)=>{const e=n[0];if(e instanceof s)return e;if(e instanceof R){let f=0;return t.calc.each(e,l=>{l!==""&&(f+=1)}),e.rows*e.cols-f}const o=t.calc.flat(e);return o instanceof g?o.data.filter(f=>f===null||f==="").length:o===null||o===""?1:0});const C=n=>t=>{if(t instanceof s)return t;if(t.length===0)return 0;let e=t[0]??0;for(const o of t)e=n(e,o);return e},N=C((n,t)=>t<n?t:n),L=C((n,t)=>t>n?t:n);i("MIN",1,c,(n,t)=>N(h(n,t))),i("MAX",1,c,(n,t)=>L(h(n,t))),i("MINA",1,c,(n,t)=>N(M(n,t))),i("MAXA",1,c,(n,t)=>L(M(n,t))),i("PRODUCT",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?0:E(e.reduce((o,f)=>o*f,1))}),i("SUMSQ",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:E(V(e.map(o=>o*o)))}),i("SUMPRODUCT",1,c,(n,t)=>{const e=n.map(r=>P(r,t)),o=e[0];if(o===void 0||o instanceof s)return o??m.VALUE;let{rows:f}=o;const{cols:l}=o,a=r=>r.reference&&r.reference.bottom<b-1?r.reference.rows:r.rows;for(const r of e){if(r instanceof s)return r;if(r.cols!==l||a(r)!==a(o))return m.VALUE;f=Math.min(f,r.rows)}let d=0;for(let r=0;r<f;r++)for(let U=0;U<l;U++){let T=1;for(const p of e){const A=p.at(r,U);if(A instanceof s)return A;T*=typeof A=="number"?A:0}d+=T}return E(d)});const k={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"};function B(n){if(!(n instanceof D))return!1;const{node:t}=n.shared;return t?.kind==="call"&&t.name==="SUBTOTAL"}i("SUBTOTAL",2,c,(n,t)=>{const e=t.calc.scalar(n[0],t.frame);if(e instanceof s)return e;if(typeof e!="number")return m.VALUE;const o=e<100,f=k[o?e:e-100],l=f===void 0?void 0:I.get(f);if(l?.kind!=="raw")return m.VALUE;const a=[],d=r=>{const U=u=>r.sheet.spec.rows?.[String(u+1)]?.hidden===!0,T=Math.min(r.bottom,r.sheet.lastRow),p=[],A=t.calc.filtered(r.sheet);for(let u=r.top;u<=T;u++)if(!A.has(u)&&!(!o&&U(u)))for(let S=r.left;S<=r.right;S++)p.push(B(r.sheet.at(u,S))?null:t.calc.read(r.sheet,u,S));a.push(new g(p.length,1,p))};for(const r of n.slice(1)){if(r instanceof s)return r;if(r instanceof R)d(r);else if(r instanceof y)r.parts.forEach(d);else return m.VALUE}return l.call(a,t)});
2
+ import{MAX_ROWS as L}from"../../address.js";import{CellError as s,ERR as u,Matrix as V}from"../../values.js";import{FormulaCell as b}from"../../workbook.js";import{finite as S,snap as g}from"../coerce.js";import{Reference as w,Union as D}from"../types.js";import{FUNCTIONS as I,cellsOf as y,eachArg as E,numbersOf as h,numbersOfA as O,raw as i}from"./define.js";function M(n){let t=0;for(const e of n)t=g(t+e,t,e);return t}i("SUM","(r)",(n,t)=>{let e=0,o;return E(n,t,(f,c)=>{if(!o){if(typeof f=="number")e=g(e+f,e,f);else if(f instanceof s)o=f;else if(c){const l=h([f],t);l instanceof s?o=l:e+=l[0]??0}}}),o??S(e)}),i("AVERAGE","(r)",(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?u.DIV0:M(e)/e.length}),i("AVERAGEA","(r)",(n,t)=>{const e=O(n,t);return e instanceof s?e:e.length===0?u.DIV0:M(e)/e.length}),i("COUNT","(r)",(n,t)=>{let e=0;return E(n,t,(o,f)=>{typeof o=="number"?e+=1:f&&!(o instanceof s)&&o!==null&&(h([o],t)instanceof s||(e+=1))}),e}),i("COUNTA","(r)",(n,t)=>{let e=0;return E(n,t,()=>{e+=1}),e}),i("COUNTBLANK","r",(n,t)=>{const e=n[0];if(e instanceof s)return e;if(e instanceof w){let f=0;return t.calc.each(e,c=>{c!==""&&(f+=1)}),e.rows*e.cols-f}const o=t.calc.flat(e);return o instanceof V?o.data.filter(f=>f===null||f==="").length:o===null||o===""?1:0});const R=n=>t=>{if(t instanceof s)return t;if(t.length===0)return 0;let e=t[0]??0;for(const o of t)e=n(e,o);return e},C=R((n,t)=>t<n?t:n),N=R((n,t)=>t>n?t:n);i("MIN","(r)",(n,t)=>C(h(n,t))),i("MAX","(r)",(n,t)=>N(h(n,t))),i("MINA","(r)",(n,t)=>C(O(n,t))),i("MAXA","(r)",(n,t)=>N(O(n,t))),i("PRODUCT","(r)",(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?0:S(e.reduce((o,f)=>o*f,1))}),i("SUMSQ","(r)",(n,t)=>{const e=h(n,t);return e instanceof s?e:S(M(e.map(o=>o*o)))}),i("SUMPRODUCT","(r)",(n,t)=>{const e=n.map(r=>y(r,t)),o=e[0];if(o===void 0||o instanceof s)return o??u.VALUE;let{rows:f}=o;const{cols:c}=o,l=r=>r.reference&&r.reference.bottom<L-1?r.reference.rows:r.rows;for(const r of e){if(r instanceof s)return r;if(r.cols!==c||l(r)!==l(o))return u.VALUE;f=Math.min(f,r.rows)}let A=0;for(let r=0;r<f;r++)for(let d=0;d<c;d++){let p=1;for(const U of e){const m=U.at(r,d);if(m instanceof s)return m;p*=typeof m=="number"?m:0}A+=p}return S(A)});const P={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"};function k(n){if(!(n instanceof b))return!1;const{node:t}=n.shared;return t?.kind==="call"&&t.name==="SUBTOTAL"}i("SUBTOTAL","v(r)",(n,t)=>{const e=t.calc.scalar(n[0],t.frame);if(e instanceof s)return e;if(typeof e!="number")return u.VALUE;const o=e<100,f=P[o?e:e-100],c=f===void 0?void 0:I.get(f);if(c?.kind!=="raw")return u.VALUE;const l=[],A=r=>{const d=a=>r.sheet.spec.rows?.[String(a+1)]?.hidden===!0,p=Math.min(r.bottom,r.sheet.lastRow),U=[],m=t.calc.filtered(r.sheet);for(let a=r.top;a<=p;a++)if(!m.has(a)&&!(!o&&d(a)))for(let T=r.left;T<=r.right;T++)U.push(k(r.sheet.at(a,T))?null:t.calc.read(r.sheet,a,T));l.push(new V(U.length,1,U))};for(const r of n.slice(1)){if(r instanceof s)return r;if(r instanceof w)A(r);else if(r instanceof D)r.parts.forEach(A);else return u.VALUE}return c.call(l,t)});
@@ -0,0 +1,4 @@
1
+ import { CellError } from "../../values.js";
2
+ /** A number from one unit to another; #N/A for an unknown unit or two of different quantities. */
3
+ export declare function convert(value: number, from: string, to: string): number | CellError;
4
+ //# sourceMappingURL=convert.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 b,ERR as l}from"../../values.js";import{toNumber as I,toText as v}from"../coerce.js";import{scalar as w}from"./define.js";const u=.0254,s=12*u,d=3*s,_=5280*s,g=1852,h=9460730472580800,k=u/72,f=453.59237,E=9.80665,P=f/1e3*E,K=s*P,q=231*u**3/128,R=.00454609,T=101325,O=550*K,N=new Map;function t(a,i){for(const o of a)N.set(o,i)}const e=(a,i)=>({quantity:a,factor:i,prefix:1});t(["g"],e("mass",1)),t(["sg"],{quantity:"mass",factor:P*1e3/s}),t(["lbm"],{quantity:"mass",factor:f}),t(["u"],e("mass",1660538782e-33)),t(["ozm"],{quantity:"mass",factor:f/16}),t(["grain"],{quantity:"mass",factor:f/7e3}),t(["cwt","shweight"],{quantity:"mass",factor:100*f}),t(["uk_cwt","lcwt","hweight"],{quantity:"mass",factor:112*f}),t(["stone"],{quantity:"mass",factor:14*f}),t(["ton"],{quantity:"mass",factor:2e3*f}),t(["uk_ton","LTON","brton"],{quantity:"mass",factor:2240*f}),t(["m"],e("distance",1)),t(["mi"],{quantity:"distance",factor:_}),t(["Nmi"],{quantity:"distance",factor:g}),t(["in"],{quantity:"distance",factor:u}),t(["ft"],{quantity:"distance",factor:s}),t(["yd"],{quantity:"distance",factor:d}),t(["ang"],e("distance",1e-10)),t(["ell"],{quantity:"distance",factor:45*u}),t(["ly"],e("distance",h)),t(["parsec","pc"],e("distance",648e3/Math.PI*149597870700)),t(["Picapt","Pica"],{quantity:"distance",factor:k}),t(["pica"],{quantity:"distance",factor:u/6}),t(["survey_mi"],{quantity:"distance",factor:6336e3/3937}),t(["yr"],{quantity:"time",factor:365.25*86400}),t(["day","d"],{quantity:"time",factor:86400}),t(["hr"],{quantity:"time",factor:3600}),t(["mn","min"],{quantity:"time",factor:60}),t(["sec","s"],e("time",1)),t(["Pa","p"],e("pressure",1)),t(["atm","at"],e("pressure",T)),t(["mmHg"],e("pressure",T/760)),t(["psi"],{quantity:"pressure",factor:P/u**2}),t(["Torr"],{quantity:"pressure",factor:T/760}),t(["N"],e("force",1)),t(["dyn","dy"],e("force",1e-5)),t(["lbf"],{quantity:"force",factor:P}),t(["pond"],e("force",E/1e3)),t(["J"],e("energy",1)),t(["e"],e("energy",1e-7)),t(["c"],e("energy",4.184)),t(["cal"],e("energy",4.1868)),t(["eV","ev"],e("energy",1602176487e-28)),t(["HPh","hh"],{quantity:"energy",factor:O*3600}),t(["Wh","wh"],e("energy",3600)),t(["flb"],{quantity:"energy",factor:K}),t(["BTU","btu"],{quantity:"energy",factor:1055.05585262}),t(["HP","h"],{quantity:"power",factor:O}),t(["PS"],{quantity:"power",factor:75*E}),t(["W","w"],e("power",1)),t(["T"],e("magnetism",1)),t(["ga"],e("magnetism",1e-4));const y=(a,i,o=!1)=>{t(a,{quantity:"volume",factor:i**3,...o?{prefix:3}:{}})};t(["tsp"],{quantity:"volume",factor:q/6}),t(["tspm"],{quantity:"volume",factor:5e-6}),t(["tbs"],{quantity:"volume",factor:q/2}),t(["oz"],{quantity:"volume",factor:q}),t(["cup"],{quantity:"volume",factor:8*q}),t(["pt","us_pt"],{quantity:"volume",factor:16*q}),t(["uk_pt"],{quantity:"volume",factor:R/8}),t(["qt"],{quantity:"volume",factor:32*q}),t(["uk_qt"],{quantity:"volume",factor:R/4}),t(["gal"],{quantity:"volume",factor:128*q}),t(["uk_gal"],{quantity:"volume",factor:R}),t(["l","L","lt"],e("volume",.001)),t(["barrel"],{quantity:"volume",factor:5376*q}),t(["bushel"],{quantity:"volume",factor:2150.42*u**3}),t(["GRT","regton"],{quantity:"volume",factor:100*s**3}),t(["MTON"],{quantity:"volume",factor:40*s**3}),y(["m3","m^3"],1,!0),y(["ang3","ang^3"],1e-10,!0),y(["ft3","ft^3"],s),y(["in3","in^3"],u),y(["ly3","ly^3"],h),y(["mi3","mi^3"],_),y(["yd3","yd^3"],d),y(["Nmi3","Nmi^3"],g),y(["Pica3","Picapt3","Pica^3","Picapt^3"],k);const m=(a,i,o=!1)=>{t(a,{quantity:"area",factor:i**2,...o?{prefix:2}:{}})};t(["uk_acre"],{quantity:"area",factor:4840*d**2}),t(["us_acre"],{quantity:"area",factor:43560*(1200/3937)**2}),t(["ar"],e("area",100)),t(["ha"],{quantity:"area",factor:1e4}),t(["Morgen"],{quantity:"area",factor:2500}),m(["m2","m^2"],1,!0),m(["ang2","ang^2"],1e-10,!0),m(["ft2","ft^2"],s),m(["in2","in^2"],u),m(["ly2","ly^2"],h),m(["mi2","mi^2"],_),m(["yd2","yd^2"],d),m(["Nmi2","Nmi^2"],g),m(["Pica2","Picapt2","Pica^2","Picapt^2"],k),t(["bit"],{quantity:"information",factor:1,prefix:1,binary:!0}),t(["byte"],{quantity:"information",factor:8,prefix:1,binary:!0}),t(["admkn"],{quantity:"speed",factor:6080*s/3600}),t(["kn"],{quantity:"speed",factor:g/3600}),t(["m/h","m/hr"],e("speed",1/3600)),t(["m/s","m/sec"],e("speed",1)),t(["mph"],{quantity:"speed",factor:_/3600});const U={Y:1e24,Z:1e21,E:1e18,P:1e15,T:1e12,G:1e9,M:1e6,k:1e3,h:100,da:10,e:10,d:.1,c:.01,m:.001,u:1e-6,n:1e-9,p:1e-12,f:1e-15,a:1e-18,z:1e-21,y:1e-24},L={Yi:2**80,Zi:2**70,Ei:2**60,Pi:2**50,Ti:2**40,Gi:2**30,Mi:2**20,ki:2**10},A={C:{toK:a=>a+273.15,fromK:a=>a-273.15},F:{toK:a=>(a-32)*5/9+273.15,fromK:a=>(a-273.15)*9/5+32},K:{toK:a=>a,fromK:a=>a},Rank:{toK:a=>a*5/9,fromK:a=>a*9/5},Reau:{toK:a=>a*5/4+273.15,fromK:a=>(a-273.15)*4/5}},M={C:"C",cel:"C",F:"F",fah:"F",K:"K",kel:"K",Rank:"Rank",Reau:"Reau"};function C(a){const i=M[a];if(i!==void 0)return{kind:"temperature",scale:i,times:1};const o=N.get(a);if(o)return{kind:"unit",quantity:o.quantity,factor:o.factor};for(const[n,r]of Object.entries(U)){if(!a.startsWith(n))continue;const c=a.slice(n.length);if(M[c]==="K")return{kind:"temperature",scale:"K",times:r};const p=N.get(c);if(p?.prefix!==void 0)return{kind:"unit",quantity:p.quantity,factor:p.factor*r**p.prefix}}for(const[n,r]of Object.entries(L)){if(!a.startsWith(n))continue;const c=N.get(a.slice(n.length));if(c?.binary===!0)return{kind:"unit",quantity:c.quantity,factor:c.factor*r}}}export function convert(a,i,o){const n=C(i),r=C(o);if(!n||!r)return l.NA;if(n.kind==="temperature"||r.kind==="temperature"){if(n.kind!=="temperature"||r.kind!=="temperature")return l.NA;const c=A[n.scale],p=A[r.scale];return!c||!p?l.NA:p.fromK(c.toK(a*n.times))/r.times}return n.quantity!==r.quantity?l.NA:a*n.factor/r.factor}w("CONVERT",3,3,(a,i,o)=>{const n=I(a),r=v(i),c=v(o);return n instanceof b?n:r instanceof b?r:c instanceof b?c:convert(n,r,c)});
@@ -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 d,ERR as g,Matrix as U}from"../../values.js";import{compare as W,numberOfText as A,sameNumber as N}from"../coerce.js";import{Reference as R}from"../types.js";import{cellsOf as h,many as w,raw as p}from"./define.js";export function indexKey(e){if(typeof e=="number")return`n${String(Number(e.toPrecision(15)))}`;if(typeof e=="string")return`t${e.toUpperCase()}`;if(typeof e=="boolean")return e?"bT":"bF"}export function wildcard(e){let n="";for(let t=0;t<e.length;t++){const s=e.charAt(t);s==="~"&&/[*?~]/u.test(e.charAt(t+1))?(t+=1,n+=e.charAt(t).replace(/[*?]/u,"\\$&")):s==="*"?n+="[\\s\\S]*":s==="?"?n+="[\\s\\S]":n+=s.replace(/[.+^${}()|[\]\\/-]/gu,"\\$&")}const r=new RegExp(`^${n}$`,"iu");return t=>r.test(t)}export const hasWildcard=e=>/[*?~]/u.test(e);function b(e){return n=>{if(typeof n=="number")return N(n,e);if(typeof n!="string")return!1;const r=A(n);return r!==void 0&&N(r,e)}}function q(e,n){const r=t=>e===">"?t>0:e===">="?t>=0:e==="<"?t<0:t<=0;return t=>typeof t==typeof n&&r(W(t,n))}export function criterion(e){if(e===null)return{test:b(0),key:"n0"};if(typeof e=="number")return{test:b(e),key:`n${String(Number(e.toPrecision(15)))}`};if(typeof e=="boolean")return{test:o=>o===e,key:e?"bT":"bF"};if(e instanceof d)return{test:o=>o===e};const n=/^(<>|>=|<=|=|>|<)/u.exec(e),r=n?.[1]??"=",t=n?e.slice(r.length):e,s=o=>o===null;if(t==="")return r==="="?{test:n?s:o=>o===null||o===""}:r==="<>"?{test:o=>o!==null}:{test:()=>!1};const c=A(t),f=/^(?:TRUE|FALSE)$/iu.test(t)?t.toUpperCase()==="TRUE":void 0,l=c??f;if(r==="="||r==="<>"){let o,i;if(c!==void 0)o=b(c),i=indexKey(c);else if(f!==void 0)o=u=>u===f,i=indexKey(f);else if(t.startsWith("#"))o=u=>u instanceof d&&u.code===t.toUpperCase();else if(hasWildcard(t)){const u=wildcard(t);o=a=>typeof a=="string"&&u(a)}else{const u=t.toUpperCase();o=a=>typeof a=="string"&&a.toUpperCase()===u,i=indexKey(t)}return r==="="?i===void 0?{test:o}:{test:o,key:i}:{test:u=>!o(u)}}return{test:q(r,l??t)}}function D(e,n){const r=e.reference;if(r?.cols!==1||e.rows<64)return;const t=`crit:${r.key}`,s=n.calc.indexes.get(t);if(s)return s;const c=new Map;for(let f=0;f<e.rows;f++){const l=e.at(f,0),o=i=>{if(i===void 0)return;const u=c.get(i);u?u.push(f):c.set(i,[f])};if(o(indexKey(l)),typeof l=="string"){const i=A(l);i!==void 0&&o(indexKey(i))}}return n.calc.indexes.set(t,c),c}function I(e,n){const r=n.calc.scalar(e,n.frame);return criterion(r)}function T(e,n){const r=[];for(let s=0;s+1<e.length;s+=2){const c=h(e[s],n);if(c instanceof d)return c;const f=I(e[s+1],n);if(f instanceof d)return f;r.push({cells:c,crit:f})}const t=r[0]?.cells;return t&&r.some(s=>!V(s.cells,t))?g.VALUE:r}const V=(e,n)=>e.cols===n.cols&&(e.reference?.rows??e.rows)===(n.reference?.rows??n.rows);function F(e,n,r){const t=e[0];if(!t)return;const s=e.slice(1),c=(o,i)=>s.every(u=>u.crit.test(u.cells.at(o,i))),f=t.crit.key===void 0?void 0:D(t.cells,n);if(f&&t.crit.key!==void 0){for(const o of f.get(t.crit.key)??[])c(o,0)&&r(o,0);return}const l=Math.max(...e.map(o=>o.cells.rows));for(let o=0;o<l;o++)for(let i=0;i<t.cells.cols;i++)t.crit.test(t.cells.at(o,i))&&c(o,i)&&r(o,i)}function K(e,n){return e instanceof R?(e.rows-n.rows)*e.cols:0}function O(e,n,r,t){let s;return F(n,r,(c,f)=>{if(s)return;const l=e.at(c,f);l instanceof d?s=l:typeof l=="number"&&t(l)}),s}function X(e,n){const r=h(e[0],n);if(r instanceof d)return r;const t=e[2];return t===void 0?r:h(t,n)}const L=e=>(n,r)=>{const t=h(n[0],r);if(t instanceof d)return t;const s=I(n[1],r);if(s instanceof d)return s;const c=X(n,r);if(c instanceof d)return c;const f=[];return O(c,[{cells:t,crit:s}],r,o=>{f.push(o)})??e(f)},x=e=>(n,r)=>{if(n.length%2===0)return g.VALUE;const t=h(n[0],r);if(t instanceof d)return t;const s=T(n.slice(1),r);if(s instanceof d)return s;const c=s[0]?.cells;if(c&&!V(t,c))return g.VALUE;const f=[];return O(t,s,r,o=>{f.push(o)})??e(f)},m=(e,n)=>(r,t)=>{const s=new Map;for(const[i,u]of r.entries()){if(!e(i)||!(u instanceof U||u instanceof R&&!u.single))continue;const a=h(u,t);if(a instanceof d)return a;s.set(i,a)}if(s.size===0)return n(r,t);const c=[...s.values()],f=Math.max(...c.map(i=>i.rows)),l=Math.max(...c.map(i=>i.cols)),o=[];for(let i=0;i<f;i++)for(let u=0;u<l;u++){const a=r.map((G,P)=>{const y=s.get(P);if(!y)return G;const $=y.rows===1?0:i,C=y.cols===1?0:u;return $<y.rows&&C<y.cols?y.at($,C):g.NA}),S=n(a,t);o.push(S instanceof U?S.at(0,0):S)}return new U(f,l,o)},k=e=>e===1,E=e=>e>=2&&e%2===0,j=e=>e%2===1,M=e=>e.reduce((n,r)=>n+r,0),z=e=>e.length===0?g.DIV0:M(e)/e.length,B=e=>e.length===0?0:e.reduce((n,r)=>r<n?r:n),H=e=>e.length===0?0:e.reduce((n,r)=>r>n?r:n);p("SUMIF",2,3,m(k,L(M))),p("AVERAGEIF",2,3,m(k,L(z))),p("SUMIFS",3,w,m(E,x(M))),p("AVERAGEIFS",3,w,m(E,x(z))),p("MINIFS",3,w,m(E,x(B))),p("MAXIFS",3,w,m(E,x(H))),p("COUNTIF",2,2,m(k,(e,n)=>{const r=h(e[0],n);if(r instanceof d)return r;const t=I(e[1],n);if(t instanceof d)return t;let s=0;return F([{cells:r,crit:t}],n,()=>{s+=1}),s+(t.test(null)?K(e[0],r):0)})),p("COUNTIFS",2,w,m(j,(e,n)=>{if(e.length%2===1)return g.VALUE;const r=T(e,n);if(r instanceof d)return r;let t=0;return F(r,n,()=>{t+=1}),t}));
2
+ import{CellError as l,ERR as I}from"../../values.js";import{compare as R,numberOfText as S,sameNumber as b}from"../coerce.js";import{Missing as T,Reference as A}from"../types.js";import{indexKeyOf as k}from"../indexes.js";import{cellsOf as h,raw as p}from"./define.js";export function indexKey(e){if(typeof e=="number")return`n${String(Number(e.toPrecision(15)))}`;if(typeof e=="string")return`t${e.toUpperCase()}`;if(typeof e=="boolean")return e?"bT":"bF"}export function wildcard(e){let r="";for(let t=0;t<e.length;t++){const o=e.charAt(t);o==="~"&&/[*?~]/u.test(e.charAt(t+1))?(t+=1,r+=e.charAt(t).replace(/[*?]/u,"\\$&")):o==="*"?r+="[\\s\\S]*":o==="?"?r+="[\\s\\S]":r+=o.replace(/[.+^${}()|[\]\\/-]/gu,"\\$&")}const n=new RegExp(`^${r}$`,"iu");return t=>n.test(t)}export const hasWildcard=e=>/[*?~]/u.test(e);function g(e){return r=>{if(typeof r=="number")return b(r,e);if(typeof r!="string")return!1;const n=S(r);return n!==void 0&&b(n,e)}}function w(e,r){const n=t=>e===">"?t>0:e===">="?t>=0:e==="<"?t<0:t<=0;return t=>typeof t==typeof r&&n(R(t,r))}export function criterion(e){if(e===null)return{test:g(0),key:"n0"};if(typeof e=="number")return{test:g(e),key:`n${String(Number(e.toPrecision(15)))}`};if(typeof e=="boolean")return{test:s=>s===e,key:e?"bT":"bF"};if(e instanceof l)return{test:s=>s===e};const r=/^(<>|>=|<=|=|>|<)/u.exec(e),n=r?.[1]??"=",t=r?e.slice(n.length):e,o=s=>s===null;if(t==="")return n==="="?{test:r?o:s=>s===null||s===""}:n==="<>"?{test:s=>s!==null}:{test:()=>!1};const i=S(t),c=/^(?:TRUE|FALSE)$/iu.test(t)?t.toUpperCase()==="TRUE":void 0,f=i??c;if(n==="="||n==="<>"){let s,u;if(i!==void 0)s=g(i),u=indexKey(i);else if(c!==void 0)s=d=>d===c,u=indexKey(c);else if(t.startsWith("#"))s=d=>d instanceof l&&d.code===t.toUpperCase();else if(hasWildcard(t)){const d=wildcard(t);s=m=>typeof m=="string"&&d(m)}else{const d=t.toUpperCase();s=m=>typeof m=="string"&&m.toUpperCase()===d,u=indexKey(t)}return n==="="?u===void 0?{test:s}:{test:s,key:u}:{test:d=>!s(d)}}return{test:w(n,f??t)}}function O(e,r){const n=e.reference;if(!(n?.cols!==1||e.rows<64))return r.calc.indexes.of(k("crit",n),[n],()=>{const t=new Map,o=(i,c)=>{if(i===void 0)return;const f=t.get(i);f?f.push(c):t.set(i,[c])};for(let i=0;i<e.rows;i++){const c=e.at(i,0);if(o(indexKey(c),i),typeof c=="string"){const f=S(c);f!==void 0&&o(indexKey(f),i)}}return t})}function F(e,r){const n=r.calc.scalar(e,r.frame);return criterion(n)}function $(e,r){const n=[];for(let o=0;o+1<e.length;o+=2){const i=h(e[o],r);if(i instanceof l)return i;const c=F(e[o+1],r);if(c instanceof l)return c;n.push({cells:i,crit:c})}const t=n[0]?.cells;return t&&n.some(o=>!x(o.cells,t))?I.VALUE:n}const x=(e,r)=>e.cols===r.cols&&(e.reference?.rows??e.rows)===(r.reference?.rows??r.rows);function E(e,r,n){const t=e[0];if(!t)return;let o,i;for(const f of e){if(f.crit.key===void 0)continue;const s=O(f.cells,r);if(!s)continue;const u=s.get(f.crit.key)??[];(o===void 0||u.length<o.length)&&(o=u,i=f)}if(o!==void 0){const f=e.filter(s=>s!==i);for(const s of o)f.every(u=>u.crit.test(u.cells.at(s,0)))&&n(s,0);return}const c=Math.max(...e.map(f=>f.cells.rows));for(let f=0;f<c;f++)for(let s=0;s<t.cells.cols;s++)e.every(u=>u.crit.test(u.cells.at(f,s)))&&n(f,s)}function V(e,r){return e instanceof A?(e.rows-r.rows)*e.cols:0}function M(e,r,n,t){let o;return E(r,n,(i,c)=>{if(o)return;const f=e.at(i,c);f instanceof l?o=f:typeof f=="number"&&t(f)}),o}function G(e,r){const n=h(e[0],r);if(n instanceof l)return n;const t=e[2];return t===void 0?n:h(t,r)}const C=e=>(r,n)=>{const t=h(r[0],n);if(t instanceof l)return t;const o=F(r[1],n);if(o instanceof l)return o;const i=G(r,n);if(i instanceof l)return i;const c=[];return M(i,[{cells:t,crit:o}],n,s=>{c.push(s)})??e(c)},y=e=>(r,n)=>{const t=h(r[0],n);if(t instanceof l)return t;const o=$(r.slice(1),n);if(o instanceof l)return o;const i=o[0]?.cells;if(i&&!x(t,i))return I.VALUE;const c=[];return M(t,o,n,s=>{c.push(s)})??e(c)},a=(e,r)=>(n,t)=>{const o=[],i=[e];for(const u of n)if(u instanceof A)o.push(u),i.push(`r${u.key}`);else if(u instanceof T)i.push("-");else if(u instanceof l)i.push(`e${u.code}`);else if(u===null||typeof u!="object")i.push(`${typeof u}:${String(u)}`);else return r(n,t);if(o.length===0)return r(n,t);const c=i.join("\0"),f=t.calc.results.get(c);if(f!==void 0)return f;const s=r(n,t);return(s===null||typeof s!="object"||s instanceof l)&&t.calc.results.set(c,o,s),s},U=e=>e.reduce((r,n)=>r+n,0),N=e=>e.length===0?I.DIV0:U(e)/e.length,j=e=>e.length===0?0:e.reduce((r,n)=>n<r?n:r),v=e=>e.length===0?0:e.reduce((r,n)=>n>r?n:r);p("SUMIF","rv?r",a("SUMIF",C(U))),p("AVERAGEIF","rv?r",a("AVERAGEIF",C(N))),p("SUMIFS","r(rv)",a("SUMIFS",y(U))),p("AVERAGEIFS","r(rv)",a("AVERAGEIFS",y(N))),p("MINIFS","r(rv)",a("MINIFS",y(j))),p("MAXIFS","r(rv)",a("MAXIFS",y(v))),p("COUNTIF","rv",a("COUNTIF",(e,r)=>{const n=h(e[0],r);if(n instanceof l)return n;const t=F(e[1],r);if(t instanceof l)return t;let o=0;return E([{cells:n,crit:t}],r,()=>{o+=1}),o+(t.test(null)?V(e[0],n):0)})),p("COUNTIFS","(rv)",a("COUNTIFS",(e,r)=>{const n=$(e,r);if(n instanceof l)return n;let t=0;return E(n,r,()=>{t+=1}),t}));