@tscaps/engine 0.1.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 (483) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  3. package/dist/index.d.ts +12 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +12 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/modules/css/BrowserCssResourceEmbedder.d.ts +5 -0
  8. package/dist/modules/css/BrowserCssResourceEmbedder.d.ts.map +1 -0
  9. package/dist/modules/css/BrowserCssResourceEmbedder.js +41 -0
  10. package/dist/modules/css/BrowserCssResourceEmbedder.js.map +1 -0
  11. package/dist/modules/css/CssMinifier.d.ts +12 -0
  12. package/dist/modules/css/CssMinifier.d.ts.map +1 -0
  13. package/dist/modules/css/CssMinifier.js +47 -0
  14. package/dist/modules/css/CssMinifier.js.map +1 -0
  15. package/dist/modules/css/CssResourceEmbedder.d.ts +4 -0
  16. package/dist/modules/css/CssResourceEmbedder.d.ts.map +1 -0
  17. package/dist/modules/css/CssResourceEmbedder.js +2 -0
  18. package/dist/modules/css/CssResourceEmbedder.js.map +1 -0
  19. package/dist/modules/css/CssScoper.d.ts +16 -0
  20. package/dist/modules/css/CssScoper.d.ts.map +1 -0
  21. package/dist/modules/css/CssScoper.js +109 -0
  22. package/dist/modules/css/CssScoper.js.map +1 -0
  23. package/dist/modules/css/NoopCssResourceEmbedder.d.ts +12 -0
  24. package/dist/modules/css/NoopCssResourceEmbedder.d.ts.map +1 -0
  25. package/dist/modules/css/NoopCssResourceEmbedder.js +13 -0
  26. package/dist/modules/css/NoopCssResourceEmbedder.js.map +1 -0
  27. package/dist/modules/css/index.d.ts +6 -0
  28. package/dist/modules/css/index.d.ts.map +1 -0
  29. package/dist/modules/css/index.js +5 -0
  30. package/dist/modules/css/index.js.map +1 -0
  31. package/dist/modules/document/CssVariable.d.ts +46 -0
  32. package/dist/modules/document/CssVariable.d.ts.map +1 -0
  33. package/dist/modules/document/CssVariable.js +47 -0
  34. package/dist/modules/document/CssVariable.js.map +1 -0
  35. package/dist/modules/document/Document.d.ts +43 -0
  36. package/dist/modules/document/Document.d.ts.map +1 -0
  37. package/dist/modules/document/Document.js +86 -0
  38. package/dist/modules/document/Document.js.map +1 -0
  39. package/dist/modules/document/DocumentEditor.d.ts +111 -0
  40. package/dist/modules/document/DocumentEditor.d.ts.map +1 -0
  41. package/dist/modules/document/DocumentEditor.js +555 -0
  42. package/dist/modules/document/DocumentEditor.js.map +1 -0
  43. package/dist/modules/document/Letter.d.ts +17 -0
  44. package/dist/modules/document/Letter.d.ts.map +1 -0
  45. package/dist/modules/document/Letter.js +17 -0
  46. package/dist/modules/document/Letter.js.map +1 -0
  47. package/dist/modules/document/Line.d.ts +31 -0
  48. package/dist/modules/document/Line.d.ts.map +1 -0
  49. package/dist/modules/document/Line.js +94 -0
  50. package/dist/modules/document/Line.js.map +1 -0
  51. package/dist/modules/document/LineState.d.ts +6 -0
  52. package/dist/modules/document/LineState.d.ts.map +1 -0
  53. package/dist/modules/document/LineState.js +7 -0
  54. package/dist/modules/document/LineState.js.map +1 -0
  55. package/dist/modules/document/NarrationPace.d.ts +20 -0
  56. package/dist/modules/document/NarrationPace.d.ts.map +1 -0
  57. package/dist/modules/document/NarrationPace.js +60 -0
  58. package/dist/modules/document/NarrationPace.js.map +1 -0
  59. package/dist/modules/document/Section.d.ts +45 -0
  60. package/dist/modules/document/Section.d.ts.map +1 -0
  61. package/dist/modules/document/Section.js +94 -0
  62. package/dist/modules/document/Section.js.map +1 -0
  63. package/dist/modules/document/Segment.d.ts +40 -0
  64. package/dist/modules/document/Segment.d.ts.map +1 -0
  65. package/dist/modules/document/Segment.js +85 -0
  66. package/dist/modules/document/Segment.js.map +1 -0
  67. package/dist/modules/document/Tag.d.ts +24 -0
  68. package/dist/modules/document/Tag.d.ts.map +1 -0
  69. package/dist/modules/document/Tag.js +37 -0
  70. package/dist/modules/document/Tag.js.map +1 -0
  71. package/dist/modules/document/TimeFragment.d.ts +11 -0
  72. package/dist/modules/document/TimeFragment.d.ts.map +1 -0
  73. package/dist/modules/document/TimeFragment.js +29 -0
  74. package/dist/modules/document/TimeFragment.js.map +1 -0
  75. package/dist/modules/document/Word.d.ts +40 -0
  76. package/dist/modules/document/Word.d.ts.map +1 -0
  77. package/dist/modules/document/Word.js +114 -0
  78. package/dist/modules/document/Word.js.map +1 -0
  79. package/dist/modules/document/WordState.d.ts +6 -0
  80. package/dist/modules/document/WordState.d.ts.map +1 -0
  81. package/dist/modules/document/WordState.js +7 -0
  82. package/dist/modules/document/WordState.js.map +1 -0
  83. package/dist/modules/document/index.d.ts +14 -0
  84. package/dist/modules/document/index.d.ts.map +1 -0
  85. package/dist/modules/document/index.js +14 -0
  86. package/dist/modules/document/index.js.map +1 -0
  87. package/dist/modules/effect/CarryQuotesEffect.d.ts +47 -0
  88. package/dist/modules/effect/CarryQuotesEffect.d.ts.map +1 -0
  89. package/dist/modules/effect/CarryQuotesEffect.js +181 -0
  90. package/dist/modules/effect/CarryQuotesEffect.js.map +1 -0
  91. package/dist/modules/effect/Effect.d.ts +16 -0
  92. package/dist/modules/effect/Effect.d.ts.map +1 -0
  93. package/dist/modules/effect/Effect.js +2 -0
  94. package/dist/modules/effect/Effect.js.map +1 -0
  95. package/dist/modules/effect/GapFreeEffect.d.ts +24 -0
  96. package/dist/modules/effect/GapFreeEffect.d.ts.map +1 -0
  97. package/dist/modules/effect/GapFreeEffect.js +67 -0
  98. package/dist/modules/effect/GapFreeEffect.js.map +1 -0
  99. package/dist/modules/effect/RemovePunctuationEffect.d.ts +21 -0
  100. package/dist/modules/effect/RemovePunctuationEffect.d.ts.map +1 -0
  101. package/dist/modules/effect/RemovePunctuationEffect.js +52 -0
  102. package/dist/modules/effect/RemovePunctuationEffect.js.map +1 -0
  103. package/dist/modules/effect/SmartLowercaseEffect.d.ts +21 -0
  104. package/dist/modules/effect/SmartLowercaseEffect.d.ts.map +1 -0
  105. package/dist/modules/effect/SmartLowercaseEffect.js +45 -0
  106. package/dist/modules/effect/SmartLowercaseEffect.js.map +1 -0
  107. package/dist/modules/effect/SmartPunctuationEffect.d.ts +25 -0
  108. package/dist/modules/effect/SmartPunctuationEffect.d.ts.map +1 -0
  109. package/dist/modules/effect/SmartPunctuationEffect.js +68 -0
  110. package/dist/modules/effect/SmartPunctuationEffect.js.map +1 -0
  111. package/dist/modules/effect/index.d.ts +7 -0
  112. package/dist/modules/effect/index.d.ts.map +1 -0
  113. package/dist/modules/effect/index.js +6 -0
  114. package/dist/modules/effect/index.js.map +1 -0
  115. package/dist/modules/pipeline/PipelineProgress.d.ts +30 -0
  116. package/dist/modules/pipeline/PipelineProgress.d.ts.map +1 -0
  117. package/dist/modules/pipeline/PipelineProgress.js +2 -0
  118. package/dist/modules/pipeline/PipelineProgress.js.map +1 -0
  119. package/dist/modules/pipeline/RenderPipeline.d.ts +105 -0
  120. package/dist/modules/pipeline/RenderPipeline.d.ts.map +1 -0
  121. package/dist/modules/pipeline/RenderPipeline.js +232 -0
  122. package/dist/modules/pipeline/RenderPipeline.js.map +1 -0
  123. package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +143 -0
  124. package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -0
  125. package/dist/modules/pipeline/RenderPipelineBuilder.js +317 -0
  126. package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -0
  127. package/dist/modules/pipeline/index.d.ts +6 -0
  128. package/dist/modules/pipeline/index.d.ts.map +1 -0
  129. package/dist/modules/pipeline/index.js +3 -0
  130. package/dist/modules/pipeline/index.js.map +1 -0
  131. package/dist/modules/profiling/Profiler.d.ts +115 -0
  132. package/dist/modules/profiling/Profiler.d.ts.map +1 -0
  133. package/dist/modules/profiling/Profiler.js +316 -0
  134. package/dist/modules/profiling/Profiler.js.map +1 -0
  135. package/dist/modules/profiling/index.d.ts +2 -0
  136. package/dist/modules/profiling/index.d.ts.map +1 -0
  137. package/dist/modules/profiling/index.js +2 -0
  138. package/dist/modules/profiling/index.js.map +1 -0
  139. package/dist/modules/rendering/AlignmentConfig.d.ts +21 -0
  140. package/dist/modules/rendering/AlignmentConfig.d.ts.map +1 -0
  141. package/dist/modules/rendering/AlignmentConfig.js +2 -0
  142. package/dist/modules/rendering/AlignmentConfig.js.map +1 -0
  143. package/dist/modules/rendering/BoxEdges.d.ts +8 -0
  144. package/dist/modules/rendering/BoxEdges.d.ts.map +1 -0
  145. package/dist/modules/rendering/BoxEdges.js +2 -0
  146. package/dist/modules/rendering/BoxEdges.js.map +1 -0
  147. package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts +12 -0
  148. package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts.map +1 -0
  149. package/dist/modules/rendering/BrowserOverlayFrameRenderer.js +31 -0
  150. package/dist/modules/rendering/BrowserOverlayFrameRenderer.js.map +1 -0
  151. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +57 -0
  152. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -0
  153. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +775 -0
  154. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -0
  155. package/dist/modules/rendering/ElementRenderOverrides.d.ts +15 -0
  156. package/dist/modules/rendering/ElementRenderOverrides.d.ts.map +1 -0
  157. package/dist/modules/rendering/ElementRenderOverrides.js +24 -0
  158. package/dist/modules/rendering/ElementRenderOverrides.js.map +1 -0
  159. package/dist/modules/rendering/InlineStyleMap.d.ts +9 -0
  160. package/dist/modules/rendering/InlineStyleMap.d.ts.map +1 -0
  161. package/dist/modules/rendering/InlineStyleMap.js +2 -0
  162. package/dist/modules/rendering/InlineStyleMap.js.map +1 -0
  163. package/dist/modules/rendering/LayeredSubtitleFrame.d.ts +20 -0
  164. package/dist/modules/rendering/LayeredSubtitleFrame.d.ts.map +1 -0
  165. package/dist/modules/rendering/LayeredSubtitleFrame.js +36 -0
  166. package/dist/modules/rendering/LayeredSubtitleFrame.js.map +1 -0
  167. package/dist/modules/rendering/OverlayFrameRenderer.d.ts +27 -0
  168. package/dist/modules/rendering/OverlayFrameRenderer.d.ts.map +1 -0
  169. package/dist/modules/rendering/OverlayFrameRenderer.js +2 -0
  170. package/dist/modules/rendering/OverlayFrameRenderer.js.map +1 -0
  171. package/dist/modules/rendering/RenderingConfig.d.ts +22 -0
  172. package/dist/modules/rendering/RenderingConfig.d.ts.map +1 -0
  173. package/dist/modules/rendering/RenderingConfig.js +2 -0
  174. package/dist/modules/rendering/RenderingConfig.js.map +1 -0
  175. package/dist/modules/rendering/ScopedRenderOverride.d.ts +19 -0
  176. package/dist/modules/rendering/ScopedRenderOverride.d.ts.map +1 -0
  177. package/dist/modules/rendering/ScopedRenderOverride.js +2 -0
  178. package/dist/modules/rendering/ScopedRenderOverride.js.map +1 -0
  179. package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts +41 -0
  180. package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts.map +1 -0
  181. package/dist/modules/rendering/SegmentPaintRegionResolver.js +47 -0
  182. package/dist/modules/rendering/SegmentPaintRegionResolver.js.map +1 -0
  183. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts +58 -0
  184. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts.map +1 -0
  185. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js +132 -0
  186. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js.map +1 -0
  187. package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +111 -0
  188. package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -0
  189. package/dist/modules/rendering/SubtitleFrameRenderer.js +2 -0
  190. package/dist/modules/rendering/SubtitleFrameRenderer.js.map +1 -0
  191. package/dist/modules/rendering/VideoFrameLayerClass.d.ts +21 -0
  192. package/dist/modules/rendering/VideoFrameLayerClass.d.ts.map +1 -0
  193. package/dist/modules/rendering/VideoFrameLayerClass.js +21 -0
  194. package/dist/modules/rendering/VideoFrameLayerClass.js.map +1 -0
  195. package/dist/modules/rendering/VideoFrameSource.d.ts +29 -0
  196. package/dist/modules/rendering/VideoFrameSource.d.ts.map +1 -0
  197. package/dist/modules/rendering/VideoFrameSource.js +2 -0
  198. package/dist/modules/rendering/VideoFrameSource.js.map +1 -0
  199. package/dist/modules/rendering/index.d.ts +14 -0
  200. package/dist/modules/rendering/index.d.ts.map +1 -0
  201. package/dist/modules/rendering/index.js +6 -0
  202. package/dist/modules/rendering/index.js.map +1 -0
  203. package/dist/modules/splitting/BalancedLineSplitter.d.ts +24 -0
  204. package/dist/modules/splitting/BalancedLineSplitter.d.ts.map +1 -0
  205. package/dist/modules/splitting/BalancedLineSplitter.js +81 -0
  206. package/dist/modules/splitting/BalancedLineSplitter.js.map +1 -0
  207. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts +31 -0
  208. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts.map +1 -0
  209. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js +99 -0
  210. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js.map +1 -0
  211. package/dist/modules/splitting/BoundarySegmentSplitter.d.ts +19 -0
  212. package/dist/modules/splitting/BoundarySegmentSplitter.d.ts.map +1 -0
  213. package/dist/modules/splitting/BoundarySegmentSplitter.js +38 -0
  214. package/dist/modules/splitting/BoundarySegmentSplitter.js.map +1 -0
  215. package/dist/modules/splitting/CompositeSegmentSplitter.d.ts +8 -0
  216. package/dist/modules/splitting/CompositeSegmentSplitter.d.ts.map +1 -0
  217. package/dist/modules/splitting/CompositeSegmentSplitter.js +12 -0
  218. package/dist/modules/splitting/CompositeSegmentSplitter.js.map +1 -0
  219. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts +56 -0
  220. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts.map +1 -0
  221. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js +197 -0
  222. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js.map +1 -0
  223. package/dist/modules/splitting/GraphemeWordSplitter.d.ts +11 -0
  224. package/dist/modules/splitting/GraphemeWordSplitter.d.ts.map +1 -0
  225. package/dist/modules/splitting/GraphemeWordSplitter.js +12 -0
  226. package/dist/modules/splitting/GraphemeWordSplitter.js.map +1 -0
  227. package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts +15 -0
  228. package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts.map +1 -0
  229. package/dist/modules/splitting/LimitByCharsSegmentSplitter.js +64 -0
  230. package/dist/modules/splitting/LimitByCharsSegmentSplitter.js.map +1 -0
  231. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts +30 -0
  232. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts.map +1 -0
  233. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js +66 -0
  234. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js.map +1 -0
  235. package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts +12 -0
  236. package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts.map +1 -0
  237. package/dist/modules/splitting/LimitByWordsSegmentSplitter.js +25 -0
  238. package/dist/modules/splitting/LimitByWordsSegmentSplitter.js.map +1 -0
  239. package/dist/modules/splitting/LineSplitter.d.ts +10 -0
  240. package/dist/modules/splitting/LineSplitter.d.ts.map +1 -0
  241. package/dist/modules/splitting/LineSplitter.js +2 -0
  242. package/dist/modules/splitting/LineSplitter.js.map +1 -0
  243. package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts +24 -0
  244. package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts.map +1 -0
  245. package/dist/modules/splitting/PauseBasedSegmentSplitter.js +43 -0
  246. package/dist/modules/splitting/PauseBasedSegmentSplitter.js.map +1 -0
  247. package/dist/modules/splitting/SegmentSplitter.d.ts +10 -0
  248. package/dist/modules/splitting/SegmentSplitter.d.ts.map +1 -0
  249. package/dist/modules/splitting/SegmentSplitter.js +2 -0
  250. package/dist/modules/splitting/SegmentSplitter.js.map +1 -0
  251. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts +17 -0
  252. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts.map +1 -0
  253. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js +46 -0
  254. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js.map +1 -0
  255. package/dist/modules/splitting/TextMeasurer.d.ts +15 -0
  256. package/dist/modules/splitting/TextMeasurer.d.ts.map +1 -0
  257. package/dist/modules/splitting/TextMeasurer.js +2 -0
  258. package/dist/modules/splitting/TextMeasurer.js.map +1 -0
  259. package/dist/modules/splitting/WordSplitter.d.ts +8 -0
  260. package/dist/modules/splitting/WordSplitter.d.ts.map +1 -0
  261. package/dist/modules/splitting/WordSplitter.js +2 -0
  262. package/dist/modules/splitting/WordSplitter.js.map +1 -0
  263. package/dist/modules/splitting/index.d.ts +24 -0
  264. package/dist/modules/splitting/index.d.ts.map +1 -0
  265. package/dist/modules/splitting/index.js +12 -0
  266. package/dist/modules/splitting/index.js.map +1 -0
  267. package/dist/modules/svg-filter/SvgFilter.d.ts +16 -0
  268. package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -0
  269. package/dist/modules/svg-filter/SvgFilter.js +28 -0
  270. package/dist/modules/svg-filter/SvgFilter.js.map +1 -0
  271. package/dist/modules/svg-filter/SvgFilterBundle.d.ts +16 -0
  272. package/dist/modules/svg-filter/SvgFilterBundle.d.ts.map +1 -0
  273. package/dist/modules/svg-filter/SvgFilterBundle.js +20 -0
  274. package/dist/modules/svg-filter/SvgFilterBundle.js.map +1 -0
  275. package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts +16 -0
  276. package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts.map +1 -0
  277. package/dist/modules/svg-filter/SvgFilterDefinitions.js +25 -0
  278. package/dist/modules/svg-filter/SvgFilterDefinitions.js.map +1 -0
  279. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts +21 -0
  280. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts.map +1 -0
  281. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js +50 -0
  282. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js.map +1 -0
  283. package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts +17 -0
  284. package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts.map +1 -0
  285. package/dist/modules/svg-filter/SvgFilterLengthResolver.js +27 -0
  286. package/dist/modules/svg-filter/SvgFilterLengthResolver.js.map +1 -0
  287. package/dist/modules/svg-filter/SvgFilterScope.d.ts +18 -0
  288. package/dist/modules/svg-filter/SvgFilterScope.d.ts.map +1 -0
  289. package/dist/modules/svg-filter/SvgFilterScope.js +28 -0
  290. package/dist/modules/svg-filter/SvgFilterScope.js.map +1 -0
  291. package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts +52 -0
  292. package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts.map +1 -0
  293. package/dist/modules/svg-filter/SvgFilterScopeProvider.js +2 -0
  294. package/dist/modules/svg-filter/SvgFilterScopeProvider.js.map +1 -0
  295. package/dist/modules/svg-filter/SvgFilterScoper.d.ts +60 -0
  296. package/dist/modules/svg-filter/SvgFilterScoper.d.ts.map +1 -0
  297. package/dist/modules/svg-filter/SvgFilterScoper.js +58 -0
  298. package/dist/modules/svg-filter/SvgFilterScoper.js.map +1 -0
  299. package/dist/modules/svg-filter/index.d.ts +10 -0
  300. package/dist/modules/svg-filter/index.d.ts.map +1 -0
  301. package/dist/modules/svg-filter/index.js +8 -0
  302. package/dist/modules/svg-filter/index.js.map +1 -0
  303. package/dist/modules/tagging/RegexTagger.d.ts +11 -0
  304. package/dist/modules/tagging/RegexTagger.d.ts.map +1 -0
  305. package/dist/modules/tagging/RegexTagger.js +32 -0
  306. package/dist/modules/tagging/RegexTagger.js.map +1 -0
  307. package/dist/modules/tagging/SpanTagger.d.ts +25 -0
  308. package/dist/modules/tagging/SpanTagger.d.ts.map +1 -0
  309. package/dist/modules/tagging/SpanTagger.js +73 -0
  310. package/dist/modules/tagging/SpanTagger.js.map +1 -0
  311. package/dist/modules/tagging/StructureTagger.d.ts +20 -0
  312. package/dist/modules/tagging/StructureTagger.d.ts.map +1 -0
  313. package/dist/modules/tagging/StructureTagger.js +74 -0
  314. package/dist/modules/tagging/StructureTagger.js.map +1 -0
  315. package/dist/modules/tagging/Tagger.d.ts +5 -0
  316. package/dist/modules/tagging/Tagger.d.ts.map +1 -0
  317. package/dist/modules/tagging/Tagger.js +5 -0
  318. package/dist/modules/tagging/Tagger.js.map +1 -0
  319. package/dist/modules/tagging/WordlistTagger.d.ts +11 -0
  320. package/dist/modules/tagging/WordlistTagger.d.ts.map +1 -0
  321. package/dist/modules/tagging/WordlistTagger.js +31 -0
  322. package/dist/modules/tagging/WordlistTagger.js.map +1 -0
  323. package/dist/modules/tagging/index.d.ts +6 -0
  324. package/dist/modules/tagging/index.d.ts.map +1 -0
  325. package/dist/modules/tagging/index.js +6 -0
  326. package/dist/modules/tagging/index.js.map +1 -0
  327. package/dist/modules/transcription/AudioDecoder.d.ts +11 -0
  328. package/dist/modules/transcription/AudioDecoder.d.ts.map +1 -0
  329. package/dist/modules/transcription/AudioDecoder.js +2 -0
  330. package/dist/modules/transcription/AudioDecoder.js.map +1 -0
  331. package/dist/modules/transcription/BrowserAudioDecoder.d.ts +13 -0
  332. package/dist/modules/transcription/BrowserAudioDecoder.d.ts.map +1 -0
  333. package/dist/modules/transcription/BrowserAudioDecoder.js +34 -0
  334. package/dist/modules/transcription/BrowserAudioDecoder.js.map +1 -0
  335. package/dist/modules/transcription/PassthroughTranscriber.d.ts +20 -0
  336. package/dist/modules/transcription/PassthroughTranscriber.d.ts.map +1 -0
  337. package/dist/modules/transcription/PassthroughTranscriber.js +23 -0
  338. package/dist/modules/transcription/PassthroughTranscriber.js.map +1 -0
  339. package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts +12 -0
  340. package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts.map +1 -0
  341. package/dist/modules/transcription/PreDecodedAudioDecoder.js +14 -0
  342. package/dist/modules/transcription/PreDecodedAudioDecoder.js.map +1 -0
  343. package/dist/modules/transcription/SrtTranscriber.d.ts +33 -0
  344. package/dist/modules/transcription/SrtTranscriber.d.ts.map +1 -0
  345. package/dist/modules/transcription/SrtTranscriber.js +111 -0
  346. package/dist/modules/transcription/SrtTranscriber.js.map +1 -0
  347. package/dist/modules/transcription/Transcriber.d.ts +23 -0
  348. package/dist/modules/transcription/Transcriber.d.ts.map +1 -0
  349. package/dist/modules/transcription/Transcriber.js +2 -0
  350. package/dist/modules/transcription/Transcriber.js.map +1 -0
  351. package/dist/modules/transcription/WhisperTranscriber.d.ts +44 -0
  352. package/dist/modules/transcription/WhisperTranscriber.d.ts.map +1 -0
  353. package/dist/modules/transcription/WhisperTranscriber.js +162 -0
  354. package/dist/modules/transcription/WhisperTranscriber.js.map +1 -0
  355. package/dist/modules/transcription/index.d.ts +8 -0
  356. package/dist/modules/transcription/index.d.ts.map +1 -0
  357. package/dist/modules/transcription/index.js +6 -0
  358. package/dist/modules/transcription/index.js.map +1 -0
  359. package/dist/modules/video/RenderJob.d.ts +95 -0
  360. package/dist/modules/video/RenderJob.d.ts.map +1 -0
  361. package/dist/modules/video/RenderJob.js +2 -0
  362. package/dist/modules/video/RenderJob.js.map +1 -0
  363. package/dist/modules/video/VideoRenderer.d.ts +5 -0
  364. package/dist/modules/video/VideoRenderer.d.ts.map +1 -0
  365. package/dist/modules/video/VideoRenderer.js +2 -0
  366. package/dist/modules/video/VideoRenderer.js.map +1 -0
  367. package/dist/modules/video/index.d.ts +33 -0
  368. package/dist/modules/video/index.d.ts.map +1 -0
  369. package/dist/modules/video/index.js +17 -0
  370. package/dist/modules/video/index.js.map +1 -0
  371. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts +69 -0
  372. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -0
  373. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +206 -0
  374. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -0
  375. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts +24 -0
  376. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts.map +1 -0
  377. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js +2 -0
  378. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js.map +1 -0
  379. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts +20 -0
  380. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts.map +1 -0
  381. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js +2 -0
  382. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js.map +1 -0
  383. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts +11 -0
  384. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts.map +1 -0
  385. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js +32 -0
  386. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js.map +1 -0
  387. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts +12 -0
  388. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts.map +1 -0
  389. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js +14 -0
  390. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js.map +1 -0
  391. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts +28 -0
  392. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts.map +1 -0
  393. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js +52 -0
  394. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js.map +1 -0
  395. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts +25 -0
  396. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts.map +1 -0
  397. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js +52 -0
  398. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js.map +1 -0
  399. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts +32 -0
  400. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts.map +1 -0
  401. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js +60 -0
  402. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js.map +1 -0
  403. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts +27 -0
  404. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts.map +1 -0
  405. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js +72 -0
  406. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js.map +1 -0
  407. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts +32 -0
  408. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts.map +1 -0
  409. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js +2 -0
  410. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js.map +1 -0
  411. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts +25 -0
  412. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts.map +1 -0
  413. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js +37 -0
  414. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js.map +1 -0
  415. package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts +32 -0
  416. package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts.map +1 -0
  417. package/dist/modules/video/mediabunny/codec/CodecPolicy.js +2 -0
  418. package/dist/modules/video/mediabunny/codec/CodecPolicy.js.map +1 -0
  419. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts +59 -0
  420. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts.map +1 -0
  421. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js +110 -0
  422. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js.map +1 -0
  423. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts +27 -0
  424. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts.map +1 -0
  425. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js +44 -0
  426. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js.map +1 -0
  427. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts +10 -0
  428. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts.map +1 -0
  429. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js +15 -0
  430. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js.map +1 -0
  431. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts +29 -0
  432. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts.map +1 -0
  433. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js +2 -0
  434. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js.map +1 -0
  435. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts +16 -0
  436. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts.map +1 -0
  437. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js +2 -0
  438. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js.map +1 -0
  439. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +25 -0
  440. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -0
  441. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +74 -0
  442. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +1 -0
  443. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts +26 -0
  444. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts.map +1 -0
  445. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js +147 -0
  446. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js.map +1 -0
  447. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts +12 -0
  448. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts.map +1 -0
  449. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js +25 -0
  450. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js.map +1 -0
  451. package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts +30 -0
  452. package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts.map +1 -0
  453. package/dist/modules/video/mediabunny/frame/FrameCompositor.js +2 -0
  454. package/dist/modules/video/mediabunny/frame/FrameCompositor.js.map +1 -0
  455. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts +44 -0
  456. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts.map +1 -0
  457. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js +334 -0
  458. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js.map +1 -0
  459. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts +10 -0
  460. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts.map +1 -0
  461. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js +17 -0
  462. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js.map +1 -0
  463. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts +30 -0
  464. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts.map +1 -0
  465. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js +2 -0
  466. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js.map +1 -0
  467. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts +22 -0
  468. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts.map +1 -0
  469. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js +2 -0
  470. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js.map +1 -0
  471. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts +17 -0
  472. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts.map +1 -0
  473. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js +48 -0
  474. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js.map +1 -0
  475. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts +11 -0
  476. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts.map +1 -0
  477. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js +22 -0
  478. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js.map +1 -0
  479. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts +27 -0
  480. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts.map +1 -0
  481. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js +2 -0
  482. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js.map +1 -0
  483. package/package.json +67 -0
@@ -0,0 +1,109 @@
1
+ const KEYFRAME_NAME_RE = /@(?:-webkit-|-moz-)?keyframes\s+([a-zA-Z_-][a-zA-Z0-9_-]*)/g;
2
+ const escapeRegex = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
3
+ /**
4
+ * Scopes a CSS string so it can coexist with sibling stylesheets in
5
+ * the same document. Top-level selectors get prefixed with
6
+ * `scopeSelector`; every `@keyframes` declaration is renamed to a
7
+ * scope-unique form and the matching `animation-name` / `animation`
8
+ * shorthand references in the same stylesheet are rewritten in step.
9
+ *
10
+ * `scopeSelector` is expected to be a simple class selector
11
+ * (e.g. `.my-scope`); its identifier portion seeds the keyframe rename.
12
+ */
13
+ export class CssScoper {
14
+ scope(css, scopeSelector) {
15
+ const scopeKey = scopeSelector.replace(/^\.+/, '');
16
+ return this.scopeSelectors(this.scopeKeyframes(css, scopeKey), scopeSelector);
17
+ }
18
+ scopeKeyframes(css, scopeKey) {
19
+ const names = new Set();
20
+ for (const m of css.matchAll(KEYFRAME_NAME_RE))
21
+ names.add(m[1]);
22
+ if (names.size === 0)
23
+ return css;
24
+ let result = css;
25
+ for (const name of names) {
26
+ const scopedName = `${name}-${scopeKey}`;
27
+ const esc = escapeRegex(name);
28
+ result = result.replace(new RegExp(`(@(?:-webkit-|-moz-)?keyframes\\s+)${esc}(?![\\w-])`, 'g'), `$1${scopedName}`);
29
+ // Both `animation-name:` and the `animation:` shorthand can carry a
30
+ // comma-separated list of names. The rewrite scans the whole value
31
+ // range (between `:` and the next `;` or rule boundary) and replaces
32
+ // every whole-word occurrence, so the second entry in
33
+ // `animation-name: foo, bar` is reached. The value-bounded scope
34
+ // avoids touching a class or property elsewhere that happens to
35
+ // share the spelling.
36
+ const replaceInValue = (_m, prefix, value) => prefix + value.replace(new RegExp(`(?<![\\w-])${esc}(?![\\w-])`, 'g'), scopedName);
37
+ result = result.replace(/(animation-name\s*:\s*)([^;{}]*)/g, replaceInValue);
38
+ result = result.replace(/(animation\s*:\s*)([^;{}]*)/g, replaceInValue);
39
+ }
40
+ return result;
41
+ }
42
+ scopeSelectors(css, scopeSelector) {
43
+ let result = '';
44
+ let i = 0;
45
+ let depth = 0;
46
+ while (i < css.length) {
47
+ if (css[i] === '{') {
48
+ depth++;
49
+ result += '{';
50
+ i++;
51
+ }
52
+ else if (css[i] === '}') {
53
+ depth--;
54
+ result += '}';
55
+ i++;
56
+ }
57
+ else if (depth === 0) {
58
+ const remaining = css.slice(i);
59
+ const ws = remaining.match(/^\s+/);
60
+ if (ws) {
61
+ result += ws[0];
62
+ i += ws[0].length;
63
+ continue;
64
+ }
65
+ // Top-level comments — copy through. Without this, a comment placed
66
+ // before an @-rule (e.g. `/* note */ @keyframes foo`) would be
67
+ // swallowed into the regular-selector branch and fed to the scoper
68
+ // alongside the @-rule header, producing invalid CSS that drops the
69
+ // whole rule.
70
+ if (remaining.startsWith('/*')) {
71
+ const end = remaining.indexOf('*/');
72
+ if (end === -1) {
73
+ result += remaining;
74
+ break;
75
+ }
76
+ result += remaining.slice(0, end + 2);
77
+ i += end + 2;
78
+ continue;
79
+ }
80
+ const brace = remaining.indexOf('{');
81
+ if (brace === -1) {
82
+ result += remaining;
83
+ break;
84
+ }
85
+ if (remaining.startsWith('@')) {
86
+ result += remaining.slice(0, brace + 1);
87
+ i += brace + 1;
88
+ depth++;
89
+ }
90
+ else {
91
+ const selector = remaining.slice(0, brace).trim();
92
+ const scoped = selector
93
+ .split(',')
94
+ .map(s => `${scopeSelector} ${s.trim()}`)
95
+ .join(', ');
96
+ result += `${scoped} {`;
97
+ i += brace + 1;
98
+ depth++;
99
+ }
100
+ }
101
+ else {
102
+ result += css[i];
103
+ i++;
104
+ }
105
+ }
106
+ return result;
107
+ }
108
+ }
109
+ //# sourceMappingURL=CssScoper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CssScoper.js","sourceRoot":"","sources":["../../../src/modules/css/CssScoper.ts"],"names":[],"mappings":"AA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CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;gBACjB,CAAC,EAAE,CAAC;YACN,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import type { CssResourceEmbedder } from '../css/CssResourceEmbedder';
2
+ /**
3
+ * `CssResourceEmbedder` that returns the input CSS verbatim and
4
+ * strips every `@font-face` rule along the way. Referenced font
5
+ * families in the stripped CSS resolve against whatever the host
6
+ * already has loaded, with the platform default as the ultimate
7
+ * fallback.
8
+ */
9
+ export declare class NoopCssResourceEmbedder implements CssResourceEmbedder {
10
+ embed(css: string): Promise<string>;
11
+ }
12
+ //# sourceMappingURL=NoopCssResourceEmbedder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopCssResourceEmbedder.d.ts","sourceRoot":"","sources":["../../../src/modules/css/NoopCssResourceEmbedder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E;;;;;;GAMG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAC3D,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG1C"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `CssResourceEmbedder` that returns the input CSS verbatim and
3
+ * strips every `@font-face` rule along the way. Referenced font
4
+ * families in the stripped CSS resolve against whatever the host
5
+ * already has loaded, with the platform default as the ultimate
6
+ * fallback.
7
+ */
8
+ export class NoopCssResourceEmbedder {
9
+ async embed(css) {
10
+ return css.replace(/@font-face\s*\{[^}]*\}/g, '');
11
+ }
12
+ }
13
+ //# sourceMappingURL=NoopCssResourceEmbedder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopCssResourceEmbedder.js","sourceRoot":"","sources":["../../../src/modules/css/NoopCssResourceEmbedder.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,OAAO,uBAAuB;IAClC,KAAK,CAAC,KAAK,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export type { CssResourceEmbedder } from '../css/CssResourceEmbedder';
2
+ export { BrowserCssResourceEmbedder } from '../css/BrowserCssResourceEmbedder';
3
+ export { NoopCssResourceEmbedder } from '../css/NoopCssResourceEmbedder';
4
+ export { CssScoper } from '../css/CssScoper';
5
+ export { CssMinifier } from '../css/CssMinifier';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/css/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { BrowserCssResourceEmbedder } from '../css/BrowserCssResourceEmbedder';
2
+ export { NoopCssResourceEmbedder } from '../css/NoopCssResourceEmbedder';
3
+ export { CssScoper } from '../css/CssScoper';
4
+ export { CssMinifier } from '../css/CssMinifier';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/css/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * CSS custom properties exposed on each rendered node so consumers can
3
+ * react to playback timing.
4
+ *
5
+ * Naming:
6
+ * - `--on-<x>-starts` / `--on-<x>-ends` are *event timestamps*: they
7
+ * encode the moment (relative to `currentTime`, in seconds) at which
8
+ * state `<x>` begins or ends. Negative values mean the event is in
9
+ * the past.
10
+ * - `--<x>-duration` is a *span*, not an event. It does not coincide
11
+ * with any moment, so it carries no `on-` prefix.
12
+ */
13
+ export declare enum CssVariable {
14
+ SECTION_STARTS = "--on-section-starts",
15
+ SECTION_ENDS = "--on-section-ends",
16
+ SECTION_DURATION = "--section-duration",
17
+ SEGMENT_STARTS = "--on-segment-starts",
18
+ SEGMENT_ENDS = "--on-segment-ends",
19
+ SEGMENT_DURATION = "--segment-duration",
20
+ LINE_NOT_NARRATED_YET_STARTS = "--on-line-not-narrated-yet-starts",
21
+ LINE_NOT_NARRATED_YET_ENDS = "--on-line-not-narrated-yet-ends",
22
+ LINE_NOT_NARRATED_YET_DURATION = "--line-not-narrated-yet-duration",
23
+ LINE_BEING_NARRATED_STARTS = "--on-line-being-narrated-starts",
24
+ LINE_BEING_NARRATED_ENDS = "--on-line-being-narrated-ends",
25
+ LINE_BEING_NARRATED_DURATION = "--line-being-narrated-duration",
26
+ LINE_ALREADY_NARRATED_STARTS = "--on-line-already-narrated-starts",
27
+ LINE_ALREADY_NARRATED_ENDS = "--on-line-already-narrated-ends",
28
+ LINE_ALREADY_NARRATED_DURATION = "--line-already-narrated-duration",
29
+ WORD_NOT_NARRATED_YET_STARTS = "--on-word-not-narrated-yet-starts",
30
+ WORD_NOT_NARRATED_YET_ENDS = "--on-word-not-narrated-yet-ends",
31
+ WORD_NOT_NARRATED_YET_DURATION = "--word-not-narrated-yet-duration",
32
+ WORD_BEING_NARRATED_STARTS = "--on-word-being-narrated-starts",
33
+ WORD_BEING_NARRATED_ENDS = "--on-word-being-narrated-ends",
34
+ WORD_BEING_NARRATED_DURATION = "--word-being-narrated-duration",
35
+ WORD_ALREADY_NARRATED_STARTS = "--on-word-already-narrated-starts",
36
+ WORD_ALREADY_NARRATED_ENDS = "--on-word-already-narrated-ends",
37
+ WORD_ALREADY_NARRATED_DURATION = "--word-already-narrated-duration",
38
+ LETTER_INDEX = "--letter-index",
39
+ LETTER_COUNT = "--letter-count",
40
+ VIDEO_FRAME = "--video-frame",
41
+ SUBTITLE_REGION_WIDTH = "--subtitle-region-width",
42
+ SUBTITLE_REGION_HEIGHT = "--subtitle-region-height",
43
+ SUBTITLE_REGION_X = "--subtitle-region-x",
44
+ SUBTITLE_REGION_Y = "--subtitle-region-y"
45
+ }
46
+ //# sourceMappingURL=CssVariable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CssVariable.d.ts","sourceRoot":"","sources":["../../../src/modules/document/CssVariable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,oBAAY,WAAW;IACrB,cAAc,wBAAwB;IACtC,YAAY,sBAAsB;IAClC,gBAAgB,uBAAuB;IAEvC,cAAc,wBAAwB;IACtC,YAAY,sBAAsB;IAClC,gBAAgB,uBAAuB;IAEvC,4BAA4B,sCAAsC;IAClE,0BAA0B,oCAAoC;IAC9D,8BAA8B,qCAAqC;IACnE,0BAA0B,oCAAoC;IAC9D,wBAAwB,kCAAkC;IAC1D,4BAA4B,mCAAmC;IAC/D,4BAA4B,sCAAsC;IAClE,0BAA0B,oCAAoC;IAC9D,8BAA8B,qCAAqC;IAEnE,4BAA4B,sCAAsC;IAClE,0BAA0B,oCAAoC;IAC9D,8BAA8B,qCAAqC;IACnE,0BAA0B,oCAAoC;IAC9D,wBAAwB,kCAAkC;IAC1D,4BAA4B,mCAAmC;IAC/D,4BAA4B,sCAAsC;IAClE,0BAA0B,oCAAoC;IAC9D,8BAA8B,qCAAqC;IAEnE,YAAY,mBAAmB;IAC/B,YAAY,mBAAmB;IAE/B,WAAW,kBAAkB;IAC7B,qBAAqB,4BAA4B;IACjD,sBAAsB,6BAA6B;IACnD,iBAAiB,wBAAwB;IACzC,iBAAiB,wBAAwB;CAC1C"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * CSS custom properties exposed on each rendered node so consumers can
3
+ * react to playback timing.
4
+ *
5
+ * Naming:
6
+ * - `--on-<x>-starts` / `--on-<x>-ends` are *event timestamps*: they
7
+ * encode the moment (relative to `currentTime`, in seconds) at which
8
+ * state `<x>` begins or ends. Negative values mean the event is in
9
+ * the past.
10
+ * - `--<x>-duration` is a *span*, not an event. It does not coincide
11
+ * with any moment, so it carries no `on-` prefix.
12
+ */
13
+ export var CssVariable;
14
+ (function (CssVariable) {
15
+ CssVariable["SECTION_STARTS"] = "--on-section-starts";
16
+ CssVariable["SECTION_ENDS"] = "--on-section-ends";
17
+ CssVariable["SECTION_DURATION"] = "--section-duration";
18
+ CssVariable["SEGMENT_STARTS"] = "--on-segment-starts";
19
+ CssVariable["SEGMENT_ENDS"] = "--on-segment-ends";
20
+ CssVariable["SEGMENT_DURATION"] = "--segment-duration";
21
+ CssVariable["LINE_NOT_NARRATED_YET_STARTS"] = "--on-line-not-narrated-yet-starts";
22
+ CssVariable["LINE_NOT_NARRATED_YET_ENDS"] = "--on-line-not-narrated-yet-ends";
23
+ CssVariable["LINE_NOT_NARRATED_YET_DURATION"] = "--line-not-narrated-yet-duration";
24
+ CssVariable["LINE_BEING_NARRATED_STARTS"] = "--on-line-being-narrated-starts";
25
+ CssVariable["LINE_BEING_NARRATED_ENDS"] = "--on-line-being-narrated-ends";
26
+ CssVariable["LINE_BEING_NARRATED_DURATION"] = "--line-being-narrated-duration";
27
+ CssVariable["LINE_ALREADY_NARRATED_STARTS"] = "--on-line-already-narrated-starts";
28
+ CssVariable["LINE_ALREADY_NARRATED_ENDS"] = "--on-line-already-narrated-ends";
29
+ CssVariable["LINE_ALREADY_NARRATED_DURATION"] = "--line-already-narrated-duration";
30
+ CssVariable["WORD_NOT_NARRATED_YET_STARTS"] = "--on-word-not-narrated-yet-starts";
31
+ CssVariable["WORD_NOT_NARRATED_YET_ENDS"] = "--on-word-not-narrated-yet-ends";
32
+ CssVariable["WORD_NOT_NARRATED_YET_DURATION"] = "--word-not-narrated-yet-duration";
33
+ CssVariable["WORD_BEING_NARRATED_STARTS"] = "--on-word-being-narrated-starts";
34
+ CssVariable["WORD_BEING_NARRATED_ENDS"] = "--on-word-being-narrated-ends";
35
+ CssVariable["WORD_BEING_NARRATED_DURATION"] = "--word-being-narrated-duration";
36
+ CssVariable["WORD_ALREADY_NARRATED_STARTS"] = "--on-word-already-narrated-starts";
37
+ CssVariable["WORD_ALREADY_NARRATED_ENDS"] = "--on-word-already-narrated-ends";
38
+ CssVariable["WORD_ALREADY_NARRATED_DURATION"] = "--word-already-narrated-duration";
39
+ CssVariable["LETTER_INDEX"] = "--letter-index";
40
+ CssVariable["LETTER_COUNT"] = "--letter-count";
41
+ CssVariable["VIDEO_FRAME"] = "--video-frame";
42
+ CssVariable["SUBTITLE_REGION_WIDTH"] = "--subtitle-region-width";
43
+ CssVariable["SUBTITLE_REGION_HEIGHT"] = "--subtitle-region-height";
44
+ CssVariable["SUBTITLE_REGION_X"] = "--subtitle-region-x";
45
+ CssVariable["SUBTITLE_REGION_Y"] = "--subtitle-region-y";
46
+ })(CssVariable || (CssVariable = {}));
47
+ //# sourceMappingURL=CssVariable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CssVariable.js","sourceRoot":"","sources":["../../../src/modules/document/CssVariable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,WAqCX;AArCD,WAAY,WAAW;IACrB,qDAAsC,CAAA;IACtC,iDAAkC,CAAA;IAClC,sDAAuC,CAAA;IAEvC,qDAAsC,CAAA;IACtC,iDAAkC,CAAA;IAClC,sDAAuC,CAAA;IAEvC,iFAAkE,CAAA;IAClE,6EAA8D,CAAA;IAC9D,kFAAmE,CAAA;IACnE,6EAA8D,CAAA;IAC9D,yEAA0D,CAAA;IAC1D,8EAA+D,CAAA;IAC/D,iFAAkE,CAAA;IAClE,6EAA8D,CAAA;IAC9D,kFAAmE,CAAA;IAEnE,iFAAkE,CAAA;IAClE,6EAA8D,CAAA;IAC9D,kFAAmE,CAAA;IACnE,6EAA8D,CAAA;IAC9D,yEAA0D,CAAA;IAC1D,8EAA+D,CAAA;IAC/D,iFAAkE,CAAA;IAClE,6EAA8D,CAAA;IAC9D,kFAAmE,CAAA;IAEnE,8CAA+B,CAAA;IAC/B,8CAA+B,CAAA;IAE/B,4CAA6B,CAAA;IAC7B,gEAAiD,CAAA;IACjD,kEAAmD,CAAA;IACnD,wDAAyC,CAAA;IACzC,wDAAyC,CAAA;AAC3C,CAAC,EArCW,WAAW,KAAX,WAAW,QAqCtB"}
@@ -0,0 +1,43 @@
1
+ import { Section } from '../document/Section';
2
+ import { Segment } from '../document/Segment';
3
+ import { Line } from '../document/Line';
4
+ import { Word } from '../document/Word';
5
+ import { NarrationPace } from '../document/NarrationPace';
6
+ export interface DocumentProps<M = unknown> {
7
+ readonly sections: ReadonlyArray<Section>;
8
+ readonly metadata?: M | undefined;
9
+ readonly narrationPace?: NarrationPace | undefined;
10
+ }
11
+ export declare class Document<M = unknown> {
12
+ readonly sections: ReadonlyArray<Section>;
13
+ readonly metadata: M | undefined;
14
+ readonly narrationPace: NarrationPace;
15
+ constructor(props: DocumentProps<M>);
16
+ getSegments(): Segment[];
17
+ getWords(): Word[];
18
+ getLines(): Line[];
19
+ getText(): string;
20
+ with(changes: Partial<DocumentProps<M>>): Document<M>;
21
+ /**
22
+ * Builds a new Document with the given segments wrapped in a single
23
+ * Section with an empty kind. Callers that need to preserve a
24
+ * multi-Section topology should use `with({ sections })` instead.
25
+ */
26
+ withSegments(segments: ReadonlyArray<Segment>): Document<M>;
27
+ withMetadata<N>(metadata: N): Document<N>;
28
+ /**
29
+ * Returns every segment whose time window contains `currentTime`,
30
+ * sorted by start time (then by end time, then by document order).
31
+ * When segments overlap in time this can yield more than one;
32
+ * non-overlapping content degenerates to a 0/1-length array. The sort
33
+ * is stable across frames so consumers can derive cache keys from the
34
+ * order.
35
+ *
36
+ * The interval is half-open `[start, end)` — see TimeFragment. At a
37
+ * shared boundary `segA.end === segB.start`, only `segB` is active.
38
+ */
39
+ getActiveSegments(currentTime: number): Segment[];
40
+ /** Mirrors {@link getActiveSegments} at the section level. */
41
+ getActiveSections(currentTime: number): Section[];
42
+ }
43
+ //# sourceMappingURL=Document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Document.d.ts","sourceRoot":"","sources":["../../../src/modules/document/Document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;CACpD;AAED,qBAAa,QAAQ,CAAC,CAAC,GAAG,OAAO;IAC/B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;gBAE1B,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IASnC,WAAW,IAAI,OAAO,EAAE;IAIxB,QAAQ,IAAI,IAAI,EAAE;IAIlB,QAAQ,IAAI,IAAI,EAAE;IAIlB,OAAO,IAAI,MAAM;IAIjB,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;IASrD;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;IAO3D,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;IAIzC;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE;IAiBjD,8DAA8D;IAC9D,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE;CAKlD"}
@@ -0,0 +1,86 @@
1
+ import { Section } from '../document/Section';
2
+ import { NarrationPace } from '../document/NarrationPace';
3
+ export class Document {
4
+ sections;
5
+ metadata;
6
+ narrationPace;
7
+ constructor(props) {
8
+ this.sections = props.sections;
9
+ this.metadata = props.metadata;
10
+ this.narrationPace = props.narrationPace ?? NarrationPace.empty();
11
+ for (const section of this.sections) {
12
+ section.setParent(this);
13
+ }
14
+ }
15
+ getSegments() {
16
+ return this.sections.flatMap((section) => [...section.segments]);
17
+ }
18
+ getWords() {
19
+ return this.sections.flatMap((section) => section.getWords());
20
+ }
21
+ getLines() {
22
+ return this.sections.flatMap((section) => section.getLines());
23
+ }
24
+ getText() {
25
+ return this.sections.map((section) => section.getText()).join(' ');
26
+ }
27
+ with(changes) {
28
+ return new Document({
29
+ sections: this.sections,
30
+ metadata: this.metadata,
31
+ narrationPace: this.narrationPace,
32
+ ...changes,
33
+ });
34
+ }
35
+ /**
36
+ * Builds a new Document with the given segments wrapped in a single
37
+ * Section with an empty kind. Callers that need to preserve a
38
+ * multi-Section topology should use `with({ sections })` instead.
39
+ */
40
+ withSegments(segments) {
41
+ return new Document({
42
+ sections: [new Section({ segments, kind: '' })],
43
+ metadata: this.metadata,
44
+ });
45
+ }
46
+ withMetadata(metadata) {
47
+ return new Document({ sections: this.sections, metadata });
48
+ }
49
+ /**
50
+ * Returns every segment whose time window contains `currentTime`,
51
+ * sorted by start time (then by end time, then by document order).
52
+ * When segments overlap in time this can yield more than one;
53
+ * non-overlapping content degenerates to a 0/1-length array. The sort
54
+ * is stable across frames so consumers can derive cache keys from the
55
+ * order.
56
+ *
57
+ * The interval is half-open `[start, end)` — see TimeFragment. At a
58
+ * shared boundary `segA.end === segB.start`, only `segB` is active.
59
+ */
60
+ getActiveSegments(currentTime) {
61
+ const flat = this.getSegments();
62
+ const active = [];
63
+ for (let i = 0; i < flat.length; i++) {
64
+ const seg = flat[i];
65
+ if (seg.time.contains(currentTime))
66
+ active.push({ seg, flatIdx: i });
67
+ }
68
+ active.sort((a, b) => {
69
+ const ds = a.seg.time.start - b.seg.time.start;
70
+ if (ds !== 0)
71
+ return ds;
72
+ const de = a.seg.time.end - b.seg.time.end;
73
+ if (de !== 0)
74
+ return de;
75
+ return a.flatIdx - b.flatIdx;
76
+ });
77
+ return active.map((e) => e.seg);
78
+ }
79
+ /** Mirrors {@link getActiveSegments} at the section level. */
80
+ getActiveSections(currentTime) {
81
+ return this.sections
82
+ .filter((section) => section.time.contains(currentTime))
83
+ .sort((a, b) => a.time.start - b.time.start || a.time.end - b.time.end);
84
+ }
85
+ }
86
+ //# sourceMappingURL=Document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Document.js","sourceRoot":"","sources":["../../../src/modules/document/Document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIpD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAQhE,MAAM,OAAO,QAAQ;IACV,QAAQ,CAAyB;IACjC,QAAQ,CAAgB;IACxB,aAAa,CAAgB;IAEtC,YAAY,KAAuB;QACjC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IA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EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,8DAA8D;IAC9D,iBAAiB,CAAC,WAAmB;QACnC,OAAO,IAAI,CAAC,QAAQ;aACjB,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;aACvD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5E,CAAC;CACF"}
@@ -0,0 +1,111 @@
1
+ import { Document } from '../document/Document';
2
+ import { Segment } from '../document/Segment';
3
+ import { Word } from '../document/Word';
4
+ import { TimeFragment } from '../document/TimeFragment';
5
+ export interface WordPosition {
6
+ segIdx: number;
7
+ lineIdx: number;
8
+ wordIdx: number;
9
+ }
10
+ /**
11
+ * Pure mutation helpers over Document. All operations preserve Section
12
+ * identity: a manual edit doesn't collapse a multi-Section document into
13
+ * a single Section. A Section that ends up with zero segments is dropped.
14
+ *
15
+ * Cross-section operations (e.g., merging two segments owned by different
16
+ * Sections) keep the result in the FIRST involved Section — the earlier
17
+ * segment's `kind` wins.
18
+ */
19
+ export declare class DocumentEditor {
20
+ findWordById(doc: Document, id: string): WordPosition | null;
21
+ computeWordTextSplit(word: Word, rawText: string): Word[];
22
+ replaceWordAt(doc: Document, segIdx: number, lineIdx: number, wordIdx: number, newWords: Word[]): Document;
23
+ insertWordAfter(doc: Document, segIdx: number, lineIdx: number, wordIdx: number): {
24
+ doc: Document;
25
+ wordId: string;
26
+ };
27
+ /**
28
+ * Inserts a fresh empty Segment adjacent to the anchor at `segIdx`. The
29
+ * new segment lands as a sibling in the same Section (same `kind`, same
30
+ * Section identity). The caller is expected to focus the returned
31
+ * `wordId` so the user can type immediately. If `time` is omitted the
32
+ * new segment clones the anchor's time — callers that want the first
33
+ * keystrokes to claim real duration should pass an explicit window.
34
+ */
35
+ insertSegmentAt(doc: Document, segIdx: number, position: 'before' | 'after', time?: TimeFragment): {
36
+ doc: Document;
37
+ wordId: string;
38
+ segmentId: string;
39
+ };
40
+ updateWordTime(doc: Document, segIdx: number, lineIdx: number, wordIdx: number, start: number, end: number): Document;
41
+ deleteWord(doc: Document, segIdx: number, lineIdx: number, wordIdx: number): Document;
42
+ splitLineAfterWord(doc: Document, segIdx: number, lineIdx: number, wordIdx: number): Document;
43
+ mergeLineWithNext(doc: Document, segIdx: number, lineIdx: number): Document;
44
+ deleteLine(doc: Document, segIdx: number, lineIdx: number): Document;
45
+ splitSegmentAfterLine(doc: Document, segIdx: number, lineIdx: number): Document;
46
+ mergeSegmentWithNext(doc: Document, segIdx: number): Document;
47
+ moveFirstWordToPrevLine(doc: Document, segIdx: number, lineIdx: number): Document;
48
+ moveLastWordToNextLine(doc: Document, segIdx: number, lineIdx: number): Document;
49
+ moveFirstWordToPrevSegment(doc: Document, segIdx: number): Document;
50
+ moveLastWordToNextSegment(doc: Document, segIdx: number): Document;
51
+ moveLineToSegment(doc: Document, fromSegIdx: number, fromLineIdx: number, toSegIdx: number, toLineIdx: number): Document;
52
+ /**
53
+ * Replaces the entire content of a segment with words derived from
54
+ * `rawText`. `\n` separates lines, whitespace runs separate words.
55
+ * The segment's start/end time is preserved verbatim — durations are
56
+ * redistributed across the new words by character length, and the last
57
+ * word ends exactly at the segment's end (clamped to absorb rounding).
58
+ *
59
+ * Edge cases:
60
+ * - Empty input (no actual words) → keeps the segment alive with a
61
+ * single empty Word holding the full segment time. The segment
62
+ * renders nothing but its time slot persists.
63
+ * - All structureTags (segment, line, word) are dropped: simple-view
64
+ * text edits don't carry any of the splitter's structure metadata,
65
+ * and the surrounding action will lock auto-layout anyway.
66
+ * - All ids are regenerated. wordStyleOverrides for words in this
67
+ * segment go stale (no longer reachable by id) — accepted by design
68
+ * for the simple/mobile view.
69
+ */
70
+ replaceSegmentText(doc: Document, segIdx: number, rawText: string): Document;
71
+ deleteSegment(doc: Document, segIdx: number): Document;
72
+ /**
73
+ * Replaces every Section whose `kind === fromKind` with a copy whose
74
+ * `kind === toKind`, then collapses adjacent same-kind Sections. The
75
+ * resulting Document carries fewer (or equal) Sections; segment order
76
+ * is preserved.
77
+ */
78
+ remapKind(doc: Document, fromKind: string, toKind: string): Document;
79
+ private _mergeAdjacent;
80
+ /**
81
+ * Replaces a single segment with a list of new segments, all lifted into
82
+ * a fresh Section with the given `kind`. Slots in the original Section
83
+ * after the target are reparented to a clone of the original Section
84
+ * (with a new id) so id-uniqueness holds when `_rebuild` reassembles
85
+ * and applies the adjacent-same-kind merge invariant.
86
+ */
87
+ replaceSegmentWithKind(doc: Document, segmentId: string, newSegments: ReadonlyArray<Segment>, newKind: string): Document;
88
+ private _replaceWords;
89
+ private _replaceLine;
90
+ /**
91
+ * Rebuilds a segment with a new set of lines and clears any `customTime`
92
+ * the segment was carrying. `customTime` overrides the segment's time
93
+ * window with a value chosen against the previous word composition;
94
+ * once the words change that value no longer reflects the segment's
95
+ * actual range, so it falls back to the natural, word-derived time.
96
+ */
97
+ private _withLines;
98
+ private _replaceSegmentSlot;
99
+ private _flatten;
100
+ /**
101
+ * Reassembles slots into Sections in two passes:
102
+ * 1. Group consecutive same-Section slots, preserving each Section's
103
+ * id + structureTags.
104
+ * 2. Apply the merge invariant: adjacent Sections sharing a `kind`
105
+ * collapse into a single Section (the first one's identity wins).
106
+ *
107
+ * Sections whose every segment was removed are dropped.
108
+ */
109
+ private _rebuild;
110
+ }
111
+ //# sourceMappingURL=DocumentEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentEditor.d.ts","sourceRoot":"","sources":["../../../src/modules/document/DocumentEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,OAA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