@allyhub/sdk 0.8.0 → 0.10.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 (497) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/NOTICE +46 -49
  3. package/dist/dom.d.ts +1 -209
  4. package/dist/dom.js +1 -1
  5. package/dist/image.d.ts +2 -0
  6. package/dist/image.js +2 -0
  7. package/dist/index.d.ts +1 -21
  8. package/dist/index.js +1 -1
  9. package/dist/media.d.ts +1 -5
  10. package/dist/media.js +1 -1
  11. package/dist/node_modules/@allyhub/audio/dist/levels.d.ts +4 -5
  12. package/dist/node_modules/@allyhub/audio/dist/levels.js +1 -1
  13. package/dist/node_modules/@allyhub/audio/dist/node/ffmpeg.d.ts +1 -6
  14. package/dist/node_modules/@allyhub/audio/dist/node/ffmpeg.js +1 -1
  15. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  16. package/dist/node_modules/@allyhub/chart/dist/chart-file.js +1 -1
  17. package/dist/node_modules/@allyhub/chart/dist/chart-xml.d.ts +4 -1
  18. package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +2 -2
  19. package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +22 -0
  20. package/dist/node_modules/@allyhub/chart/dist/chart.js +1 -1
  21. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  22. package/dist/node_modules/@allyhub/diagnostics/LICENSE +241 -0
  23. package/dist/node_modules/@allyhub/diagnostics/dist/fact.d.ts +37 -0
  24. package/dist/node_modules/@allyhub/diagnostics/dist/fact.js +2 -0
  25. package/dist/node_modules/@allyhub/diagnostics/dist/index.d.ts +4 -0
  26. package/dist/node_modules/@allyhub/diagnostics/dist/index.js +2 -0
  27. package/dist/node_modules/@allyhub/diagnostics/dist/problem.d.ts +43 -0
  28. package/dist/node_modules/@allyhub/diagnostics/dist/problem.js +2 -0
  29. package/dist/node_modules/@allyhub/diagnostics/dist/rules.d.ts +30 -0
  30. package/dist/node_modules/@allyhub/diagnostics/dist/rules.js +2 -0
  31. package/dist/node_modules/@allyhub/diagnostics/package.json +14 -0
  32. package/dist/node_modules/@allyhub/formats/dist/contributed.d.ts +126 -0
  33. package/dist/node_modules/@allyhub/formats/dist/contributed.js +2 -0
  34. package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +1 -1
  35. package/dist/node_modules/@allyhub/formats/dist/data/reference.d.ts +7 -12
  36. package/dist/node_modules/@allyhub/formats/dist/data/reference.js +1 -1
  37. package/dist/node_modules/@allyhub/formats/dist/data/script.d.ts +9 -4
  38. package/dist/node_modules/@allyhub/formats/dist/data/script.js +1 -1
  39. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +107 -83
  40. package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
  41. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +185 -8
  42. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
  43. package/dist/node_modules/@allyhub/formats/dist/data/website.d.ts +2 -1
  44. package/dist/node_modules/@allyhub/formats/dist/data/website.js +1 -1
  45. package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +42 -0
  46. package/dist/node_modules/@allyhub/formats/dist/data/work.js +2 -0
  47. package/dist/node_modules/@allyhub/formats/dist/extension.d.ts +91 -0
  48. package/dist/node_modules/@allyhub/formats/dist/extension.js +2 -0
  49. package/dist/node_modules/@allyhub/formats/dist/files.d.ts +51 -0
  50. package/dist/node_modules/@allyhub/formats/dist/files.js +2 -0
  51. package/dist/node_modules/@allyhub/formats/dist/index.d.ts +5 -1
  52. package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
  53. package/dist/node_modules/@allyhub/formats/dist/items.d.ts +226 -90
  54. package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
  55. package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +7 -1
  56. package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
  57. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +96 -42
  58. package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
  59. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  60. package/dist/node_modules/@allyhub/image-draw/LICENSE +241 -0
  61. package/dist/node_modules/@allyhub/image-draw/dist/context.d.ts +5 -0
  62. package/dist/node_modules/@allyhub/image-draw/dist/context.js +2 -0
  63. package/dist/node_modules/@allyhub/image-draw/dist/contrast.d.ts +13 -0
  64. package/dist/node_modules/@allyhub/image-draw/dist/contrast.js +2 -0
  65. package/dist/node_modules/@allyhub/image-draw/dist/env.d.ts +112 -0
  66. package/dist/node_modules/@allyhub/image-draw/dist/env.js +2 -0
  67. package/dist/node_modules/@allyhub/image-draw/dist/errors.d.ts +20 -0
  68. package/dist/node_modules/@allyhub/image-draw/dist/errors.js +2 -0
  69. package/dist/node_modules/@allyhub/image-draw/dist/fonts.d.ts +110 -0
  70. package/dist/node_modules/@allyhub/image-draw/dist/fonts.js +2 -0
  71. package/dist/node_modules/@allyhub/image-draw/dist/guards.d.ts +32 -0
  72. package/dist/node_modules/@allyhub/image-draw/dist/guards.js +2 -0
  73. package/dist/node_modules/@allyhub/image-draw/dist/hash.d.ts +3 -0
  74. package/dist/node_modules/@allyhub/image-draw/dist/hash.js +2 -0
  75. package/dist/node_modules/@allyhub/image-draw/dist/inspect.d.ts +113 -0
  76. package/dist/node_modules/@allyhub/image-draw/dist/inspect.js +3 -0
  77. package/dist/node_modules/@allyhub/image-draw/dist/layer-style.d.ts +151 -0
  78. package/dist/node_modules/@allyhub/image-draw/dist/layer-style.js +2 -0
  79. package/dist/node_modules/@allyhub/image-draw/dist/paint.d.ts +29 -0
  80. package/dist/node_modules/@allyhub/image-draw/dist/paint.js +2 -0
  81. package/dist/node_modules/@allyhub/image-draw/dist/pictures.d.ts +39 -0
  82. package/dist/node_modules/@allyhub/image-draw/dist/pictures.js +2 -0
  83. package/dist/node_modules/@allyhub/image-draw/dist/plan.d.ts +52 -0
  84. package/dist/node_modules/@allyhub/image-draw/dist/plan.js +2 -0
  85. package/dist/node_modules/@allyhub/image-draw/dist/reads.d.ts +145 -0
  86. package/dist/node_modules/@allyhub/image-draw/dist/reads.js +2 -0
  87. package/dist/node_modules/@allyhub/image-draw/dist/shape-path.d.ts +26 -0
  88. package/dist/node_modules/@allyhub/image-draw/dist/shape-path.js +2 -0
  89. package/dist/node_modules/@allyhub/image-draw/dist/stage.d.ts +56 -0
  90. package/dist/node_modules/@allyhub/image-draw/dist/stage.js +2 -0
  91. package/dist/node_modules/@allyhub/image-draw/dist/styles.d.ts +35 -0
  92. package/dist/node_modules/@allyhub/image-draw/dist/styles.js +2 -0
  93. package/dist/node_modules/@allyhub/image-draw/dist/tone.d.ts +53 -0
  94. package/dist/node_modules/@allyhub/image-draw/dist/tone.js +2 -0
  95. package/dist/node_modules/@allyhub/image-draw/package.json +14 -0
  96. package/dist/node_modules/@allyhub/image-measure/LICENSE +241 -0
  97. package/dist/node_modules/@allyhub/image-measure/dist/contrast.d.ts +43 -0
  98. package/dist/node_modules/@allyhub/image-measure/dist/contrast.js +2 -0
  99. package/dist/node_modules/@allyhub/image-measure/dist/layout.d.ts +186 -0
  100. package/dist/node_modules/@allyhub/image-measure/dist/layout.js +5 -0
  101. package/dist/node_modules/@allyhub/image-measure/package.json +14 -0
  102. package/dist/node_modules/@allyhub/image-sdk/LICENSE +241 -0
  103. package/dist/node_modules/@allyhub/image-sdk/dist/adjustment.d.ts +13 -0
  104. package/dist/node_modules/@allyhub/image-sdk/dist/adjustment.js +2 -0
  105. package/dist/{define.d.ts → node_modules/@allyhub/image-sdk/dist/define.d.ts} +21 -4
  106. package/dist/node_modules/@allyhub/image-sdk/dist/define.js +2 -0
  107. package/dist/node_modules/@allyhub/image-sdk/dist/dom.d.ts +210 -0
  108. package/dist/node_modules/@allyhub/image-sdk/dist/dom.js +2 -0
  109. package/dist/node_modules/@allyhub/image-sdk/dist/fill.d.ts +21 -0
  110. package/dist/node_modules/@allyhub/image-sdk/dist/fill.js +2 -0
  111. package/dist/node_modules/@allyhub/image-sdk/dist/group.d.ts +17 -0
  112. package/dist/node_modules/@allyhub/image-sdk/dist/group.js +2 -0
  113. package/dist/node_modules/@allyhub/image-sdk/dist/index.d.ts +166 -0
  114. package/dist/node_modules/@allyhub/image-sdk/dist/index.js +2 -0
  115. package/dist/node_modules/@allyhub/image-sdk/dist/media.d.ts +6 -0
  116. package/dist/node_modules/@allyhub/image-sdk/dist/media.js +2 -0
  117. package/dist/{messages.d.ts → node_modules/@allyhub/image-sdk/dist/messages.d.ts} +1 -1
  118. package/dist/node_modules/@allyhub/image-sdk/dist/picture.d.ts +59 -0
  119. package/dist/node_modules/@allyhub/image-sdk/dist/picture.js +2 -0
  120. package/dist/{props.d.ts → node_modules/@allyhub/image-sdk/dist/props.d.ts} +4 -4
  121. package/dist/node_modules/@allyhub/image-sdk/dist/shape.d.ts +34 -0
  122. package/dist/node_modules/@allyhub/image-sdk/dist/shape.js +2 -0
  123. package/dist/node_modules/@allyhub/image-sdk/dist/stack.d.ts +16 -0
  124. package/dist/node_modules/@allyhub/image-sdk/dist/stack.js +2 -0
  125. package/dist/node_modules/@allyhub/image-sdk/dist/text-layer.d.ts +38 -0
  126. package/dist/node_modules/@allyhub/image-sdk/dist/text-layer.js +2 -0
  127. package/dist/{written.js → node_modules/@allyhub/image-sdk/dist/written.js} +1 -1
  128. package/dist/node_modules/@allyhub/image-sdk/package.json +19 -0
  129. package/dist/node_modules/@allyhub/measure/LICENSE +241 -0
  130. package/dist/node_modules/@allyhub/measure/dist/compare.d.ts +195 -0
  131. package/dist/node_modules/@allyhub/measure/dist/compare.js +2 -0
  132. package/dist/node_modules/@allyhub/measure/dist/grain.d.ts +8 -0
  133. package/dist/node_modules/@allyhub/measure/dist/grain.js +2 -0
  134. package/dist/node_modules/@allyhub/measure/dist/image.d.ts +16 -0
  135. package/dist/node_modules/@allyhub/measure/dist/image.js +2 -0
  136. package/dist/node_modules/@allyhub/measure/dist/index.d.ts +4 -0
  137. package/dist/node_modules/@allyhub/measure/dist/index.js +2 -0
  138. package/dist/node_modules/@allyhub/measure/package.json +13 -0
  139. package/dist/node_modules/@allyhub/ooxml/dist/generated/presets.d.ts +4 -1
  140. package/dist/node_modules/@allyhub/ooxml/dist/generated/presets.js +1 -1
  141. package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.d.ts +15 -1
  142. package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
  143. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  144. package/dist/node_modules/@allyhub/piece/LICENSE +241 -0
  145. package/dist/node_modules/@allyhub/{video-core → piece}/dist/anchors.d.ts +1 -9
  146. package/dist/node_modules/@allyhub/{video-core → piece}/dist/component.js +1 -1
  147. package/dist/node_modules/@allyhub/piece/dist/context.d.ts +39 -0
  148. package/dist/node_modules/@allyhub/piece/dist/context.js +2 -0
  149. package/dist/node_modules/@allyhub/{video-core → piece}/dist/contrast.d.ts +2 -2
  150. package/dist/node_modules/@allyhub/{video-core → piece}/dist/export.d.ts +27 -10
  151. package/dist/node_modules/@allyhub/piece/dist/export.js +2 -0
  152. package/dist/node_modules/@allyhub/{video-core → piece}/dist/formats.d.ts +12 -68
  153. package/dist/node_modules/@allyhub/piece/dist/formats.js +2 -0
  154. package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +104 -0
  155. package/dist/node_modules/@allyhub/piece/dist/index.d.ts +26 -0
  156. package/dist/node_modules/@allyhub/piece/dist/index.js +2 -0
  157. package/dist/node_modules/@allyhub/piece/dist/layer-style.d.ts +1558 -0
  158. package/dist/node_modules/@allyhub/piece/dist/layer-style.js +2 -0
  159. package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +389 -0
  160. package/dist/node_modules/@allyhub/piece/dist/layer.js +2 -0
  161. package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +437 -0
  162. package/dist/node_modules/@allyhub/piece/dist/layout.js +2 -0
  163. package/dist/node_modules/@allyhub/{video-core → piece}/dist/look.d.ts +1 -1
  164. package/dist/node_modules/@allyhub/{video-core → piece}/dist/media.d.ts +39 -9
  165. package/dist/node_modules/@allyhub/{video-core → piece}/dist/media.js +1 -1
  166. package/dist/node_modules/@allyhub/{video-core → piece}/dist/messages.d.ts +6 -0
  167. package/dist/node_modules/@allyhub/piece/dist/names.d.ts +26 -0
  168. package/dist/node_modules/@allyhub/piece/dist/names.js +2 -0
  169. package/dist/node_modules/@allyhub/piece/dist/page/console.d.ts +21 -0
  170. package/dist/node_modules/@allyhub/piece/dist/page/console.js +2 -0
  171. package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +3 -0
  172. package/dist/node_modules/@allyhub/piece/dist/page/index.js +2 -0
  173. package/dist/node_modules/@allyhub/piece/dist/page/locate.d.ts +4 -0
  174. package/dist/node_modules/@allyhub/piece/dist/page/locate.js +2 -0
  175. package/dist/node_modules/@allyhub/piece/dist/picture.d.ts +62 -0
  176. package/dist/node_modules/@allyhub/piece/dist/picture.js +2 -0
  177. package/dist/node_modules/@allyhub/piece/dist/piece.d.ts +15 -0
  178. package/dist/node_modules/@allyhub/piece/dist/piece.js +2 -0
  179. package/dist/node_modules/@allyhub/{video-core → piece}/dist/script.d.ts +9 -4
  180. package/dist/node_modules/@allyhub/piece/dist/script.js +2 -0
  181. package/dist/node_modules/@allyhub/piece/dist/source.d.ts +131 -0
  182. package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +291 -0
  183. package/dist/node_modules/@allyhub/piece/dist/stage.js +2 -0
  184. package/dist/node_modules/@allyhub/piece/dist/version.d.ts +15 -0
  185. package/dist/node_modules/@allyhub/piece/dist/version.js +2 -0
  186. package/dist/node_modules/@allyhub/{video-core → piece}/dist/voice.d.ts +1 -20
  187. package/dist/node_modules/@allyhub/piece/package.json +18 -0
  188. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +271 -0
  189. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  190. package/dist/node_modules/@allyhub/protocol/dist/app.d.ts +3 -10
  191. package/dist/node_modules/@allyhub/protocol/dist/app.js +1 -1
  192. package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +19 -1
  193. package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
  194. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.d.ts +337 -0
  195. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.js +2 -0
  196. package/dist/node_modules/@allyhub/protocol/dist/cli.d.ts +12 -1
  197. package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
  198. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +155 -0
  199. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  200. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +235 -133
  201. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  202. package/dist/node_modules/@allyhub/protocol/dist/files.d.ts +2 -0
  203. package/dist/node_modules/@allyhub/protocol/dist/files.js +1 -1
  204. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +65 -197
  205. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  206. package/dist/node_modules/@allyhub/protocol/dist/image.d.ts +8 -0
  207. package/dist/node_modules/@allyhub/protocol/dist/image.js +2 -0
  208. package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +6 -0
  209. package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
  210. package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
  211. package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +98 -0
  212. package/dist/node_modules/@allyhub/protocol/dist/kinds.js +2 -0
  213. package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +274 -0
  214. package/dist/node_modules/@allyhub/protocol/dist/mail.js +2 -0
  215. package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +77 -91
  216. package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
  217. package/dist/node_modules/@allyhub/protocol/dist/peer.d.ts +59 -0
  218. package/dist/node_modules/@allyhub/protocol/dist/peer.js +2 -0
  219. package/dist/node_modules/@allyhub/protocol/dist/place.d.ts +21 -0
  220. package/dist/node_modules/@allyhub/protocol/dist/place.js +2 -0
  221. package/dist/node_modules/@allyhub/protocol/dist/presence.d.ts +125 -0
  222. package/dist/node_modules/@allyhub/protocol/dist/presence.js +2 -0
  223. package/dist/node_modules/@allyhub/protocol/dist/registry.d.ts +1 -1
  224. package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
  225. package/dist/node_modules/@allyhub/protocol/dist/shape.d.ts +35 -0
  226. package/dist/node_modules/@allyhub/protocol/dist/shape.js +2 -0
  227. package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +2 -8
  228. package/dist/node_modules/@allyhub/protocol/dist/shares.js +1 -1
  229. package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +70 -40
  230. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  231. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +224 -177
  232. package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
  233. package/dist/node_modules/@allyhub/protocol/package.json +5 -1
  234. package/dist/node_modules/@allyhub/runtimes/dist/bundled.js +1 -1
  235. package/dist/node_modules/@allyhub/runtimes/dist/declared.d.ts +14 -0
  236. package/dist/node_modules/@allyhub/runtimes/dist/declared.js +2 -0
  237. package/dist/node_modules/@allyhub/runtimes/dist/ffmpeg.d.ts +15 -0
  238. package/dist/node_modules/@allyhub/runtimes/dist/ffmpeg.js +2 -0
  239. package/dist/node_modules/@allyhub/runtimes/dist/index.d.ts +2 -0
  240. package/dist/node_modules/@allyhub/runtimes/dist/index.js +1 -1
  241. package/dist/node_modules/@allyhub/runtimes/dist/packages.js +3 -3
  242. package/dist/node_modules/@allyhub/runtimes/dist/runtimes.d.ts +1 -0
  243. package/dist/node_modules/@allyhub/runtimes/dist/runtimes.js +1 -1
  244. package/dist/node_modules/@allyhub/runtimes/manifest.json +0 -82
  245. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  246. package/dist/node_modules/@allyhub/scenery/dist/define.d.ts +2 -0
  247. package/dist/node_modules/@allyhub/scenery/dist/define.js +1 -1
  248. package/dist/node_modules/@allyhub/scenery/dist/index.d.ts +2 -2
  249. package/dist/node_modules/@allyhub/scenery/dist/index.js +1 -1
  250. package/dist/node_modules/@allyhub/scenery/dist/moire.d.ts +45 -5
  251. package/dist/node_modules/@allyhub/scenery/dist/moire.js +2 -2
  252. package/dist/node_modules/@allyhub/scenery/dist/phone.d.ts +4 -3
  253. package/dist/node_modules/@allyhub/scenery/dist/phone.js +1 -1
  254. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  255. package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
  256. package/dist/node_modules/@allyhub/sheet/dist/api/code.d.ts +4 -4
  257. package/dist/node_modules/@allyhub/sheet/dist/api/code.js +1 -1
  258. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +15 -11
  259. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
  260. package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
  261. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.d.ts +70 -0
  262. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
  263. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.d.ts +6 -0
  264. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
  265. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
  266. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.d.ts +3 -1
  267. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.js +1 -1
  268. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
  269. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/kernels.js +1 -1
  270. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
  271. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/maths.js +1 -1
  272. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
  273. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.d.ts +9 -0
  274. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.js +1 -1
  275. package/dist/node_modules/@allyhub/sheet/dist/calc/server.d.ts +1 -1
  276. package/dist/node_modules/@allyhub/sheet/dist/calc/types.d.ts +6 -0
  277. package/dist/node_modules/@allyhub/sheet/dist/calc/types.js +1 -1
  278. package/dist/node_modules/@allyhub/sheet/dist/chart.d.ts +9 -0
  279. package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
  280. package/dist/node_modules/@allyhub/sheet/dist/export.js +1 -1
  281. package/dist/node_modules/@allyhub/sheet/dist/file.d.ts +5 -0
  282. package/dist/node_modules/@allyhub/sheet/dist/file.js +1 -1
  283. package/dist/node_modules/@allyhub/sheet/dist/formula/ast.d.ts +12 -1
  284. package/dist/node_modules/@allyhub/sheet/dist/formula/move.d.ts +5 -1
  285. package/dist/node_modules/@allyhub/sheet/dist/formula/move.js +1 -1
  286. package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
  287. package/dist/node_modules/@allyhub/sheet/dist/formula/print.js +1 -1
  288. package/dist/node_modules/@allyhub/sheet/dist/generated.d.ts +5 -19
  289. package/dist/node_modules/@allyhub/sheet/dist/generated.js +1 -1
  290. package/dist/node_modules/@allyhub/sheet/dist/import.d.ts +3 -1
  291. package/dist/node_modules/@allyhub/sheet/dist/import.js +1 -1
  292. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +5 -5
  293. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  294. package/dist/node_modules/@allyhub/sheet/dist/inspect.d.ts +88 -3
  295. package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
  296. package/dist/node_modules/@allyhub/sheet/dist/patch.d.ts +1 -1
  297. package/dist/node_modules/@allyhub/sheet/dist/patch.js +1 -1
  298. package/dist/node_modules/@allyhub/sheet/dist/printed.d.ts +19 -0
  299. package/dist/node_modules/@allyhub/sheet/dist/printed.js +2 -0
  300. package/dist/node_modules/@allyhub/sheet/dist/sdk.d.ts +2 -0
  301. package/dist/node_modules/@allyhub/sheet/dist/sdk.js +2 -0
  302. package/dist/node_modules/@allyhub/sheet/dist/values.d.ts +2 -0
  303. package/dist/node_modules/@allyhub/sheet/dist/values.js +1 -1
  304. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +8 -6
  305. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  306. package/dist/node_modules/@allyhub/sheet/dist/write.js +15 -15
  307. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.d.ts +6 -2
  308. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  309. package/dist/node_modules/@allyhub/sheet/dist/xlsx/formula.js +2 -2
  310. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.d.ts +2 -1
  311. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  312. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +3 -1
  313. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  314. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.d.ts +7 -1
  315. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.js +3 -1
  316. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  317. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  318. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.d.ts +1 -1
  319. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  320. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.d.ts +12 -1
  321. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.js +3 -2
  322. package/dist/node_modules/@allyhub/sheet/package.json +5 -1
  323. package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +23 -7
  324. package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
  325. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +101 -11
  326. package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
  327. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  328. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +18 -1
  329. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
  330. package/dist/node_modules/@allyhub/slides-core/dist/code.d.ts +1 -1
  331. package/dist/node_modules/@allyhub/slides-core/dist/connect.d.ts +62 -0
  332. package/dist/node_modules/@allyhub/slides-core/dist/connect.js +2 -0
  333. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +24 -0
  334. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  335. package/dist/node_modules/@allyhub/slides-core/dist/fact.d.ts +223 -0
  336. package/dist/node_modules/@allyhub/slides-core/dist/fact.js +2 -0
  337. package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +4 -4
  338. package/dist/node_modules/@allyhub/slides-core/dist/file.js +2 -2
  339. package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +2 -0
  340. package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
  341. package/dist/node_modules/@allyhub/slides-core/dist/measure.d.ts +4 -2
  342. package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
  343. package/dist/node_modules/@allyhub/slides-core/dist/merge.d.ts +5 -5
  344. package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
  345. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +25 -4
  346. package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +1 -1
  347. package/dist/node_modules/@allyhub/slides-core/dist/path.d.ts +1 -1
  348. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +20 -11
  349. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  350. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +18 -0
  351. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +2 -0
  352. package/dist/node_modules/@allyhub/slides-core/dist/stage.d.ts +28 -11
  353. package/dist/node_modules/@allyhub/slides-core/dist/units.d.ts +3 -6
  354. package/dist/node_modules/@allyhub/slides-core/dist/units.js +1 -1
  355. package/dist/node_modules/@allyhub/slides-core/package.json +5 -1
  356. package/dist/node_modules/@allyhub/video-core/dist/audio-types.d.ts +1 -2
  357. package/dist/node_modules/@allyhub/video-core/dist/captions.d.ts +1 -10
  358. package/dist/node_modules/@allyhub/video-core/dist/captions.js +1 -1
  359. package/dist/node_modules/@allyhub/video-core/dist/check.d.ts +62 -0
  360. package/dist/node_modules/@allyhub/video-core/dist/check.js +2 -0
  361. package/dist/node_modules/@allyhub/video-core/dist/cut-report.d.ts +2 -2
  362. package/dist/node_modules/@allyhub/video-core/dist/cut-report.js +1 -1
  363. package/dist/node_modules/@allyhub/video-core/dist/edits.d.ts +3 -3
  364. package/dist/node_modules/@allyhub/video-core/dist/edits.js +1 -1
  365. package/dist/node_modules/@allyhub/video-core/dist/fact.d.ts +21 -762
  366. package/dist/node_modules/@allyhub/video-core/dist/fact.js +1 -1
  367. package/dist/node_modules/@allyhub/video-core/dist/footage-motion.d.ts +3 -2
  368. package/dist/node_modules/@allyhub/video-core/dist/footage-motion.js +1 -1
  369. package/dist/node_modules/@allyhub/video-core/dist/index.d.ts +3 -17
  370. package/dist/node_modules/@allyhub/video-core/dist/index.js +1 -1
  371. package/dist/node_modules/@allyhub/video-core/dist/measure.d.ts +72 -423
  372. package/dist/node_modules/@allyhub/video-core/dist/measure.js +1 -4
  373. package/dist/node_modules/@allyhub/video-core/dist/mix-plan.d.ts +44 -0
  374. package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +2 -0
  375. package/dist/node_modules/@allyhub/video-core/dist/motion.d.ts +1 -1
  376. package/dist/node_modules/@allyhub/video-core/dist/piece.d.ts +24 -432
  377. package/dist/node_modules/@allyhub/video-core/dist/piece.js +1 -1
  378. package/dist/node_modules/@allyhub/video-core/dist/placement.d.ts +1 -1
  379. package/dist/node_modules/@allyhub/video-core/dist/schema.d.ts +8 -14
  380. package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
  381. package/dist/node_modules/@allyhub/video-core/dist/script-edit.d.ts +11 -6
  382. package/dist/node_modules/@allyhub/video-core/dist/script-edit.js +1 -1
  383. package/dist/node_modules/@allyhub/video-core/dist/seams.d.ts +2 -3
  384. package/dist/node_modules/@allyhub/video-core/dist/sound-under.d.ts +2 -2
  385. package/dist/node_modules/@allyhub/video-core/dist/sound-under.js +1 -1
  386. package/dist/node_modules/@allyhub/video-core/dist/speech.d.ts +2 -4
  387. package/dist/node_modules/@allyhub/video-core/dist/speech.js +2 -2
  388. package/dist/node_modules/@allyhub/video-core/dist/stage.d.ts +52 -0
  389. package/dist/node_modules/@allyhub/video-core/dist/stage.js +2 -0
  390. package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +18 -136
  391. package/dist/node_modules/@allyhub/video-core/dist/timeline.js +1 -1
  392. package/dist/node_modules/@allyhub/video-core/dist/timing.d.ts +3 -3
  393. package/dist/node_modules/@allyhub/video-core/dist/timing.js +1 -1
  394. package/dist/node_modules/@allyhub/video-core/dist/transcript.d.ts +2 -2
  395. package/dist/node_modules/@allyhub/video-core/dist/transcript.js +1 -1
  396. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  397. package/dist/node_modules/@allyhub/video-sdk/LICENSE +241 -0
  398. package/dist/node_modules/@allyhub/video-sdk/NOTICE +118 -0
  399. package/dist/{free.d.ts → node_modules/@allyhub/video-sdk/dist/free.d.ts} +14 -10
  400. package/dist/node_modules/@allyhub/video-sdk/dist/free.js +2 -0
  401. package/dist/node_modules/@allyhub/video-sdk/dist/index.d.ts +28 -0
  402. package/dist/node_modules/@allyhub/video-sdk/dist/index.js +2 -0
  403. package/dist/{input.d.ts → node_modules/@allyhub/video-sdk/dist/input.d.ts} +76 -22
  404. package/dist/node_modules/@allyhub/video-sdk/dist/input.js +2 -0
  405. package/dist/{module.d.ts → node_modules/@allyhub/video-sdk/dist/module.d.ts} +6 -4
  406. package/dist/node_modules/@allyhub/video-sdk/dist/module.js +2 -0
  407. package/dist/{parts.d.ts → node_modules/@allyhub/video-sdk/dist/parts.d.ts} +15 -6
  408. package/dist/node_modules/@allyhub/video-sdk/dist/parts.js +2 -0
  409. package/dist/{phone.d.ts → node_modules/@allyhub/video-sdk/dist/phone.d.ts} +12 -5
  410. package/dist/node_modules/@allyhub/video-sdk/dist/phone.js +2 -0
  411. package/dist/{piece.d.ts → node_modules/@allyhub/video-sdk/dist/piece.d.ts} +26 -16
  412. package/dist/node_modules/@allyhub/video-sdk/dist/piece.js +2 -0
  413. package/dist/node_modules/@allyhub/video-sdk/dist/route.d.ts +46 -0
  414. package/dist/node_modules/@allyhub/video-sdk/dist/route.js +2 -0
  415. package/dist/node_modules/@allyhub/video-sdk/dist/scenery.d.ts +2 -0
  416. package/dist/node_modules/@allyhub/video-sdk/dist/scenery.js +2 -0
  417. package/dist/node_modules/@allyhub/video-sdk/package.json +19 -0
  418. package/dist/scenery.d.ts +1 -1
  419. package/dist/scenery.js +1 -1
  420. package/dist/sheets.d.ts +1 -1
  421. package/dist/sheets.js +1 -1
  422. package/dist/slides.d.ts +1 -9
  423. package/dist/slides.js +1 -1
  424. package/docs/README.md +10 -6
  425. package/docs/batches.md +5 -5
  426. package/docs/canvas.md +28 -0
  427. package/docs/contract.md +2 -2
  428. package/docs/defaults.md +298 -22
  429. package/docs/docs.md +80 -66
  430. package/docs/footage.md +7 -7
  431. package/docs/image.md +165 -0
  432. package/docs/layers.md +22 -13
  433. package/docs/modeling.md +4 -4
  434. package/docs/pictures.md +65 -0
  435. package/docs/project.md +51 -31
  436. package/docs/scenery.md +14 -15
  437. package/docs/sheets.md +46 -28
  438. package/docs/slides.md +121 -67
  439. package/docs/sound.md +3 -3
  440. package/docs/speech.md +8 -8
  441. package/docs/video.md +16 -13
  442. package/docs/websites.md +4 -4
  443. package/docs/x.md +73 -0
  444. package/package.json +7 -2
  445. package/dist/define.js +0 -2
  446. package/dist/free.js +0 -2
  447. package/dist/input.js +0 -2
  448. package/dist/module.js +0 -2
  449. package/dist/node_modules/@allyhub/formats/dist/data/comments.d.ts +0 -94
  450. package/dist/node_modules/@allyhub/formats/dist/data/comments.js +0 -2
  451. package/dist/node_modules/@allyhub/runtimes/pins/onnxruntime-node/package-lock.json +0 -227
  452. package/dist/node_modules/@allyhub/runtimes/pins/onnxruntime-node/package.json +0 -8
  453. package/dist/node_modules/@allyhub/runtimes/pins/sherpa-onnx-node/package-lock.json +0 -105
  454. package/dist/node_modules/@allyhub/runtimes/pins/sherpa-onnx-node/package.json +0 -8
  455. package/dist/node_modules/@allyhub/runtimes/pins/tesseract.js/package-lock.json +0 -128
  456. package/dist/node_modules/@allyhub/runtimes/pins/tesseract.js/package.json +0 -9
  457. package/dist/node_modules/@allyhub/video-core/dist/export.js +0 -2
  458. package/dist/node_modules/@allyhub/video-core/dist/formats.js +0 -2
  459. package/dist/node_modules/@allyhub/video-core/dist/gen.d.ts +0 -37
  460. package/dist/node_modules/@allyhub/video-core/dist/problem.d.ts +0 -278
  461. package/dist/node_modules/@allyhub/video-core/dist/problem.js +0 -2
  462. package/dist/node_modules/@allyhub/video-core/dist/script.js +0 -2
  463. package/dist/node_modules/@allyhub/video-core/dist/source.d.ts +0 -7
  464. package/dist/parts.js +0 -2
  465. package/dist/phone.js +0 -2
  466. package/dist/piece.js +0 -2
  467. /package/dist/node_modules/@allyhub/{sheet → formats}/dist/csv.d.ts +0 -0
  468. /package/dist/node_modules/@allyhub/{sheet → formats}/dist/csv.js +0 -0
  469. /package/dist/{fit.d.ts → node_modules/@allyhub/image-sdk/dist/fit.d.ts} +0 -0
  470. /package/dist/{fit.js → node_modules/@allyhub/image-sdk/dist/fit.js} +0 -0
  471. /package/dist/{messages.js → node_modules/@allyhub/image-sdk/dist/messages.js} +0 -0
  472. /package/dist/{props.js → node_modules/@allyhub/image-sdk/dist/props.js} +0 -0
  473. /package/dist/{text.d.ts → node_modules/@allyhub/image-sdk/dist/text.d.ts} +0 -0
  474. /package/dist/{text.js → node_modules/@allyhub/image-sdk/dist/text.js} +0 -0
  475. /package/dist/{written.d.ts → node_modules/@allyhub/image-sdk/dist/written.d.ts} +0 -0
  476. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/anchors.js +0 -0
  477. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/component.d.ts +0 -0
  478. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/console.d.ts +0 -0
  479. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/console.js +0 -0
  480. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/contrast.js +0 -0
  481. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/gen.js +0 -0
  482. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/look.js +0 -0
  483. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/marks.d.ts +0 -0
  484. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/marks.js +0 -0
  485. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/matrix.d.ts +0 -0
  486. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/matrix.js +0 -0
  487. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/messages.js +0 -0
  488. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/source.js +0 -0
  489. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/voice.js +0 -0
  490. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/words.d.ts +0 -0
  491. /package/dist/node_modules/@allyhub/{video-core → piece}/dist/words.js +0 -0
  492. /package/dist/{anim.d.ts → node_modules/@allyhub/video-sdk/dist/anim.d.ts} +0 -0
  493. /package/dist/{anim.js → node_modules/@allyhub/video-sdk/dist/anim.js} +0 -0
  494. /package/dist/{noise.d.ts → node_modules/@allyhub/video-sdk/dist/noise.d.ts} +0 -0
  495. /package/dist/{noise.js → node_modules/@allyhub/video-sdk/dist/noise.js} +0 -0
  496. /package/dist/{paths.d.ts → node_modules/@allyhub/video-sdk/dist/paths.d.ts} +0 -0
  497. /package/dist/{paths.js → node_modules/@allyhub/video-sdk/dist/paths.js} +0 -0
@@ -2,14 +2,14 @@ import { type ShapeFile, type SlidesFile, type Numbering, type TextAlign } from
2
2
  import { type ChartDef } from "@allyhub/chart";
3
3
  import type { DeckCode } from "./code.js";
4
4
  import type { Anchor, AutoSize, PlaceholderType } from "./enums.js";
5
- import type { Color, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, GradientDef, ShadowDef, ShapeDef, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
5
+ import type { Color, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, GradientDef, ShadowDef, ShapeDef, Glue, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
6
6
  import { type ResolvedAnimation, type ResolvedTransition } from "./animation.js";
7
7
  import { type Theme } from "./theme.js";
8
8
  import { type Length } from "./units.js";
9
- /** Where a value came from: a level of the deck, and its place in slides.yaml when it is the slide's. */
9
+ /** Where a value came from: a level of the deck, and its place in the slides file when it is the slide's. */
10
10
  export interface ValueSource {
11
11
  from: "master" | "layout" | "code" | "slide";
12
- /** slides.yaml's path of the value (`slides.2.shapes.Title.frame`), when it is set there. */
12
+ /** The slides file's path of the value (`slides.2.shapes.Title.frame`), when it is set there. */
13
13
  path?: string;
14
14
  }
15
15
  /** A level of a text frame's style, every value inherited and resolved: what a paragraph at that level takes. */
@@ -59,6 +59,11 @@ export interface ResolvedShape {
59
59
  h?: boolean;
60
60
  v?: boolean;
61
61
  };
62
+ /** A connector's ends glued to shapes of its level, by their names: its frame and flips put them on their sites. */
63
+ connect?: {
64
+ begin?: Glue;
65
+ end?: Glue;
66
+ };
62
67
  /** Degrees clockwise about its centre. */
63
68
  rotation?: number;
64
69
  /** Its alternative text, the script's: what a screen reader says (`p:cNvPr/@descr`). */
@@ -73,12 +78,14 @@ export interface ResolvedShape {
73
78
  fill?: Color | null;
74
79
  fill_transparency?: number;
75
80
  gradient?: GradientDef;
76
- shadow?: ShadowDef;
81
+ shadow?: ShadowDef | null;
77
82
  line?: Color | null;
78
83
  line_width?: Length;
79
84
  line_dash?: NonNullable<ShapeDef["line_dash"]>;
80
85
  line_begin?: NonNullable<ShapeDef["line_begin"]>;
81
86
  line_end?: NonNullable<ShapeDef["line_end"]>;
87
+ line_begin_size?: NonNullable<ShapeDef["line_begin_size"]>;
88
+ line_end_size?: NonNullable<ShapeDef["line_end_size"]>;
82
89
  path?: NonNullable<ShapeDef["path"]>;
83
90
  table?: ResolvedTable;
84
91
  chart?: ChartDef;
@@ -98,11 +105,13 @@ export interface ResolvedShape {
98
105
  bottom: number;
99
106
  };
100
107
  };
108
+ /** A component: its name, its props, and how long it moves (seconds; SLIDE_SECONDS when absent). */
101
109
  component?: {
102
110
  name: string;
103
111
  props: Record<string, unknown>;
112
+ dur?: number;
104
113
  };
105
- /** What slides.yaml set on its text (`text`), over what it inherits: a placeholder's own. */
114
+ /** What the slides file set on its text (`text`), over what it inherits: a placeholder's own. */
106
115
  fileText?: NonNullable<ShapeFile["text"]>;
107
116
  sources: {
108
117
  frame: ValueSource;
@@ -133,7 +142,7 @@ export interface ResolvedSlide {
133
142
  /** Seconds after it comes on that a show goes on by itself (`advance_after`). */
134
143
  advance?: number;
135
144
  notes?: string;
136
- /** Its place in slides.yaml's `slides`, and its block's generator for a generated slide. */
145
+ /** Its place in the slides file's `slides`, and its block's generator for a generated slide. */
137
146
  file: {
138
147
  index: number;
139
148
  generate?: string;
@@ -150,9 +159,9 @@ export interface DeckProblem {
150
159
  message: string;
151
160
  slide?: string;
152
161
  shape?: string;
153
- /** slides.yaml's path, when the problem is there. */
162
+ /** The slides file's path, when the problem is there. */
154
163
  path?: string;
155
- /** The stack of an exception slides.ts's code threw: its line is the problem's place. */
164
+ /** The stack of an exception the deck's module threw: its line is the problem's place. */
156
165
  stack?: string;
157
166
  }
158
167
  /** Words of the script: a text, a list of them (paragraphs, nested a level deeper), or none. */
@@ -160,7 +169,7 @@ export type Words = string | readonly Words[] | undefined;
160
169
  /** A table's cell as drawn: its text resolved, the rest as made. */
161
170
  export type ResolvedCell = Omit<TableCellDef, "text"> & {
162
171
  text: ResolvedText;
163
- /** What slides.yaml's row sets of its text. */
172
+ /** What the slides file's row sets of its text. */
164
173
  fileText?: NonNullable<ShapeFile["text"]>;
165
174
  };
166
175
  /** A table as drawn. */
@@ -177,7 +186,7 @@ export interface ResolveInput {
177
186
  /** The script's words of a key, `<prefix>.<slide>.<shape>` or `.notes`. */
178
187
  words: (key: string) => Words;
179
188
  prefix: string;
180
- /** The deck's folder, a project path: slides.yaml's paths are from it. */
189
+ /** The deck's module's folder, a project path: its slides file's paths are from it. */
181
190
  base: string;
182
191
  /** The theme under the deck's own: the project's look as a theme. */
183
192
  theme?: Theme;
@@ -190,7 +199,7 @@ export declare function joinPath(base: string, rel: string): string;
190
199
  export declare function levelsOver(base: readonly LevelStyle[], ...over: (LevelsDef | undefined)[]): LevelStyle[];
191
200
  /** What the text of a shape that is not a placeholder starts from under a master: PowerPoint's own, then the master's other style. */
192
201
  export declare const plainLevels: (master: MasterDef) => LevelStyle[];
193
- /** A colour slides.yaml names (its format has checked it): the theme's, lighter or darker, or `#RRGGBB`. */
202
+ /** A colour the slides file names (its format has checked it): the theme's, lighter or darker, or `#RRGGBB`. */
194
203
  export declare const colorOfFile: (c: string) => Color;
195
204
  /** Paragraphs from the script's words: a line each; a list's items each a paragraph, a nested list a level deeper; `**bold**`, `*italic*`, `` `code` `` (in the font `code` names) and spans (WORDS_SPAN) as runs. */
196
205
  export declare function paragraphsOfWords(words: Words, level?: number, code?: string): ParagraphDef[];
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{colorOfFile as Q}from"@allyhub/formats";import{readMarks as ge,markRuns as _e}from"@allyhub/video-core";import{chartOfFile as be}from"@allyhub/chart";import{AUTOSHAPE_STYLE as C,SHADOW_DEFAULTS as H,CONNECTOR_STYLE as ee,DRAWN_TEXTBOX_FRAME as ne,TEXT_FALLBACK as te,TEXT_INSETS as W,isConnectorGeometry as ye,placeholderFrame as $e,styleKindOf as xe}from"./office.js";import{resolveAnimation as we,resolveTransition as ie}from"./animation.js";import{pathSteps as ke}from"./path.js";import{masterPlaceholder as ve}from"./placeholders.js";import{DECK_FONTS as Se,OFFICE_THEME as Ae,themeOver as Oe}from"./theme.js";import{Pt as S}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const u=i===""?[]:i.split("/");for(const o of t.split("/"))o===""||o==="."||(o===".."?u.pop():u.push(o));return u.join("/")}const re={left:0,top:0,width:0,height:0},U=()=>Array.from({length:9},()=>({...te,font:{...te.font},margin_left:0}));export function levelsOver(i,...t){return i.map((u,o)=>{let r={...u,font:{...u.font}};for(const y of t){const l=y?.[o];l&&(r={...r,...l.alignment===void 0?{}:{alignment:l.alignment},...l.line_spacing===void 0?{}:{line_spacing:l.line_spacing},...l.space_before===void 0?{}:{space_before:l.space_before},...l.space_after===void 0?{}:{space_after:l.space_after},...l.margin_left===void 0?{}:{margin_left:l.margin_left},...l.indent===void 0?{}:{indent:l.indent},font:{...r.font,...l.font}},l.numbered!==void 0&&(r.numbered=l.numbered,delete r.bullet),l.bullet===null?(delete r.bullet,delete r.numbered):l.bullet!==void 0?(delete r.numbered,r.bullet={char:l.bullet,...l.bullet_font===void 0?{}:{font:l.bullet_font}}):l.bullet_font!==void 0&&r.bullet&&(r.bullet={...r.bullet,font:l.bullet_font}))}return r})}function I(i,...t){const u=t.filter(r=>r!==void 0),o=r=>{for(let y=u.length-1;y>=0;y--){const l=u[y]?.[r];if(l!==void 0)return l}};return{vertical_anchor:o("vertical_anchor")??i.vertical_anchor,auto_size:o("auto_size")??i.auto_size,word_wrap:o("word_wrap")??i.word_wrap,margins:{left:o("margin_left")??W.left,top:o("margin_top")??W.top,right:o("margin_right")??W.right,bottom:o("margin_bottom")??W.bottom}}}const oe={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(U(),i.text_styles.other);function V(i,t){return{...I(oe,t),levels:levelsOver(U(),i.text_styles.other,t.levels)}}function Te(i,t,...u){return{...I($e(t),...u),levels:levelsOver(U(),i.text_styles[xe(t)],...u.map(o=>o?.levels))}}const je=Array.from({length:9},()=>({font:{color:C.font_color}})),ae={vertical_anchor:C.vertical_anchor};function le(i,t){return{...I(oe,t),levels:levelsOver(U(),i.text_styles.other,je,t.levels)}}const X=i=>{const t={...i};return delete t.paragraphs,t},G=i=>({paragraphs:[],levels:[],...i}),z=i=>i==="none"?null:colorOfFile(i),Ee=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,Fe=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike)="([^"\n]*)"/gu,K=57344,Ne=256,de="",ze=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>Q(i)??"dk1";function Z(i){const{shadow:t,gradient:u}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...u?{gradient:{angle:u.angle??0,stops:u.stops.map(o=>({at:o.at,color:colorOfFile(o.color),...o.transparency===void 0?{}:{transparency:o.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?H.color:colorOfFile(t.color),blur:t.blur===void 0?H.blur:S(t.blur),distance:t.distance===void 0?H.distance:S(t.distance),angle:t.angle??H.angle,transparency:t.transparency??H.transparency}}:{}}}function se(i,t,u=[]){return{...i,rows:i.rows.map((o,r)=>({height:o.height,cells:o.cells.map(y=>{const l=u[r];return{...y,text:{paragraphs:y.text.paragraphs,style:B({...V(t,y.text),auto_size:"shape"},l),own:X(y.text),empty:!1},...l?{fileText:l}:{}}})}))}}function B(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},levels:i.levels.map(u=>{const o={...u.font,...t.size===void 0?{}:{size:S(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(o.color=colorOfFile(t.color));const r={...u,font:o,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:S(t.space_before)},...t.space_after===void 0?{}:{space_after:S(t.space_after)}};return t.numbered!==void 0?(r.numbered=t.numbered,delete r.bullet):t.bullet===!1?(delete r.bullet,delete r.numbered):t.bullet!==void 0&&(r.bullet={char:t.bullet},delete r.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&u.margin_left===0?{...r,margin_left:fe,indent:-fe}:r})}:i}function Me(i,t){if(!t)return[...i];const u=t.numbered!==void 0||t.bullet!==void 0;return i.map(o=>{const r={...o};return t.align!==void 0&&delete r.alignment,t.line_spacing!==void 0&&delete r.line_spacing,t.space_before!==void 0&&delete r.space_before,t.space_after!==void 0&&delete r.space_after,u&&(delete r.bullet,delete r.bullet_font,delete r.numbered),r})}function Ce(i){const t={};for(const[,u,o=""]of i.matchAll(Fe))if(u==="font")t.name=o.trim();else if(u==="link")t.link=o.trim();else if(u==="highlight")t.highlight=o.trim().toUpperCase();else if(u==="bold")t.bold=o.trim()!=="false";else if(u==="italic")t.italic=o.trim()!=="false";else if(u==="strike")t.strike=o.trim()!=="false";else if(u==="underline")t.underline=o.trim()!=="false";else if(u==="size"){const r=Number(o);Number.isFinite(r)&&r>0&&(t.size=S(r))}else if(u==="baseline"){const r=Number(o);Number.isFinite(r)&&(t.baseline=r)}else{const r=Q(o.trim());r!==void 0&&(t.color=r)}return t}const fe=342900;export function paragraphsOfWords(i,t=0,u=Se.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(o=>{const r=[],y=o.replace(Ee,(T,N,P)=>(r.push(Ce(N)),`${String.fromCharCode(K+r.length-1)}${P}${de}`)),l=ge(y);let F;const M=_e(l.text,l.marks).flatMap(T=>{const N=T.kinds.includes("code"),P={...T.kinds.includes("strong")?{bold:!0}:{},...T.kinds.includes("em")?{italic:!0}:{},...N?{name:u}:{}};return[...T.text.matchAll(ze)].flatMap(Y=>{const L=Y[0],R=L.charCodeAt(0);if(L===de)return F=void 0,[];if(R>=K&&R<K+Ne)return F=r[R-K],[];const D={...F,...P};return[{text:L,...Object.keys(D).length>0?{font:D}:{},...N?{code:!0}:{}}]})});return{runs:M.length>0?M:[{text:""}],level:t}}):i.flatMap(o=>paragraphsOfWords(o,Array.isArray(o)?Math.min(t+1,8):t,u))}const ue=i=>({left:S(i.x),top:S(i.y),width:S(i.w),height:S(i.h)}),Pe=new Set(["dt","ftr","sldNum"]),ce=i=>({...i.locked?{locked:!0}:{},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function pe(i,t,u){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const o=t.gradient&&Z({gradient:t.gradient}).gradient;o&&(i.background_gradient=o),t.picture!==void 0&&(i.background_picture=joinPath(u,t.picture))}const he=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:u,words:o,prefix:r,base:y}=i,l=[],F=Oe(i.theme??Ae,t.theme),M=new Map;for(const e of t.masters)for(const n of e.layouts)M.set(n.name,{layout:n,master:e});const T=[],N=(e,n,a)=>({name:e.name,kind:e.kind,frame:{...e.frame??re},...e.flip?{flip:{...e.flip}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?le(a,e.text):V(a,e.text),own:X(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow?{shadow:e.shadow}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.path?{path:e.path}:{},...e.table?{table:se(e.table,a)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const a=e.placeholder?.type??"body",g=ve(n,a),_=e.frame??g?.frame??re;return{name:e.name,kind:"placeholder",frame:{..._},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:Te(n,a,g?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!g?"layout":"master"},text:{from:"layout"}}}},Y=(e,n,a)=>{const g=t.components[e];if(!g){l.push({...a,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in slides.ts (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const _ of Object.keys(n??{}))Object.hasOwn(g.props,_)||l.push({...a,message:`Component ${e} has no prop ${_} a person sets (it has ${Object.keys(g.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}}}},L=(e,n,a,g,_)=>{const $={slide:g,shape:e,path:a};if(!n.frame){l.push({...$,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const w=ue(n.frame),d={frame:{from:"slide",path:`${a}.frame`}},b={name:e,frame:w,level:"slide",...n.fill===void 0?{}:{fill:z(n.fill)},...Z(n),...n.line===void 0?{}:{line:z(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.group===void 0?{}:{group:n.group},...ce(n)};if(n.textbox)return{...b,kind:"textbox",text:{paragraphs:paragraphsOfWords(o(`${r}.${g}.${e}`),0,F.fonts.code),style:B(V(_,G(ne)),n.text),own:X(G(ne)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...d,text:{from:"slide",path:`${a}.text`}}};if(n.picture!==void 0){const s=he(n.crop);return{...b,kind:"picture",media:{path:joinPath(y,n.picture),...s?{crop:s}:{}},sources:{...d,media:{from:"slide",path:`${a}.picture`}}}}if(n.movie!==void 0)return{...b,kind:"movie",media:{path:joinPath(y,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:{...d,media:{from:"slide",path:`${a}.movie`}}};if(n.chart){const s=o(`${r}.${g}.${e}`),k=be(n.chart,{title:typeof s=="string"?s:void 0,base:y,rows:m=>i.data?.(m),problem:m=>{l.push({...$,message:`Chart ${e}: ${m}`})}});return k?{...b,kind:"chart",chart:k,sources:d}:void 0}if(n.table){const s=n.table,k=w.width/s.columns.reduce((f,c)=>f+c,0),m=w.height/s.rows.reduce((f,c)=>f+c.height,0),x=o(`${r}.${g}.${e}`),O=Array.isArray(x)?x:[];return O.length>s.rows.length&&l.push({...$,message:`Table ${e} has ${String(s.rows.length)} rows and its words ${String(O.length)}.`}),{...b,kind:"table",table:se({columns:s.columns.map(f=>Math.round(f*k)),rows:s.rows.map((f,c)=>{const p=O[c],v=Array.isArray(p)?p:p===void 0?[]:[p];return{height:Math.round(f.height*m),cells:s.columns.map((j,A)=>({text:{levels:[],paragraphs:paragraphsOfWords(v[A],0,F.fonts.code)},...f.fill===void 0?{}:{fill:colorOfFile(f.fill)},...f.line===void 0?{}:{borders:{bottom:{color:colorOfFile(f.line),width:S(1)}}}}))}})},_,s.rows.map(f=>f.text)),sources:d}}const h=n.path&&ke(n.path.d);if(n.path&&!h){l.push({...$,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&h){const s=!n.path&&ye(n.geometry);return{...b,kind:"autoshape",...n.path&&h?{path:{w:n.path.w,h:n.path.h,steps:h}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...s?{line:n.line===void 0?ee.line:z(n.line),line_width:n.line_width===void 0?ee.line_width:S(n.line_width)}:{fill:n.fill===void 0?C.fill:z(n.fill),line:n.line===void 0?C.line:z(n.line),line_width:n.line_width===void 0?C.line_width:S(n.line_width)},...n.text&&!s?{fileText:{...n.text}}:{},...s?{}:{text:{paragraphs:paragraphsOfWords(o(`${r}.${g}.${e}`)).map(k=>n.text?.align===void 0?{alignment:C.alignment,...k}:k),style:B(le(_,G(ae)),n.text),own:X(G(ae)),empty:!1}},sources:{...d,fill:{from:"slide",path:`${a}.fill`}}}}if(n.component!==void 0){const s=Y(n.component,n.props,$);return s?{...b,kind:"component",component:s,sources:d}:void 0}},R=(e,n,a)=>{if(n.frame&&(e.frame=ue(n.frame),e.sources.frame={from:"slide",path:`${a}.frame`}),Object.assign(e,ce(n)),n.text&&e.text&&(e.text.style=B(e.text.style,n.text),e.text.paragraphs=Me(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${a}.text`}),n.line!==void 0&&(e.line=z(n.line),e.sources.line={from:"slide",path:`${a}.line`}),n.line_width!==void 0&&(e.line_width=S(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.fill!==void 0&&(e.fill=z(n.fill),e.sources.fill={from:"slide",path:`${a}.fill`}),Object.assign(e,Z(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const g=he(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(y,n.picture??n.movie??""),...g?{crop:g}:{},...n.poster===void 0?{}:{poster:n.poster}},e.sources.media={from:"slide",path:`${a}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}},D=(e,n,a,g,_)=>{const $=M.get(n);if(!$){l.push({slide:e,path:`slides.${String(a)}.layout`,message:`Slide ${e} is on the layout "${n}", which slides.ts does not have (it has ${[...M.keys()].join(", ")||"none"}).`});return}const{layout:w,master:d}=$,b=[...(w.display_master_shapes===!1?[]:d.shapes).filter(s=>s.kind!=="placeholder").map(s=>N(s,"master",d)),...w.shapes.filter(s=>s.kind!=="placeholder").map(s=>N(s,"layout",d))],h=w.shapes.filter(s=>s.kind==="placeholder").map((s,k)=>({shape:P(s,d),order:k}));return{slide:{id:e,layout:w.name,master:d.name,hidden:g,background:w.background??d.background,shapes:b,animations:[],file:{index:a,..._===void 0?{}:{generate:_}}},placed:h,master:d}},q=(e,n,a,g,_,$,w,d,b,h=()=>{})=>{const s=new Set(a.map(f=>f.shape.name));let k=a.length;for(const[f,c]of Object.entries(g??{})){const p=$(f);if(p===void 0)continue;const v=`${_}.shapes.${f}`,j=c.textbox!==void 0||c.geometry!==void 0||c.path!==void 0||c.table!==void 0||c.chart!==void 0||c.component!==void 0||(c.picture!==void 0||c.movie!==void 0)&&!s.has(p),A=a.find(me=>me.shape.name===p);if(A&&!j){R(A.shape,c,v),A.shown=!0,c.z!==void 0&&(A.z=c.z);continue}if(A){l.push({slide:e.id,shape:p,path:v,message:`Slide ${e.id} has a ${A.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!j){l.push({slide:e.id,shape:p,path:v,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...s].join(", ")||"none"}).`});continue}const E=L(p,c,v,e.id,n);E&&(a.push({shape:E,order:k++,...c.z===void 0?{}:{z:c.z}}),s.add(p))}const m=a.filter(f=>f.shown===!0||!Pe.has(f.shape.placeholder?.type??"")||w(f.shape)!==void 0);a.splice(0,a.length,...m),a.sort((f,c)=>(f.z??0)-(c.z??0)||f.order-c.order);const x=new Map(a.flatMap((f,c)=>f.shape.group===void 0?[]:[[f.shape.group,c]])),O=a.flatMap((f,c)=>{const p=f.shape.group;return p===void 0?[f]:x.get(p)===c?a.filter(v=>v.shape.group===p):[]});a.splice(0,a.length,...O);for(const f of a){const c=h(f.shape);c!==void 0&&(f.shape.alt=c);const p=f.shape.text;if(f.shape.kind==="placeholder"&&p){const v=w(f.shape);p.paragraphs=paragraphsOfWords(v,0,F.fonts.code),p.empty=p.paragraphs.length===0||p.paragraphs.every(j=>j.runs.every(A=>A.text===""))}}e.shapes.push(...a.map(f=>f.shape)),d!==void 0&&d.trim()!==""&&(e.notes=d);for(const[f,c]of(b??[]).entries()){const p=$(c.shape);if(p===void 0)continue;const v={slide:e.id,shape:p,path:`${_}.animations.${String(f)}`},j=e.shapes.find(E=>E.name===p&&E.level==="slide");if(!j){l.push({...v,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(E=>E.level==="slide").map(E=>E.name).join(", ")}).`});continue}if(c.paragraph!==void 0&&c.paragraph>=(j.text?.paragraphs.length??0)){l.push({...v,message:`Shape ${p} has no paragraph ${String(c.paragraph)} to animate (it has ${String(j.text?.paragraphs.length??0)}).`});continue}const A=we({...c,shape:p});A?e.animations.push(A):l.push({...v,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},J=new Set;return u.slides.forEach((e,n)=>{const a=`slides.${String(n)}`;if(e.layout!==void 0){const d=D(e.id,e.layout,n,e.hidden===!0);if(!d)return;const b=o(`${r}.${e.id}.notes`);e.transition&&(d.slide.transition=ie(e.transition)),e.advance_after!==void 0&&(d.slide.advance=e.advance_after),pe(d.slide,e.background,y),q(d.slide,d.master,d.placed,e.shapes,a,h=>h,h=>o(`${r}.${e.id}.${h.name}`),typeof b=="string"?b:void 0,e.animations,h=>{const s=o(`${r}.${e.id}.alt.${h.name}`);return typeof s=="string"?s:void 0}),T.push(d.slide),J.add(e.id);return}const g=e.generate??"",_=t.generators[g];if(_===void 0){l.push({slide:e.id,path:`${a}.generate`,message:`There is no generator ${g} in slides.ts (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(_)){l.push({slide:e.id,path:`${a}.generate`,message:`Generator ${g} threw: ${_.error}`,..._.stack===void 0?{}:{stack:_.stack}});return}const $=_,w=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const d of $){const b=`${e.id}/${d.id}`,h=D(b,d.layout,n,w.has(d.id),g);if(!h)continue;for(const m of d.shapes){const x=m.placeholder?h.placed.find(O=>O.shape.placeholder?.idx===m.placeholder?.idx):void 0;if(x)m.frame&&(x.shape.frame={...m.frame}),x.shape.sources.frame={from:"code"},x.shown=!0;else{const O=N(m,"layout",h.master);h.placed.push({shape:{...O,level:"slide",sources:{frame:{from:"code"}}},order:h.placed.length})}}const s=`${d.id}/`,k=d.transition??(d===$[0]?e.transition:void 0);pe(h.slide,e.background,y),k&&(h.slide.transition=ie(k)),q(h.slide,h.master,h.placed,e.shapes,a,m=>m.startsWith(s)?m.slice(s.length):void 0,m=>{const x=m.placeholder===void 0?void 0:d.text[m.placeholder.idx];return x===void 0?void 0:x.map(O=>O.runs.map(f=>f.text).join(""))},d.notes,[...(d.animations??[]).map(m=>({...m,shape:`${s}${m.shape}`})),...e.animations??[]]);for(const m of h.slide.shapes){const x=m.placeholder===void 0?void 0:d.text[m.placeholder.idx];x&&m.text&&(m.text.paragraphs=x,m.text.empty=!1)}T.push(h.slide),J.add(b)}for(const d of Object.keys(e.shapes??{})){const[b]=d.split("/");b!==void 0&&!$.some(h=>h.id===b)&&l.push({slide:e.id,path:`${a}.shapes.${d}`,message:`Generator ${g} makes no slide ${b}: ${d} changes nothing.`})}}),T.forEach((e,n)=>{for(const a of e.shapes)a.placeholder?.type==="sldNum"&&a.text&&(a.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],a.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:F,slides:T},problems:l}}
2
+ import{colorOfFile as ee}from"@allyhub/formats";import{readMarks as _e,markRuns as be}from"@allyhub/piece";import{chartOfFile as ye}from"@allyhub/chart";import{AUTOSHAPE_STYLE as C,SHADOW_DEFAULTS as H,CONNECTOR_STYLE as ne,DRAWN_TEXTBOX_FRAME as te,TEXT_FALLBACK as ie,TEXT_INSETS as W,isConnectorGeometry as $e,placeholderFrame as xe,styleKindOf as we}from"./office.js";import{resolveAnimation as ke,resolveTransition as oe}from"./animation.js";import{glued as ve}from"./connect.js";import{pathSteps as Se}from"./path.js";import{masterPlaceholder as Ae}from"./placeholders.js";import{DECK_FONTS as Oe,OFFICE_THEME as ze,themeOver as Te}from"./theme.js";import{Pt as O}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const u=[];for(const r of[...i.split("/"),...t.split("/")])r===""||r==="."||(r===".."?u.pop():u.push(r));return u.join("/")}const re={left:0,top:0,width:0,height:0},U=()=>Array.from({length:9},()=>({...ie,font:{...ie.font},margin_left:0}));export function levelsOver(i,...t){return i.map((u,r)=>{let o={...u,font:{...u.font}};for(const $ of t){const l=$?.[r];l&&(o={...o,...l.alignment===void 0?{}:{alignment:l.alignment},...l.line_spacing===void 0?{}:{line_spacing:l.line_spacing},...l.space_before===void 0?{}:{space_before:l.space_before},...l.space_after===void 0?{}:{space_after:l.space_after},...l.margin_left===void 0?{}:{margin_left:l.margin_left},...l.indent===void 0?{}:{indent:l.indent},font:{...o.font,...l.font}},l.numbered!==void 0&&(o.numbered=l.numbered,delete o.bullet),l.bullet===null?(delete o.bullet,delete o.numbered):l.bullet!==void 0?(delete o.numbered,o.bullet={char:l.bullet,...l.bullet_font===void 0?{}:{font:l.bullet_font}}):l.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:l.bullet_font}))}return o})}function I(i,...t){const u=t.filter(o=>o!==void 0),r=o=>{for(let $=u.length-1;$>=0;$--){const l=u[$]?.[o];if(l!==void 0)return l}};return{vertical_anchor:r("vertical_anchor")??i.vertical_anchor,auto_size:r("auto_size")??i.auto_size,word_wrap:r("word_wrap")??i.word_wrap,margins:{left:r("margin_left")??W.left,top:r("margin_top")??W.top,right:r("margin_right")??W.right,bottom:r("margin_bottom")??W.bottom}}}const ae={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(U(),i.text_styles.other);function V(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,t.levels)}}function je(i,t,...u){return{...I(xe(t),...u),levels:levelsOver(U(),i.text_styles[we(t)],...u.map(r=>r?.levels))}}const Ee=Array.from({length:9},()=>({font:{color:C.font_color}})),de={vertical_anchor:C.vertical_anchor};function le(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,Ee,t.levels)}}const X=i=>{const t={...i};return delete t.paragraphs,t},G=i=>({paragraphs:[],levels:[],...i}),N=i=>i==="none"?null:colorOfFile(i),Fe=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,Ne=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike)="([^"\n]*)"/gu,K=57344,Me=256,se="",Ce=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>ee(i)??"dk1";function Z(i){const{shadow:t,gradient:u}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...u?{gradient:{angle:u.angle??0,stops:u.stops.map(r=>({at:r.at,color:colorOfFile(r.color),...r.transparency===void 0?{}:{transparency:r.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?H.color:colorOfFile(t.color),blur:t.blur===void 0?H.blur:O(t.blur),distance:t.distance===void 0?H.distance:O(t.distance),angle:t.angle??H.angle,transparency:t.transparency??H.transparency}}:{}}}function fe(i,t,u=[]){return{...i,rows:i.rows.map((r,o)=>({height:r.height,cells:r.cells.map($=>{const l=u[o];return{...$,text:{paragraphs:$.text.paragraphs,style:B({...V(t,$.text),auto_size:"shape"},l),own:X($.text),empty:!1},...l?{fileText:l}:{}}})}))}}function B(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},levels:i.levels.map(u=>{const r={...u.font,...t.size===void 0?{}:{size:O(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(r.color=colorOfFile(t.color));const o={...u,font:r,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:O(t.space_before)},...t.space_after===void 0?{}:{space_after:O(t.space_after)}};return t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&u.margin_left===0?{...o,margin_left:ue,indent:-ue}:o})}:i}function Pe(i,t){if(!t)return[...i];const u=t.numbered!==void 0||t.bullet!==void 0;return i.map(r=>{const o={...r};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,u&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}function Le(i){const t={};for(const[,u,r=""]of i.matchAll(Ne))if(u==="font")t.name=r.trim();else if(u==="link")t.link=r.trim();else if(u==="highlight")t.highlight=r.trim().toUpperCase();else if(u==="bold")t.bold=r.trim()!=="false";else if(u==="italic")t.italic=r.trim()!=="false";else if(u==="strike")t.strike=r.trim()!=="false";else if(u==="underline")t.underline=r.trim()!=="false";else if(u==="size"){const o=Number(r);Number.isFinite(o)&&o>0&&(t.size=O(o))}else if(u==="baseline"){const o=Number(r);Number.isFinite(o)&&(t.baseline=o)}else{const o=ee(r.trim());o!==void 0&&(t.color=o)}return t}const ue=342900;export function paragraphsOfWords(i,t=0,u=Oe.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(r=>{const o=[],$=r.replace(Fe,(j,F,P)=>(o.push(Le(F)),`${String.fromCharCode(K+o.length-1)}${P}${se}`)),l=_e($);let E;const M=be(l.text,l.marks).flatMap(j=>{const F=j.kinds.includes("code"),P={...j.kinds.includes("strong")?{bold:!0}:{},...j.kinds.includes("em")?{italic:!0}:{},...F?{name:u}:{}};return[...j.text.matchAll(Ce)].flatMap(Y=>{const L=Y[0],R=L.charCodeAt(0);if(L===se)return E=void 0,[];if(R>=K&&R<K+Me)return E=o[R-K],[];const D={...E,...P};return[{text:L,...Object.keys(D).length>0?{font:D}:{},...F?{code:!0}:{}}]})});return{runs:M.length>0?M:[{text:""}],level:t}}):i.flatMap(r=>paragraphsOfWords(r,Array.isArray(r)?Math.min(t+1,8):t,u))}const ce=i=>({left:O(i.x),top:O(i.y),width:O(i.w),height:O(i.h)}),Re=new Set(["dt","ftr","sldNum"]),pe=i=>({...i.locked?{locked:!0}:{},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function he(i,t,u){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const r=t.gradient&&Z({gradient:t.gradient}).gradient;r&&(i.background_gradient=r),t.picture!==void 0&&(i.background_picture=joinPath(u,t.picture))}const me=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:u,words:r,prefix:o,base:$}=i,l=[],E=Te(i.theme??ze,t.theme),M=new Map;for(const e of t.masters)for(const n of e.layouts)M.set(n.name,{layout:n,master:e});const j=[],F=(e,n,a)=>({name:e.name,kind:e.kind,frame:{...e.frame??re},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?le(a,e.text):V(a,e.text),own:X(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow===void 0?{}:{shadow:e.shadow},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size},...e.path?{path:e.path}:{},...e.table?{table:fe(e.table,a)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const a=e.placeholder?.type??"body",m=Ae(n,a),_=e.frame??m?.frame??re;return{name:e.name,kind:"placeholder",frame:{..._},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:je(n,a,m?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!m?"layout":"master"},text:{from:"layout"}}}},Y=(e,n,a,m)=>{const _=t.components[e];if(!_){l.push({...a,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const b of Object.keys(n??{}))Object.hasOwn(_.props,b)||l.push({...a,message:`Component ${e} has no prop ${b} a person sets (it has ${Object.keys(_.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...m===void 0?{}:{dur:m}}},L=(e,n,a,m,_)=>{const b={slide:m,shape:e,path:a};if(!n.frame){l.push({...b,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const w=ce(n.frame),s={frame:{from:"slide",path:`${a}.frame`}},y={name:e,frame:w,level:"slide",...n.fill===void 0?{}:{fill:N(n.fill)},...Z(n),...n.line===void 0?{}:{line:N(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.line_begin_size===void 0?{}:{line_begin_size:n.line_begin_size},...n.line_end_size===void 0?{}:{line_end_size:n.line_end_size},...n.group===void 0?{}:{group:n.group},...pe(n)};if(n.textbox)return{...y,kind:"textbox",text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`),0,E.fonts.code),style:B(V(_,G(te)),n.text),own:X(G(te)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...s,text:{from:"slide",path:`${a}.text`}}};if(n.picture!==void 0){const f=me(n.crop);return{...y,kind:"picture",media:{path:joinPath($,n.picture),...f?{crop:f}:{}},sources:{...s,media:{from:"slide",path:`${a}.picture`}}}}if(n.movie!==void 0)return{...y,kind:"movie",media:{path:joinPath($,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:{...s,media:{from:"slide",path:`${a}.movie`}}};if(n.chart){const f=r(`${o}.${m}.${e}`),S=ye(n.chart,{title:typeof f=="string"?f:void 0,base:$,rows:g=>i.data?.(g),problem:g=>{l.push({...b,message:`Chart ${e}: ${g}`})}});return S?{...y,kind:"chart",chart:S,sources:s}:void 0}if(n.table){const f=n.table,S=w.width/f.columns.reduce((d,c)=>d+c,0),g=w.height/f.rows.reduce((d,c)=>d+c.height,0),v=r(`${o}.${m}.${e}`),z=Array.isArray(v)?v:[];return z.length>f.rows.length&&l.push({...b,message:`Table ${e} has ${String(f.rows.length)} rows and its words ${String(z.length)}.`}),{...y,kind:"table",table:fe({columns:f.columns.map(d=>Math.round(d*S)),rows:f.rows.map((d,c)=>{const p=z[c],x=Array.isArray(p)?p:p===void 0?[]:[p];return{height:Math.round(d.height*g),cells:f.columns.map((k,A)=>({text:{levels:[],paragraphs:paragraphsOfWords(x[A],0,E.fonts.code)},...d.fill===void 0?{}:{fill:colorOfFile(d.fill)},...d.line===void 0?{}:{borders:{bottom:{color:colorOfFile(d.line),width:O(1)}}}}))}})},_,f.rows.map(d=>d.text)),sources:s}}const h=n.path&&Se(n.path.d);if(n.path&&!h){l.push({...b,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&h){const f=!n.path&&$e(n.geometry);return{...y,kind:"autoshape",...n.path&&h?{path:{w:n.path.w,h:n.path.h,steps:h}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...f?{line:n.line===void 0?ne.line:N(n.line),line_width:n.line_width===void 0?ne.line_width:O(n.line_width)}:{fill:n.fill===void 0?C.fill:N(n.fill),line:n.line===void 0?C.line:N(n.line),line_width:n.line_width===void 0?C.line_width:O(n.line_width)},...n.text&&!f?{fileText:{...n.text}}:{},...f?{}:{text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`)).map(S=>n.text?.align===void 0?{alignment:C.alignment,...S}:S),style:B(le(_,G(de)),n.text),own:X(G(de)),empty:!1}},sources:{...s,fill:{from:"slide",path:`${a}.fill`}}}}if(n.component!==void 0){const f=Y(n.component,n.props,b,n.dur);return f?{...y,kind:"component",component:f,sources:s}:void 0}},R=(e,n,a)=>{if(n.frame&&(e.frame=ce(n.frame),e.sources.frame={from:"slide",path:`${a}.frame`}),Object.assign(e,pe(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=B(e.text.style,n.text),e.text.paragraphs=Pe(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${a}.text`}),n.line!==void 0&&(e.line=N(n.line),e.sources.line={from:"slide",path:`${a}.line`}),n.line_width!==void 0&&(e.line_width=O(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.line_begin_size!==void 0&&(e.line_begin_size=n.line_begin_size),n.line_end_size!==void 0&&(e.line_end_size=n.line_end_size),n.fill!==void 0&&(e.fill=N(n.fill),e.sources.fill={from:"slide",path:`${a}.fill`}),Object.assign(e,Z(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const m=me(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath($,n.picture??n.movie??""),...m?{crop:m}:{},...n.poster===void 0?{}:{poster:n.poster}},e.sources.media={from:"slide",path:`${a}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}},D=(e,n,a,m,_)=>{const b=M.get(n);if(!b){l.push({slide:e,path:`slides.${String(a)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...M.keys()].join(", ")||"none"}).`});return}const{layout:w,master:s}=b,y=[...(w.display_master_shapes===!1?[]:s.shapes).filter(f=>f.kind!=="placeholder").map(f=>F(f,"master",s)),...w.shapes.filter(f=>f.kind!=="placeholder").map(f=>F(f,"layout",s))],h=w.shapes.filter(f=>f.kind==="placeholder").map((f,S)=>({shape:P(f,s),order:S}));return{slide:{id:e,layout:w.name,master:s.name,hidden:m,background:w.background??s.background,shapes:y,animations:[],file:{index:a,..._===void 0?{}:{generate:_}}},placed:h,master:s}},q=(e,n,a)=>{if(!n)return;const m=w=>{const s=n[w];if(s===void 0)return e.connect?.[w];const y=s==="none"?void 0:a(s.shape);return s==="none"||y===void 0?void 0:{shape:y,site:s.site}},_=m("begin"),b=m("end");_||b?e.connect={..._?{begin:_}:{},...b?{end:b}:{}}:delete e.connect},J=(e,n,a,m,_,b,w,s,y,h=()=>{})=>{const f=new Set(a.map(d=>d.shape.name));let S=a.length;for(const[d,c]of Object.entries(m??{})){const p=b(d);if(p===void 0)continue;const x=`${_}.shapes.${d}`,k=c.textbox!==void 0||c.geometry!==void 0||c.path!==void 0||c.table!==void 0||c.chart!==void 0||c.component!==void 0||(c.picture!==void 0||c.movie!==void 0)&&!f.has(p),A=a.find(ge=>ge.shape.name===p);if(A&&!k){R(A.shape,c,x),q(A.shape,c.connect,b),A.shown=!0,c.z!==void 0&&(A.z=c.z);continue}if(A){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has a ${A.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!k){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...f].join(", ")||"none"}).`});continue}const T=L(p,c,x,e.id,n);T&&q(T,c.connect,b),T&&(a.push({shape:T,order:S++,...c.z===void 0?{}:{z:c.z}}),f.add(p))}const g=a.filter(d=>d.shown===!0||!Re.has(d.shape.placeholder?.type??"")||w(d.shape)!==void 0);a.splice(0,a.length,...g),a.sort((d,c)=>(d.z??0)-(c.z??0)||d.order-c.order);const v=new Map(a.flatMap((d,c)=>d.shape.group===void 0?[]:[[d.shape.group,c]])),z=a.flatMap((d,c)=>{const p=d.shape.group;return p===void 0?[d]:v.get(p)===c?a.filter(x=>x.shape.group===p):[]});a.splice(0,a.length,...z);for(const d of a){const c=h(d.shape);c!==void 0&&(d.shape.alt=c);const p=d.shape.text;if(d.shape.kind==="placeholder"&&p){const x=w(d.shape);p.paragraphs=paragraphsOfWords(x,0,E.fonts.code),p.empty=p.paragraphs.length===0||p.paragraphs.every(k=>k.runs.every(A=>A.text===""))}}e.shapes.push(...a.map(d=>d.shape));for(const d of e.shapes){const c=d.connect;if(!c)continue;const p=ve(d,x=>e.shapes.find(k=>k.name===x&&k.level===d.level&&k!==d));d.frame=p.frame,p.flip?d.flip=p.flip:delete d.flip;for(const x of p.lost){const k=c[x];k&&d.level==="slide"&&l.push({slide:e.id,shape:d.name,message:`Connector ${d.name}'s ${x} is glued to site ${String(k.site)} of ${k.shape}, which slide ${e.id} has not: it stays where it is.`})}}s!==void 0&&s.trim()!==""&&(e.notes=s);for(const[d,c]of(y??[]).entries()){const p=b(c.shape);if(p===void 0)continue;const x={slide:e.id,shape:p,path:`${_}.animations.${String(d)}`},k=e.shapes.find(T=>T.name===p&&T.level==="slide");if(!k){l.push({...x,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(T=>T.level==="slide").map(T=>T.name).join(", ")}).`});continue}if(c.paragraph!==void 0&&c.paragraph>=(k.text?.paragraphs.length??0)){l.push({...x,message:`Shape ${p} has no paragraph ${String(c.paragraph)} to animate (it has ${String(k.text?.paragraphs.length??0)}).`});continue}const A=ke({...c,shape:p});A?e.animations.push(A):l.push({...x,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},Q=new Set;return u.slides.forEach((e,n)=>{const a=`slides.${String(n)}`;if(e.layout!==void 0){const s=D(e.id,e.layout,n,e.hidden===!0);if(!s)return;const y=r(`${o}.${e.id}.notes`);e.transition&&(s.slide.transition=oe(e.transition)),e.advance_after!==void 0&&(s.slide.advance=e.advance_after),he(s.slide,e.background,$),J(s.slide,s.master,s.placed,e.shapes,a,h=>h,h=>r(`${o}.${e.id}.${h.name}`),typeof y=="string"?y:void 0,e.animations,h=>{const f=r(`${o}.${e.id}.alt.${h.name}`);return typeof f=="string"?f:void 0}),j.push(s.slide),Q.add(e.id);return}const m=e.generate??"",_=t.generators[m];if(_===void 0){l.push({slide:e.id,path:`${a}.generate`,message:`There is no generator ${m} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(_)){l.push({slide:e.id,path:`${a}.generate`,message:`Generator ${m} threw: ${_.error}`,..._.stack===void 0?{}:{stack:_.stack}});return}const b=_,w=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const s of b){const y=`${e.id}/${s.id}`,h=D(y,s.layout,n,w.has(s.id),m);if(!h)continue;for(const g of s.shapes){const v=g.placeholder?h.placed.find(z=>z.shape.placeholder?.idx===g.placeholder?.idx):void 0;if(v)g.frame&&(v.shape.frame={...g.frame}),v.shape.sources.frame={from:"code"},v.shown=!0;else{const z=F(g,"layout",h.master);h.placed.push({shape:{...z,level:"slide",sources:{frame:{from:"code"}}},order:h.placed.length})}}const f=`${s.id}/`,S=s.transition??(s===b[0]?e.transition:void 0);he(h.slide,e.background,$),S&&(h.slide.transition=oe(S)),J(h.slide,h.master,h.placed,e.shapes,a,g=>g.startsWith(f)?g.slice(f.length):void 0,g=>{const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];return v===void 0?void 0:v.map(z=>z.runs.map(d=>d.text).join(""))},s.notes,[...(s.animations??[]).map(g=>({...g,shape:`${f}${g.shape}`})),...e.animations??[]]);for(const g of h.slide.shapes){const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];v&&g.text&&(g.text.paragraphs=v,g.text.empty=!1)}j.push(h.slide),Q.add(y)}for(const s of Object.keys(e.shapes??{})){const[y]=s.split("/");y!==void 0&&!b.some(h=>h.id===y)&&l.push({slide:e.id,path:`${a}.shapes.${s}`,message:`Generator ${m} makes no slide ${y}: ${s} changes nothing.`})}}),j.forEach((e,n)=>{for(const a of e.shapes)a.placeholder?.type==="sldNum"&&a.text&&(a.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],a.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:E,slides:j},problems:l}}
@@ -0,0 +1,18 @@
1
+ import { presentationFor } from "./index.js";
2
+ /** python-pptx's length functions: each gives a Length, a number of EMU that says itself in other units (`Pt(12).pt`, `.inches`, `.cm`, `.mm`, `.emu`). */
3
+ export declare const Emu: (n: number) => import("./units.js").LengthValue, Inches: (n: number) => import("./units.js").LengthValue, Pt: (n: number) => import("./units.js").LengthValue, Cm: (n: number) => import("./units.js").LengthValue, Mm: (n: number) => import("./units.js").LengthValue, Centipoints: (n: number) => import("./units.js").LengthValue;
4
+ export { RGBColor, MSO_ANCHOR, CategoryChartData, MSO_ARROWHEAD, MSO_ARROWHEAD_SIZE, XL_CHART_TYPE, XL_LABEL_POSITION, XL_LEGEND_POSITION, MSO_AUTO_SIZE, MSO_CONNECTOR, MSO_FILL, MSO_LINE, MSO_LINE_DASH_STYLE, MSO_SHAPE, MSO_SHAPE_TYPE, MSO_THEME_COLOR, PP_ALIGN, PP_PARAGRAPH_ALIGNMENT, PP_PLACEHOLDER, THEME_FONT, SLIDE_SIZES, presentationFor, isDeck, type Anchor, type AutoSize, type Background, type Cell, type ColorFormat, type ComponentContext, type ComponentInput, type Deck, type FillFormat, type FreeformBuilder, type GradientStop, type GroupShape, type Font, type GeneratedSlide, type Generator, type Length, type LengthValue, type LineFormat, type ListLevel, type ListStyle, type Paragraph, type Placeholders, type PlaceholderType, type Presentation, type PresentationOptions, type PropSpec, type Run, type Shape, type ShapeCollection, type ShapeType, type SlideLayout, type SlideLayouts, type SlideMaster, type SlideMasters, type SlideSizeName, type Table, type TextFrame, type TextStyles, type ThemeInput, } from "./index.js";
5
+ /**
6
+ * A deck: the default export of a deck's module. Its function makes
7
+ * the presentation's slide masters, layouts, components and generators;
8
+ * its slides are in the slides file it names (`slides: "./q3.yaml"`), their
9
+ * words in its script (`script: "./q3.{locale}.yaml"`).
10
+ */
11
+ export declare const presentation: (options: import("./api.js").PresentationOptions | ((prs: import("./api.js").Presentation) => void), build?: (prs: import("./api.js").Presentation) => void) => import("./api.js").Deck;
12
+ /** presentation() made for a module (`{ file }`, a project path): what the build gives the file that imports this entry. */
13
+ export declare const slidesFor: (module: {
14
+ file: string;
15
+ }) => {
16
+ presentation: ReturnType<typeof presentationFor>;
17
+ };
18
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{LENGTH_UNITS as O,presentationFor as _}from"./index.js";export const{Emu,Inches,Pt,Cm,Mm,Centipoints}=O;export{RGBColor,MSO_ANCHOR,CategoryChartData,MSO_ARROWHEAD,MSO_ARROWHEAD_SIZE,XL_CHART_TYPE,XL_LABEL_POSITION,XL_LEGEND_POSITION,MSO_AUTO_SIZE,MSO_CONNECTOR,MSO_FILL,MSO_LINE,MSO_LINE_DASH_STYLE,MSO_SHAPE,MSO_SHAPE_TYPE,MSO_THEME_COLOR,PP_ALIGN,PP_PARAGRAPH_ALIGNMENT,PP_PLACEHOLDER,THEME_FONT,SLIDE_SIZES,presentationFor,isDeck}from"./index.js";export const presentation=_(""),slidesFor=E=>({presentation:_(E.file)});
@@ -1,16 +1,10 @@
1
+ import type { ComponentAt } from "@allyhub/piece";
1
2
  import type { DeckCode } from "./code.js";
2
- import type { ResolvedDeck } from "./resolve.js";
3
+ import type { DrawnDeck } from "./model.js";
4
+ import type { ResolvedDeck, ResolvedSlide } from "./resolve.js";
3
5
  import type { Theme } from "./theme.js";
4
- /** A component drawn alone, on a transparent page of its frame's size. */
5
- export interface ComponentAt {
6
- name: string;
7
- props: Record<string, unknown>;
8
- /** Its frame, in the stage's pixels. */
9
- width: number;
10
- height: number;
11
- /** Seconds since it came on: what moves in it has settled by its slide's still. */
12
- t: number;
13
- }
6
+ /** A component drawn alone, on a transparent page of its frame's size (the stage's). */
7
+ export type { ComponentAt };
14
8
  /** The editor to a frame. */
15
9
  export type DeckHostCommand =
16
10
  /** The code host: the deck's code as data (asked any time after the frame is made). */
@@ -58,4 +52,27 @@ export type DeckHostMessage =
58
52
  type: "error";
59
53
  message: string;
60
54
  };
55
+ /**
56
+ * What a deck's output answers on the stage beyond what every piece does
57
+ * (@allyhub/piece's StageOutput), called by name where a host knows it
58
+ * has a deck: what its PowerPoint file is written from, and a deck
59
+ * resolved again drawn in place.
60
+ */
61
+ export interface DeckOutput {
62
+ /** The deck as it was drawn: every slide drawn for it, with the share autofit shrank each text to. */
63
+ deck(): Promise<DrawnDeck<ResolvedSlide, Theme>>;
64
+ /**
65
+ * A deck resolved again for the same code, and media it shows that the
66
+ * stage was not given: the slides whose identity changed are drawn
67
+ * again in place, the rest kept as drawn. `reload`: the slides' timing
68
+ * changed, which the stage does not take in place (nothing changed).
69
+ */
70
+ update(deck: ResolvedDeck, media?: Readonly<Record<string, {
71
+ url: string;
72
+ duration?: number;
73
+ }>>): Promise<{
74
+ redrawn: string[];
75
+ reload?: true;
76
+ }>;
77
+ }
61
78
  //# sourceMappingURL=stage.d.ts.map
@@ -37,14 +37,14 @@ export declare const Pt: (n: number) => Length;
37
37
  export declare const Cm: (n: number) => Length;
38
38
  export declare const Mm: (n: number) => Length;
39
39
  export declare const Centipoints: (n: number) => Length;
40
- /** A length in points: slides.yaml's unit. */
40
+ /** A length in points: the slides file's unit. */
41
41
  export declare const toPt: (emu: Length) => number;
42
42
  /**
43
43
  * Slide sizes by name, in EMU (width × height). `16:9`, `16:10` and `4:3`
44
44
  * are PowerPoint's own (`16:9` is its Widescreen, 13.333 × 7.5 in); `a4`
45
45
  * and `letter` are the paper's own size, for a deck printed edge to edge
46
- * (PowerPoint's "A4 Paper" slide is 27.52 × 19.05 cm, inside the paper);
47
- * `1:1`, `4:5` and `9:16` are a carousel's and a story's.
46
+ * (PowerPoint's "A4 Paper" slide is 27.52 × 19.05 cm, inside the paper).
47
+ * A carousel is an image's boards, not a deck (docs/design/images.md, 5).
48
48
  */
49
49
  export declare const SLIDE_SIZES: {
50
50
  readonly "16:9": readonly [number, number];
@@ -54,9 +54,6 @@ export declare const SLIDE_SIZES: {
54
54
  readonly "a4-portrait": readonly [number, number];
55
55
  readonly letter: readonly [number, number];
56
56
  readonly "letter-portrait": readonly [number, number];
57
- readonly "1:1": readonly [number, number];
58
- readonly "4:5": readonly [number, number];
59
- readonly "9:16": readonly [number, number];
60
57
  };
61
58
  export type SlideSizeName = keyof typeof SLIDE_SIZES;
62
59
  //# sourceMappingURL=units.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- class o extends Number{get emu(){return this.valueOf()}get inches(){return this.valueOf()/EMU_PER_INCH}get cm(){return this.valueOf()/EMU_PER_CM}get mm(){return this.valueOf()/EMU_PER_MM}get pt(){return this.valueOf()/EMU_PER_PT}get centipoints(){return Math.trunc(this.valueOf()/EMU_PER_CENTIPOINT)}get twips(){return Math.trunc(this.valueOf()/(EMU_PER_PT/20))}}const r=new Map;export function length(t){const n=Math.trunc(t);let e=r.get(n);return e||(e=new o(n),r.set(n,e)),e}export const lengthOr=t=>t===void 0?void 0:length(t),held=t=>t instanceof Number||t instanceof String?t.valueOf():t,LENGTH_UNITS={Emu:t=>length(t),Inches:t=>length(t*EMU_PER_INCH),Pt:t=>length(t*EMU_PER_PT),Cm:t=>length(t*EMU_PER_CM),Mm:t=>length(t*EMU_PER_MM),Centipoints:t=>length(t*EMU_PER_CENTIPOINT)},EMU_PER_INCH=914400,EMU_PER_PT=12700,EMU_PER_CM=36e4,EMU_PER_MM=36e3,EMU_PER_CENTIPOINT=127,Emu=t=>Math.trunc(t),Inches=t=>Math.trunc(t*EMU_PER_INCH),Pt=t=>Math.trunc(t*EMU_PER_PT),Cm=t=>Math.trunc(t*EMU_PER_CM),Mm=t=>Math.trunc(t*EMU_PER_MM),Centipoints=t=>Math.trunc(t*EMU_PER_CENTIPOINT),toPt=t=>Math.round(t/EMU_PER_PT*100)/100,SLIDE_SIZES={"16:9":[Emu(12192e3),Emu(6858e3)],"16:10":[Emu(9144e3),Emu(5715e3)],"4:3":[Emu(9144e3),Emu(6858e3)],a4:[Mm(297),Mm(210)],"a4-portrait":[Mm(210),Mm(297)],letter:[Inches(11),Inches(8.5)],"letter-portrait":[Inches(8.5),Inches(11)],"1:1":[Emu(6858e3),Emu(6858e3)],"4:5":[Emu(6858e3),Emu(8572500)],"9:16":[Emu(6858e3),Emu(12192e3)]};
2
+ class o extends Number{get emu(){return this.valueOf()}get inches(){return this.valueOf()/EMU_PER_INCH}get cm(){return this.valueOf()/EMU_PER_CM}get mm(){return this.valueOf()/EMU_PER_MM}get pt(){return this.valueOf()/EMU_PER_PT}get centipoints(){return Math.trunc(this.valueOf()/EMU_PER_CENTIPOINT)}get twips(){return Math.trunc(this.valueOf()/(EMU_PER_PT/20))}}const r=new Map;export function length(t){const n=Math.trunc(t);let e=r.get(n);return e||(e=new o(n),r.set(n,e)),e}export const lengthOr=t=>t===void 0?void 0:length(t),held=t=>t instanceof Number||t instanceof String?t.valueOf():t,LENGTH_UNITS={Emu:t=>length(t),Inches:t=>length(t*EMU_PER_INCH),Pt:t=>length(t*EMU_PER_PT),Cm:t=>length(t*EMU_PER_CM),Mm:t=>length(t*EMU_PER_MM),Centipoints:t=>length(t*EMU_PER_CENTIPOINT)},EMU_PER_INCH=914400,EMU_PER_PT=12700,EMU_PER_CM=36e4,EMU_PER_MM=36e3,EMU_PER_CENTIPOINT=127,Emu=t=>Math.trunc(t),Inches=t=>Math.trunc(t*EMU_PER_INCH),Pt=t=>Math.trunc(t*EMU_PER_PT),Cm=t=>Math.trunc(t*EMU_PER_CM),Mm=t=>Math.trunc(t*EMU_PER_MM),Centipoints=t=>Math.trunc(t*EMU_PER_CENTIPOINT),toPt=t=>Math.round(t/EMU_PER_PT*100)/100,SLIDE_SIZES={"16:9":[Emu(12192e3),Emu(6858e3)],"16:10":[Emu(9144e3),Emu(5715e3)],"4:3":[Emu(9144e3),Emu(6858e3)],a4:[Mm(297),Mm(210)],"a4-portrait":[Mm(210),Mm(297)],letter:[Inches(11),Inches(8.5)],"letter-portrait":[Inches(8.5),Inches(11)]};
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@allyhub/slides-core",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
8
8
  "default": "./dist/index.js"
9
+ },
10
+ "./sdk": {
11
+ "types": "./dist/sdk.d.ts",
12
+ "default": "./dist/sdk.js"
9
13
  }
10
14
  },
11
15
  "sideEffects": false,
@@ -51,8 +51,7 @@ export interface MixLevels {
51
51
  }
52
52
  export interface MasterOptions {
53
53
  /**
54
- * Integrated loudness, LUFS (-70 to 0); default the platform profile's,
55
- * else -14. false keeps the mix's own level (peaks still limited).
54
+ * Integrated loudness, LUFS (-70 to 0); default -14. false keeps the mix's own level (peaks still limited).
56
55
  */
57
56
  lufs?: number | false;
58
57
  /** True-peak ceiling, dBTP (-9 to 0); default -3 (AAC overshoots up to about 2 dB). */
@@ -1,5 +1,4 @@
1
- import type { Word } from "./media.js";
2
- import type { CaptionOptions, CaptionTrackCue, CaptionWord } from "./piece.js";
1
+ import type { CaptionLine, Word, CaptionOptions, CaptionTrackCue, CaptionWord } from "@allyhub/piece";
3
2
  import type { PartText, Timeline } from "./timeline.js";
4
3
  export interface CaptionCue {
5
4
  start: number;
@@ -7,14 +6,6 @@ export interface CaptionCue {
7
6
  text: string;
8
7
  part: string;
9
8
  }
10
- export interface CaptionLine {
11
- part: string;
12
- /** The line as shown, and as spoken. */
13
- shown: string;
14
- spoken: string;
15
- /** The part's words on the film's clock. */
16
- words: readonly Word[];
17
- }
18
9
  export interface CaptionInput {
19
10
  /** Voiced parts in order. */
20
11
  lines: CaptionLine[];
@@ -1,5 +1,5 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{changesOf as K}from"./anchors.js";import{normText as p,joinWords as V,ScriptAlignment as v,WordStream as F}from"./words.js";import{speechWords as D}from"./speech.js";export const CAPTION_CUE_DEFAULTS={maxChars:42,maxCharsCjk:16,minSeconds:.8,maxSeconds:6,gapFrames:2};export function speechLines(c,s,i){return c.parts.flatMap(r=>{const o=r.speech,h=o?i[o.file]?.words:void 0;if(!o||!h?.length)return[];const a=D(h,o);if(a.length===0)return[];const n=s.find(t=>t.key===r.key),e=n?.spoken??V(a);return[{part:r.key,shown:e,spoken:n?.speak??e,words:a}]})}export function shownToSpoken(c,s){const i=(o,h)=>p(o.slice(0,h)).length,r=[[0,0]];for(const o of K(c,s))r.push([i(c,o.at),i(s,o.into)]),r.push([i(c,o.at+o.removed),i(s,o.into+o.inserted)]);return r.push([p(c).length,p(s).length]),o=>{for(let h=1;h<r.length;h++){const[a,n]=r[h-1]??[0,0],[e,t]=r[h]??[0,0];if(o>e&&h<r.length-1)continue;if(e<=a)return o<=a?n:t;const u=Math.max(0,Math.min(1,(o-a)/(e-a)));return n+(t-n)*u}return 0}}const b=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,G=/[。!?!?…]|\.(?=\s|$)/u,J=/[,、;:,;:—]/u,H=/[,、;:。,;:.\s]+$/u,P=(c,s)=>/[.,:;]/u.test(c[s]??"")&&/[0-9A-Za-z]/u.test(c[s+1]??"");export function keptSpans(c,s){const i=[],r=U(c).map(o=>({...o,n:p(o.w)}));for(const o of s){const h=p(o);if(!h)continue;if(b.test(o)){const n=[];Array.from(c).reduce((t,u)=>(p(u)&&n.push(t),t+u.length),0);const e=p(c);for(let t=e.indexOf(h);t>=0;t=e.indexOf(h,t+1)){const u=n[t],g=n[t+h.length-1];u!==void 0&&g!==void 0&&i.push([u,g+1])}continue}const a=o.split(/\s+/u).map(p).filter(Boolean);for(let n=0;n+a.length<=r.length;n++)if(a.every((e,t)=>r[n+t]?.n===e)){const e=r[n],t=r[n+a.length-1];e&&t&&i.push([e.from,t.to])}}return i}const _=(c,s)=>c.some(([i,r])=>s>i&&s<r);export function splitLine(c,s=b.test(c)?CAPTION_CUE_DEFAULTS.maxCharsCjk:CAPTION_CUE_DEFAULTS.maxChars,i=[]){const r=[],o=(a,n)=>{const e=c.slice(a,n),t=e.length-e.trimStart().length,u=e.trim();u&&r.push({text:u,from:a+t,to:a+t+u.length})},h=(a,n,e)=>{const t=c.slice(a,n);if(Array.from(t.trim()).length<=s){o(a,n);return}const g=e===0?G:e===1?J:void 0;if(g){let f=-1;for(let k=1;k<t.length-1;k++)g.test(t[k]??"")&&!P(t,k)&&!_(i,a+k+1)&&(f<0||Math.abs(k-t.length/2)<Math.abs(f-t.length/2))&&(f=k);if(f<0){h(a,n,e+1);return}h(a,a+f+1,e),h(a+f+1,n,e);return}const w=Math.floor(t.length/2),C=f=>f>0&&f<t.length&&!_(i,a+f);let x=-1;if(!b.test(t)){for(let f=w;f>0&&x<0;f--)t[f]===" "&&C(f)&&(x=f);for(let f=w;f<t.length&&x<0;f++)t[f]===" "&&C(f)&&(x=f)}for(let f=0;f<=t.length&&x<0;f++)C(w-f)?x=w-f:C(w+f)&&(x=w+f);if(x<0){o(a,n);return}h(a,a+x,e),h(a+x,n,e)};return h(0,c.length,0),r}export function captionCues(c,s={}){const{lines:i,fps:r}=c,o={...CAPTION_CUE_DEFAULTS,...s},h=[];for(const t of i){if(t.words.length===0)continue;const u=t.words,g=new v(new F(u),[t.spoken]),w=(M,l)=>{const d=u[g.wordAtChar(0,M)];return d?l?d.end:d.start:0};if((g.lines[0]?.length??0)===0)continue;const f=p(t.shown)===p(t.spoken)?M=>M:shownToSpoken(t.shown,t.spoken),k=b.test(t.shown)?o.maxCharsCjk:o.maxChars;for(const M of splitLine(t.shown,k)){const l=Math.round(f(p(t.shown.slice(0,M.from)).length)),d=Math.round(f(p(t.shown.slice(0,M.to)).length)),S=w(l,!1),A=w(Math.max(l,d-1),!0),T=b.test(M.text)?M.text.replace(H,""):M.text.replace(/[,;:]+$/u,"");T&&h.push({start:S,end:Math.max(A,S),text:T,part:t.part})}}const a=1/r,n=t=>Math.round(t*r)/r,e=h.map(t=>({...t,start:n(t.start),end:n(t.end)}));for(let t=0;t<e.length;t++){const u=e[t];if(!u)continue;const g=e[t+1],w=g?g.start-o.gapFrames*a:1/0;u.end=Math.min(Math.max(u.end,u.start+o.minSeconds),u.start+o.maxSeconds,w),u.end<=u.start&&(u.end=u.start+a)}return e}export function subtitleCues(c,s){return s===void 0?captionCues(c):wordCues(c.lines,{...s,fps:c.fps}).map(i=>({start:i.start,end:i.end,text:i.text,part:i.part}))}function U(c){const s=[],i=/\S+/gu;for(let r=i.exec(c);r;r=i.exec(c))s.push({w:r[0],from:r.index,to:r.index+r[0].length});return s}export function wordCues(c,s){const{fps:i}=s,r=[];for(const n of c){if(n.words.length===0)continue;const e=n.words,t=new v(new F(e),[n.spoken]);if((t.lines[0]?.length??0)===0)continue;const g=(l,d)=>{const S=e[t.wordAtChar(0,l)];return S?d?S.end:S.start:0},C=p(n.shown)===p(n.spoken)?l=>l:shownToSpoken(n.shown,n.spoken),x=(l,d)=>{const S=Math.round(C(p(n.shown.slice(0,l)).length)),A=Math.round(C(p(n.shown.slice(0,d)).length));return[g(S,!1),g(Math.max(S,A-1),!0)]},f=b.test(n.shown),k=s.maxChars??(f?16:32),M=keptSpans(n.shown,s.keep??[]);for(const l of splitLine(n.shown,k,M)){const d=(f?[{w:l.text,from:l.from,to:l.to}]:U(n.shown.slice(l.from,l.to)).map(m=>({w:m.w,from:m.from+l.from,to:m.to+l.from}))).filter(m=>p(m.w)!=="");if(d.length===0)continue;const S=s.maxWords&&s.maxWords>0?s.maxWords:d.length,A=Math.ceil(d.length/S),T=Math.ceil(d.length/A),O=[];d.forEach((m,L)=>{const W=d[L-1],j=O.at(-1);j&&W&&_(M,Math.ceil((W.to+m.from)/2))?j.push(m):O.push([m])});const I=[];let $=[];for(const m of O)$.length>0&&$.length+m.length>T&&(I.push($),$=[]),$.push(...m);$.length>0&&I.push($);for(const m of I){const L=m.map(E=>{const[N,B]=x(E.from,E.to);return{text:E.w,start:N,end:Math.max(B,N)}}),W=L[0],j=L.at(-1);if(!W||!j)continue;const z=m.map(E=>E.w).join(f?"":" ").replace(f?H:/[,;:]+$/u,"");r.push({start:W.start,end:j.end,text:z,part:n.part,words:L})}}}const o=n=>Math.round(n*i)/i,h=1/i,a=r.map(n=>({...n,start:o(n.start),end:o(n.end)}));for(let n=0;n<a.length;n++){const e=a[n];if(!e)continue;const t=a[n+1],u=t?.part===e.part;t&&u&&t.start-e.end<(s.close??.4)&&(e.end=t.start),e.end=Math.max(e.end,e.start+Math.min(.5,6*h)),t&&e.end>t.start&&(e.end=t.start),e.end<=e.start&&(e.end=e.start+h)}return a}export function cuesIn(c,s,i){const r=o=>Math.round(o*1e6)/1e6;return c.filter(o=>o.end>s&&o.start<i).map(o=>({start:r(Math.max(o.start,s)-s),end:r(Math.min(o.end,i)-s),text:o.text,words:o.words.map(h=>({text:h.text,start:r(h.start-s),end:r(h.end-s)}))}))}const y=(c,s)=>{const i=Math.round(c*1e3),r=Math.floor(i/36e5),o=Math.floor(i/6e4)%60,h=Math.floor(i/1e3)%60,a=(n,e=2)=>String(n).padStart(e,"0");return`${a(r)}:${a(o)}:${a(h)}${s}${a(i%1e3,3)}`};export function toSrt(c){return c.map((s,i)=>`${String(i+1)}
2
+ import{changesOf as K}from"@allyhub/piece";import{normText as p,joinWords as V,ScriptAlignment as v,WordStream as F}from"@allyhub/piece";import{speechWords as D}from"./speech.js";export const CAPTION_CUE_DEFAULTS={maxChars:42,maxCharsCjk:16,minSeconds:.8,maxSeconds:6,gapFrames:2};export function speechLines(c,s,i){return c.parts.flatMap(r=>{const o=r.speech,h=o?i[o.file]?.words:void 0;if(!o||!h?.length)return[];const a=D(h,o);if(a.length===0)return[];const n=s.find(t=>t.key===r.key),e=n?.spoken??V(a);return[{part:r.key,shown:e,spoken:n?.speak??e,words:a}]})}export function shownToSpoken(c,s){const i=(o,h)=>p(o.slice(0,h)).length,r=[[0,0]];for(const o of K(c,s))r.push([i(c,o.at),i(s,o.into)]),r.push([i(c,o.at+o.removed),i(s,o.into+o.inserted)]);return r.push([p(c).length,p(s).length]),o=>{for(let h=1;h<r.length;h++){const[a,n]=r[h-1]??[0,0],[e,t]=r[h]??[0,0];if(o>e&&h<r.length-1)continue;if(e<=a)return o<=a?n:t;const u=Math.max(0,Math.min(1,(o-a)/(e-a)));return n+(t-n)*u}return 0}}const b=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,G=/[。!?!?…]|\.(?=\s|$)/u,J=/[,、;:,;:—]/u,H=/[,、;:。,;:.\s]+$/u,P=(c,s)=>/[.,:;]/u.test(c[s]??"")&&/[0-9A-Za-z]/u.test(c[s+1]??"");export function keptSpans(c,s){const i=[],r=U(c).map(o=>({...o,n:p(o.w)}));for(const o of s){const h=p(o);if(!h)continue;if(b.test(o)){const n=[];Array.from(c).reduce((t,u)=>(p(u)&&n.push(t),t+u.length),0);const e=p(c);for(let t=e.indexOf(h);t>=0;t=e.indexOf(h,t+1)){const u=n[t],g=n[t+h.length-1];u!==void 0&&g!==void 0&&i.push([u,g+1])}continue}const a=o.split(/\s+/u).map(p).filter(Boolean);for(let n=0;n+a.length<=r.length;n++)if(a.every((e,t)=>r[n+t]?.n===e)){const e=r[n],t=r[n+a.length-1];e&&t&&i.push([e.from,t.to])}}return i}const _=(c,s)=>c.some(([i,r])=>s>i&&s<r);export function splitLine(c,s=b.test(c)?CAPTION_CUE_DEFAULTS.maxCharsCjk:CAPTION_CUE_DEFAULTS.maxChars,i=[]){const r=[],o=(a,n)=>{const e=c.slice(a,n),t=e.length-e.trimStart().length,u=e.trim();u&&r.push({text:u,from:a+t,to:a+t+u.length})},h=(a,n,e)=>{const t=c.slice(a,n);if(Array.from(t.trim()).length<=s){o(a,n);return}const g=e===0?G:e===1?J:void 0;if(g){let f=-1;for(let k=1;k<t.length-1;k++)g.test(t[k]??"")&&!P(t,k)&&!_(i,a+k+1)&&(f<0||Math.abs(k-t.length/2)<Math.abs(f-t.length/2))&&(f=k);if(f<0){h(a,n,e+1);return}h(a,a+f+1,e),h(a+f+1,n,e);return}const w=Math.floor(t.length/2),C=f=>f>0&&f<t.length&&!_(i,a+f);let x=-1;if(!b.test(t)){for(let f=w;f>0&&x<0;f--)t[f]===" "&&C(f)&&(x=f);for(let f=w;f<t.length&&x<0;f++)t[f]===" "&&C(f)&&(x=f)}for(let f=0;f<=t.length&&x<0;f++)C(w-f)?x=w-f:C(w+f)&&(x=w+f);if(x<0){o(a,n);return}h(a,a+x,e),h(a+x,n,e)};return h(0,c.length,0),r}export function captionCues(c,s={}){const{lines:i,fps:r}=c,o={...CAPTION_CUE_DEFAULTS,...s},h=[];for(const t of i){if(t.words.length===0)continue;const u=t.words,g=new v(new F(u),[t.spoken]),w=(M,l)=>{const d=u[g.wordAtChar(0,M)];return d?l?d.end:d.start:0};if((g.lines[0]?.length??0)===0)continue;const f=p(t.shown)===p(t.spoken)?M=>M:shownToSpoken(t.shown,t.spoken),k=b.test(t.shown)?o.maxCharsCjk:o.maxChars;for(const M of splitLine(t.shown,k)){const l=Math.round(f(p(t.shown.slice(0,M.from)).length)),d=Math.round(f(p(t.shown.slice(0,M.to)).length)),S=w(l,!1),A=w(Math.max(l,d-1),!0),T=b.test(M.text)?M.text.replace(H,""):M.text.replace(/[,;:]+$/u,"");T&&h.push({start:S,end:Math.max(A,S),text:T,part:t.part})}}const a=1/r,n=t=>Math.round(t*r)/r,e=h.map(t=>({...t,start:n(t.start),end:n(t.end)}));for(let t=0;t<e.length;t++){const u=e[t];if(!u)continue;const g=e[t+1],w=g?g.start-o.gapFrames*a:1/0;u.end=Math.min(Math.max(u.end,u.start+o.minSeconds),u.start+o.maxSeconds,w),u.end<=u.start&&(u.end=u.start+a)}return e}export function subtitleCues(c,s){return s===void 0?captionCues(c):wordCues(c.lines,{...s,fps:c.fps}).map(i=>({start:i.start,end:i.end,text:i.text,part:i.part}))}function U(c){const s=[],i=/\S+/gu;for(let r=i.exec(c);r;r=i.exec(c))s.push({w:r[0],from:r.index,to:r.index+r[0].length});return s}export function wordCues(c,s){const{fps:i}=s,r=[];for(const n of c){if(n.words.length===0)continue;const e=n.words,t=new v(new F(e),[n.spoken]);if((t.lines[0]?.length??0)===0)continue;const g=(l,d)=>{const S=e[t.wordAtChar(0,l)];return S?d?S.end:S.start:0},C=p(n.shown)===p(n.spoken)?l=>l:shownToSpoken(n.shown,n.spoken),x=(l,d)=>{const S=Math.round(C(p(n.shown.slice(0,l)).length)),A=Math.round(C(p(n.shown.slice(0,d)).length));return[g(S,!1),g(Math.max(S,A-1),!0)]},f=b.test(n.shown),k=s.maxChars??(f?16:32),M=keptSpans(n.shown,s.keep??[]);for(const l of splitLine(n.shown,k,M)){const d=(f?[{w:l.text,from:l.from,to:l.to}]:U(n.shown.slice(l.from,l.to)).map(m=>({w:m.w,from:m.from+l.from,to:m.to+l.from}))).filter(m=>p(m.w)!=="");if(d.length===0)continue;const S=s.maxWords&&s.maxWords>0?s.maxWords:d.length,A=Math.ceil(d.length/S),T=Math.ceil(d.length/A),O=[];d.forEach((m,L)=>{const W=d[L-1],j=O.at(-1);j&&W&&_(M,Math.ceil((W.to+m.from)/2))?j.push(m):O.push([m])});const I=[];let $=[];for(const m of O)$.length>0&&$.length+m.length>T&&(I.push($),$=[]),$.push(...m);$.length>0&&I.push($);for(const m of I){const L=m.map(E=>{const[N,B]=x(E.from,E.to);return{text:E.w,start:N,end:Math.max(B,N)}}),W=L[0],j=L.at(-1);if(!W||!j)continue;const z=m.map(E=>E.w).join(f?"":" ").replace(f?H:/[,;:]+$/u,"");r.push({start:W.start,end:j.end,text:z,part:n.part,words:L})}}}const o=n=>Math.round(n*i)/i,h=1/i,a=r.map(n=>({...n,start:o(n.start),end:o(n.end)}));for(let n=0;n<a.length;n++){const e=a[n];if(!e)continue;const t=a[n+1],u=t?.part===e.part;t&&u&&t.start-e.end<(s.close??.4)&&(e.end=t.start),e.end=Math.max(e.end,e.start+Math.min(.5,6*h)),t&&e.end>t.start&&(e.end=t.start),e.end<=e.start&&(e.end=e.start+h)}return a}export function cuesIn(c,s,i){const r=o=>Math.round(o*1e6)/1e6;return c.filter(o=>o.end>s&&o.start<i).map(o=>({start:r(Math.max(o.start,s)-s),end:r(Math.min(o.end,i)-s),text:o.text,words:o.words.map(h=>({text:h.text,start:r(h.start-s),end:r(h.end-s)}))}))}const y=(c,s)=>{const i=Math.round(c*1e3),r=Math.floor(i/36e5),o=Math.floor(i/6e4)%60,h=Math.floor(i/1e3)%60,a=(n,e=2)=>String(n).padStart(e,"0");return`${a(r)}:${a(o)}:${a(h)}${s}${a(i%1e3,3)}`};export function toSrt(c){return c.map((s,i)=>`${String(i+1)}
3
3
  ${y(s.start,",")} --> ${y(s.end,",")}
4
4
  ${s.text}
5
5
  `).join(`
@@ -0,0 +1,62 @@
1
+ import type { Combo, Target } from "@allyhub/piece";
2
+ import type { GeneratedUse } from "./fact.js";
3
+ import type { Timeline } from "./timeline.js";
4
+ import type { Reads } from "@allyhub/piece";
5
+ export interface FilmResult extends Target {
6
+ /** Its film's plan; absent when it did not load. */
7
+ timeline?: Timeline;
8
+ /** What it read while it loaded and drew its stills. */
9
+ reads?: Reads;
10
+ /** What it was built from; absent when it did not load. */
11
+ digest?: string;
12
+ }
13
+ /** A media file a part shows, plays or reads, in seconds from the part's start. */
14
+ export interface PlanUse {
15
+ file: string;
16
+ as: GeneratedUse["as"];
17
+ from: number;
18
+ /** Absent for a placed sound: it plays for its file's length. */
19
+ to?: number;
20
+ }
21
+ /** One part of a combo's plan. */
22
+ export interface PlanPart {
23
+ key: string;
24
+ slot?: string;
25
+ /** Seconds it lasts. */
26
+ dur: number;
27
+ /** Where its speech comes from: the take's file and stretch (seconds of the file). */
28
+ speech?: {
29
+ file: string;
30
+ from: number;
31
+ dur: number;
32
+ };
33
+ /** The media it uses: its footage, speech and placed sounds, and what its layers read. */
34
+ uses: PlanUse[];
35
+ }
36
+ export interface ComboPlan {
37
+ piece: string;
38
+ output: string;
39
+ combo: Combo;
40
+ /** The combo's id (pieces with slots). */
41
+ id?: string;
42
+ format: string;
43
+ duration: number;
44
+ parts: PlanPart[];
45
+ /** Media its parts read (for provenance flags). */
46
+ media: string[];
47
+ /** Put together from other combos' parts: it was not loaded. */
48
+ estimated: boolean;
49
+ /** Its music, when it has some: the file, where it starts, whether it loops. */
50
+ music?: string;
51
+ musicFrom?: number;
52
+ musicLoop?: true;
53
+ /**
54
+ * Seconds of the film its music plays when it is put together from
55
+ * stretches (`music.play`) or ends on a bar (`music.end`); absent: the
56
+ * file from `musicFrom` to its end.
57
+ */
58
+ musicLength?: number;
59
+ /** The loudness the mix levels speech to (video({ mix }).speech), when not the default. */
60
+ speechLevel?: number;
61
+ }
62
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ export{};
@@ -1,7 +1,7 @@
1
1
  import { type EditList, type EditRange, type EditedSpeech, type KeptRange, type SoundCut } from "./edits.js";
2
- import type { Word } from "./media.js";
2
+ import type { Word } from "@allyhub/piece";
3
3
  import { type Join } from "./transcript.js";
4
- import { type RoomLevel, type VoiceFrames } from "./voice.js";
4
+ import { type RoomLevel, type VoiceFrames } from "@allyhub/piece";
5
5
  export interface CutReportOptions {
6
6
  /** Words [from, to] of the take (default every word). */
7
7
  from?: number;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{applyEdits as E,editedLength as P,PAD_AFTER as T,PAD_BEFORE as _,speechPads as j}from"./edits.js";import{JOIN_NEAR as q,joinsOf as x,takeLevels as B}from"./transcript.js";import{matchRoom as g,ROOM_MATCH as v,roomTone as I}from"./voice.js";import{joinWords as y}from"./words.js";const A=o=>Math.round(o*1e3)/1e3;export function cutReport(o,e,a,c={}){const r=Math.max(0,o.length-1),d=Math.min(c.from??0,r),s=Math.min(c.to??r,r),p=c.fps??30,i=c.duration??o.at(-1)?.end??0,n=E(o,e,d,s,{levels:a,fps:p}),m=o[d],u=o[s],l=m&&u?u.end-m.start:0,h=P(n.ranges),M=[];for(const t of n.removed){const f=M.at(-1);f?.to===t-1?f.to=t:M.push({from:t,to:t})}const O=t=>e.maxPause===void 0?t:Math.min(t,e.maxPause/2),k={before:O(e.pad?.before??_),after:O(e.pad?.after??T)},W=M.map(t=>({...t,start:o[t.from]?.start??0,end:o[t.to]?.end??0,text:y(o.slice(t.from,t.to+1))})),R=c.quiet??(a?B(a).threshold:-60),b=c.near??q;return{from:d,to:s,fps:p,pad:k,padGiven:e.pad?.before!==void 0||e.pad?.after!==void 0,kept:n.ranges,removed:W,sounds:n.sounds,soundsUnused:(e.sounds??[]).filter(t=>!n.sounds.some(f=>f.from<t.to&&f.to>t.from)),inWord:n.inWord,inWordUnplaced:(e.inWord??[]).filter(t=>!n.inWord.some(f=>f.from<t.to+.05&&f.to>t.from-.05)),pauses:n.pauses,lost:n.lost,seconds:{before:A(l),after:A(h),removed:A(l-h)},roomTone:a?D(o,n,a,i):null,joins:x(o,n,a,R,b),quietBelow:a?R:null,near:b}}function D(o,e,a,c){const r=I(a),d=e.kept[0],s=e.kept.at(-1);if(!r||d===void 0||s===void 0)return null;const p=j(o,d,s,c,a),i=e.ranges[0]?.from??o[d]?.start??0,n=e.ranges.at(-1)?.to??o[s]?.end??0,m=i>(o[d]?.start??0)+1e-6?0:p.padIn,u=n<(o[s]?.end??0)-1e-6?0:p.padOut,l={from:r.from,to:Math.min(r.to,r.from+v.near)},h=g(a,l,{from:i-m,to:i-m+Math.min(m,v.near)}),M=g(a,l,{from:n+u-Math.min(u,v.near),to:n+u});return{...r,level:h.level,lead:{word:d,pad:m,...h},tail:{word:s,pad:u,...M}}}
2
+ import{applyEdits as E,editedLength as P,PAD_AFTER as T,PAD_BEFORE as _,speechPads as j}from"./edits.js";import{JOIN_NEAR as q,joinsOf as x,takeLevels as B}from"./transcript.js";import{matchRoom as g,ROOM_MATCH as v,roomTone as I}from"@allyhub/piece";import{joinWords as y}from"@allyhub/piece";const A=o=>Math.round(o*1e3)/1e3;export function cutReport(o,e,a,c={}){const r=Math.max(0,o.length-1),d=Math.min(c.from??0,r),s=Math.min(c.to??r,r),p=c.fps??30,i=c.duration??o.at(-1)?.end??0,n=E(o,e,d,s,{levels:a,fps:p}),m=o[d],u=o[s],l=m&&u?u.end-m.start:0,h=P(n.ranges),M=[];for(const t of n.removed){const f=M.at(-1);f?.to===t-1?f.to=t:M.push({from:t,to:t})}const O=t=>e.maxPause===void 0?t:Math.min(t,e.maxPause/2),k={before:O(e.pad?.before??_),after:O(e.pad?.after??T)},W=M.map(t=>({...t,start:o[t.from]?.start??0,end:o[t.to]?.end??0,text:y(o.slice(t.from,t.to+1))})),R=c.quiet??(a?B(a).threshold:-60),b=c.near??q;return{from:d,to:s,fps:p,pad:k,padGiven:e.pad?.before!==void 0||e.pad?.after!==void 0,kept:n.ranges,removed:W,sounds:n.sounds,soundsUnused:(e.sounds??[]).filter(t=>!n.sounds.some(f=>f.from<t.to&&f.to>t.from)),inWord:n.inWord,inWordUnplaced:(e.inWord??[]).filter(t=>!n.inWord.some(f=>f.from<t.to+.05&&f.to>t.from-.05)),pauses:n.pauses,lost:n.lost,seconds:{before:A(l),after:A(h),removed:A(l-h)},roomTone:a?D(o,n,a,i):null,joins:x(o,n,a,R,b),quietBelow:a?R:null,near:b}}function D(o,e,a,c){const r=I(a),d=e.kept[0],s=e.kept.at(-1);if(!r||d===void 0||s===void 0)return null;const p=j(o,d,s,c,a),i=e.ranges[0]?.from??o[d]?.start??0,n=e.ranges.at(-1)?.to??o[s]?.end??0,m=i>(o[d]?.start??0)+1e-6?0:p.padIn,u=n<(o[s]?.end??0)-1e-6?0:p.padOut,l={from:r.from,to:Math.min(r.to,r.from+v.near)},h=g(a,l,{from:i-m,to:i-m+Math.min(m,v.near)}),M=g(a,l,{from:n+u-Math.min(u,v.near),to:n+u});return{...r,level:h.level,lead:{word:d,pad:m,...h},tail:{word:s,pad:u,...M}}}
@@ -1,6 +1,6 @@
1
- import type { Word } from "./media.js";
2
- import { type VoiceFrames } from "./voice.js";
3
- import { WordStream } from "./words.js";
1
+ import type { Word } from "@allyhub/piece";
2
+ import { type VoiceFrames } from "@allyhub/piece";
3
+ import { WordStream } from "@allyhub/piece";
4
4
  /** Words removed: indices into the take's words file, inclusive, with their text. */
5
5
  export interface EditRange {
6
6
  from: number;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{PAD_MAX as X}from"@allyhub/formats";import{quietest as Y}from"./voice.js";import{joinWords as Z,normText as w,WordStream as z}from"./words.js";export const PAD_BEFORE=.12,PAD_AFTER=.08;const $=.04,R=.04,A=e=>Math.round(e*1e3)/1e3,T=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0;export function parseEditList(e){if(typeof e!="object"||e===null||Array.isArray(e))return"an edits file is a JSON object: { version: 1, remove, sounds, inWord, maxPause, pad }";const t=e;if(t.version!==1)return"version is 1";for(const o of["take","$schema"])if(t[o]!==void 0&&typeof t[o]!="string")return`${o} is a string`;const s=Object.keys(t).filter(o=>!["version","remove","sounds","inWord","maxPause","pad","take","$schema"].includes(o));if(s.length>0)return`unknown field${s.length>1?"s":""} ${s.join(", ")} (an edits file has version, remove, sounds, inWord, maxPause, pad and take)`;const f={};if(t.remove!==void 0){if(!Array.isArray(t.remove))return"remove is a list of { from, to, text }";const o=[];for(const[i,k]of t.remove.entries()){const u=k,M=u?.from,m=u?.to,p=u?.text;if(typeof M!="number"||typeof m!="number"||!Number.isInteger(M)||!Number.isInteger(m)||M<0||m<M||p!==void 0&&typeof p!="string")return`remove[${String(i)}] is not { from, to, text } with word indices from ≤ to`;o.push({from:M,to:m,...p===void 0?{}:{text:p}})}f.remove=o}for(const o of["sounds","inWord"]){if(t[o]===void 0)continue;if(!Array.isArray(t[o]))return`${o} is a list of { from, to } in seconds of the take`;const i=[];for(const[k,u]of t[o].entries()){const M=u,m=M?.from,p=M?.to;if(!T(m)||!T(p)||p<=m)return`${o}[${String(k)}] is not { from, to } in seconds with from < to`;i.push({from:m,to:p})}f[o]=i}const a=t.maxPause;if(a!==void 0){if(typeof a!="number"||!Number.isFinite(a)||a<.05||a>10)return"maxPause is seconds, from 0.05 to 10";f.maxPause=a}const r=t.pad;if(r!==void 0){const o=r,i=typeof r=="object"&&o!==null&&!Array.isArray(r),k=i?Object.keys(o).filter(p=>p!=="before"&&p!=="after"):[],u=p=>p===void 0||T(p)&&p<=X;if(!i||k.length>0||!u(o.before)||!u(o.after))return`pad is { before, after }: seconds of silence kept before and after each cut, each from 0 to ${String(X)}`;const M=o.before,m=o.after;f.pad={...M===void 0?{}:{before:M},...m===void 0?{}:{after:m}}}return f}export function rangeText(e,t,s){return Z(e.slice(t,s+1))}export function locateRange(e,t,s=new z(e)){const f=t.from>=0&&t.to<e.length&&t.to>=t.from;if(t.text===void 0)return f?{from:t.from,to:t.to}:void 0;const a=w(t.text);if(a==="")return f?{from:t.from,to:t.to}:void 0;if(f&&w(rangeText(e,t.from,t.to))===a)return{from:t.from,to:t.to};let r;for(let o=1;;o++){const i=s.span(a,0,e.length-1,o);if(!i)break;w(rangeText(e,i.first,i.last))===a&&(!r||Math.abs(i.first-t.from)<Math.abs(r.from-t.from))&&(r={from:i.first,to:i.last})}return r}export function removedWords(e,t,s=new z(e)){const f=new Set,a=[];for(const r of t?.remove??[]){const o=locateRange(e,r,s);if(!o){a.push(r);continue}for(let i=o.from;i<=o.to;i++)f.add(i)}return{cut:f,lost:a}}export function snapCut(e,t,s,f){const a=Math.min(Math.max(t,s),f);return e?Y(e,a,Math.max(s,a-$),Math.min(f,a+$)):a}const tt=.5,ot=.6;export function speechPads(e,t,s,f,a){const r=e[t],o=e[s]??r;if(!r||!o)return{padIn:0,padOut:0};const i=r.start,k=e[t-1]?.end??0,u=e[s+1]?.start??f??o.end+.4,M=Math.max(0,Math.min((i-k)/2,i)),m=Math.max(0,(u-o.end)/2),p=snapCut(a,i-Math.min(tt,M),i-M,i),g=snapCut(a,o.end+Math.min(ot,m),o.end,o.end+m);return{padIn:A(Math.max(0,i-p)),padOut:A(Math.max(0,g-o.end))}}export function applyEdits(e,t,s=0,f=e.length-1,a={}){const{levels:r,fps:o}=a,{cut:i,lost:k}=removedWords(e,t),u=[];for(let n=s;n<=f;n++)i.has(n)||u.push(n);const M=[...i].filter(n=>n>=s&&n<=f).sort((n,c)=>n-c),m=t?.maxPause,p=[],g=[],y=n=>e[n]??{text:"",start:0,end:0};if(u.length===0)return{ranges:[],words:[],kept:u,removed:M,sounds:[],inWord:[],pauses:p,lost:k};const _=[],j=new Map;for(const n of t?.sounds??[])for(let c=0;c<u.length-1;c++){const h=y(u[c]??0),l=y(u[c+1]??0),b=Math.max(n.from,h.end),x=Math.min(n.to,l.start);if(x-b<.01)continue;const d=j.get(c)??[];d.push({start:b,end:x}),j.set(c,d),_.push({from:A(b),to:A(x)})}const F=y(u[0]??0);let O=F.start,W=F.start;const B=t?.pad?.before??PAD_BEFORE,C=t?.pad?.after??PAD_AFTER,H=m===void 0?B:Math.min(B,m/2),K=m===void 0?C:Math.min(C,m/2);for(let n=0;n<u.length-1;n++){const c=u[n]??0,h=u[n+1]??0,l=y(c),b=y(h),x=[];for(let v=c+1;v<h;v++)x.push({start:y(v).start,end:y(v).end});x.push(...j.get(n)??[]),x.sort((v,P)=>v.start-P.start);const d=x[0],N=x.at(-1);if(!d||!N){const v=b.start-l.end;if(m!==void 0&&v>m){const P=snapCut(r,l.end+m/2,l.end,b.start),S=snapCut(r,b.start-m/2,P,b.start);S-P>=R&&(p.push({after:c,was:A(v),now:m}),g.push({from:O,to:P,lo:W,hi:S}),O=S,W=P)}continue}const J=Math.max(0,d.start-l.end),q=Math.max(0,b.start-N.end),U=snapCut(r,l.end+Math.min(H,J/2),l.end,l.end+J/2),V=snapCut(r,b.start-Math.min(K,q/2),b.start-q/2,b.start);g.push({from:O,to:U,lo:W,hi:d.start}),O=Math.max(V,U),W=Math.min(O,N.end)}const D=y(u.at(-1)??0);g.push({from:O,to:D.end,lo:W,hi:D.end});const L=[];for(const n of t?.inWord??[]){const c=(n.from+n.to)/2,h=snapCut(r,n.from,n.from-$,c),l=snapCut(r,n.to,c,n.to+$);if(l-h<R)continue;let b=!1;for(let x=0;x<g.length;x++){const d=g[x];!d||h>=d.to||l<=d.from||(b=!0,h>d.from&&l<d.to?(g.splice(x,1,{from:d.from,to:h,lo:d.lo,hi:h},{from:l,to:d.to,lo:l,hi:d.hi}),x++):h<=d.from&&l>=d.to?(g.splice(x,1),x--):h<=d.from?(d.from=l,d.lo=l):(d.to=h,d.hi=h))}b&&L.push({from:A(h),to:A(l),words:u.filter(x=>y(x).start<l&&y(x).end>h)})}o!==void 0&&o>0&&g.forEach((n,c)=>{if(c>0){const h=Math.floor(n.from*o+1e-6)/o;h>=n.lo-1e-9&&(n.from=h)}if(c<g.length-1){const h=Math.ceil(n.to*o-1e-6)/o;h<=n.hi+1e-9&&(n.to=h)}});const E=[];for(const n of g){const c=E.at(-1);c&&n.from-c.to<R?c.to=Math.max(c.to,n.to):E.push({from:n.from,to:n.to})}const I=E.map(n=>({from:A(n.from),to:A(n.to)})),Q=editedLength(I),G=n=>A(Math.min(Q,Math.max(0,toEdited(I,n))));return{ranges:I,words:u.map(n=>{const c=y(n);return{text:c.text,start:G(c.start),end:G(c.end)}}),kept:u,removed:M,sounds:_,inWord:L,pauses:p,lost:k}}export function editedLength(e){return e.reduce((t,s)=>t+(s.to-s.from),0)}export function toEdited(e,t){let s=0;const f=e[0];if(!f)return t;if(t<=f.from)return t-f.from;for(const r of e){if(t<r.from)return s;if(t<=r.to)return s+(t-r.from);s+=r.to-r.from}const a=e.at(-1)??f;return s+(t-a.to)}export function fromEdited(e,t){const s=e[0];if(!s)return t;if(t<=0)return s.from+t;let f=0;for(const r of e){const o=r.to-r.from;if(t<f+o)return r.from+(t-f);f+=o}return(e.at(-1)??s).to+(t-f)}
2
+ import{PAD_MAX as X}from"@allyhub/formats";import{quietest as Y}from"@allyhub/piece";import{joinWords as Z,normText as w,WordStream as z}from"@allyhub/piece";export const PAD_BEFORE=.12,PAD_AFTER=.08;const $=.04,R=.04,A=e=>Math.round(e*1e3)/1e3,T=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0;export function parseEditList(e){if(typeof e!="object"||e===null||Array.isArray(e))return"an edits file is a JSON object: { version: 1, remove, sounds, inWord, maxPause, pad }";const t=e;if(t.version!==1)return"version is 1";for(const o of["take","$schema"])if(t[o]!==void 0&&typeof t[o]!="string")return`${o} is a string`;const s=Object.keys(t).filter(o=>!["version","remove","sounds","inWord","maxPause","pad","take","$schema"].includes(o));if(s.length>0)return`unknown field${s.length>1?"s":""} ${s.join(", ")} (an edits file has version, remove, sounds, inWord, maxPause, pad and take)`;const f={};if(t.remove!==void 0){if(!Array.isArray(t.remove))return"remove is a list of { from, to, text }";const o=[];for(const[i,k]of t.remove.entries()){const u=k,M=u?.from,m=u?.to,p=u?.text;if(typeof M!="number"||typeof m!="number"||!Number.isInteger(M)||!Number.isInteger(m)||M<0||m<M||p!==void 0&&typeof p!="string")return`remove[${String(i)}] is not { from, to, text } with word indices from ≤ to`;o.push({from:M,to:m,...p===void 0?{}:{text:p}})}f.remove=o}for(const o of["sounds","inWord"]){if(t[o]===void 0)continue;if(!Array.isArray(t[o]))return`${o} is a list of { from, to } in seconds of the take`;const i=[];for(const[k,u]of t[o].entries()){const M=u,m=M?.from,p=M?.to;if(!T(m)||!T(p)||p<=m)return`${o}[${String(k)}] is not { from, to } in seconds with from < to`;i.push({from:m,to:p})}f[o]=i}const a=t.maxPause;if(a!==void 0){if(typeof a!="number"||!Number.isFinite(a)||a<.05||a>10)return"maxPause is seconds, from 0.05 to 10";f.maxPause=a}const r=t.pad;if(r!==void 0){const o=r,i=typeof r=="object"&&o!==null&&!Array.isArray(r),k=i?Object.keys(o).filter(p=>p!=="before"&&p!=="after"):[],u=p=>p===void 0||T(p)&&p<=X;if(!i||k.length>0||!u(o.before)||!u(o.after))return`pad is { before, after }: seconds of silence kept before and after each cut, each from 0 to ${String(X)}`;const M=o.before,m=o.after;f.pad={...M===void 0?{}:{before:M},...m===void 0?{}:{after:m}}}return f}export function rangeText(e,t,s){return Z(e.slice(t,s+1))}export function locateRange(e,t,s=new z(e)){const f=t.from>=0&&t.to<e.length&&t.to>=t.from;if(t.text===void 0)return f?{from:t.from,to:t.to}:void 0;const a=w(t.text);if(a==="")return f?{from:t.from,to:t.to}:void 0;if(f&&w(rangeText(e,t.from,t.to))===a)return{from:t.from,to:t.to};let r;for(let o=1;;o++){const i=s.span(a,0,e.length-1,o);if(!i)break;w(rangeText(e,i.first,i.last))===a&&(!r||Math.abs(i.first-t.from)<Math.abs(r.from-t.from))&&(r={from:i.first,to:i.last})}return r}export function removedWords(e,t,s=new z(e)){const f=new Set,a=[];for(const r of t?.remove??[]){const o=locateRange(e,r,s);if(!o){a.push(r);continue}for(let i=o.from;i<=o.to;i++)f.add(i)}return{cut:f,lost:a}}export function snapCut(e,t,s,f){const a=Math.min(Math.max(t,s),f);return e?Y(e,a,Math.max(s,a-$),Math.min(f,a+$)):a}const tt=.5,ot=.6;export function speechPads(e,t,s,f,a){const r=e[t],o=e[s]??r;if(!r||!o)return{padIn:0,padOut:0};const i=r.start,k=e[t-1]?.end??0,u=e[s+1]?.start??f??o.end+.4,M=Math.max(0,Math.min((i-k)/2,i)),m=Math.max(0,(u-o.end)/2),p=snapCut(a,i-Math.min(tt,M),i-M,i),g=snapCut(a,o.end+Math.min(ot,m),o.end,o.end+m);return{padIn:A(Math.max(0,i-p)),padOut:A(Math.max(0,g-o.end))}}export function applyEdits(e,t,s=0,f=e.length-1,a={}){const{levels:r,fps:o}=a,{cut:i,lost:k}=removedWords(e,t),u=[];for(let n=s;n<=f;n++)i.has(n)||u.push(n);const M=[...i].filter(n=>n>=s&&n<=f).sort((n,c)=>n-c),m=t?.maxPause,p=[],g=[],y=n=>e[n]??{text:"",start:0,end:0};if(u.length===0)return{ranges:[],words:[],kept:u,removed:M,sounds:[],inWord:[],pauses:p,lost:k};const _=[],j=new Map;for(const n of t?.sounds??[])for(let c=0;c<u.length-1;c++){const h=y(u[c]??0),l=y(u[c+1]??0),b=Math.max(n.from,h.end),x=Math.min(n.to,l.start);if(x-b<.01)continue;const d=j.get(c)??[];d.push({start:b,end:x}),j.set(c,d),_.push({from:A(b),to:A(x)})}const F=y(u[0]??0);let O=F.start,W=F.start;const B=t?.pad?.before??PAD_BEFORE,C=t?.pad?.after??PAD_AFTER,H=m===void 0?B:Math.min(B,m/2),K=m===void 0?C:Math.min(C,m/2);for(let n=0;n<u.length-1;n++){const c=u[n]??0,h=u[n+1]??0,l=y(c),b=y(h),x=[];for(let v=c+1;v<h;v++)x.push({start:y(v).start,end:y(v).end});x.push(...j.get(n)??[]),x.sort((v,P)=>v.start-P.start);const d=x[0],N=x.at(-1);if(!d||!N){const v=b.start-l.end;if(m!==void 0&&v>m){const P=snapCut(r,l.end+m/2,l.end,b.start),S=snapCut(r,b.start-m/2,P,b.start);S-P>=R&&(p.push({after:c,was:A(v),now:m}),g.push({from:O,to:P,lo:W,hi:S}),O=S,W=P)}continue}const J=Math.max(0,d.start-l.end),q=Math.max(0,b.start-N.end),U=snapCut(r,l.end+Math.min(H,J/2),l.end,l.end+J/2),V=snapCut(r,b.start-Math.min(K,q/2),b.start-q/2,b.start);g.push({from:O,to:U,lo:W,hi:d.start}),O=Math.max(V,U),W=Math.min(O,N.end)}const D=y(u.at(-1)??0);g.push({from:O,to:D.end,lo:W,hi:D.end});const L=[];for(const n of t?.inWord??[]){const c=(n.from+n.to)/2,h=snapCut(r,n.from,n.from-$,c),l=snapCut(r,n.to,c,n.to+$);if(l-h<R)continue;let b=!1;for(let x=0;x<g.length;x++){const d=g[x];!d||h>=d.to||l<=d.from||(b=!0,h>d.from&&l<d.to?(g.splice(x,1,{from:d.from,to:h,lo:d.lo,hi:h},{from:l,to:d.to,lo:l,hi:d.hi}),x++):h<=d.from&&l>=d.to?(g.splice(x,1),x--):h<=d.from?(d.from=l,d.lo=l):(d.to=h,d.hi=h))}b&&L.push({from:A(h),to:A(l),words:u.filter(x=>y(x).start<l&&y(x).end>h)})}o!==void 0&&o>0&&g.forEach((n,c)=>{if(c>0){const h=Math.floor(n.from*o+1e-6)/o;h>=n.lo-1e-9&&(n.from=h)}if(c<g.length-1){const h=Math.ceil(n.to*o-1e-6)/o;h<=n.hi+1e-9&&(n.to=h)}});const E=[];for(const n of g){const c=E.at(-1);c&&n.from-c.to<R?c.to=Math.max(c.to,n.to):E.push({from:n.from,to:n.to})}const I=E.map(n=>({from:A(n.from),to:A(n.to)})),Q=editedLength(I),G=n=>A(Math.min(Q,Math.max(0,toEdited(I,n))));return{ranges:I,words:u.map(n=>{const c=y(n);return{text:c.text,start:G(c.start),end:G(c.end)}}),kept:u,removed:M,sounds:_,inWord:L,pauses:p,lost:k}}export function editedLength(e){return e.reduce((t,s)=>t+(s.to-s.from),0)}export function toEdited(e,t){let s=0;const f=e[0];if(!f)return t;if(t<=f.from)return t-f.from;for(const r of e){if(t<r.from)return s;if(t<=r.to)return s+(t-r.from);s+=r.to-r.from}const a=e.at(-1)??f;return s+(t-a.to)}export function fromEdited(e,t){const s=e[0];if(!s)return t;if(t<=0)return s.from+t;let f=0;for(const r of e){const o=r.to-r.from;if(t<f+o)return r.from+(t-f);f+=o}return(e.at(-1)??s).to+(t-f)}