@allyhub/sdk 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (717) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/dist/define.d.ts +20 -3
  3. package/dist/define.js +1 -1
  4. package/dist/dom.d.ts +1 -1
  5. package/dist/dom.js +1 -1
  6. package/dist/free.d.ts +6 -6
  7. package/dist/free.js +1 -1
  8. package/dist/input.js +1 -1
  9. package/dist/media.d.ts +1 -1
  10. package/dist/media.js +1 -1
  11. package/dist/messages.d.ts +1 -1
  12. package/dist/node_modules/@allyhub/audio/dist/node/ffmpeg.js +2 -0
  13. package/dist/node_modules/{@allyhub-next → @allyhub}/audio/package.json +2 -2
  14. package/dist/node_modules/@allyhub/chart/dist/chart-file.d.ts +11 -0
  15. package/dist/node_modules/@allyhub/chart/dist/chart-file.js +2 -0
  16. package/dist/node_modules/{@allyhub-next → @allyhub}/chart/dist/chart-xml.d.ts +2 -0
  17. package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +3 -0
  18. package/dist/node_modules/{@allyhub-next → @allyhub}/chart/dist/chart.d.ts +3 -1
  19. package/dist/node_modules/@allyhub/chart/dist/chart.js +2 -0
  20. package/dist/node_modules/@allyhub/chart/dist/embedded.d.ts +15 -0
  21. package/dist/node_modules/@allyhub/chart/dist/embedded.js +3 -0
  22. package/dist/node_modules/@allyhub/chart/dist/index.d.ts +6 -0
  23. package/dist/node_modules/@allyhub/chart/dist/index.js +2 -0
  24. package/dist/node_modules/@allyhub/chart/dist/svg.d.ts +22 -0
  25. package/dist/node_modules/@allyhub/chart/dist/svg.js +2 -0
  26. package/dist/node_modules/{@allyhub-next → @allyhub}/chart/package.json +2 -2
  27. package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/slides.d.ts +3 -3
  28. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +2 -0
  29. package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/schemas.d.ts +1 -1
  30. package/dist/node_modules/{@allyhub-next → @allyhub}/formats/package.json +2 -2
  31. package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/package.json +2 -2
  32. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/account.d.ts +1 -0
  33. package/dist/node_modules/@allyhub/protocol/dist/app.js +2 -0
  34. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/auth.d.ts +8 -4
  35. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/auth.js +1 -1
  36. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/cloud.d.ts +1 -0
  37. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +2 -0
  38. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/editor.d.ts +68 -3
  39. package/dist/node_modules/@allyhub/protocol/dist/editor.js +2 -0
  40. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +290 -0
  41. package/dist/node_modules/@allyhub/protocol/dist/frame.js +2 -0
  42. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/index.d.ts +3 -0
  43. package/dist/node_modules/@allyhub/protocol/dist/index.js +2 -0
  44. package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +91 -0
  45. package/dist/node_modules/@allyhub/protocol/dist/jobs.js +2 -0
  46. package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +187 -0
  47. package/dist/node_modules/@allyhub/protocol/dist/notes.js +2 -0
  48. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/registry.d.ts +6 -0
  49. package/dist/node_modules/@allyhub/protocol/dist/registry.js +2 -0
  50. package/dist/node_modules/@allyhub/protocol/dist/routes.js +2 -0
  51. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/sites.d.ts +4 -0
  52. package/dist/node_modules/@allyhub/protocol/dist/sites.js +2 -0
  53. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/snapshots.d.ts +48 -8
  54. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +2 -0
  55. package/dist/node_modules/@allyhub/protocol/dist/sources.d.ts +14 -0
  56. package/dist/node_modules/{@allyhub-next/chart/dist/index.js → @allyhub/protocol/dist/sources.js} +1 -1
  57. package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +195 -0
  58. package/dist/node_modules/@allyhub/protocol/dist/teams.js +2 -0
  59. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/tools.d.ts +52 -3
  60. package/dist/node_modules/@allyhub/protocol/dist/tools.js +2 -0
  61. package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/package.json +2 -2
  62. package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/bundled.d.ts +1 -1
  63. package/dist/node_modules/@allyhub/runtimes/dist/bundled.js +2 -0
  64. package/dist/node_modules/@allyhub/runtimes/dist/download.d.ts +38 -0
  65. package/dist/node_modules/@allyhub/runtimes/dist/download.js +2 -0
  66. package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/index.d.ts +2 -2
  67. package/dist/node_modules/@allyhub/runtimes/dist/index.js +2 -0
  68. package/dist/node_modules/@allyhub/runtimes/dist/lock.d.ts +14 -0
  69. package/dist/node_modules/@allyhub/runtimes/dist/lock.js +2 -0
  70. package/dist/node_modules/@allyhub/runtimes/dist/manifest.d.ts +3 -0
  71. package/dist/node_modules/@allyhub/runtimes/dist/manifest.js +2 -0
  72. package/dist/node_modules/@allyhub/runtimes/dist/node-program.d.ts +12 -0
  73. package/dist/node_modules/@allyhub/runtimes/dist/node-program.js +2 -0
  74. package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/packages.d.ts +21 -2
  75. package/dist/node_modules/@allyhub/runtimes/dist/packages.js +4 -0
  76. package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/runtimes.d.ts +4 -1
  77. package/dist/node_modules/@allyhub/runtimes/dist/runtimes.js +4 -0
  78. package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/package.json +2 -2
  79. package/dist/node_modules/@allyhub/runtimes/pins/pdfjs-dist/package-lock.json +275 -0
  80. package/dist/node_modules/@allyhub/runtimes/pins/pdfjs-dist/package.json +11 -0
  81. package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/package.json +2 -2
  82. package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +2 -0
  83. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/charts.d.ts +1 -1
  84. package/dist/node_modules/@allyhub/sheet/dist/api/charts.js +2 -0
  85. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/page.d.ts +1 -1
  86. package/dist/node_modules/@allyhub/sheet/dist/api/page.js +2 -0
  87. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/rules.d.ts +1 -1
  88. package/dist/node_modules/@allyhub/sheet/dist/api/rules.js +2 -0
  89. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/styles.d.ts +1 -1
  90. package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +2 -0
  91. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/workbook.d.ts +1 -1
  92. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +2 -0
  93. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/arrange.d.ts +1 -1
  94. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/server.d.ts +1 -1
  95. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/chart.d.ts +4 -10
  96. package/dist/node_modules/@allyhub/sheet/dist/chart.js +2 -0
  97. package/dist/node_modules/@allyhub/sheet/dist/diff.js +2 -0
  98. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/edit.d.ts +1 -1
  99. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/file.d.ts +1 -1
  100. package/dist/node_modules/@allyhub/sheet/dist/file.js +3 -0
  101. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/files.d.ts +1 -1
  102. package/dist/node_modules/@allyhub/sheet/dist/files.js +2 -0
  103. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/generated.d.ts +1 -1
  104. package/dist/node_modules/@allyhub/sheet/dist/generated.js +2 -0
  105. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/inspect.d.ts +1 -1
  106. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/paginate.d.ts +1 -1
  107. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/structure.d.ts +1 -1
  108. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/table-style.d.ts +1 -1
  109. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/validate.d.ts +1 -1
  110. package/dist/node_modules/@allyhub/sheet/dist/validate.js +2 -0
  111. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/workbook.d.ts +1 -1
  112. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +2 -0
  113. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/charts.d.ts +1 -1
  114. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +2 -0
  115. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/import.d.ts +1 -1
  116. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +2 -0
  117. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/read.d.ts +2 -2
  118. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +3 -0
  119. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +2 -0
  120. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/zip.d.ts +1 -1
  121. package/dist/node_modules/@allyhub/sheet/dist/xlsx/zip.js +2 -0
  122. package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/package.json +2 -2
  123. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/animation.d.ts +1 -1
  124. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/api.d.ts +9 -5
  125. package/dist/node_modules/@allyhub/slides-core/dist/api.js +4 -0
  126. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/chart-api.d.ts +2 -2
  127. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +2 -0
  128. package/dist/node_modules/@allyhub/slides-core/dist/code.js +2 -0
  129. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/file.d.ts +1 -1
  130. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/file.js +1 -1
  131. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/index.d.ts +1 -2
  132. package/dist/node_modules/@allyhub/slides-core/dist/index.js +2 -0
  133. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/measure.d.ts +1 -1
  134. package/dist/node_modules/@allyhub/slides-core/dist/measure.js +2 -0
  135. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/merge.d.ts +1 -1
  136. package/dist/node_modules/@allyhub/slides-core/dist/merge.js +2 -0
  137. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/model.d.ts +8 -24
  138. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/resolve.d.ts +2 -2
  139. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +2 -0
  140. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/script.d.ts +1 -1
  141. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/script.js +1 -1
  142. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/strict.d.ts +1 -1
  143. package/dist/node_modules/@allyhub/slides-core/dist/strict.js +2 -0
  144. package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/theme.d.ts +1 -1
  145. package/dist/node_modules/{@allyhub-next/video-core → @allyhub/slides-core}/package.json +2 -2
  146. package/dist/node_modules/@allyhub/video-core/dist/component.d.ts +70 -0
  147. package/dist/node_modules/@allyhub/video-core/dist/component.js +2 -0
  148. package/dist/node_modules/@allyhub/video-core/dist/edits.js +2 -0
  149. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/export.d.ts +1 -1
  150. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/fact.d.ts +2 -2
  151. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/gen.d.ts +1 -1
  152. package/dist/node_modules/@allyhub/video-core/dist/gen.js +2 -0
  153. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/index.d.ts +1 -0
  154. package/dist/node_modules/@allyhub/video-core/dist/index.js +2 -0
  155. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/measure.d.ts +6 -1
  156. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/media.d.ts +2 -2
  157. package/dist/node_modules/@allyhub/video-core/dist/media.js +2 -0
  158. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/piece.d.ts +2 -2
  159. package/dist/node_modules/@allyhub/video-core/dist/piece.js +2 -0
  160. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/problem.d.ts +1 -1
  161. package/dist/node_modules/@allyhub/video-core/dist/problem.js +2 -0
  162. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/schema.d.ts +2 -2
  163. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/speech.js +1 -1
  164. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/timeline.d.ts +8 -3
  165. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/transition.d.ts +11 -0
  166. package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/transition.js +1 -1
  167. package/dist/node_modules/{@allyhub-next/slides-core → @allyhub/video-core}/package.json +2 -2
  168. package/dist/parts.d.ts +2 -2
  169. package/dist/parts.js +1 -1
  170. package/dist/phone.d.ts +3 -3
  171. package/dist/phone.js +1 -1
  172. package/dist/piece.d.ts +7 -7
  173. package/dist/piece.js +1 -1
  174. package/dist/props.d.ts +1 -1
  175. package/dist/sheets.d.ts +1 -1
  176. package/dist/sheets.js +1 -1
  177. package/dist/slides.d.ts +3 -3
  178. package/dist/slides.js +1 -1
  179. package/dist/written.js +1 -1
  180. package/docs/README.md +1 -1
  181. package/docs/defaults.md +54 -1
  182. package/docs/docs.md +152 -5
  183. package/docs/layers.md +26 -0
  184. package/docs/modeling.md +7 -7
  185. package/docs/project.md +2 -2
  186. package/docs/scenery.md +4 -4
  187. package/docs/sheets.md +4 -4
  188. package/docs/slides.md +2 -2
  189. package/docs/websites.md +3 -3
  190. package/package.json +3 -2
  191. package/dist/node_modules/@allyhub-next/audio/dist/node/ffmpeg.js +0 -2
  192. package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +0 -3
  193. package/dist/node_modules/@allyhub-next/chart/dist/chart.js +0 -2
  194. package/dist/node_modules/@allyhub-next/chart/dist/index.d.ts +0 -3
  195. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +0 -2
  196. package/dist/node_modules/@allyhub-next/protocol/dist/app.js +0 -2
  197. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +0 -2
  198. package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +0 -2
  199. package/dist/node_modules/@allyhub-next/protocol/dist/index.js +0 -2
  200. package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +0 -188
  201. package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +0 -2
  202. package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +0 -2
  203. package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +0 -2
  204. package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +0 -2
  205. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +0 -2
  206. package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +0 -79
  207. package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +0 -2
  208. package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +0 -2
  209. package/dist/node_modules/@allyhub-next/runtimes/dist/bundled.js +0 -2
  210. package/dist/node_modules/@allyhub-next/runtimes/dist/download.d.ts +0 -15
  211. package/dist/node_modules/@allyhub-next/runtimes/dist/download.js +0 -2
  212. package/dist/node_modules/@allyhub-next/runtimes/dist/index.js +0 -2
  213. package/dist/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +0 -8
  214. package/dist/node_modules/@allyhub-next/runtimes/dist/lock.js +0 -2
  215. package/dist/node_modules/@allyhub-next/runtimes/dist/manifest.d.ts +0 -3
  216. package/dist/node_modules/@allyhub-next/runtimes/dist/manifest.js +0 -2
  217. package/dist/node_modules/@allyhub-next/runtimes/dist/node-program.d.ts +0 -3
  218. package/dist/node_modules/@allyhub-next/runtimes/dist/node-program.js +0 -2
  219. package/dist/node_modules/@allyhub-next/runtimes/dist/packages.js +0 -4
  220. package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.js +0 -4
  221. package/dist/node_modules/@allyhub-next/sheet/dist/api/capabilities.js +0 -2
  222. package/dist/node_modules/@allyhub-next/sheet/dist/api/charts.js +0 -2
  223. package/dist/node_modules/@allyhub-next/sheet/dist/api/page.js +0 -2
  224. package/dist/node_modules/@allyhub-next/sheet/dist/api/rules.js +0 -2
  225. package/dist/node_modules/@allyhub-next/sheet/dist/api/styles.js +0 -2
  226. package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.js +0 -2
  227. package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +0 -2
  228. package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +0 -2
  229. package/dist/node_modules/@allyhub-next/sheet/dist/file.js +0 -3
  230. package/dist/node_modules/@allyhub-next/sheet/dist/files.js +0 -2
  231. package/dist/node_modules/@allyhub-next/sheet/dist/generated.js +0 -2
  232. package/dist/node_modules/@allyhub-next/sheet/dist/validate.js +0 -2
  233. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +0 -2
  234. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +0 -2
  235. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +0 -2
  236. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +0 -3
  237. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +0 -2
  238. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +0 -2
  239. package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +0 -4
  240. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +0 -2
  241. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-file.d.ts +0 -11
  242. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-file.js +0 -2
  243. package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +0 -2
  244. package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +0 -2
  245. package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +0 -2
  246. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +0 -2
  247. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +0 -2
  248. package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +0 -2
  249. package/dist/node_modules/@allyhub-next/video-core/dist/edits.js +0 -2
  250. package/dist/node_modules/@allyhub-next/video-core/dist/gen.js +0 -2
  251. package/dist/node_modules/@allyhub-next/video-core/dist/index.js +0 -2
  252. package/dist/node_modules/@allyhub-next/video-core/dist/media.js +0 -2
  253. package/dist/node_modules/@allyhub-next/video-core/dist/piece.js +0 -2
  254. package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +0 -2
  255. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/LICENSE +0 -0
  256. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/at-cut.d.ts +0 -0
  257. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/at-cut.js +0 -0
  258. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/decode.d.ts +0 -0
  259. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/decode.js +0 -0
  260. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/envelope.d.ts +0 -0
  261. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/envelope.js +0 -0
  262. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/index.d.ts +0 -0
  263. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/index.js +0 -0
  264. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/levels.d.ts +0 -0
  265. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/levels.js +0 -0
  266. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/master.d.ts +0 -0
  267. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/master.js +0 -0
  268. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/music.d.ts +0 -0
  269. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/music.js +0 -0
  270. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/decode.d.ts +0 -0
  271. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/decode.js +0 -0
  272. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/ebur128.d.ts +0 -0
  273. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/ebur128.js +0 -0
  274. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/ffmpeg.d.ts +0 -0
  275. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/index.d.ts +0 -0
  276. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/index.js +0 -0
  277. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/loudness.d.ts +0 -0
  278. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/loudness.js +0 -0
  279. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/master.d.ts +0 -0
  280. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/master.js +0 -0
  281. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/measure.d.ts +0 -0
  282. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/measure.js +0 -0
  283. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/mix.d.ts +0 -0
  284. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/node/mix.js +0 -0
  285. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/plan.d.ts +0 -0
  286. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/plan.js +0 -0
  287. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recorded.d.ts +0 -0
  288. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recorded.js +0 -0
  289. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/bandwidth.d.ts +0 -0
  290. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/bandwidth.js +0 -0
  291. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/chain.d.ts +0 -0
  292. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/chain.js +0 -0
  293. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/dynamics.d.ts +0 -0
  294. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/dynamics.js +0 -0
  295. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/fft.d.ts +0 -0
  296. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/fft.js +0 -0
  297. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/filters.d.ts +0 -0
  298. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/filters.js +0 -0
  299. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/fit.d.ts +0 -0
  300. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/fit.js +0 -0
  301. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/index.d.ts +0 -0
  302. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/index.js +0 -0
  303. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/loudness.d.ts +0 -0
  304. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/loudness.js +0 -0
  305. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/measure.d.ts +0 -0
  306. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/measure.js +0 -0
  307. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/mic.d.ts +0 -0
  308. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/mic.js +0 -0
  309. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/noise.d.ts +0 -0
  310. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/noise.js +0 -0
  311. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/presets.d.ts +0 -0
  312. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/presets.js +0 -0
  313. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/room.d.ts +0 -0
  314. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/room.js +0 -0
  315. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/setup.d.ts +0 -0
  316. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/setup.js +0 -0
  317. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/vec.d.ts +0 -0
  318. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/recording/vec.js +0 -0
  319. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/render.d.ts +0 -0
  320. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/render.js +0 -0
  321. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/sfx.d.ts +0 -0
  322. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/sfx.js +0 -0
  323. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/shape.d.ts +0 -0
  324. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/shape.js +0 -0
  325. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/voice.d.ts +0 -0
  326. /package/dist/node_modules/{@allyhub-next → @allyhub}/audio/dist/voice.js +0 -0
  327. /package/dist/node_modules/{@allyhub-next → @allyhub}/chart/LICENSE +0 -0
  328. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/LICENSE +0 -0
  329. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/comments.d.ts +0 -0
  330. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/comments.js +0 -0
  331. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/config.d.ts +0 -0
  332. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/config.js +0 -0
  333. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/deck-code.d.ts +0 -0
  334. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/deck-code.js +0 -0
  335. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/edits.d.ts +0 -0
  336. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/edits.js +0 -0
  337. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/elements.d.ts +0 -0
  338. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/elements.js +0 -0
  339. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/faces.d.ts +0 -0
  340. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/faces.js +0 -0
  341. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/file.d.ts +0 -0
  342. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/file.js +0 -0
  343. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/gen.d.ts +0 -0
  344. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/gen.js +0 -0
  345. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/messages.d.ts +0 -0
  346. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/messages.js +0 -0
  347. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/reference.d.ts +0 -0
  348. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/reference.js +0 -0
  349. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/script.d.ts +0 -0
  350. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/script.js +0 -0
  351. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/sheet.d.ts +0 -0
  352. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/sheet.js +0 -0
  353. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/website.d.ts +0 -0
  354. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/website.js +0 -0
  355. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/words.d.ts +0 -0
  356. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/data/words.js +0 -0
  357. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/index.d.ts +0 -0
  358. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/index.js +0 -0
  359. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/items.d.ts +0 -0
  360. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/items.js +0 -0
  361. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/layout.d.ts +0 -0
  362. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/layout.js +0 -0
  363. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/media-type.d.ts +0 -0
  364. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/media-type.js +0 -0
  365. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/note-shape.d.ts +0 -0
  366. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/note-shape.js +0 -0
  367. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/schemas.js +0 -0
  368. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/strict.d.ts +0 -0
  369. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/strict.js +0 -0
  370. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/zip.d.ts +0 -0
  371. /package/dist/node_modules/{@allyhub-next → @allyhub}/formats/dist/zip.js +0 -0
  372. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/LICENSE +0 -0
  373. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/brightness.d.ts +0 -0
  374. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/brightness.js +0 -0
  375. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/color.d.ts +0 -0
  376. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/color.js +0 -0
  377. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/enums.d.ts +0 -0
  378. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/enums.js +0 -0
  379. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/ext.d.ts +0 -0
  380. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/ext.js +0 -0
  381. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/generated/enums.d.ts +0 -0
  382. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/generated/enums.js +0 -0
  383. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/generated/presets.d.ts +0 -0
  384. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/generated/presets.js +0 -0
  385. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/generated/spec.d.ts +0 -0
  386. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/generated/spec.js +0 -0
  387. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/geometry/index.d.ts +0 -0
  388. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/geometry/index.js +0 -0
  389. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/index.d.ts +0 -0
  390. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/index.js +0 -0
  391. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/mce.d.ts +0 -0
  392. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/mce.js +0 -0
  393. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/node.d.ts +0 -0
  394. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/node.js +0 -0
  395. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/ns.d.ts +0 -0
  396. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/ns.js +0 -0
  397. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/opc.d.ts +0 -0
  398. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/opc.js +0 -0
  399. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/report.d.ts +0 -0
  400. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/report.js +0 -0
  401. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/xml.d.ts +0 -0
  402. /package/dist/node_modules/{@allyhub-next → @allyhub}/ooxml/dist/xml.js +0 -0
  403. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/LICENSE +0 -0
  404. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/account.js +0 -0
  405. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/app.d.ts +0 -0
  406. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/blobs.d.ts +0 -0
  407. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/blobs.js +0 -0
  408. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/cli.d.ts +0 -0
  409. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/cli.js +0 -0
  410. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/files.d.ts +0 -0
  411. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/files.js +0 -0
  412. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/jsonrpc.d.ts +0 -0
  413. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/jsonrpc.js +0 -0
  414. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/open.d.ts +0 -0
  415. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/open.js +0 -0
  416. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/routes.d.ts +0 -0
  417. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/runtimes.d.ts +0 -0
  418. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/runtimes.js +0 -0
  419. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/shares.d.ts +0 -0
  420. /package/dist/node_modules/{@allyhub-next → @allyhub}/protocol/dist/shares.js +0 -0
  421. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/LICENSE +0 -0
  422. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/errors.d.ts +0 -0
  423. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/errors.js +0 -0
  424. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/home.d.ts +0 -0
  425. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/home.js +0 -0
  426. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/unpack.d.ts +0 -0
  427. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/dist/unpack.js +0 -0
  428. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/manifest.json +0 -0
  429. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/docx/package-lock.json +0 -0
  430. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/docx/package.json +0 -0
  431. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/gltf-tools/package-lock.json +0 -0
  432. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/gltf-tools/package.json +0 -0
  433. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/manifold-3d/package-lock.json +0 -0
  434. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/manifold-3d/package.json +0 -0
  435. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/onnxruntime-node/package-lock.json +0 -0
  436. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/onnxruntime-node/package.json +0 -0
  437. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/sherpa-onnx-node/package-lock.json +0 -0
  438. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/sherpa-onnx-node/package.json +0 -0
  439. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/tesseract.js/package-lock.json +0 -0
  440. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/pins/tesseract.js/package.json +0 -0
  441. /package/dist/node_modules/{@allyhub-next → @allyhub}/runtimes/schemas/runtimes.schema.json +0 -0
  442. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/LICENSE +0 -0
  443. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/NOTICE +0 -0
  444. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/aim.d.ts +0 -0
  445. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/aim.js +0 -0
  446. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/bake.d.ts +0 -0
  447. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/bake.js +0 -0
  448. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/camera.d.ts +0 -0
  449. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/camera.js +0 -0
  450. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/curve.d.ts +0 -0
  451. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/curve.js +0 -0
  452. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/define.d.ts +0 -0
  453. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/define.js +0 -0
  454. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/fit.d.ts +0 -0
  455. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/fit.js +0 -0
  456. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/glass.d.ts +0 -0
  457. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/glass.js +0 -0
  458. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/handheld.d.ts +0 -0
  459. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/handheld.js +0 -0
  460. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/hull.d.ts +0 -0
  461. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/hull.js +0 -0
  462. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/index.d.ts +0 -0
  463. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/index.js +0 -0
  464. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/lens.d.ts +0 -0
  465. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/lens.js +0 -0
  466. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/moire.d.ts +0 -0
  467. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/moire.js +0 -0
  468. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/motion.d.ts +0 -0
  469. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/motion.js +0 -0
  470. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/move.d.ts +0 -0
  471. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/move.js +0 -0
  472. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/noise.d.ts +0 -0
  473. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/noise.js +0 -0
  474. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/phone.d.ts +0 -0
  475. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/phone.js +0 -0
  476. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/report.d.ts +0 -0
  477. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/report.js +0 -0
  478. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/screen-focus.d.ts +0 -0
  479. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/screen-focus.js +0 -0
  480. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/screen.d.ts +0 -0
  481. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/screen.js +0 -0
  482. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/solve.d.ts +0 -0
  483. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/solve.js +0 -0
  484. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/timing.d.ts +0 -0
  485. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/timing.js +0 -0
  486. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/vec.d.ts +0 -0
  487. /package/dist/node_modules/{@allyhub-next → @allyhub}/scenery/dist/vec.js +0 -0
  488. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/LICENSE +0 -0
  489. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/address.d.ts +0 -0
  490. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/address.js +0 -0
  491. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/capabilities.d.ts +0 -0
  492. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/code.d.ts +0 -0
  493. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/code.js +0 -0
  494. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/hint.d.ts +0 -0
  495. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/hint.js +0 -0
  496. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/index.d.ts +0 -0
  497. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/index.js +0 -0
  498. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/rectangles.d.ts +0 -0
  499. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/api/rectangles.js +0 -0
  500. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/arrange.js +0 -0
  501. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/analyse.d.ts +0 -0
  502. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/analyse.js +0 -0
  503. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/coerce.d.ts +0 -0
  504. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/coerce.js +0 -0
  505. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/engine.d.ts +0 -0
  506. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/engine.js +0 -0
  507. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/aggregate.d.ts +0 -0
  508. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/aggregate.js +0 -0
  509. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/convert.d.ts +0 -0
  510. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/convert.js +0 -0
  511. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/criteria.d.ts +0 -0
  512. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/criteria.js +0 -0
  513. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/database.d.ts +0 -0
  514. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/database.js +0 -0
  515. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/date.d.ts +0 -0
  516. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/date.js +0 -0
  517. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/define.d.ts +0 -0
  518. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/define.js +0 -0
  519. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/delimiters.d.ts +0 -0
  520. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/delimiters.js +0 -0
  521. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/distributions.d.ts +0 -0
  522. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/distributions.js +0 -0
  523. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/dynamic.d.ts +0 -0
  524. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/dynamic.js +0 -0
  525. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/finance.d.ts +0 -0
  526. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/finance.js +0 -0
  527. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/index.d.ts +0 -0
  528. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/index.js +0 -0
  529. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/info.d.ts +0 -0
  530. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/info.js +0 -0
  531. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/kernels.d.ts +0 -0
  532. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/kernels.js +0 -0
  533. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/logical.d.ts +0 -0
  534. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/logical.js +0 -0
  535. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/lookup.d.ts +0 -0
  536. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/lookup.js +0 -0
  537. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/maths.d.ts +0 -0
  538. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/maths.js +0 -0
  539. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/modern.d.ts +0 -0
  540. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/modern.js +0 -0
  541. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/special.d.ts +0 -0
  542. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/special.js +0 -0
  543. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/text.d.ts +0 -0
  544. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/functions/text.js +0 -0
  545. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/graph.d.ts +0 -0
  546. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/graph.js +0 -0
  547. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/indexes.d.ts +0 -0
  548. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/indexes.js +0 -0
  549. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/remote.d.ts +0 -0
  550. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/remote.js +0 -0
  551. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/server.js +0 -0
  552. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/types.d.ts +0 -0
  553. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/calc/types.js +0 -0
  554. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/check.d.ts +0 -0
  555. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/check.js +0 -0
  556. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/csv.d.ts +0 -0
  557. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/csv.js +0 -0
  558. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/diff.d.ts +0 -0
  559. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/edit.js +0 -0
  560. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/export.d.ts +0 -0
  561. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/export.js +0 -0
  562. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/fill.d.ts +0 -0
  563. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/fill.js +0 -0
  564. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/filter.d.ts +0 -0
  565. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/filter.js +0 -0
  566. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/format.d.ts +0 -0
  567. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/format.js +0 -0
  568. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/ast.d.ts +0 -0
  569. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/ast.js +0 -0
  570. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/move.d.ts +0 -0
  571. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/move.js +0 -0
  572. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/parse.d.ts +0 -0
  573. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/parse.js +0 -0
  574. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/print.d.ts +0 -0
  575. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/print.js +0 -0
  576. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/rewrite.d.ts +0 -0
  577. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/rewrite.js +0 -0
  578. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/walk.d.ts +0 -0
  579. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/formula/walk.js +0 -0
  580. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/html.d.ts +0 -0
  581. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/html.js +0 -0
  582. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/import.d.ts +0 -0
  583. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/import.js +0 -0
  584. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/index.d.ts +0 -0
  585. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/index.js +0 -0
  586. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/inspect.js +0 -0
  587. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/paginate.js +0 -0
  588. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/patch.d.ts +0 -0
  589. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/patch.js +0 -0
  590. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/profile.d.ts +0 -0
  591. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/profile.js +0 -0
  592. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/rules.d.ts +0 -0
  593. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/rules.js +0 -0
  594. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/scenario.d.ts +0 -0
  595. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/scenario.js +0 -0
  596. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/series.d.ts +0 -0
  597. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/series.js +0 -0
  598. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/sort.d.ts +0 -0
  599. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/sort.js +0 -0
  600. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/structure.js +0 -0
  601. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/table-style.js +0 -0
  602. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/table-styles.d.ts +0 -0
  603. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/table-styles.js +0 -0
  604. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/values.d.ts +0 -0
  605. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/values.js +0 -0
  606. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/write.d.ts +0 -0
  607. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/write.js +0 -0
  608. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/colors.d.ts +0 -0
  609. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/colors.js +0 -0
  610. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/formula.d.ts +0 -0
  611. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/formula.js +0 -0
  612. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/functions.d.ts +0 -0
  613. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/functions.js +0 -0
  614. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/index.d.ts +0 -0
  615. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/index.js +0 -0
  616. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/numfmt.d.ts +0 -0
  617. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/numfmt.js +0 -0
  618. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/sax.d.ts +0 -0
  619. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/sax.js +0 -0
  620. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/styles.d.ts +0 -0
  621. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/styles.js +0 -0
  622. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/theme.d.ts +0 -0
  623. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/theme.js +0 -0
  624. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/write.d.ts +0 -0
  625. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/xml.d.ts +0 -0
  626. /package/dist/node_modules/{@allyhub-next → @allyhub}/sheet/dist/xlsx/xml.js +0 -0
  627. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/LICENSE +0 -0
  628. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/animation.js +0 -0
  629. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/capabilities.d.ts +0 -0
  630. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/capabilities.js +0 -0
  631. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/check.d.ts +0 -0
  632. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/check.js +0 -0
  633. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/code.d.ts +0 -0
  634. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/components.d.ts +0 -0
  635. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/components.js +0 -0
  636. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/enums.d.ts +0 -0
  637. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/enums.js +0 -0
  638. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/identity.d.ts +0 -0
  639. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/identity.js +0 -0
  640. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/lang.d.ts +0 -0
  641. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/lang.js +0 -0
  642. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/model.js +0 -0
  643. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/office.d.ts +0 -0
  644. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/office.js +0 -0
  645. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/path.d.ts +0 -0
  646. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/path.js +0 -0
  647. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/placeholders.d.ts +0 -0
  648. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/placeholders.js +0 -0
  649. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/stage.d.ts +0 -0
  650. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/stage.js +0 -0
  651. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/theme.js +0 -0
  652. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/units.d.ts +0 -0
  653. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/units.js +0 -0
  654. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/values.d.ts +0 -0
  655. /package/dist/node_modules/{@allyhub-next → @allyhub}/slides-core/dist/values.js +0 -0
  656. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/LICENSE +0 -0
  657. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/anchors.d.ts +0 -0
  658. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/anchors.js +0 -0
  659. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/audio-types.d.ts +0 -0
  660. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/audio-types.js +0 -0
  661. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/backdrop.d.ts +0 -0
  662. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/backdrop.js +0 -0
  663. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/captions.d.ts +0 -0
  664. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/captions.js +0 -0
  665. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/console.d.ts +0 -0
  666. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/console.js +0 -0
  667. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/contrast.d.ts +0 -0
  668. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/contrast.js +0 -0
  669. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/cut-report.d.ts +0 -0
  670. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/cut-report.js +0 -0
  671. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/edit.d.ts +0 -0
  672. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/edit.js +0 -0
  673. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/edits.d.ts +0 -0
  674. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/export.js +0 -0
  675. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/fact.js +0 -0
  676. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/footage-motion.d.ts +0 -0
  677. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/footage-motion.js +0 -0
  678. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/formats.d.ts +0 -0
  679. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/formats.js +0 -0
  680. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/look.d.ts +0 -0
  681. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/look.js +0 -0
  682. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/marks.d.ts +0 -0
  683. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/marks.js +0 -0
  684. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/matrix.d.ts +0 -0
  685. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/matrix.js +0 -0
  686. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/measure.js +0 -0
  687. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/messages.d.ts +0 -0
  688. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/messages.js +0 -0
  689. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/motion.d.ts +0 -0
  690. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/motion.js +0 -0
  691. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/music.d.ts +0 -0
  692. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/music.js +0 -0
  693. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/placement.d.ts +0 -0
  694. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/placement.js +0 -0
  695. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/render-types.d.ts +0 -0
  696. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/render-types.js +0 -0
  697. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/schema.js +0 -0
  698. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/script-edit.d.ts +0 -0
  699. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/script-edit.js +0 -0
  700. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/script.d.ts +0 -0
  701. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/script.js +0 -0
  702. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/seams.d.ts +0 -0
  703. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/seams.js +0 -0
  704. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/sound-under.d.ts +0 -0
  705. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/sound-under.js +0 -0
  706. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/source.d.ts +0 -0
  707. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/source.js +0 -0
  708. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/speech.d.ts +0 -0
  709. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/timeline.js +0 -0
  710. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/timing.d.ts +0 -0
  711. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/timing.js +0 -0
  712. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/transcript.d.ts +0 -0
  713. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/transcript.js +0 -0
  714. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/voice.d.ts +0 -0
  715. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/voice.js +0 -0
  716. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/words.d.ts +0 -0
  717. /package/dist/node_modules/{@allyhub-next → @allyhub}/video-core/dist/words.js +0 -0
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_DATA as G,SHEET_FILE as P,strict as g}from"@allyhub-next/formats";import{Comment as z,HeaderFooter as A,PageMargins as V,PageSetup as Y,SheetProtection as q}from"./page.js";import{columnIndex as E,columnLetter as L,cellName as C,contains as N,rangeName as x,readAddress as y,readArea as k}from"../address.js";import{Calc as Q}from"../calc/engine.js";import{checkWorkbook as X}from"../check.js";import{readCsv as Z,writeCsv as ee}from"../csv.js";import{GENERATED as te}from"../generated.js";import{moveFormula as se,relativeKey as ne}from"../formula/move.js";import{parseFormula as F}from"../formula/parse.js";import{printFormula as B}from"../formula/print.js";import{rewriteFormula as oe}from"../formula/rewrite.js";import{isDateCode as S}from"../format.js";import{patchCsv as re}from"../patch.js";import{CellError as W,dateOfSerial as ie,isoOfSerial as le,readTyped as M,serialOfDate as ae,writeTyped as he}from"../values.js";import{FormulaCell as fe,readWorkbook as I,validName as H}from"../workbook.js";import{restructure as _e,tableShape as ce}from"../structure.js";import{patchYaml as ue}from"../write.js";import{anchorOf as de,chartOfSpec as me}from"./charts.js";import{HINT as w}from"./hint.js";import{rectangles as T}from"./rectangles.js";import{AutoFilter as K,ConditionalFormattingList as pe,DataValidationList as we,validationOf as ge,validationSpec as ke}from"./rules.js";import{alignmentLook as ye,alignmentOf as be,borderLook as ve,borderOf as xe,fillLook as Ee,fillOf as Se,fontLook as $e,fontOf as Ce}from"./styles.js";const J=()=>process.getBuiltinModule("node:fs"),$=(...l)=>process.getBuiltinModule("node:path").join(...l);export const BLOCK_CELLS=100;const Te=l=>Math.round(l*7+5),Oe=l=>(l-5)/7,Le=l=>l*4/3,Ne=l=>l*3/4;function Fe(l,e){const t={},s=l,n=e;for(const o of new Set([...Object.keys(s),...Object.keys(n)])){const r=n[o];JSON.stringify(r??!1)!==JSON.stringify(s[o]??!1)&&(t[o]=r??!1)}return t}const m=l=>Object.keys(l).length===0,b=(l,e)=>{if(!Number.isInteger(l)||l<1)throw new RangeError(`A ${e} is a whole number from 1: ${String(l)}.`);return l},j=(l,e)=>Object.fromEntries(Object.entries(l).filter(([t])=>t!==e));export class Cell{row;column;_ws;_value;_formula=void 0;_look;_changed=!1;_styled=!1;_fresh=!1;constructor(e,t,s){this._ws=e,this.row=t,this.column=s;const n=t-1,o=s-1,r=e._model?.at(n,o);return this._value=null,r instanceof fe?this._formula=r.text:r!==void 0&&(this._value=r),this._look=e._model?.lookAt(n,o)??{},this._fresh=r===void 0,g(this,"Cell",w)}get parent(){return this._ws}get coordinate(){return C({row:this.row-1,col:this.column-1})}get column_letter(){return L(this.column-1)}get col_idx(){return this.column}get value(){return this._ws.parent.data_only?this.computed:this._formula!==void 0?this._formula:this._shown(this._value)}set value(e){if(e===void 0)throw new TypeError(`${this.coordinate}: a value is not undefined.`);if(this._formula=void 0,this._changed=!0,this._ws.parent._pending=!0,e instanceof Date){if(Number.isNaN(e.getTime()))throw new TypeError(`${this.coordinate}: the date is not valid.`);this._value=ae(e),S(this._look.format)||(this._look={...this._look,format:Number.isInteger(this._value)?"yyyy-mm-dd":"yyyy-mm-dd hh:mm"});return}if(typeof e=="string"&&e.length>1&&e.startsWith("=")){this._formula=e,this._value=null;return}this._value=e}_shown(e){return typeof e=="number"&&S(this._look.format)?ie(e)??e:e instanceof W?e.code:e}get computed(){const{calc:e,model:t}=this._ws.parent._computed(),s=t.sheet(this._ws.title);return s?this._shown(e.value(s,this.row-1,this.column-1)):null}get data_type(){if(this._formula!==void 0)return"f";const e=this._value;return e===null?"n":typeof e=="number"?S(this._look.format)?"d":"n":typeof e=="boolean"?"b":e instanceof W?"e":"s"}get is_date(){return this.data_type==="d"}get hyperlink(){return this._ws._links[this.coordinate]}set hyperlink(e){e===void 0?Reflect.deleteProperty(this._ws._links,this.coordinate):this._ws._links[this.coordinate]=e,this._ws._changed()}get comment(){const e=this._ws._notes[this.coordinate];if(e!==void 0)return typeof e=="string"?new z(e):new z(e.text,e.author)}set comment(e){e===void 0?Reflect.deleteProperty(this._ws._notes,this.coordinate):this._ws._notes[this.coordinate]=e._file(),this._ws._changed()}get number_format(){return this._look.format??"General"}set number_format(e){this._setLook({format:e})}_setLook(e){this._look={...this._look,...e},this._styled=!0,this._ws.parent._pending=!0}get font(){return Ce(this._look)}set font(e){this._setLook($e(e))}get fill(){return Se(this._look)}set fill(e){this._setLook(Ee(e))}get border(){return xe(this._look)}set border(e){this._setLook(ve(e))}get alignment(){return be(this._look)}set alignment(e){this._setLook(ye(e))}get has_style(){return!m(this._look)}offset(e=0,t=0){return this._ws.cell(this.row+e,this.column+t)}}export class ColumnDimension{index;_width;_hidden;_files;_level;_ws;constructor(e,t){this._ws=e,this.index=t;const s=e._spec()?.columns?.[t];return this._level=s?.level,this._width=s?.width,this._hidden=s?.hidden,this._files=s?.files,g(this,"ColumnDimension",w)}get outlineLevel(){return this._level}set outlineLevel(e){this._level=e,this._ws._dimensions=!0}get files(){return this._files}set files(e){this._files=e,this._ws._dimensions=!0}get width(){return this._width===void 0?void 0:Oe(this._width)}set width(e){this._width=e===void 0?void 0:Te(e),this._ws._dimensions=!0}get hidden(){return this._hidden??!1}set hidden(e){this._hidden=e,this._ws._dimensions=!0}}export class RowDimension{index;_height;_hidden;_level;_ws;constructor(e,t){this._ws=e,this.index=t;const s=e._spec()?.rows?.[String(t)];return this._level=s?.level,this._height=s?.height,this._hidden=s?.hidden,g(this,"RowDimension",w)}get outlineLevel(){return this._level}set outlineLevel(e){this._level=e,this._ws._dimensions=!0}get height(){return this._height===void 0?void 0:Ne(this._height)}set height(e){this._height=e===void 0?void 0:Le(e),this._ws._dimensions=!0}get hidden(){return this._hidden??!1}set hidden(e){this._hidden=e,this._ws._dimensions=!0}}export class Table{displayName;ref;key;_spec;autoFilter;constructor(e){for(const t of Object.keys(e))if(!["displayName","ref","key"].includes(t))throw new TypeError(`Table takes displayName, ref and key; it has no ${t}. ${w}`);if(!H(e.displayName))throw new TypeError(`${e.displayName} cannot be a table's name.`);if(!k(e.ref))throw new TypeError(`${e.ref} is not a range.`);return this.displayName=e.displayName,this.ref=e.ref,this.key=e.key,this.autoFilter=new K(e.ref,()=>{}),g(this,"Table",w)}get name(){return this.displayName}}export class TableList{_items=new Map;constructor(){return g(this,"TableList",w,{key:e=>this._items.get(e)})}add(e){this._items.set(e.name,e)}get(e){return this._items.get(e)}keys(){return[...this._items.keys()]}values(){return[...this._items.values()]}items(){return[...this._items.entries()]}pop(e){const t=this._items.get(e);return this._items.delete(e),t}}export class DefinedName{name;attr_text;constructor(e,t){if(!H(e))throw new TypeError(`${e} cannot be a name.`);return this.name=e,this.attr_text=t.attr_text.replace(/^=/u,""),g(this,"DefinedName",w)}get value(){return this.attr_text}set value(e){this.attr_text=e.replace(/^=/u,"")}}export class DefinedNameDict{_items=new Map;constructor(){return g(this,"DefinedNameDict",w,{key:e=>this._items.get(e),setKey:(e,t)=>t instanceof DefinedName?(this._items.set(e,t),!0):!1})}add(e){this._items.set(e.name,e)}get(e){return this._items.get(e)}keys(){return[...this._items.keys()]}values(){return[...this._items.values()]}items(){return[...this._items.entries()]}pop(e){const t=this._items.get(e);return this._items.delete(e),t}}const v=l=>{if(l._formula!==void 0)return l._formula;const e=l._value;return typeof e=="number"&&S(l._look.format)?le(e):he(e)};function U(l){if(l._formula!==void 0)return l._formula;const e=l._value;return e===null?null:typeof e=="number"&&!S(l._look.format)||typeof e=="boolean"?e:v(l)}const Me=l=>l.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/gu,"")||"rows";export class Worksheet{_parent;_title;_was;_model;_cells=new Map;_columns=new Map;_rows=new Map;_tables=new TableList;_freeze;_merges=[];_state="visible";_dimensions=!1;_lastRow=0;_rules=[];_validations=[];_filter;_charts=[];_print={};_links={};_notes={};_pictures=[];_protect=!1;constructor(e,t,s){if(this._parent=e,this._title=t,this._filter=new K(void 0,()=>{this._parent._pending=!0}),s){this._model=s,this._was=t,this._freeze=s.spec.freeze,this._heldPage(s.spec),this._merges=[...s.spec.merges??[]],this._state=s.spec.hidden===!0?"hidden":"visible",this._lastRow=(s.used?.bottom??-1)+1,this._heldRules(s.spec);for(const n of s.tables){const o=new Table({displayName:n.name,ref:x(n.area),...n.spec.key===void 0?{}:{key:n.spec.key}});o._spec=n.spec;const{filter:r}=n.spec;if(r)for(const[a,f]of Object.entries(r.columns)){const c=n.column(a);c&&o.autoFilter._columns.set(c.index,f)}this._tables.add(o)}}return g(this,"Worksheet",w,{index:n=>this._rowCells(n),key:n=>this._at(n),setKey:(n,o)=>{const r=y(n);return r?(this.cell(r.row+1,r.col+1).value=o,!0):!1}})}_spec(){return this._parent._file.sheets.find(e=>e.name===(this._was??this._title))}_heldRules(e){this._rules=[...e?.conditional??[]],this._validations=(e?.validations??[]).map(ge),this._charts=(e?.charts??[]).map(me),this._filter.ref=e?.filter?.range,this._filter._columns.clear();const t=e?.filter?k(e.filter.range):void 0;for(const[s,n]of Object.entries(e?.filter?.columns??{})){const o=E(s);t&&o!==void 0&&this._filter._columns.set(o-t.left,n)}}_at(e){const t=y(e);if(t)return this.cell(t.row+1,t.col+1);const s=k(e);if(s)return this._area(s);const n=E(e);if(n!==void 0){const o=[];for(let r=1;r<=this.max_row;r++)o.push(this.cell(r,n+1));return o}}_rowCells(e){const t=[];for(let s=1;s<=this.max_column;s++)t.push(this.cell(e,s));return t}_area(e){const t=[];for(let s=e.top;s<=e.bottom;s++){const n=[];for(let o=e.left;o<=e.right;o++)n.push(this.cell(s+1,o+1));t.push(n)}return t}get parent(){return this._parent}get title(){return this._title}set title(e){const t=this._title;e!==t&&this._parent._renameSheet(this,t,e)}get sheet_state(){return this._state}set sheet_state(e){this._state=e}cell(e,t,s){if(e<1||t<1)throw new RangeError(`Row and column values must be at least 1: ${String(e)}, ${String(t)}.`);const n=(e-1)*16384+t-1;let o=this._cells.get(n);return o||(o=new Cell(this,e,t),this._cells.set(n,o)),s!==void 0&&(o.value=s),e>this._lastRow&&(this._lastRow=e),o}append(e){const t=this._lastRow+1,s=(n,o)=>{o!=null&&this.cell(t,n,o)};if(Array.isArray(e))e.forEach((n,o)=>{s(o+1,n)});else for(const[n,o]of Object.entries(e)){const r=/^\d+$/u.test(n)?Number(n)-1:E(n);if(r===void 0)throw new TypeError(`${n} is not a column.`);s(r+1,o)}this._lastRow=t}get max_row(){return Math.max(1,this._lastRow)}get max_column(){let e=this._model?.columnsUsed??0;for(const t of this._cells.values())(t._value!==null||t._formula!==void 0)&&t.column>e&&(e=t.column);return Math.max(1,e)}min_row=1;min_column=1;get dimensions(){return x({top:0,left:0,bottom:this.max_row-1,right:this.max_column-1})}iter_rows(e={}){const t=this._area({top:(e.min_row??1)-1,left:(e.min_col??1)-1,bottom:(e.max_row??this.max_row)-1,right:(e.max_col??this.max_column)-1});return e.values_only===!0?t.map(s=>s.map(n=>n.value)):t}iter_cols(e={}){const t=this.iter_rows(e);return(t[0]??[]).map((n,o)=>t.map(r=>r[o]))}get rows(){return this.iter_rows()}get columns(){return this.iter_cols()}get values(){return this.iter_rows({values_only:!0})}insert_rows(e,t=1){this._parent._restructure({op:"insert-rows",sheet:this._title,at:b(e,"row")-1,count:b(t,"amount")})}delete_rows(e,t=1){this._parent._restructure({op:"delete-rows",sheet:this._title,at:b(e,"row")-1,count:b(t,"amount")})}insert_cols(e,t=1){this._parent._restructure({op:"insert-columns",sheet:this._title,at:b(e,"column")-1,count:b(t,"amount")})}delete_cols(e,t=1){this._parent._restructure({op:"delete-columns",sheet:this._title,at:b(e,"column")-1,count:b(t,"amount")})}merge_cells(e){if(!k(e))throw new TypeError(`${e} is not a range.`);this._merges.includes(e)||this._merges.push(e),this._parent._pending=!0}unmerge_cells(e){this._merges=this._merges.filter(t=>t!==e),this._parent._pending=!0}get merged_cells(){return[...this._merges]}get freeze_panes(){return this._freeze}set freeze_panes(e){const t=e instanceof Cell?e.coordinate:e;if(t!==void 0&&!y(t))throw new TypeError(`${t} is not a cell.`);this._freeze=t,this._parent._pending=!0}get column_dimensions(){return new Proxy({},{get:(e,t)=>{if(typeof t!="string")return;const s=t.toUpperCase();if(E(s)===void 0)throw new TypeError(`${t} is not a column.`);let n=this._columns.get(s);return n||(n=new ColumnDimension(this,s),this._columns.set(s,n)),n}})}get row_dimensions(){return new Proxy({},{get:(e,t)=>{if(typeof t!="string"||!/^[1-9]\d*$/u.test(t))throw new TypeError(`${String(t)} is not a row.`);const s=Number(t);let n=this._rows.get(s);return n||(n=new RowDimension(this,s),this._rows.set(s,n)),n}})}get tables(){return this._tables}get conditional_formatting(){return new pe(this._rules,()=>{this._parent._pending=!0})}get data_validations(){return new we(this._validations,()=>{this._parent._pending=!0})}add_data_validation(e){this._validations.push(e),this._parent._pending=!0}get auto_filter(){return this._filter}_changed(){this._parent._pending=!0}_heldPage(e){this._print=structuredClone(e?.print??{}),this._links={...e?.links},this._notes={...e?.notes},this._pictures=[...e?.pictures??[]],this._protect=e?.protect===!0}get page_setup(){return new Y(this)}get page_margins(){return new V(this)}get oddHeader(){return new A(this,"header")}get oddFooter(){return new A(this,"footer")}get protection(){return new q(()=>this._protect,e=>{this._protect=e,this._changed()})}get print_area(){return this._print.area}set print_area(e){if(e===void 0)delete this._print.area;else if(k(e))this._print.area=e;else throw new TypeError(`${e} is not a range.`);this._changed()}get print_title_rows(){return this._print.title_rows}set print_title_rows(e){e===void 0?delete this._print.title_rows:this._print.title_rows=e,this._changed()}get print_title_cols(){return this._print.title_cols}set print_title_cols(e){e===void 0?delete this._print.title_cols:this._print.title_cols=e,this._changed()}add_image(e,t){const s=t??e.anchor??"A1";if(!y(s))throw new TypeError(`${s} is not a cell.`);this._pictures.push({file:e.path,at:s,...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}),this._changed()}add_chart(e,t){e.anchor=de(t)??e.anchor,this._charts.push(e),this._parent._pending=!0}add_table(e){if(this._parent._tableNamed(e.name))throw new Error(`There is already a table named ${e.name}.`);this._tables.add(e),this._parent._pending=!0}}export class Workbook{worksheets=[];defined_names=new DefinedNameDict;data_only;title;path;block_cells=BLOCK_CELLS;_file={sheets:[]};_text="";_disk={text:"",csv:new Map};_csv=new Map;_model;_names=new Map;_active=0;_pending=!1;_making=!1;_calc=void 0;constructor(e={}){this.data_only=e.data_only??!1;const t=g(this,"Workbook",w,{key:s=>this.worksheets.find(n=>n.title===s),index:s=>this.worksheets[s]});return t.worksheets=[new Worksheet(t,"Sheet")],t}static open(e,t={}){const s=new Workbook(t);return s.path=e,s._read(e),s}_read(e){const{readFileSync:t}=J(),s=t($(e,P),"utf8"),n=new Map,o=r=>{try{const a=t($(e,r),"utf8");return n.set(r,a),a}catch{return}};this._load(s,o);for(const[r,a]of n)this._keepCsv(r,a);this._disk={text:s,csv:n}}_keepCsv(e,t){const s=Z(t);this._csv.set(e,{parsed:s,rows:s.records.map(n=>n.end===n.start?[]:[...n.fields])})}_load(e,t){const{workbook:s,problems:n}=I({text:e,read:t});if(!s)throw new Error(`sheet.yaml cannot be opened: ${n.map(o=>o.message).join("; ")}`);this._text=e,this._file=structuredClone(s.file),this._model=s,this.title=s.title,this.worksheets=s.sheets.map(o=>new Worksheet(this,o.name,o));for(const o of s.names.values()){if(o.source.path?.[0]!=="names")continue;const r=o.formula?o.formula.text:o.value??null;this._names.set(o.name,r),this.defined_names.add(new DefinedName(o.name,{attr_text:String(r)}))}}get active(){const e=this.worksheets[this._active]??this.worksheets[0];if(!e)throw new Error("The workbook has no sheets.");return e}set active(e){this._active=this.worksheets.indexOf(e)}get sheetnames(){return this.worksheets.map(e=>e.title)}get_sheet_by_name(e){return this.worksheets.find(t=>t.title===e)}index(e){return this.worksheets.indexOf(e)}create_sheet(e,t){let s=e??"Sheet";for(let o=1;this.worksheets.some(r=>r.title===s);o++)s=`${e??"Sheet"}${String(o)}`;const n=new Worksheet(this,s);return this.worksheets.splice(t??this.worksheets.length,0,n),this._pending=!0,n}remove(e){this.worksheets=this.worksheets.filter(t=>t!==e),this._pending=!0}move_sheet(e,t=0){const s=this.worksheets.indexOf(e);this.worksheets.splice(s,1),this.worksheets.splice(s+t,0,e),this._pending=!0}_tableNamed(e){for(const t of this.worksheets){const s=t._tables.get(e);if(s)return s}}_renameSheet(e,t,s){if(this.worksheets.some(o=>o!==e&&o.title===s))throw new Error(`There is already a sheet named ${s}.`);this._apply(),this._rewrite({op:"rename-sheet",from:t,to:s}),e._title=s,e._was=s;const n=this._file.sheets.find(o=>o.name===t);n&&(n.name=s),this._apply()}_restructure(e){this._apply();const t=_e({file:this._file,rows:new Map([...this._csv].map(([n,o])=>[n,o.rows]))},e);if(t.refused!==void 0)throw new Error(t.refused==="table-header"?"A table's header row is not deleted: delete the table's rows, or all of it.":"That sheet is not there.");this._file=t.file;for(const[n,o]of t.rows){const r=this._csv.get(n);r&&(r.rows=o.map(a=>[...a]))}for(const n of this.worksheets){const o=this._file.sheets.find(r=>r.name===n._title);n._cells.clear(),n._columns.clear(),n._rows.clear(),n._merges=[...o?.merges??[]],n._freeze=o?.freeze,n._heldPage(o),n._heldRules(o)}const s=this._build();this._rebase(s.text,s.files);for(const n of this.worksheets){const o=this._model?.sheet(n._title);if(o){n._lastRow=(o.used?.bottom??-1)+1;for(const r of o.tables){const a=n._tables.get(r.name);a&&(a.ref=x(r.area))}}}}_rewrite(e){const t=(n,o)=>{const r=F(n);if(!r.ok)return n;const a=oe(r.node,e,o);return a===r.node?n:B(a)},{_file:s}=this;if(s.names){for(const[n,o]of Object.entries(s.names))if(typeof o=="string"&&o.startsWith("=")){const r=t(o,s.sheets[0]?.name??"");s.names[n]=r,this._names.set(n,r);const a=this.defined_names.get(n);a&&(a.attr_text=r.slice(1))}}for(const n of s.checks??[])n.formula=t(n.formula,s.sheets[0]?.name??"");for(const n of s.sheets){for(const[o,r]of Object.entries(n.cells??{}))typeof r=="string"&&r.startsWith("=")?n.cells[o]=t(r,n.name):r!==null&&typeof r=="object"&&r.formula!==void 0&&(r.formula=t(r.formula,n.name));for(const o of n.tables??[]){for(const r of Object.values(o.columns??{}))r.formula!==void 0&&(r.formula=t(r.formula,n.name));this._rewriteCsv(o.rows,n.name,t)}for(const o of n.blocks??[])this._rewriteCsv(o.rows,n.name,t)}}_rewriteCsv(e,t,s){const n=this._csv.get(e);n&&(n.rows=n.rows.map(o=>o.map(r=>M(r).formula!==void 0?s(r,t):r)))}_sheetEntry(e){const t=e._was??e._title;let s=this._file.sheets.find(n=>n.name===t);return s||(s={name:e._title},this._file.sheets.push(s)),s.name=e._title,s}_dataPath(e){const t=`${G}/${Me(e)}`;let s=`${t}.csv`;const n=o=>this._csv.has(o)||this._file.sheets.some(r=>r.tables?.some(a=>a.rows===o)??r.blocks?.some(a=>a.rows===o));for(let o=2;n(s);o++)s=`${t}-${String(o)}.csv`;return s}_writeNewTable(e,t,s){const n=k(s.ref);if(!n)throw new Error(`${s.ref} is not a range.`);const o=[];for(let i=n.left;i<=n.right;i++){const h=e.cell(n.top+1,i+1).value;if(h===null||h==="")throw new Error(`Table ${s.name}'s header has no name at ${C({row:n.top,col:i})}.`);o.push(String(h))}const r={},a=[];o.forEach((i,h)=>{const _=n.left+h,d=this._columnFormula(e,n,_);d===void 0?a.push(h):r[i]={formula:d};const p=this._columnFormat(e,n,_);p!==void 0&&(r[i]={...r[i],format:p})}),this._columnsStyled(e,n);const f=[a.map(i=>o[i]??"")];for(let i=n.top+1;i<=n.bottom;i++)f.push(a.map(h=>v(e.cell(i+1,n.left+h+1))));t.cells&&(t.cells=Object.fromEntries(Object.entries(t.cells).filter(([i])=>{const h=y(i);return!h||!N(n,h.row,h.col)})));const c=this._dataPath(s.name);this._csv.set(c,{parsed:void 0,rows:f});const u={name:s.name,at:C({row:n.top,col:n.left}),rows:c,...s.key===void 0?{}:{key:s.key},...m(r)?{}:{columns:r}};(t.tables??=[]).push(u),s._spec=u}_columnsStyled(e,t){for(let s=t.left;s<=t.right;s++)for(let n=t.top+1;n<=t.bottom;n++){const o=e.cell(n+1,s+1),{format:r,...a}=this._ownLook(o);r!==void 0&&m(a)&&(o._styled=!1)}}_columnFormula(e,t,s){if(t.bottom<=t.top)return;const n=e.cell(t.top+2,s+1),o=R(n);if(o!==void 0){for(let r=t.top+2;r<=t.bottom;r++)if(R(e.cell(r+1,s+1))!==o)return;return n._formula}}_columnFormat(e,t,s){if(t.bottom<=t.top)return;const n=r=>this._ownLook(e.cell(r+1,s+1)).format,o=n(t.top+1);for(let r=t.top+2;r<=t.bottom;r++)if(n(r)!==o)return;return o}_held(e){const t=this._csv.get(e);if(!t)throw new Error(`${e} was not read.`);return t}_setCsvCell(e,t,s,n){const{rows:o}=this._held(e);for(;o.length<=t;)o.push([]);const r=o[t];if(r){for(;r.length<=s;)r.push("");r[s]=n}}_recordOf(e,t){let s=0;for(let n=0;n<t;){if(s+=1,s>=e.length)return s+t-n-1;e[s]?.length!==0&&(n+=1)}return s}_writeTableCell(e,t,s){const n=this._held(e.rows),o=n.rows[0]??[],r=s.column-1-t.left,a=this._recordOf(n.rows,s.row-1-t.top),f=Object.keys(e.columns??{}).filter(_=>!o.some(d=>d.trim().toLowerCase()===_.toLowerCase())),u=[...o.map(_=>_.trim()),...f][r];if(u===void 0)return;if(a===0){r<o.length&&(o[r]=v(s));return}const i=e.columns?.[u]?.formula;if(i!==void 0){const _=this._movedColumn(i,t,s);if(s._formula===_){const d=o.findIndex(p=>p.trim()===u);d>=0&&this._setCsvCell(e.rows,a,d,"");return}}let h=o.findIndex(_=>_.trim()===u);h<0&&(h=o.length,this._setCsvCell(e.rows,0,h,u)),this._setCsvCell(e.rows,a,h,v(s))}_movedColumn(e,t,s){const n=F(e);if(!n.ok)return e;const o=s.row-1-(t.top+1);return o===0?e:B(se(n.node,o,0))}_apply(){this.title===void 0?delete this._file.title:this._file.title=this.title;const e=new Set(this.worksheets.map(s=>s._was??s._title));this._file.sheets=this._file.sheets.filter(s=>e.has(s.name));for(const s of this.worksheets)this._applySheet(s);this._file.sheets=this.worksheets.map(s=>this._sheetEntry(s)),this._applyNames();const t=this._build();this._rebase(t.text,t.files)}_applyNames(){const e={};for(const t of this.defined_names.values()){const s=M(t.attr_text),n=this._names.get(t.name);e[t.name]=n!==void 0&&String(n).replace(/^=/u,"")===t.attr_text?n:typeof s.value=="number"||typeof s.value=="boolean"?s.value:/^"[^"]*"$/u.test(t.attr_text)?t.attr_text.slice(1,-1):`=${t.attr_text}`}m(e)?delete this._file.names:this._file.names=e}_applySheet(e){const t=this._sheetEntry(e);e._freeze===void 0?delete t.freeze:t.freeze=e._freeze,m(e._print)?delete t.print:t.print=e._print,m(e._links)?delete t.links:t.links=e._links,m(e._notes)?delete t.notes:t.notes=e._notes,e._pictures.length===0?delete t.pictures:t.pictures=e._pictures,e._protect?t.protect=!0:delete t.protect,e._merges.length===0?delete t.merges:t.merges=[...e._merges],e._state==="hidden"?t.hidden=!0:delete t.hidden,e._rules.length===0?delete t.conditional:t.conditional=[...e._rules],e._validations.length===0?delete t.validations:t.validations=e._validations.map(ke),e._charts.length===0?delete t.charts:t.charts=e._charts.map(n=>n._spec(e._title)),this._applyFilter(e,t);const s=new Set(t.tables?.map(n=>n.name.toLowerCase()));for(const n of e._tables.values())s.has(n.name.toLowerCase())||this._writeNewTable(e,t,n);this._applyTableFilters(e,t),this._applyCells(e,t),this._applyDimensions(e,t),t.cells&&m(t.cells)&&delete t.cells,t.columns&&m(t.columns)&&delete t.columns,t.rows&&m(t.rows)&&delete t.rows,t.format?.length===0&&delete t.format,t.tables?.length===0&&delete t.tables,t.blocks?.length===0&&delete t.blocks}_applyFilter(e,t){const{ref:s,_columns:n}=e._filter;if(s===void 0){delete t.filter;return}const o=k(s);if(!o)throw new TypeError(`${s} is not a range.`);const r={};for(const[a,f]of n)r[L(o.left+a)]=f;t.filter={range:s,...m(r)?{}:{columns:r}}}_applyTableFilters(e,t){for(const s of t.tables??[]){const n=e._tables.get(s.name);if(!n||n.autoFilter._columns.size===0)continue;const o=this._csv.get(s.rows)?.rows??[],r=ce(s,o)?.names??[],a={};for(const[f,c]of n.autoFilter._columns){const u=r[f];if(u===void 0)throw new RangeError(`Table ${s.name} has no column at ${String(f)}.`);a[u]=c}s.filter={columns:a}}}_applyDimensions(e,t){if(e._dimensions){for(const[s,n]of e._columns){const o={...t.columns?.[s]};n._width===void 0?delete o.width:o.width=n._width,n._hidden===void 0?delete o.hidden:o.hidden=n._hidden,n._files===void 0?delete o.files:o.files=n._files,n._level===void 0?delete o.level:o.level=n._level;const r=j(t.columns??{},s);t.columns=m(o)?r:{...r,[s]:o}}for(const[s,n]of e._rows){const o={...t.rows?.[String(s)]};n._height===void 0?delete o.height:o.height=n._height,n._hidden===void 0?delete o.hidden:o.hidden=n._hidden,n._level===void 0?delete o.level:o.level=n._level;const r=j(t.rows??{},String(s));t.rows=m(o)?r:{...r,[String(s)]:o}}e._dimensions=!1}}_applyCells(e,t){const s=(t.tables??[]).flatMap(r=>{const a=y(r.at),f=e._tables.get(r.name),c=f?k(f.ref):void 0;return a&&c?[{entry:r,area:c}]:[]}),n=(t.blocks??[]).flatMap(r=>{const a=e._model?.blocks.find(f=>f.file===r.rows);return a?[{entry:r,area:a.area}]:[]}),o=[];for(const r of e._cells.values()){if(!r._changed&&!r._styled)continue;const a=r.row-1,f=r.column-1,c=s.find(i=>N(i.area,a,f)),u=n.find(i=>N(i.area,a,f));c?(r._changed&&this._writeTableCell(c.entry,c.area,r),r._styled&&this._styleByFormat(t,r)):u?(r._changed&&this._setCsvCell(u.entry.rows,a-u.area.top,f-u.area.left,v(r)),r._styled&&this._styleByFormat(t,r)):r._fresh&&!e._model?.keys.has(a*16384+f)?o.push(r):this._writeLoose(e,t,r),r._changed=!1,r._styled=!1}this._consolidate(e,t,o),je(t)}_styleByFormat(e,t){(e.format??=[]).push({range:t.coordinate,...this._ownLook(t)})}_ownLook(e){const t=e._ws._model?.lookAt(e.row-1,e.column-1)??{},s=Fe(t,e._look);return s.format!==void 0&&e._formula===void 0&&M(v(e)).format===s.format&&delete s.format,s}_writeLoose(e,t,s){const n=s.coordinate,o=t.cells??={},r=U(s),a=this._ownLook(s),f=o[n],u={...f!==null&&typeof f=="object"?Object.fromEntries(Object.entries(f).filter(([_])=>_!=="value"&&_!=="formula"&&_!=="name")):{},...a},i=f!==null&&typeof f=="object"&&f.name!==void 0?{name:f.name}:{},h=e._model?.at(s.row-1,s.column-1)!==void 0;if(r===null&&m(u)&&!h){t.cells=j(o,n);return}o[n]=m(u)&&m(i)?r:{...typeof r=="string"&&r.startsWith("=")?{formula:r}:r===null?{}:{value:r},...i,...u}}_consolidate(e,t,s){const n=s.filter(i=>i._value!==null||i._formula!==void 0),o=new Map;for(const i of s){const h=this._ownLook(i);if(m(h))continue;const _=JSON.stringify(h),d=o.get(_);d?d.push(i):o.set(_,[i])}const r=new Map(n.map(i=>[`${String(i.row)}:${String(i.column)}`,i])),a=i=>r.get(`${String(i.row+1)}:${String(i.col+1)}`)??e.cell(i.row+1,i.col+1),f=new Map,c=[];for(const i of n){const h={row:i.row-1,col:i.column-1},_=i._formula===void 0?void 0:R(i);if(_===void 0){c.push(h);continue}const d=f.get(_);d?d.push(h):f.set(_,[h])}const u=t.cells??={};for(const i of f.values())for(const h of T(i))u[x(h)]=a({row:h.top,col:h.left})._formula??null;for(const i of T(c))if((i.bottom-i.top+1)*(i.right-i.left+1)>=this.block_cells){const _=[];for(let p=i.top;p<=i.bottom;p++){const D=[];for(let O=i.left;O<=i.right;O++)D.push(v(a({row:p,col:O})));_.push(D)}const d=this._dataPath(e._title);this._csv.set(d,{parsed:void 0,rows:_}),(t.blocks??=[]).push({at:C({row:i.top,col:i.left}),rows:d})}else for(let _=i.top;_<=i.bottom;_++)for(let d=i.left;d<=i.right;d++){const p=a({row:_,col:d});u[p.coordinate]=U(p)}for(const i of o.values()){const[h]=i;if(!h)continue;const _=this._ownLook(h),d=i.map(p=>({row:p.row-1,col:p.column-1}));for(const p of T(d))(t.format??=[]).push({range:x(p),..._})}}_build(){const e=new Map;for(const[t,s]of this._csv)e.set(t,s.parsed?re(s.parsed,s.rows):ee(s.rows));return{text:ue(this._text,this._file),files:e}}_rebase(e,t){const{workbook:s,problems:n}=I({text:e,read:o=>t.get(o)});if(!s)throw new Error(`The workbook is not one: ${n.map(o=>o.message).join("; ")}`);this._text=e,this._file=structuredClone(s.file),this._model=s;for(const[o,r]of t)this._keepCsv(o,r);this._calc=void 0,this._pending=!1;for(const o of this.worksheets){o._was=o._title;const r=s.sheet(o._title);r&&(o._model=r);for(const a of o._cells.values())a._fresh=r?.at(a.row-1,a.column-1)===void 0}this._names=new Map;for(const o of s.names.values())o.source.path?.[0]==="names"&&this._names.set(o.name,o.formula?o.formula.text:o.value??null)}_computed(){const e=[...this.defined_names.values()];if((this._pending||e.length!==this._names.size||e.some(t=>String(this._names.get(t.name)).replace(/^=/u,"")!==t.attr_text))&&this._apply(),!this._calc){const t=this._model;if(!t)throw new Error("The workbook has no sheets.");this._calc={calc:new Q(t).calculate(),model:t}}return this._calc}check(){this._apply();const{text:e,files:t}=this._build();return X({text:e,read:s=>t.get(s)}).problems}_generated(){if(this.worksheets.length===0)return this._applyNames(),{sheets:[],csv:{},...this._file.names?{names:this._file.names}:{}};this._apply();const e=structuredClone(this._file.sheets),t=n=>`${te}${n}`;for(const n of e){for(const o of n.tables??[])o.rows=t(o.rows);for(const o of n.blocks??[])o.rows=t(o.rows)}const s={};for(const[n,o]of this._build().files)s[t(n)]=o;return{sheets:e,csv:s,...this._file.names?{names:this._file.names}:{}}}save(e){if(this._making)throw new Error("sheet.ts makes sheets and saves nothing: what it adds to wb is what it makes.");const t=e??this.path;if(t===void 0)throw new TypeError("A new workbook is saved to a folder: wb.save('content/budget').");if(this.worksheets.length===0)throw new Error("A workbook has at least one sheet.");const{text:s,csv:n}=this._disk;this._apply();const o=new Set(this._file.sheets.flatMap(i=>[...(i.tables??[]).map(h=>h.rows),...(i.blocks??[]).map(h=>h.rows)])),r=[...this._csv.keys()].filter(i=>!o.has(i));for(const i of r)this._csv.delete(i);const{mkdirSync:a,rmSync:f,writeFileSync:c}=J(),u=process.getBuiltinModule("node:path");a(t,{recursive:!0}),(this._text!==s||e!==void 0)&&c($(t,P),this._text);for(const[i,h]of this._csv){const _=h.parsed?.source??"";if(e===void 0&&n.get(i)===_)continue;const d=$(t,i);a(u.dirname(d),{recursive:!0}),c(d,_)}if(e===void 0||t===this.path)for(const i of r)f($(t,i),{force:!0});this._disk={text:this._text,csv:new Map([...this._csv].map(([i,h])=>[i,h.parsed?.source??""]))},this.path=t}}function R(l){if(l._formula===void 0)return;const e=F(l._formula);if(e.ok)return ne(e.node,l.row-1,l.column-1)}function je(l){const e=l.format;if(!e||e.length<2)return;const t=[],s=new Map;for(const n of e){const{range:o,...r}=n,a=y(o);if(!a){t.push(n);continue}const f=JSON.stringify(r),c=s.get(f);c?c.places.push(a):s.set(f,{look:r,places:[a]})}for(const{look:n,places:o}of s.values())for(const r of T(o))t.push({range:x(r),...n});l.format=t}export function load_workbook(l,e={}){return Workbook.open(l,e)}export const get_column_letter=l=>L(l-1);export function column_index_from_string(l){const e=E(l);if(e===void 0)throw new TypeError(`${l} is not a column.`);return e+1}export function coordinate_to_tuple(l){const e=y(l);if(!e)throw new TypeError(`${l} is not a cell.`);return[e.row+1,e.col+1]}export function range_boundaries(l){const e=k(l);if(!e)throw new TypeError(`${l} is not a range.`);return[e.left+1,e.top+1,e.right+1,e.bottom+1]}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{chartDrawing as B,colorRgb as U,isRound as F,isScatter as R}from"@allyhub-next/chart";import{cellName as q,columnLetter as I,contains as V,rangeName as j,readAddress as W,readArea as G}from"./address.js";import{Reference as N,Union as J}from"./calc/types.js";import{shownValue as K}from"./format.js";import{sheetPrefix as D}from"./formula/print.js";import{CellError as Q,Matrix as T}from"./values.js";export const SHEET_CHART_DEFAULTS={width:480,height:288,size:9,titleSize:14,ink:"#595959",pixelsToPoints:.75};const X={dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"},k=e=>U(e,X);function z(e,o,n){const{node:t}=n;if(!t)return[];const i=e.eval(t,{sheet:o,row:0,col:0,dr:0,dc:0}),s=u=>{const a=u.sheet,p=e.filtered(a),m=[],x=Math.min(u.bottom,a.lastRow),g=Math.min(u.right,a.columnsUsed-1);for(let c=u.top;c<=x;c++)if(!(p.has(c)||a.spec.rows?.[String(c+1)]?.hidden===!0))for(let d=u.left;d<=g;d++)a.spec.columns?.[I(d)]?.hidden!==!0&&m.push({value:e.value(a,c,d),sheet:a,row:c,col:d});return m};if(i instanceof N)return s(i);if(i instanceof J)return i.parts.flatMap(s);if(i instanceof T)return i.data.map(u=>({value:u}));const r=e.flat(i);return r instanceof T?r.data.map(u=>({value:u})):[{value:r}]}const E=e=>{if(e.value===null)return"";const o=e.sheet&&e.row!==void 0&&e.col!==void 0?e.sheet.lookAt(e.row,e.col).format:void 0;return K(e.value,o)};function H(e){return typeof e=="number"?Number.isFinite(e)?e:null:e===null||e instanceof Q?null:typeof e=="boolean"&&e?1:0}const P=e=>e&&{...e.min===void 0?{}:{minimum_scale:e.min},...e.max===void 0?{}:{maximum_scale:e.max},...e.major===void 0?{}:{major_unit:e.major},...e.gridlines===void 0?{}:{has_major_gridlines:e.gridlines},...e.visible===void 0?{}:{visible:e.visible},...e.format===void 0?{}:{number_format:e.format},...e.reverse===void 0?{}:{reverse_order:e.reverse},...e.title===void 0||e.title===""?{}:{title:e.title}},C=e=>e===void 0?void 0:{rgb:e};function Y(e){if(e===void 0||e===!1)return;if(e===!0)return{show_value:!0};const o=typeof e.color=="string"?C(e.color):void 0;return{...e.value===void 0?{}:{show_value:e.value},...e.percentage===void 0?{}:{show_percentage:e.percentage},...e.category===void 0?{}:{show_category_name:e.category},...e.series===void 0?{}:{show_series_name:e.series},...e.format===void 0?{}:{number_format:e.format},...e.position===void 0?{}:{position:e.position},...e.size===void 0?{}:{size:e.size},...o?{color:o}:{}}}const Z=e=>{const o=e.find(n=>n.sheet);return o?.sheet&&o.row!==void 0&&o.col!==void 0?o.sheet.lookAt(o.row,o.col).format:void 0};export function chartDef(e,o,n){const{spec:t}=n,i=R(t.type),s=n.categories?z(e,o,n.categories):void 0,r=n.series.map((d,b)=>{const h=t.series[b],v=z(e,o,d.values),$=d.name?z(e,o,d.name)[0]:void 0,A=d.x?z(e,o,d.x):i?s:void 0,w=h.format??Z(v),y=C(h.color);return{name:($?E($):h.name)??`Series${String(b+1)}`,values:v.map(f=>H(f.value)),...A?{x:A.map(f=>H(f.value))}:{},...w===void 0?{}:{number_format:w},...y?{color:y}:{},...h.smooth===void 0?{}:{smooth:h.smooth},...h.line_width===void 0?{}:{line_width:h.line_width},...h.marker_size===void 0?{}:{marker_size:h.marker_size}}}),u=Math.max(0,...r.map(d=>d.values.length)),a=s?s.map(E):Array.from({length:u},(d,b)=>String(b+1)),p=n.title?z(e,o,n.title)[0]:void 0,m=p?E(p):t.title,x=Y(t.labels),g=P(t.value_axis),c=P(t.category_axis);return{type:t.type,categories:a,series:r,...m===void 0||m===""?{}:{title:m},...t.legend===void 0?{}:{legend:t.legend},...x?{labels:x}:{},...t.gap_width===void 0?{}:{gap_width:t.gap_width},...t.overlap===void 0?{}:{overlap:t.overlap},...t.vary_by_categories===void 0?{}:{vary_by_categories:t.vary_by_categories},...t.hole_size===void 0?{}:{hole_size:t.hole_size},...g?{value_axis:g}:{},...c?{category_axis:c}:{},font_size:t.size??SHEET_CHART_DEFAULTS.size,title_size:t.title_size??SHEET_CHART_DEFAULTS.titleSize,font_color:C(t.color)??{rgb:SHEET_CHART_DEFAULTS.ink}}}export const chartSize=e=>({width:e.width??SHEET_CHART_DEFAULTS.width,height:e.height??SHEET_CHART_DEFAULTS.height});const ee={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},O=e=>e.replace(/[&<>"]/gu,o=>ee[o]??o),l=e=>String(Number(e.toFixed(3)));function L(e){const o=e.fill===void 0?"none":k(e.fill),n=e.width>0?k(e.color):"none";return`<path d="${O(e.d)}" fill="${o}" stroke="${n}" stroke-width="${l(e.width)}" stroke-linejoin="round"/>`}function te(e){const o=[];for(const n of[...e.grid,...e.shapes])o.push(L(n));for(const n of[...e.boxes,...e.keys])o.push(`<rect x="${l(n.x)}" y="${l(n.y)}" width="${l(n.width)}" height="${l(n.height)}" fill="${k(n.color)}"/>`);for(const n of[...e.axes,...e.lines])o.push(L(n));for(const n of e.dots)o.push(`<circle cx="${l(n.x)}" cy="${l(n.y)}" r="${l(n.r)}" fill="${k(n.color)}"/>`);for(const n of e.words){const t=n.rotate===void 0?"":` transform="rotate(${l(n.rotate)} ${l(n.x)} ${l(n.y)})"`;o.push(`<text x="${l(n.x)}" y="${l(n.y)}" font-size="${l(n.size)}" text-anchor="${n.anchor}" dominant-baseline="central" fill="${k(n.color)}"${t}>${O(n.text)}</text>`)}return o.join("")}export function chartSvg(e,o,n,t={}){const i=SHEET_CHART_DEFAULTS.pixelsToPoints,s=o*i,r=n*i,u=t.font??"Carlito, Calibri, Arial, sans-serif",a=t.paper??"#FFFFFF",p=t.edge??"#D9D9D9";return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l(s)} ${l(r)}" width="${l(o)}" height="${l(n)}" font-family="${O(u)}"><rect x="0.375" y="0.375" width="${l(s-.75)}" height="${l(r-.75)}" fill="${a}" stroke="${p==="none"?"none":p}" stroke-width="0.75"/>${te(B(e,s,r))}</svg>`}export function chartAfter(e,o){const n=i=>i?.startsWith("=")===!0?o(i):i,t=n(e.title);return{...e,...t===void 0?{}:{title:t},...e.categories===void 0?{}:{categories:o(e.categories)},series:e.series.map(i=>{const s=n(i.name);return{...i,values:o(i.values),...i.x===void 0?{}:{x:o(i.x)},...s===void 0?{}:{name:s}}})}}function ne(e,o,n,t){if(t){const i=t.data;if(n.top===i.top&&n.bottom===i.bottom&&n.left===n.right){const s=t.columns[n.left-t.at.col];if(s)return`${t.name}[${s.name}]`}}return`${o===e?"":D(o.name)}${j(n)}`}const oe=(e,o,n,t)=>typeof e.value(o,n,t)=="number",ie=(e,o,n,t)=>{const i=e.value(o,n,t);if(typeof i=="string")return!0;const s=o.lookAt(n,t).format;return typeof i=="number"&&s!==void 0&&/[ymd]/iu.test(s)};export function chartOfRange(e,o,n,t,i){const s=t.bottom-t.top+1,r=t.right-t.left+1,u=o.tables.find(f=>V(f.area,t.top,t.left)),a=f=>ne(n,o,f,u),p=R(i),m=s>1&&Array.from({length:r},(f,_)=>t.left+_).some(f=>!oe(e,o,t.top,f)),x=r>1&&(p||Array.from({length:s-(m?1:0)},(f,_)=>_).every(f=>ie(e,o,t.top+(m?1:0)+f,t.left)||e.value(o,t.top+(m?1:0)+f,t.left)===null)),g=t.top+(m?1:0),c=t.left+(x?1:0);if(g>t.bottom||c>t.right)return;const d=!p&&!F(i)&&t.right-c>t.bottom-g,b=[],h=(f,_)=>e.value(o,f,_)===null?void 0:`=${o===n?"":D(o.name)}${q({row:f,col:_})}`,v=d?{first:g,last:t.bottom}:{first:c,last:t.right};for(let f=v.first;f<=v.last;f++){const _=d?{top:f,left:c,bottom:f,right:t.right}:{top:g,left:f,bottom:t.bottom,right:f},M=d?x?h(f,t.left):void 0:m?h(t.top,f):void 0;b.push({values:a(_),...M===void 0?{}:{name:M}})}const $=d?m?{top:t.top,left:c,bottom:t.top,right:t.right}:void 0:x?{top:g,left:t.left,bottom:t.bottom,right:t.left}:void 0,A=b.length>1&&!F(i),w=F(i)?b.slice(0,1):b,y=w.length===1?w[0]?.name:void 0;return{type:i,...$?{categories:a($)}:{},series:w,...A||F(i)?{legend:"bottom"}:{},...y===void 0?{}:{title:y}}}function S(e,o,n){if(!n?.node)return;const t=e.eval(n.node,{sheet:o,row:0,col:0,dr:0,dc:0});return t instanceof N?{sheet:t.sheet,area:{top:t.top,left:t.left,bottom:Math.min(t.bottom,Math.max(t.top,t.sheet.lastRow)),right:t.right}}:void 0}export function chartDataRange(e,o,n){const t=[S(e,o,n.categories),...n.series.flatMap(r=>[S(e,o,r.values),S(e,o,r.name),S(e,o,r.x)])].filter(r=>r!==void 0),i=t[0];if(!i||t.some(r=>r.sheet!==i.sheet))return;const s={top:Math.min(...t.map(r=>r.area.top)),left:Math.min(...t.map(r=>r.area.left)),bottom:Math.max(...t.map(r=>r.area.bottom)),right:Math.max(...t.map(r=>r.area.right))};return`${i.sheet===o?"":D(i.sheet.name)}${j(s)}`}export function readDataRange(e,o,n){const t=n.lastIndexOf("!"),i=t<0?void 0:n.slice(0,t).replace(/^'|'$/gu,""),s=i===void 0?o:e.wb.sheet(i.replaceAll("''","'")),r=G(n.slice(t+1).replaceAll("$",""));return s&&r?{sheet:s,area:r}:void 0}export function chartPlace(e,o,n){const t=W(e.at)??{row:0,col:0};return{left:n(t.col)+(e.x??0),top:o(t.row)+(e.y??0),...chartSize(e)}}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_MARGINS as F,SHEET_NOTE_AUTHOR as H}from"@allyhub-next/formats";import{cellName as U,readAddress as A}from"./address.js";import{dataValue as _}from"./export.js";import{shownValue as j}from"./format.js";import{sheetPrefix as S}from"./formula/print.js";import{CellError as M}from"./values.js";import{FormulaCell as N}from"./workbook.js";export const DIFF_DEFAULTS={tolerance:0};const I=(o,e)=>{if(o!=="written")return e};function J(o){const{row:e,col:n}=o;return JSON.stringify(o.moved,(t,s)=>(t==="col"||t==="col2"||t==="row"||t==="row2")&&typeof s=="object"&&s!==null&&s.abs===!1?[s.index-(t.startsWith("col")?n:e)]:I(t,s))}function P(o,e,n){if(o===e)return!0;if(typeof o=="number"&&typeof e=="number"){const t=Math.max(Math.abs(o),Math.abs(e));return Math.abs(o-e)<=n*t}return o instanceof M&&e instanceof M?o.code===e.code:!1}function E(o,e,n,t){const s=o.value(e,n,t),i=e.lookAt(n,t).format,r=e.at(n,t);return{cell:U({row:n,col:t}),value:_(s,i),shown:j(s,i),...r instanceof N?{formula:r.text}:{}}}const R=(o,e,n)=>{const t=o.at(e,n);return t instanceof N&&t.shared.node?J(t):void 0},T=(o,e,n)=>o.at(e,n)!==void 0||o.spillAt(e,n)!==void 0;class D{out={sheets:[],tables:[],names:[],parts:[],charts:[],cells:[],counts:{value:0,formula:0,both:0,added:0,removed:0}};a;b;tolerance;constructor(e,n,t){this.a=e,this.b=n,this.tolerance=t}push(e){this.out.counts[e.kind]+=1,this.out.cells.push(e)}cell(e,n,t){const s=this.a.value(e.sheet,e.row,e.col),i=this.b.value(n.sheet,n.row,n.col),r=T(e.sheet,e.row,e.col),d=T(n.sheet,n.row,n.col);if(!r&&!d)return;const u=n.sheet.name,c=()=>({was:E(this.a,e.sheet,e.row,e.col),now:E(this.b,n.sheet,n.row,n.col)});if(!r){this.push({...t,sheet:u,kind:"added",now:c().now});return}if(!d){this.push({...t,sheet:u,kind:"removed",was:c().was});return}const f=P(s,i,this.tolerance),l=R(e.sheet,e.row,e.col)===R(n.sheet,n.row,n.col);if(f&&l)return;const h=l?"value":f?"formula":"both";this.push({...t,sheet:u,kind:h,...c()})}loose(e,n){const t=(r,d,u)=>r.tableAt(d,u)!==void 0,s=Math.max(e.lastRow,n.lastRow),i=Math.max(e.columnsUsed,n.columnsUsed)-1;for(let r=0;r<=i;r++){const[d,u]=W(e,n,r,s);for(let c=d;c<=u;c++)t(e,c,r)||t(n,c,r)||this.cell({sheet:e,row:c,col:r},{sheet:n,row:c,col:r},{})}}table(e,n){const t=n.spec.key??e.spec.key,s=e.column(t??""),i=n.column(t??""),r=(a,m,g)=>{const w=new Map;if(g){for(let p=0;p<a.rows;p++){const C=m.value(a.sheet,a.at.row+1+p,a.at.col+g.index),v=j(C);if(v===""||w.has(v))return;w.set(v,p)}return w}},d=r(e,this.a,s),u=r(n,this.b,i),c=d&&u?{from:d,to:u}:void 0,f=[];if(c){for(const[a,m]of c.from)f.push([m,c.to.get(a),a]);for(const[a,m]of c.to)c.from.has(a)||f.push([void 0,m,a])}else for(let a=0;a<Math.max(e.rows,n.rows);a++)f.push([a<e.rows?a:void 0,a<n.rows?a:void 0,String(a+1)]);const l=[],h=[],y=n.columns.filter(a=>e.column(a.name));for(const[a,m,g]of f)if(a===void 0)l.push(g);else if(m===void 0)h.push(g);else for(const w of y){const p=e.column(w.name);p&&this.cell({sheet:e.sheet,row:e.at.row+1+a,col:e.at.col+p.index},{sheet:n.sheet,row:n.at.row+1+m,col:n.at.col+w.index},{table:n.name,column:w.name,...c?{key:g}:{}})}const k=n.columns.filter(a=>!e.column(a.name)).map(a=>a.name),x=e.columns.filter(a=>!n.column(a.name)).map(a=>a.name);(l.length+h.length+k.length+x.length>0||c)&&this.out.tables.push({sheet:n.sheet.name,name:n.name,by:c?"key":"position",...c&&t!==void 0?{key:t}:{},rowsAdded:l,rowsRemoved:h,columnsAdded:k,columnsRemoved:x})}names(e,n){const t=u=>{const c=new Map;for(const f of u.names.values())c.set(f.name.toLowerCase(),f);for(const f of u.sheets)for(const l of f.names.values())c.set(`${S(f.name)}${l.name}`.toLowerCase(),l);return c},s=u=>u&&(u.formula?.text??j(u.value??null)),i=t(e),r=t(n),d=new Map;for(const[u,c]of[...i,...r])d.set(u,c.sheet?`${S(c.sheet.name)}${c.name}`:c.name);for(const u of[...d.keys()].sort()){const c=s(i.get(u)),f=s(r.get(u));c!==f&&this.out.names.push({name:d.get(u)??u,...c===void 0?{}:{was:c},...f===void 0?{}:{now:f}});const l=k=>k===void 0?void 0:k.hidden===!0,h=l(i.get(u)),y=l(r.get(u));h!==void 0&&y!==void 0&&h!==y&&this.out.parts.push({part:"hidden names",key:d.get(u)??u,was:String(h),now:String(y)})}}part(e){this.out.parts.push(e)}whole(e,n,t,s){const i=b(t),r=b(s);i!==r&&this.part({...e===void 0?{}:{sheet:e},part:n,...i===void 0?{}:{was:i},...r===void 0?{}:{now:r}})}keyed(e,n,t,s,i=b){const r=new Set([...Object.keys(t??{}),...Object.keys(s??{})]);for(const d of[...r].sort(L)){const u=i(t?.[d]),c=i(s?.[d]);u!==c&&this.part({sheet:e,part:n,key:d,...u===void 0?{}:{was:u},...c===void 0?{}:{now:c}})}}listed(e,n,t,s,i=!0){const r=d=>d===void 0||d.length===0?void 0:i?d:d.map(u=>b(u)??"").sort();this.whole(e,n,r(t),r(s))}sheetParts(e,n){const t=e.spec,s=n.spec,i=n.name;this.whole(i,"print",$(t.print),$(s.print)),this.keyed(i,"notes",t.notes,s.notes,V),this.keyed(i,"links",t.links,s.links,r=>typeof r=="string"?r:void 0),this.listed(i,"validations",t.validations,s.validations,!1),this.listed(i,"conditional",t.conditional,s.conditional),this.listed(i,"pictures",t.pictures,s.pictures),this.whole(i,"protect",t.protect===!0||void 0,s.protect===!0||void 0),this.whole(i,"freeze",t.freeze,s.freeze),this.listed(i,"merges",t.merges,s.merges,!1),this.whole(i,"filter",t.filter,s.filter),this.keyed(i,"columns",O(t.columns),O(s.columns)),this.keyed(i,"rows",O(t.rows),O(s.rows)),this.whole(i,"view",z(t),z(s))}run(){const{wb:e}=this.a,{wb:n}=this.b;this.names(e,n),this.whole(void 0,"title",e.title,n.title);for(const t of e.sheets)n.sheet(t.name)||this.out.sheets.push({name:t.name,added:!1,removed:!0});for(const t of n.sheets){const s=e.sheet(t.name);if(!s){this.out.sheets.push({name:t.name,added:!0,removed:!1});continue}this.loose(s,t),this.sheetParts(s,t);for(const i of t.tables){const r=e.table(i.name);r?this.table(r,i):this.out.tables.push({sheet:t.name,name:i.name,by:"position",rowsAdded:[String(i.rows)],rowsRemoved:[],columnsAdded:i.columns.map(d=>d.name),columnsRemoved:[]})}JSON.stringify(s.spec.charts??[])!==JSON.stringify(t.spec.charts??[])&&this.out.charts.push(t.name)}return this.out}}function b(o){if(o!==void 0)return JSON.stringify(o,(e,n)=>n!==null&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort(([t],[s])=>t<s?-1:t>s?1:0)):n)}function L(o,e){const n=A(o),t=A(e);if(n&&t)return n.row-t.row||n.col-t.col;const s=Number(o),i=Number(e);return Number.isInteger(s)&&Number.isInteger(i)?s-i:o.length-e.length||(o<e?-1:o>e?1:0)}function V(o){if(typeof o=="string")return o;if(o===null||typeof o!="object")return;const e=o;return e.author===void 0||e.author===H?e.text:`${e.text} (${e.author})`}function $(o){if(!o)return;const e=Object.fromEntries(Object.entries(o.margins??{}).filter(([t,s])=>F[t]!==s)),n={...o};return Object.keys(e).length>0?n.margins=e:delete n.margins,Object.keys(n).length>0?n:void 0}function O(o){if(!o)return;const e={};for(const[n,t]of Object.entries(o)){const s={..."width"in t&&t.width!==void 0?{width:t.width}:{},..."height"in t&&t.height!==void 0?{height:t.height}:{},...t.hidden===!0?{hidden:!0}:{},...t.level===void 0?{}:{level:t.level}};Object.keys(s).length>0&&(e[n]=s)}return e}const z=o=>{const e={...o.hidden===!0?{hidden:!0}:{},...o.tab===void 0?{}:{tab:o.tab.toUpperCase()},...o.gridlines===!1?{gridlines:!1}:{}};return Object.keys(e).length>0?e:void 0};function W(o,e,n,t){const[s,i]=o.span(n,0,t),[r,d]=e.span(n,0,t);return[Math.min(s,r),Math.max(i,d)]}export function diffWorkbooks(o,e,n={}){return new D(o,e,n.tolerance??DIFF_DEFAULTS.tolerance).run()}
@@ -1,3 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{readDataFile as c}from"@allyhub-next/formats";import{LineCounter as p,isMap as m,isScalar as f,parseDocument as d,visit as g}from"yaml";export const ENTRY="sheet.yaml";export function dataFilesOf(i){const{file:t}=readSheetFile(i);return[...new Set(t?.sheets.flatMap(s=>[...(s.tables??[]).map(n=>n.rows),...(s.blocks??[]).map(n=>n.rows)])??[])]}function h(i){const t=[];return g(i,{Map(s,n){if(!m(n))return;const a=new Set;for(const o of n.items){const e=f(o.key)?String(o.key.value):void 0;if(e!==void 0)if(a.has(e)){const r=f(o.key)?o.key.range?.[0]??0:0;t.push({at:r,key:e})}else a.add(e)}}}),t}export function readSheetFile(i){const t=new p,s=d(i,{lineCounter:t,uniqueKeys:!1}),n=e=>{for(let r=e.length;r>=0;r--){const u=s.getIn(e.slice(0,r),!0)?.range?.[0];if(u!==void 0)return t.linePos(u).line}},a=h(s);if(s.errors.length>0||a.length>0)return{problems:[...s.errors.map(e=>({file:ENTRY,line:t.linePos(e.pos[0]).line,message:`not YAML: ${e.message.split(`
3
- `)[0]??""}`})),...a.map(e=>({file:ENTRY,line:t.linePos(e.at).line,message:`not YAML: Map keys must be unique (${e.key})`}))],lineOf:n};const o=c("sheet",s.toJS()??{});return o.ok?{file:o.value,problems:[],lineOf:n}:{problems:o.problems.map(e=>{const r=n(e.path===""?[]:e.path.split(".").map(l=>/^\d+$/u.test(l)?Number(l):l));return{file:ENTRY,...r===void 0?{}:{line:r},message:`${e.path===""?"":`${e.path}: `}${e.message}`}}),lineOf:n}}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_PICTURE_HEIGHT as p}from"@allyhub-next/formats";import{columnIndex as d,columnLetter as a}from"./address.js";import{filesIn as x}from"./workbook.js";const m=/\.(?:png|jpe?g|gif|webp|bmp|svg)$/iu;export const isPicture=e=>m.test(e),pictureHeight=e=>(typeof e=="object"?e.height:void 0)??p;export function hasFiles(e){return Object.values(e.spec.columns??{}).some(t=>t.files!==void 0)||e.tables.some(t=>t.columns.some(c=>c.spec?.files))}export function fileCells(e,t){if(!hasFiles(e))return[];const c=[],o=(n,i,f)=>{const l=t.value(e,n,i);if(typeof l!="string")return;const s=x(l,f);s.length>0&&c.push({row:n,col:i,paths:s,column:f})},r=(n,i)=>e.tableAt(n,i)!==void 0;for(const[n,i]of Object.entries(e.spec.columns??{})){const f=d(n);if(f===void 0||i.files===void 0)continue;const[l,s]=e.span(f,0,e.lastRow);for(let u=l;u<=s;u++)r(u,f)||o(u,f,i.files)}for(const n of e.tables)for(const i of n.columns){const f=n.at.col+i.index,l=i.spec?.files??e.spec.columns?.[a(f)]?.files;if(l!==void 0)for(let s=n.data.top;s<=n.data.bottom;s++)o(s,f,l)}return c}export function pictureSize(e){const t=o=>e[o]??0,c=(o,r)=>{let n=0;for(let i=0;i<r;i++)n=n*256+t(o+i);return n};if(t(0)===137&&t(1)===80&&t(2)===78)return{type:"png",width:c(16,4),height:c(20,4)};if(t(0)===71&&t(1)===73&&t(2)===70)return{type:"gif",width:t(6)+t(7)*256,height:t(8)+t(9)*256};if(t(0)===255&&t(1)===216){let o=2;for(;o+9<e.length;){if(t(o)!==255)return;const r=t(o+1);if(r>=192&&r<=207&&![196,200,204].includes(r))return{type:"jpeg",width:c(o+7,2),height:c(o+5,2)};o+=2+c(o+2,2)}}}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_CODE as v,SHEET_DATA as w}from"@allyhub-next/formats";import{readCsv as d}from"./csv.js";export const GENERATED=`${v}/`;const l=e=>e.toLowerCase();export function withGenerated(e,n){const a=e.sheets.length;if(!n)return{file:e,own:a,names:new Set,ordinary:[]};const m=new Set(e.sheets.map(s=>l(s.name))),t=n.sheets.filter(s=>!m.has(l(s.name))),c=n.sheets.filter(s=>m.has(l(s.name))).map(s=>s.name),f=new Set(Object.keys(e.names??{}).map(l)),r=Object.entries(n.names??{}).filter(([s])=>!f.has(l(s)));return{file:{...e,sheets:[...e.sheets,...t],...r.length===0?{}:{names:{...e.names,...Object.fromEntries(r)}}},own:a,names:new Set(r.map(([s])=>s)),ordinary:c}}const b=e=>[...(e.tables??[]).map(n=>n.rows),...(e.blocks??[]).map(n=>n.rows)],E=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/gu,"");export function ordinarySheet(e,n,a,m=()=>!1){const t=n.sheets.find(o=>l(o.name)===l(a));if(!t)return{rows:new Map,cells:[],whole:!1,refused:"no-sheet"};const c=new Map,f=new Map;for(const o of b(t)){const p=n.csv[o];if(p===void 0)continue;const h=E(`${t.name} ${o.split("/").pop()??""}`).replace(/-csv$/u,"");let u=`${w}/${h}.csv`;for(let i=2;m(u)||c.has(u);i++)u=`${w}/${h}-${String(i)}.csv`;f.set(o,u),c.set(u,d(p).records.map(i=>i.end===i.start?[]:i.fields))}const r=o=>f.get(o)??o,s=structuredClone(t);for(const o of s.tables??[])o.rows=r(o.rows);for(const o of s.blocks??[])o.rows=r(o.rows);return{file:{...e.file,sheets:[...e.file.sheets,s]},rows:c,cells:[],whole:!0}}export function typedNumbers(e,n){const a=[],m=t=>typeof t=="number"?t:t!==null&&typeof t=="object"?t.value:void 0;for(const t of e){for(const[c,f]of Object.entries(t.cells??{})){const r=m(f);typeof r=="number"&&a.push({sheet:t.name,cell:c,value:r})}for(const c of b(t))d(n[c]??"").records.forEach(f=>{for(const r of f.fields){const s=Number(r);r.trim()!==""&&Number.isFinite(s)&&a.push({sheet:t.name,file:c,value:s})}})}return a}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_SEPARATOR as y}from"@allyhub-next/formats";import{toBool as g}from"./calc/coerce.js";import{holds as l}from"./rules.js";import{shownValue as d}from"./format.js";import{CellError as x,Matrix as b,readTyped as C}from"./values.js";import{FormulaCell as A}from"./workbook.js";export const separatorOf=e=>e.separator??y;export function choicesIn(e,o){const i=separatorOf(o);return e.split(i.trim()===""?i:i.trim()).map(n=>n.trim()).filter(n=>n!=="")}export const joinChoices=(e,o)=>e.join(separatorOf(o));export function listValues(e,o,i,n,r){const{spec:t}=i;if(t.values)return t.values;const[s]=t.formula??[],[f]=i.formulas;if(!f)return typeof s=="string"?s.split(","):[];const u=e.evaluateAt(f,o,n,r),a=m=>d(m,void 0);return u instanceof b?u.data.map(a).filter(m=>m!==""):u===null?[]:[a(u)]}function E(e,o,i,n,r,t){const s=i.spec.formula?.[n];if(s===void 0)return null;const f=i.formulas[n];if(f){const a=e.evaluateAt(f,o,r,t);return a instanceof b?a.at(0,0):a}if(typeof s=="number")return s;const u=C(s);return u.formula===void 0?u.value:null}function H(e,o,i,n,r,t){const[s]=i.formulas;if(!s)return!0;const f=o.at(n,r),a=e.value(o,n,r)!==t&&!(f instanceof A);a&&e.change([{sheet:o,row:n,col:r,slot:t??void 0}]);const m=e.evaluateAt(s,o,n,r);a&&e.change([{sheet:o,row:n,col:r,slot:f}]);const c=m instanceof b?m.at(0,0):m;return g(c)===!0}export function valid(e,o,i,n,r,t){const{spec:s}=i;if(t===null||t==="")return s.blank!==!1;if(t instanceof x)return!1;const f=s.operator??"between",u=a=>E(e,o,i,a,n,r);switch(s.type){case"list":{const a=d(t,void 0),m=listValues(e,o,i,n,r).map(p=>p.trim()),c=p=>s.values?m.includes(p.trim()):m.some(h=>h.toLowerCase()===p.trim().toLowerCase());return s.multiple===!0?choicesIn(a,s).every(c):c(a)}case"custom":return H(e,o,i,n,r,t);case"textLength":return l(f,(typeof t=="string"?t:d(t)).length,u(0),u(1));case"whole":return typeof t=="number"&&Number.isInteger(t)&&l(f,t,u(0),u(1));case"time":return typeof t=="number"&&t>=0&&t<1&&l(f,t,u(0),u(1));default:return typeof t=="number"&&l(f,t,u(0),u(1))}}function L(e,o,i){const n=Math.min(o.right,e.columnsUsed-1);for(let r=o.left;r<=n;r++){const[t,s]=e.span(r,o.top,o.bottom);for(let f=t;f<=s;f++)e.at(f,r)!==void 0&&i(f,r)}}export function invalidCells(e,o){const i=[];for(const n of e.sheets)for(const r of n.validations)for(const t of r.areas)L(n,t,(s,f)=>{const u=o.value(n,s,f);valid(o,n,r,s,f,u)||i.push({sheet:n.name,row:s,col:f,value:u,range:r.spec.range,type:r.spec.type})});return i}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_CODE as C,SHEET_SEPARATOR as P}from"@allyhub-next/formats";import{MAX_ROWS as B,cellName as H,columnIndex as z,columnLetter as j,contains as y,overlaps as v,rangeName as U,readAddress as x,readArea as $,readAreas as _}from"./address.js";import{readCsv as R}from"./csv.js";import{ENTRY as E,readSheetFile as D}from"./file.js";import{withGenerated as O}from"./generated.js";import{moveFormula as G}from"./formula/move.js";import{parseFormula as X}from"./formula/parse.js";import{printFormula as Y}from"./formula/print.js";import{readTyped as S}from"./values.js";export class SharedFormula{node;error;analysis;text;row;col;source;constructor(e,t,s,n){this.text=e,this.row=t,this.col=s,this.source=n;const i=X(e);i.ok?this.node=i.node:this.error=i.error}}export class FormulaCell{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,s,n){this.shared=e,this.sheet=t,this.row=s,this.col=n}get moved(){const{node:e,row:t,col:s}=this.shared;if(!e)throw new Error(`${this.shared.text} does not parse.`);return G(e,this.row-t,this.col-s)}get text(){const{node:e,text:t,row:s,col:n}=this.shared;return!e||s===this.row&&n===this.col?t:Y(this.moved)}}class Z{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,s){let n=this.columns[t];n||(n=[],this.columns[t]=n,this.firsts[t]=e,this.lasts[t]=e),n[e]instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??1)-1),s instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??0)+1),n[e]=s,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,s){const n=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=n;i++){const a=this.columns[i];if(!a)continue;const r=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=r;o++)if(a[o]!==void 0&&!(o===t&&i===s))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}}export class Table{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,s,n,i){this.name=e,this.sheet=t,this.at=s,this.file=n,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){const e=this.area;return{...e,top:e.top+1}}column(e){const t=e.toLowerCase();return this.columns.find(s=>s.name.toLowerCase()===t)}}export const placeKey=(l,e)=>l*16384+e;function T(l,e){l.bottom=Math.max(l.bottom,e.bottom),l.right=Math.max(l.right,e.right);for(let t=e.left;t<=e.right;t++){const s=l.columns.get(t);l.columns.set(t,[Math.min(s?.[0]??e.top,e.top),Math.max(s?.[1]??e.bottom,e.bottom)])}}export class Worksheet{tables=[];blocks=[];merges=[];formulas=new Set;implied=new Map;keys=new Map;fills=[];blanks=new Set;conditions=[];validations=[];filters=[];charts=[];names=new Map;freeze;generated=!1;grid=new Z;expanded=!1;lowest=-1;ghosts=new Map;spills=new Set;stopped=new Set;reach;lookAreas;name;index;spec;constructor(e,t,s){this.name=e,this.index=t,this.spec=s}respec(e){const t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((s,n)=>{const i=W(s,n,[],()=>{});i&&this.charts.push(i)}))}put(e,t,s){s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}replace(e,t,s){this.expand();const n=this.grid.get(e,t);n instanceof FormulaCell&&this.formulas.delete(n),s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){const t=this.fills[e];if(!t)continue;const{area:s,shared:n,value:i,format:a}=t;for(let r=s.top;r<=s.bottom;r++)for(let o=s.left;o<=s.right;o++)this.grid.get(r,o)===void 0&&(this.blanks.has(placeKey(r,o))||(n?this.put(r,o,new FormulaCell(n,this,r,o)):i!=null&&(this.put(r,o,i),a!==void 0&&this.implied.set(placeKey(r,o),a))))}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(placeKey(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(n=>n.spill!==void 0&&v(n.spill,e));const s=new Set;for(let n=e.top;n<=e.bottom;n++)for(let i=e.left;i<=e.right;i++){const a=this.ghosts.get(placeKey(n,i));a&&s.add(a)}return[...s]}blockedBy(e){if(this.stopped.size===0)return[];const t=[];for(const s of this.stopped)s.blocked&&v(s.blocked,e)&&t.push(s);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)(s!==e.row||n!==e.col)&&this.ghosts.set(placeKey(s,n),e);this.reach&&T(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){const t=e.spill;if(t)for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)this.ghosts.get(placeKey(s,n))===e&&this.ghosts.delete(placeKey(s,n));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(const e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;const e={columns:new Map,bottom:-1,right:-1};for(const{spill:t}of this.spills)t&&T(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,s){this.expand();const n=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,n),Math.min(s,i)];const[a,r]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(n,a)),Math.min(s,Math.max(i,r))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){const e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(s=>y(s.area,e,t))}blockAt(e,t){return this.blocks.find(s=>y(s.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;const e=[];for(const s of this.spec.format??[]){const n=$(s.range);n&&e.push({area:n,entry:s})}const t=[];for(const[s,n]of Object.entries(this.spec.cells??{})){if(!s.includes(":")||n===null||typeof n!="object")continue;const i=$(s);i&&t.push({area:i,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){const{formats:e,ranges:t}=this.looks();return[...e,...t.filter(s=>Object.keys(s.entry).some(n=>F.has(n)))]}lookAt(e,t){const s={},n=c=>{if(c)for(const[b,w]of Object.entries(c))F.has(b)&&w!==void 0&&(s[b]=b==="border"?{...s.border,...w}:w)},i=this.implied.get(placeKey(e,t));i!==void 0&&(s.format=i);const a=this.ghosts.size===0?void 0:this.spillAt(e,t),r=a&&this.lookAt(a.row,a.col).format;r!==void 0&&(s.format=r),this.spec.columns&&n(this.spec.columns[j(t)]),this.spec.rows&&n(this.spec.rows[String(e+1)]);const o=this.tableAt(e,t);o&&e>o.at.row&&n(o.columns[t-o.at.col]?.spec);const{formats:f,ranges:h}=this.looks();for(const c of f)y(c.area,e,t)&&n(c.entry);for(const c of h)y(c.area,e,t)&&n(c.entry);const d=this.keys.get(placeKey(e,t)),g=d===void 0?void 0:this.spec.cells?.[d];if(g!==null&&typeof g=="object"&&n(g),s.border){const c=Object.entries(s.border).filter(([,b])=>b?.style!=="none");c.length===0?delete s.border:s.border=Object.fromEntries(c)}return s}mergeAt(e,t){return this.merges.find(s=>y(s,e,t))}validationAt(e,t){return this.validations.find(s=>s.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(s=>e===s.area.top&&t>=s.area.left&&t<=s.area.right)}filterAt(e,t){return this.filters.find(s=>y(s.area,e,t))}filesAt(e,t){const s=this.tableAt(e,t);if(s&&e>s.at.row){const n=s.columns[t-s.at.col]?.spec?.files;if(n!==void 0)return n}return s?.at.row===e?void 0:this.spec.columns?.[j(t)]?.files}}export const filesSeparator=l=>(typeof l=="object"?l.separator:void 0)??P;export function filesIn(l,e){const t=filesSeparator(e);return l.split(t.trim()===""?t:t.trim()).map(s=>s.trim()).filter(s=>s!=="")}const F=new Set(["bold","italic","underline","strike","font","size","color","fill","align","valign","wrap","shrink","indent","rotation","border","format"]);export class Workbook{title;sheets=[];names=new Map;checks=[];bySheet=new Map;byTable=new Map;file;generated;ordinary=[];constructor(e,t){this.file=e,this.title=e.title,this.generated=t}respec(e){this.file=O(e,this.generated).file,this.title=e.title,this.sheets.forEach(t=>{const s=e.sheets.find(n=>n.name===t.name);s&&t.respec(s)})}sheet(e){return this.bySheet.get(e.toLowerCase())}table(e){return this.byTable.get(e.toLowerCase())}name(e,t){const s=e.toLowerCase();return(t?.names.size?t.names.get(s):void 0)??this.names.get(s)}definitions(e){const t=e.toLowerCase(),s=[],n=this.names.get(t);n&&s.push(n);for(const i of this.sheets){const a=i.names.get(t);a&&s.push(a)}return s}get tables(){return[...this.byTable.values()]}addSheet(e){this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,s){if(e.generated)return{file:C};const n=this.sheets.indexOf(e),i=e.tableAt(t,s);if(i){const o=i.columns[s-i.at.col],f=t-i.at.row-1,h=o?.csv!==void 0&&(i.records[f]?.[o.csv]??"")!=="";return f>=0&&o?.formula&&!h?o.formula.source:{file:i.file,line:f<0?1:i.lines[f]??1}}const a=e.blockAt(t,s);if(a)return{file:a.file,line:a.lines[t-a.area.top]??1};const r=e.keys.get(placeKey(t,s));if(r!==void 0)return{file:E,path:["sheets",n,"cells",r]};for(const o of Object.keys(e.spec.cells??{})){if(!o.includes(":"))continue;const f=$(o);if(f&&y(f,t,s))return{file:E,path:["sheets",n,"cells",o]}}}}export const MAX_FILL_CELLS=5e6;const q=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;export function validName(l){return q.test(l)&&x(l)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(l)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(l)&&!/^[Cc]\d*$/u.test(l)}const M="made",k=l=>l[0]===M?C:E;class N{problems=[];wb;read_;lineOf;own;madeNames;constructor(e,t,s,n,i){this.wb=e,this.read_=t,this.lineOf=s,this.own=n,this.madeNames=i}yaml(e,t){const s=this.lineOf(e);this.problems.push({file:k(e),...s===void 0?{}:{line:s},message:t})}sheetPath(e){return e<this.own?["sheets",e]:[M,"sheets",e-this.own]}read(){const{file:e}=this.wb;e.sheets.forEach((t,s)=>{const n=this.sheetPath(s);if(this.wb.sheet(t.name)){this.yaml([...n,"name"],`two sheets are named ${t.name}`);return}(/[\\/?*[\]:]/u.test(t.name)||t.name.length>31)&&this.yaml([...n,"name"],`${t.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);const i=new Worksheet(t.name,this.wb.sheets.length,t);i.generated=s>=this.own,this.wb.addSheet(i)}),this.names();for(const[t,s]of e.sheets.entries()){const n=this.wb.sheets[t];n?.spec===s&&this.sheet(n,this.sheetPath(t))}e.checks?.forEach((t,s)=>{const n={file:E,path:["checks",s,"formula"]};this.wb.checks.push({name:t.name,formula:new SharedFormula(t.formula,0,0,n),source:n})})}names(){const{file:e}=this.wb;this.namesOf(e.names,e.hidden_names,t=>this.madeNames.has(t)?[M,"names",t]:["names",t],this.wb.names,void 0),e.sheets.forEach((t,s)=>{const n=this.wb.sheets[s];n?.spec===t&&this.namesOf(t.names,t.hidden_names,i=>[...this.sheetPath(s),"names",i],n.names,n)})}namesOf(e,t,s,n,i){const a=new Set(t?.map(r=>r.toLowerCase()));for(const[r,o]of Object.entries(e??{})){const f=s(r);if(!validName(r)){this.yaml(f,`${r} cannot be a name`);continue}const h={file:k(f),path:f},d=typeof o=="string"&&o.startsWith("=")?{name:r,formula:new SharedFormula(o,0,0,h),source:h}:{name:r,value:typeof o=="string"?S(o).value:o,source:h};i&&(d.sheet=i),a.has(r.toLowerCase())&&(d.hidden=!0),n.set(r.toLowerCase(),d)}}sheet(e,t){const{spec:s}=e;if(s.freeze!==void 0){const n=x(s.freeze);n?e.freeze=n:this.yaml([...t,"freeze"],`${s.freeze} is not a cell`)}s.tables?.forEach((n,i)=>{this.table(e,n,[...t,"tables",i])});for(const[n,i]of e.tables.entries())for(const a of e.tables.slice(n+1))v(i.area,a.area)&&this.problems.push({file:E,message:`tables ${i.name} and ${a.name} overlap on ${e.name}`});s.blocks?.forEach((n,i)=>{this.block(e,n.at,n.rows,[...t,"blocks",i])}),this.cells(e,s.cells??{},[...t,"cells"]),s.merges?.forEach((n,i)=>{const a=$(n);a?e.merges.push(a):this.yaml([...t,"merges",i],`${n} is not a range`)}),s.format?.forEach((n,i)=>{$(n.range)||this.yaml([...t,"format",i,"range"],`${n.range} is not a range`)}),s.conditional?.forEach((n,i)=>{this.condition(e,n,[...t,"conditional",i])}),s.validations?.forEach((n,i)=>{this.validation(e,n,[...t,"validations",i])}),this.filters(e,t),s.charts?.forEach((n,i)=>{this.chart(e,n,i,[...t,"charts",i])});for(const n of Object.keys(s.columns??{}))z(n)===void 0&&this.yaml([...t,"columns",n],`${n} is not a column`);for(const n of Object.keys(s.rows??{}))(!/^[1-9]\d*$/u.test(n)||Number(n)>B)&&this.yaml([...t,"rows",n],`${n} is not a row`)}chart(e,t,s,n){const i=W(t,s,n,(a,r)=>{this.yaml(a,r)});i&&e.charts.push(i)}bound(e,t,s){if(!(typeof e!="string"||!e.startsWith("=")||e.length<2))return new SharedFormula(e,t?.top??0,t?.left??0,{file:k(s),path:s})}condition(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const[i]=n,a=[],r=(o,f)=>{const h=this.bound(o,i,f);h&&a.push(h)};if(t.type==="expression"){const o=t.formula.startsWith("=")?t.formula:`=${t.formula}`;r(o,[...s,"formula"])}if(t.type==="cellIs"&&t.formula.forEach((o,f)=>{r(o,[...s,"formula",f])}),t.type==="dataBar")for(const o of["min","max"])r(t[o]?.value,[...s,o,"value"]);(t.type==="colorScale"||t.type==="iconSet")&&t.stops?.forEach((o,f)=>{r(o.value,[...s,"stops",f,"value"])}),e.conditions.push({spec:t,areas:n,formulas:a})}validation(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const i=(t.formula??[]).map((o,f)=>this.bound(o,n[0],[...s,"formula",f])),a=t.formula?.length??0,r=t.type!=="list"&&t.type!=="custom"&&(t.operator===void 0||t.operator==="between"||t.operator==="notBetween");!(t.type==="list"&&t.values!==void 0)&&a<(r?2:1)&&this.yaml(s,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:n,formulas:i})}filters(e,t){const{spec:s}=e;if(s.filter){const n=[...t,"filter"],i=$(s.filter.range);if(!i)this.yaml([...n,"range"],`${s.filter.range} is not a range`);else{const a=new Map;for(const[o,f]of Object.entries(s.filter.columns??{})){const h=z(o);h===void 0||h<i.left||h>i.right?this.yaml([...n,"columns",o],`${o} is not a column of ${s.filter.range}`):a.set(h,f)}const r=e.tables.find(o=>v(o.area,i));r&&this.yaml(n,`a filter over table ${r.name}: a table has its own`),e.filters.push({area:i,columns:a})}}e.tables.forEach((n,i)=>{const{filter:a}=n.spec;if(a===!1)return;const r=new Map;for(const[o,f]of Object.entries(a?.columns??{})){const h=n.column(o);h?r.set(n.at.col+h.index,f):this.yaml([...t,"tables",i,"filter","columns",o],`table ${n.name} has no column ${o}`)}e.filters.push({area:n.area,table:n,columns:r})})}csv(e,t,s){const n=this.read_(e);return n||this.yaml(t,`${s}: ${e} is not there`),n}overlapping(e,t){const s=e.tables.find(i=>v(i.area,t));if(s)return`table ${s.name}`;const n=e.blocks.find(i=>v(i.area,t));return n?`the block of ${n.file}`:void 0}typed(e,t,s,n,i){if(n.formula!==void 0){const a=new SharedFormula(n.formula,t,s,i);e.put(t,s,new FormulaCell(a,e,t,s));return}n.value!==null&&(e.put(t,s,n.value),n.format!==void 0&&e.implied.set(placeKey(t,s),n.format))}table(e,t,s){const n=x(t.at);if(!n){this.yaml([...s,"at"],`${t.at} is not a cell`);return}if(!validName(t.name)){this.yaml([...s,"name"],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...s,"name"],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...s,"name"],`${t.name} is a defined name and a table's`);const i=new Table(t.name,e,n,t.rows,t),a=this.csv(t.rows,[...s,"rows"],`table ${t.name}`),r=a?.rows??[],o=a?.lines??[],f=r[0],h=o[0]??1,d=new Set,g=f?.length===0?[""]:f??[];g.forEach((u,m)=>{const p=u.trim();p===""&&this.problems.push({file:t.rows,line:h,message:`column ${String(m+1)} has no name`}),d.has(p.toLowerCase())&&this.problems.push({file:t.rows,line:h,message:`two columns are named ${p}`}),d.add(p.toLowerCase()),i.columns.push({name:p,index:i.columns.length,csv:m})});for(const[u,m]of Object.entries(t.columns??{})){const p=i.column(u),A=p??{name:u,index:i.columns.length};p||(m.formula===void 0&&this.yaml([...s,"columns",u],`table ${t.name} has no column ${u}`),i.columns.push(A)),A.spec=m}const c=g.length;for(let u=1;u<r.length;u++){const m=r[u];if(!m||m.length===0)continue;const p=o[u]??u+1;i.places.push(u),i.records.push(m),i.lines.push(p),m.length>c&&this.problems.push({file:t.rows,line:p,message:`this row has ${String(m.length)} fields and the header ${String(c)}`})}i.rows=i.records.length;const b=this.overlapping(e,i.area);b&&this.yaml(s,`table ${t.name} overlaps ${b} on ${e.name}`),this.wb.addTable(i),this.tableKey(i,s);const w=n.row+1;i.columns.forEach(u=>{const m=n.col+u.index;e.put(n.row,m,u.name);const p=u.spec?.formula;p!==void 0&&(u.formula=new SharedFormula(p,w,m,{file:k(s),path:[...s,"columns",u.name,"formula"]}),i.rows>0&&e.fills.push({area:{top:w,left:m,bottom:w+i.rows-1,right:m},shared:u.formula})),u.csv!==void 0&&i.records.forEach((A,L)=>{this.typed(e,w+L,m,S(A[u.csv??0]??""),{file:t.rows,line:i.lines[L]??1})})})}tableKey(e,t){const{key:s}=e.spec;if(s===void 0)return;const n=e.column(s);if(n?.csv===void 0){this.yaml([...t,"key"],`table ${e.name} has no column ${s} in ${e.file}`);return}const i=new Set;e.records.forEach((a,r)=>{const o=a[n.csv??0]??"",f=e.lines[r]??1;o===""?this.problems.push({file:e.file,line:f,message:`this row has no ${s}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:f,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,s,n){const i=x(t);if(!i){this.yaml([...n,"at"],`${t} is not a cell`);return}const a=this.csv(s,[...n,"rows"],"a block");if(!a)return;const r=a.rows,o=r.map((g,c)=>a.lines[c]??c+1),f=r.reduce((g,c)=>Math.max(g,c.length),1),h={top:i.row,left:i.col,bottom:i.row+Math.max(r.length,1)-1,right:i.col+f-1},d=this.overlapping(e,h);d&&this.yaml(n,`the block of ${s} overlaps ${d} on ${e.name}`),e.blocks.push({area:h,file:s,lines:o}),r.forEach((g,c)=>{g.forEach((b,w)=>{this.typed(e,i.row+c,i.col+w,S(b),{file:s,line:o[c]??c+1})})})}cells(e,t,s){const n=[];for(const[i,a]of Object.entries(t)){const r=[...s,i],o=$(i);if(!o){this.yaml(r,`${i} is not a cell or a range`);continue}const f=this.overlapping(e,o);if(f&&this.yaml(r,`${i} overlaps ${f}`),i.includes(":")){const h=(o.bottom-o.top+1)*(o.right-o.left+1);h>MAX_FILL_CELLS?this.yaml(r,`${i} is ${String(h)} cells`):this.fill(e,o,a,r)}else n.push([i,a,{row:o.top,col:o.left}])}for(const[i,a,r]of n){const o=[...s,i],f=K(a),h=placeKey(r.row,r.col);e.keys.set(h,i),f.value===null&&f.formula===void 0&&e.blanks.add(h),this.typed(e,r.row,r.col,f,{file:k(o),path:o});const d=a!==null&&typeof a=="object"?a.name:void 0;d!==void 0&&this.cellName(e,r,d,o)}}cellName(e,t,s,n){if(!validName(s)){this.yaml(n,`${s} cannot be a name`);return}if(this.wb.name(s)){this.yaml(n,`two places are named ${s}`);return}const i={file:k(n),path:n},a=H(t).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2"),r=`='${e.name.replaceAll("'","''")}'!${a}`;this.wb.names.set(s.toLowerCase(),{name:s,formula:new SharedFormula(r,0,0,i),source:i})}fill(e,t,s,n){const i=K(s),a={file:k(n),path:n};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new SharedFormula(i.formula,t.top,t.left,a)})}}function W(l,e,t,s){const n=x(l.at);if(!n){s([...t,"at"],`${l.at} is not a cell`);return}const i=(o,f)=>{const h=new SharedFormula(chartFormula(o),0,0,{file:k(f),path:f});return h.node&&!I(h.node)&&s(f,`${o} is not a range or a table's column`),h},a=(o,f)=>o?.startsWith("=")===!0?i(o,f):void 0,r=a(l.title,[...t,"title"]);return{spec:l,at:n,index:e,...l.categories===void 0?{}:{categories:i(l.categories,[...t,"categories"])},...r?{title:r}:{},series:l.series.map((o,f)=>{const h=[...t,"series",f],d=a(o.name,[...h,"name"]);return{values:i(o.values,[...h,"values"]),...o.x===void 0?{}:{x:i(o.x,[...h,"x"])},...d?{name:d}:{}}})}}export const chartFormula=l=>l.startsWith("=")?l:`=${l}`;function I(l){switch(l.kind){case"error":case"ref":case"structured":case"name":return!0;case"paren":case"postfix":return I(l.arg);case"binary":return l.op===":"||l.op===",";default:return!1}}function K(l){if(l===null)return{value:null};if(typeof l=="string")return S(l);if(typeof l!="object")return{value:l};if(l.formula!==void 0)return{value:null,formula:l.formula.startsWith("=")?l.formula:`=${l.formula}`};const{value:e}=l;return typeof e=="string"?S(e):{value:e??null}}export function readWorkbook(l){const e=D(l.text),t=r=>r[0]===M?void 0:e.lineOf(r);if(!e.file)return{problems:e.problems,lineOf:t};const s=O(e.file,l.generated),n=new Workbook(s.file,l.generated);n.ordinary=s.ordinary;const i=[],a=new N(n,r=>{const o=l.generated?.csv[r]??l.read(r);if(o===void 0)return;const f=R(o);for(const h of f.problems)i.push({file:r,line:h.line,message:h.message});return{rows:f.records.map(h=>h.end===h.start?[]:h.fields),lines:f.records.map(h=>h.line)}},t,s.own,s.names);return a.read(),{workbook:n,problems:[...i,...a.problems],lineOf:t}}export function workbookOf(l){const e=O(l.file,l.generated),t=new Workbook(e.file,l.generated);return t.ordinary=e.ordinary,new N(t,s=>{const n=l.generated?.csv[s];if(n!==void 0)return{rows:R(n).records.map(a=>a.end===a.start?[]:a.fields),lines:[]};const i=l.rows(s);return i&&{rows:i,lines:[]}},()=>{},e.own,e.names).read(),t}export{U as rangeName};
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CHART_DEFAULTS as Q,chartSpaceXml as ce}from"@allyhub-next/chart";import{columnLetter as Y}from"../address.js";import{Reference as Z,Union as ae}from"../calc/types.js";import{chartDef as fe,chartSize as de}from"../chart.js";import{sheetPrefix as le}from"../formula/print.js";import{HEAD as ue,attr as y,el as s,flag as ee,numberAttr as M,tag as r,tags as R,textOf as O}from"./xml.js";const he="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",me="http://schemas.openxmlformats.org/drawingml/2006/main",te="http://schemas.openxmlformats.org/drawingml/2006/chart",re="http://schemas.openxmlformats.org/officeDocument/2006/relationships",g=9525,xe=(e,t)=>`${le(e.sheet.name)}$${Y(e.left)}$${String(e.top+1)}${e.single?"":`:$${Y(e.right)}$${String(t+1)}`}`;function _(e,t,n){if(!n?.node)return;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0}),i=a=>xe(a,Math.min(a.bottom,Math.max(a.top,a.sheet.lastRow)));if(o instanceof Z)return i(o);if(o instanceof ae)return`(${o.parts.map(i).join(",")})`}function pe(e,t,n){if(!n?.node)return!1;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0});return o instanceof Z&&typeof e.value(o.sheet,o.top,o.left)=="number"}export function chartPart(e,t,n){const o=fe(e,t,n),i={name:l=>_(e,t,n.series[l]?.name),categories:_(e,t,n.categories),numeric:pe(e,t,n.categories),values:l=>_(e,t,n.series[l]?.values)??"",x:l=>_(e,t,n.series[l]?.x??n.categories)},a=_(e,t,n.title);return ce(o,{refs:i,...a===void 0?{}:{titleRef:a}})}const ge=(e,t,n)=>s("xdr:oneCellAnchor",{},s("xdr:from",{},`<xdr:col>${String(e.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round(e.x*g))}</xdr:colOff>`,`<xdr:row>${String(e.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((e.y??0)*g))}</xdr:rowOff>`),s("xdr:ext",{cx:Math.round(e.width*g),cy:Math.round(e.height*g)}),s("xdr:pic",{},s("xdr:nvPicPr",{},s("xdr:cNvPr",{id:t,name:e.name,descr:e.path}),s("xdr:cNvPicPr",{},s("a:picLocks",{noChangeAspect:!0}))),s("xdr:blipFill",{},s("a:blip",{"xmlns:r":re,"r:embed":`rId${String(n)}`}),s("a:stretch",{},s("a:fillRect"))),s("xdr:spPr",{},s("a:xfrm",{},s("a:off",{x:0,y:0}),s("a:ext",{cx:Math.round(e.width*g),cy:Math.round(e.height*g)})),s("a:prstGeom",{prst:"rect"},s("a:avLst")))),s("xdr:clientData"));export function drawingPart(e,t=[]){const n=(o,i)=>{const{width:a,height:l}=de(o.spec);return s("xdr:oneCellAnchor",{},s("xdr:from",{},`<xdr:col>${String(o.at.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round((o.spec.x??0)*g))}</xdr:colOff>`,`<xdr:row>${String(o.at.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((o.spec.y??0)*g))}</xdr:rowOff>`),s("xdr:ext",{cx:Math.round(a*g),cy:Math.round(l*g)}),s("xdr:graphicFrame",{macro:""},s("xdr:nvGraphicFramePr",{},s("xdr:cNvPr",{id:i+2,name:`Chart ${String(i+1)}`}),s("xdr:cNvGraphicFramePr")),s("xdr:xfrm",{},s("a:off",{x:0,y:0}),s("a:ext",{cx:0,cy:0})),s("a:graphic",{},s("a:graphicData",{uri:te},s("c:chart",{"xmlns:c":te,"xmlns:r":re,"r:id":`rId${String(i+1)}`})))),s("xdr:clientData"))};return ue+s("xdr:wsDr",{"xmlns:xdr":he,"xmlns:a":me},...e.map(n),...t.map((o,i)=>ge(o,e.length+i+2,e.length+i+1)))}function I(e){if(Array.isArray(e))return e.map(I).join("");if(typeof e!="object"||e===null)return"";const t=e,n=[];for(const[o,i]of Object.entries(t))o==="t"?n.push(O(i)):typeof i=="object"&&n.push(I(i));return n.join("")}const V=e=>{const t=r(e?.solidFill),n=y(r(t?.srgbClr),"val");return n!==void 0?`#${n.toUpperCase()}`:we[y(r(t?.schemeClr),"val")??""]},we={accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47"},$=(e,t)=>y(r(e?.[t]),"val"),A=(e,t)=>M(r(e?.[t]),"val"),F=(e,t)=>ee(r(e?.[t]),"val");function ne(e){if(!e)return;const t=r(e.tx),n=r(t?.strRef);if(n)return`=${O(n.f)}`;const o=I(t?.rich);return o===""?void 0:o}function oe(e){if(!e)return;const t=r(e.scaling),n=r(e.numFmt),o=y(n,"formatCode"),i={},a=ne(r(e.title));a!==void 0&&(i.title=a);const l=A(t,"min"),x=A(t,"max"),u=A(e,"majorUnit");return l!==void 0&&(i.min=l),x!==void 0&&(i.max=x),u!==void 0&&u>0&&(i.major=u),F(e,"delete")===!0&&(i.visible=!1),$(t,"orientation")==="maxMin"&&(i.reverse=!0),o!==void 0&&o!=="General"&&ee(n,"sourceLinked")!==!0&&(i.format=o),i}const j=e=>{const t=r(e?.numRef)??r(e?.strRef),n=t?O(t.f):"";return n===""?void 0:n};function be(e,t){const n=j(r(e[t?"yVal":"val"]));if(n===void 0)return"its numbers are written in the chart";const o={values:n},i=r(e.tx),a=j(i);if(a!==void 0)o.name=`=${a}`;else{const d=O(i?.v);d!==""&&(o.name=d)}const l=r(e.spPr),x=r(l?.ln),u=r(e.marker),w=t||u!==void 0,c=V(l)??(w?V(x)??V(r(u?.spPr)):void 0);c!==void 0&&(o.color=c);const f=M(x,"w");if(w&&f!==void 0&&x?.noFill===void 0){const d=Number((f/12700).toFixed(2));d!==Q.lineWidth&&(o.line_width=d)}F(e,"smooth")===!0&&(o.smooth=!0);const m=A(u,"size");m!==void 0&&m!==Q.marker&&(o.marker_size=m);const v=t?j(r(e.xVal)):void 0;v!==void 0&&(o.x=v);const b=t?void 0:j(r(e.cat));return{series:o,...b===void 0?{}:{categories:b}}}function ve(e){const t=$(e,"barDir")==="bar"?"bar":"column",n=$(e,"grouping");return n==="stacked"?`${t}-stacked`:n==="percentStacked"?`${t}-stacked-100`:`${t}-clustered`}function ye(e){const t=$(e,"grouping");return t==="stacked"?"area-stacked":t==="percentStacked"?"area-stacked-100":"area"}export function readChart(e){const t=r(e?.chartSpace),n=r(t?.chart),o=r(n?.plotArea);if(!n||!o)return"it has no plot";const i=Object.entries(o).filter(([h])=>h.endsWith("Chart")),[a]=i;if(!a)return"it has no plot";if(i.length>1||Array.isArray(a[1])&&a[1].length>1)return"it combines several kinds of chart";const[l,x]=a,u=r(x);if(!u)return"it has no plot";const w=R(u.ser),c=l==="scatterChart",f=[];let m;for(const h of w){const P=be(h,c);if(typeof P=="string")return P;f.push(P.series),m??=P.categories}if(f.length===0)return"it has no series";const v=h=>r(r(h.spPr)?.ln)?.noFill!==void 0,b=h=>$(r(h.marker),"symbol")==="none",d=(()=>{switch(l){case"barChart":return ve(u);case"lineChart":return w.every(b)?"line":"line-markers";case"areaChart":return ye(u);case"pieChart":return"pie";case"doughnutChart":return"doughnut";case"scatterChart":return w.every(v)?"scatter":w.some(h=>F(h,"smooth")===!0)?"scatter-smooth":"scatter-lines";default:return}})();if(!d)return`a sheet has no ${l.replace(/Chart$/u,"")} chart`;const S=ne(r(n.title)),k=r(n.legend),C=$(k,"legendPos"),D=r(u.dLbls),p=h=>F(D,h)===!0,se=p("showVal")||p("showPercent")||p("showCatName")||p("showSerName"),H=$(D,"dLblPos"),z=A(u,"gapWidth"),W=A(u,"overlap"),E=A(u,"holeSize"),X=F(u,"varyColors"),B=d==="pie"||d==="doughnut",N={value:R(o.valAx).find((h,P,ie)=>c?P===ie.length-1:!0),category:c?R(o.valAx)[0]:r(o.catAx)??r(o.dateAx)},G=oe(N.value),T=oe(N.category);G&&N.value?.majorGridlines===void 0&&(G.gridlines=!1),T&&N.category?.majorGridlines!==void 0&&(T.gridlines=!0);const U=M(r(r(r(r(t?.txPr)?.p)?.pPr)?.defRPr),"sz"),q=h=>h&&Object.keys(h).length>0?h:void 0,J=q(G),K=q(T);return{type:d,at:"A1",...S===void 0?{}:{title:S},...m===void 0?{}:{categories:m},series:B?f.slice(0,1):f,...k?{legend:C==="b"?"bottom":C==="t"?"top":C==="l"?"left":"right"}:{},...se?{labels:{...p("showVal")?{value:!0}:{},...p("showPercent")?{percentage:!0}:{},...p("showCatName")?{category:!0}:{},...p("showSerName")?{series:!0}:{},...H===void 0?{}:{position:H}}}:{},...z===void 0||z===150?{}:{gap_width:z},...W===void 0||d.includes("stacked")?{}:{overlap:W},...E===void 0||E===50?{}:{hole_size:E},...X===!0&&l==="barChart"?{vary_by_categories:!0}:{},...X===!1&&B?{vary_by_categories:!1}:{},...J?{value_axis:J}:{},...K?{category_axis:K}:{},...U===void 0||U===900?{}:{size:U/100}}}const L=e=>Math.round(e/g);export function chartAnchors(e,t,n){const o=r(e?.wsDr),i=[],a=[];let l=0;const x=c=>({col:Number(O(c?.col)),row:Number(O(c?.row)),colOff:L(Number(O(c?.colOff))),rowOff:L(Number(O(c?.rowOff)))}),u=c=>y(r(r(r(r(c.graphicFrame)?.graphic)?.graphicData)?.chart),"id"),w=(c,f,m,v)=>{const b={at:{row:f.row,col:f.col},...f.colOff>0?{x:f.colOff}:{},...f.rowOff>0?{y:f.rowOff}:{},width:m,height:v},d=r(c.pic),S=y(r(r(d?.blipFill)?.blip),"embed");if(d&&S!==void 0){const C=r(r(d.nvPicPr)?.cNvPr),D=y(C,"name"),p=y(C,"descr");a.push({id:S,...b,...D===void 0?{}:{name:D},...p===void 0?{}:{descr:p}});return}const k=u(c);if(k===void 0){l+=1;return}i.push({id:k,...b})};for(const c of R(o?.oneCellAnchor)){const f=r(c.ext);w(c,x(r(c.from)),L(M(f,"cx")??0),L(M(f,"cy")??0))}for(const c of R(o?.twoCellAnchor)){const f=x(r(c.from)),m=x(r(c.to));let v=m.colOff-f.colOff;for(let d=f.col;d<m.col;d++)v+=t(d);let b=m.rowOff-f.rowOff;for(let d=f.row;d<m.row;d++)b+=n(d);w(c,f,v,b)}return{anchors:i,pictures:a,others:l}}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_DATA as re,SHEET_FILE as ie,SHEET_FILES as j,SHEET_NOTE_AUTHOR as le,SHEET_PICTURE_HEIGHT as P,SHEET_SEPARATOR as fe}from"@allyhub-next/formats";import{cellName as y,columnLetter as M,contains as T,overlaps as A,rangeName as v,readAddress as ae,readArea as W}from"../address.js";import{rectangles as O}from"../api/rectangles.js";import{chartAfter as ce}from"../chart.js";import{analyse as ue}from"../calc/analyse.js";import{FUNCTIONS as he}from"../calc/functions/index.js";import{checkWorkbook as de}from"../check.js";import{writeCsv as me}from"../csv.js";import{pictureSize as pe}from"../files.js";import{isDateCode as z}from"../format.js";import{moveFormula as we,relativeKey as B}from"../formula/move.js";import{printFormula as E,sheetPrefix as U}from"../formula/print.js";import{mapNode as ge,walk as H}from"../formula/walk.js";import{CellError as N,isoOfSerial as ke,readTyped as F,writeTyped as I}from"../values.js";import{FormulaCell as be,validName as V}from"../workbook.js";import{writeYaml as ye}from"../write.js";import{readFileFormula as $e}from"./formula.js";import{hasDate as q}from"./numfmt.js";import{placesLine as D,readXlsx as xe}from"./read.js";import{LISTS_SHEET as Le}from"./write.js";const J=100,ve=.5,K=1462,Z=64,X=1e4;export const COMPARE_TOLERANCE=1e-9;const Y=a=>a.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/gu,"")||"rows",k=a=>{for(const e in a)if(Object.hasOwn(a,e))return!1;return!0},G=(a,e)=>`${String(a)} ${e}${a===1?"":"s"}`,S=a=>({row:a.row,col:a.col});function Q(a){return a===""||a.length>255||/^[/\\]|^[A-Za-z]:|\\|\0/u.test(a)?!1:a.split("/").every(e=>e!==""&&e!=="."&&e!=="..")}class Ee{cells;starts;first;constructor(e){let o=!0;for(let t=1;t<e.length&&o;t++){const n=e[t-1],r=e[t];n&&r&&(r.row<n.row||r.row===n.row&&r.col<=n.col)&&(o=!1)}if(!o){e.sort((t,n)=>t.row-n.row||t.col-n.col);for(let t=e.length-1;t>0;t--){const n=e[t-1],r=e[t];r&&n?.row===r.row&&n.col===r.col&&e.splice(t-1,1)}}this.cells=e;const s=e[0]?.row??0,l=e[e.length-1]?.row??-1;this.first=s,this.starts=new Int32Array(Math.max(0,l-s+2));let i=0;for(let t=0;t<this.starts.length;t++){for(;i<e.length&&(e[i]?.row??0)<s+t;)i++;this.starts[t]=i}}get(e,o){const s=e-this.first;if(s<0||s>=this.starts.length-1)return;let l=this.starts[s]??0,i=(this.starts[s+1]??0)-1;for(;l<=i;){const t=l+i>>1,n=this.cells[t];if(!n)return;if(n.col===o)return n;n.col<o?l=t+1:i=t-1}}}class ee{list=[];add(e){this.list.push(e)}has(e,o){for(const s of this.list)if(T(s,e,o))return!0;return!1}}function te(a,e){const o=e.toLowerCase();return ge(a,s=>s.kind!=="structured"||s.table?.toLowerCase()!==o?s:Object.fromEntries(Object.entries(s).filter(([l])=>l!=="table")))}function oe(a){return a.headers===0?"has no header row":a.columns.length!==a.ref.right-a.ref.left+1||!V(a.name)?"cannot be held as a table":new Set(a.columns.map(e=>e.name.toLowerCase())).size===a.columns.length?void 0:"has two columns of one name"}function ne(a,e,o){let s;const l=new Set;H(a,t=>{t.kind==="call"&&(t.name==="LET"||t.name==="LAMBDA")&&t.args.forEach(n=>{n.kind==="name"&&l.add(n.name.toLowerCase())})});const i=t=>l.has(t)||o===void 0||o.names.has(t)||o.tables.has(t);return H(a,t=>{s===void 0&&(t.kind==="call"&&!he.has(t.name)&&(i(t.written.toLowerCase())||(s=`no function ${t.name}`)),t.kind==="name"&&!i(t.name.toLowerCase())&&(s=`no name ${t.name}`),t.kind==="structured"&&t.table!==void 0&&!i(t.table.toLowerCase())&&(s=`no table ${t.table}`),(t.kind==="ref"||t.kind==="name"||t.kind==="error")&&t.sheet!==void 0&&(t.sheet.startsWith("[")?s="it reads another workbook":e.has(t.sheet.toLowerCase())||(s=`no sheet ${t.sheet}`)))}),s}function Se(a){const e=new Set(a.book.sheets.map(o=>o.name.toLowerCase()));for(const o of a.book.sheets){const s=new Map,l=(t,n)=>{const r=s.get(n),f=y(t);r?r.push(f):s.set(n,[f])},i=[];for(const t of o.cells){if(t.unread!==void 0){l(t,/^\[|[!']\[|\[\d+\]/u.test(t.unread)?"it reads another workbook":`it could not be read: ${t.unread}`);continue}if(!t.node)continue;const n=ne(t.node,e,a);n!==void 0?(delete t.node,l(t,n)):(a.carried.set(t,o),t.array&&v(t.array)!==y(t)&&i.push(t))}Ce(a,o,i);for(const[t,n]of s)a.lost.push(`${o.name}: ${G(n.length,"formula")} kept as ${n.length===1?"its value":"their values"}, as ${t} (${D(n)})`)}}function Ce(a,e,o){if(o.length===0)return;const s=new Set;for(const l of o){const{array:i}=l;if(i)for(const t of e.cells)t!==l&&!t.node&&T(i,t.row,t.col)&&s.add(t)}e.cells=e.cells.filter(l=>!s.has(l));for(const l of s)a.spilled.set(l,e)}function C(a,e){const{value:o}=e;if(!a.book.date1904||typeof o!="number")return o;const s=a.book.looks[e.style]?.format;return z(s)&&s!==void 0&&q(s)?o+K:o}function R(a,e){if(typeof a!="number"||e===void 0||!z(e)||!q(e)||a<1)return;const o=ke(a);return F(o).value===a?o:void 0}const Me=(a,e)=>R(a,e)??I(a??null);function Oe(a,e){const o=R(a,e);return o!==void 0?o:a==null?null:typeof a=="number"||typeof a=="boolean"?a:I(a)}function _e(a){const e=[];for(let n=0;n<a.length;n++){const r=a[n];if(!r)continue;const f=e[e.length-1];f?.row===r.row&&f.right===r.col-1?(f.right=r.col,f.last=n):e.push({row:r.row,left:r.col,right:r.col,first:n,last:n})}const o=e.map((n,r)=>r),s=n=>{let r=n;for(;o[r]!==r;){const f=o[o[r]??r]??r;o[r]=f,r=f}return r};let l=0,i=0;for(let n=0;n<e.length;n++){const r=e[n];if(r){n>0&&e[n-1]?.row!==r.row&&(l=e[n-1]?.row===r.row-1?i:n,i=n);for(let f=l;f<i;f++){const c=e[f];c?.row===r.row-1&&c.right>=r.left&&c.left<=r.right&&(o[s(n)]=s(f))}}}const t=new Map;return e.forEach((n,r)=>{const f=s(r),c=t.get(f),u=n.right-n.left+1;c?(c.box.top=Math.min(c.box.top,n.row),c.box.bottom=Math.max(c.box.bottom,n.row),c.box.left=Math.min(c.box.left,n.left),c.box.right=Math.max(c.box.right,n.right),c.count+=u,c.runs.push(r)):t.set(f,{box:{top:n.row,bottom:n.row,left:n.left,right:n.right},count:u,runs:[r]})}),[...t.values()].map(n=>({box:n.box,count:n.count,cells:()=>n.runs.flatMap(r=>{const f=e[r];return f?a.slice(f.first,f.last+1):[]})}))}const se=a=>JSON.stringify(a);class Te{ctx;read;cells;inTables=new ee;columnLooks=new Map;rowLooks=new Map;lookDone=new ee;tables=[];areas=[];filtered=[];ownLooks=new Map;fileColumns=new Map;pictured=new Map;over=[];constructor(e,o){this.ctx=e,this.read=o,this.cells=new Ee(o.cells)}at(e,o){return this.cells.get(e,o)}look(e){return this.ctx.book.looks[e.style]??{}}code(e){return this.look(e).format}text(e){return e.node?E(e.node):Me(C(this.ctx,e),this.code(e))}baseLooks(){const{read:e}=this,{looks:o}=this.ctx.book;let s=-1;for(const i of e.cells)i.col>s&&(s=i.col);for(const i of e.columns){if(i.style===void 0)continue;const t=o[i.style];if(!(!t||k(t)))for(let n=i.min;n<=Math.min(i.max,s);n++)this.columnLooks.set(n,t)}for(const i of e.rows){const t=i.style===void 0?void 0:o[i.style];t&&!k(t)&&this.rowLooks.set(i.row,t)}const l=(i,t)=>{for(const n in t)if(!(n in i))return!1;return!0};for(const i of e.cells){const t=this.look(i),n=this.columnLooks.get(i.col);n&&!l(t,n)&&this.columnLooks.delete(i.col);const r=this.rowLooks.get(i.row);r&&!l(t,r)&&this.rowLooks.delete(i.row)}}ownLook(e){const o=this.columnLooks.get(e.col),s=this.rowLooks.get(e.row),l=this.look(e),i=l.format!==void 0&&z(l.format);if(!o&&!s&&!i){let f=this.ownLooks.get(e.style);return f||(f={look:l,key:se(l)},this.ownLooks.set(e.style,f)),f}const t={...o,...s},n={};for(const[f,c]of Object.entries(l))JSON.stringify(c)!==JSON.stringify(t[f])&&(n[f]=c);const r=n.format;if(typeof r=="string"){const f=e.node?void 0:R(C(this.ctx,e),r);f!==void 0&&F(f).format===r&&delete n.format}return{look:n,key:se(n)}}columnFormula(e,o,s){const l=new Map,i=s-o+1;for(let n=o;n<=s;n++){const r=this.at(n,e);if(!r||r.value===void 0&&!r.node||r.value===null&&!r.node)return;if(!r.node)continue;r.key??=B(r.node,r.row,r.col);const f=l.get(r.key);f?f.n+=1:l.set(r.key,{n:1,cell:r})}let t;for(const n of l.values())(!t||n.n>t.n)&&(t=n);return t&&t.n*2>i?t.cell:void 0}csv(e,o){const s=[];for(let l=0;l<e;l+=X){const i=[];for(let t=l;t<Math.min(e,l+X);t++)i.push(o(t));s.push(me(i))}return s.join("")}table(e){const{read:o,ctx:s}=this,l=p=>s.lost.push(`${o.name}: table ${e.name} ${p}`),i=e.ref.right-e.ref.left+1,t=oe(e);if(t!==void 0)return l(`${t}, so its cells are kept and it is no table`),!1;const n=e.ref.top,r=n+1,f=e.ref.bottom-e.totals;e.totals>0&&l("has a totals row, kept as plain cells under it");const c=e.columns.map((p,d)=>f>=r?this.columnFormula(e.ref.left+d,r,f):void 0),u=p=>{const d=c[p];if(!d)return!1;for(let g=r;g<=f;g++)if(this.at(g,e.ref.left+p)?.key!==d.key)return!1;return!0};let h=i;for(;h>1&&u(h-1);)h-=1;const w={},m=this.path(e.name);s.files.set(m,this.csv(f-r+2,p=>{if(p===0)return e.columns.slice(0,h).map(b=>b.name);const d=r+p-1,g=[];for(let b=0;b<h;b++){const x=this.at(d,e.ref.left+b),L=c[b];x?L&&x.key===L.key?g.push(""):x.node?g.push(E(te(x.node,e.name))):g.push(this.text(x)):g.push("")}return g})),this.inTables.add({...e.ref,bottom:f}),e.columns.forEach((p,d)=>{const g=e.ref.left+d,b=this.columnLook(g,r,f),x=c[d];x?.node&&(b.formula=E(te(we(x.node,r-x.row,0),e.name)));const L=this.fileColumns.get(g);L!==void 0&&r<=f&&(b.files=L===P?!0:{height:L}),k(b)||(w[p.name]=b)});const $=new Map;for(const[p,d]of e.filter?.columns??[]){const g=e.columns[p]?.name;g!==void 0&&$.set(g,d)}return(e.filter?.unread??0)>0&&l(`has ${G(e.filter?.unread??0,"filter")} by condition, its rows left as they were hidden`),this.tables.push({name:e.name,at:y({row:n,col:e.ref.left}),rows:m,...e.style!==void 0&&e.style!=="TableStyleMedium2"?{style:e.style}:{},...k(w)?{}:{columns:w},...e.filter===void 0?{filter:!1}:$.size>0?{filter:{columns:Object.fromEntries($)}}:{}}),e.filter?.unread===0&&e.filter.columns.size>0&&this.filtered.push({...e.ref,bottom:f}),this.areas.push({...e.ref,bottom:f}),!0}columnLook(e,o,s){let l,i={};for(let t=o;t<=s;t++){const n=this.at(t,e),r=n?this.ownLook(n):{look:{},key:"{}"};if(l===void 0)l=r.key,i=r.look;else if(l!==r.key)return{}}return k(i)?{}:(this.lookDone.add({top:o,bottom:s,left:e,right:e}),{...i})}path(e){const o=`${re}/${Y(e)}`;let s=`${o}.csv`;for(let l=2;this.ctx.files.has(s);l++)s=`${o}-${String(l)}.csv`;return s}loose(){const e=[],o=[];for(const s of this.read.cells)this.inTables.has(s.row,s.col)||(s.node?e.push(s):s.value!==void 0&&s.value!==null&&o.push(s));return{formulas:e,typed:o}}blockAreas(e,o){const s=[],l=O(o.map(S)),i=n=>!s.some(r=>A(r,n))&&!this.areas.some(r=>A(r,n))&&!l.some(r=>A(r,n)),t=n=>(n.bottom-n.top+1)*(n.right-n.left+1);for(const n of _e(e)){const{box:r}=n;if(!(t(r)<J)){if(n.count/t(r)>=ve&&i(r)){s.push(r);continue}for(const f of O(n.cells().map(S)))t(f)>=J&&i(f)&&s.push(f)}}return s.sort((n,r)=>n.top-r.top||n.left-r.left)}cells_(e){const{formulas:o,typed:s}=this.loose(),l=this.blockAreas(s,o),i=r=>l.some(f=>T(f,r.row,r.col));l.length>0&&(e.blocks=l.map(r=>{const f=this.path(this.read.name);return this.ctx.files.set(f,this.csv(r.bottom-r.top+1,c=>{const u=[];for(let h=r.left;h<=r.right;h++){const w=this.at(r.top+c,h);u.push(w?this.text(w):"")}return u})),{at:y({row:r.top,col:r.left}),rows:f}}));const t=[],n=new Map;for(const r of o){if(!r.node)continue;r.key??=B(r.node,r.row,r.col);const f=n.get(r.key);f?f.push(r):n.set(r.key,[r])}for(const r of n.values())for(const f of O(r.map(S))){const c=this.at(f.top,f.left);c?.node&&t.push([{row:f.top,col:f.left},v(f),E(c.node)])}for(const r of s)l.length>0&&i(r)||t.push([S(r),y(r),Oe(C(this.ctx,r),this.code(r))]);t.sort(([r],[f])=>r.row-f.row||r.col-f.col),t.length>0&&(e.cells=Object.fromEntries(t.map(([,r,f])=>[r,f])))}formats(e){const o=new Map,s=this.lookDone.list.length>0;for(const i of this.read.cells){if(s&&this.lookDone.has(i.row,i.col))continue;const t=this.ownLook(i);if(k(t.look))continue;const n=o.get(t.key);n?n.places.push(S(i)):o.set(t.key,{look:t.look,places:[S(i)]})}const l=[];for(const{look:i,places:t}of o.values())for(const n of O(t))l.push({range:v(n),...i});l.length>0&&(e.format=l)}columns(e){const{read:o}=this,s=new Map;let l=0;for(const t of o.cells)t.col>l&&(l=t.col);const i=[];for(const t of o.columns){if(t.width===void 0&&t.hidden!==!0&&t.level===void 0)continue;const n=t.max-Math.max(t.min,l+1)+1>Z?Math.max(l,t.min+Z-1):t.max;n<t.max&&i.push(`${M(n+1)}:${M(t.max)}`);for(let r=t.min;r<=n;r++)s.set(r,{...t.width===void 0?{}:{width:t.width},...t.hidden===!0?{hidden:!0}:{},...t.level===void 0?{}:{level:t.level}})}for(const[t,n]of this.columnLooks)s.set(t,{...s.get(t),...n});for(const[t,n]of this.fileColumns)this.tableColumn(t)||s.set(t,{...s.get(t),files:n===P?!0:{height:n}});s.size>0&&(e.columns=Object.fromEntries([...s.keys()].sort((t,n)=>t-n).map(t=>[M(t),s.get(t)??{}]))),i.length>0&&this.ctx.lost.push(`${o.name}: the size of columns ${D(i)}, past those that hold anything`)}tableColumn(e){return this.areas.some(o=>e>=o.left&&e<=o.right)}rows(e){const o={};for(const s of this.read.rows){const l=this.rowLooks.get(s.row),i=this.filtered.some(r=>s.row>r.top&&s.row<=r.bottom),t=s.height!==void 0&&this.pictured.get(s.row)!==s.height?s.height:void 0,n={...t===void 0?{}:{height:t},...s.hidden===!0&&!i?{hidden:!0}:{},...s.level===void 0?{}:{level:s.level},...l};k(n)||(o[String(s.row+1)]=n)}k(o)||(e.rows=o)}assetPath(e,o){const s=t=>{const n=this.ctx.assets.get(t);return!n||Ae(n,o.bytes)};if(e!==void 0&&Q(e)&&s(e))return e;const l=Y((o.name??"picture").replace(/\.[A-Za-z0-9]+$/u,""));let i=`${j}/${l}.${o.type}`;for(let t=2;!s(i);t++)i=`${j}/${l}-${String(t)}.${o.type}`;return i}pictures(){const e=this.over;for(const o of this.read.pictures){const s=this.at(o.row,o.col),l=typeof s?.value=="string"?s.value:"";if(o.y===void 0&&o.descr!==void 0&&Q(o.descr)&&l.split(fe).includes(o.descr)&&o.descr!==void 0){this.ctx.assets.set(o.descr,o.bytes),this.fileColumns.set(o.col,Math.max(this.fileColumns.get(o.col)??0,o.height)),this.pictured.set(o.row,Math.max(this.pictured.get(o.row)??0,o.height));continue}const t=this.assetPath(o.descr,o);this.ctx.assets.set(t,o.bytes);const n=pe(o.bytes),r=n?.width===o.width&&n.height===o.height;e.push({file:t,at:y({row:o.row,col:o.col}),...o.x===void 0?{}:{x:o.x},...o.y===void 0?{}:{y:o.y},...r?{}:{width:o.width,height:o.height}})}}build(){const{read:e}=this;this.baseLooks(),this.pictures();for(const s of e.tables)this.table(s);const o={name:e.name};return e.state!=="visible"&&(o.hidden=!0),e.gridlines===!1&&(o.gridlines=!1),e.tab!==void 0&&(o.tab=e.tab),e.state==="veryHidden"&&this.ctx.lost.push(`${e.name}: being very hidden; it is hidden`),e.freeze&&(e.freeze.row>0||e.freeze.col>0)&&(o.freeze=y(e.freeze)),this.tables.length>0&&(o.tables=this.tables),this.filter(o),this.columns(o),this.rows(o),this.cells_(o),e.merges.length>0&&(o.merges=e.merges.map(v)),this.formats(o),e.conditional.length>0&&(o.conditional=e.conditional),e.validations.length>0&&(o.validations=e.validations),e.charts.length>0&&(o.charts=e.charts.map(s=>this.chart(s))),this.over.length>0&&(o.pictures=this.over),k(e.links)||(o.links=e.links),e.notes.length>0&&(o.notes=Object.fromEntries(e.notes.map(s=>[s.ref,s.author===void 0||s.author===le?s.text:{text:s.text,author:s.author}]))),e.print&&(o.print=e.print),e.protect===!0&&(o.protect=!0),o}chart(e){return ce(e,o=>{const s=this.chartReference(o.replace(/^=/u,""));return o.startsWith("=")?`=${s}`:s})}chartReference(e){const o=e.lastIndexOf("!"),l=(o<0?this.read.name:e.slice(0,o)).replace(/^'|'$/gu,"").replaceAll("''","'"),i=W(e.slice(o+1).replaceAll("$",""));if(!i)return e;const t=this.ctx.book.sheets.find(n=>n.name.toLowerCase()===l.toLowerCase());for(const n of t?.tables??[]){const r=n.ref.top+1,c=i.left===i.right&&i.top===r&&i.bottom===n.ref.bottom&&i.left>=n.ref.left&&i.left<=n.ref.right?n.columns[i.left-n.ref.left]:void 0;if(c&&this.ctx.tables.has(n.name.toLowerCase()))return`${n.name}[${c.name}]`}return`${t===this.read||o<0?"":`${e.slice(0,o)}!`}${v(i)}`}filter(e){const{filter:o}=this.read;if(!o)return;const s={};for(const[l,i]of o.columns)s[M(o.ref.left+l)]=i;e.filter={range:v(o.ref),...k(s)?{}:{columns:s}},o.unread===0&&!k(s)&&this.filtered.push(o.ref)}}const Ae=(a,e)=>a.length===e.length&&a.every((o,s)=>o===e[s]),ze=new Set(["_xlnm._FilterDatabase","_xlnm.Print_Area","_xlnm.Print_Titles"]);function He(a){const e={},o=[],s=new Map,{book:l,lost:i}=a,t=new Set(l.sheets.map(f=>f.name.toLowerCase())),n=new Set,r=f=>{const c=Ie(f.text);if(c!==void 0)return typeof c=="string"?I(c):c;const u=$e(f.text,!0),h=u.ok?ne(u.node,t):"it could not be read";if(!u.ok||h!==void 0||Fe(u.node)){i.push(`the name ${f.name} (${f.text})${h===void 0?"":`: ${h}`}`);return}return E(u.node)};for(const f of l.names){if(f.name.startsWith("_xlnm.")){ze.has(f.name)||i.push(`Excel's name ${f.name}`);continue}if(/^_xl(?:fn|pm|ws|udf)/iu.test(f.name))continue;const c=f.name.toLowerCase(),u=f.sheet===void 0?"":String(f.sheet);if(!V(f.name)||a.tables.has(c)){i.push(`the name ${f.name}, which cannot be held here`);continue}if(n.has(`${u}|${c}`)){i.push(`a second name ${f.name}${u===""?"":` of ${l.sheets[f.sheet??0]?.name??""}`}`);continue}const h=r(f);if(h!==void 0)if(n.add(`${u}|${c}`),a.names.add(c),f.sheet===void 0)e[f.name]=h,f.hidden===!0&&o.push(f.name);else{const w=s.get(f.sheet)??{names:{},hidden:[]};w.names[f.name]=h,f.hidden===!0&&w.hidden.push(f.name),s.set(f.sheet,w)}}return{names:e,hidden:o,sheets:s}}function Ne(a,e){const o={},s=new Map;for(const[l,i]of Object.entries(e))typeof i=="string"&&i.startsWith("=")&&s.set(i.slice(1).replaceAll("$","").toLowerCase(),l);for(const l of a.book.sheets)for(const i of l.scenarios){const t={};let n=!0;for(const{at:r,value:f}of i.cells){const c=ae(r),u=c&&l.cells.find(m=>m.row===c.row&&m.col===c.col);String(u?.value??"")!==f&&(n=!1);const h=s.get(`${U(l.name)}${r}`.toLowerCase())??s.get(r.toLowerCase()),w=F(f);h===void 0?a.lost.push(`${l.name}: scenario ${i.name}'s cell ${r}, which has no name`):t[h]=typeof w.value=="number"?w.value:f}!n&&!k(t)&&(o[i.name]={...o[i.name],...t})}return o}function Fe(a){let e=!1;return H(a,o=>{e||=o.kind==="error"&&o.code==="#REF!"}),e}function Ie(a){const e=a.trim();return/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/u.test(e)?Number(e):/^true$/iu.test(e)?!0:/^false$/iu.test(e)?!1:/^"((?:[^"]|"")*)"$/u.exec(e)?.[1]?.replaceAll('""','"')}const De=new RegExp(`^${Le.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}(?: \\(\\d+\\))?$`,"u");function Re(a){const e=a.sheets.find(i=>i.state==="veryHidden"&&De.test(i.name));if(!e)return;const o=U(e.name).toLowerCase(),s=i=>{const t=i.replace(/^=/u,"");if(!t.toLowerCase().startsWith(o))return;const n=W(t.slice(o.length).replaceAll("$",""));if(!n||n.left!==n.right)return;const r=[];for(let f=n.top;f<=n.bottom;f++){const c=e.cells.find(u=>u.row===f&&u.col===n.left);r.push(typeof c?.value=="string"?c.value:"")}return r};for(const i of a.sheets)i.validations=i.validations.map(t=>{const[n]=t.formula??[],r=t.type==="list"&&typeof n=="string"?s(n):void 0;if(!r)return t;const f={...t,values:r};return delete f.formula,f});const l=a.sheets.indexOf(e);a.sheets=a.sheets.filter(i=>i!==e),a.names=a.names.flatMap(i=>i.sheet===void 0||i.sheet<l?[i]:i.sheet===l?[]:[{...i,sheet:i.sheet-1}])}const _=a=>a instanceof N?a.code:a??null;export function sameValue(a,e,o){if(typeof a=="number"&&typeof e=="number")return a===e?!0:Math.abs(a-e)<=Math.max(Math.abs(a),Math.abs(e))*o;if(a instanceof N||e instanceof N)return a?.code===e?.code;if(a===null||e===null){const s=a??e;return s===null||s===""||s===0||s===!1}return a===e}function je(a,e){const o=[];for(const i of e.sheets)for(const t of i.formulas)t.shared.node&&ue(e,t.shared,i).volatile&&o.push(t);const s=new Set(o),l=[...o];for(;;){const i=l.pop();if(!i)return s;for(const t of a.readers(i.sheet,i.row,i.col))s.has(t)||(s.add(t),l.push(t))}}function Pe(a,e,o,s){const l={formulas:0,same:0,uncached:0,moving:0,differences:[]},i=je(o,e);for(const[t,n]of a.carried){if(!t.node)continue;const r=e.sheet(n.name);if(!r)continue;l.formulas+=1;const f=r.at(t.row,t.col);if(f instanceof be&&i.has(f)){l.moving+=1;continue}const c=C(a,t);if(c===void 0){l.uncached+=1;continue}const u=o.value(r,t.row,t.col);sameValue(c,u,s)?l.same+=1:l.differences.push({sheet:n.name,cell:y(t),formula:E(t.node),file:_(c),engine:_(u)})}for(const[t,n]of a.spilled){const r=e.sheet(n.name);if(!r)continue;l.formulas+=1;const f=r.spillAt(t.row,t.col);if(f&&i.has(f)){l.moving+=1;continue}const c=C(a,t),u=o.value(r,t.row,t.col);c===void 0?l.uncached+=1:sameValue(c,u,s)?l.same+=1:l.differences.push({sheet:n.name,cell:y(t),formula:f?`${y(f)}#`:"",file:_(c),engine:_(u)})}return l}function We(a,e){const o=new Map,s=[];for(const l of a){const i=e.find(r=>l.startsWith(`${r}: `));if(i===void 0){s.push(l);continue}const t=l.slice(i.length+2),n=o.get(t);n?n.push(i):o.set(t,[i])}for(const[l,i]of o)s.push(i.length===1?`${i[0]??""}: ${l}`:`${l}, on ${String(i.length)} sheets (${D(i)})`);return s}export function importXlsx(a,e){const o=xe(a,e.zip);if(Re(o),o.sheets.length===0)throw new Error("It holds no sheets.");const s={book:o,files:new Map,assets:new Map,lost:[...o.lost],tables:new Set(o.sheets.flatMap(m=>m.tables.filter($=>oe($)===void 0).map($=>$.name.toLowerCase()))),names:new Set,carried:new Map,spilled:new Map};o.date1904&&s.lost.push(`the 1904 date system: dates are moved to the 1900 one, ${String(K)} days on`),(o.font.name!==void 0&&o.font.name!=="Calibri"||o.font.size!==void 0&&o.font.size!==11)&&s.lost.push(`its default font, ${o.font.name??""} ${String(o.font.size??"")}`);const l=He(s);Se(s);const i=o.sheets.map((m,$)=>{const p=new Te(s,m).build(),d=l.sheets.get($);return d&&!k(d.names)&&(p.names=d.names),d&&d.hidden.length>0&&(p.hidden_names=d.hidden),p}),t=Ne(s,l.names),n={title:o.title??e.name,...k(l.names)?{}:{names:l.names},...l.hidden.length>0?{hidden_names:l.hidden}:{},sheets:i,...k(t)?{}:{scenarios:t}},r=ye(n),f=new Map([[ie,r],...s.files]),c=de({text:r,read:m=>f.get(m),exists:m=>f.has(m)||s.assets.has(m)}),{workbook:u,calc:h,problems:w}=c;return{files:f,assets:s.assets,lost:We(s.lost,o.sheets.map(m=>m.name)),problems:w,compared:u&&h?Pe(s,u,h,e.tolerance??COMPARE_TOLERANCE):{formulas:0,same:0,uncached:0,moving:0,differences:[]},sheets:o.sheets.length,tables:s.tables.size}}
@@ -1,3 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{ZipLimitError as ve}from"@allyhub-next/formats";import{SHEET_ICONS as Se,SHEET_MARGINS as de,SHEET_OPERATORS as Ce,SHEET_PAPERS as Ee,SHEET_VALIDATIONS as Ne}from"@allyhub-next/formats";import{MAX_COLUMNS as q,MAX_ROWS as K,cellName as Y,columnLetter as Ae,readAddress as Oe,readArea as G,readAreas as ee}from"../address.js";import{SHEET_CHART_DEFAULTS as ce}from"../chart.js";import{moveFormula as Te,relativeKey as Ie}from"../formula/move.js";import{printFormula as fe}from"../formula/print.js";import{ERR as Le,errorOf as Re,serialOfDate as Me}from"../values.js";import{OFFICE_THEME as Fe,colorOf as F,paletteOf as le,themeColors as De}from"./colors.js";import{chartAnchors as je,readChart as Pe}from"./charts.js";import{isRangeText as ze,readFileFormula as te}from"./formula.js";import{BUILTIN_FORMATS as _e}from"./numfmt.js";import{XmlStream as ue}from"./sax.js";import{attr as u,flag as v,numberAttr as k,readXml as he,readXstring as A,tag as d,tags as x,textOf as E}from"./xml.js";import{ZipIn as He}from"./zip.js";const pe=7,Ve=r=>Math.floor((256*r+Math.floor(128/pe))/256*pe),Ue=r=>Math.round(r*4/3),ne=5;export function placesLine(r){const e=r.slice(0,ne).join(", ");return r.length>ne?`${e} and ${String(r.length-ne)} more`:e}const H=(r,e,t=`${e}s`)=>`${String(r)} ${r===1?e:t}`;export const GRID_END=`Excel's grid ends at ${Ae(q-1)}${String(K)} (${K.toLocaleString("en-US")} rows, ${q.toLocaleString("en-US")} columns)`;function We(r,e){let t=0,n=0;const o=r.length;for(;t<o;t++){const i=r.charCodeAt(t),c=i>=65&&i<=90,a=i>=97&&i<=122;if(!c&&!a)break;n=n*26+(c?i-64:i-96)}if(t===0||t===o)return;let s=0;for(let i=t;i<o;i++){const c=r.charCodeAt(i);if(c<48||c>57)return;s=s*10+c-48}if(s!==0){if(t>3||n>q||s>K)throw new Error(`${e} has a cell at ${r}, and ${GRID_END}.`);return{row:s-1,col:n-1}}}class Be{zip;constructor(e,t){this.zip=new He(e,t)}get names(){return this.zip.names}has(e){return this.zip.has(e)}text(e){return this.zip.text(e)}bytes(e){return this.zip.bytesOf(e)}xml(e){const t=this.text(e);return t===void 0?void 0:he(t)}stream(e,t){const n=this.zip.streamText(e,o=>{t.push(o)});return n&&t.end(),n}rels(e){const t=e.lastIndexOf("/"),n=`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`,o=this.xml(n);return x(d(o?.Relationships)?.Relationship).map(s=>{const i=u(s,"Type")??"",c=u(s,"Target")??"",a=u(s,"TargetMode")==="External";return{id:u(s,"Id")??"",type:i.slice(i.lastIndexOf("/")+1),target:a?c:Xe(e,c),external:a}})}count(e){return this.names.filter(t=>e.test(t)).length}}function Xe(r,e){if(e.startsWith("/"))return e.slice(1);const t=r.split("/").slice(0,-1);for(const n of e.split("/"))n===".."?t.pop():n!=="."&&t.push(n);return t.join("/")}function qe(r,e){const t=[];if(e===void 0)return t;let n,o=0,s=!1;const i={open(c){if(c==="si"){n={text:"",rich:!1};return}if(n){if(o>0||c==="rPh"||c==="phoneticPr"||c==="extLst"){o+=1;return}c==="r"&&(n.rich=!0),c==="t"&&(s=!0)}},close(c){if(o>0){o-=1;return}if(c==="si"){n&&t.push({...n,text:A(n.text)}),n=void 0;return}c==="t"&&(s=!1)},text(c){n&&s&&o===0&&(n.text+=c)}};return r.stream(e,new ue(i)),t}function W(r,e){const t=r[e];if(t===void 0)return!1;const n=u(d(t),"val");return n===void 0||n!=="0"&&n!=="false"}const Ge=new Set(["double","singleAccounting","doubleAccounting"]);function Ze(r,e,t){const n={},o=(a,l)=>u(d(a?.[l]),"val");if(W(r,"b")&&(n.bold=!0),W(r,"i")&&(n.italic=!0),W(r,"strike")&&(n.strike=!0),W(r,"u")){const a=o(r,"u");n.underline=a!==void 0&&Ge.has(a)?a:!0}const s=o(r,"name");s!==void 0&&s!==o(e,"name")&&(n.font=s);const i=o(r,"sz");i!==void 0&&i!==o(e,"sz")&&(n.size=Number(i));const c=F(d(r.color),t);return c!==void 0&&c!==F(d(e?.color),t)&&(n.color=c),n}function Je(r,e){const t=d(r.patternFill),n=u(t,"patternType");if(n===void 0||n==="none")return;const o=F(d(t?.fgColor),e),s=F(d(t?.bgColor),e);return n==="solid"&&o!==void 0?o:{pattern:n,...o===void 0?{}:{color:o},...s===void 0?{}:{background:s}}}function me(r,e){const t={};for(const n of["left","right","top","bottom"]){const o=d(r[n]),s=u(o,"style");if(s===void 0||s==="none")continue;const i=F(d(o?.color),e);t[n]={style:s,...i===void 0?{}:{color:i}}}return Object.keys(t).length===0?void 0:t}function Ke(r){const e={},t=u(r,"horizontal");t!==void 0&&t!=="general"&&(e.align=t);const n=u(r,"vertical");n!==void 0&&n!=="bottom"&&(e.valign=n),v(r,"wrapText")===!0&&(e.wrap=!0),v(r,"shrinkToFit")===!0&&(e.shrink=!0);const o=k(r,"indent");o!==void 0&&o>0&&(e.indent=o);const s=k(r,"textRotation");return s!==void 0&&s>0&&s<=180&&(e.rotation=s),e}function ge(r,e){const t={},n=d(r.font);if(n){const a=(f,p)=>{n[f]!==void 0&&(t[p]=W(n,f))};a("b","bold"),a("i","italic"),a("strike","strike"),n.u!==void 0&&(t.underline=W(n,"u"));const l=F(d(n.color),e);l!==void 0&&(t.color=l)}const o=d(d(r.fill)?.patternFill),s=F(d(o?.bgColor),e)??F(d(o?.fgColor),e);s!==void 0&&(t.fill=s);const i=d(r.border),c=i&&me(i,e);return c!==void 0&&(t.border=c),t}function Qe(r,e){const t=d(r?.styleSheet),n=le(e,t),o=new Map(x(d(t?.numFmts)?.numFmt).map(w=>[k(w,"numFmtId")??-1,u(w,"formatCode")??"General"])),s=x(d(t?.fonts)?.font),i=x(d(t?.fills)?.fill),c=x(d(t?.borders)?.border),a=x(d(t?.cellXfs)?.xf),l=s[k(a[0],"fontId")??0],f=new Set;i.some(w=>w.gradientFill!==void 0)&&f.add("gradient fills");const p=a.map(w=>{const m={},$=s[k(w,"fontId")??0];$&&(Object.assign(m,Ze($,l,n)),$.vertAlign!==void 0&&f.add("superscript and subscript"));const S=i[k(w,"fillId")??0],O=S&&Je(S,n);O!==void 0&&(m.fill=O);const T=c[k(w,"borderId")??0],z=T&&me(T,n);z!==void 0&&(m.border=z),T&&u(d(T.diagonal),"style")!==void 0&&f.add("diagonal borders");const D=d(w.alignment);D&&(Object.assign(m,Ke(D)),k(D,"textRotation")===255&&f.add("vertical text"));const I=k(w,"numFmtId")??0,M=o.get(I)??_e[I];return M!==void 0&&M!=="General"&&(m.format=M),m}),h=u(d(l?.name),"val"),b=u(d(l?.sz),"val");return{looks:p,dxfs:x(d(t?.dxfs)?.dxf).map(w=>ge(w,n)),font:{...h===void 0?{}:{name:h},...b===void 0?{}:{size:Number(b)}},lost:[...f]}}function be(r){const e=new Map;let t=0;for(const n of x(r.filterColumn)){const o=k(n,"colId")??0,s=d(n.filters);if(!s){Object.keys(n).some(c=>c!=="colId"&&c!=="hiddenButton")&&(t+=1);continue}if(s.dateGroupItem!==void 0){t+=1;continue}const i=x(s.filter).map(c=>A(u(c,"val")??""));e.set(o,{...i.length===0?{}:{values:i},...v(s,"blank")===!0?{blanks:!0}:{}})}return{columns:e,unread:t}}function Ye(r){const e=d(r?.table),t=G(u(e,"ref")??""),n=u(e,"displayName")??u(e,"name");if(!t||n===void 0)return;const o=d(e?.tableStyleInfo),s=d(e?.autoFilter);return{name:n,ref:t,headers:k(e,"headerRowCount")??1,totals:k(e,"totalsRowCount")??0,columns:x(d(e?.tableColumns)?.tableColumn).map(i=>({name:A(u(i,"name")??"").trim(),calculated:i.calculatedColumnFormula!==void 0})),style:u(o,"name")??"none",...s?{filter:be(s)}:{}}}function oe(r){const e=r.trim();if(e==="")return;const t=/^"((?:[^"]|"")*)"$/u.exec(e);if(t)return(t[1]??"").replaceAll('""','"');const n=Number(e);if(!Number.isNaN(n))return n;const o=te(e,!0);return o.ok?fe(o.node):void 0}const xe=r=>r!==void 0&&Ce.includes(r);function re(r){const e=u(r,"type")??"num",t=u(r,"val")??(r.f===void 0?void 0:E(r.f)),n=t===void 0?void 0:oe(t);return{at:e,...n===void 0?{}:{value:n}}}const et=Se,tt=r=>{const e=r.formula??r.f;return(Array.isArray(e)?e:e===void 0?[]:[e]).map(E)};function nt(r,e,t,n){const o=u(r,"type")??"",s={range:e,...v(r,"stopIfTrue")===!0?{stop:!0}:{}},i={...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline!==!1},...t.strike===void 0?{}:{strike:t.strike},...t.color===void 0?{}:{color:t.color},...typeof t.fill=="string"?{fill:t.fill}:{},...t.border===void 0?{}:{border:t.border}},c=tt(r);switch(o){case"cellIs":{const a=u(r,"operator"),l=c.flatMap(f=>{const p=oe(f);return p===void 0?[]:[p]});return!xe(a)||l.length===0?`a cellIs rule of ${a??"no operator"}`:{...s,...i,type:"cellIs",operator:a,formula:l}}case"containsText":case"notContainsText":case"beginsWith":case"endsWith":{const a=u(r,"text");return a===void 0?`a ${o} rule with no text`:{...s,...i,type:"containsText",...o==="containsText"?{}:{operator:o==="notContainsText"?"notContains":o},text:A(a)}}case"duplicateValues":case"uniqueValues":return{...s,...i,type:o};case"top10":return{...s,...i,type:"top10",rank:k(r,"rank")??10,...v(r,"percent")===!0?{percent:!0}:{},...v(r,"bottom")===!0?{bottom:!0}:{}};case"aboveAverage":return{...s,...i,type:"aboveAverage",...v(r,"aboveAverage")===!1?{below:!0}:{},...v(r,"equalAverage")===!0?{equal:!0}:{}};case"expression":{const a=c[0]===void 0?void 0:te(c[0],!0);return a?.ok?{...s,...i,type:"expression",formula:fe(a.node)}:"an expression rule that cannot be read"}case"dataBar":{const a=d(r.dataBar),l=F(d(a?.color??a?.fillColor),n),[f,p]=x(a?.cfvo).map(re);return l===void 0?"a data bar with no colour":{...s,type:"dataBar",color:l,...f&&f.at!=="min"?{min:f}:{},...p&&p.at!=="max"?{max:p}:{},...v(a,"showValue")===!1?{show:!1}:{}}}case"colorScale":{const a=d(r.colorScale),l=x(a?.cfvo).map(re),f=x(a?.color).map(h=>F(h,n)),p=l.flatMap((h,b)=>{const w=f[b];return w===void 0?[]:[{...h,color:w}]});return p.length<2?"a colour scale with too few stops":{...s,type:"colorScale",stops:p.slice(0,3)}}case"iconSet":{const a=d(r.iconSet),l=u(a,"iconSet")??"3TrafficLights1";if(!et.includes(l))return`the icon set ${l}`;if(a?.cfIcon!==void 0)return"an icon set of icons chosen one by one";const f=x(a?.cfvo).map(re);return{...s,type:"iconSet",icons:l,...f.length>=3?{stops:f.slice(0,5)}:{},...v(a,"reverse")===!0?{reverse:!0}:{},...v(a,"showValue")===!1?{show:!1}:{}}}default:return`a ${o} rule`}}const we={conditional:"{78C0D931-6437-407d-A8EE-F0AAD7539E65}",validations:"{CCE6A557-97BC-4b89-ADB6-D9C93CAAB3DF}"},ye=(r,e)=>x(d(r.extLst)?.ext).find(t=>u(t,"uri")?.toUpperCase()===e.toUpperCase());function ot(r,e,t){const n=[],o=[],s=new Set,i=(a,l,f)=>{const p=nt(a,l,f,t);typeof p=="string"?o.push(`${p} on ${l}`):n.push({priority:k(a,"priority")??0,rule:p})};for(const a of x(r.conditionalFormatting)){const l=u(a,"sqref")??"";if(!ee(l)){o.push(`a rule on ${l}`);continue}for(const f of x(a.cfRule)){const p=E(d(d(f.extLst)?.ext)?.id);p!==""&&s.add(p.toUpperCase());const h=k(f,"dxfId");i(f,l,h===void 0?{}:e[h]??{})}}const c=d(ye(r,we.conditional)?.conditionalFormattings);for(const a of x(c?.conditionalFormatting)){const l=E(a.sqref).trim();for(const f of x(a.cfRule)){if(s.has((u(f,"id")??"").toUpperCase()))continue;if(!ee(l)){o.push(`a rule on ${l}`);continue}const p=d(f.dxf);i(f,l,p?ge(p,t):{})}}return{rules:n.sort((a,l)=>a.priority-l.priority).map(a=>a.rule),unread:o}}const rt=Ne;function $e(r,e,t,n){const o=u(r,"type")??"none";if(o==="none"&&u(r,"prompt")===void 0)return;if(!rt.includes(o)||!ee(e))return`a ${o} rule on ${e}`;const s=/^"((?:[^"]|"")*)"$/u.exec(t.trim()),i=o==="list"&&s?(s[1]??"").replaceAll('""','"').split(","):void 0,c=[t,n].flatMap(w=>{const m=oe(w);return m===void 0?[]:[m]}),a=u(r,"operator"),l=w=>Object.fromEntries(Object.entries(w).filter(([,m])=>m!==void 0)),f=l({title:u(r,"promptTitle"),message:u(r,"prompt")}),p=l({style:u(r,"errorStyle"),title:u(r,"errorTitle"),message:u(r,"error")}),h=v(r,"showInputMessage")!==!0,b=v(r,"showErrorMessage")!==!0;return{range:e,type:o,...xe(a)&&a!=="between"?{operator:a}:{},...i?{values:i}:{formula:c},...v(r,"allowBlank")===!0?{}:{blank:!1},...v(r,"showDropDown")===!0?{dropdown:!1}:{},...h||Object.keys(f).length>0?{prompt:{...f,...h?{show:!1}:{}}}:{},...b||Object.keys(p).length>0?{error:{...p,...b?{show:!1}:{}}}:{}}}function st(r){const e=[],t=[],n=s=>{typeof s=="string"?t.push(s):s&&e.push(s)};for(const s of x(d(r.dataValidations)?.dataValidation))n($e(s,u(s,"sqref")??"",E(s.formula1),E(s.formula2)));const o=d(ye(r,we.validations)?.dataValidations);for(const s of x(o?.dataValidation))n($e(s,E(s.sqref).trim(),E(d(s.formula1)?.f),E(d(s.formula2)?.f)));return{rules:e,unread:t}}function it(r){const e=/^(-?\d{4,})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(\.\d+)?)?)?(?:Z|[+-]\d{2}:?\d{2})?$/u.exec(r)??/^()()()(\d{2}):(\d{2})(?::(\d{2})(\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/u.exec(r);if(!e)return;const t=e[1]==="",n=t?1899:Number(e[1]),o=t?12:Number(e[2]),s=t?30:Number(e[3]),i=Number(e[4]??0)*3600+Number(e[5]??0)*60+Number(e[6]??0)+Number(e[7]??0),c=new Date(Date.UTC(n,o-1,s)+i*1e3);if(Number.isNaN(c.getTime()))return;const a=Me(c);return t?a-Math.floor(a):a}function se(r,e,t){const n=te(r,e,t);return n.ok?{node:n.node}:{unread:r}}class at{cells=[];rows=[];rich=[];outlined=!1;rest=[];xml;masters=new Map;strings;name;isRangeName;inData=!1;row=-1;nextRow=0;nextCol=0;cell;target;buffer="";skip=0;constructor(e,t,n){this.strings=e,this.name=t,this.isRangeName=n,this.xml=new ue(this),this.xml.capture=this.rest}open(e,t){if(!this.inData){e==="sheetData"&&(this.inData=!0,this.xml.capture=void 0);return}const n=this.cell;if(n){if(this.skip>0){this.skip+=1;return}switch(e){case"v":this.target="v",this.buffer="";return;case"f":n.f={...t,text:""},this.target="f",this.buffer="";return;case"is":n.inline={text:"",rich:!1};return;case"r":n.inline&&(n.inline.rich=!0);return;case"t":n.inline&&(this.target="t",this.buffer="");return;case"rPh":case"phoneticPr":case"extLst":this.skip=1;return;default:return}}e==="row"?this.openRow(t):e==="c"&&(this.cell={r:t.r,s:t.s,t:t.t,cm:t.cm,v:void 0,f:void 0,inline:void 0})}close(e){if(!this.inData)return;const t=this.cell;if(!t){e==="sheetData"&&(this.inData=!1,this.xml.capture=this.rest);return}if(this.skip>0){this.skip-=1;return}if(e===this.target){e==="v"?t.v=this.buffer:e==="f"&&t.f?t.f.text=this.buffer:t.inline&&(t.inline.text+=this.buffer),this.target=void 0;return}e==="c"&&(this.cell=void 0,this.readCell(t))}text(e){this.target!==void 0&&this.skip===0&&(this.buffer+=e)}openRow(e){const t=e.r,n=t===void 0?void 0:Number(t);if(n!==void 0&&Number.isInteger(n)&&n>K)throw new Error(`${this.name} has a row ${t??""}, and ${GRID_END}.`);const o=n!==void 0&&Number.isInteger(n)&&n>0?n-1:this.nextRow;this.row=o,this.nextRow=o+1,this.nextCol=0;const s={row:o},i=e.ht===void 0?void 0:Number(e.ht),c=f=>f==="1"||f==="true";i!==void 0&&Number.isFinite(i)&&c(e.customHeight)&&(s.height=Ue(i)),c(e.hidden)&&(s.hidden=!0);const a=e.s===void 0?void 0:Number(e.s);a!==void 0&&a!==0&&c(e.customFormat)&&(s.style=a);const l=Number(e.outlineLevel??0);l>0&&(s.level=Math.min(7,l),this.outlined=!0),Object.keys(s).length>1&&this.rows.push(s)}value(e,t){const n=e.t??"n";if(n==="inlineStr"){const s=e.inline;return s?{value:A(s.text),...s.rich?{rich:!0}:{}}:{value:e.v===void 0?"":A(e.v)}}const o=e.v;if(o===void 0)return{value:void 0};switch(n){case"s":{const s=this.strings[Number(o)];return s?{value:s.text,...s.rich?{rich:!0}:{}}:{value:""}}case"str":return{value:A(o)};case"b":return{value:o.trim()==="1"||o.trim()==="true"};case"e":return{value:Re(o.trim())??Le.VALUE};case"d":return{value:it(o.trim())??o};default:{if(o.trim()==="")return{value:void 0};const s=Number(o);if(Number.isNaN(s))throw new Error(`${t} says it holds a number and holds ${o}.`);return{value:s}}}}formula(e,t,n,o){const s=e.f;if(s===void 0)return;const i=s.t??"normal",c=s.text;if(i==="dataTable"){o.unread=`a data table's {=TABLE(${s.r1??""})}`;return}if(i==="array"){Object.assign(o,se(c,!0,this.isRangeName));const a=G(s.ref??"");a&&(o.array=a),e.cm!==void 0&&(o.dynamic=!0);return}if(i==="shared"){const a=s.si??"";if(c!==""){const f=se(c,!1,this.isRangeName),p=f.node?Ie(f.node,t,n):"";this.masters.set(a,{node:f.node,unread:f.unread,row:t,col:n,key:p}),Object.assign(o,f),f.node&&(o.key=p);return}const l=this.masters.get(a);if(!l){o.unread=`a shared formula of a group that has no first cell (${a})`;return}l.node?(o.node=Te(l.node,t-l.row,n-l.col),o.key=l.key):l.unread!==void 0&&(o.unread=l.unread);return}c!==""&&Object.assign(o,se(c,!1,this.isRangeName))}readCell(e){const t=e.r===void 0?void 0:We(e.r,this.name),n=t?.row??this.row,o=t?.col??this.nextCol;if(o>=q)throw new Error(`${this.name} has a cell past its last column, and ${GRID_END}.`);this.nextCol=o+1;const s=e.r??Y({row:n,col:o}),{value:i,rich:c}=this.value(e,s),a={row:n,col:o,value:i,style:e.s===void 0?0:Number(e.s)||0};c===!0&&(a.rich=!0,this.rich.push(s)),this.formula(e,n,o,a),this.cells.push(a)}}function dt(r,e,t){const n=[],o=p=>n.push(`${r}: ${p}`);t.length>0&&o(`${H(t.length,"cell")} of rich text, kept as plain text (${placesLine(t)})`);const s=x(d(e.hyperlinks)?.hyperlink).filter(p=>u(p,"tooltip")!==void 0);s.length>0&&o(`the tooltips of ${H(s.length,"link")} (${placesLine(s.map(p=>u(p,"ref")??""))})`),e.sortState!==void 0&&o("a sort");const i=d(e.sheetProtection);v(i,"sheet")===!0&&(u(i,"password")!==void 0||u(i,"hashValue")!==void 0)&&o("its protection's password: it is protected with none"),e.protectedRanges!==void 0&&o("protected ranges");const c=d(e.headerFooter);(c?.evenHeader!==void 0||c?.evenFooter!==void 0||c?.firstHeader!==void 0||c?.firstFooter!==void 0)&&o("its print header and footer of the first or even pages");const a=d(e.printOptions);a&&["gridLines","headings","horizontalCentered","verticalCentered"].some(p=>v(a,p)===!0)&&o("its print options (gridlines, headings, centring)"),(e.rowBreaks!==void 0||e.colBreaks!==void 0)&&o("its page breaks"),e.oleObjects!==void 0&&o("embedded objects"),e.controls!==void 0&&o("form controls"),e.dataConsolidate!==void 0&&o("a consolidation"),e.customSheetViews!==void 0&&o("custom views"),x(d(e.sheetViews)?.sheetView).some(p=>u(d(p.pane),"state")==="split")&&o("a split, not frozen, window");const f=JSON.stringify(e.extLst??"");return f.includes("sparklineGroups")&&o("sparklines"),f.includes("slicerList")&&o("slicers"),n}function ct(r,e){const t=[],n=(s,i,c)=>{const a=r.count(s);a>0&&t.push(H(a,i,c))};r.has("xl/vbaProject.bin")&&t.push("VBA macros"),n(/^xl\/pivotTables\/pivotTable\d*\.xml$/u,"pivot table"),n(/^xl\/chartsheets\/[^/]+\.xml$/u,"chart sheet"),n(/^xl\/dialogsheets\/[^/]+\.xml$/u,"dialog sheet"),n(/^xl\/macrosheets\/[^/]+\.xml$/u,"macro sheet");const o=r.names.filter(s=>s.startsWith("xl/media/")&&!e.has(s)).length;return o>0&&t.push(H(o,"image")),n(/^xl\/embeddings\//u,"embedded object"),n(/^xl\/slicers\/[^/]+\.xml$/u,"slicer part"),n(/^xl\/timelines\/[^/]+\.xml$/u,"timeline part"),n(/^xl\/ctrlProps\/[^/]+\.xml$/u,"form control"),n(/^xl\/activeX\/[^/]+\.xml$/u,"ActiveX control"),n(/^xl\/queryTables\/[^/]+\.xml$/u,"query table"),r.has("xl/connections.xml")&&t.push("data connections"),r.names.some(s=>s.startsWith("xl/richData/"))&&t.push("rich values (data types, pictures in cells)"),r.names.some(s=>/^customXml\/item\d+\.xml$/u.test(s)&&(r.text(s)??"").includes("DataMashup"))&&t.push("Power Query queries"),t}export function readHeaderFooter(r){const e={left:"",center:"",right:""};let t="center",n=new Set;for(let o=0;o<r.length;o++){const s=r[o],i=r[o+1];if(s==="&"&&(i==="L"||i==="C"||i==="R")){t=i==="L"?"left":i==="C"?"center":"right",n=new Set([...n,t]),o+=1;continue}if(s==="&"&&i==="&"){e[t]+="&&",o+=1;continue}e[t]+=s??""}return Object.fromEntries(Object.entries(e).filter(([o,s])=>s!==""||n.has(o)))}const ft=new Map(Object.entries(Ee).map(([r,e])=>[e,r]));function lt(r,e,t){const n={},o=d(r.pageSetup),s=u(o,"orientation");(s==="portrait"||s==="landscape")&&(n.orientation=s);const i=k(o,"paperSize");if(i!==void 0){const h=ft.get(i);h?n.paper=h:t.push(`${e}: its paper size, Excel's number ${String(i)}`)}v(d(d(r.sheetPr)?.pageSetUpPr),"fitToPage")===!0&&(n.fit={width:k(o,"fitToWidth")??1,height:k(o,"fitToHeight")??1});const c=d(r.pageMargins),a={};for(const h of Object.keys(de)){const b=k(c,h);b!==void 0&&b!==de[h]&&(a[h]=b)}Object.keys(a).length>0&&(n.margins=a);const l=d(r.headerFooter),f=E(l?.oddHeader),p=E(l?.oddFooter);return f!==""&&(n.header=readHeaderFooter(A(f))),p!==""&&(n.footer=readHeaderFooter(A(p))),n}function ut(r,e,t,n,o){const s=r.rels(e),i=new Map;for(const a of s.filter(l=>l.type==="comments")){const l=d(r.xml(a.target)?.comments),f=d(l?.authors)?.author,p=(Array.isArray(f)?f:f===void 0?[]:[f]).map(h=>A(E(h)));for(const h of x(d(l?.commentList)?.comment)){const b=u(h,"ref")??"",w=d(h.text),m=x(w?.r),$=A(m.length>0?m.map(O=>E(O.t)).join(""):E(w?.t)),S=p[k(h,"authorId")??-1];b!==""&&$!==""&&i.set(b,{ref:b,text:$,...S===void 0||S===""?{}:{author:S}})}}let c=0;for(const a of s.filter(l=>l.type==="threadedComment")){const l=d(r.xml(a.target)?.ThreadedComments),f=new Map;for(const p of x(l?.threadedComment)){const h=u(p,"ref")??"",b=A(E(p.text)),w=f.get(h)??{texts:[]};if(w.texts.length===0){const m=n.get(u(p,"personId")??"");m!==void 0&&(w.author=m)}w.texts.push(b),f.set(h,w)}for(const[p,h]of f)c+=1,i.set(p,{ref:p,text:h.texts.join(`
3
- `),...h.author===void 0?{}:{author:h.author}})}return c>0&&o.push(`${t}: ${H(c,"threaded comment")}, kept as notes, replies after the first line`),[...i.values()]}function ht(r,e,t,n,o,s,i,c,a,l){const f=new at(o,t,a);if(!r.stream(e,f.xml))throw new Error(`${e} is not in the file.`);const p=he(f.rest.join("")),h=d(p.worksheet);if(!h)throw new Error(`${e} is not a worksheet.`);const b=x(d(h.cols)?.col).map(y=>{const C=k(y,"width"),R=k(y,"style"),P=k(y,"outlineLevel")??0,L=(k(y,"min")??1)-1,ie=(k(y,"max")??1)-1;if(ie>=q)throw new Error(`${t} sets a column past its last, and ${GRID_END}.`);const ae=v(y,"customWidth"),Q=C===void 0?void 0:Ve(C);return{min:L,max:ie,...Q!==void 0&&(ae===!0||ae===void 0&&Q!==ke)?{width:Q}:{},...v(y,"hidden")===!0?{hidden:!0}:{},...R===void 0||R===0?{}:{style:R},...P>0?{level:Math.min(7,P)}:{}}}),w=x(d(h.mergeCells)?.mergeCell).flatMap(y=>{const C=G(u(y,"ref")??"");return C?[C]:[]}),m=x(d(h.sheetViews)?.sheetView)[0],$=d(m?.pane);let S;const O=u($,"state");if(O==="frozen"||O==="frozenSplit"){const y=Oe(u(m,"topLeftCell")??"A1")??{row:0,col:0};S={row:y.row+(k($,"ySplit")??0),col:y.col+(k($,"xSplit")??0)}}const T=r.rels(e),z=T.filter(y=>y.type==="table").flatMap(y=>{const C=Ye(r.xml(y.target));return C?[C]:[]}),D=F(d(d(h.sheetPr)?.tabColor),s),I=dt(t,h,f.rich),M=ot(h,i,s),B=st(h);for(const y of M.unread)I.push(`${t}: a conditional format, ${y}`);for(const y of B.unread)I.push(`${t}: a data validation, ${y}`);const V=d(h.autoFilter),Z=G(u(V,"ref")??""),j=V&&Z?{ref:Z,...be(V)}:void 0;j&&j.unread>0&&I.push(`${t}: ${H(j.unread,"filter")} by condition on ${u(V,"ref")??""}, its rows left as they were hidden`);const{charts:X,pictures:J}=mt(r,e,t,b,f.rows,I,l),U={},g=new Map(T.map(y=>[y.id,y]));for(const y of x(d(h.hyperlinks)?.hyperlink)){const C=u(y,"ref");if(C===void 0)continue;const R=u(y,"location"),P=u(y,"id"),L=P===void 0?void 0:g.get(P)?.target;L!==void 0?U[C]=R===void 0?L:`${L}#${R}`:R!==void 0&&(U[C]=`#${R}`)}const N=d(h.sheetProtection),_=lt(h,t,I);return{sheet:{name:t,state:n,cells:f.cells,merges:w,...S?{freeze:S}:{},...u(m,"showGridLines")==="0"?{gridlines:!1}:{},...D===void 0?{}:{tab:D},columns:b,rows:f.rows,tables:z,conditional:M.rules,validations:B.rules,scenarios:x(d(h.scenarios)?.scenario).map(y=>({name:u(y,"name")??"",cells:x(y.inputCells).map(C=>({at:u(C,"r")??"",value:u(C,"val")??""}))})),...j?{filter:j}:{},charts:X,links:U,notes:ut(r,e,t,c,I),pictures:J,...v(N,"sheet")===!0?{protect:!0}:{},...Object.keys(_).length>0?{print:_}:{}},lost:I}}const ke=64,pt=20;function mt(r,e,t,n,o,s,i){const c=h=>n.find(b=>h>=b.min&&h<=b.max)?.width??ke,a=new Map(o.map(h=>[h.row,h.height])),l=h=>a.get(h)??pt,f=[],p=[];for(const h of r.rels(e).filter(b=>b.type==="drawing")){const b=je(r.xml(h.target),c,l),w=r.rels(h.target);for(const m of b.anchors){const $=w.find(T=>T.id===m.id),S=Pe($?r.xml($.target):void 0),O=Y(m.at);if(typeof S=="string"){s.push(`${t}: the chart at ${O}, as ${S}`);continue}f.push({...S,at:O,...m.x===void 0?{}:{x:m.x},...m.y===void 0?{}:{y:m.y},...m.width===ce.width?{}:{width:m.width},...m.height===ce.height?{}:{height:m.height}})}for(const m of b.pictures){const $=w.find(T=>T.id===m.id),S=$&&!$.external?r.bytes($.target):void 0;if(!$||!S){s.push(`${t}: the picture at ${Y(m.at)}, whose image is not in the file`);continue}i.add($.target);const O=$.target.slice($.target.lastIndexOf(".")+1).toLowerCase();p.push({row:m.at.row,col:m.at.col,...m.x===void 0?{}:{x:m.x},...m.y===void 0?{}:{y:m.y},width:m.width,height:m.height,...m.name===void 0?{}:{name:m.name},...m.descr===void 0?{}:{descr:m.descr},bytes:S,type:O})}b.others>0&&s.push(`${t}: ${H(b.others,"shape")} of its drawing`)}return{charts:f,pictures:p}}function gt(r,e,t){for(const n of r){if(n.sheet===void 0)continue;const o=e[n.sheet];if(!o)continue;const s=n.text.split(",").map(i=>i.slice(i.lastIndexOf("!")+1).replaceAll("$",""));if(n.name==="_xlnm.Print_Area"){const[i]=s;s.length>1&&t.push(`${o.name}: its print area's ranges after the first`),i!==void 0&&G(i)&&(o.print={...o.print,area:i})}else if(n.name==="_xlnm.Print_Titles")for(const i of s)/^\d+:\d+$/u.test(i)?o.print={...o.print,title_rows:i}:/^[A-Za-z]+:[A-Za-z]+$/u.test(i)&&(o.print={...o.print,title_cols:i})}}export function readXlsx(r,e){let t;try{t=new Be(r,e)}catch(g){throw g instanceof ve?g:new Error("It is not a zip file, as an .xlsx file is.")}const n=t.rels(""),o=n.find(g=>g.type==="officeDocument")?.target??"xl/workbook.xml";if(o.endsWith(".bin"))throw new Error("It is a binary workbook (.xlsb): save it as .xlsx.");const s=t.xml(o),i=d(s?.workbook);if(!i)throw new Error("It has no workbook part.");const c=t.rels(o),a=g=>c.find(N=>N.type===g)?.target,l=(()=>{const g=a("theme");return g===void 0?void 0:t.text(g)})(),f=l===void 0?Fe:De(l),p=a("styles"),h=p===void 0?void 0:t.xml(p),b=Qe(h,f),w=le(f,d(h?.styleSheet)),m=qe(t,a("sharedStrings")),$=[];for(const g of b.lost)$.push(g);const S=d(i.workbookPr),O=d(i.calcPr);v(O,"iterate")===!0&&$.push("iterative calculation");const T=d(i.workbookProtection);(v(T,"lockStructure")===!0||v(T,"lockWindows")===!0)&&$.push("the workbook's protection"),i.fileSharing!==void 0&&$.push("its write protection");const z=new Map,D=a("person");if(D!==void 0)for(const g of x(d(t.xml(D)?.personList)?.person))z.set(u(g,"id")??"",A(u(g,"displayName")??""));const I=x(d(i.definedNames)?.definedName).map(g=>{const N=k(g,"localSheetId");return{name:u(g,"name")??"",text:A(E(g)),...N===void 0?{}:{sheet:N},...v(g,"hidden")===!0?{hidden:!0}:{}}}),M=[],B=new Set,V=new Map(c.map(g=>[g.id,g])),Z=x(d(i.sheets)?.sheet);for(const[g,N]of Z.entries()){const _=V.get(u(N,"id")??""),y=A(u(N,"name")??"");if(_?.type!=="worksheet"){_?.type!=="chartsheet"&&_?.type!=="dialogsheet"&&$.push(`${y}: a sheet of a kind this cannot read`);continue}const C=new Map;for(const L of I)(L.sheet===void 0||L.sheet===g)&&(L.sheet!==void 0||!C.has(L.name.toLowerCase()))&&C.set(L.name.toLowerCase(),ze(L.text));const R=u(N,"state"),P=ht(t,_.target,y,R==="hidden"||R==="veryHidden"?R:"visible",m,w,b.dxfs,z,L=>C.get(L.toLowerCase())===!0,B);M[g]=P.sheet,$.push(...P.lost)}gt(I,M,$);const j=n.find(g=>g.type==="core-properties")?.target,X=j===void 0?void 0:E(d(t.xml(j)?.coreProperties)?.title).trim(),J=M.filter(g=>g!==void 0),U=new Map;return M.forEach((g,N)=>{g!==void 0&&U.set(N,J.indexOf(g))}),{sheets:J,names:I.flatMap(g=>{if(g.sheet===void 0)return[g];const N=U.get(g.sheet);return N===void 0?[]:[{...g,sheet:N}]}),looks:b.looks,dxfs:b.dxfs,date1904:v(S,"date1904")===!0,font:b.font,...X===void 0||X===""?{}:{title:X},lost:[...ct(t,B),...$]}}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_MARGINS as pe,SHEET_NOTE_AUTHOR as K,SHEET_PAPERS as we}from"@allyhub-next/formats";import{MAX_COLUMNS as Q,MAX_ROWS as ee,cellName as _,columnIndex as xe,columnLetter as D,rangeName as M,readAddress as te,readArea as ge}from"../address.js";import{parseFormula as $e}from"../formula/parse.js";import{sheetPrefix as X}from"../formula/print.js";import{walk as ye}from"../formula/walk.js";import{fileCells as be,isPicture as ve,pictureHeight as Se,pictureSize as se}from"../files.js";import{scenariosByCell as ke}from"../scenario.js";import{CellError as P,readTyped as Ae}from"../values.js";import{FormulaCell as Ce}from"../workbook.js";import{chartPart as Ee,drawingPart as Te}from"./charts.js";import{fileFormula as N,needsArray as B}from"./formula.js";import{GRID_END as W}from"./read.js";import{Styles as Me}from"./styles.js";import{THEME_XML as Re}from"./theme.js";import{HEAD as S,NS as k,el as o,xstring as x}from"./xml.js";import{ZipOut as _e}from"./zip.js";const A={comments:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",sheet:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",worksheet:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",styles:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",strings:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",theme:"application/vnd.openxmlformats-officedocument.theme+xml",table:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",metadata:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",drawing:"application/vnd.openxmlformats-officedocument.drawing+xml",chart:"application/vnd.openxmlformats-officedocument.drawingml.chart+xml",core:"application/vnd.openxmlformats-package.core-properties+xml",app:"application/vnd.openxmlformats-officedocument.extended-properties+xml"},v=`${k.rel}/`,ne="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main",oe="http://schemas.microsoft.com/office/excel/2006/main",re={conditional:"{78C0D931-6437-407d-A8EE-F0AAD7539E65}",validations:"{CCE6A557-97BC-4b89-ADB6-D9C93CAAB3DF}"},je=191029;export const DEFAULT_TABLE_STYLE="TableStyleMedium2",LISTS_SHEET="AllyHub lists";const Le=64,Oe=7,Fe=a=>Math.min(255,Math.floor(a/Oe*256)/256),Ie=a=>Math.min(409.5,a*3/4),q=32767,De=255,Pe=2e5,Ne=o("metadata",{xmlns:k.main,"xmlns:xda":"http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray"},o("metadataTypes",{count:1},o("metadataType",{name:"XLDAPR",minSupportedVersion:12e4,copy:1,pasteAll:1,pasteValues:1,merge:1,splitFirst:1,rowColShift:1,clearFormats:1,clearComments:1,assign:1,coerce:1,cellMeta:1})),o("futureMetadata",{name:"XLDAPR",count:1},o("bk",{},o("extLst",{},o("ext",{uri:"{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}"},o("xda:dynamicArrayProperties",{fDynamic:1,fCollapsed:0}))))),o("cellMetadata",{count:1},o("bk",{},o("rc",{t:1,v:0}))));class Ve{index=new Map;count=0;of(t){this.count+=1;let s=this.index.get(t);return s===void 0&&(s=this.index.size,this.index.set(t,s)),s}write(t){t.write(`${S}<sst xmlns="${k.main}" count="${String(this.count)}" uniqueCount="${String(this.index.size)}">`);for(const s of this.index.keys()){const e=/^\s|\s$|\n/u.test(s);t.write(`<si><t${e?' xml:space="preserve"':""}>${x(s)}</t></si>`)}t.write("</sst>"),t.end()}}function ze(a){for(const t in a)if(Object.hasOwn(a,t))return!1;return!0}const He=a=>o("x",a).slice(2,-2),Ue="Base case";function Xe(a){const t=new Map;for(const n of a.scenarios)for(const r of n.cells)t.set(_(r),r);const s=(n,r)=>o("inputCells",{r:_(n),val:r===null||r instanceof P?"":typeof r=="boolean"?r?"1":"0":String(r)}),e=(n,r)=>o("scenario",{name:n,locked:!0,count:r.length,user:"AllyHub"},r.join(""));return o("scenarios",{current:0,show:0,sqref:[...t.keys()].join(" ")},e(Ue,[...t.values()].map(n=>s(n,n.base))),...a.scenarios.map(n=>e(n.name,n.cells.map(r=>s(r,r.value)))))}function Be(a,t,s,e){const n=[];let r=0;for(const{row:l,col:h,paths:c,column:i}of be(a,t)){let d=0;const f=Se(i);for(const m of c){const u=ve(m)?s?.(m):void 0,$=u&&se(u);if(!u||!$){r+=1;continue}const T=Math.round($.width/$.height*f);n.push({row:l,col:h,x:d,width:T,height:f,name:m.split("/").pop()??m,path:m,file:`.${$.type==="jpeg"?"jpg":$.type}`,bytes:u}),d+=T+4}}for(const l of a.spec.pictures??[]){const h=te(l.at),c=s?.(l.file),i=c&&se(c);if(!h||!c||!i)continue;const d=i.width/i.height,f=l.width??(l.height===void 0?i.width:l.height*d);n.push({row:h.row,col:h.col,x:l.x??0,y:l.y??0,width:Math.round(f),height:Math.round(l.height??f/d),name:l.file.split("/").pop()??l.file,path:l.file,file:`.${i.type==="jpeg"?"jpg":i.type}`,bytes:c})}return r>0&&e.push(`${a.name}: ${String(r)} file${r===1?"":"s"} in a cell, which stay${r===1?"s":""} a name`),n}class We{name;columns=[];known=new Map;constructor(t){let s=LISTS_SHEET;for(let e=2;t.sheet(s);e++)s=`${LISTS_SHEET} (${String(e)})`;this.name=s}place(t){const s=JSON.stringify(t);let e=this.known.get(s);e===void 0&&(e=this.columns.length,this.columns.push(t),this.known.set(s,e));const n=D(e);return`${X(this.name)}$${n}$1:$${n}$${String(Math.max(1,t.length))}`}xml(t){const s=[],e=Math.max(0,...this.columns.map(n=>n.length));for(let n=0;n<e;n++){let r=`<row r="${String(n+1)}">`;this.columns.forEach((l,h)=>{const c=l[n];c!==void 0&&(r+=`<c r="${_({row:n,col:h})}" t="s"><v>${String(t.of(c))}</v></c>`)}),s.push(`${r}</row>`)}return`${S}<worksheet xmlns="${k.main}" xmlns:r="${k.rel}"><dimension ref="${M({top:0,left:0,bottom:Math.max(0,e-1),right:Math.max(0,this.columns.length-1)})}"/><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData>${s.join("")}</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>`}}class qe{rows=new Int32Array(1024);cols=new Int32Array(1024);size=0;add(t,s){if(this.size===this.rows.length){const e=new Int32Array(this.size*2);e.set(this.rows),this.rows=e;const n=new Int32Array(this.size*2);n.set(this.cols),this.cols=n}this.rows[this.size]=t,this.cols[this.size]=s,this.size+=1}byRow(){const{size:t}=this;if(t===0)return{start:new Uint32Array(1),cols:new Int32Array(0),top:0,used:void 0};let s=1/0,e=-1,n=1/0,r=-1;for(let i=0;i<t;i++){const d=this.rows[i]??0,f=this.cols[i]??0;d<s&&(s=d),d>e&&(e=d),f<n&&(n=f),f>r&&(r=f)}const l=new Uint32Array(e-s+2);for(let i=0;i<t;i++){const d=(this.rows[i]??0)-s+1;l[d]=(l[d]??0)+1}for(let i=1;i<l.length;i++)l[i]=(l[i]??0)+(l[i-1]??0);const h=l.slice(0,-1),c=new Int32Array(t);for(let i=0;i<t;i++){const d=(this.rows[i]??0)-s,f=h[d]??0;c[f]=this.cols[i]??0,h[d]=f+1}return{start:l,cols:c,top:s,used:{top:s,bottom:e,left:n,right:r}}}}function Ge(a,t){if(!a)return!1;let s=!1;const e=t.toLowerCase();return ye(a,n=>{(n.kind==="ref"||n.kind==="name")&&n.sheet!==void 0&&n.sheet.toLowerCase()!==e&&(s=!0)}),s}const Ye=(a,t)=>`{00000000-0000-4000-8000-${(a*65536+t).toString(16).toUpperCase().padStart(12,"0")}}`;class Ze{arrays=!1;sheet;calc;styles;strings;wb;cached;left;lists;index;isTable;isRangeName;hiddenRows;tall;scenarios;drawn;newerRules=[];newerValidations=[];shapes=new Map;groups=new Map;constructor(t,s,e,n,r,l,h,c,i=[],d){this.sheet=t,this.calc=s,this.wb=s.wb,this.styles=e,this.strings=n,this.cached=r,this.left=l,this.lists=h,this.index=c,this.isTable=m=>this.wb.table(m)!==void 0,this.isRangeName=m=>{const u=this.wb.name(m,t)?.formula?.node;return this.isTable(m)||u!==void 0&&B({kind:"unary",op:"-",arg:u})},this.hiddenRows=s.filtered(t),this.scenarios=d,this.drawn=t.charts.length>0||i.length>0;const f=new Map;for(const m of i)m.y===void 0&&f.set(m.row,Math.max(f.get(m.row)??0,m.height));this.tall=f}grid(){const{sheet:t}=this;if(t.lastRow>=ee)throw new Error(`${t.name} reaches row ${(t.lastRow+1).toLocaleString("en-US")}, and ${W}: an Excel file cannot hold it.`);if(t.columnsUsed>Q)throw new Error(`${t.name} reaches past column ${D(Q-1)}, and ${W}: an Excel file cannot hold it.`);for(const s of Object.keys(t.spec.rows??{}))if(Number(s)>ee)throw new Error(`${t.name} sets row ${s}, and ${W}: an Excel file cannot hold it.`)}gather(){const{sheet:t}=this,s=new qe;for(let e=0;e<t.columnsUsed;e++){const[n,r]=t.span(e,0,Number.MAX_SAFE_INTEGER);for(let l=n;l<=r;l++)(t.at(l,e)!==void 0||t.spillAt(l,e))&&s.add(l,e)}for(const{area:e}of t.styledAreas()){const n=(e.bottom-e.top+1)*(e.right-e.left+1);if(n>Pe){this.left.push(`${t.name}!${M(e)}: its look on the cells that hold something, ${String(n)} cells being too many to write empty`);continue}for(let r=e.top;r<=e.bottom;r++)for(let l=e.left;l<=e.right;l++)s.add(r,l)}for(const e of t.keys.keys())s.add(Math.floor(e/16384),e%16384);return s.byRow()}styleOf(t,s){const e=this.sheet.lookAt(t,s);return ze(e)?void 0:this.styles.xf(e)}held(t,s){return s.length<=q?s:(this.left.push(`${this.sheet.name}!${t} past Excel's ${String(q)} characters, of its ${String(s.length)}`),s.slice(0,q))}value(t,s,e){return e===null?`<c r="${t}"${C(s)}/>`:typeof e=="number"?`<c r="${t}"${C(s)}><v>${String(e)}</v></c>`:typeof e=="boolean"?`<c r="${t}"${C(s)} t="b"><v>${e?"1":"0"}</v></c>`:e instanceof P?ce(e)?`<c r="${t}"${C(s)} t="e"><v>${e.code}</v></c>`:`<c r="${t}"${C(s)} t="s"><v>${String(this.strings.of(e.code))}</v></c>`:`<c r="${t}"${C(s)} t="s"><v>${String(this.strings.of(this.held(t,e)))}</v></c>`}table(t){return this.sheet.tableAt(t.row,t.col)?.name}formula(t,s,e){const n=this.calc.value(e.sheet,e.row,e.col),{shared:r}=e,{node:l}=r;if(!l)return`<c r="${t}"${C(s)} t="e"><v>#NAME?</v></c>`;let h=this.shapes.get(r);h===void 0&&(h=B(l,this.isRangeName),this.shapes.set(r,h));const c=e.array!==void 0||e.blocked!==void 0||h;let i=c?void 0:this.groups.get(r);i?.written===!1&&(e.row!==i.ref.top||e.col!==i.ref.left)&&(i=void 0);let d,f="";if(i?.written===!0)d=`<f t="shared" si="${String(i.si)}"/>`;else{const m=N(e.moved,{table:this.table(e),isTable:this.isTable,array:c});d=i?`<f t="shared" ref="${M(i.ref)}" si="${String(i.si)}">${x(m)}</f>`:`<f>${x(m)}</f>`,i&&(i.written=!0),c&&(d=this.arrayFormula(e,m))}return c&&(this.arrays=!0,f=' cm="1"'),this.cached?n===null||typeof n=="number"?`<c r="${t}"${C(s)}${f}>${d}<v>${String(n??0)}</v></c>`:typeof n=="boolean"?`<c r="${t}"${C(s)} t="b"${f}>${d}<v>${n?"1":"0"}</v></c>`:n instanceof P?ce(n)?`<c r="${t}"${C(s)} t="e"${f}>${d}<v>${n.code}</v></c>`:`<c r="${t}"${C(s)}${f}>${d}<v>0</v></c>`:`<c r="${t}"${C(s)} t="str"${f}>${d}<v>${x(this.held(t,n))}</v></c>`:`<c r="${t}"${C(s)}${f}>${d}</c>`}arrayFormula(t,s){const e=t.spill??{top:t.row,left:t.col,bottom:t.row,right:t.col};return`<f t="array" ref="${M(e)}">${x(s)}</f>`}shareFormulas(){const t=new Map;for(const e of this.sheet.formulas){const n=t.get(e.shared);if(!n)t.set(e.shared,{area:{top:e.row,bottom:e.row,left:e.col,right:e.col},first:e,n:1});else{const{area:r}=n;e.row<r.top&&(r.top=e.row),e.row>r.bottom&&(r.bottom=e.row),e.col<r.left&&(r.left=e.col),e.col>r.right&&(r.right=e.col),(e.row<n.first.row||e.row===n.first.row&&e.col<n.first.col)&&(n.first=e),n.n+=1}}let s=0;for(const[e,{area:n,first:r,n:l}]of t)l>1&&r.row===n.top&&r.col===n.left&&(this.groups.set(e,{si:s,ref:n,written:!1}),s+=1)}cell(t,s){const e=_({row:t,col:s}),n=this.styleOf(t,s),r=this.sheet.at(t,s);return r instanceof Ce?this.formula(e,n,r):r===void 0&&this.cached&&this.sheet.spillAt(t,s)?this.value(e,n,this.calc.value(this.sheet,t,s)):this.value(e,n,r??null)}columns(){const{sheet:t}=this,{spec:s}=t,e=new Map,n=new Map;for(const c of t.tables)for(const i of c.columns)i.spec?.width!==void 0&&n.set(c.at.col+i.index,i.spec.width);const r=new Set(n.keys()),l=new Map;for(const[c,i]of Object.entries(s.columns??{})){const d=xe(c);d!==void 0&&(l.set(d,i),r.add(d))}for(const c of r){const i=l.get(c),d=i?.width??n.get(c),f=de(i);e.set(c,o("col",{min:c+1,max:c+1,width:Fe(d??Le),style:f===void 0?void 0:this.styles.xf(f),hidden:i?.hidden===!0?!0:void 0,customWidth:d===void 0?void 0:!0,outlineLevel:i?.level}))}const h=[...e.keys()].sort((c,i)=>c-i).map(c=>e.get(c)??"");return h.length===0?"":`<cols>${h.join("")}</cols>`}rowAttrs(t){const s=this.sheet.spec.rows?.[String(t+1)],e=de(s),n=s?.height??this.tall.get(t);return He({r:t+1,s:e===void 0?void 0:this.styles.xf(e),customFormat:e===void 0?void 0:!0,ht:n===void 0?void 0:Ie(n),customHeight:n===void 0?void 0:!0,hidden:s?.hidden===!0||this.hiddenRows.has(t)?!0:void 0,outlineLevel:s?.level})}rows(t,s){const{sheet:e}=this,n=new Set(this.hiddenRows);for(const d of Object.keys(e.spec.rows??{}))n.add(Number(d)-1);const{start:r,cols:l,top:h}=s;let c=s.used?h:1/0,i=s.used?s.used.bottom:-1;for(const d of n)d<c&&(c=d),d>i&&(i=d);for(let d=Math.max(0,c);d<=i;d++){const f=d-h,m=f>=0&&f<r.length-1?r[f]??0:0,u=f>=0&&f<r.length-1?r[f+1]??0:0;if(m===u&&!n.has(d))continue;if(m===u){t.write(`<row${this.rowAttrs(d)}/>`);continue}const $=l.subarray(m,u).sort();let T=`<row${this.rowAttrs(d)}>`,y=-1;for(const b of $)b!==y&&(y=b,T+=this.cell(d,b));t.write(`${T}</row>`)}}view(t){const{freeze:s}=this.sheet;let e="";if(s&&(s.row>0||s.col>0)){const n=s.row>0&&s.col>0?"bottomRight":s.row>0?"bottomLeft":"topRight";e=o("pane",{xSplit:s.col>0?s.col:void 0,ySplit:s.row>0?s.row:void 0,topLeftCell:_(s),activePane:n,state:"frozen"})}return o("sheetViews",{},o("sheetView",{showGridLines:this.sheet.spec.gridlines===!1?!1:void 0,tabSelected:t?!0:void 0,workbookViewId:0},e))}write(t,s,e){const{sheet:n}=this;this.grid();const r=this.gather();this.shareFormulas();const l=n.tables.map((y,b)=>o("tablePart",{"r:id":`rId${String(b+1)}`})),{print:h}=n.spec,c=h?.fit,i=Object.keys(n.spec.notes??{}).length>0;t.write(`${S}<worksheet xmlns="${k.main}" xmlns:r="${k.rel}">`+(n.spec.tab===void 0&&c===void 0?"":o("sheetPr",{},n.spec.tab===void 0?"":o("tabColor",{rgb:`FF${n.spec.tab.slice(1).toUpperCase()}`}),c===void 0?"":o("pageSetUpPr",{fitToPage:!0})))+o("dimension",{ref:r.used?M(r.used):"A1"})+this.view(s)+o("sheetFormatPr",{defaultRowHeight:15,outlineLevelRow:ie(n.spec.rows),outlineLevelCol:ie(n.spec.columns)})+this.columns()+"<sheetData>"),this.rows(t,r);const d=l.length+1+(this.drawn?1:0)+(i?2:0);let f=0;const m=Object.entries(n.spec.links??{}).map(([y,b])=>b.startsWith("#")?o("hyperlink",{ref:y,location:b.slice(1)}):o("hyperlink",{ref:y,"r:id":`rId${String(d+f++)}`})),u=n.merges.map(y=>o("mergeCell",{ref:M(y)})),$=n.conditions.map((y,b)=>this.condition(y,b+1)).join(""),T=this.validations();return t.write("</sheetData>"+(n.spec.protect===!0?o("sheetProtection",{sheet:!0,objects:!0,scenarios:!0}):"")+(this.scenarios?Xe(this.scenarios):"")+this.sheetFilter()+(u.length>0?o("mergeCells",{count:u.length},u.join("")):"")+$+T+(m.length>0?o("hyperlinks",{},m.join("")):"")+o("pageMargins",{...pe,...h?.margins})+(h?.orientation!==void 0||h?.paper!==void 0||c!==void 0?o("pageSetup",{paperSize:h?.paper===void 0?void 0:we[h.paper],fitToWidth:c?.width,fitToHeight:c?.height,orientation:h?.orientation}):"")+(h?.header||h?.footer?o("headerFooter",{},h.header?o("oddHeader",{},x(ae(h.header))):"",h.footer?o("oddFooter",{},x(ae(h.footer))):""):"")+(this.drawn?o("drawing",{"r:id":`rId${String(l.length+1)}`}):"")+(i?o("legacyDrawing",{"r:id":`rId${String(l.length+(this.drawn?2:1))}`}):"")+(l.length>0?o("tableParts",{count:l.length},l.join("")):"")+this.extensions()+"</worksheet>"),t.end(),n.tables.map((y,b)=>this.tableXml(y,e+b))}extensions(){const t=[];return this.newerRules.length>0&&t.push(o("ext",{uri:re.conditional,"xmlns:x14":ne},o("x14:conditionalFormattings",{},this.newerRules.join("")))),this.newerValidations.length>0&&t.push(o("ext",{uri:re.validations,"xmlns:x14":ne},o("x14:dataValidations",{count:this.newerValidations.length,"xmlns:xm":oe},this.newerValidations.join("")))),t.length===0?"":o("extLst",{},t.join(""))}bound(t){if(t===void 0)return"";if(typeof t=="number")return String(t);if(!t.startsWith("=")){const e=Ae(t);return typeof e.value=="number"&&e.formula===void 0?String(e.value):`"${t.replaceAll('"','""')}"`}const s=$e(t);return s.ok?N(s.node,{isTable:this.isTable,array:!0}):t.slice(1)}cfvo(t,s){const e=t.value===void 0?void 0:typeof t.value=="number"?String(t.value):this.bound(t.value);return s?o("x14:cfvo",{type:t.at},e===void 0?"":o("xm:f",{},x(e))):o("cfvo",{type:t.at,val:e})}crosses(t){return t.some(s=>Ge(s?.node,this.sheet.name))}condition(t,s){const{spec:e}=t,n=e.range,r=e.type!=="dataBar"&&this.crosses(t.formulas),l=(f,m,...u)=>{if(!r){const $=Object.keys(m).length===0?void 0:this.styles.dxf(m);return o("conditionalFormatting",{sqref:n},o("cfRule",{...f,dxfId:$,priority:s,stopIfTrue:e.stop===!0?!0:void 0},...u))}return this.newerRules.push(o("x14:conditionalFormatting",{"xmlns:xm":oe},o("x14:cfRule",{...f,priority:s,stopIfTrue:e.stop===!0?!0:void 0,id:Ye(this.index,s)},...u.map($=>$.replace(/^<formula>(.*)<\/formula>$/su,"<xm:f>$1</xm:f>")),Object.keys(m).length===0?"":this.styles.dxfXml(m,"x14:dxf")),o("xm:sqref",{},n))),""},h=et(e),c=t.areas[0],i=c?_({row:c.top,col:c.left}):"A1",d=f=>o("formula",{},x(f));switch(e.type){case"cellIs":return l({type:"cellIs",operator:e.operator},h,...e.formula.map(f=>d(this.bound(f))));case"containsText":{const f=e.operator??"contains",m=`"${e.text.replaceAll('"','""')}"`,u=f==="contains"?`NOT(ISERROR(SEARCH(${m},${i})))`:f==="notContains"?`ISERROR(SEARCH(${m},${i}))`:f==="beginsWith"?`LEFT(${i},LEN(${m}))=${m}`:`RIGHT(${i},LEN(${m}))=${m}`;return l({type:f==="contains"?"containsText":f==="notContains"?"notContainsText":f,operator:f==="contains"?"containsText":f,text:e.text},h,d(u))}case"duplicateValues":case"uniqueValues":return l({type:e.type},h);case"top10":return l({type:"top10",percent:e.percent===!0?!0:void 0,bottom:e.bottom===!0?!0:void 0,rank:e.rank},h);case"aboveAverage":return l({type:"aboveAverage",aboveAverage:e.below===!0?!1:void 0,equalAverage:e.equal===!0?!0:void 0},h);case"expression":return l({type:"expression"},h,d(this.bound(e.formula.startsWith("=")?e.formula:`=${e.formula}`)));case"dataBar":return l({type:"dataBar"},{},o("dataBar",{showValue:e.show===!1?!1:void 0},this.cfvo(e.min??{at:"min"},!1),this.cfvo(e.max??{at:"max"},!1),o("color",{rgb:le(e.color)})));case"colorScale":{const f=r?"x14:":"";return l({type:"colorScale"},{},o(`${f}colorScale`,{},...e.stops.map(m=>this.cfvo(m,r)),...e.stops.map(m=>o(`${f}color`,{rgb:le(m.color)}))))}case"iconSet":{const f=Number.parseInt(e.icons,10),m=e.stops??Array.from({length:f},(u,$)=>({at:"percent",value:Math.round($*100/f)}));return l({type:"iconSet"},{},o(r?"x14:iconSet":"iconSet",{iconSet:e.icons,showValue:e.show===!1?!1:void 0,reverse:e.reverse===!0?!0:void 0},...m.map(u=>this.cfvo(u,r))))}}}validation(t){const{spec:s}=t;let e="",n=this.crosses(t.formulas);if(s.values){const i=s.values.join(",");i.length>De||s.values.some(d=>d.includes(",")||d.includes('"'))?(e=this.lists.place(s.values),n=!0):e=`"${i}"`}else e=this.bound(s.formula?.[0]);const r=this.bound(s.formula?.[1]),{error:l,prompt:h}=s;s.multiple===!0&&this.left.push(`${this.sheet.name}!${s.range}: several choices in a cell: its text stays, and Excel's list offers one at a time`);const c={type:s.type,errorStyle:l?.style===void 0||l.style==="stop"?void 0:l.style,operator:s.operator===void 0||s.operator==="between"?void 0:s.operator,allowBlank:s.blank===!1?void 0:!0,showDropDown:s.dropdown===!1?!0:void 0,showInputMessage:h?.show===!1?void 0:!0,showErrorMessage:l?.show===!1||s.multiple===!0?void 0:!0,errorTitle:l?.title,error:l?.message,promptTitle:h?.title,prompt:h?.message};return n?(this.newerValidations.push(o("x14:dataValidation",c,e===""?"":o("x14:formula1",{},o("xm:f",{},x(e))),r===""?"":o("x14:formula2",{},o("xm:f",{},x(r))),o("xm:sqref",{},s.range))),""):o("dataValidation",{...c,sqref:s.range},e===""?"":o("formula1",{},x(e)),r===""?"":o("formula2",{},x(r)))}validations(){const t=this.sheet.validations.map(s=>this.validation(s)).filter(s=>s!=="");return t.length===0?"":o("dataValidations",{count:t.length},t.join(""))}filterColumns(t){return[...t.columns.entries()].sort(([s],[e])=>s-e).map(([s,e])=>tt(s-t.area.left,e))}sheetFilter(){const t=this.sheet.filters.find(s=>!s.table);return t?o("autoFilter",{ref:M(t.area)},...this.filterColumns(t)):""}columnFormula(t,s){if(!s?.node)return"";const e=B(s.node,this.isRangeName),n=N(s.node,{table:t.name,isTable:this.isTable,array:e});return o("calculatedColumnFormula",{array:e?!0:void 0},x(n))}tableXml(t,s){const e=t.area,n=M({...e,bottom:Math.max(e.bottom,e.top+1)}),r=t.spec.style??DEFAULT_TABLE_STYLE,l=this.sheet.filters.find(h=>h.table===t);return S+o("table",{xmlns:k.main,id:s,name:t.name,displayName:t.name,ref:n,totalsRowShown:0},l?o("autoFilter",{ref:n},...this.filterColumns(l)):"",o("tableColumns",{count:t.columns.length},t.columns.map((h,c)=>o("tableColumn",{id:c+1,name:h.name},this.columnFormula(t,h.formula))).join("")),r==="none"?o("tableStyleInfo",{showFirstColumn:0,showLastColumn:0,showRowStripes:1,showColumnStripes:0}):o("tableStyleInfo",{name:r,showFirstColumn:0,showLastColumn:0,showRowStripes:1,showColumnStripes:0}))}}const ie=a=>{let t;for(const s of Object.values(a??{}))s.level!==void 0&&(t=Math.max(t??0,s.level));return t},ae=a=>[a.left===void 0?"":`&L${a.left}`,a.center===void 0?"":`&C${a.center}`,a.right===void 0?"":`&R${a.right}`].join(""),Je=a=>typeof a=="string"?{text:a,author:K}:{text:a.text,author:a.author??K};function Ke(a){const t=a.map(([e,n])=>({ref:e,...Je(n)})),s=[...new Set(t.map(e=>e.author))];return S+o("comments",{xmlns:k.main},o("authors",{},s.map(e=>o("author",{},x(e))).join("")),o("commentList",{},t.map(e=>o("comment",{ref:e.ref,authorId:s.indexOf(e.author)},o("text",{},o("r",{},o("t",/^\s|\s$|\n/u.test(e.text)?{"xml:space":"preserve"}:{},x(e.text)))))).join("")))}function Qe(a){return`<xml xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout><v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>${a.flatMap(([s],e)=>{const n=te(s);return n?[`<v:shape id="_x0000_s${String(1025+e)}" type="#_x0000_t202" style="position:absolute;margin-left:80pt;margin-top:5pt;width:120pt;height:60pt;z-index:${String(e+1)};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto"><v:fill color2="#ffffe1"/><v:shadow on="t" color="black" obscured="t"/><v:path o:connecttype="none"/><v:textbox style="mso-direction-alt:auto"><div style="text-align:left"></div></v:textbox><x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${String(n.col+1)}, 15, ${String(n.row)}, 2, ${String(n.col+3)}, 15, ${String(n.row+4)}, 4</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${String(n.row)}</x:Row><x:Column>${String(n.col)}</x:Column></x:ClientData></v:shape>`]:[]}).join("")}</xml>`}const le=a=>`FF${a.slice(1).toUpperCase()}`;function et(a){if(a.type==="dataBar"||a.type==="colorScale"||a.type==="iconSet")return{};const t={};for(const s of["bold","italic","underline","strike","color","fill","border"])a[s]!==void 0&&(t[s]=a[s]);return t}function tt(a,t){return o("filterColumn",{colId:a},o("filters",{blank:t.blanks===!0?!0:void 0},(t.values??[]).map(s=>o("filter",{val:s})).join("")))}const C=a=>a===void 0?"":` s="${String(a)}"`,ce=a=>a.code!=="#CYCLE!",st=new Set(["width","height","hidden"]);function de(a){if(!a)return;const t=Object.fromEntries(Object.entries(a).filter(([s])=>!st.has(s)));return Object.keys(t).length===0?void 0:t}const V=a=>S+o("Relationships",{xmlns:k.pkg},a.map(([t,s,e],n)=>o("Relationship",{Id:`rId${String(n+1)}`,Type:t,Target:s,TargetMode:e})).join(""));function nt(a,t){const s=t.formula?.node;if(s)return N(s,{isTable:n=>a.table(n)!==void 0,array:!0});const{value:e}=t;return e==null?'""':typeof e=="string"?`"${e.replaceAll('"','""')}"`:typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof P?e.code:String(e)}const ot=(a,t)=>a.length===t.length&&a.every((s,e)=>s===t[e]),he=a=>`$${D(a.left)}$${String(a.top+1)}:$${D(a.right)}$${String(a.bottom+1)}`;function rt(a){const t=[],s=(e,n)=>o("definedName",{name:e.name,localSheetId:n,hidden:e.hidden===!0?!0:void 0},x(nt(a,e)));for(const e of a.names.values())t.push(s(e));return a.sheets.forEach((e,n)=>{for(const d of e.names.values())t.push(s(d,n));const r=e.filters.find(d=>!d.table);r&&t.push(o("definedName",{name:"_xlnm._FilterDatabase",localSheetId:n,hidden:!0},x(`${X(e.name)}${he(r.area)}`)));const l=X(e.name),h=e.spec.print,c=h?.area===void 0?void 0:ge(h.area);c&&t.push(o("definedName",{name:"_xlnm.Print_Area",localSheetId:n},x(`${l}${he(c)}`)));const i=[h?.title_cols?.toUpperCase().replace(/([A-Z]+):([A-Z]+)/u,"$$$1:$$$2"),h?.title_rows?.replace(/(\d+):(\d+)/u,"$$$1:$$$2")].flatMap(d=>d===void 0?[]:[`${l}${d}`]);i.length>0&&t.push(o("definedName",{name:"_xlnm.Print_Titles",localSheetId:n},x(i.join(","))))}),t}export function writeXlsx(a,t={}){const s=a.wb,e=[];s.checks.length>0&&e.push(`${String(s.checks.length)} check${s.checks.length===1?"":"s"}: a file has no such thing`);const n=ke(a);e.push(...n.left);const r=new Me,l=new Ve,h=new We(s),c=new _e,i=[["/xl/workbook.xml",A.sheet]],d=Math.max(0,s.sheets.findIndex(p=>p.spec.hidden!==!0));let f=1,m=!1;const u=new Map;let $=0,T=0,y=0;for(const[p,w]of s.sheets.entries()){const H=String(p+1),O=Be(w,a,t.file,e),F=w.charts.filter(({spec:g})=>[g.categories,...g.series.flatMap(E=>[E.values,E.x])].some(E=>E?.endsWith("#"))).length;F>0&&e.push(`${w.name}: ${String(F)} chart${F===1?"":"s"} on a spill: ${F===1?"it reads":"they read"} the cells the spill covers now, and will not grow with it`);const Z=new Ze(w,a,r,l,t.cached!==!1,e,h,p,O,n.sheets.find(g=>g.sheet===w)),me=Z.write(c.part(`xl/worksheets/sheet${H}.xml`),p===d,f);m||=Z.arrays,i.push([`/xl/worksheets/sheet${H}.xml`,A.worksheet]);const R=[];for(const g of me){const E=`table${String(f)}.xml`;f+=1,c.add(`xl/tables/${E}`,g),i.push([`/xl/tables/${E}`,A.table]),R.push([`${v}table`,`../tables/${E}`])}if(w.charts.length>0||O.length>0){$+=1;const g=`drawing${String($)}.xml`;c.add(`xl/drawings/${g}`,Te(w.charts,O)),i.push([`/xl/drawings/${g}`,A.drawing]),R.push([`${v}drawing`,`../drawings/${g}`]);const E=w.charts.map(L=>{T+=1;const I=`chart${String(T)}.xml`;return c.add(`xl/charts/${I}`,Ee(a,w,L)),i.push([`/xl/charts/${I}`,A.chart]),[`${v}chart`,`../charts/${I}`]});for(const L of O){const J=[...u].find(([,ue])=>ot(ue,L.bytes))?.[0]??`image${String(u.size+1)}${L.file}`;u.set(J,L.bytes),E.push([`${v}image`,`../media/${J}`])}c.add(`xl/drawings/_rels/${g}.rels`,V(E))}const U=Object.entries(w.spec.notes??{});if(U.length>0){y+=1;const g=String(y);c.add(`xl/comments${g}.xml`,Ke(U)),i.push([`/xl/comments${g}.xml`,A.comments]),c.add(`xl/drawings/vmlDrawing${g}.vml`,Qe(U)),R.push([`${v}vmlDrawing`,`../drawings/vmlDrawing${g}.vml`]),R.push([`${v}comments`,`../comments${g}.xml`])}for(const g of Object.values(w.spec.links??{}))g.startsWith("#")||R.push([`${v}hyperlink`,g,"External"]);R.length>0&&c.add(`xl/worksheets/_rels/sheet${H}.xml.rels`,V(R))}const b=s.sheets.length,z=h.columns.length>0;if(z){const p=`xl/worksheets/sheet${String(b+1)}.xml`;c.add(p,h.xml(l)),i.push([`/${p}`,A.worksheet])}const j=[...s.sheets,...z?[void 0]:[]].map((p,w)=>[`${v}worksheet`,`worksheets/sheet${String(w+1)}.xml`]);j.push([`${v}theme`,"theme/theme1.xml"]),j.push([`${v}styles`,"styles.xml"]),j.push([`${v}sharedStrings`,"sharedStrings.xml"]),m&&(j.push([`${v}sheetMetadata`,"metadata.xml"]),i.push(["/xl/metadata.xml",A.metadata]));const G=rt(s),Y=s.sheets.map((p,w)=>o("sheet",{name:p.name,sheetId:w+1,state:p.spec.hidden===!0?"hidden":void 0,"r:id":`rId${String(w+1)}`}));z&&Y.push(o("sheet",{name:h.name,sheetId:b+1,state:"veryHidden","r:id":`rId${String(b+1)}`})),c.add("xl/workbook.xml",S+o("workbook",{xmlns:k.main,"xmlns:r":k.rel},o("workbookPr",{}),o("bookViews",{},o("workbookView",{activeTab:d===0?void 0:d})),o("sheets",{},Y.join("")),G.length>0?o("definedNames",{},G.join("")):"",o("calcPr",{calcId:je,fullCalcOnLoad:!0}))),c.add("xl/_rels/workbook.xml.rels",V(j)),c.add("xl/styles.xml",S+r.xml()),l.write(c.part("xl/sharedStrings.xml")),c.add("xl/theme/theme1.xml",S+Re),m&&c.add("xl/metadata.xml",S+Ne),c.add("docProps/core.xml",S+o("cp:coreProperties",{"xmlns:cp":"http://schemas.openxmlformats.org/package/2006/metadata/core-properties","xmlns:dc":"http://purl.org/dc/elements/1.1/"},s.title===void 0?"":o("dc:title",{},x(s.title)))),c.add("docProps/app.xml",S+o("Properties",{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"},o("Application",{},"AllyHub"))),c.add("_rels/.rels",V([[`${v}officeDocument`,"xl/workbook.xml"],["http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"],[`${v}extended-properties`,"docProps/app.xml"]])),i.push(["/xl/styles.xml",A.styles],["/xl/sharedStrings.xml",A.strings],["/xl/theme/theme1.xml",A.theme],["/docProps/core.xml",A.core],["/docProps/app.xml",A.app]);const fe=[...u].sort(([p],[w])=>p.localeCompare(w));for(const[p,w]of fe)c.add(`xl/media/${p}`,w);return c.add("[Content_Types].xml",S+o("Types",{xmlns:k.types},o("Default",{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}),o("Default",{Extension:"xml",ContentType:"application/xml"}),y>0?o("Default",{Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"}):"",[...new Set([...u.keys()].map(p=>p.split(".").pop()??""))].sort().map(p=>o("Default",{Extension:p,ContentType:`image/${p==="jpg"?"jpeg":p}`})).join(""),i.map(([p,w])=>o("Override",{PartName:p,ContentType:w})).join(""))),{bytes:c.finish(),left:e}}
@@ -1,2 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{Inflate as C,Zip as D,ZipDeflate as M}from"fflate";import{withinZip as U,ZipLimitError as E}from"@allyhub-next/formats";const O=new Date(1980,0,1),_=1<<20;export class ZipOut{chunks=[];zip;encoder=new TextEncoder;open=!1;constructor(){this.zip=new D((t,e)=>{if(t)throw t;this.chunks.push(e)})}entry(t){if(this.open)throw new Error(`${t} is written while a part is open.`);const e=new M(t,{level:6});return e.mtime=O,this.zip.add(e),e}part(t){const e=this.entry(t);this.open=!0;let n=[],s=0;const i=o=>{const r=n.length===1?n[0]??"":n.join("");n=[],s=0,e.push(this.encoder.encode(r),o)};return{write:o=>{n.push(o),s+=o.length,s>=_&&i(!1)},end:()=>{i(!0),this.open=!1}}}add(t,e){this.entry(t).push(typeof e=="string"?this.encoder.encode(e):e,!0)}finish(){this.zip.end();let t=0;for(const s of this.chunks)t+=s.length;const e=new Uint8Array(t);let n=0;for(const s of this.chunks)e.set(s,n),n+=s.length;return e}}const g=65536,h=(f,t)=>(f[t]??0)|(f[t+1]??0)<<8,a=(f,t)=>(h(f,t)|h(f,t+2)<<16)>>>0,d=(f,t)=>a(f,t)+a(f,t+4)*4294967296,A=f=>{let t="";for(const e of f)t+=String.fromCharCode(e);return t};export class ZipIn{bytes;entries=new Map;lower=new Map;constructor(t,e){this.bytes=t;const n=U(e);for(const s of this.directory())n({name:s.name,originalSize:s.size}),this.entries.set(s.name,s),this.lower.set(s.name.toLowerCase(),s)}get names(){return[...this.entries.keys()]}find(t){return this.entries.get(t)??this.lower.get(t.toLowerCase())}has(t){return this.find(t)!==void 0}*directory(){const t=this.bytes;let e=-1;for(let r=t.length-22;r>=Math.max(0,t.length-22-65535);r--)if(a(t,r)===101010256){e=r;break}if(e<0)throw new Error("It has no zip directory.");let n=h(t,e+10),s=a(t,e+16);if((n===65535||s===4294967295)&&a(t,e-20)===117853008){const r=d(t,e-12);if(a(t,r)!==101075792)throw new Error("Its zip64 end is lost.");n=d(t,r+32),s=d(t,r+48)}const i=new TextDecoder;let o=s;for(let r=0;r<n;r++){if(a(t,o)!==33639248)throw new Error("Its zip directory is damaged.");const I=h(t,o+8),Z=h(t,o+10);let w=a(t,o+20),m=a(t,o+24);const y=h(t,o+28),L=h(t,o+30),T=h(t,o+32);let c=a(t,o+42);const x=t.subarray(o+46,o+46+y),p=I&2048?i.decode(x):A(x);let l=o+46+y;const z=l+L;for(;l+4<=z;){const $=h(t,l),k=h(t,l+2);if($===1){let u=l+4;m===4294967295&&(m=d(t,u),u+=8),w===4294967295&&(w=d(t,u),u+=8),c===4294967295&&(c=d(t,u))}l+=4+k}if(o=z+T,a(t,c)!==67324752)throw new Error(`Its part ${p} is lost.`);const b=c+30+h(t,c+26)+h(t,c+28);if(b+w>t.length)throw new Error(`Its part ${p} is cut short.`);p.endsWith("/")||(yield{name:p,method:Z,start:b,compressed:w,size:m})}}stream(t,e){const n=this.find(t);if(!n)return!1;const s=this.bytes.subarray(n.start,n.start+n.compressed);if(n.method===0){if(s.length>n.size)throw new E(`${n.name} holds more than it says.`);return e(s),!0}if(n.method!==8)throw new Error(`${n.name} is compressed in a way a zip reader here does not know.`);let i=0;const o=new C(r=>{if(i+=r.length,i>n.size)throw new E(`${n.name} unzips to more than it says.`);e(r)});for(let r=0;r<s.length;r+=g)o.push(s.subarray(r,r+g),r+g>=s.length);return s.length===0&&o.push(s,!0),!0}streamText(t,e){const n=new TextDecoder;if(!this.stream(t,o=>{const r=n.decode(o,{stream:!0});r!==""&&e(r)}))return!1;const i=n.decode();return i!==""&&e(i),!0}bytesOf(t){const e=this.find(t);if(!e)return;const n=new Uint8Array(e.size);let s=0;return this.stream(t,i=>{n.set(i,s),s+=i.length}),s===n.length?n:n.subarray(0,s)}text(t){const e=this.bytesOf(t);return e===void 0?void 0:new TextDecoder().decode(e)}}
@@ -1,4 +0,0 @@
1
- /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{themeColor as O,themeColorOf as T}from"@allyhub-next/chart";import{presetAdjustments as z}from"@allyhub-next/ooxml/geometry";import{MSO_CONNECTOR as G,MSO_SHAPE as M,MSO_SHAPE_TYPE as I,PP_PLACEHOLDER as j}from"./enums.js";import{Chart as B}from"./chart-api.js";import{AUTOSHAPE_STYLE as p,SHADOW_DEFAULTS as v,CONNECTOR_GEOMETRIES as D,CONNECTOR_STYLE as P,FOOTER_IDX as H,isConnectorGeometry as R,OFFICE_TEXT_STYLES as U,placeholderLevels as X,TEXT_INSETS as w,TEXTBOX_FRAME as Y}from"./office.js";import{masterPlaceholder as A}from"./placeholders.js";import{strict as o}from"./strict.js";import{EMU_PER_PT as F,SLIDE_SIZES as k,length as d,lengthOr as y}from"./units.js";class J extends Error{constructor(t){super(`${t} (allyhub slides capabilities lists what the API holds).`),this.name="Unsupported"}}const m=i=>{throw new J(i)},Z=/^#?[0-9a-f]{6}$/iu,C=i=>{if(!Z.test(i))throw new Error(`rgb ${i} is not RRGGBB.`);return`#${i.replace("#","").toUpperCase()}`};export const RGBColor=Object.assign(function(t,e,s){for(const h of[t,e,s])if(!Number.isInteger(h)||h<0||h>255)throw new Error(`RGBColor(${String(t)}, ${String(e)}, ${String(s)}): each is 0 to 255.`);const r=`#${[t,e,s].map(h=>h.toString(16).padStart(2,"0")).join("").toUpperCase()}`;return new.target===void 0?r:new String(r)},{from_string:i=>C(i)});export class ColorFormat{read;write;constructor(t,e){return this.read=t,this.write=e,o(this,"ColorFormat")}get theme_color(){const t=this.read();return t===void 0?void 0:T(t)}set theme_color(t){this.write(t===void 0?void 0:O(t,this.brightness))}get brightness(){const t=this.read();return typeof t=="object"&&"brightness"in t?t.brightness:0}set brightness(t){if(!(t>=-1&&t<=1))throw new RangeError(`brightness ${String(t)} is not a number from -1.0 to 1.0.`);const e=this.read();if(e===void 0)throw new TypeError("There is no colour to set the brightness of: set theme_color first.");const s=T(e);if(s!==void 0)this.write(O(s,t));else if(t!==0)throw new TypeError("Only a theme colour has a brightness here, so an RGB colour does not: set theme_color first, or rgb to the colour it makes.")}get rgb(){const t=this.read();return typeof t=="object"&&"rgb"in t?t.rgb:void 0}set rgb(t){this.write(t===void 0?void 0:{rgb:C(t)})}}export class Font{def;constructor(t){return this.def=t,o(this,"Font")}_set(t,e){e===void 0?Reflect.deleteProperty(this.def,t):this.def[t]=e}get strike(){return this.def.strike}set strike(t){this._set("strike",t)}get baseline(){return this.def.baseline}set baseline(t){this._set("baseline",t)}get highlight(){return this.def.highlight}set highlight(t){this._set("highlight",t)}get name(){return this.def.name}set name(t){this._set("name",t)}get size(){return y(this.def.size)}set size(t){this._set("size",t)}get bold(){return this.def.bold}set bold(t){this._set("bold",t)}get italic(){return this.def.italic}set italic(t){this._set("italic",t)}get underline(){return this.def.underline}set underline(t){this._set("underline",t)}get spacing(){return y(this.def.spacing)}set spacing(t){this._set("spacing",t)}get color(){return new ColorFormat(()=>this.def.color,t=>{this._set("color",t)})}}export class Hyperlink{def;constructor(t){return this.def=t,o(this,"_Hyperlink")}get address(){return this.def.font?.link}set address(t){this.def.font??={},t===void 0?Reflect.deleteProperty(this.def.font,"link"):this.def.font.link=t}}export class Run{def;constructor(t){return this.def=t,o(this,"_Run")}get text(){return this.def.text}set text(t){this.def.text=t}get font(){return this.def.font??={},new Font(this.def.font)}get hyperlink(){return new Hyperlink(this.def)}}const q=i=>{if(!Number.isFinite(i)||i<=0)throw new Error(`line_spacing ${String(i)} is not over 0.`);return Number.isInteger(i)&&i>=F?{fixed:i}:{lines:i}},K=i=>i===void 0?void 0:"lines"in i?i.lines:d(i.fixed),N=i=>i.split(/\n|\v/u).flatMap((t,e)=>[...e>0?[{text:"\v"}]:[],...t===""?[]:[{text:t}]]);class L{_set(t,e){e===void 0?Reflect.deleteProperty(this.fmt,t):this.fmt[t]=e}get alignment(){return this.fmt.alignment}set alignment(t){this._set("alignment",t)}get line_spacing(){return K(this.fmt.line_spacing)}set line_spacing(t){this._set("line_spacing",t===void 0?void 0:q(t))}get space_before(){return y(this.fmt.space_before)}set space_before(t){this._set("space_before",t)}get space_after(){return y(this.fmt.space_after)}set space_after(t){this._set("space_after",t)}get font(){return this.fmt.font??={},new Font(this.fmt.font)}}export class Paragraph extends L{fmt;constructor(t){return super(),this.fmt=t,o(this,"_Paragraph")}get text(){return this.fmt.runs.map(t=>t.text).join("")}set text(t){this.fmt.runs=N(t)}get runs(){return this.fmt.runs.filter(t=>t.text!=="\v").map(t=>new Run(t))}add_run(){const t={text:""};return this.fmt.runs.push(t),new Run(t)}add_line_break(){this.fmt.runs.push({text:"\v"})}clear(){return this.fmt.runs=[],this}get level(){return this.fmt.level}set level(t){if(!Number.isInteger(t)||t<0||t>8)throw new Error(`level ${String(t)} is not 0 to 8.`);this.fmt.level=t}}export class ListLevel extends L{fmt;constructor(t){return super(),this.fmt=t,o(this,"ListLevel")}get numbered(){return this.fmt.numbered}set numbered(t){this._set("numbered",t)}get bullet(){return this.fmt.bullet}set bullet(t){this._set("bullet",t)}get bullet_font(){return this.fmt.bullet_font}set bullet_font(t){this._set("bullet_font",t)}get margin_left(){return y(this.fmt.margin_left)}set margin_left(t){this._set("margin_left",t)}get indent(){return y(this.fmt.indent)}set indent(t){this._set("indent",t)}}const S=i=>Object.freeze(i.map(t=>new ListLevel(t))),W=()=>Array.from({length:9},()=>({})),E=()=>({paragraphs:[],levels:W()});export class TextFrame{def;constructor(t){return this.def=t,o(this,"TextFrame")}_set(t,e){e===void 0?Reflect.deleteProperty(this.def,t):this.def[t]=e}get text(){return this.def.paragraphs.map(t=>t.runs.map(e=>e.text).join("")).join(`
3
- `)}set text(t){this.def.paragraphs=t.split(`
4
- `).map(e=>({runs:N(e),level:0}))}get paragraphs(){return this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0}),this.def.paragraphs.map(t=>new Paragraph(t))}add_paragraph(){this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0});const t={runs:[],level:0};return this.def.paragraphs.push(t),new Paragraph(t)}clear(){const t=this.def.paragraphs[0];this.def.paragraphs=t?[{...t,runs:[]}]:[]}fit_text(t,e=18,s,r){this.def.auto_size="text",this.def.word_wrap=!0;for(const n of this.def.paragraphs)for(const h of n.runs)h.font={...h.font,size:Math.trunc(e*F),...t===void 0?{}:{name:t},...s===void 0?{}:{bold:s},...r===void 0?{}:{italic:r}}}get list_style(){return S(this.def.levels)}get vertical_anchor(){return this.def.vertical_anchor}set vertical_anchor(t){this._set("vertical_anchor",t)}get auto_size(){return this.def.auto_size}set auto_size(t){this._set("auto_size",t)}get word_wrap(){return this.def.word_wrap}set word_wrap(t){this._set("word_wrap",t)}get margin_left(){return d(this.def.margin_left??w.left)}set margin_left(t){this.def.margin_left=t}get margin_top(){return d(this.def.margin_top??w.top)}set margin_top(t){this.def.margin_top=t}get margin_right(){return d(this.def.margin_right??w.right)}set margin_right(t){this.def.margin_right=t}get margin_bottom(){return d(this.def.margin_bottom??w.bottom)}set margin_bottom(t){this.def.margin_bottom=t}}export class FillFormat{read;write;start;shape;constructor(t,e,s="lt1",r){return this.read=t,this.write=e,this.start=s,this.shape=r,o(this,"FillFormat")}solid(){const t=this.read();this.shape&&Reflect.deleteProperty(this.shape,"gradient"),t==null&&this.write(this.start)}background(){this.shape&&Reflect.deleteProperty(this.shape,"gradient"),this.write(null)}_shape(t){if(!this.shape)throw new TypeError(`Only a shape's fill has ${t}.`);return this.shape}gradient(){this._shape("a gradient").gradient??={angle:90,stops:[{at:0,color:"accent1"},{at:1,color:"accent2"}]}}get gradient_angle(){return this._gradient().angle}set gradient_angle(t){this._gradient().angle=t}get gradient_stops(){return this._gradient().stops}set gradient_stops(t){if(t.length<2)throw new Error("A gradient has two stops at least.");this._gradient().stops=t.map(e=>({...e}))}_gradient(){const{gradient:t}=this._shape("a gradient");if(!t)throw new TypeError("This fill is no gradient: call fill.gradient() first.");return t}get transparency(){return this._shape("a transparency").fill_transparency??0}set transparency(t){if(!(t>=0&&t<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(t)}.`);this._shape("a transparency").fill_transparency=t}get type(){if(this.shape?.gradient)return"gradient";const t=this.read();return t===void 0?void 0:t===null?"background":"solid"}get fore_color(){const t=this.read();if(t==null)throw new TypeError("This fill is not solid, so it has no fore_color: call fill.solid() first.");return new ColorFormat(()=>this.read()??void 0,e=>{this.write(e??this.start)})}}export class ShadowFormat{def;constructor(t){return this.def=t,o(this,"ShadowFormat")}_shadow(){return this.def.shadow??={...v},this.def.shadow}get inherit(){return this.def.shadow===void 0}set inherit(t){t?Reflect.deleteProperty(this.def,"shadow"):this._shadow()}get blur_radius(){return d(this._shadow().blur)}set blur_radius(t){this._shadow().blur=t}get distance(){return d(this._shadow().distance)}set distance(t){this._shadow().distance=t}get angle(){return this._shadow().angle}set angle(t){this._shadow().angle=t}get transparency(){return this._shadow().transparency}set transparency(t){this._shadow().transparency=t}get color(){const t=this._shadow();return new ColorFormat(()=>t.color,e=>{t.color=e??v.color})}}export class LineFormat{def;constructor(t){return this.def=t,o(this,"LineFormat")}get color(){return new ColorFormat(()=>this.def.line??void 0,t=>{this.def.line=t??null})}get fill(){return new FillFormat(()=>this.def.line,t=>{this.def.line=t},"dk1")}get width(){return d(this.def.line_width??0)}set width(t){this.def.line_width=t}get dash_style(){return this.def.line_dash??null}set dash_style(t){t===null?delete this.def.line_dash:this.def.line_dash=t}get begin_arrow(){return this.def.line_begin??"none"}set begin_arrow(t){this.def.line_begin=t}get end_arrow(){return this.def.line_end??"none"}set end_arrow(t){this.def.line_end=t}}export class Background{holder;constructor(t){return this.holder=t,o(this,"_Background")}get fill(){return new FillFormat(()=>this.holder.background,t=>{this.holder.background=t??"lt1"})}}export const adjustmentDefaults=i=>z(i).map(t=>t.value/1e5);export class Adjustments{def;constructor(t){return this.def=t,o(this,"Adjustments",{index:e=>this._values()[e],setIndex:(e,s)=>{this._set(e,Number(s))}})}_values(){return this.def.adjustments??adjustmentDefaults(this.def.geometry??"rect")}get length(){return this._values().length}_set(t,e){const s=this._values();if(t<0||t>=s.length)throw new RangeError(`adjustments[${String(t)}]: ${this.def.geometry??"this shape"} has ${String(s.length)}.`);if(!Number.isFinite(e))throw new Error(`adjustments[${String(t)}] = ${String(e)} is not a number.`);s[t]=e,this.def.adjustments=s}}const Q={left:0,top:0,width:0,height:0};export class Shape{def;inherit;constructor(t,e=()=>{}){return this.def=t,this.inherit=e,o(this,"Shape")}get _def(){return this.def}_frame(){return this.def.frame??this.inherit()??Q}_own(){return this.def.frame??={...this._frame()},this.def.frame}get name(){return this.def.name}set name(t){this.def.name=t}get shape_type(){return this.def.path?"freeform":R(this.def.geometry)?"line":this.def.kind}get is_placeholder(){return this.def.kind==="placeholder"}get has_table(){return this.def.table!==void 0}get has_chart(){return this.def.chart!==void 0}get chart(){if(!this.def.chart)throw new Error(`${this.def.name} is not a chart.`);return new B(this.def.chart)}get table(){if(!this.def.table)throw new Error(`${this.def.name} is not a table.`);return new Table(this.def.table)}get placeholder_format(){if(!this.def.placeholder)throw new Error(`${this.def.name} is not a placeholder.`);return o({...this.def.placeholder},"_PlaceholderFormat")}get left(){return d(this._frame().left)}set left(t){this._own().left=t}get top(){return d(this._frame().top)}set top(t){this._own().top=t}get width(){return d(this._frame().width)}set width(t){this._own().width=t}get height(){return d(this._frame().height)}set height(t){this._own().height=t}get rotation(){return this.def.rotation??0}set rotation(t){if(!Number.isFinite(t))throw new Error(`${this.def.name}: rotation is a number of degrees.`);const e=(Math.trunc(t*6e4)%216e5+216e5)%216e5/6e4;e===0?Reflect.deleteProperty(this.def,"rotation"):this.def.rotation=e}get has_text_frame(){return this.def.text!==void 0}get text_frame(){if(!this.def.text)throw new Error(`${this.def.name} (a ${this.shape_type}) has no text frame: has_text_frame is false.`);return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t},"lt1",this.def)}get line(){return new LineFormat(this.def)}get shadow(){return new ShadowFormat(this.def)}get adjustments(){return new Adjustments(this.def)}}const V=i=>typeof i=="number"&&Number.isFinite(i),g=(i,t,e,s,{line:r=!1}={})=>{for(const[n,h]of Object.entries({left:i,top:t,width:e,height:s}))if(!V(h))throw new Error(`${n} ${String(h)} is not a length (Emu, Inches, Pt, Cm, Mm).`);if(r?e<0||s<0:e<=0||s<=0)throw new Error("A shape's width and height are over 0.");return{left:Math.trunc(i),top:Math.trunc(t),width:Math.trunc(e),height:Math.trunc(s)}},tt=new Set(Object.values(M));export class FreeformBuilder{steps;sx;sy;make;constructor(t,e,s){return this.steps=[{op:"move",x:t[0],y:t[1]}],[this.sx,this.sy]=typeof e=="number"?[e,e]:e,this.make=s,o(this,"FreeformBuilder")}add_line_segments(t,e=!0){for(const[s,r]of t)this.steps.push({op:"line",x:s,y:r});return e&&this.steps.push({op:"close"}),this}add_curve_segment(t,e,s,r,n,h){return this.steps.push({op:"curve",x1:t,y1:e,x2:s,y2:r,x:n,y:h}),this}move_to(t,e){return this.steps.push({op:"move",x:t,y:e}),this}convert_to_shape(t=0,e=0){this.steps.length<2&&m("convert_to_shape(): a freeform needs a segment.");const s=this.steps.flatMap(a=>a.op==="close"?[]:a.op==="curve"?[[a.x1,a.y1],[a.x2,a.y2],[a.x,a.y]]:[[a.x,a.y]]),r=s.map(a=>a[0]),n=s.map(a=>a[1]),h=Math.min(...r),l=Math.min(...n),f=Math.max(...r)-h,u=Math.max(...n)-l,c=(a,_)=>({x:a-h,y:_-l});return this.make({w:f,h:u,steps:this.steps.map(a=>{if(a.op==="close")return a;if(a.op!=="curve")return{op:a.op,...c(a.x,a.y)};const _=c(a.x1,a.y1),x=c(a.x2,a.y2);return{op:"curve",x1:_.x,y1:_.y,x2:x.x,y2:x.y,...c(a.x,a.y)}})},g(Math.round(h*this.sx)+t,Math.round(l*this.sy)+e,Math.round(f*this.sx),Math.round(u*this.sy)))}}export class GroupShape{list;_name;make;constructor(t,e,s){return this.list=t,this._name=e,this.make=s,o(this,"GroupShape")}members(){return this.list.filter(t=>t.group===this._name)}box(){const t=this.members().flatMap(r=>r.frame?[r.frame]:[]),e=Math.min(...t.map(r=>r.left)),s=Math.min(...t.map(r=>r.top));return{left:t.length>0?e:0,top:t.length>0?s:0,right:Math.max(0,...t.map(r=>r.left+r.width)),bottom:Math.max(0,...t.map(r=>r.top+r.height))}}get shapes(){return this.make(this._name)}get shape_type(){return I.GROUP}get name(){return this._name}set name(t){for(const e of this.members())e.group=t;this._name=t}get left(){return d(this.box().left)}set left(t){const e=t-this.box().left;for(const s of this.members())s.frame&&(s.frame.left+=e)}get top(){return d(this.box().top)}set top(t){const e=t-this.box().top;for(const s of this.members())s.frame&&(s.frame.top+=e)}get width(){const t=this.box();return d(t.right-t.left)}get height(){const t=this.box();return d(t.bottom-t.top)}}export class Cell{def;table;row;col;constructor(t,e,s,r){return this.def=t,this.table=e,this.row=s,this.col=r,o(this,"_Cell")}get text_frame(){return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t})}get borders(){return this.def.borders??{}}set borders(t){this.def.borders=t}get margin_left(){return d(this.def.text.margin_left??w.left)}set margin_left(t){this.def.text.margin_left=t}get margin_right(){return d(this.def.text.margin_right??w.right)}set margin_right(t){this.def.text.margin_right=t}get margin_top(){return d(this.def.text.margin_top??w.top)}set margin_top(t){this.def.text.margin_top=t}get margin_bottom(){return d(this.def.text.margin_bottom??w.bottom)}set margin_bottom(t){this.def.text.margin_bottom=t}get vertical_anchor(){return this.def.text.vertical_anchor}set vertical_anchor(t){t===void 0?delete this.def.text.vertical_anchor:this.def.text.vertical_anchor=t}get is_merge_origin(){return(this.def.span_width??1)>1||(this.def.span_height??1)>1}get is_spanned(){return this.def.spanned===!0}get span_width(){return this.def.span_width??1}get span_height(){return this.def.span_height??1}merge(t){const e=[this.row,t.row].sort((f,u)=>f-u),s=[this.col,t.col].sort((f,u)=>f-u),[r=0,n=0]=e,[h=0,l=0]=s;for(let f=r;f<=n;f++)for(let u=h;u<=l;u++){const c=this.table.rows[f]?.cells[u];c&&(f===r&&u===h?(l>h&&(c.span_width=l-h+1),n>r&&(c.span_height=n-r+1)):c.spanned=!0)}}split(){const t=this.span_width,e=this.span_height;delete this.def.span_width,delete this.def.span_height;for(let s=this.row;s<this.row+e;s++)for(let r=this.col;r<this.col+t;r++){const n=this.table.rows[s]?.cells[r];n&&delete n.spanned}}}export class Column{def;at;constructor(t,e){return this.def=t,this.at=e,o(this,"_Column")}get width(){return d(this.def.columns[this.at]??0)}set width(t){this.def.columns[this.at]=t}}export class Row{def;at;constructor(t,e){return this.def=t,this.at=e,o(this,"_Row")}get row(){const t=this.def.rows[this.at];if(!t)throw new Error(`The table has no row ${String(this.at)}.`);return t}get height(){return d(this.row.height)}set height(t){this.row.height=t}}export class Table{def;constructor(t){return this.def=t,o(this,"Table")}cell(t,e){const s=this.def.rows[t]?.cells[e];if(!s)throw new Error(`cell(): the table has ${String(this.def.rows.length)} rows and ${String(this.def.columns.length)} columns.`);return new Cell(s,this.def,t,e)}*iter_cells(){for(let t=0;t<this.def.rows.length;t++)for(let e=0;e<this.def.columns.length;e++)yield this.cell(t,e)}get columns(){return this.def.columns.map((t,e)=>new Column(this.def,e))}get rows(){return this.def.rows.map((t,e)=>new Row(this.def,e))}flag(t){return this.def[t]===!0}get first_row(){return this.flag("first_row")}set first_row(t){this.def.first_row=t}get first_col(){return this.flag("first_col")}set first_col(t){this.def.first_col=t}get last_row(){return this.flag("last_row")}set last_row(t){this.def.last_row=t}get last_col(){return this.flag("last_col")}set last_col(t){this.def.last_col=t}get horz_banding(){return this.flag("horz_banding")}set horz_banding(t){this.def.horz_banding=t}get vert_banding(){return this.flag("vert_banding")}set vert_banding(t){this.def.vert_banding=t}}function et(i,t,e=[]){const s=new Set([...i,...e].map(n=>n.name));let r=1;for(;s.has(`${t}-${String(r)}`);)r++;return`${t}-${String(r)}`}export class ShapeCollection{list;base;components;inherit;group;under;constructor(t,e,s,r=()=>{},n=()=>[],h){return this.list=t,this.base=e,this.components=s,this.inherit=r,this.under=n,this.group=h,o(this,"SlideShapes",{index:l=>this._at(l)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}_at(t){const e=this.list[t];return e?this._wrap(e):void 0}*[Symbol.iterator](){for(const t of this.list)yield this._wrap(t)}get length(){return this.list.length}get(t){const e=this.list.find(s=>s.name===t);return e?this._wrap(e):void 0}get title(){const t=this.list.find(e=>e.placeholder?.type==="title"||e.placeholder?.type==="ctrTitle");return t?this._wrap(t):void 0}get placeholders(){return new Placeholders(this.list,this.inherit)}_add(t,e){const s={name:et(this.list,t,this.under()),...e,...this.group===void 0?{}:{group:this.group}};return this.list.push(s),this._wrap(s)}add_textbox(t,e,s,r){return this._add("textbox",{kind:"textbox",frame:g(t,e,s,r),text:{...E(),...Y}})}add_picture(t,e,s,r,n){return(r===void 0||n===void 0)&&m("add_picture() takes a width and a height here: a picture's own size is not read while a deck's code runs"),this._add("picture",{kind:"picture",frame:g(e,s,r??0,n??0),media:{path:t,base:this.base}})}add_movie(t,e,s,r,n,h={}){return this._add("movie",{kind:"movie",frame:g(e,s,r,n),media:{path:t,base:this.base,...h.poster_frame_time===void 0?{}:{poster:h.poster_frame_time}}})}add_shape(t,e,s,r,n){tt.has(t)||m(`add_shape(): ${t} is not one of MSO_SHAPE's ${Object.keys(M).join(", ")}`);const h=E();return h.vertical_anchor=p.vertical_anchor,h.paragraphs=[{runs:[],level:0,alignment:p.alignment}],this._add("shape",{kind:"autoshape",frame:g(e,s,r,n),geometry:t,fill:p.fill,line:p.line,line_width:p.line_width,text:h})}add_table(t,e,s,r,n,h){(t<1||e<1)&&m("add_table(): a table has at least a row and a column.");const l=Math.floor(n/e),f=Math.floor(h/t);return this._add("table",{kind:"table",frame:g(s,r,n,h),table:{columns:Array.from({length:e},()=>l),rows:Array.from({length:t},()=>({height:f,cells:Array.from({length:e},()=>({text:E()}))}))}})}add_chart(t,e,s,r,n,h){return this._add("chart",{kind:"chart",frame:g(e,s,r,n),chart:{type:t,categories:[...h.categories],series:h._series()}})}add_group_shape(){this.group!==void 0&&m("add_group_shape(): a group here holds shapes, not another group.");let t=1;for(;this.list.some(e=>e.group===`group-${String(t)}`);)t++;return new GroupShape(this.list,`group-${String(t)}`,e=>new ShapeCollection(this.list,this.base,this.components,this.inherit,this.under,e))}build_freeform(t=0,e=0,s=1){return new FreeformBuilder([t,e],s,(r,n)=>{const h=E();return h.vertical_anchor=p.vertical_anchor,h.paragraphs=[{runs:[],level:0,alignment:p.alignment}],this._add("freeform",{kind:"autoshape",frame:n,path:r,fill:p.fill,line:p.line,line_width:p.line_width,text:h})})}add_connector(t,e,s,r,n){R(t)||m(`add_connector(): ${t} is not one of MSO_CONNECTOR's ${Object.keys(G).join(", ")}, nor a connector's preset (${D.join(", ")})`);const h=g(Math.min(e,r),Math.min(s,n),Math.abs(r-e),Math.abs(n-s),{line:!0}),l=r<e,f=n<s;return this._add("connector",{kind:"autoshape",frame:h,geometry:t,...l||f?{flip:{...l?{h:l}:{},...f?{v:f}:{}}}:{},line:P.line,line_width:P.line_width})}add_component(t,e,s,r,n,h={}){if(!Object.hasOwn(this.components(),t))throw new Error(`add_component(): the presentation has no component ${t}; add it with prs.components.add("${t}", { … }) first.`);return this._add(t,{kind:"component",frame:g(e,s,r,n),component:{name:t,props:h}})}}export const NAME_OF_TYPE={title:"title",ctrTitle:"title",subTitle:"subtitle",body:"body",pic:"picture",media:"media",obj:"content",dt:"date",ftr:"footer",sldNum:"slide-number"};export class Placeholders{list;inherit;constructor(t,e=()=>{}){return this.list=t,this.inherit=e,o(this,"placeholders",{index:s=>this.get(s)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}*[Symbol.iterator](){for(const t of this.list)t.kind==="placeholder"&&(yield this._wrap(t))}get length(){return this.list.filter(t=>t.kind==="placeholder").length}get(t){const e=this.list.find(s=>s.kind==="placeholder"&&(typeof t=="number"?s.placeholder?.idx===t:s.name===t||s.placeholder?.type===t));return e?this._wrap(e):void 0}add(t,e,s,r,n,h={}){const l=typeof e=="object"?e:h,f=typeof e=="object"?void 0:e;Object.values(j).includes(t)||m(`placeholders.add(): ${t} is not one of PP_PLACEHOLDER's ${Object.keys(j).join(", ")}`);const u=this.list.filter(b=>b.kind==="placeholder"),c=new Set(u.map(b=>b.placeholder?.idx));let a=t==="title"||t==="ctrTitle"?0:H[t]??1;for(;c.has(a)&&a!==0;)a++;if(c.has(a))throw new Error("A layout has one title placeholder (idx 0).");const _=l.name??NAME_OF_TYPE[t];if(this.list.some(b=>b.name===_))throw new Error(`Two shapes are ${_}: give the placeholder a name ({ name }).`);const x=[f,s,r,n].filter(b=>b!==void 0);if(x.length!==0&&x.length!==4)throw new Error("placeholders.add(type, left, top, width, height): give all four, or none to take the master's frame.");const $={name:_,kind:"placeholder",placeholder:{type:t,idx:a},...x.length===4?{frame:g(f??0,s??0,r??0,n??0)}:{},text:{paragraphs:[],levels:X(t)}};return this.list.push($),this._wrap($)}}export class SlideLayout{def;master;ctx;constructor(t,e,s){return this.def=t,this.master=e,this.ctx=s,o(this,"SlideLayout")}get _def(){return this.def}inherit=t=>t.placeholder?A(this.master._def,t.placeholder.type)?.frame:void 0;get name(){return this.def.name}get slide_master(){return this.master}get display_master_shapes(){return this.def.display_master_shapes??!0}set display_master_shapes(t){t?delete this.def.display_master_shapes:this.def.display_master_shapes=!1}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes,this.inherit)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components,this.inherit,()=>this.master._def.shapes)}}export class SlideLayouts{list;make;constructor(t,e){return this.list=t,this.make=e,o(this,"SlideLayouts",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}get_by_name(t,e){return this.list.find(s=>s.name===t)??e}index(t){const e=this.list.indexOf(t);if(e<0)throw new Error(`${t.name} is not among these layouts.`);return e}add(t,e){if(!this.make)throw new Error("A layout is added to a master: master.slide_layouts.add(name).");const s=this.make(t);return e?.(s),s}}export class TextStyles{def;constructor(t){return this.def=t,o(this,"text_styles")}get title_style(){return S(this.def.title)}get body_style(){return S(this.def.body)}get other_style(){return S(this.def.other)}}export class SlideMaster{def;layouts=[];ctx;allLayouts;constructor(t,e,s){return this.def=t,this.ctx=e,this.allLayouts=s,o(this,"SlideMaster")}get _def(){return this.def}get name(){return this.def.name}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components)}get text_styles(){return new TextStyles(this.def.text_styles)}get slide_layouts(){return new SlideLayouts(this.layouts,t=>{if(this.allLayouts.some(r=>r.name===t))throw new Error(`Two layouts are "${t}": a layout's name is unique in the deck, as slides.yaml names it.`);const e={name:t,master:this.def.name,shapes:[]};this.def.layouts.push(e);const s=new SlideLayout(e,this,this.ctx);return this.layouts.push(s),this.allLayouts.push(s),s})}}export class SlideMasters{list;make;constructor(t,e){return this.list=t,this.make=e,o(this,"SlideMasters",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}index(t){return this.list.indexOf(t)}add(t,e){const s=this.make(t);return e?.(s),s}}export class GeneratedSlide{own;def;layout;constructor(t,e,s){this.def=t,this.layout=e,this.own=e._def.shapes.filter(n=>n.kind==="placeholder").map(n=>({name:n.name,kind:"placeholder",...n.placeholder?{placeholder:{...n.placeholder}}:{},text:E()}));const r=n=>{const h=e._def.shapes.find(l=>l.kind==="placeholder"&&l.placeholder?.idx===n.placeholder?.idx);return h?h.frame??(h.placeholder?A(e.slide_master._def,h.placeholder.type)?.frame:void 0):void 0};return this._shapes=new ShapeCollection(this.own,s.base,s.components,r,()=>[...e.slide_master._def.shapes,...e._def.shapes]),this._placeholders=new Placeholders(this.own,r),o(this,"Slide")}_shapes;_placeholders;get shapes(){return this._shapes}get placeholders(){return this._placeholders}get slide_id(){return this.def.id}get slide_layout(){return this.layout}get has_notes_slide(){return this.def.notes!==void 0}get notes_slide(){const t=this.def;return o({notes_text_frame:o({get text(){return t.notes??""},set text(e){t.notes=e}},"TextFrame")},"NotesSlide")}get transition(){return this.def.transition}set transition(t){t===void 0?delete this.def.transition:this.def.transition=t}get animations(){return new Animations(this.def.animations??=[])}_done(){const t={},e=[];for(const s of this.own)s.kind==="placeholder"&&s.placeholder?(s.text?.paragraphs.some(r=>r.runs.length>0)&&(t[s.placeholder.idx]=s.text.paragraphs),s.frame&&e.push({...s,text:E()})):e.push(s);return{...this.def,shapes:e,text:t}}}export class Animations{list;constructor(t){return this.list=t,o(this,"Animations")}add(t,e,s={}){this.list.push({shape:typeof t=="string"?t:t.name,effect:e,...s})}get length(){return this.list.length}}class st{gen;constructor(t){return this.gen=t,o(this,"slides")}add_slide(t,e){return this.gen._add(t,e)}}export class Generator{list=[];prs;ctx;constructor(t,e){return this.prs=t,this.ctx=e,o(this,"Generator")}data(t){return this.ctx.data(t)}get slides(){return new st(this)}_add(t,e){const s=typeof t=="string"?this.prs._layout(t):t;if(!s)throw new Error(`add_slide(): the presentation has no layout ${typeof t=="string"?t:t.name}.`);if(!/^[A-Za-z0-9_-]+$/u.test(e))throw new Error(`add_slide(): ${e} is not an id of letters, digits, _ and -.`);if(this.list.some(n=>n.slide_id===e))throw new Error(`add_slide(): two slides are ${e}.`);const r=new GeneratedSlide({id:e,layout:s.name,shapes:[],text:{}},s,this.prs._ctx);return this.list.push(r),r}_made(){return this.list.map(t=>t._done())}}const rt=()=>JSON.parse(JSON.stringify(U));export class Presentation{masters=[];layouts=[];def;_ctx;constructor(t,e){return this.def={slide_width:t[0],slide_height:t[1],masters:[],components:{},generators:{}},this._ctx={base:e,components:()=>this.def.components},o(this,"Presentation")}get _def(){return this.def}get slide_width(){return d(this.def.slide_width)}set slide_width(t){this.def.slide_width=t}get slide_height(){return d(this.def.slide_height)}set slide_height(t){this.def.slide_height=t}get slide_masters(){return new SlideMasters(this.masters,t=>{if(this.masters.some(r=>r.name===t))throw new Error(`Two masters are "${t}".`);const e={name:t,background:"lt1",text_styles:rt(),shapes:[],layouts:[]};this.def.masters.push(e);const s=new SlideMaster(e,this._ctx,this.layouts);return this.masters.push(s),s})}get slide_master(){const t=this.masters[0];if(!t)throw new Error("The presentation has no master yet: prs.slide_masters.add(name) makes one.");return t}get slide_layouts(){const t=this.masters[0];return t?t.slide_layouts:new SlideLayouts([])}get slides(){return m("A deck's slides are slides.yaml's, in order, each on a layout, and their words the script's; slides made from data are a generator's (prs.generators.add)")}save(){return m("A deck is not saved by its code: allyhub render writes its PDF, pictures and PPTX")}get theme(){return this.def.theme??={},this.def.theme}set theme(t){this.def.theme=t}get components(){return o({add:(t,e)=>{if(Object.hasOwn(this.def.components,t))throw new Error(`Two components are "${t}".`);if(typeof e.layers!="function")throw new Error(`Component ${t} draws with its layers function.`);this.def.components[t]={name:t,props:e.props??{},layers:e.layers}}},"components")}get generators(){return o({add:(t,e)=>{if(Object.hasOwn(this.def.generators,t))throw new Error(`Two generators are "${t}".`);this.def.generators[t]={name:t,make:s=>{const r=new Generator(this,s);return e(r),r._made()}}}},"generators")}_layout(t){return this.layouts.find(e=>e.name===t)}}export const DECK_BRAND="__allyhubDeck";export function isDeck(i){return typeof i=="object"&&i!==null&&DECK_BRAND in i}export const presentationFor=i=>(t,e)=>{const[s,r]=typeof t=="function"?[{},t]:[t,e];if(typeof r!="function")throw new Error("An item's slides.ts exports one deck: export default presentation({ size }, (prs) => { … masters, layouts, components … }); its slides are slides.yaml.");if(typeof s.size=="string"&&!Object.hasOwn(k,s.size))throw new Error(`presentation(): size ${s.size} is not one of ${Object.keys(k).join(", ")}, or { width, height } in EMU.`);return{[DECK_BRAND]:!0,kind:"slides",options:s,build:r,written:{file:i}}};export function evaluateDeck(i){const t=i.options.size??"16:9",e=typeof t=="string"?k[t]:[t.width,t.height],s=i.written.file.split("/").slice(0,-1).join("/"),r=new Presentation(e,s);return i.options.theme&&(r.theme=JSON.parse(JSON.stringify(i.options.theme))),i.build(r),r._def}