@allyhub/sdk 0.1.0-alpha.8 → 0.2.0-next.1

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 (365) hide show
  1. package/LICENSE.md +241 -0
  2. package/NOTICE +85 -0
  3. package/client.d.ts +45 -1
  4. package/dist/anim.js +2 -75
  5. package/dist/define.d.ts +10 -4
  6. package/dist/define.js +2 -95
  7. package/dist/dom.d.ts +1 -1
  8. package/dist/dom.js +2 -457
  9. package/dist/fit.js +2 -60
  10. package/dist/free.d.ts +18 -0
  11. package/dist/free.js +2 -0
  12. package/dist/index.d.ts +28 -13
  13. package/dist/index.js +2 -11
  14. package/dist/input.d.ts +306 -0
  15. package/dist/input.js +2 -0
  16. package/dist/media.d.ts +3 -6
  17. package/dist/media.js +2 -27
  18. package/dist/messages.d.ts +3 -2
  19. package/dist/messages.js +2 -2
  20. package/dist/module.d.ts +24 -0
  21. package/dist/module.js +2 -0
  22. package/dist/noise.js +2 -233
  23. package/dist/parts.d.ts +98 -22
  24. package/dist/parts.js +2 -414
  25. package/dist/paths.d.ts +1 -1
  26. package/dist/paths.js +2 -720
  27. package/dist/phone.d.ts +26 -0
  28. package/dist/phone.js +2 -0
  29. package/dist/piece.d.ts +106 -35
  30. package/dist/piece.js +2 -38
  31. package/dist/props.d.ts +1 -1
  32. package/dist/props.js +2 -35
  33. package/dist/scenery.d.ts +2 -0
  34. package/dist/scenery.js +2 -0
  35. package/dist/text.js +2 -38
  36. package/dist/written.d.ts +12 -0
  37. package/dist/written.js +2 -0
  38. package/docs/README.md +18 -0
  39. package/docs/batches.md +148 -0
  40. package/docs/contract.md +51 -0
  41. package/docs/defaults.md +703 -0
  42. package/docs/docs.md +148 -0
  43. package/docs/footage.md +249 -0
  44. package/docs/layers.md +317 -0
  45. package/docs/modeling.md +143 -0
  46. package/docs/project.md +265 -0
  47. package/docs/scenery.md +308 -0
  48. package/docs/sheets.md +119 -0
  49. package/docs/slides.md +111 -0
  50. package/docs/sound.md +170 -0
  51. package/docs/speech.md +289 -0
  52. package/docs/video.md +265 -0
  53. package/node_modules/@allyhub-next/audio/LICENSE +241 -0
  54. package/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +52 -0
  55. package/node_modules/@allyhub-next/audio/dist/at-cut.js +2 -0
  56. package/node_modules/@allyhub-next/audio/dist/decode.d.ts +33 -0
  57. package/node_modules/@allyhub-next/audio/dist/decode.js +2 -0
  58. package/node_modules/@allyhub-next/audio/dist/envelope.d.ts +37 -0
  59. package/node_modules/@allyhub-next/audio/dist/envelope.js +2 -0
  60. package/node_modules/@allyhub-next/audio/dist/index.d.ts +17 -0
  61. package/node_modules/@allyhub-next/audio/dist/index.js +2 -0
  62. package/node_modules/@allyhub-next/audio/dist/levels.d.ts +97 -0
  63. package/node_modules/@allyhub-next/audio/dist/levels.js +2 -0
  64. package/node_modules/@allyhub-next/audio/dist/master.d.ts +29 -0
  65. package/node_modules/@allyhub-next/audio/dist/master.js +2 -0
  66. package/node_modules/@allyhub-next/audio/dist/music.d.ts +11 -0
  67. package/node_modules/@allyhub-next/audio/dist/music.js +2 -0
  68. package/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +39 -0
  69. package/node_modules/@allyhub-next/audio/dist/node/decode.js +2 -0
  70. package/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +25 -0
  71. package/node_modules/@allyhub-next/audio/dist/node/ebur128.js +2 -0
  72. package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +31 -0
  73. package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.js +2 -0
  74. package/node_modules/@allyhub-next/audio/dist/node/index.d.ts +8 -0
  75. package/node_modules/@allyhub-next/audio/dist/node/index.js +2 -0
  76. package/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +18 -0
  77. package/node_modules/@allyhub-next/audio/dist/node/loudness.js +2 -0
  78. package/node_modules/@allyhub-next/audio/dist/node/master.d.ts +42 -0
  79. package/node_modules/@allyhub-next/audio/dist/node/master.js +2 -0
  80. package/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +60 -0
  81. package/node_modules/@allyhub-next/audio/dist/node/measure.js +2 -0
  82. package/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +31 -0
  83. package/node_modules/@allyhub-next/audio/dist/node/mix.js +2 -0
  84. package/node_modules/@allyhub-next/audio/dist/plan.d.ts +143 -0
  85. package/node_modules/@allyhub-next/audio/dist/plan.js +2 -0
  86. package/node_modules/@allyhub-next/audio/dist/recorded.d.ts +26 -0
  87. package/node_modules/@allyhub-next/audio/dist/recorded.js +2 -0
  88. package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +47 -0
  89. package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.js +2 -0
  90. package/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +89 -0
  91. package/node_modules/@allyhub-next/audio/dist/recording/chain.js +2 -0
  92. package/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +64 -0
  93. package/node_modules/@allyhub-next/audio/dist/recording/dynamics.js +2 -0
  94. package/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +26 -0
  95. package/node_modules/@allyhub-next/audio/dist/recording/fft.js +2 -0
  96. package/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +42 -0
  97. package/node_modules/@allyhub-next/audio/dist/recording/filters.js +2 -0
  98. package/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +56 -0
  99. package/node_modules/@allyhub-next/audio/dist/recording/fit.js +2 -0
  100. package/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +10 -0
  101. package/node_modules/@allyhub-next/audio/dist/recording/index.js +2 -0
  102. package/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +12 -0
  103. package/node_modules/@allyhub-next/audio/dist/recording/loudness.js +2 -0
  104. package/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +67 -0
  105. package/node_modules/@allyhub-next/audio/dist/recording/measure.js +2 -0
  106. package/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +32 -0
  107. package/node_modules/@allyhub-next/audio/dist/recording/mic.js +2 -0
  108. package/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +27 -0
  109. package/node_modules/@allyhub-next/audio/dist/recording/noise.js +2 -0
  110. package/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +64 -0
  111. package/node_modules/@allyhub-next/audio/dist/recording/presets.js +2 -0
  112. package/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +78 -0
  113. package/node_modules/@allyhub-next/audio/dist/recording/room.js +2 -0
  114. package/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +111 -0
  115. package/node_modules/@allyhub-next/audio/dist/recording/setup.js +2 -0
  116. package/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +3 -0
  117. package/node_modules/@allyhub-next/audio/dist/recording/vec.js +2 -0
  118. package/node_modules/@allyhub-next/audio/dist/render.d.ts +26 -0
  119. package/node_modules/@allyhub-next/audio/dist/render.js +2 -0
  120. package/node_modules/@allyhub-next/audio/dist/sfx.d.ts +10 -0
  121. package/node_modules/@allyhub-next/audio/dist/sfx.js +2 -0
  122. package/node_modules/@allyhub-next/audio/dist/shape.d.ts +118 -0
  123. package/node_modules/@allyhub-next/audio/dist/shape.js +2 -0
  124. package/node_modules/@allyhub-next/audio/dist/voice.d.ts +45 -0
  125. package/node_modules/@allyhub-next/audio/dist/voice.js +2 -0
  126. package/node_modules/@allyhub-next/audio/package.json +17 -0
  127. package/node_modules/@allyhub-next/formats/LICENSE +241 -0
  128. package/node_modules/@allyhub-next/formats/dist/data/comments.d.ts +94 -0
  129. package/node_modules/@allyhub-next/formats/dist/data/comments.js +2 -0
  130. package/node_modules/@allyhub-next/formats/dist/data/config.d.ts +10 -0
  131. package/node_modules/@allyhub-next/formats/dist/data/config.js +2 -0
  132. package/node_modules/@allyhub-next/formats/dist/data/edits.d.ts +28 -0
  133. package/node_modules/@allyhub-next/formats/dist/data/edits.js +2 -0
  134. package/node_modules/@allyhub-next/formats/dist/data/elements.d.ts +6 -0
  135. package/node_modules/@allyhub-next/formats/dist/data/elements.js +2 -0
  136. package/node_modules/@allyhub-next/formats/dist/data/faces.d.ts +38 -0
  137. package/node_modules/@allyhub-next/formats/dist/data/faces.js +2 -0
  138. package/node_modules/@allyhub-next/formats/dist/data/file.d.ts +11 -0
  139. package/node_modules/@allyhub-next/formats/dist/data/file.js +2 -0
  140. package/node_modules/@allyhub-next/formats/dist/data/gen.d.ts +31 -0
  141. package/node_modules/@allyhub-next/formats/dist/data/gen.js +2 -0
  142. package/node_modules/@allyhub-next/formats/dist/data/messages.d.ts +34 -0
  143. package/node_modules/@allyhub-next/formats/dist/data/messages.js +2 -0
  144. package/node_modules/@allyhub-next/formats/dist/data/reference.d.ts +676 -0
  145. package/node_modules/@allyhub-next/formats/dist/data/reference.js +2 -0
  146. package/node_modules/@allyhub-next/formats/dist/data/script.d.ts +37 -0
  147. package/node_modules/@allyhub-next/formats/dist/data/script.js +2 -0
  148. package/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +214 -0
  149. package/node_modules/@allyhub-next/formats/dist/data/sheet.js +2 -0
  150. package/node_modules/@allyhub-next/formats/dist/data/words.d.ts +25 -0
  151. package/node_modules/@allyhub-next/formats/dist/data/words.js +2 -0
  152. package/node_modules/@allyhub-next/formats/dist/index.d.ts +16 -0
  153. package/node_modules/@allyhub-next/formats/dist/index.js +2 -0
  154. package/node_modules/@allyhub-next/formats/dist/items.d.ts +94 -0
  155. package/node_modules/@allyhub-next/formats/dist/items.js +2 -0
  156. package/node_modules/@allyhub-next/formats/dist/layout.d.ts +50 -0
  157. package/node_modules/@allyhub-next/formats/dist/layout.js +5 -0
  158. package/node_modules/@allyhub-next/formats/dist/schemas.d.ts +301 -0
  159. package/node_modules/@allyhub-next/formats/dist/schemas.js +2 -0
  160. package/node_modules/@allyhub-next/formats/package.json +14 -0
  161. package/node_modules/@allyhub-next/protocol/LICENSE +241 -0
  162. package/node_modules/@allyhub-next/protocol/dist/app.d.ts +98 -0
  163. package/node_modules/@allyhub-next/protocol/dist/app.js +2 -0
  164. package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +116 -0
  165. package/node_modules/@allyhub-next/protocol/dist/auth.js +2 -0
  166. package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +59 -0
  167. package/node_modules/@allyhub-next/protocol/dist/cli.js +2 -0
  168. package/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +274 -0
  169. package/node_modules/@allyhub-next/protocol/dist/cloud.js +2 -0
  170. package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +405 -0
  171. package/node_modules/@allyhub-next/protocol/dist/editor.js +2 -0
  172. package/node_modules/@allyhub-next/protocol/dist/files.d.ts +101 -0
  173. package/node_modules/@allyhub-next/protocol/dist/files.js +2 -0
  174. package/node_modules/@allyhub-next/protocol/dist/index.d.ts +12 -0
  175. package/node_modules/@allyhub-next/protocol/dist/index.js +2 -0
  176. package/node_modules/@allyhub-next/protocol/dist/jsonrpc.d.ts +83 -0
  177. package/node_modules/@allyhub-next/protocol/dist/jsonrpc.js +2 -0
  178. package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +53 -0
  179. package/node_modules/@allyhub-next/protocol/dist/registry.js +2 -0
  180. package/node_modules/@allyhub-next/protocol/dist/runtimes.d.ts +93 -0
  181. package/node_modules/@allyhub-next/protocol/dist/runtimes.js +2 -0
  182. package/node_modules/@allyhub-next/protocol/dist/teams.d.ts +67 -0
  183. package/node_modules/@allyhub-next/protocol/dist/teams.js +2 -0
  184. package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +345 -0
  185. package/node_modules/@allyhub-next/protocol/dist/tools.js +2 -0
  186. package/node_modules/@allyhub-next/protocol/package.json +13 -0
  187. package/node_modules/@allyhub-next/runtimes/LICENSE +241 -0
  188. package/node_modules/@allyhub-next/runtimes/dist/bundled.d.ts +10 -0
  189. package/node_modules/@allyhub-next/runtimes/dist/bundled.js +2 -0
  190. package/node_modules/@allyhub-next/runtimes/dist/download.d.ts +15 -0
  191. package/node_modules/@allyhub-next/runtimes/dist/download.js +2 -0
  192. package/node_modules/@allyhub-next/runtimes/dist/errors.d.ts +16 -0
  193. package/node_modules/@allyhub-next/runtimes/dist/errors.js +2 -0
  194. package/node_modules/@allyhub-next/runtimes/dist/home.d.ts +2 -0
  195. package/node_modules/@allyhub-next/runtimes/dist/home.js +2 -0
  196. package/node_modules/@allyhub-next/runtimes/dist/index.d.ts +9 -0
  197. package/node_modules/@allyhub-next/runtimes/dist/index.js +2 -0
  198. package/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
  199. package/node_modules/@allyhub-next/runtimes/dist/lock.js +2 -0
  200. package/node_modules/@allyhub-next/runtimes/dist/manifest.d.ts +3 -0
  201. package/node_modules/@allyhub-next/runtimes/dist/manifest.js +2 -0
  202. package/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +63 -0
  203. package/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -0
  204. package/node_modules/@allyhub-next/runtimes/dist/unpack.d.ts +7 -0
  205. package/node_modules/@allyhub-next/runtimes/dist/unpack.js +2 -0
  206. package/node_modules/@allyhub-next/runtimes/manifest.json +395 -0
  207. package/node_modules/@allyhub-next/runtimes/package.json +14 -0
  208. package/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +153 -0
  209. package/node_modules/@allyhub-next/scenery/LICENSE +241 -0
  210. package/node_modules/@allyhub-next/scenery/NOTICE +42 -0
  211. package/node_modules/@allyhub-next/scenery/dist/aim.d.ts +55 -0
  212. package/node_modules/@allyhub-next/scenery/dist/aim.js +2 -0
  213. package/node_modules/@allyhub-next/scenery/dist/bake.d.ts +203 -0
  214. package/node_modules/@allyhub-next/scenery/dist/bake.js +2 -0
  215. package/node_modules/@allyhub-next/scenery/dist/camera.d.ts +150 -0
  216. package/node_modules/@allyhub-next/scenery/dist/camera.js +2 -0
  217. package/node_modules/@allyhub-next/scenery/dist/curve.d.ts +40 -0
  218. package/node_modules/@allyhub-next/scenery/dist/curve.js +2 -0
  219. package/node_modules/@allyhub-next/scenery/dist/define.d.ts +164 -0
  220. package/node_modules/@allyhub-next/scenery/dist/define.js +2 -0
  221. package/node_modules/@allyhub-next/scenery/dist/fit.d.ts +64 -0
  222. package/node_modules/@allyhub-next/scenery/dist/fit.js +2 -0
  223. package/node_modules/@allyhub-next/scenery/dist/glass.d.ts +34 -0
  224. package/node_modules/@allyhub-next/scenery/dist/glass.js +2 -0
  225. package/node_modules/@allyhub-next/scenery/dist/handheld.d.ts +184 -0
  226. package/node_modules/@allyhub-next/scenery/dist/handheld.js +2 -0
  227. package/node_modules/@allyhub-next/scenery/dist/hull.d.ts +23 -0
  228. package/node_modules/@allyhub-next/scenery/dist/hull.js +2 -0
  229. package/node_modules/@allyhub-next/scenery/dist/index.d.ts +22 -0
  230. package/node_modules/@allyhub-next/scenery/dist/index.js +2 -0
  231. package/node_modules/@allyhub-next/scenery/dist/lens.d.ts +48 -0
  232. package/node_modules/@allyhub-next/scenery/dist/lens.js +2 -0
  233. package/node_modules/@allyhub-next/scenery/dist/moire.d.ts +136 -0
  234. package/node_modules/@allyhub-next/scenery/dist/moire.js +93 -0
  235. package/node_modules/@allyhub-next/scenery/dist/motion.d.ts +48 -0
  236. package/node_modules/@allyhub-next/scenery/dist/motion.js +2 -0
  237. package/node_modules/@allyhub-next/scenery/dist/move.d.ts +260 -0
  238. package/node_modules/@allyhub-next/scenery/dist/move.js +2 -0
  239. package/node_modules/@allyhub-next/scenery/dist/noise.d.ts +41 -0
  240. package/node_modules/@allyhub-next/scenery/dist/noise.js +2 -0
  241. package/node_modules/@allyhub-next/scenery/dist/phone.d.ts +34 -0
  242. package/node_modules/@allyhub-next/scenery/dist/phone.js +2 -0
  243. package/node_modules/@allyhub-next/scenery/dist/report.d.ts +677 -0
  244. package/node_modules/@allyhub-next/scenery/dist/report.js +2 -0
  245. package/node_modules/@allyhub-next/scenery/dist/screen-focus.d.ts +55 -0
  246. package/node_modules/@allyhub-next/scenery/dist/screen-focus.js +2 -0
  247. package/node_modules/@allyhub-next/scenery/dist/screen.d.ts +71 -0
  248. package/node_modules/@allyhub-next/scenery/dist/screen.js +2 -0
  249. package/node_modules/@allyhub-next/scenery/dist/solve.d.ts +82 -0
  250. package/node_modules/@allyhub-next/scenery/dist/solve.js +2 -0
  251. package/node_modules/@allyhub-next/scenery/dist/timing.d.ts +26 -0
  252. package/node_modules/@allyhub-next/scenery/dist/timing.js +2 -0
  253. package/node_modules/@allyhub-next/scenery/dist/vec.d.ts +19 -0
  254. package/node_modules/@allyhub-next/scenery/dist/vec.js +2 -0
  255. package/node_modules/@allyhub-next/scenery/package.json +13 -0
  256. package/node_modules/@allyhub-next/video-core/LICENSE +241 -0
  257. package/node_modules/@allyhub-next/video-core/dist/anchors.d.ts +164 -0
  258. package/node_modules/@allyhub-next/video-core/dist/anchors.js +2 -0
  259. package/node_modules/@allyhub-next/video-core/dist/audio-types.d.ts +148 -0
  260. package/node_modules/@allyhub-next/video-core/dist/audio-types.js +2 -0
  261. package/node_modules/@allyhub-next/video-core/dist/backdrop.d.ts +87 -0
  262. package/node_modules/@allyhub-next/video-core/dist/backdrop.js +2 -0
  263. package/node_modules/@allyhub-next/video-core/dist/captions.d.ts +122 -0
  264. package/node_modules/@allyhub-next/video-core/dist/captions.js +11 -0
  265. package/node_modules/@allyhub-next/video-core/dist/console.d.ts +91 -0
  266. package/node_modules/@allyhub-next/video-core/dist/console.js +2 -0
  267. package/node_modules/@allyhub-next/video-core/dist/contrast.d.ts +98 -0
  268. package/node_modules/@allyhub-next/video-core/dist/contrast.js +2 -0
  269. package/node_modules/@allyhub-next/video-core/dist/cut-report.d.ts +77 -0
  270. package/node_modules/@allyhub-next/video-core/dist/cut-report.js +2 -0
  271. package/node_modules/@allyhub-next/video-core/dist/edit.d.ts +77 -0
  272. package/node_modules/@allyhub-next/video-core/dist/edit.js +13 -0
  273. package/node_modules/@allyhub-next/video-core/dist/edits.d.ts +163 -0
  274. package/node_modules/@allyhub-next/video-core/dist/edits.js +2 -0
  275. package/node_modules/@allyhub-next/video-core/dist/export.d.ts +96 -0
  276. package/node_modules/@allyhub-next/video-core/dist/export.js +2 -0
  277. package/node_modules/@allyhub-next/video-core/dist/fact.d.ts +965 -0
  278. package/node_modules/@allyhub-next/video-core/dist/fact.js +2 -0
  279. package/node_modules/@allyhub-next/video-core/dist/footage-motion.d.ts +168 -0
  280. package/node_modules/@allyhub-next/video-core/dist/footage-motion.js +2 -0
  281. package/node_modules/@allyhub-next/video-core/dist/formats.d.ts +240 -0
  282. package/node_modules/@allyhub-next/video-core/dist/formats.js +2 -0
  283. package/node_modules/@allyhub-next/video-core/dist/gen.d.ts +37 -0
  284. package/node_modules/@allyhub-next/video-core/dist/gen.js +2 -0
  285. package/node_modules/@allyhub-next/video-core/dist/index.d.ts +40 -0
  286. package/node_modules/@allyhub-next/video-core/dist/index.js +2 -0
  287. package/node_modules/@allyhub-next/video-core/dist/look.d.ts +66 -0
  288. package/node_modules/@allyhub-next/video-core/dist/look.js +2 -0
  289. package/node_modules/@allyhub-next/video-core/dist/marks.d.ts +34 -0
  290. package/node_modules/@allyhub-next/video-core/dist/marks.js +2 -0
  291. package/node_modules/@allyhub-next/video-core/dist/matrix.d.ts +289 -0
  292. package/node_modules/@allyhub-next/video-core/dist/matrix.js +2 -0
  293. package/node_modules/@allyhub-next/video-core/dist/measure.d.ts +465 -0
  294. package/node_modules/@allyhub-next/video-core/dist/measure.js +5 -0
  295. package/node_modules/@allyhub-next/video-core/dist/media.d.ts +226 -0
  296. package/node_modules/@allyhub-next/video-core/dist/media.js +2 -0
  297. package/node_modules/@allyhub-next/video-core/dist/messages.d.ts +88 -0
  298. package/node_modules/@allyhub-next/video-core/dist/messages.js +2 -0
  299. package/node_modules/@allyhub-next/video-core/dist/motion.d.ts +56 -0
  300. package/node_modules/@allyhub-next/video-core/dist/motion.js +2 -0
  301. package/node_modules/@allyhub-next/video-core/dist/music.d.ts +110 -0
  302. package/node_modules/@allyhub-next/video-core/dist/music.js +2 -0
  303. package/node_modules/@allyhub-next/video-core/dist/piece.d.ts +1146 -0
  304. package/node_modules/@allyhub-next/video-core/dist/piece.js +2 -0
  305. package/node_modules/@allyhub-next/video-core/dist/placement.d.ts +37 -0
  306. package/node_modules/@allyhub-next/video-core/dist/placement.js +2 -0
  307. package/node_modules/@allyhub-next/video-core/dist/problem.d.ts +262 -0
  308. package/node_modules/@allyhub-next/video-core/dist/problem.js +2 -0
  309. package/node_modules/@allyhub-next/video-core/dist/render-types.d.ts +49 -0
  310. package/node_modules/@allyhub-next/video-core/dist/render-types.js +2 -0
  311. package/node_modules/@allyhub-next/video-core/dist/schema.d.ts +352 -0
  312. package/node_modules/@allyhub-next/video-core/dist/schema.js +2 -0
  313. package/node_modules/@allyhub-next/video-core/dist/script-edit.d.ts +176 -0
  314. package/node_modules/@allyhub-next/video-core/dist/script-edit.js +2 -0
  315. package/node_modules/@allyhub-next/video-core/dist/script.d.ts +67 -0
  316. package/node_modules/@allyhub-next/video-core/dist/script.js +2 -0
  317. package/node_modules/@allyhub-next/video-core/dist/seams.d.ts +214 -0
  318. package/node_modules/@allyhub-next/video-core/dist/seams.js +2 -0
  319. package/node_modules/@allyhub-next/video-core/dist/slides.d.ts +37 -0
  320. package/node_modules/@allyhub-next/video-core/dist/slides.js +2 -0
  321. package/node_modules/@allyhub-next/video-core/dist/sound-under.d.ts +72 -0
  322. package/node_modules/@allyhub-next/video-core/dist/sound-under.js +2 -0
  323. package/node_modules/@allyhub-next/video-core/dist/speech.d.ts +83 -0
  324. package/node_modules/@allyhub-next/video-core/dist/speech.js +5 -0
  325. package/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +616 -0
  326. package/node_modules/@allyhub-next/video-core/dist/timeline.js +2 -0
  327. package/node_modules/@allyhub-next/video-core/dist/timing.d.ts +88 -0
  328. package/node_modules/@allyhub-next/video-core/dist/timing.js +2 -0
  329. package/node_modules/@allyhub-next/video-core/dist/transcript.d.ts +288 -0
  330. package/node_modules/@allyhub-next/video-core/dist/transcript.js +2 -0
  331. package/node_modules/@allyhub-next/video-core/dist/transition.d.ts +289 -0
  332. package/node_modules/@allyhub-next/video-core/dist/transition.js +2 -0
  333. package/node_modules/@allyhub-next/video-core/dist/voice.d.ts +175 -0
  334. package/node_modules/@allyhub-next/video-core/dist/voice.js +2 -0
  335. package/node_modules/@allyhub-next/video-core/dist/words.d.ts +128 -0
  336. package/node_modules/@allyhub-next/video-core/dist/words.js +2 -0
  337. package/node_modules/@allyhub-next/video-core/package.json +14 -0
  338. package/package.json +52 -41
  339. package/README.md +0 -17
  340. package/dist/anim.d.ts.map +0 -1
  341. package/dist/anim.js.map +0 -1
  342. package/dist/define.d.ts.map +0 -1
  343. package/dist/define.js.map +0 -1
  344. package/dist/dom.d.ts.map +0 -1
  345. package/dist/dom.js.map +0 -1
  346. package/dist/fit.d.ts.map +0 -1
  347. package/dist/fit.js.map +0 -1
  348. package/dist/index.d.ts.map +0 -1
  349. package/dist/index.js.map +0 -1
  350. package/dist/media.d.ts.map +0 -1
  351. package/dist/media.js.map +0 -1
  352. package/dist/messages.d.ts.map +0 -1
  353. package/dist/messages.js.map +0 -1
  354. package/dist/noise.d.ts.map +0 -1
  355. package/dist/noise.js.map +0 -1
  356. package/dist/parts.d.ts.map +0 -1
  357. package/dist/parts.js.map +0 -1
  358. package/dist/paths.d.ts.map +0 -1
  359. package/dist/paths.js.map +0 -1
  360. package/dist/piece.d.ts.map +0 -1
  361. package/dist/piece.js.map +0 -1
  362. package/dist/props.d.ts.map +0 -1
  363. package/dist/props.js.map +0 -1
  364. package/dist/text.d.ts.map +0 -1
  365. package/dist/text.js.map +0 -1
@@ -0,0 +1,91 @@
1
+ import type { Combo } from "./matrix.js";
2
+ export declare const CONSOLE_LEVELS: readonly ["log", "info", "warn", "error", "debug"];
3
+ export type ConsoleLevel = (typeof CONSOLE_LEVELS)[number];
4
+ /**
5
+ * What piece code was doing when it printed: loading its files' top level
6
+ * (`module`), running the output's function (`build`), a layer's `mount`
7
+ * or `render`, drawing a cover (`cover`), or anything else, such as a
8
+ * callback that ran later (`other`).
9
+ */
10
+ export type ConsolePhase = "module" | "build" | "mount" | "render" | "cover" | "other";
11
+ /** Where a console call was made, as the stage knows it. */
12
+ export interface ConsoleWhere {
13
+ phase: ConsolePhase;
14
+ /** The part (or page) whose layer was running. */
15
+ part?: string;
16
+ /** The layer's component name ("custom" for custom()). */
17
+ layer?: string;
18
+ /** The layer's place in its part's `layers`, from 0. */
19
+ index?: number;
20
+ /** render and cover: the part time drawn, seconds from the part's start (render's t). */
21
+ t?: number;
22
+ }
23
+ /** One message: the same text printed at the same place, with its count. */
24
+ export interface ConsoleMessage extends ConsoleWhere {
25
+ level: ConsoleLevel;
26
+ text: string;
27
+ /** render: the latest part time it was printed at, when later than `t`. */
28
+ until?: number;
29
+ /** How many calls printed it. */
30
+ count: number;
31
+ }
32
+ /** What one output × combo × format printed. */
33
+ export interface ConsoleLog {
34
+ messages: ConsoleMessage[];
35
+ /** Calls not kept: their message came after `limit` others. */
36
+ dropped: number;
37
+ }
38
+ /** A message with the output × combo × format it came from. */
39
+ export interface ConsoleEntry extends ConsoleMessage {
40
+ piece: string;
41
+ output: string;
42
+ combo: Combo;
43
+ format: string;
44
+ }
45
+ /** What a command's pages printed, for the CLI. */
46
+ export interface ConsoleReport {
47
+ entries: ConsoleEntry[];
48
+ /** Calls not kept, over every output × combo × format. */
49
+ dropped: number;
50
+ /** The most messages kept per output × combo × format. */
51
+ limit: number;
52
+ }
53
+ /** The most different messages kept per output × combo × format by default. */
54
+ export declare const CONSOLE_LIMIT = 200;
55
+ /** The longest text kept of one call, in characters; the rest is cut with a note. */
56
+ export declare const CONSOLE_TEXT_MAX = 4000;
57
+ /**
58
+ * Collects messages: the same text at the same place counts once (with the
59
+ * earliest and latest part time it was printed at), at most `limit`
60
+ * different ones. Pure: the stage and the host both use it.
61
+ */
62
+ export declare class ConsoleCollector {
63
+ readonly limit: number;
64
+ private readonly kept;
65
+ private droppedCalls;
66
+ constructor(limit?: number);
67
+ /** Adds one call (or `count` calls, from another collector). */
68
+ add(m: ConsoleWhere & {
69
+ level: ConsoleLevel;
70
+ text: string;
71
+ count?: number;
72
+ until?: number;
73
+ }): void;
74
+ /** Adds what another collector kept and dropped. */
75
+ merge(log: ConsoleLog): void;
76
+ /**
77
+ * What was kept, in order: phase (module, build, mount, render, cover,
78
+ * other), then part in `parts` order, then part time, then first printed.
79
+ */
80
+ log(parts?: readonly string[]): ConsoleLog;
81
+ }
82
+ /** A value as console.log would show it, on one line where it can be. */
83
+ export declare function consoleValue(v: unknown): string;
84
+ /**
85
+ * The text of one console call: format specifiers in a first string
86
+ * (%s %d %i %f %o %O %j %c %%) take the next arguments, as the browser's
87
+ * console does, and the rest follow separated by spaces. Cut at
88
+ * CONSOLE_TEXT_MAX characters, saying how many more there were.
89
+ */
90
+ export declare function consoleText(args: readonly unknown[]): string;
91
+ //# sourceMappingURL=console.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 const CONSOLE_LEVELS=["log","info","warn","error","debug"];const f={module:0,build:1,mount:2,render:3,cover:4,other:5};export const CONSOLE_LIMIT=200,CONSOLE_TEXT_MAX=4e3;const p=t=>[t.level,t.phase,t.part??"",t.layer??"",t.index??"",t.text].join("\0");export class ConsoleCollector{limit;kept=new Map;droppedCalls=0;constructor(e=CONSOLE_LIMIT){this.limit=Math.max(0,e)}add(e){const r=e.count??1,i=p(e),n=this.kept.get(i);if(n){n.count+=r;const o=[n.t,e.t].filter(s=>s!==void 0),u=[n.until??n.t,e.until??e.t].filter(s=>s!==void 0);if(o.length>0){const s=Math.min(...o),a=Math.max(...u);n.t=s,a>s&&(n.until=a)}return}if(this.kept.size>=this.limit){this.droppedCalls+=r;return}this.kept.set(i,{level:e.level,text:e.text,phase:e.phase,...e.part===void 0?{}:{part:e.part},...e.layer===void 0?{}:{layer:e.layer},...e.index===void 0?{}:{index:e.index},...e.t===void 0?{}:{t:e.t},...e.until!==void 0&&e.t!==void 0&&e.until>e.t?{until:e.until}:{},count:r})}merge(e){for(const r of e.messages)this.add(r);this.droppedCalls+=e.dropped}log(e=[]){const r=new Map(e.map((n,o)=>[n,o]));return{messages:[...this.kept.values()].map((n,o)=>({m:n,i:o})).sort((n,o)=>f[n.m.phase]-f[o.m.phase]||(r.get(n.m.part??"")??-1)-(r.get(o.m.part??"")??-1)||(n.m.t??-1)-(o.m.t??-1)||n.i-o.i).map(({m:n})=>({...n})),dropped:this.droppedCalls}}}function c(t){const e=globalThis.Node;if(!e||!(t instanceof e))return;const r=t;if(r.nodeType===1){const i=[...r.classList??[]].map(n=>`.${n}`).join("");return`<${r.nodeName.toLowerCase()}${i}${r.id?`#${r.id}`:""}>`}return JSON.stringify(r.textContent??"")}function l(t){if(typeof t=="bigint")return`${String(t)}n`;if(typeof t=="function")return`[Function${t.name?` ${t.name}`:""}]`;if(typeof t=="number"&&!Number.isFinite(t))return String(t);if(typeof t!="object"||t===null)return t;if(t instanceof Error)return`${t.name}: ${t.message}`;const e=c(t);return e!==void 0?e:t instanceof Map?{Map:[...t]}:t instanceof Set?{Set:[...t]}:ArrayBuffer.isView(t)&&!(t instanceof DataView)?Array.from(t):t}function d(t){const e=[];try{return JSON.stringify(t,function(r,i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(typeof i!="object"||i===null)return l(i);if(e.includes(i))return"[Circular]";e.push(i);const n=l(i);return n!==i&&typeof n=="object"&&n!==null&&e.push(n),n})}catch{return Object.prototype.toString.call(t)}}export function consoleValue(t){switch(typeof t){case"string":return t;case"number":case"boolean":case"undefined":return String(t);case"bigint":return`${String(t)}n`;case"symbol":return t.toString();case"function":return`[Function${t.name?` ${t.name}`:""}]`;case"object":{if(t===null)return"null";if(t instanceof Error)return`${t.name}: ${t.message}`;const e=c(t);return e!==void 0?e:d(t)}}}export function consoleText(t){const e=[...t],r=[],i=e[0];typeof i=="string"&&i.includes("%")&&(e.shift(),r.push(i.replace(/%([sdifoOjc%])/g,(o,u)=>{if(u==="%")return"%";if(e.length===0)return o;const s=e.shift();if(u==="c")return"";if(u==="d"||u==="i"||u==="f"){const a=typeof s=="symbol"?NaN:Number(s);return String(u==="f"?a:Math.trunc(a))}return consoleValue(s)}))),r.push(...e.map(consoleValue));const n=r.join(" ");return n.length<=CONSOLE_TEXT_MAX?n:`${n.slice(0,CONSOLE_TEXT_MAX)}… (${String(n.length-CONSOLE_TEXT_MAX)} more characters)`}
@@ -0,0 +1,98 @@
1
+ import type { MeasuredText } from "./measure.js";
2
+ import type { Box } from "./problem.js";
3
+ /**
4
+ * A style sheet that hides every text's fill and nothing else: borders and
5
+ * icons drawn in `currentColor`, shadows and strokes round letters, and
6
+ * colour emoji stay. What a capture then has at the glyphs is what is
7
+ * behind them.
8
+ */
9
+ export declare const HIDE_TEXT_CSS: string;
10
+ /**
11
+ * The same, with the strokes and shadows round letters hidden too: what a
12
+ * capture has at the glyphs is then the picture under a text's outline.
13
+ */
14
+ export declare const HIDE_OUTLINE_CSS = "*{-webkit-text-fill-color:transparent!important;caret-color:transparent!important;transition:none!important}svg text,svg tspan,svg textPath{fill:transparent!important}*{-webkit-text-stroke-color:transparent!important;text-shadow:none!important}";
15
+ /** A colour in sRGB, channels 0–255, alpha 0–1. */
16
+ export type Rgba = [r: number, g: number, b: number, a: number];
17
+ /** One line of a text block's glyphs, as the stage draws it. */
18
+ export interface InkLine {
19
+ /** The line's glyph box in the frame's pixels (not rounded; the frame may cut it). */
20
+ box: Box;
21
+ /** The colour its glyphs are filled with; absent when the fill is not a colour (transparent: a background clipped to the text). */
22
+ fill?: Rgba;
23
+ /** Its text node's opacity, its ancestors' included. */
24
+ opacity: number;
25
+ }
26
+ /** A text block with what its contrast is measured from (LoadedOutput.inks). */
27
+ export interface TextInk {
28
+ text: MeasuredText;
29
+ lines: InkLine[];
30
+ /** Its font size in the frame's pixels (its transforms' scale counted), and its weight. */
31
+ size: number;
32
+ weight: number;
33
+ /** A text-shadow or a stroke round its letters: drawn with the picture behind its fill, so it counts there. */
34
+ shadow?: true;
35
+ stroke?: true;
36
+ }
37
+ /** How the text-contrast fact measures. */
38
+ export interface ContrastOptions {
39
+ /** The low percentile reported beside the minimum and the median (0–100). */
40
+ percentile: number;
41
+ /** The scale the picture behind the text is captured at (0–1 of the frame's pixels). */
42
+ scale: number;
43
+ /** Blocks drawn at a lower opacity (fading in or out) are left out (0: every block). */
44
+ opacity: number;
45
+ }
46
+ /**
47
+ * The 10th percentile beside the minimum and the median; the picture
48
+ * behind captured at the frame's own pixels; blocks drawn at 90 % opacity
49
+ * or more (whole, as text-time counts it).
50
+ */
51
+ export declare const CONTRAST_DEFAULTS: Readonly<ContrastOptions>;
52
+ /** The options with the defaults filled in, checked. */
53
+ export declare function contrastOptions(o?: Partial<ContrastOptions>): ContrastOptions;
54
+ /** WCAG 2.1 relative luminance of an sRGB colour (0–1). */
55
+ export declare function luminance(r: number, g: number, b: number): number;
56
+ /** WCAG 2.1 contrast ratio of two luminances: 1 (none) to 21 (black on white). */
57
+ export declare function contrastRatio(la: number, lb: number): number;
58
+ /** A colour drawn at `alpha` over an opaque one. */
59
+ export declare function over(fg: readonly [number, number, number], alpha: number, bg: readonly [number, number, number]): [number, number, number];
60
+ /** #rrggbb, with the alpha as two more digits when under 1. */
61
+ export declare function hexOf(c: readonly number[]): string;
62
+ /** A picture's pixels, RGBA, row by row. */
63
+ export interface Pixels {
64
+ width: number;
65
+ height: number;
66
+ data: Uint8Array;
67
+ }
68
+ /** Where a picture lies in the frame: its pixel (0, 0) is at frame (x, y), and each of its pixels spans `scale` frame pixels (2: captured at half size). */
69
+ export interface PixelsAt {
70
+ x: number;
71
+ y: number;
72
+ scale: number;
73
+ }
74
+ /** The ratios over the pixels behind a block's glyphs. */
75
+ export interface ContrastStats {
76
+ min: number;
77
+ low: number;
78
+ median: number;
79
+ /** Pixels measured. */
80
+ pixels: number;
81
+ /** The picture behind, #rrggbb: the median of each channel, and the pixel at the minimum. */
82
+ background: {
83
+ median: string;
84
+ atMin: string;
85
+ };
86
+ }
87
+ /**
88
+ * The contrast between each line's fill and every pixel of `behind` inside
89
+ * that line's glyph box (the box in frame pixels; `at` places the picture
90
+ * in the frame): the fill drawn at its alpha × opacity over the pixel,
91
+ * against the pixel. The minimum, the `percentile`th lowest and the
92
+ * median, and the colours behind. Undefined when no line has a colour or
93
+ * no pixel of the picture is inside a line's box.
94
+ */
95
+ export declare function contrastOver(lines: readonly InkLine[], behind: Pixels, at: PixelsAt, percentile: number): ContrastStats | undefined;
96
+ /** The box round a block's lines, whole frame pixels, inside the frame; undefined when none of it is inside. */
97
+ export declare function linesRegion(lines: readonly InkLine[], width: number, height: number): Box | undefined;
98
+ //# sourceMappingURL=contrast.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 const HIDE_TEXT_CSS="*{-webkit-text-fill-color:transparent!important;caret-color:transparent!important;transition:none!important}svg text,svg tspan,svg textPath{fill:transparent!important}",HIDE_OUTLINE_CSS=`${HIDE_TEXT_CSS}*{-webkit-text-stroke-color:transparent!important;text-shadow:none!important}`,CONTRAST_DEFAULTS={percentile:10,scale:1,opacity:.9};export function contrastOptions(o={}){const t=(n,r,a)=>{const e=o[n];return e!==void 0&&Number.isFinite(e)&&e>=r&&e<=a?e:CONTRAST_DEFAULTS[n]};return{percentile:t("percentile",0,100),scale:t("scale",.05,1),opacity:t("opacity",0,1)}}const S=o=>{const t=o/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4};export function luminance(o,t,n){return .2126*S(o)+.7152*S(t)+.0722*S(n)}export function contrastRatio(o,t){const n=Math.max(o,t),r=Math.min(o,t);return(n+.05)/(r+.05)}export function over(o,t,n){const r=Math.min(1,Math.max(0,t));return[o[0]*r+n[0]*(1-r),o[1]*r+n[1]*(1-r),o[2]*r+n[2]*(1-r)]}const u=o=>Math.round(Math.min(255,Math.max(0,o))).toString(16).padStart(2,"0");export function hexOf(o){const[t=0,n=0,r=0,a=1]=o;return`#${u(t)}${u(n)}${u(r)}${a<1?u(a*255):""}`}const b=o=>Math.round(o*100)/100;export function contrastOver(o,t,n,r){const a=[],e=[],p=[],x=[];let f=1/0,m=[0,0,0];for(const h of o){const s=h.fill;if(!s)continue;const E=s[3]*h.opacity,[v,T,O,_]=h.box,$=Math.max(0,Math.ceil((v-n.x)/n.scale-.5)),k=Math.max(0,Math.ceil((T-n.y)/n.scale-.5)),A=Math.min(t.width-1,Math.floor((v+O-n.x)/n.scale-.5)),F=Math.min(t.height-1,Math.floor((T+_-n.y)/n.scale-.5));for(let y=k;y<=F;y++)for(let d=$;d<=A;d++){const g=(y*t.width+d)*4,c=[t.data[g]??0,t.data[g+1]??0,t.data[g+2]??0],w=over([s[0],s[1],s[2]],E,c),I=contrastRatio(luminance(w[0],w[1],w[2]),luminance(c[0],c[1],c[2]));a.push(I),e.push(c[0]),p.push(c[1]),x.push(c[2]),I<f&&(f=I,m=c)}}if(a.length===0)return;const l=Float64Array.from(a).sort(),i=h=>l[Math.min(l.length-1,Math.floor(h/100*l.length))]??0,M=h=>{const s=Float64Array.from(h).sort();return s[Math.floor(s.length/2)]??0};return{min:b(l[0]??0),low:b(i(r)),median:b(i(50)),pixels:a.length,background:{median:hexOf([M(e),M(p),M(x)]),atMin:hexOf(m)}}}export function linesRegion(o,t,n){let r=1/0,a=1/0,e=-1/0,p=-1/0;for(const{box:i}of o)r=Math.min(r,i[0]),a=Math.min(a,i[1]),e=Math.max(e,i[0]+i[2]),p=Math.max(p,i[1]+i[3]);const x=Math.max(0,Math.floor(r)),f=Math.max(0,Math.floor(a)),m=Math.min(t,Math.ceil(e)),l=Math.min(n,Math.ceil(p));return m>x&&l>f?[x,f,m-x,l-f]:void 0}
@@ -0,0 +1,77 @@
1
+ import { type EditList, type EditRange, type EditedSpeech, type KeptRange, type SoundCut } from "./edits.js";
2
+ import type { Word } from "./media.js";
3
+ import { type Join } from "./transcript.js";
4
+ import { type RoomLevel, type VoiceFrames } from "./voice.js";
5
+ export interface CutReportOptions {
6
+ /** Words [from, to] of the take (default every word). */
7
+ from?: number;
8
+ to?: number;
9
+ /** The frame grid cuts are placed on (default 30). */
10
+ fps?: number;
11
+ /** A join's silence is its 10 ms frames under this level, dBFS (default the take's speech/silence threshold). */
12
+ quiet?: number;
13
+ /** Seconds of each word next to a cut whose mean level gives the step across a join (default JOIN_NEAR). */
14
+ near?: number;
15
+ /** The take's length, seconds (default its last word's end). */
16
+ duration?: number;
17
+ }
18
+ /** A run of removed words. */
19
+ export interface Removal {
20
+ from: number;
21
+ to: number;
22
+ start: number;
23
+ end: number;
24
+ text: string;
25
+ }
26
+ /** The room tone, and how a fill would be matched at each end of what is kept. */
27
+ export interface RoomReport {
28
+ from: number;
29
+ to: number;
30
+ /** The floor of the room tone where a fill plays it, dBFS. */
31
+ level: number | null;
32
+ lead: {
33
+ word: number;
34
+ pad: number;
35
+ } & RoomLevel;
36
+ tail: {
37
+ word: number;
38
+ pad: number;
39
+ } & RoomLevel;
40
+ }
41
+ export interface CutReport {
42
+ from: number;
43
+ to: number;
44
+ fps: number;
45
+ /** The padding each cut keeps into the silence, seconds. */
46
+ pad: {
47
+ before: number;
48
+ after: number;
49
+ };
50
+ /** Whether the pad is the edits file's own. */
51
+ padGiven: boolean;
52
+ kept: KeptRange[];
53
+ removed: Removal[];
54
+ sounds: SoundCut[];
55
+ /** Sounds the edits file lists that are not between two kept words here: nothing was cut. */
56
+ soundsUnused: SoundCut[];
57
+ inWord: EditedSpeech["inWord"];
58
+ /** inWord stretches that cut nothing here (outside what is kept, or under 0.04 s once placed). */
59
+ inWordUnplaced: SoundCut[];
60
+ pauses: EditedSpeech["pauses"];
61
+ /** Ranges the take no longer says (AK-T005). */
62
+ lost: EditRange[];
63
+ seconds: {
64
+ before: number;
65
+ after: number;
66
+ removed: number;
67
+ };
68
+ /** Null without the take's levels, or when it has no steady quiet stretch. */
69
+ roomTone: RoomReport | null;
70
+ joins: Join[];
71
+ /** The level a join's silence is under, dBFS; null without levels. */
72
+ quietBelow: number | null;
73
+ near: number;
74
+ }
75
+ /** What an edits file keeps and removes of words [from, to] of a take, and every join. */
76
+ export declare function cutReport(words: readonly Word[], list: EditList, frames: VoiceFrames | undefined, options?: CutReportOptions): CutReport;
77
+ //# sourceMappingURL=cut-report.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{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}}}
@@ -0,0 +1,77 @@
1
+ import { type FormattingOptions, type JSONPath } from "jsonc-parser";
2
+ /** A key's new value; undefined deletes it. */
3
+ export interface KeyEdit {
4
+ key: string;
5
+ value?: unknown;
6
+ }
7
+ /** The indentation and line ending the file already uses. */
8
+ export declare function formattingOf(text: string): FormattingOptions;
9
+ /** A value on one line, the way prettier prints it: `["a", "b"]`, `{ "k": 1 }`. */
10
+ export declare function inline(v: unknown): string;
11
+ /**
12
+ * Sets (or with `undefined` deletes) the value at a path of keys and
13
+ * indexes of a JSON document; the empty path replaces the whole document.
14
+ * A new key goes where `insertAt` says among its siblings (default: last).
15
+ * Lists and objects that were on one line (or are new) stay on one line
16
+ * when they fit.
17
+ */
18
+ export declare function editJsonAt(text: string, at: readonly (string | number)[], value: unknown, insertAt?: (props: string[]) => number): string;
19
+ /** The value at a path of a JSON document; undefined when it is not there. */
20
+ export declare function readJsonAt(text: string, path: JSONPath): unknown;
21
+ /**
22
+ * Applies edits to the top-level keys of a JSON object. A new key goes after
23
+ * the last key that comes before it in `order` (the default language's
24
+ * strings, so every language file keeps the same order), else at the end.
25
+ */
26
+ export declare function editJsonKeys(text: string, edits: readonly KeyEdit[], order?: readonly string[]): string;
27
+ /** A field of a CSV file and where its text is (start inclusive, end exclusive). */
28
+ interface CsvField {
29
+ value: string;
30
+ start: number;
31
+ end: number;
32
+ quoted: boolean;
33
+ }
34
+ /**
35
+ * RFC 4180 rows with where each field is, skipping blank lines the way the
36
+ * build reads CSV (`@allyhub/build`'s parseCsvRows): the first row is the
37
+ * header.
38
+ */
39
+ export declare function csvFields(text: string): CsvField[][];
40
+ /** A cell by data row (0 = the first row after the header) and column name. */
41
+ export declare function csvCell(text: string, row: number, column: string): CsvField | undefined;
42
+ /** Replaces one cell's text; quotes it when it must be (or was) quoted. */
43
+ export declare function editCsvCell(text: string, row: number, column: string, value: string): string;
44
+ /** Where an edit is: a messages key, a JSON path, or a CSV cell. */
45
+ export type EditLocation = string | {
46
+ pointer: (string | number)[];
47
+ } | {
48
+ row: number;
49
+ column: string;
50
+ };
51
+ /** null means absent: a key that is not there, a value to delete. */
52
+ export type EditValue = unknown;
53
+ export type EditOutcome = {
54
+ ok: true;
55
+ text: string;
56
+ } | {
57
+ ok: false;
58
+ reason: "conflict";
59
+ current: EditValue;
60
+ } | {
61
+ ok: false;
62
+ reason: "invalid";
63
+ message: string;
64
+ };
65
+ /** Which kind of file an edit can change. */
66
+ export declare function editableKind(path: string): "json" | "csv" | undefined;
67
+ /** The value now at a location of a file's text; null when absent. */
68
+ export declare function valueAt(text: string | null, path: string, at: EditLocation): EditValue;
69
+ /**
70
+ * Applies one edit to a file's text if the value there is still `before`
71
+ * (if it is, only that value changes; if not, it is a conflict). A file that does not
72
+ * exist is `null`; it can only gain a JSON value. `after` null deletes a
73
+ * JSON value (a translation cleared); a CSV cell becomes empty.
74
+ */
75
+ export declare function applyEdit(text: string | null, path: string, at: EditLocation, before: EditValue, after: EditValue, order?: readonly string[]): EditOutcome;
76
+ export {};
77
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1,13 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{applyEdits as h,findNodeAtLocation as g,getNodeValue as S,modify as w,parseTree as p}from"jsonc-parser";import{dequal as m}from"dequal/lite";export function formattingOf(n){const o=n.includes(`\r
3
+ `)?`\r
4
+ `:`
5
+ `,e=/\n([ \t]+)"/.exec(n)?.[1]??" ";return e.startsWith(" ")?{insertSpaces:!1,tabSize:1,eol:o}:{insertSpaces:!0,tabSize:e.length,eol:o}}const b=80;export function inline(n){if(Array.isArray(n))return`[${n.map(inline).join(", ")}]`;if(typeof n=="object"&&n!==null){const o=Object.entries(n).map(([e,r])=>`${JSON.stringify(e)}: ${inline(r)}`);return o.length?`{ ${o.join(", ")} }`:"{}"}return JSON.stringify(n)}const y={type:"object",offset:0,length:0};export function editJsonAt(n,o,e,r){const t=formattingOf(n);if(o.length===0){const s=t.insertSpaces?t.tabSize:" ";return`${JSON.stringify(e,null,s)}${t.eol??`
6
+ `}`}const u=[...o];let i=n.trim()===""?`{}
7
+ `:n;const f=g(p(i)??y,u),c=f===void 0||!i.slice(f.offset,f.offset+f.length).includes(`
8
+ `);if(i=h(i,w(i,u,e,{formattingOptions:t,...r?{getInsertionIndex:r}:{}})),e!==null&&typeof e=="object"&&c){const s=g(p(i)??y,u),l=inline(e);if(s){const d=i.lastIndexOf(`
9
+ `,s.offset)+1;s.offset-d+l.length+1<=b&&(i=i.slice(0,s.offset)+l+i.slice(s.offset+s.length))}}return i}export function readJsonAt(n,o){const e=p(n);if(!e)return;const r=g(e,o);return r?S(r):void 0}export function editJsonKeys(n,o,e=[]){let r=n;for(const{key:t,value:u}of o){const i=e.indexOf(t);r=editJsonAt(r,[t],u,f=>{if(i<0)return f.length;let c=f.length,s=-1;return f.forEach((l,d)=>{const a=e.indexOf(l);a>=0&&a<i&&a>s&&(s=a,c=d+1)}),s<0&&f.some(l=>e.indexOf(l)>i)?0:c})}return r}export function csvFields(n){const o=[];let e=[],t=n.startsWith("\uFEFF")?1:0,u=t,i="",f=!1,c=!1;const s=l=>{e.push({value:i,start:u,end:l,quoted:c}),i="",c=!1};for(;t<n.length;t++){const l=n.charAt(t);if(f){l==='"'?n[t+1]==='"'?(i+='"',t++):f=!1:i+=l;continue}l==='"'?(f=!0,c=!0):l===","?(s(t),u=t+1):l===`
10
+ `||l==="\r"?(s(t),o.push(e),e=[],l==="\r"&&n[t+1]===`
11
+ `&&t++,u=t+1):i+=l}return(i!==""||e.length>0||c)&&(s(n.length),o.push(e)),o.filter(l=>l.some(d=>d.value!==""))}export function csvCell(n,o,e){const[r,...t]=csvFields(n),u=r?.findIndex(i=>i.value.trim()===e)??-1;if(!(u<0))return t[o]?.[u]}const $=/[",\r\n]|^\s|\s$/;export function editCsvCell(n,o,e,r){const t=csvCell(n,o,e);if(!t)throw new Error(`There is no cell ${e} in row ${String(o+1)}.`);const u=t.quoted||$.test(r)?`"${r.replace(/"/g,'""')}"`:r;return n.slice(0,t.start)+u+n.slice(t.end)}export function editableKind(n){if(/\.json$/i.test(n))return"json";if(/\.csv$/i.test(n))return"csv"}export function valueAt(n,o,e){if(n===null)return null;if(editableKind(o)==="csv")return typeof e!="object"||!("row"in e)?null:csvCell(n,e.row,e.column)?.value??null;const t=typeof e=="string"?[e]:"pointer"in e?e.pointer:void 0;return t?readJsonAt(n,t)??null:null}export function applyEdit(n,o,e,r,t,u=[]){const i=editableKind(o);if(!i)return{ok:!1,reason:"invalid",message:`${o} cannot be edited in the preview: only messages and JSON or CSV data files can.`};const f=valueAt(n,o,e);if(!m(f,r??null))return{ok:!1,reason:"conflict",current:f};if(m(f,t??null))return{ok:!0,text:n??""};if(i==="csv")return typeof e!="object"||!("row"in e)?{ok:!1,reason:"invalid",message:"An edit to a CSV file needs { row, column }."}:n===null||t!==null&&typeof t!="string"?{ok:!1,reason:"invalid",message:"A CSV cell can only be text."}:csvCell(n,e.row,e.column)?{ok:!0,text:editCsvCell(n,e.row,e.column,t??"")}:{ok:!1,reason:"invalid",message:`${o} has no cell ${e.column} in row ${String(e.row+1)}.`};if(typeof e=="object"&&"row"in e)return{ok:!1,reason:"invalid",message:"An edit to a JSON file needs a key or { pointer }."};if(n!==null&&p(n)?.type!=="object")return{ok:!1,reason:"invalid",message:`${o} is not a JSON object.`};const c=t===null?void 0:t,s=typeof e=="string"?editJsonKeys(n??"",[{key:e,value:c}],u):editJsonAt(n??"",e.pointer,c);return{ok:!0,text:n===null&&!s.endsWith(`
12
+ `)?`${s}
13
+ `:s}}
@@ -0,0 +1,163 @@
1
+ import type { Word } from "./media.js";
2
+ import { type VoiceFrames } from "./voice.js";
3
+ import { WordStream } from "./words.js";
4
+ /** Words removed: indices into the take's words file, inclusive, with their text. */
5
+ export interface EditRange {
6
+ from: number;
7
+ to: number;
8
+ /**
9
+ * The removed words as text: when the words file changes (transcribed
10
+ * again), the range is found again by its text, nearest its old place.
11
+ */
12
+ text?: string;
13
+ }
14
+ /** A sound removed: its stretch of the take's file, seconds (from `allyhub words`). */
15
+ export interface SoundCut {
16
+ from: number;
17
+ to: number;
18
+ }
19
+ /** An edits file: `edits/<name>.json`. */
20
+ export interface EditList {
21
+ /** Ranges of words to remove. */
22
+ remove?: EditRange[];
23
+ /**
24
+ * Sounds between words to remove, by their stretch of the file. A cut
25
+ * never reaches into a kept word, whatever the stretch says.
26
+ */
27
+ sounds?: SoundCut[];
28
+ /**
29
+ * Stretches of the file to remove even inside a kept word: a sound
30
+ * attached to a word with no silence between ("so-um"), which `sounds`
31
+ * would never reach. Cut as listed: each end moves only to the quietest
32
+ * 10 ms within 40 ms. Nothing finds these: `allyhub words` measures
33
+ * the words, the choice is the agent's.
34
+ */
35
+ inWord?: SoundCut[];
36
+ /** Pauses between kept words longer than this many seconds are shortened to it. */
37
+ maxPause?: number;
38
+ /**
39
+ * Seconds of silence kept beside each cut: `before` it, after the last
40
+ * kept word (default PAD_BEFORE, 0.12), and `after` it, before the next
41
+ * kept word (default PAD_AFTER, 0.08). Never past half the silence.
42
+ */
43
+ pad?: CutPad;
44
+ }
45
+ /** Seconds of silence kept on each side of a cut (EditList.pad). */
46
+ export interface CutPad {
47
+ before?: number;
48
+ after?: number;
49
+ }
50
+ /** A kept stretch of the take's file, in its seconds. */
51
+ export interface KeptRange {
52
+ from: number;
53
+ to: number;
54
+ }
55
+ export interface EditedSpeech {
56
+ /** Kept stretches of the file, in order, from the first kept word's start to the last one's end. */
57
+ ranges: KeptRange[];
58
+ /** The kept words on the edited clock: 0 at the first kept word's start. */
59
+ words: Word[];
60
+ /** Indices (in the words file) of the kept words. */
61
+ kept: number[];
62
+ /** Indices of removed words. */
63
+ removed: number[];
64
+ /** Sounds removed inside the stretch, clamped to the silence between kept words. */
65
+ sounds: SoundCut[];
66
+ /**
67
+ * Stretches cut inside kept speech (`inWord`), as placed, with the kept
68
+ * words each one cuts into.
69
+ */
70
+ inWord: (SoundCut & {
71
+ words: number[];
72
+ })[];
73
+ /** Pauses shortened: after word index `after`, from `was` seconds to `now`. */
74
+ pauses: {
75
+ after: number;
76
+ was: number;
77
+ now: number;
78
+ }[];
79
+ /** Edit ranges whose words are no longer in the take (AK-T005). */
80
+ lost: EditRange[];
81
+ }
82
+ /**
83
+ * Seconds kept into the silence beside a cut when the edits file does not
84
+ * say (`pad`): before the cut (after the word before it), and after it
85
+ * (before the word after it).
86
+ */
87
+ export declare const PAD_BEFORE = 0.12;
88
+ export declare const PAD_AFTER = 0.08;
89
+ /**
90
+ * Checks a parsed edits file; returns the edit list, or what is wrong with
91
+ * it (one line).
92
+ */
93
+ export declare function parseEditList(v: unknown): EditList | string;
94
+ /** The text of words [from, to], as an edit range keeps it. */
95
+ export declare function rangeText(words: readonly Word[], from: number, to: number): string;
96
+ /**
97
+ * Where an edit range's words are now: the same indices when their text
98
+ * still matches, else the occurrence of its text nearest its old place;
99
+ * undefined when the take no longer says it.
100
+ */
101
+ export declare function locateRange(words: readonly Word[], r: EditRange, stream?: WordStream): {
102
+ from: number;
103
+ to: number;
104
+ } | undefined;
105
+ /**
106
+ * The words an edit list removes (indices into the take's words file, each
107
+ * range found again by its text when the file changed), and the ranges the
108
+ * take no longer says.
109
+ */
110
+ export declare function removedWords(words: readonly Word[], edits: EditList | undefined, stream?: WordStream): {
111
+ cut: Set<number>;
112
+ lost: EditRange[];
113
+ };
114
+ /** The take's level per 10 ms, which cut points snap to. */
115
+ export type CutLevels = Pick<VoiceFrames, "db" | "hop">;
116
+ /**
117
+ * A cut point near `target`, inside [lo, hi]: the quietest 10 ms within
118
+ * SNAP of it when the levels are known, else the target.
119
+ */
120
+ export declare function snapCut(levels: CutLevels | undefined, target: number, lo: number, hi: number): number;
121
+ /**
122
+ * The take's own sound a part keeps around words [first, last]: before the
123
+ * first and after the last, into the silence there (never past half of it,
124
+ * so never into a neighbouring word; up to half a second before, 0.6 s
125
+ * after), each end at its quietest 10 ms nearby when the levels are known.
126
+ * A recognizer's word times clip consonants, and a part's lead and tail
127
+ * play the take's own room rather than digital silence. Seconds.
128
+ */
129
+ export declare function speechPads(words: readonly Word[], first: number, last: number, duration: number | undefined, levels?: CutLevels): {
130
+ padIn: number;
131
+ padOut: number;
132
+ };
133
+ /** How cuts are placed: the take's level per 10 ms and the film's frame rate. */
134
+ export interface CutOptions {
135
+ /** Moves each cut point to the quietest moment near it (voice.ts). */
136
+ levels?: CutLevels | undefined;
137
+ /**
138
+ * Moves each cut point onto this frame grid, outward into the kept
139
+ * stretch's silence, never into what is removed: picture cuts land on
140
+ * whole frames.
141
+ */
142
+ fps?: number | undefined;
143
+ }
144
+ /**
145
+ * Applies an edit list to words [first, last] of a take, exactly as
146
+ * listed. Without edits (or with nothing to remove) the result is one
147
+ * stretch from the first word's start to the last one's end.
148
+ */
149
+ export declare function applyEdits(words: readonly Word[], edits: EditList | undefined, first?: number, last?: number, opts?: CutOptions): EditedSpeech;
150
+ /** Seconds of the edited take: the kept stretches' lengths added up. */
151
+ export declare function editedLength(ranges: readonly KeptRange[]): number;
152
+ /**
153
+ * A moment of the file on the edited clock (0 at the first stretch's
154
+ * start). A moment inside a cut lands where the cut is; before the first
155
+ * stretch or after the last, the clock runs on.
156
+ */
157
+ export declare function toEdited(ranges: readonly KeptRange[], t: number): number;
158
+ /**
159
+ * The file's moment at a moment of the edited clock: inside a stretch;
160
+ * before the first or after the last, the file runs on from its edge.
161
+ */
162
+ export declare function fromEdited(ranges: readonly KeptRange[], e: number): number;
163
+ //# sourceMappingURL=edits.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{PAD_MAX as X}from"@allyhub-next/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)}