@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.
- package/LICENSE.md +241 -0
- package/NOTICE +85 -0
- package/client.d.ts +45 -1
- package/dist/anim.js +2 -75
- package/dist/define.d.ts +10 -4
- package/dist/define.js +2 -95
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +2 -457
- package/dist/fit.js +2 -60
- package/dist/free.d.ts +18 -0
- package/dist/free.js +2 -0
- package/dist/index.d.ts +28 -13
- package/dist/index.js +2 -11
- package/dist/input.d.ts +306 -0
- package/dist/input.js +2 -0
- package/dist/media.d.ts +3 -6
- package/dist/media.js +2 -27
- package/dist/messages.d.ts +3 -2
- package/dist/messages.js +2 -2
- package/dist/module.d.ts +24 -0
- package/dist/module.js +2 -0
- package/dist/noise.js +2 -233
- package/dist/parts.d.ts +98 -22
- package/dist/parts.js +2 -414
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +2 -720
- package/dist/phone.d.ts +26 -0
- package/dist/phone.js +2 -0
- package/dist/piece.d.ts +106 -35
- package/dist/piece.js +2 -38
- package/dist/props.d.ts +1 -1
- package/dist/props.js +2 -35
- package/dist/scenery.d.ts +2 -0
- package/dist/scenery.js +2 -0
- package/dist/text.js +2 -38
- package/dist/written.d.ts +12 -0
- package/dist/written.js +2 -0
- package/docs/README.md +18 -0
- package/docs/batches.md +148 -0
- package/docs/contract.md +51 -0
- package/docs/defaults.md +703 -0
- package/docs/docs.md +148 -0
- package/docs/footage.md +249 -0
- package/docs/layers.md +317 -0
- package/docs/modeling.md +143 -0
- package/docs/project.md +265 -0
- package/docs/scenery.md +308 -0
- package/docs/sheets.md +119 -0
- package/docs/slides.md +111 -0
- package/docs/sound.md +170 -0
- package/docs/speech.md +289 -0
- package/docs/video.md +265 -0
- package/node_modules/@allyhub-next/audio/LICENSE +241 -0
- package/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +52 -0
- package/node_modules/@allyhub-next/audio/dist/at-cut.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/decode.d.ts +33 -0
- package/node_modules/@allyhub-next/audio/dist/decode.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/envelope.d.ts +37 -0
- package/node_modules/@allyhub-next/audio/dist/envelope.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/index.d.ts +17 -0
- package/node_modules/@allyhub-next/audio/dist/index.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/levels.d.ts +97 -0
- package/node_modules/@allyhub-next/audio/dist/levels.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/master.d.ts +29 -0
- package/node_modules/@allyhub-next/audio/dist/master.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/music.d.ts +11 -0
- package/node_modules/@allyhub-next/audio/dist/music.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +39 -0
- package/node_modules/@allyhub-next/audio/dist/node/decode.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +25 -0
- package/node_modules/@allyhub-next/audio/dist/node/ebur128.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +31 -0
- package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/index.d.ts +8 -0
- package/node_modules/@allyhub-next/audio/dist/node/index.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +18 -0
- package/node_modules/@allyhub-next/audio/dist/node/loudness.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/master.d.ts +42 -0
- package/node_modules/@allyhub-next/audio/dist/node/master.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +60 -0
- package/node_modules/@allyhub-next/audio/dist/node/measure.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +31 -0
- package/node_modules/@allyhub-next/audio/dist/node/mix.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/plan.d.ts +143 -0
- package/node_modules/@allyhub-next/audio/dist/plan.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recorded.d.ts +26 -0
- package/node_modules/@allyhub-next/audio/dist/recorded.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +47 -0
- package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +89 -0
- package/node_modules/@allyhub-next/audio/dist/recording/chain.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +64 -0
- package/node_modules/@allyhub-next/audio/dist/recording/dynamics.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +26 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fft.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +42 -0
- package/node_modules/@allyhub-next/audio/dist/recording/filters.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +56 -0
- package/node_modules/@allyhub-next/audio/dist/recording/fit.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +10 -0
- package/node_modules/@allyhub-next/audio/dist/recording/index.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +12 -0
- package/node_modules/@allyhub-next/audio/dist/recording/loudness.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +67 -0
- package/node_modules/@allyhub-next/audio/dist/recording/measure.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +32 -0
- package/node_modules/@allyhub-next/audio/dist/recording/mic.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +27 -0
- package/node_modules/@allyhub-next/audio/dist/recording/noise.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +64 -0
- package/node_modules/@allyhub-next/audio/dist/recording/presets.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +78 -0
- package/node_modules/@allyhub-next/audio/dist/recording/room.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +111 -0
- package/node_modules/@allyhub-next/audio/dist/recording/setup.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +3 -0
- package/node_modules/@allyhub-next/audio/dist/recording/vec.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/render.d.ts +26 -0
- package/node_modules/@allyhub-next/audio/dist/render.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/sfx.d.ts +10 -0
- package/node_modules/@allyhub-next/audio/dist/sfx.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/shape.d.ts +118 -0
- package/node_modules/@allyhub-next/audio/dist/shape.js +2 -0
- package/node_modules/@allyhub-next/audio/dist/voice.d.ts +45 -0
- package/node_modules/@allyhub-next/audio/dist/voice.js +2 -0
- package/node_modules/@allyhub-next/audio/package.json +17 -0
- package/node_modules/@allyhub-next/formats/LICENSE +241 -0
- package/node_modules/@allyhub-next/formats/dist/data/comments.d.ts +94 -0
- package/node_modules/@allyhub-next/formats/dist/data/comments.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/config.d.ts +10 -0
- package/node_modules/@allyhub-next/formats/dist/data/config.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/edits.d.ts +28 -0
- package/node_modules/@allyhub-next/formats/dist/data/edits.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/elements.d.ts +6 -0
- package/node_modules/@allyhub-next/formats/dist/data/elements.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/faces.d.ts +38 -0
- package/node_modules/@allyhub-next/formats/dist/data/faces.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/file.d.ts +11 -0
- package/node_modules/@allyhub-next/formats/dist/data/file.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/gen.d.ts +31 -0
- package/node_modules/@allyhub-next/formats/dist/data/gen.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/messages.d.ts +34 -0
- package/node_modules/@allyhub-next/formats/dist/data/messages.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/reference.d.ts +676 -0
- package/node_modules/@allyhub-next/formats/dist/data/reference.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/script.d.ts +37 -0
- package/node_modules/@allyhub-next/formats/dist/data/script.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +214 -0
- package/node_modules/@allyhub-next/formats/dist/data/sheet.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/data/words.d.ts +25 -0
- package/node_modules/@allyhub-next/formats/dist/data/words.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/index.d.ts +16 -0
- package/node_modules/@allyhub-next/formats/dist/index.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/items.d.ts +94 -0
- package/node_modules/@allyhub-next/formats/dist/items.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/layout.d.ts +50 -0
- package/node_modules/@allyhub-next/formats/dist/layout.js +5 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.d.ts +301 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.js +2 -0
- package/node_modules/@allyhub-next/formats/package.json +14 -0
- package/node_modules/@allyhub-next/protocol/LICENSE +241 -0
- package/node_modules/@allyhub-next/protocol/dist/app.d.ts +98 -0
- package/node_modules/@allyhub-next/protocol/dist/app.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +116 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +59 -0
- package/node_modules/@allyhub-next/protocol/dist/cli.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +274 -0
- package/node_modules/@allyhub-next/protocol/dist/cloud.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +405 -0
- package/node_modules/@allyhub-next/protocol/dist/editor.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/files.d.ts +101 -0
- package/node_modules/@allyhub-next/protocol/dist/files.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/index.d.ts +12 -0
- package/node_modules/@allyhub-next/protocol/dist/index.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/jsonrpc.d.ts +83 -0
- package/node_modules/@allyhub-next/protocol/dist/jsonrpc.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +53 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/runtimes.d.ts +93 -0
- package/node_modules/@allyhub-next/protocol/dist/runtimes.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/teams.d.ts +67 -0
- package/node_modules/@allyhub-next/protocol/dist/teams.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +345 -0
- package/node_modules/@allyhub-next/protocol/dist/tools.js +2 -0
- package/node_modules/@allyhub-next/protocol/package.json +13 -0
- package/node_modules/@allyhub-next/runtimes/LICENSE +241 -0
- package/node_modules/@allyhub-next/runtimes/dist/bundled.d.ts +10 -0
- package/node_modules/@allyhub-next/runtimes/dist/bundled.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/download.d.ts +15 -0
- package/node_modules/@allyhub-next/runtimes/dist/download.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/errors.d.ts +16 -0
- package/node_modules/@allyhub-next/runtimes/dist/errors.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/home.d.ts +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/home.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/index.d.ts +9 -0
- package/node_modules/@allyhub-next/runtimes/dist/index.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
- package/node_modules/@allyhub-next/runtimes/dist/lock.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/manifest.d.ts +3 -0
- package/node_modules/@allyhub-next/runtimes/dist/manifest.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +63 -0
- package/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -0
- package/node_modules/@allyhub-next/runtimes/dist/unpack.d.ts +7 -0
- package/node_modules/@allyhub-next/runtimes/dist/unpack.js +2 -0
- package/node_modules/@allyhub-next/runtimes/manifest.json +395 -0
- package/node_modules/@allyhub-next/runtimes/package.json +14 -0
- package/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +153 -0
- package/node_modules/@allyhub-next/scenery/LICENSE +241 -0
- package/node_modules/@allyhub-next/scenery/NOTICE +42 -0
- package/node_modules/@allyhub-next/scenery/dist/aim.d.ts +55 -0
- package/node_modules/@allyhub-next/scenery/dist/aim.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/bake.d.ts +203 -0
- package/node_modules/@allyhub-next/scenery/dist/bake.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/camera.d.ts +150 -0
- package/node_modules/@allyhub-next/scenery/dist/camera.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/curve.d.ts +40 -0
- package/node_modules/@allyhub-next/scenery/dist/curve.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/define.d.ts +164 -0
- package/node_modules/@allyhub-next/scenery/dist/define.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/fit.d.ts +64 -0
- package/node_modules/@allyhub-next/scenery/dist/fit.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/glass.d.ts +34 -0
- package/node_modules/@allyhub-next/scenery/dist/glass.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/handheld.d.ts +184 -0
- package/node_modules/@allyhub-next/scenery/dist/handheld.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/hull.d.ts +23 -0
- package/node_modules/@allyhub-next/scenery/dist/hull.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/index.d.ts +22 -0
- package/node_modules/@allyhub-next/scenery/dist/index.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/lens.d.ts +48 -0
- package/node_modules/@allyhub-next/scenery/dist/lens.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/moire.d.ts +136 -0
- package/node_modules/@allyhub-next/scenery/dist/moire.js +93 -0
- package/node_modules/@allyhub-next/scenery/dist/motion.d.ts +48 -0
- package/node_modules/@allyhub-next/scenery/dist/motion.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/move.d.ts +260 -0
- package/node_modules/@allyhub-next/scenery/dist/move.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/noise.d.ts +41 -0
- package/node_modules/@allyhub-next/scenery/dist/noise.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/phone.d.ts +34 -0
- package/node_modules/@allyhub-next/scenery/dist/phone.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/report.d.ts +677 -0
- package/node_modules/@allyhub-next/scenery/dist/report.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/screen-focus.d.ts +55 -0
- package/node_modules/@allyhub-next/scenery/dist/screen-focus.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/screen.d.ts +71 -0
- package/node_modules/@allyhub-next/scenery/dist/screen.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/solve.d.ts +82 -0
- package/node_modules/@allyhub-next/scenery/dist/solve.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/timing.d.ts +26 -0
- package/node_modules/@allyhub-next/scenery/dist/timing.js +2 -0
- package/node_modules/@allyhub-next/scenery/dist/vec.d.ts +19 -0
- package/node_modules/@allyhub-next/scenery/dist/vec.js +2 -0
- package/node_modules/@allyhub-next/scenery/package.json +13 -0
- package/node_modules/@allyhub-next/video-core/LICENSE +241 -0
- package/node_modules/@allyhub-next/video-core/dist/anchors.d.ts +164 -0
- package/node_modules/@allyhub-next/video-core/dist/anchors.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/audio-types.d.ts +148 -0
- package/node_modules/@allyhub-next/video-core/dist/audio-types.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/backdrop.d.ts +87 -0
- package/node_modules/@allyhub-next/video-core/dist/backdrop.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/captions.d.ts +122 -0
- package/node_modules/@allyhub-next/video-core/dist/captions.js +11 -0
- package/node_modules/@allyhub-next/video-core/dist/console.d.ts +91 -0
- package/node_modules/@allyhub-next/video-core/dist/console.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/contrast.d.ts +98 -0
- package/node_modules/@allyhub-next/video-core/dist/contrast.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/cut-report.d.ts +77 -0
- package/node_modules/@allyhub-next/video-core/dist/cut-report.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/edit.d.ts +77 -0
- package/node_modules/@allyhub-next/video-core/dist/edit.js +13 -0
- package/node_modules/@allyhub-next/video-core/dist/edits.d.ts +163 -0
- package/node_modules/@allyhub-next/video-core/dist/edits.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/export.d.ts +96 -0
- package/node_modules/@allyhub-next/video-core/dist/export.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/fact.d.ts +965 -0
- package/node_modules/@allyhub-next/video-core/dist/fact.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/footage-motion.d.ts +168 -0
- package/node_modules/@allyhub-next/video-core/dist/footage-motion.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/formats.d.ts +240 -0
- package/node_modules/@allyhub-next/video-core/dist/formats.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/gen.d.ts +37 -0
- package/node_modules/@allyhub-next/video-core/dist/gen.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/index.d.ts +40 -0
- package/node_modules/@allyhub-next/video-core/dist/index.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/look.d.ts +66 -0
- package/node_modules/@allyhub-next/video-core/dist/look.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/marks.d.ts +34 -0
- package/node_modules/@allyhub-next/video-core/dist/marks.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/matrix.d.ts +289 -0
- package/node_modules/@allyhub-next/video-core/dist/matrix.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/measure.d.ts +465 -0
- package/node_modules/@allyhub-next/video-core/dist/measure.js +5 -0
- package/node_modules/@allyhub-next/video-core/dist/media.d.ts +226 -0
- package/node_modules/@allyhub-next/video-core/dist/media.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/messages.d.ts +88 -0
- package/node_modules/@allyhub-next/video-core/dist/messages.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/motion.d.ts +56 -0
- package/node_modules/@allyhub-next/video-core/dist/motion.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/music.d.ts +110 -0
- package/node_modules/@allyhub-next/video-core/dist/music.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/piece.d.ts +1146 -0
- package/node_modules/@allyhub-next/video-core/dist/piece.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/placement.d.ts +37 -0
- package/node_modules/@allyhub-next/video-core/dist/placement.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/problem.d.ts +262 -0
- package/node_modules/@allyhub-next/video-core/dist/problem.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/render-types.d.ts +49 -0
- package/node_modules/@allyhub-next/video-core/dist/render-types.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/schema.d.ts +352 -0
- package/node_modules/@allyhub-next/video-core/dist/schema.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/script-edit.d.ts +176 -0
- package/node_modules/@allyhub-next/video-core/dist/script-edit.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/script.d.ts +67 -0
- package/node_modules/@allyhub-next/video-core/dist/script.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/seams.d.ts +214 -0
- package/node_modules/@allyhub-next/video-core/dist/seams.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/slides.d.ts +37 -0
- package/node_modules/@allyhub-next/video-core/dist/slides.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/sound-under.d.ts +72 -0
- package/node_modules/@allyhub-next/video-core/dist/sound-under.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/speech.d.ts +83 -0
- package/node_modules/@allyhub-next/video-core/dist/speech.js +5 -0
- package/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +616 -0
- package/node_modules/@allyhub-next/video-core/dist/timeline.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/timing.d.ts +88 -0
- package/node_modules/@allyhub-next/video-core/dist/timing.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/transcript.d.ts +288 -0
- package/node_modules/@allyhub-next/video-core/dist/transcript.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/transition.d.ts +289 -0
- package/node_modules/@allyhub-next/video-core/dist/transition.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/voice.d.ts +175 -0
- package/node_modules/@allyhub-next/video-core/dist/voice.js +2 -0
- package/node_modules/@allyhub-next/video-core/dist/words.d.ts +128 -0
- package/node_modules/@allyhub-next/video-core/dist/words.js +2 -0
- package/node_modules/@allyhub-next/video-core/package.json +14 -0
- package/package.json +52 -41
- package/README.md +0 -17
- package/dist/anim.d.ts.map +0 -1
- package/dist/anim.js.map +0 -1
- package/dist/define.d.ts.map +0 -1
- package/dist/define.js.map +0 -1
- package/dist/dom.d.ts.map +0 -1
- package/dist/dom.js.map +0 -1
- package/dist/fit.d.ts.map +0 -1
- package/dist/fit.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/media.d.ts.map +0 -1
- package/dist/media.js.map +0 -1
- package/dist/messages.d.ts.map +0 -1
- package/dist/messages.js.map +0 -1
- package/dist/noise.d.ts.map +0 -1
- package/dist/noise.js.map +0 -1
- package/dist/parts.d.ts.map +0 -1
- package/dist/parts.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/piece.d.ts.map +0 -1
- package/dist/piece.js.map +0 -1
- package/dist/props.d.ts.map +0 -1
- package/dist/props.js.map +0 -1
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js.map +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { Word } from "./media.js";
|
|
2
|
+
/**
|
|
3
|
+
* A named place in a line, in characters of the line as shown: a point at
|
|
4
|
+
* `at`, or the stretch from `at` to `end`.
|
|
5
|
+
*/
|
|
6
|
+
export interface TextAnchor {
|
|
7
|
+
name: string;
|
|
8
|
+
at: number;
|
|
9
|
+
end?: number;
|
|
10
|
+
}
|
|
11
|
+
/** A piece of a line, `at` to `end` of it as shown, that is said as `speak`. */
|
|
12
|
+
export interface SpokenSpan {
|
|
13
|
+
at: number;
|
|
14
|
+
end: number;
|
|
15
|
+
speak: string;
|
|
16
|
+
}
|
|
17
|
+
/** A line read: its words as shown, with its anchors and what is said another way. */
|
|
18
|
+
export interface SaidLine {
|
|
19
|
+
text: string;
|
|
20
|
+
anchors: TextAnchor[];
|
|
21
|
+
spans: SpokenSpan[];
|
|
22
|
+
}
|
|
23
|
+
/** An anchor's name: letters, digits, `_` and `-`. */
|
|
24
|
+
export declare const ANCHOR_NAME: RegExp;
|
|
25
|
+
/** `text` has something that reads as an anchor. */
|
|
26
|
+
export declare const hasAnchors: (text: string) => boolean;
|
|
27
|
+
/** `text` has something that reads as <shown|said>. */
|
|
28
|
+
export declare const hasSpans: (text: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A line as written, read: its words as shown, the anchors by where they
|
|
31
|
+
* sit in those words, the pieces said another way, and what is wrong. A
|
|
32
|
+
* start hugs the word after it and an end the word before it, wherever the
|
|
33
|
+
* spaces were written; one space goes with an anchor that had spaces both
|
|
34
|
+
* sides. Every anchor is returned, also a name written twice, so a draft
|
|
35
|
+
* that is wrong for a moment loses nothing.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readAnchors(raw: string): SaidLine & {
|
|
38
|
+
problems: string[];
|
|
39
|
+
};
|
|
40
|
+
/** A line as written, read (see readAnchors), without what is wrong with it. */
|
|
41
|
+
export declare function readLine(raw: string): SaidLine;
|
|
42
|
+
/**
|
|
43
|
+
* The line as said: each <shown|said> piece by its said side. `at` gives
|
|
44
|
+
* the place in it of a place in the line as shown; `end` asks for the end
|
|
45
|
+
* of a stretch, which stops before a piece that is only said, where a
|
|
46
|
+
* start goes past it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function spokenLine(line: SaidLine): {
|
|
49
|
+
text: string;
|
|
50
|
+
at(place: number, end: boolean): number;
|
|
51
|
+
/** The way back: the place in the line as shown of a place in the line as said. */
|
|
52
|
+
shown(place: number, end: boolean): number;
|
|
53
|
+
};
|
|
54
|
+
/** The line as written: its words with each anchor and each <shown|said> at its place. */
|
|
55
|
+
export declare function writeAnchors(text: string, anchors: readonly TextAnchor[], spans?: readonly SpokenSpan[]): string;
|
|
56
|
+
/** A line read, as written. */
|
|
57
|
+
export declare const writeLine: (line: SaidLine) => string;
|
|
58
|
+
/** A line as written, as its words are shown: no anchors, each piece by its shown side. */
|
|
59
|
+
export declare const withoutAnchors: (raw: string) => string;
|
|
60
|
+
/**
|
|
61
|
+
* The anchors after `removed` characters at `at` gave way to `inserted`
|
|
62
|
+
* new ones. An anchor stays with the words it was on: what is typed at a
|
|
63
|
+
* point or at a stretch's start goes after it, what is typed at a
|
|
64
|
+
* stretch's end goes inside. An anchor whose words went stays at the place
|
|
65
|
+
* they were; none is ever dropped.
|
|
66
|
+
*/
|
|
67
|
+
export declare function spliceAnchors(anchors: readonly TextAnchor[], at: number, removed: number, inserted: number): TextAnchor[];
|
|
68
|
+
/**
|
|
69
|
+
* The pieces said another way after the same change. A piece keeps what
|
|
70
|
+
* is typed over its own words and nothing typed beside it, unless `grow`
|
|
71
|
+
* says what was typed at its end, or at its start, goes on the same word
|
|
72
|
+
* (a digit after a digit). One whose shown words all went goes with them;
|
|
73
|
+
* a piece that is only said stays.
|
|
74
|
+
*/
|
|
75
|
+
export declare function spliceSpans(spans: readonly SpokenSpan[], at: number, removed: number, inserted: number, grow?: {
|
|
76
|
+
start?: boolean;
|
|
77
|
+
end?: boolean;
|
|
78
|
+
}): SpokenSpan[];
|
|
79
|
+
/**
|
|
80
|
+
* A line with `removed` characters at `at` giving way to `insert`. What is
|
|
81
|
+
* typed right at the edge of a piece said another way joins it when it
|
|
82
|
+
* goes on the same word: "4" after "1" is "14", a space or a new word is not.
|
|
83
|
+
*/
|
|
84
|
+
export declare function editLine(line: SaidLine, at: number, removed: number, insert: string): SaidLine;
|
|
85
|
+
/**
|
|
86
|
+
* The words of a line from `from` to `to`, trimmed, as a line of their
|
|
87
|
+
* own: with the anchors that start there (a stretch that runs on ends
|
|
88
|
+
* where these words do) and the pieces said another way that are whole in it.
|
|
89
|
+
*/
|
|
90
|
+
export declare function sliceLine(line: SaidLine, from: number, to: number): SaidLine;
|
|
91
|
+
/** Two lines as one, a space between their words. */
|
|
92
|
+
export declare function joinLines(a: SaidLine, b: SaidLine): SaidLine;
|
|
93
|
+
/** A stretch of a text that gave way: `removed` characters at `at`, for `inserted` at `into` of the new text. */
|
|
94
|
+
export interface TextChange {
|
|
95
|
+
at: number;
|
|
96
|
+
removed: number;
|
|
97
|
+
into: number;
|
|
98
|
+
inserted: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Where `after` differs from `before`: each stretch of `before` that gave
|
|
102
|
+
* way (`removed` characters at `at`) and how many took its place (at
|
|
103
|
+
* `into` of `after`), first to last. The longest run of pieces the two
|
|
104
|
+
* share stays; lines too long to compare so are one change in the middle.
|
|
105
|
+
*/
|
|
106
|
+
export declare function changesOf(before: string, after: string): TextChange[];
|
|
107
|
+
/**
|
|
108
|
+
* The anchors of a line whose words changed from `before` to `after`:
|
|
109
|
+
* the words the two share keep their anchors, and where they differ the
|
|
110
|
+
* anchors go by spliceAnchors.
|
|
111
|
+
*/
|
|
112
|
+
export declare function moveAnchors(anchors: readonly TextAnchor[], before: string, after: string): TextAnchor[];
|
|
113
|
+
/** A line with new words: its anchors and pieces moved with the words the two share. */
|
|
114
|
+
export declare function rewordLine(line: SaidLine, words: string): SaidLine;
|
|
115
|
+
/**
|
|
116
|
+
* A line as written with new words, what is written in it moved with
|
|
117
|
+
* them: for a text changed whole (a field of a table, an input method's text).
|
|
118
|
+
*/
|
|
119
|
+
export declare function rewordAnchored(raw: string, words: string): string;
|
|
120
|
+
/**
|
|
121
|
+
* An anchor's place in the line as spoken: counted in the letters and
|
|
122
|
+
* digits before it (normText), which is how a line is matched to the words
|
|
123
|
+
* of its sound.
|
|
124
|
+
*/
|
|
125
|
+
export interface LineAnchor {
|
|
126
|
+
name: string;
|
|
127
|
+
at: number;
|
|
128
|
+
end?: number;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Anchors by the letters and digits before them. `through` is what the
|
|
132
|
+
* line goes through before it is said (its {name} variables filled), given
|
|
133
|
+
* the words up to an anchor.
|
|
134
|
+
*/
|
|
135
|
+
export declare function lineAnchors(text: string, anchors: readonly TextAnchor[], through?: (text: string) => string): LineAnchor[];
|
|
136
|
+
/** "@form", "@/free", "@form+0.2": an anchor's name, which end, and a shift in seconds. */
|
|
137
|
+
export interface ParsedAnchorRef {
|
|
138
|
+
name: string;
|
|
139
|
+
end: boolean;
|
|
140
|
+
shift: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A reference that names an anchor, read against the names a line has: a
|
|
144
|
+
* whole name wins over a name with a shift ("@step-2" is the anchor
|
|
145
|
+
* step-2 when there is one, else step shifted two seconds back).
|
|
146
|
+
* Undefined when it does not start with "@".
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseAnchorRef(ref: string, names?: ReadonlySet<string>): ParsedAnchorRef | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* A line with one end of an anchor moved to a moment of its sound: to the
|
|
151
|
+
* start of the word that starts nearest `t` (or, for the end of a stretch,
|
|
152
|
+
* the end of the word that ends nearest). `words` are the words of the
|
|
153
|
+
* line's sound, on the clock `t` is on. Undefined when the line has no
|
|
154
|
+
* such anchor or end, has no sound, or the stretch would be left with no
|
|
155
|
+
* words in it.
|
|
156
|
+
*/
|
|
157
|
+
export declare function anchorAtTime(line: SaidLine, name: string, end: boolean, words: readonly Word[], t: number): SaidLine | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* What is wrong with writing `value` over `before` as a move of anchors:
|
|
160
|
+
* the two must have the same words and the same pieces said another way,
|
|
161
|
+
* and the same anchors by name, each still readable. Undefined when it is one.
|
|
162
|
+
*/
|
|
163
|
+
export declare function anchorMoveProblem(before: string, value: string): string | undefined;
|
|
164
|
+
//# sourceMappingURL=anchors.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{normText as w,ScriptAlignment as O,WordStream as y}from"./words.js";export const ANCHOR_NAME=/^[A-Za-z0-9_-]+$/;const H=/@\{(\/?)([^{}]*)\}|<([^<>|\n]*)\|([^<>\n]*)>/g,M=/\s/u;export const hasAnchors=n=>/@\{[^{}]*\}/.test(n),hasSpans=n=>/<[^<>|\n]*\|[^<>\n]*>/.test(n);export function readAnchors(n){const e=[],a=[],s=[],o=[],h=new Set;let r="",c=0,u=!1;const t=d=>{r+=u?d.replace(/^[ \t]+/,""):d,u=!1};for(const d of n.matchAll(H)){if(d[3]!==void 0){const m=d[3].trim(),x=(d[4]??"").trim();if(m===""&&x===""){e.push("<|> shows nothing and says nothing");continue}hasAnchors(d[0])&&e.push(`${d[0]} has an anchor inside: write the anchor before the <`),t(n.slice(c,d.index)),c=d.index+d[0].length,s.push({at:r.length,end:r.length+m.length,speak:x}),r+=m;continue}const p=d[2]??"";if(!ANCHOR_NAME.test(p)){e.push(`${d[0]} is not an anchor: a name has only letters, digits, _ and -`);continue}if(t(n.slice(c,d.index)),c=d.index+d[0].length,u=r===""||M.test(r.slice(-1)),d[1]==="/"){let m=o.length-1;for(;m>=0&&o[m]?.name!==p;)m--;const x=o[m];if(!x){e.push(`@{/${p}} ends an anchor that did not start`);continue}o.splice(m,1),x.end=r.length;continue}h.has(p)&&e.push(`the anchor ${p} is there twice`),h.add(p);const A={name:p,at:r.length};a.push(A),o.push(A)}t(n.slice(c));const f=a.map(d=>E(r,d)),i=spokenLine({text:r,anchors:f,spans:s});for(const d of f)d.end!==void 0&&w(i.text.slice(i.at(d.at,!1),i.at(d.end,!0)))===""&&e.push(`the anchor ${d.name} has no words between its two ends`);return{text:r,anchors:f,spans:s,problems:e}}export function readLine(n){const{text:e,anchors:a,spans:s}=readAnchors(n);return{text:e,anchors:a,spans:s}}function E(n,e){const a=r=>Math.max(0,Math.min(r,n.length)),s=e.end===void 0?n.length:Math.max(a(e.at),a(e.end));let o=a(e.at);for(;o<s&&M.test(n.charAt(o));)o++;if(e.end===void 0)return{name:e.name,at:o};let h=s;for(;h>o&&M.test(n.charAt(h-1));)h--;return{name:e.name,at:o,end:h}}export function spokenLine(n){const e=[...n.spans].sort((r,c)=>r.at-c.at||r.end-c.end);let a="",s=0;for(const r of e)a+=n.text.slice(s,r.at)+r.speak,s=r.end;return a+=n.text.slice(s),{text:a,at:(r,c)=>{let u=0;for(const t of e){const f=t.speak.length-(t.end-t.at);if(t.end<r||t.end===r&&(t.at<r||!c))u+=f;else if(t.at<r&&r<t.end)return c?t.end+u+f:t.at+u}return r+u},shown:(r,c)=>{let u=0;for(const t of e){const f=t.at+u,i=f+t.speak.length;if(c?r<=f:r<f)break;if(c?r<=i:r<i)return c?t.end:t.at;u+=t.speak.length-(t.end-t.at)}return r-u}}}export function writeAnchors(n,e,a=[]){if(e.length===0&&a.length===0)return n;const s=t=>Math.max(0,Math.min(t,n.length)),o=a.map(t=>({at:s(t.at),end:Math.max(s(t.at),s(t.end)),speak:t.speak})).sort((t,f)=>t.at-f.at||t.end-f.end),h=(t,f)=>{const i=o.find(d=>d.at<t&&t<d.end);return i?f?i.end:i.at:t},r=[];e.forEach((t,f)=>{const{name:i,at:d,end:p}=E(n,t),A=h(d,!1);if(r.push({pos:A,rank:2,order:f,token:`@{${i}}`}),p===void 0)return;const m=Math.max(A,h(p,!0));r.push({pos:m,rank:m===A?3:0,order:f,token:`@{/${i}}`})}),o.forEach((t,f)=>{r.push({pos:t.at,rank:t.end===t.at?1:4,order:f,token:`<${n.slice(t.at,t.end)}|${t.speak}>`,until:t.end})}),r.sort((t,f)=>t.pos-f.pos||t.rank-f.rank||t.order-f.order);let c="",u=0;for(const t of r)t.pos<u||(c+=n.slice(u,t.pos)+t.token,u=t.until??t.pos);return c+n.slice(u)}export const writeLine=n=>writeAnchors(n.text,n.anchors,n.spans),withoutAnchors=n=>hasAnchors(n)||hasSpans(n)?readAnchors(n).text:n;export function spliceAnchors(n,e,a,s){const o=e+a,h=c=>c<=e?c:c<o?e:c-a+s,r=c=>c<e?c:c<=o?e+s:c-a+s;return n.map(c=>{const u=h(c.at);return c.end===void 0?{name:c.name,at:u}:{name:c.name,at:u,end:Math.max(u,r(c.end))}})}export function spliceSpans(n,e,a,s,o={}){const h=e+a,r=i=>i-a+s,c=o.end===!0&&a===0&&n.some(i=>i.end===e&&i.at<e),u=o.start===!0&&a===0&&!c,t=i=>i<e?i:i===e?a>0||u?i:i+s:i<h?e+s:r(i),f=i=>i<e?i:i===e?c?i+s:i:i<h?e:i===h?e+s:r(i);return n.flatMap(i=>{if(i.end===i.at){const A=i.at<=e?i.at:i.at<h?e:r(i.at);return[{at:A,end:A,speak:i.speak}]}const d=t(i.at),p=f(i.end);return p>d?[{at:d,end:p,speak:i.speak}]:[]})}const j=/^(?![\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}])[\p{L}\p{N}]$/u;export function editLine(n,e,a,s){const o=c=>c!==void 0&&j.test(c),h=c=>/^./su.exec(c)?.[0],r=c=>/.$/su.exec(c)?.[0];return{text:n.text.slice(0,e)+s+n.text.slice(e+a),anchors:spliceAnchors(n.anchors,e,a,s.length),spans:spliceSpans(n.spans,e,a,s.length,{end:o(h(s))&&o(r(n.text.slice(0,e))),start:o(r(s))&&o(h(n.text.slice(e)))})}}export function sliceLine(n,e,a){const s=n.text.slice(e,a),o=s.trim(),h=s.length-s.trimStart().length,r=t=>Math.max(0,Math.min(t-e-h,o.length)),c=a>=n.text.length,u=t=>t>=e&&(t<a||c);return{text:o,anchors:n.anchors.filter(t=>u(t.at)).map(t=>({name:t.name,at:r(t.at),...t.end===void 0?{}:{end:r(t.end)}})),spans:n.spans.filter(t=>u(t.at)&&t.end<=a).map(t=>({at:r(t.at),end:r(t.end),speak:t.speak}))}}export function joinLines(n,e){const a=[n.text,e.text].filter(o=>o!=="").join(" "),s=a.length-e.text.length;return{text:a,anchors:[...n.anchors,...e.anchors.map(o=>({name:o.name,at:o.at+s,...o.end===void 0?{}:{end:o.end+s}}))],spans:[...n.spans,...e.spans.map(o=>({at:o.at+s,end:o.end+s,speak:o.speak}))]}}const N=/\s+|[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]|[\p{L}\p{N}]+|./gsu,C=4e5;export function changesOf(n,e){const a=n.match(N)??[],s=e.match(N)??[];let o=0;for(;o<a.length&&o<s.length&&a[o]===s[o];)o++;let h=0;for(;h<a.length-o&&h<s.length-o&&a[a.length-1-h]===s[s.length-1-h];)h++;const r=a.length-o-h,c=s.length-o-h,u=(k,g,$)=>{let L=0;for(let S=g;S<$;S++)L+=(k[S]??"").length;return L},t=u(a,0,o);if(r===0&&c===0)return[];if(r===0||c===0||r*c>C)return[{at:t,removed:u(a,o,o+r),into:t,inserted:u(s,o,o+c)}];const f=c+1,i=new Int32Array((r+1)*f);for(let k=r-1;k>=0;k--)for(let g=c-1;g>=0;g--)i[k*f+g]=a[o+k]===s[o+g]?(i[(k+1)*f+g+1]??0)+1:Math.max(i[(k+1)*f+g]??0,i[k*f+g+1]??0);const d=[];let p=t,A=t,m,x=0,l=0;for(;x<r||l<c;){const k=a[o+x],g=s[o+l];if(x<r&&l<c&&k===g){m=void 0,p+=(k??"").length,A+=(g??"").length,x++,l++;continue}m||(m={at:p,removed:0,into:A,inserted:0},d.push(m)),l>=c||x<r&&(i[(x+1)*f+l]??0)>=(i[x*f+l+1]??0)?(m.removed+=(k??"").length,p+=(k??"").length,x++):(m.inserted+=(g??"").length,A+=(g??"").length,l++)}return d}export function moveAnchors(n,e,a){return n.length===0||e===a?[...n]:changesOf(e,a).reduceRight((s,o)=>spliceAnchors(s,o.at,o.removed,o.inserted),[...n])}export function rewordLine(n,e){return n.text===e?n:changesOf(n.text,e).reduceRight((a,s)=>editLine(a,s.at,s.removed,e.slice(s.into,s.into+s.inserted)),n)}export function rewordAnchored(n,e){return!hasAnchors(n)&&!hasSpans(n)?e:writeLine(rewordLine(readLine(n),e))}export function lineAnchors(n,e,a=s=>s){const s=o=>w(a(n.slice(0,o))).length;return e.map(o=>({name:o.name,at:s(o.at),...o.end===void 0?{}:{end:s(o.end)}}))}export function parseAnchorRef(n,e=new Set){const a=/^@(\/?)(.+)$/su.exec(n.trim());if(!a?.[2])return;const s=a[1]==="/",o=a[2];if(e.has(o))return{name:o,end:s,shift:0};const h=/^(.+?)([+-]\d*\.?\d+)$/su.exec(o);return h?.[1]&&h[2]?{name:h[1],end:s,shift:Number(h[2])}:{name:o,end:s,shift:0}}export function anchorAtTime(n,e,a,s,o){const h=n.anchors.find(l=>l.name===e);if(!h||a&&h.end===void 0||s.length===0)return;const r=spokenLine(n),c=new O(new y(s),[r.text]),u=c.lines[0]?.length??0;if(u===0)return;const t=[],f=[];let i=0;for(const l of r.text.matchAll(/./gsu)){const k=w(l[0]).length;for(let g=0;g<k;g++)t.push(i),f.push(i+l[0].length);i+=l[0].length}const d=l=>c.wordAtChar(0,l);let p;const A=(l,k)=>{if(k===void 0)return;const g=Math.abs(k-o);(!p||g<p.off)&&(p={place:l,off:g})};for(let l=0;l<u;l++)a?(l===u-1||d(l+1)!==d(l))&&A(f[l]??r.text.length,s[d(l)]?.end):(l===0||d(l-1)!==d(l))&&A(t[l]??0,s[d(l)]?.start);if(!a&&h.end===void 0&&A(r.text.length,s.at(-1)?.end),!p)return;const m=r.shown(p.place,a),x=a?{name:e,at:h.at,end:m}:{name:e,at:m,...h.end===void 0?{}:{end:h.end}};if(!(x.end!==void 0&&w(r.text.slice(r.at(x.at,!1),r.at(x.end,!0)))===""))return{text:n.text,spans:n.spans,anchors:n.anchors.map(l=>l===h?x:l)}}export function anchorMoveProblem(n,e){const a=readAnchors(n),s=readAnchors(e);if(s.problems.length>0)return s.problems.join("; ");if(a.text!==s.text||JSON.stringify(a.spans)!==JSON.stringify(s.spans))return"moving an anchor changes no words";const o=h=>h.anchors.map(r=>`${r.name}${r.end===void 0?"":"…"}`).sort().join(" ");return o(a)===o(s)?void 0:"moving an anchor adds and removes none"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** An output's mix levels (`video({ mix })`), LUFS; each default is the audio package's. */
|
|
2
|
+
export interface MixOptions {
|
|
3
|
+
/** Each part's speech; default -16. */
|
|
4
|
+
speech?: number;
|
|
5
|
+
/** The music while speech plays; default -20. */
|
|
6
|
+
music?: number;
|
|
7
|
+
/** The music where nobody speaks; default -16. */
|
|
8
|
+
musicAlone?: number;
|
|
9
|
+
/** Sound effects from files; built-in sounds move by the same amount from the default; default -22. */
|
|
10
|
+
sfx?: number;
|
|
11
|
+
/** Footage's own sound where nobody speaks; default -16. */
|
|
12
|
+
footage?: number;
|
|
13
|
+
/** Footage's own sound while speech plays; default -22. */
|
|
14
|
+
footageUnderSpeech?: number;
|
|
15
|
+
/**
|
|
16
|
+
* How the music dips under words: `db` below its level while speech
|
|
17
|
+
* plays (default -8), going down over `attack` seconds before a word
|
|
18
|
+
* (0.3), back up over `release` after one (1), and staying down
|
|
19
|
+
* through pauses shorter than `hold` (2).
|
|
20
|
+
*/
|
|
21
|
+
duck?: {
|
|
22
|
+
db?: number;
|
|
23
|
+
attack?: number;
|
|
24
|
+
release?: number;
|
|
25
|
+
hold?: number;
|
|
26
|
+
};
|
|
27
|
+
/** The music's fade in at the start and out at the end, seconds; defaults 0.3 and 1.5 (at most a quarter of the video). */
|
|
28
|
+
musicFade?: {
|
|
29
|
+
in?: number;
|
|
30
|
+
out?: number;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The mix's settings with every default filled in. */
|
|
34
|
+
export interface MixLevels {
|
|
35
|
+
speech: number;
|
|
36
|
+
music: number;
|
|
37
|
+
musicAlone: number;
|
|
38
|
+
sfx: number;
|
|
39
|
+
footage: number;
|
|
40
|
+
footageUnderSpeech: number;
|
|
41
|
+
duck: {
|
|
42
|
+
db: number;
|
|
43
|
+
attack: number;
|
|
44
|
+
release: number;
|
|
45
|
+
hold: number;
|
|
46
|
+
};
|
|
47
|
+
musicFade: {
|
|
48
|
+
in: number;
|
|
49
|
+
out: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface MasterOptions {
|
|
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).
|
|
56
|
+
*/
|
|
57
|
+
lufs?: number | false;
|
|
58
|
+
/** True-peak ceiling, dBTP (-9 to 0); default -3 (AAC overshoots up to about 2 dB). */
|
|
59
|
+
truePeak?: number;
|
|
60
|
+
}
|
|
61
|
+
/** The master's targets, or false to keep the mix's level (its peaks still limited to `truePeak`). */
|
|
62
|
+
export interface MasterTargets {
|
|
63
|
+
lufs: number | false;
|
|
64
|
+
truePeak: number;
|
|
65
|
+
}
|
|
66
|
+
export declare const BAND_TYPES: readonly ["highpass", "lowpass", "bandpass", "peak", "lowshelf", "highshelf"];
|
|
67
|
+
export type BandType = (typeof BAND_TYPES)[number];
|
|
68
|
+
/**
|
|
69
|
+
* A moment of the film a video-level option names: film seconds, an
|
|
70
|
+
* anchor of any part ("@drop", "@drop+0.2", "@/drop") or a part's key
|
|
71
|
+
* (its start), or a word reference in a part (`{ part, at }`: `at` as a
|
|
72
|
+
* layer's at, from that part's start).
|
|
73
|
+
*/
|
|
74
|
+
export type SoundMoment = number | string | {
|
|
75
|
+
part: string;
|
|
76
|
+
at: number | string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* A band's values from a moment of the film on: `at` is the moment (the
|
|
80
|
+
* music's own reference: film seconds, an anchor, a part or a word in a
|
|
81
|
+
* part), and what it leaves out is the band's own value.
|
|
82
|
+
*/
|
|
83
|
+
export interface BandKey<T = SoundMoment> {
|
|
84
|
+
at: T;
|
|
85
|
+
hz?: number;
|
|
86
|
+
db?: number;
|
|
87
|
+
q?: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* One band of an equalizer: a pass (`highpass`, `lowpass`, `bandpass`,
|
|
91
|
+
* with its `q`, default a Butterworth's 0.707), a `peak` (`db` at `hz`,
|
|
92
|
+
* `q` default 1) or a shelf (`lowshelf`, `highshelf`: `db` under or over
|
|
93
|
+
* `hz`, `q` the shelf's slope, default 1). `keys` move its values over
|
|
94
|
+
* the film's clock (music only).
|
|
95
|
+
*/
|
|
96
|
+
export interface EqBand<T = SoundMoment> {
|
|
97
|
+
type: BandType;
|
|
98
|
+
hz: number;
|
|
99
|
+
db?: number;
|
|
100
|
+
q?: number;
|
|
101
|
+
keys?: BandKey<T>[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A compressor: from `threshold` dB over the stem's loudness (its
|
|
105
|
+
* integrated loudness as shaped so far: 0 is at it, -6 six dB under), the
|
|
106
|
+
* level over it is divided by `ratio`.
|
|
107
|
+
*/
|
|
108
|
+
export interface SoundCompressor {
|
|
109
|
+
threshold: number;
|
|
110
|
+
/** Input dB over the threshold per output dB; default 2. */
|
|
111
|
+
ratio?: number;
|
|
112
|
+
/** The knee's width, dB; default 6. */
|
|
113
|
+
knee?: number;
|
|
114
|
+
/** Seconds to go down, and to come back up; defaults 0.01 and 0.15. */
|
|
115
|
+
attack?: number;
|
|
116
|
+
release?: number;
|
|
117
|
+
/** The detector's window, seconds (0: the peak); default 0.01. */
|
|
118
|
+
window?: number;
|
|
119
|
+
}
|
|
120
|
+
/** How a stem is shaped (`music: { filter, eq, compress }`, a sound's own). */
|
|
121
|
+
export interface SoundShape<T = SoundMoment> {
|
|
122
|
+
/**
|
|
123
|
+
* An ffmpeg audio filter chain run on the file as it is decoded, on the
|
|
124
|
+
* file's own clock ("acompressor=ratio=3,deesser"): one chain, nothing
|
|
125
|
+
* that reads files, makes sound of its own or changes the timing.
|
|
126
|
+
*/
|
|
127
|
+
filter?: string;
|
|
128
|
+
/** Equalizer bands, in order. */
|
|
129
|
+
eq?: EqBand<T>[];
|
|
130
|
+
/** A compressor after the bands. */
|
|
131
|
+
compress?: SoundCompressor;
|
|
132
|
+
}
|
|
133
|
+
/** A shape whose bands do not move (a sound effect's). */
|
|
134
|
+
export type FixedShape = Omit<SoundShape, "eq"> & {
|
|
135
|
+
eq?: Omit<EqBand, "keys">[];
|
|
136
|
+
};
|
|
137
|
+
/** A shape resolved for the mix: its keys at film seconds. */
|
|
138
|
+
export type ResolvedShape = SoundShape<number>;
|
|
139
|
+
/**
|
|
140
|
+
* How a voice was recorded (`video({ mic })`, `part({ mic })`): a setup by
|
|
141
|
+
* name (studio, phone, lav), a setup's options with any value changed, or
|
|
142
|
+
* false (played as it is). Its fields and their checks are the audio
|
|
143
|
+
* package's recording; here it is only carried.
|
|
144
|
+
*/
|
|
145
|
+
export type VoiceSetting = string | Readonly<Record<string, unknown>> | false;
|
|
146
|
+
/** A voice setting resolved over its presets, as the audio package resolves it. */
|
|
147
|
+
export type ResolvedVoice = Readonly<Record<string, unknown>>;
|
|
148
|
+
//# sourceMappingURL=audio-types.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The softness of the person's edge over a treated background when the
|
|
3
|
+
* layer does not say (`background.feather`): px at 1080p.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MATTE_FEATHER = 2;
|
|
6
|
+
/**
|
|
7
|
+
* How far the person's edge is pulled in then (`background.shrink`): px at
|
|
8
|
+
* 1080p. A little, so the rim of the old background the matte keeps round
|
|
9
|
+
* the person does not show against the new one.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MATTE_SHRINK = 4;
|
|
12
|
+
/** The most `background.blur`, `feather` and `shrink` take, px at 1080p. */
|
|
13
|
+
export declare const BACKDROP_BLUR_MAX = 200;
|
|
14
|
+
export declare const MATTE_FEATHER_MAX = 40;
|
|
15
|
+
export declare const MATTE_SHRINK_MAX = 40;
|
|
16
|
+
/**
|
|
17
|
+
* The frame's pixels in one "px at 1080p": a background's lengths (blur,
|
|
18
|
+
* feather, shrink) scale with the format's shorter side, so the same
|
|
19
|
+
* numbers look the same in every format.
|
|
20
|
+
*/
|
|
21
|
+
export declare function backdropUnit(width: number, height: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* A matte's levels are made firm before anything else: under the first
|
|
24
|
+
* (of 0–1) is none of the person, over the second all, a straight ramp
|
|
25
|
+
* between. A matte is a guess, and where it is unsure inside the person (a
|
|
26
|
+
* hand moving in front of the chest comes out at 0.9) the person is not
|
|
27
|
+
* see-through; its edge is then one clean line to soften and pull in.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MATTE_FIRM: readonly [number, number];
|
|
30
|
+
/** The firm level (0–255) of each level of a matte (0–255). */
|
|
31
|
+
export declare function firmLevels(): Uint8ClampedArray;
|
|
32
|
+
/** The same as an ffmpeg expression of `val` (0–255), for the lut filter. */
|
|
33
|
+
export declare function firmLevelsExpr(): string;
|
|
34
|
+
/**
|
|
35
|
+
* How a matte becomes the person's alpha: made firm (firmLevels), blurred
|
|
36
|
+
* by `sigma`, then each level m (0–1) becomes m / (m + gain × (1 − m)).
|
|
37
|
+
*/
|
|
38
|
+
export interface MatteEdge {
|
|
39
|
+
/** Gaussian blur of the matte, its standard deviation in the frame's pixels (0: none). */
|
|
40
|
+
sigma: number;
|
|
41
|
+
/** Over 1 pulls the edge in, under 1 lets it out, 1 leaves it. */
|
|
42
|
+
gain: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* After the blur, a matte's lowest and highest levels count as none and
|
|
46
|
+
* all of the person: a little of each end, so that a level one short of
|
|
47
|
+
* all (the blur's rounding) does not make the whole person see-through
|
|
48
|
+
* once the edge is pulled in.
|
|
49
|
+
*/
|
|
50
|
+
export declare const MATTE_FLOOR = 6;
|
|
51
|
+
/**
|
|
52
|
+
* The person's edge from a matte: `feather` softens it and `shrink` pulls
|
|
53
|
+
* it in (negative: lets it out), both in the frame's pixels; `scale` is
|
|
54
|
+
* the frame's pixels per matte pixel (a matte is smaller than the picture,
|
|
55
|
+
* so its edge, made firm, is still about a fifth of a matte pixel soft).
|
|
56
|
+
*
|
|
57
|
+
* The firm matte is blurred, which makes its edge an S-shaped ramp around
|
|
58
|
+
* where it was, as soft as the feather and the matte's own softness
|
|
59
|
+
* together. Sliding that ramp `shrink` pixels along is, on its levels,
|
|
60
|
+
* m → m / (m + gain × (1 − m)) with gain = exp(1.702 × shrink / softness)
|
|
61
|
+
* (the logistic curve that follows a Gaussian edge within a hundredth). A
|
|
62
|
+
* shrink the ramp is too narrow for (over 1.5 times its softness, where
|
|
63
|
+
* the levels left would be too few) widens the blur.
|
|
64
|
+
*/
|
|
65
|
+
export declare function matteEdge(feather: number, shrink: number, scale: number): MatteEdge;
|
|
66
|
+
/** The person's alpha (0–255) for each level of a blurred matte (0–255). */
|
|
67
|
+
export declare function edgeLevels(edge: MatteEdge): Uint8ClampedArray;
|
|
68
|
+
/**
|
|
69
|
+
* The same levels as an ffmpeg expression of `val` (0–255), for the lut
|
|
70
|
+
* filter.
|
|
71
|
+
*/
|
|
72
|
+
export declare function edgeLevelsExpr(edge: MatteEdge): string;
|
|
73
|
+
/**
|
|
74
|
+
* How much smaller a background is blurred: a blur of standard deviation
|
|
75
|
+
* `sigma` (pixels) holds no detail finer than about a third of it, so the
|
|
76
|
+
* picture is blurred at 1/2, 1/4 or 1/8 of its size and scaled back.
|
|
77
|
+
*/
|
|
78
|
+
export declare function blurStep(sigma: number): 1 | 2 | 4 | 8;
|
|
79
|
+
/**
|
|
80
|
+
* The colour matrix of a background's `desaturate` and `dim` (each 0–1):
|
|
81
|
+
* rows for red, green and blue out, columns for red, green and blue in.
|
|
82
|
+
* The same as CSS `saturate(1 − desaturate) brightness(1 − dim)`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function backdropMatrix(desaturate: number, dim: number): [Row, Row, Row];
|
|
85
|
+
/** A row of a colour matrix: how much of red, green and blue goes into one channel. */
|
|
86
|
+
export type Row = [r: number, g: number, b: number];
|
|
87
|
+
//# sourceMappingURL=backdrop.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 MATTE_FEATHER=2,MATTE_SHRINK=4,BACKDROP_BLUR_MAX=200,MATTE_FEATHER_MAX=40,MATTE_SHRINK_MAX=40;export function backdropUnit(t,o){return Math.min(t,o)/1080}export const MATTE_FIRM=[.25,.75];export function firmLevels(){const t=new Uint8ClampedArray(256),[o,n]=MATTE_FIRM;for(let r=0;r<256;r++)t[r]=Math.round((r/255-o)/(n-o)*255);return t}export function firmLevelsExpr(){const[t,o]=MATTE_FIRM;return`clip((val-${String(t*255)})/${String(o-t)},0,255)`}export const MATTE_FLOOR=6;export function matteEdge(t,o,n){const r=.2*Math.max(0,n),a=Math.max(Math.hypot(t,r),Math.abs(o)/1.5,.001),c=Math.sqrt(Math.max(0,a*a-r*r)),e=s=>Math.round(s*1e4)/1e4;return{sigma:e(c),gain:e(Math.exp(1.702*o/a))}}export function edgeLevels(t){const o=new Uint8ClampedArray(256);for(let n=0;n<256;n++){const r=Math.min(Math.max((n-MATTE_FLOOR)/(255-2*MATTE_FLOOR),0),1);o[n]=Math.round(255*r/(r+t.gain*(1-r)))}return o}export function edgeLevelsExpr(t){const o=255-2*MATTE_FLOOR,n=`clip((val-${String(MATTE_FLOOR)})/${String(o)},0,1)`;return`255*${n}/(${n}+${String(t.gain)}*(1-${n}))`}export function blurStep(t){return t>=24?8:t>=12?4:t>=6?2:1}const i=[.2126,.7152,.0722];export function backdropMatrix(t,o){const n=Math.min(Math.max(t,0),1),r=1-Math.min(Math.max(o,0),1),a=e=>Math.round(e*1e4)/1e4,c=e=>[a(r*(n*i[0]+(e===0?1-n:0))),a(r*(n*i[1]+(e===1?1-n:0))),a(r*(n*i[2]+(e===2?1-n:0)))];return[c(0),c(1),c(2)]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Word } from "./media.js";
|
|
2
|
+
import type { CaptionOptions, CaptionTrackCue, CaptionWord } from "./piece.js";
|
|
3
|
+
import type { PartText, Timeline } from "./timeline.js";
|
|
4
|
+
export interface CaptionCue {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
text: string;
|
|
8
|
+
part: string;
|
|
9
|
+
}
|
|
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
|
+
export interface CaptionInput {
|
|
19
|
+
/** Voiced parts in order. */
|
|
20
|
+
lines: CaptionLine[];
|
|
21
|
+
fps: number;
|
|
22
|
+
}
|
|
23
|
+
/** How subtitle cues are cut and timed (srt and vtt, and the player's captions). */
|
|
24
|
+
export interface CaptionCueOptions {
|
|
25
|
+
/** Most characters on a cue's line. */
|
|
26
|
+
maxChars?: number;
|
|
27
|
+
/** Most characters on a line in Chinese, Japanese or Korean. */
|
|
28
|
+
maxCharsCjk?: number;
|
|
29
|
+
/** Shortest a cue lasts, in seconds (unless the next cue starts sooner). */
|
|
30
|
+
minSeconds?: number;
|
|
31
|
+
/** Longest a cue lasts, in seconds. */
|
|
32
|
+
maxSeconds?: number;
|
|
33
|
+
/** Frames left between a cue's end and the next cue's start. */
|
|
34
|
+
gapFrames?: number;
|
|
35
|
+
}
|
|
36
|
+
/** The values captionCues uses for options not given. */
|
|
37
|
+
export declare const CAPTION_CUE_DEFAULTS: Readonly<Required<CaptionCueOptions>>;
|
|
38
|
+
/**
|
|
39
|
+
* The caption lines of a timeline: each voiced part's words (from its
|
|
40
|
+
* take's words file), with the text it says.
|
|
41
|
+
*/
|
|
42
|
+
export declare function speechLines(timeline: Pick<Timeline, "parts">, texts: readonly PartText[], media: Readonly<Record<string, {
|
|
43
|
+
words?: Word[] | undefined;
|
|
44
|
+
}>>): CaptionLine[];
|
|
45
|
+
/**
|
|
46
|
+
* Where a place in a line as shown is in the line as said, both counted in
|
|
47
|
+
* letters and digits (normText). The words the two share are at the same
|
|
48
|
+
* place in both; inside a stretch that differs, the place is in proportion.
|
|
49
|
+
* Two lines with nothing in common are in proportion from end to end.
|
|
50
|
+
*/
|
|
51
|
+
export declare function shownToSpoken(shown: string, spoken: string): (place: number) => number;
|
|
52
|
+
/** Character spans of a line, [from, to): a break never falls inside one. */
|
|
53
|
+
export type KeptSpan = [from: number, to: number];
|
|
54
|
+
/**
|
|
55
|
+
* Where a line says each phrase of `keep` (whole words, matched as said:
|
|
56
|
+
* case, accents and punctuation ignored), as character spans of the line.
|
|
57
|
+
* Chinese, Japanese and Korean phrases match inside the text.
|
|
58
|
+
*/
|
|
59
|
+
export declare function keptSpans(line: string, keep: readonly string[]): KeptSpan[];
|
|
60
|
+
/**
|
|
61
|
+
* Splits a line into caption-sized pieces, keeping their positions. A
|
|
62
|
+
* piece breaks at no position inside a `keep` span: a piece that cannot
|
|
63
|
+
* break elsewhere stays longer than `max`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function splitLine(line: string, max?: number, keep?: readonly KeptSpan[]): {
|
|
66
|
+
text: string;
|
|
67
|
+
from: number;
|
|
68
|
+
to: number;
|
|
69
|
+
}[];
|
|
70
|
+
/**
|
|
71
|
+
* Subtitle cues from the voiced parts' lines: one line per cue, cut at
|
|
72
|
+
* sentence ends, then clauses, then the length; frame-snapped, between
|
|
73
|
+
* minSeconds and maxSeconds long, gapFrames before the next cue.
|
|
74
|
+
* Options not given are CAPTION_CUE_DEFAULTS.
|
|
75
|
+
*/
|
|
76
|
+
export declare function captionCues(input: CaptionInput, options?: CaptionCueOptions): CaptionCue[];
|
|
77
|
+
/**
|
|
78
|
+
* The subtitles (srt, vtt and the player's captions). A piece whose layers
|
|
79
|
+
* read its captions (`ctx.captions(options)`) has its subtitles cut and
|
|
80
|
+
* timed as the captions it burns in, by the options its first such layer
|
|
81
|
+
* asked; a piece without one, by captionCues and CAPTION_CUE_DEFAULTS.
|
|
82
|
+
*/
|
|
83
|
+
export declare function subtitleCues(input: CaptionInput, asked?: CaptionOptions): CaptionCue[];
|
|
84
|
+
/** A cue with its words, on the film's clock. */
|
|
85
|
+
export interface WordCue {
|
|
86
|
+
start: number;
|
|
87
|
+
end: number;
|
|
88
|
+
text: string;
|
|
89
|
+
part: string;
|
|
90
|
+
words: CaptionWord[];
|
|
91
|
+
}
|
|
92
|
+
export interface WordCueOptions {
|
|
93
|
+
fps: number;
|
|
94
|
+
/** Most characters in a cue; default 32 (16 for Chinese, Japanese and Korean). */
|
|
95
|
+
maxChars?: number;
|
|
96
|
+
/** Most words in a cue; default no limit. */
|
|
97
|
+
maxWords?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Phrases a cue never breaks inside ("work harder"), wherever a line
|
|
100
|
+
* says them: the cue around one may run over maxChars or maxWords.
|
|
101
|
+
*/
|
|
102
|
+
keep?: readonly string[];
|
|
103
|
+
/** Seconds: a gap between two cues of a part shorter than this closes; default 0.4. */
|
|
104
|
+
close?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Caption cues with word times, for the burned-in captions track: each
|
|
108
|
+
* voiced part's line (as written; the times from aligning it to the
|
|
109
|
+
* words heard), cut at sentence and clause ends, then by length and word
|
|
110
|
+
* count. A cue never spans two parts. Cues follow each other without a
|
|
111
|
+
* flicker: a gap under `close` (0.4 s) is closed.
|
|
112
|
+
*/
|
|
113
|
+
export declare function wordCues(lines: readonly CaptionLine[], opts: WordCueOptions): WordCue[];
|
|
114
|
+
/**
|
|
115
|
+
* The cues a part shows over its picture [start, end) in film seconds,
|
|
116
|
+
* on the part's clock: cues are clipped to the picture (a J or L cut's
|
|
117
|
+
* speech heard under a neighbour's picture shows there).
|
|
118
|
+
*/
|
|
119
|
+
export declare function cuesIn(cues: readonly WordCue[], start: number, end: number): CaptionTrackCue[];
|
|
120
|
+
export declare function toSrt(cues: readonly CaptionCue[]): string;
|
|
121
|
+
export declare function toVtt(cues: readonly CaptionCue[]): string;
|
|
122
|
+
//# sourceMappingURL=captions.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{changesOf as V}from"./anchors.js";import{normText as p,joinWords as z,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(f,o,c){return f.parts.flatMap(r=>{const s=r.speech,h=s?c[s.file]?.words:void 0;if(!s||!h?.length)return[];const a=D(h,s);if(a.length===0)return[];const n=o.find(t=>t.key===r.key),e=n?.spoken??z(a);return[{part:r.key,shown:e,spoken:n?.speak??e,words:a}]})}export function shownToSpoken(f,o){const c=(s,h)=>p(s.slice(0,h)).length,r=[[0,0]];for(const s of V(f,o))r.push([c(f,s.at),c(o,s.into)]),r.push([c(f,s.at+s.removed),c(o,s.into+s.inserted)]);return r.push([p(f).length,p(o).length]),s=>{for(let h=1;h<r.length;h++){const[a,n]=r[h-1]??[0,0],[e,t]=r[h]??[0,0];if(s>e&&h<r.length-1)continue;if(e<=a)return s<=a?n:t;const u=Math.max(0,Math.min(1,(s-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;export function keptSpans(f,o){const c=[],r=U(f).map(s=>({...s,n:p(s.w)}));for(const s of o){const h=p(s);if(!h)continue;if(b.test(s)){const n=[];Array.from(f).reduce((t,u)=>(p(u)&&n.push(t),t+u.length),0);const e=p(f);for(let t=e.indexOf(h);t>=0;t=e.indexOf(h,t+1)){const u=n[t],x=n[t+h.length-1];u!==void 0&&x!==void 0&&c.push([u,x+1])}continue}const a=s.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&&c.push([e.from,t.to])}}return c}const _=(f,o)=>f.some(([c,r])=>o>c&&o<r);export function splitLine(f,o=b.test(f)?CAPTION_CUE_DEFAULTS.maxCharsCjk:CAPTION_CUE_DEFAULTS.maxChars,c=[]){const r=[],s=(a,n)=>{const e=f.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=f.slice(a,n);if(Array.from(t.trim()).length<=o){s(a,n);return}const x=e===0?G:e===1?J:void 0;if(x){let i=-1;for(let S=1;S<t.length-1;S++)x.test(t[S]??"")&&!_(c,a+S+1)&&(i<0||Math.abs(S-t.length/2)<Math.abs(i-t.length/2))&&(i=S);if(i<0){h(a,n,e+1);return}h(a,a+i+1,e),h(a+i+1,n,e);return}const w=Math.floor(t.length/2),C=i=>i>0&&i<t.length&&!_(c,a+i);let g=-1;if(!b.test(t)){for(let i=w;i>0&&g<0;i--)t[i]===" "&&C(i)&&(g=i);for(let i=w;i<t.length&&g<0;i++)t[i]===" "&&C(i)&&(g=i)}for(let i=0;i<=t.length&&g<0;i++)C(w-i)?g=w-i:C(w+i)&&(g=w+i);if(g<0){s(a,n);return}h(a,a+g,e),h(a+g,n,e)};return h(0,f.length,0),r}export function captionCues(f,o={}){const{lines:c,fps:r}=f,s={...CAPTION_CUE_DEFAULTS,...o},h=[];for(const t of c){if(t.words.length===0)continue;const u=t.words,x=new v(new F(u),[t.spoken]),w=(M,l)=>{const d=u[x.wordAtChar(0,M)];return d?l?d.end:d.start:0};if((x.lines[0]?.length??0)===0)continue;const i=p(t.shown)===p(t.spoken)?M=>M:shownToSpoken(t.shown,t.spoken),S=b.test(t.shown)?s.maxCharsCjk:s.maxChars;for(const M of splitLine(t.shown,S)){const l=Math.round(i(p(t.shown.slice(0,M.from)).length)),d=Math.round(i(p(t.shown.slice(0,M.to)).length)),k=w(l,!1),L=w(Math.max(l,d-1),!0),W=b.test(M.text)?M.text.replace(H,""):M.text.replace(/[,;:]+$/u,"");W&&h.push({start:k,end:Math.max(L,k),text:W,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 x=e[t+1],w=x?x.start-s.gapFrames*a:1/0;u.end=Math.min(Math.max(u.end,u.start+s.minSeconds),u.start+s.maxSeconds,w),u.end<=u.start&&(u.end=u.start+a)}return e}export function subtitleCues(f,o){return o===void 0?captionCues(f):wordCues(f.lines,{...o,fps:f.fps}).map(c=>({start:c.start,end:c.end,text:c.text,part:c.part}))}function U(f){const o=[],c=/\S+/gu;for(let r=c.exec(f);r;r=c.exec(f))o.push({w:r[0],from:r.index,to:r.index+r[0].length});return o}export function wordCues(f,o){const{fps:c}=o,r=[];for(const n of f){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 x=(l,d)=>{const k=e[t.wordAtChar(0,l)];return k?d?k.end:k.start:0},C=p(n.shown)===p(n.spoken)?l=>l:shownToSpoken(n.shown,n.spoken),g=(l,d)=>{const k=Math.round(C(p(n.shown.slice(0,l)).length)),L=Math.round(C(p(n.shown.slice(0,d)).length));return[x(k,!1),x(Math.max(k,L-1),!0)]},i=b.test(n.shown),S=o.maxChars??(i?16:32),M=keptSpans(n.shown,o.keep??[]);for(const l of splitLine(n.shown,S,M)){const d=(i?[{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 k=o.maxWords&&o.maxWords>0?o.maxWords:d.length,L=Math.ceil(d.length/k),W=Math.ceil(d.length/L),O=[];d.forEach((m,A)=>{const j=d[A-1],E=O.at(-1);E&&j&&_(M,Math.ceil((j.to+m.from)/2))?E.push(m):O.push([m])});const I=[];let $=[];for(const m of O)$.length>0&&$.length+m.length>W&&(I.push($),$=[]),$.push(...m);$.length>0&&I.push($);for(const m of I){const A=m.map(T=>{const[N,K]=g(T.from,T.to);return{text:T.w,start:N,end:Math.max(K,N)}}),j=A[0],E=A.at(-1);if(!j||!E)continue;const B=m.map(T=>T.w).join(i?"":" ").replace(i?H:/[,;:]+$/u,"");r.push({start:j.start,end:E.end,text:B,part:n.part,words:A})}}}const s=n=>Math.round(n*c)/c,h=1/c,a=r.map(n=>({...n,start:s(n.start),end:s(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<(o.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(f,o,c){const r=s=>Math.round(s*1e6)/1e6;return f.filter(s=>s.end>o&&s.start<c).map(s=>({start:r(Math.max(s.start,o)-o),end:r(Math.min(s.end,c)-o),text:s.text,words:s.words.map(h=>({text:h.text,start:r(h.start-o),end:r(h.end-o)}))}))}const y=(f,o)=>{const c=Math.round(f*1e3),r=Math.floor(c/36e5),s=Math.floor(c/6e4)%60,h=Math.floor(c/1e3)%60,a=(n,e=2)=>String(n).padStart(e,"0");return`${a(r)}:${a(s)}:${a(h)}${o}${a(c%1e3,3)}`};export function toSrt(f){return f.map((o,c)=>`${String(c+1)}
|
|
3
|
+
${y(o.start,",")} --> ${y(o.end,",")}
|
|
4
|
+
${o.text}
|
|
5
|
+
`).join(`
|
|
6
|
+
`)}export function toVtt(f){return`WEBVTT
|
|
7
|
+
|
|
8
|
+
${f.map(o=>`${y(o.start,".")} --> ${y(o.end,".")}
|
|
9
|
+
${o.text}
|
|
10
|
+
`).join(`
|
|
11
|
+
`)}`}
|