@tscaps/engine 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -10
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/bidi/BidiAnalyzer.d.ts +23 -0
- package/dist/modules/bidi/BidiAnalyzer.d.ts.map +1 -0
- package/dist/modules/bidi/BidiAnalyzer.js +2 -0
- package/dist/modules/bidi/BidiAnalyzer.js.map +1 -0
- package/dist/modules/bidi/BidiCharacterClassifier.d.ts +13 -0
- package/dist/modules/bidi/BidiCharacterClassifier.d.ts.map +1 -0
- package/dist/modules/bidi/BidiCharacterClassifier.js +2 -0
- package/dist/modules/bidi/BidiCharacterClassifier.js.map +1 -0
- package/dist/modules/bidi/BidiJsAnalyzer.d.ts +14 -0
- package/dist/modules/bidi/BidiJsAnalyzer.d.ts.map +1 -0
- package/dist/modules/bidi/BidiJsAnalyzer.js +19 -0
- package/dist/modules/bidi/BidiJsAnalyzer.js.map +1 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.d.ts +8 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.d.ts.map +1 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.js +19 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.js.map +1 -0
- package/dist/modules/bidi/CursiveScriptDetector.d.ts +12 -0
- package/dist/modules/bidi/CursiveScriptDetector.d.ts.map +1 -0
- package/dist/modules/bidi/CursiveScriptDetector.js +20 -0
- package/dist/modules/bidi/CursiveScriptDetector.js.map +1 -0
- package/dist/modules/bidi/HorizontalSide.d.ts +18 -0
- package/dist/modules/bidi/HorizontalSide.d.ts.map +1 -0
- package/dist/modules/bidi/HorizontalSide.js +3 -0
- package/dist/modules/bidi/HorizontalSide.js.map +1 -0
- package/dist/modules/bidi/HorizontalSideResolver.d.ts +21 -0
- package/dist/modules/bidi/HorizontalSideResolver.d.ts.map +1 -0
- package/dist/modules/bidi/HorizontalSideResolver.js +27 -0
- package/dist/modules/bidi/HorizontalSideResolver.js.map +1 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.d.ts +24 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.d.ts.map +1 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.js +34 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.js.map +1 -0
- package/dist/modules/bidi/TextDirection.d.ts +9 -0
- package/dist/modules/bidi/TextDirection.d.ts.map +1 -0
- package/dist/modules/bidi/TextDirection.js +2 -0
- package/dist/modules/bidi/TextDirection.js.map +1 -0
- package/dist/modules/bidi/TextDirectionDetector.d.ts +12 -0
- package/dist/modules/bidi/TextDirectionDetector.d.ts.map +1 -0
- package/dist/modules/bidi/TextDirectionDetector.js +2 -0
- package/dist/modules/bidi/TextDirectionDetector.js.map +1 -0
- package/dist/modules/bidi/WordFragment.d.ts +34 -0
- package/dist/modules/bidi/WordFragment.d.ts.map +1 -0
- package/dist/modules/bidi/WordFragment.js +2 -0
- package/dist/modules/bidi/WordFragment.js.map +1 -0
- package/dist/modules/bidi/WordFragmenter.d.ts +43 -0
- package/dist/modules/bidi/WordFragmenter.d.ts.map +1 -0
- package/dist/modules/bidi/WordFragmenter.js +112 -0
- package/dist/modules/bidi/WordFragmenter.js.map +1 -0
- package/dist/modules/bidi/index.d.ts +14 -0
- package/dist/modules/bidi/index.d.ts.map +1 -0
- package/dist/modules/bidi/index.js +8 -0
- package/dist/modules/bidi/index.js.map +1 -0
- package/dist/modules/css/CssBlockSealer.d.ts +30 -0
- package/dist/modules/css/CssBlockSealer.d.ts.map +1 -0
- package/dist/modules/css/CssBlockSealer.js +64 -0
- package/dist/modules/css/CssBlockSealer.js.map +1 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.d.ts +13 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.d.ts.map +1 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.js +24 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.js.map +1 -0
- package/dist/modules/css/CssFilterReferenceScanner.d.ts +15 -0
- package/dist/modules/css/CssFilterReferenceScanner.d.ts.map +1 -0
- package/dist/modules/css/CssFilterReferenceScanner.js +22 -0
- package/dist/modules/css/CssFilterReferenceScanner.js.map +1 -0
- package/dist/modules/css/CssFragmentParser.d.ts +53 -0
- package/dist/modules/css/CssFragmentParser.d.ts.map +1 -0
- package/dist/modules/css/CssFragmentParser.js +127 -0
- package/dist/modules/css/CssFragmentParser.js.map +1 -0
- package/dist/modules/css/CssKeyframeNamespacer.d.ts +21 -0
- package/dist/modules/css/CssKeyframeNamespacer.d.ts.map +1 -0
- package/dist/modules/css/CssKeyframeNamespacer.js +48 -0
- package/dist/modules/css/CssKeyframeNamespacer.js.map +1 -0
- package/dist/modules/css/CssKeyframesScanner.d.ts +29 -0
- package/dist/modules/css/CssKeyframesScanner.d.ts.map +1 -0
- package/dist/modules/css/CssKeyframesScanner.js +102 -0
- package/dist/modules/css/CssKeyframesScanner.js.map +1 -0
- package/dist/modules/css/CssLayer.d.ts +20 -0
- package/dist/modules/css/CssLayer.d.ts.map +1 -0
- package/dist/modules/css/CssLayer.js +21 -0
- package/dist/modules/css/CssLayer.js.map +1 -0
- package/dist/modules/css/CssScoper.d.ts +31 -2
- package/dist/modules/css/CssScoper.d.ts.map +1 -1
- package/dist/modules/css/CssScoper.js +168 -79
- package/dist/modules/css/CssScoper.js.map +1 -1
- package/dist/modules/css/CssSelectorClassScanner.d.ts +25 -0
- package/dist/modules/css/CssSelectorClassScanner.d.ts.map +1 -0
- package/dist/modules/css/CssSelectorClassScanner.js +91 -0
- package/dist/modules/css/CssSelectorClassScanner.js.map +1 -0
- package/dist/modules/css/CssVarReferenceScanner.d.ts +16 -0
- package/dist/modules/css/CssVarReferenceScanner.d.ts.map +1 -0
- package/dist/modules/css/CssVarReferenceScanner.js +27 -0
- package/dist/modules/css/CssVarReferenceScanner.js.map +1 -0
- package/dist/modules/css/index.d.ts +9 -0
- package/dist/modules/css/index.d.ts.map +1 -1
- package/dist/modules/css/index.js +9 -0
- package/dist/modules/css/index.js.map +1 -1
- package/dist/modules/document/CssClass.d.ts +20 -0
- package/dist/modules/document/CssClass.d.ts.map +1 -0
- package/dist/modules/document/CssClass.js +21 -0
- package/dist/modules/document/CssClass.js.map +1 -0
- package/dist/modules/document/CssVariable.d.ts +21 -6
- package/dist/modules/document/CssVariable.d.ts.map +1 -1
- package/dist/modules/document/CssVariable.js +27 -5
- package/dist/modules/document/CssVariable.js.map +1 -1
- package/dist/modules/document/DataAttribute.d.ts +26 -0
- package/dist/modules/document/DataAttribute.d.ts.map +1 -0
- package/dist/modules/document/DataAttribute.js +27 -0
- package/dist/modules/document/DataAttribute.js.map +1 -0
- package/dist/modules/document/Decoration.d.ts +42 -0
- package/dist/modules/document/Decoration.d.ts.map +1 -0
- package/dist/modules/document/Decoration.js +52 -0
- package/dist/modules/document/Decoration.js.map +1 -0
- package/dist/modules/document/Document.d.ts.map +1 -1
- package/dist/modules/document/Document.js +0 -3
- package/dist/modules/document/Document.js.map +1 -1
- package/dist/modules/document/DocumentEditor.d.ts +51 -9
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -1
- package/dist/modules/document/DocumentEditor.js +118 -26
- package/dist/modules/document/DocumentEditor.js.map +1 -1
- package/dist/modules/document/DocumentNodeId.d.ts +23 -0
- package/dist/modules/document/DocumentNodeId.d.ts.map +1 -0
- package/dist/modules/document/DocumentNodeId.js +31 -0
- package/dist/modules/document/DocumentNodeId.js.map +1 -0
- package/dist/modules/document/Line.d.ts +10 -7
- package/dist/modules/document/Line.d.ts.map +1 -1
- package/dist/modules/document/Line.js +13 -25
- package/dist/modules/document/Line.js.map +1 -1
- package/dist/modules/document/Section.d.ts +1 -8
- package/dist/modules/document/Section.d.ts.map +1 -1
- package/dist/modules/document/Section.js +4 -35
- package/dist/modules/document/Section.js.map +1 -1
- package/dist/modules/document/Segment.d.ts +24 -14
- package/dist/modules/document/Segment.d.ts.map +1 -1
- package/dist/modules/document/Segment.js +41 -23
- package/dist/modules/document/Segment.js.map +1 -1
- package/dist/modules/document/Word.d.ts +21 -8
- package/dist/modules/document/Word.d.ts.map +1 -1
- package/dist/modules/document/Word.js +34 -35
- package/dist/modules/document/Word.js.map +1 -1
- package/dist/modules/document/index.d.ts +5 -2
- package/dist/modules/document/index.d.ts.map +1 -1
- package/dist/modules/document/index.js +4 -1
- package/dist/modules/document/index.js.map +1 -1
- package/dist/modules/effect/CarryQuotesEffect.d.ts +1 -7
- package/dist/modules/effect/CarryQuotesEffect.d.ts.map +1 -1
- package/dist/modules/effect/CarryQuotesEffect.js +17 -30
- package/dist/modules/effect/CarryQuotesEffect.js.map +1 -1
- package/dist/modules/effect/GapFreeEffect.d.ts +15 -0
- package/dist/modules/effect/GapFreeEffect.d.ts.map +1 -1
- package/dist/modules/effect/GapFreeEffect.js +29 -4
- package/dist/modules/effect/GapFreeEffect.js.map +1 -1
- package/dist/modules/effect/RemovePunctuationEffect.d.ts +10 -2
- package/dist/modules/effect/RemovePunctuationEffect.d.ts.map +1 -1
- package/dist/modules/effect/RemovePunctuationEffect.js +26 -6
- package/dist/modules/effect/RemovePunctuationEffect.js.map +1 -1
- package/dist/modules/effect/SmartLowercaseEffect.d.ts +7 -6
- package/dist/modules/effect/SmartLowercaseEffect.d.ts.map +1 -1
- package/dist/modules/effect/SmartLowercaseEffect.js +11 -7
- package/dist/modules/effect/SmartLowercaseEffect.js.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +3 -3
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.js +13 -8
- package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +19 -25
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +43 -717
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -1
- package/dist/modules/rendering/HorizontalPlacementResolver.d.ts +27 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.d.ts.map +1 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.js +31 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.js.map +1 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +10 -5
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/index.d.ts +16 -8
- package/dist/modules/rendering/index.d.ts.map +1 -1
- package/dist/modules/rendering/index.js +8 -2
- package/dist/modules/rendering/index.js.map +1 -1
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts +41 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts.map +1 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.js +64 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.js.map +1 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.d.ts +7 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.js +35 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.js.map +1 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.d.ts +28 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.js +28 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.js.map +1 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts +20 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts.map +1 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.js +44 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.js.map +1 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.d.ts +15 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.js +33 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.js.map +1 -0
- package/dist/modules/rendering/{VideoFrameLayerClass.d.ts → styles/VideoFrameLayerBaselineCss.d.ts} +3 -10
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.js +15 -0
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.js.map +1 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts +13 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.js +2 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.js.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts +20 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js +31 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts +21 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js +46 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts +39 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.js +203 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts +15 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js +26 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlan.d.ts +32 -0
- package/dist/modules/rendering/subtitle/BatchPlan.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlan.js +2 -0
- package/dist/modules/rendering/subtitle/BatchPlan.js.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts +32 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.js +93 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.js.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts +36 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.js +2 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.js.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.d.ts +31 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js +91 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.d.ts +13 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.js +24 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.js.map +1 -0
- package/dist/modules/rendering/{SegmentPaintRegionResolver.d.ts → subtitle/SegmentPaintRegionResolver.d.ts} +1 -1
- package/dist/modules/rendering/subtitle/SegmentPaintRegionResolver.d.ts.map +1 -0
- package/dist/modules/rendering/{SegmentPaintRegionResolver.js → subtitle/SegmentPaintRegionResolver.js} +7 -4
- package/dist/modules/rendering/subtitle/SegmentPaintRegionResolver.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.d.ts +45 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.js +50 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts +108 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js +246 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts +40 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js +132 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts +48 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.js +143 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts +17 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js +58 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.d.ts +20 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.js +30 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.js.map +1 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.d.ts +42 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js +121 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js.map +1 -0
- package/dist/modules/rendering/types/AlignmentConfig.d.ts +33 -0
- package/dist/modules/rendering/types/AlignmentConfig.d.ts.map +1 -0
- package/dist/modules/rendering/types/AlignmentConfig.js +3 -0
- package/dist/modules/rendering/types/AlignmentConfig.js.map +1 -0
- package/dist/modules/rendering/types/BoxEdges.d.ts.map +1 -0
- package/dist/modules/rendering/types/BoxEdges.js.map +1 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.d.ts +8 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.d.ts.map +1 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.js +2 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.js.map +1 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts +23 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts.map +1 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.js +52 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.js.map +1 -0
- package/dist/modules/rendering/types/InlineStyleMap.d.ts.map +1 -0
- package/dist/modules/rendering/types/InlineStyleMap.js.map +1 -0
- package/dist/modules/rendering/{RenderingConfig.d.ts → types/RenderingConfig.d.ts} +8 -1
- package/dist/modules/rendering/types/RenderingConfig.d.ts.map +1 -0
- package/dist/modules/rendering/types/RenderingConfig.js.map +1 -0
- package/dist/modules/rendering/types/ScopedRenderOverride.d.ts +24 -0
- package/dist/modules/rendering/types/ScopedRenderOverride.d.ts.map +1 -0
- package/dist/modules/rendering/types/ScopedRenderOverride.js.map +1 -0
- package/dist/modules/rendering/types/VideoFrameSource.d.ts.map +1 -0
- package/dist/modules/rendering/types/VideoFrameSource.js.map +1 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.d.ts +33 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.js +100 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/FixedTailLineSplitter.d.ts +29 -0
- package/dist/modules/splitting/FixedTailLineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/FixedTailLineSplitter.js +43 -0
- package/dist/modules/splitting/FixedTailLineSplitter.js.map +1 -0
- package/dist/modules/splitting/index.d.ts +4 -0
- package/dist/modules/splitting/index.d.ts.map +1 -1
- package/dist/modules/splitting/index.js +2 -0
- package/dist/modules/splitting/index.js.map +1 -1
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.d.ts +53 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.js +133 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.d.ts +20 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.js +31 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.d.ts +21 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.js +33 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCue.d.ts +18 -0
- package/dist/modules/subtitle-file/SubtitleCue.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCue.js +20 -0
- package/dist/modules/subtitle-file/SubtitleCue.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.d.ts +38 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.js +106 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.d.ts +17 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.js +2 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.d.ts +36 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.js +44 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.d.ts +11 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.js +2 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleRow.d.ts +11 -0
- package/dist/modules/subtitle-file/SubtitleRow.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleRow.js +14 -0
- package/dist/modules/subtitle-file/SubtitleRow.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleToken.d.ts +13 -0
- package/dist/modules/subtitle-file/SubtitleToken.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleToken.js +15 -0
- package/dist/modules/subtitle-file/SubtitleToken.js.map +1 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.d.ts +19 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.js +24 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/Timecode.d.ts +20 -0
- package/dist/modules/subtitle-file/Timecode.d.ts.map +1 -0
- package/dist/modules/subtitle-file/Timecode.js +32 -0
- package/dist/modules/subtitle-file/Timecode.js.map +1 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.d.ts +22 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.js +57 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.d.ts +21 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.js +39 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/index.d.ts +10 -0
- package/dist/modules/subtitle-file/index.d.ts.map +1 -0
- package/dist/modules/subtitle-file/index.js +8 -0
- package/dist/modules/subtitle-file/index.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts +8 -1
- package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilter.js +9 -1
- package/dist/modules/svg-filter/SvgFilter.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js +9 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.d.ts +44 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.js +47 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.js.map +1 -0
- package/dist/modules/svg-filter/index.d.ts +2 -0
- package/dist/modules/svg-filter/index.d.ts.map +1 -1
- package/dist/modules/svg-filter/index.js +1 -0
- package/dist/modules/svg-filter/index.js.map +1 -1
- package/dist/modules/tagging/PauseTagger.d.ts +24 -0
- package/dist/modules/tagging/PauseTagger.d.ts.map +1 -0
- package/dist/modules/tagging/PauseTagger.js +42 -0
- package/dist/modules/tagging/PauseTagger.js.map +1 -0
- package/dist/modules/tagging/RegexTagger.js +1 -1
- package/dist/modules/tagging/RegexTagger.js.map +1 -1
- package/dist/modules/tagging/SpanTagger.js +1 -1
- package/dist/modules/tagging/SpanTagger.js.map +1 -1
- package/dist/modules/tagging/StructureTagger.d.ts +1 -2
- package/dist/modules/tagging/StructureTagger.d.ts.map +1 -1
- package/dist/modules/tagging/StructureTagger.js +12 -11
- package/dist/modules/tagging/StructureTagger.js.map +1 -1
- package/dist/modules/tagging/WordlistTagger.js +1 -1
- package/dist/modules/tagging/WordlistTagger.js.map +1 -1
- package/dist/modules/tagging/index.d.ts +2 -0
- package/dist/modules/tagging/index.d.ts.map +1 -1
- package/dist/modules/tagging/index.js +1 -0
- package/dist/modules/tagging/index.js.map +1 -1
- package/dist/modules/tags/AndTagCondition.d.ts +10 -0
- package/dist/modules/tags/AndTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/AndTagCondition.js +14 -0
- package/dist/modules/tags/AndTagCondition.js.map +1 -0
- package/dist/modules/tags/HasTagCondition.d.ts +10 -0
- package/dist/modules/tags/HasTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/HasTagCondition.js +18 -0
- package/dist/modules/tags/HasTagCondition.js.map +1 -0
- package/dist/modules/tags/NotTagCondition.d.ts +10 -0
- package/dist/modules/tags/NotTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/NotTagCondition.js +14 -0
- package/dist/modules/tags/NotTagCondition.js.map +1 -0
- package/dist/modules/tags/OrTagCondition.d.ts +10 -0
- package/dist/modules/tags/OrTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/OrTagCondition.js +14 -0
- package/dist/modules/tags/OrTagCondition.js.map +1 -0
- package/dist/modules/{document/Tag.d.ts → tags/StructureTag.d.ts} +4 -10
- package/dist/modules/tags/StructureTag.d.ts.map +1 -0
- package/dist/modules/{document/Tag.js → tags/StructureTag.js} +4 -19
- package/dist/modules/tags/StructureTag.js.map +1 -0
- package/dist/modules/tags/Tag.d.ts +8 -0
- package/dist/modules/tags/Tag.d.ts.map +1 -0
- package/dist/modules/tags/Tag.js +16 -0
- package/dist/modules/tags/Tag.js.map +1 -0
- package/dist/modules/tags/TagCondition.d.ts +12 -0
- package/dist/modules/tags/TagCondition.d.ts.map +1 -0
- package/dist/modules/tags/TagCondition.js +2 -0
- package/dist/modules/tags/TagCondition.js.map +1 -0
- package/dist/modules/tags/TagConditionParser.d.ts +21 -0
- package/dist/modules/tags/TagConditionParser.d.ts.map +1 -0
- package/dist/modules/tags/TagConditionParser.js +75 -0
- package/dist/modules/tags/TagConditionParser.js.map +1 -0
- package/dist/modules/tags/index.d.ts +9 -0
- package/dist/modules/tags/index.d.ts.map +1 -0
- package/dist/modules/tags/index.js +8 -0
- package/dist/modules/tags/index.js.map +1 -0
- package/dist/modules/transcription/AudioDecoder.d.ts +9 -4
- package/dist/modules/transcription/AudioDecoder.d.ts.map +1 -1
- package/dist/modules/transcription/BatchedMonoResampler.d.ts +45 -0
- package/dist/modules/transcription/BatchedMonoResampler.d.ts.map +1 -0
- package/dist/modules/transcription/BatchedMonoResampler.js +116 -0
- package/dist/modules/transcription/BatchedMonoResampler.js.map +1 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.d.ts +38 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.d.ts.map +1 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.js +86 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.js.map +1 -0
- package/dist/modules/transcription/CueDocumentBuilder.d.ts +40 -0
- package/dist/modules/transcription/CueDocumentBuilder.d.ts.map +1 -0
- package/dist/modules/transcription/CueDocumentBuilder.js +77 -0
- package/dist/modules/transcription/CueDocumentBuilder.js.map +1 -0
- package/dist/modules/transcription/CueParseResult.d.ts +16 -0
- package/dist/modules/transcription/CueParseResult.d.ts.map +1 -0
- package/dist/modules/transcription/CueParseResult.js +2 -0
- package/dist/modules/transcription/CueParseResult.js.map +1 -0
- package/dist/modules/transcription/CueTextTokenizer.d.ts +10 -0
- package/dist/modules/transcription/CueTextTokenizer.d.ts.map +1 -0
- package/dist/modules/transcription/CueTextTokenizer.js +21 -0
- package/dist/modules/transcription/CueTextTokenizer.js.map +1 -0
- package/dist/modules/transcription/CueTimecodeReader.d.ts +19 -0
- package/dist/modules/transcription/CueTimecodeReader.d.ts.map +1 -0
- package/dist/modules/transcription/CueTimecodeReader.js +45 -0
- package/dist/modules/transcription/CueTimecodeReader.js.map +1 -0
- package/dist/modules/transcription/CueWordReader.d.ts +12 -0
- package/dist/modules/transcription/CueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/CueWordReader.js +2 -0
- package/dist/modules/transcription/CueWordReader.js.map +1 -0
- package/dist/modules/transcription/EstimatedCueWordReader.d.ts +16 -0
- package/dist/modules/transcription/EstimatedCueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/EstimatedCueWordReader.js +17 -0
- package/dist/modules/transcription/EstimatedCueWordReader.js.map +1 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.d.ts +43 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.d.ts.map +1 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.js +72 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.js.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.d.ts +27 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.js +76 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/ModelFileCache.d.ts +20 -0
- package/dist/modules/transcription/ModelFileCache.d.ts.map +1 -0
- package/dist/modules/transcription/ModelFileCache.js +2 -0
- package/dist/modules/transcription/ModelFileCache.js.map +1 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.d.ts +18 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.d.ts.map +1 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.js +18 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.js.map +1 -0
- package/dist/modules/transcription/SrtTranscriber.d.ts +24 -15
- package/dist/modules/transcription/SrtTranscriber.d.ts.map +1 -1
- package/dist/modules/transcription/SrtTranscriber.js +32 -90
- package/dist/modules/transcription/SrtTranscriber.js.map +1 -1
- package/dist/modules/transcription/SubtitleFileUnreadableError.d.ts +22 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.d.ts.map +1 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.js +22 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.js.map +1 -0
- package/dist/modules/transcription/TimestampedCueWordReader.d.ts +27 -0
- package/dist/modules/transcription/TimestampedCueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/TimestampedCueWordReader.js +52 -0
- package/dist/modules/transcription/TimestampedCueWordReader.js.map +1 -0
- package/dist/modules/transcription/Transcriber.d.ts +13 -0
- package/dist/modules/transcription/Transcriber.d.ts.map +1 -1
- package/dist/modules/transcription/TransformersRuntime.d.ts +50 -0
- package/dist/modules/transcription/TransformersRuntime.d.ts.map +1 -0
- package/dist/modules/transcription/TransformersRuntime.js +79 -0
- package/dist/modules/transcription/TransformersRuntime.js.map +1 -0
- package/dist/modules/transcription/VttTranscriber.d.ts +46 -0
- package/dist/modules/transcription/VttTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/VttTranscriber.js +80 -0
- package/dist/modules/transcription/VttTranscriber.js.map +1 -0
- package/dist/modules/transcription/WhisperChunkStitcher.d.ts +51 -0
- package/dist/modules/transcription/WhisperChunkStitcher.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperChunkStitcher.js +101 -0
- package/dist/modules/transcription/WhisperChunkStitcher.js.map +1 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.d.ts +16 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.js +16 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.js.map +1 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.d.ts +16 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.js +16 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.js.map +1 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.d.ts +61 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.js +102 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.js.map +1 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.d.ts +38 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.js +94 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.js.map +1 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.d.ts +15 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.js +15 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.js.map +1 -0
- package/dist/modules/transcription/WhisperTranscriber.d.ts +106 -7
- package/dist/modules/transcription/WhisperTranscriber.d.ts.map +1 -1
- package/dist/modules/transcription/WhisperTranscriber.js +312 -25
- package/dist/modules/transcription/WhisperTranscriber.js.map +1 -1
- package/dist/modules/transcription/WhisperWindowCoverage.d.ts +79 -0
- package/dist/modules/transcription/WhisperWindowCoverage.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperWindowCoverage.js +129 -0
- package/dist/modules/transcription/WhisperWindowCoverage.js.map +1 -0
- package/dist/modules/transcription/WordTimingEstimator.d.ts +14 -0
- package/dist/modules/transcription/WordTimingEstimator.d.ts.map +1 -0
- package/dist/modules/transcription/WordTimingEstimator.js +33 -0
- package/dist/modules/transcription/WordTimingEstimator.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +9 -2
- package/dist/modules/transcription/index.d.ts.map +1 -1
- package/dist/modules/transcription/index.js +6 -1
- package/dist/modules/transcription/index.js.map +1 -1
- package/dist/modules/video/RenderJob.d.ts +17 -0
- package/dist/modules/video/RenderJob.d.ts.map +1 -1
- package/dist/modules/video/RenderTimeMap.d.ts +50 -0
- package/dist/modules/video/RenderTimeMap.d.ts.map +1 -0
- package/dist/modules/video/RenderTimeMap.js +90 -0
- package/dist/modules/video/RenderTimeMap.js.map +1 -0
- package/dist/modules/video/index.d.ts +8 -1
- package/dist/modules/video/index.d.ts.map +1 -1
- package/dist/modules/video/index.js +4 -0
- package/dist/modules/video/index.js.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts +102 -0
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js +207 -0
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts +12 -52
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +25 -190
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -1
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts +7 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js +2 -2
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js.map +1 -1
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts +2 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js +8 -2
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js.map +1 -1
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts +3 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js +9 -2
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js.map +1 -1
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts +7 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +4 -2
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +33 -23
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +1 -1
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts +9 -2
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts +5 -2
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js +8 -2
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js.map +1 -1
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts +35 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js +69 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.d.ts +23 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.js +23 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts +46 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.js +2 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.d.ts +24 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.js +2 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.js.map +1 -0
- package/package.json +13 -10
- package/dist/modules/document/Tag.d.ts.map +0 -1
- package/dist/modules/document/Tag.js.map +0 -1
- package/dist/modules/rendering/AlignmentConfig.d.ts +0 -21
- package/dist/modules/rendering/AlignmentConfig.d.ts.map +0 -1
- package/dist/modules/rendering/AlignmentConfig.js +0 -2
- package/dist/modules/rendering/AlignmentConfig.js.map +0 -1
- package/dist/modules/rendering/BoxEdges.d.ts.map +0 -1
- package/dist/modules/rendering/BoxEdges.js.map +0 -1
- package/dist/modules/rendering/ElementRenderOverrides.d.ts +0 -15
- package/dist/modules/rendering/ElementRenderOverrides.d.ts.map +0 -1
- package/dist/modules/rendering/ElementRenderOverrides.js +0 -24
- package/dist/modules/rendering/ElementRenderOverrides.js.map +0 -1
- package/dist/modules/rendering/InlineStyleMap.d.ts.map +0 -1
- package/dist/modules/rendering/InlineStyleMap.js.map +0 -1
- package/dist/modules/rendering/RenderingConfig.d.ts.map +0 -1
- package/dist/modules/rendering/RenderingConfig.js.map +0 -1
- package/dist/modules/rendering/ScopedRenderOverride.d.ts +0 -19
- package/dist/modules/rendering/ScopedRenderOverride.d.ts.map +0 -1
- package/dist/modules/rendering/ScopedRenderOverride.js.map +0 -1
- package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts.map +0 -1
- package/dist/modules/rendering/SegmentPaintRegionResolver.js.map +0 -1
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts +0 -58
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts.map +0 -1
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js +0 -132
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js.map +0 -1
- package/dist/modules/rendering/VideoFrameLayerClass.d.ts.map +0 -1
- package/dist/modules/rendering/VideoFrameLayerClass.js +0 -21
- package/dist/modules/rendering/VideoFrameLayerClass.js.map +0 -1
- package/dist/modules/rendering/VideoFrameSource.d.ts.map +0 -1
- package/dist/modules/rendering/VideoFrameSource.js.map +0 -1
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts +0 -13
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts.map +0 -1
- package/dist/modules/transcription/BrowserAudioDecoder.js +0 -34
- package/dist/modules/transcription/BrowserAudioDecoder.js.map +0 -1
- /package/dist/modules/rendering/{BoxEdges.d.ts → types/BoxEdges.d.ts} +0 -0
- /package/dist/modules/rendering/{BoxEdges.js → types/BoxEdges.js} +0 -0
- /package/dist/modules/rendering/{InlineStyleMap.d.ts → types/InlineStyleMap.d.ts} +0 -0
- /package/dist/modules/rendering/{InlineStyleMap.js → types/InlineStyleMap.js} +0 -0
- /package/dist/modules/rendering/{RenderingConfig.js → types/RenderingConfig.js} +0 -0
- /package/dist/modules/rendering/{ScopedRenderOverride.js → types/ScopedRenderOverride.js} +0 -0
- /package/dist/modules/rendering/{VideoFrameSource.d.ts → types/VideoFrameSource.d.ts} +0 -0
- /package/dist/modules/rendering/{VideoFrameSource.js → types/VideoFrameSource.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimestampedCueWordReader.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/TimestampedCueWordReader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAYtF;;;;;;;;;;;GAWG;AACH,qBAAa,wBAAyB,YAAW,aAAa;IAE1D,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAFT,SAAS,EAAE,gBAAgB,EAC3B,cAAc,EAAE,iBAAiB,EACjC,SAAS,EAAE,mBAAmB;IAGjD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC;IAWjF,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** A cue timestamp: a position on its own inside the cue's text. */
|
|
2
|
+
const CUE_TIMESTAMP = /<(?:\d{1,3}:)?\d{2}:\d{2}[.,]\d{1,3}>/g;
|
|
3
|
+
/**
|
|
4
|
+
* Reads a cue from a format that can mark, inside the cue's own text,
|
|
5
|
+
* when a word is spoken — WebVTT does this so a caption can be revealed
|
|
6
|
+
* word by word without being broken into an entry per word.
|
|
7
|
+
*
|
|
8
|
+
* Each mark cuts the cue into a stretch that runs until the next mark,
|
|
9
|
+
* and the words of a stretch share it out between them. A mark before
|
|
10
|
+
* every word therefore yields the timing the file recorded; a mark
|
|
11
|
+
* every few words yields those, with the words between them estimated.
|
|
12
|
+
* A cue carrying no marks at all is one stretch, which is the same
|
|
13
|
+
* answer a format without marks would give.
|
|
14
|
+
*/
|
|
15
|
+
export class TimestampedCueWordReader {
|
|
16
|
+
tokenizer;
|
|
17
|
+
timecodeReader;
|
|
18
|
+
estimator;
|
|
19
|
+
constructor(tokenizer, timecodeReader, estimator) {
|
|
20
|
+
this.tokenizer = tokenizer;
|
|
21
|
+
this.timecodeReader = timecodeReader;
|
|
22
|
+
this.estimator = estimator;
|
|
23
|
+
}
|
|
24
|
+
read(text, startSeconds, endSeconds) {
|
|
25
|
+
return this.cutIntoStretches(text, startSeconds, endSeconds)
|
|
26
|
+
.flatMap((stretch) => [
|
|
27
|
+
...this.estimator.spread(this.tokenizer.tokenize(stretch.text), stretch.startSeconds, stretch.endSeconds),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
cutIntoStretches(text, startSeconds, endSeconds) {
|
|
31
|
+
const stretches = [];
|
|
32
|
+
let textFrom = 0;
|
|
33
|
+
let stretchStart = startSeconds;
|
|
34
|
+
for (const mark of text.matchAll(CUE_TIMESTAMP)) {
|
|
35
|
+
const markAt = this.positionOf(mark[0]);
|
|
36
|
+
const markFrom = mark.index ?? 0;
|
|
37
|
+
stretches.push({
|
|
38
|
+
text: text.slice(textFrom, markFrom),
|
|
39
|
+
startSeconds: stretchStart,
|
|
40
|
+
endSeconds: markAt,
|
|
41
|
+
});
|
|
42
|
+
textFrom = markFrom + mark[0].length;
|
|
43
|
+
stretchStart = markAt;
|
|
44
|
+
}
|
|
45
|
+
stretches.push({ text: text.slice(textFrom), startSeconds: stretchStart, endSeconds });
|
|
46
|
+
return stretches;
|
|
47
|
+
}
|
|
48
|
+
positionOf(mark) {
|
|
49
|
+
return this.timecodeReader.readPosition(mark.slice(1, -1));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=TimestampedCueWordReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AAY;gBAC1B,UAAU,EAAE,MAAM;aACnB,CAAC,CAAC;YACH,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACrC,YAAY,GAAG,MAAM,CAAC;QACxB,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;QACvF,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -16,8 +16,21 @@ export type TranscriberProgressEvent = {
|
|
|
16
16
|
stage: 'inferring';
|
|
17
17
|
progress?: number;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* An audio region, in absolute seconds, that transcription deliberately
|
|
21
|
+
* left empty because decoding produced no trustworthy output for it.
|
|
22
|
+
*/
|
|
23
|
+
export interface UntranscribedRegion {
|
|
24
|
+
startSeconds: number;
|
|
25
|
+
endSeconds: number;
|
|
26
|
+
}
|
|
19
27
|
export interface Transcriber {
|
|
20
28
|
onProgress?: (event: TranscriberProgressEvent) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Fired at most once per region, before `transcribe` resolves.
|
|
31
|
+
* Implementations that always cover the full audio never fire it.
|
|
32
|
+
*/
|
|
33
|
+
onUntranscribedRegion?: (region: UntranscribedRegion) => void;
|
|
21
34
|
transcribe(audio: Blob, options?: TranscriberOptions): Promise<Document>;
|
|
22
35
|
}
|
|
23
36
|
//# sourceMappingURL=Transcriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transcriber.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/Transcriber.ts"],"names":[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B,KAAK,IAAI,CAAC;IAC9D,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC1E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type * as Transformers from '@huggingface/transformers';
|
|
2
|
+
import type { ModelFileCache } from '../transcription/ModelFileCache';
|
|
3
|
+
/**
|
|
4
|
+
* The inference library, loaded on first use and configured once.
|
|
5
|
+
*
|
|
6
|
+
* It is reached through a dynamic import because a static one makes the
|
|
7
|
+
* whole ONNX runtime a dependency of merely *naming* a transcriber: the
|
|
8
|
+
* package's entry point re-exports this module, so a consumer that
|
|
9
|
+
* imports a document node pulls the runtime with it. In a browser that
|
|
10
|
+
* is a large bundle nobody asked for; in Node it is a native binding
|
|
11
|
+
* loaded — and on musl, failed — for code that never runs inference.
|
|
12
|
+
*
|
|
13
|
+
* The environment settings live here rather than at the call site
|
|
14
|
+
* because they have to be applied before the first pipeline is built and
|
|
15
|
+
* exactly once. Holding the module and the settings together is what
|
|
16
|
+
* makes "loaded" and "configured" the same event.
|
|
17
|
+
*
|
|
18
|
+
* A failed load is not cached: the import can fail on a dead network the
|
|
19
|
+
* same way the weights can, and a caller retrying deserves to reach the
|
|
20
|
+
* network again.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TransformersRuntime {
|
|
23
|
+
private readonly modelFileCache?;
|
|
24
|
+
private modulePromise;
|
|
25
|
+
constructor(modelFileCache?: ModelFileCache | undefined);
|
|
26
|
+
/**
|
|
27
|
+
* Resolves with the library, configured. Concurrent callers share one
|
|
28
|
+
* load, and the settings are applied before any of them sees it.
|
|
29
|
+
*/
|
|
30
|
+
load(): Promise<typeof Transformers>;
|
|
31
|
+
private configure;
|
|
32
|
+
/**
|
|
33
|
+
* Takes over where the downloaded model files are kept.
|
|
34
|
+
*
|
|
35
|
+
* Left to itself the library picks a store from the environment and
|
|
36
|
+
* discards a refused write with nothing but a console warning, so a
|
|
37
|
+
* caller that wants to know when the files did not survive the run
|
|
38
|
+
* has to own the store. Without one, that default stands.
|
|
39
|
+
*/
|
|
40
|
+
private installModelFileCache;
|
|
41
|
+
/**
|
|
42
|
+
* Raises the WASM thread count above ORT's built-in ceiling when the
|
|
43
|
+
* runtime supports it. ORT locks the count to 1 without cross-origin
|
|
44
|
+
* isolation, and even with isolation its own default caps at 4 no matter
|
|
45
|
+
* the machine — Whisper's encoder scales past that. On a WebGPU run this
|
|
46
|
+
* has no effect; the WASM backend is not touched.
|
|
47
|
+
*/
|
|
48
|
+
private configureWasmThreading;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=TransformersRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformersRuntime.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/TransformersRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,mBAAmB;IAGlB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAF5C,OAAO,CAAC,aAAa,CAA6C;gBAErC,cAAc,CAAC,EAAE,cAAc,YAAA;IAE5D;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,OAAO,YAAY,CAAC;IAcpC,OAAO,CAAC,SAAS;IAMjB;;;;;;;OAOG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;CAM/B"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The inference library, loaded on first use and configured once.
|
|
3
|
+
*
|
|
4
|
+
* It is reached through a dynamic import because a static one makes the
|
|
5
|
+
* whole ONNX runtime a dependency of merely *naming* a transcriber: the
|
|
6
|
+
* package's entry point re-exports this module, so a consumer that
|
|
7
|
+
* imports a document node pulls the runtime with it. In a browser that
|
|
8
|
+
* is a large bundle nobody asked for; in Node it is a native binding
|
|
9
|
+
* loaded — and on musl, failed — for code that never runs inference.
|
|
10
|
+
*
|
|
11
|
+
* The environment settings live here rather than at the call site
|
|
12
|
+
* because they have to be applied before the first pipeline is built and
|
|
13
|
+
* exactly once. Holding the module and the settings together is what
|
|
14
|
+
* makes "loaded" and "configured" the same event.
|
|
15
|
+
*
|
|
16
|
+
* A failed load is not cached: the import can fail on a dead network the
|
|
17
|
+
* same way the weights can, and a caller retrying deserves to reach the
|
|
18
|
+
* network again.
|
|
19
|
+
*/
|
|
20
|
+
export class TransformersRuntime {
|
|
21
|
+
modelFileCache;
|
|
22
|
+
modulePromise = null;
|
|
23
|
+
constructor(modelFileCache) {
|
|
24
|
+
this.modelFileCache = modelFileCache;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolves with the library, configured. Concurrent callers share one
|
|
28
|
+
* load, and the settings are applied before any of them sees it.
|
|
29
|
+
*/
|
|
30
|
+
load() {
|
|
31
|
+
if (this.modulePromise === null) {
|
|
32
|
+
const attempt = import('@huggingface/transformers').then((module) => {
|
|
33
|
+
this.configure(module.env);
|
|
34
|
+
return module;
|
|
35
|
+
});
|
|
36
|
+
attempt.catch(() => {
|
|
37
|
+
if (this.modulePromise === attempt)
|
|
38
|
+
this.modulePromise = null;
|
|
39
|
+
});
|
|
40
|
+
this.modulePromise = attempt;
|
|
41
|
+
}
|
|
42
|
+
return this.modulePromise;
|
|
43
|
+
}
|
|
44
|
+
configure(env) {
|
|
45
|
+
env.allowLocalModels = false;
|
|
46
|
+
this.installModelFileCache(env);
|
|
47
|
+
this.configureWasmThreading(env);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Takes over where the downloaded model files are kept.
|
|
51
|
+
*
|
|
52
|
+
* Left to itself the library picks a store from the environment and
|
|
53
|
+
* discards a refused write with nothing but a console warning, so a
|
|
54
|
+
* caller that wants to know when the files did not survive the run
|
|
55
|
+
* has to own the store. Without one, that default stands.
|
|
56
|
+
*/
|
|
57
|
+
installModelFileCache(env) {
|
|
58
|
+
if (!this.modelFileCache)
|
|
59
|
+
return;
|
|
60
|
+
env.useCustomCache = true;
|
|
61
|
+
env.customCache = this.modelFileCache;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Raises the WASM thread count above ORT's built-in ceiling when the
|
|
65
|
+
* runtime supports it. ORT locks the count to 1 without cross-origin
|
|
66
|
+
* isolation, and even with isolation its own default caps at 4 no matter
|
|
67
|
+
* the machine — Whisper's encoder scales past that. On a WebGPU run this
|
|
68
|
+
* has no effect; the WASM backend is not touched.
|
|
69
|
+
*/
|
|
70
|
+
configureWasmThreading(env) {
|
|
71
|
+
if (typeof self === 'undefined' || !self.crossOriginIsolated)
|
|
72
|
+
return;
|
|
73
|
+
const wasm = env.backends.onnx.wasm;
|
|
74
|
+
if (!wasm)
|
|
75
|
+
return;
|
|
76
|
+
wasm.numThreads = Math.min(navigator.hardwareConcurrency || 4, 8);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=TransformersRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformersRuntime.js","sourceRoot":"","sources":["../../../src/modules/transcription/TransformersRuntime.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,mBAAmB;IAGD;IAFrB,aAAa,GAAwC,IAAI,CAAC;IAElE,YAA6B,cAA+B;QAA/B,mBAAc,GAAd,cAAc,CAAiB;IAAG,CAAC;IAEhE;;;OAGG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;gBAClE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC3B,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;gBACjB,IAAI,IAAI,CAAC,aAAa,KAAK,OAAO;oBAAE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAChE,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAEO,SAAS,CAAC,GAA4B;QAC5C,GAAG,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;OAOG;IACK,qBAAqB,CAAC,GAA4B;QACxD,IAAI,CAAC,IAAI,CAAC,cAAc;YAAE,OAAO;QACjC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC;QAC1B,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACK,sBAAsB,CAAC,GAA4B;QACzD,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,mBAAmB;YAAE,OAAO;QACrE,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Document } from '../document/Document';
|
|
2
|
+
import type { Transcriber, TranscriberOptions, TranscriberProgressEvent } from '../transcription/Transcriber';
|
|
3
|
+
/**
|
|
4
|
+
* Builds a Document by parsing a WebVTT (`.vtt`) caption file. Skips
|
|
5
|
+
* the mandatory `WEBVTT` header block and any `NOTE`, `STYLE`, or
|
|
6
|
+
* `REGION` blocks, then reads the cues below them.
|
|
7
|
+
*
|
|
8
|
+
* WebVTT can mark inside a cue when each word is spoken, and those
|
|
9
|
+
* marks are honoured: a file carrying them yields the word timings it
|
|
10
|
+
* recorded rather than a guess. Where a cue carries no marks, its words
|
|
11
|
+
* are shared out across it the way a format without marks requires.
|
|
12
|
+
*
|
|
13
|
+
* The audio Blob passed to `transcribe` is ignored. Useful when
|
|
14
|
+
* caption text and timing are already known — burning a hand-authored
|
|
15
|
+
* VTT into a video, replaying captions from a subtitle-authoring
|
|
16
|
+
* tool, etc.
|
|
17
|
+
*
|
|
18
|
+
* A block that carries no timecode is skipped and announced through
|
|
19
|
+
* `onSkippedCueBlock`, so a single broken cue costs its own text and
|
|
20
|
+
* nothing else. Throws only when the file has blocks and none of them
|
|
21
|
+
* could be read, or when a timecode itself is malformed.
|
|
22
|
+
*
|
|
23
|
+
* Builds its own collaborators rather than receiving them. The
|
|
24
|
+
* constructor is the surface a consumer of the engine reaches for, and
|
|
25
|
+
* it asks for a source and nothing else, so this class is where the
|
|
26
|
+
* parsing side is assembled rather than a participant in someone
|
|
27
|
+
* else's assembly.
|
|
28
|
+
*/
|
|
29
|
+
export declare class VttTranscriber implements Transcriber {
|
|
30
|
+
private readonly source;
|
|
31
|
+
onProgress?: (event: TranscriberProgressEvent) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Fired once per block left out of the document, before
|
|
34
|
+
* `transcribe` resolves, carrying the block verbatim.
|
|
35
|
+
*/
|
|
36
|
+
onSkippedCueBlock?: (block: string) => void;
|
|
37
|
+
private readonly timecodeReader;
|
|
38
|
+
private readonly documentBuilder;
|
|
39
|
+
private readonly wordReader;
|
|
40
|
+
constructor(source: string);
|
|
41
|
+
transcribe(_audio: Blob, _options?: TranscriberOptions): Promise<Document>;
|
|
42
|
+
private extractCueBlocks;
|
|
43
|
+
private stripWebVttHeader;
|
|
44
|
+
private isCueBlock;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=VttTranscriber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VttTranscriber.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/VttTranscriber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAM3D,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,cAAe,YAAW,WAAW;IAiBpC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAhBnC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAEvD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2B;IAC1D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA+C;IAC/E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAIzB;gBAE2B,MAAM,EAAE,MAAM;IAErC,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAOhF,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,UAAU;CAOnB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { CueDocumentBuilder } from '../transcription/CueDocumentBuilder';
|
|
2
|
+
import { CueTextTokenizer } from '../transcription/CueTextTokenizer';
|
|
3
|
+
import { CueTimecodeReader } from '../transcription/CueTimecodeReader';
|
|
4
|
+
import { TimestampedCueWordReader } from '../transcription/TimestampedCueWordReader';
|
|
5
|
+
import { WordTimingEstimator } from '../transcription/WordTimingEstimator';
|
|
6
|
+
const BOM_RE = /^\uFEFF/;
|
|
7
|
+
/**
|
|
8
|
+
* Builds a Document by parsing a WebVTT (`.vtt`) caption file. Skips
|
|
9
|
+
* the mandatory `WEBVTT` header block and any `NOTE`, `STYLE`, or
|
|
10
|
+
* `REGION` blocks, then reads the cues below them.
|
|
11
|
+
*
|
|
12
|
+
* WebVTT can mark inside a cue when each word is spoken, and those
|
|
13
|
+
* marks are honoured: a file carrying them yields the word timings it
|
|
14
|
+
* recorded rather than a guess. Where a cue carries no marks, its words
|
|
15
|
+
* are shared out across it the way a format without marks requires.
|
|
16
|
+
*
|
|
17
|
+
* The audio Blob passed to `transcribe` is ignored. Useful when
|
|
18
|
+
* caption text and timing are already known — burning a hand-authored
|
|
19
|
+
* VTT into a video, replaying captions from a subtitle-authoring
|
|
20
|
+
* tool, etc.
|
|
21
|
+
*
|
|
22
|
+
* A block that carries no timecode is skipped and announced through
|
|
23
|
+
* `onSkippedCueBlock`, so a single broken cue costs its own text and
|
|
24
|
+
* nothing else. Throws only when the file has blocks and none of them
|
|
25
|
+
* could be read, or when a timecode itself is malformed.
|
|
26
|
+
*
|
|
27
|
+
* Builds its own collaborators rather than receiving them. The
|
|
28
|
+
* constructor is the surface a consumer of the engine reaches for, and
|
|
29
|
+
* it asks for a source and nothing else, so this class is where the
|
|
30
|
+
* parsing side is assembled rather than a participant in someone
|
|
31
|
+
* else's assembly.
|
|
32
|
+
*/
|
|
33
|
+
export class VttTranscriber {
|
|
34
|
+
source;
|
|
35
|
+
onProgress;
|
|
36
|
+
/**
|
|
37
|
+
* Fired once per block left out of the document, before
|
|
38
|
+
* `transcribe` resolves, carrying the block verbatim.
|
|
39
|
+
*/
|
|
40
|
+
onSkippedCueBlock;
|
|
41
|
+
timecodeReader = new CueTimecodeReader();
|
|
42
|
+
documentBuilder = new CueDocumentBuilder(this.timecodeReader);
|
|
43
|
+
wordReader = new TimestampedCueWordReader(new CueTextTokenizer(), this.timecodeReader, new WordTimingEstimator());
|
|
44
|
+
constructor(source) {
|
|
45
|
+
this.source = source;
|
|
46
|
+
}
|
|
47
|
+
async transcribe(_audio, _options) {
|
|
48
|
+
this.onProgress?.({ stage: 'inferring', progress: 1 });
|
|
49
|
+
const result = this.documentBuilder.build(this.extractCueBlocks(this.source), this.wordReader);
|
|
50
|
+
for (const block of result.skippedBlocks)
|
|
51
|
+
this.onSkippedCueBlock?.(block);
|
|
52
|
+
return result.document;
|
|
53
|
+
}
|
|
54
|
+
extractCueBlocks(source) {
|
|
55
|
+
const normalized = source.replace(BOM_RE, '').replace(/\r\n?/g, '\n');
|
|
56
|
+
return this.stripWebVttHeader(normalized)
|
|
57
|
+
.split(/\n{2,}/)
|
|
58
|
+
.filter((block) => this.isCueBlock(block))
|
|
59
|
+
.join('\n\n');
|
|
60
|
+
}
|
|
61
|
+
stripWebVttHeader(source) {
|
|
62
|
+
if (!/^WEBVTT(?:\s|$)/.test(source))
|
|
63
|
+
return source;
|
|
64
|
+
const firstBlockEnd = source.indexOf('\n\n');
|
|
65
|
+
if (firstBlockEnd === -1)
|
|
66
|
+
return '';
|
|
67
|
+
return source.slice(firstBlockEnd + 2);
|
|
68
|
+
}
|
|
69
|
+
isCueBlock(block) {
|
|
70
|
+
const firstLine = block.trim().split('\n')[0]?.trim() ?? '';
|
|
71
|
+
if (firstLine.length === 0)
|
|
72
|
+
return false;
|
|
73
|
+
if (firstLine === 'STYLE' || firstLine === 'REGION')
|
|
74
|
+
return false;
|
|
75
|
+
if (firstLine === 'NOTE' || firstLine.startsWith('NOTE ') || firstLine.startsWith('NOTE\t'))
|
|
76
|
+
return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=VttTranscriber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VttTranscriber.js","sourceRoot":"","sources":["../../../src/modules/transcription/VttTranscriber.ts"],"names":[],"mappings":"AACA,OAAO,E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
|
4
|
+
timestamp: [number | null, number | null];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Reconciles the chunk streams from consecutive pipeline windows into
|
|
8
|
+
* one non-duplicated timeline.
|
|
9
|
+
*
|
|
10
|
+
* transformers.js runs Whisper's chunk-and-stitch long-form strategy:
|
|
11
|
+
* consecutive windows overlap by `2 * strideLengthSeconds`, and each
|
|
12
|
+
* window transcribes its full range independently. The library is
|
|
13
|
+
* supposed to discard the overlap zones at stitch time but its word-
|
|
14
|
+
* timestamps path leaks them through — both windows' takes on the
|
|
15
|
+
* same audio land in the final chunks. Under a degenerate loop or a
|
|
16
|
+
* token-ceiling cut, a window can also flood its overlap zone with
|
|
17
|
+
* garbage.
|
|
18
|
+
*
|
|
19
|
+
* This class re-splits the merged chunk stream back into per-window
|
|
20
|
+
* groups (detected via timestamp drops in generation order) and crops
|
|
21
|
+
* each to a single half of every overlap. The split point between two
|
|
22
|
+
* consecutive windows is the later of the overlap midpoint and the
|
|
23
|
+
* next window's own first chunk — so if the next window declared
|
|
24
|
+
* silence over part of its overlap, the previous window's take on
|
|
25
|
+
* that same audio is kept instead of dropped.
|
|
26
|
+
*/
|
|
27
|
+
export declare class WhisperChunkStitcher {
|
|
28
|
+
private readonly chunkLengthSeconds;
|
|
29
|
+
private readonly strideLengthSeconds;
|
|
30
|
+
constructor(chunkLengthSeconds: number, strideLengthSeconds: number);
|
|
31
|
+
stitch(chunks: WhisperChunk[], audioDurationSeconds: number): WhisperChunk[];
|
|
32
|
+
/**
|
|
33
|
+
* Splits the merged chunk stream into per-window groups. Windows emit
|
|
34
|
+
* in generation order and each window's own timestamps are monotonic,
|
|
35
|
+
* so a chunk whose anchor is earlier than the previous chunk's marks
|
|
36
|
+
* the start of the next window.
|
|
37
|
+
*/
|
|
38
|
+
private splitByGenerationWindow;
|
|
39
|
+
/**
|
|
40
|
+
* The split points between consecutive window groups, in absolute
|
|
41
|
+
* seconds. `boundaries[i]` is the second at which trust hands over
|
|
42
|
+
* from window `i` to window `i + 1`.
|
|
43
|
+
*/
|
|
44
|
+
private trustBoundariesBetween;
|
|
45
|
+
private leftBoundaryOf;
|
|
46
|
+
private rightBoundaryOf;
|
|
47
|
+
private cropGroup;
|
|
48
|
+
private anchorOf;
|
|
49
|
+
private firstAnchorOf;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=WhisperChunkStitcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperChunkStitcher.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperChunkStitcher.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBADnB,kBAAkB,EAAE,MAAM,EAC1B,mBAAmB,EAAE,MAAM;IAG9C,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,oBAAoB,EAAE,MAAM,GAAG,YAAY,EAAE;IAW5E;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAiB/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reconciles the chunk streams from consecutive pipeline windows into
|
|
3
|
+
* one non-duplicated timeline.
|
|
4
|
+
*
|
|
5
|
+
* transformers.js runs Whisper's chunk-and-stitch long-form strategy:
|
|
6
|
+
* consecutive windows overlap by `2 * strideLengthSeconds`, and each
|
|
7
|
+
* window transcribes its full range independently. The library is
|
|
8
|
+
* supposed to discard the overlap zones at stitch time but its word-
|
|
9
|
+
* timestamps path leaks them through — both windows' takes on the
|
|
10
|
+
* same audio land in the final chunks. Under a degenerate loop or a
|
|
11
|
+
* token-ceiling cut, a window can also flood its overlap zone with
|
|
12
|
+
* garbage.
|
|
13
|
+
*
|
|
14
|
+
* This class re-splits the merged chunk stream back into per-window
|
|
15
|
+
* groups (detected via timestamp drops in generation order) and crops
|
|
16
|
+
* each to a single half of every overlap. The split point between two
|
|
17
|
+
* consecutive windows is the later of the overlap midpoint and the
|
|
18
|
+
* next window's own first chunk — so if the next window declared
|
|
19
|
+
* silence over part of its overlap, the previous window's take on
|
|
20
|
+
* that same audio is kept instead of dropped.
|
|
21
|
+
*/
|
|
22
|
+
export class WhisperChunkStitcher {
|
|
23
|
+
chunkLengthSeconds;
|
|
24
|
+
strideLengthSeconds;
|
|
25
|
+
constructor(chunkLengthSeconds, strideLengthSeconds) {
|
|
26
|
+
this.chunkLengthSeconds = chunkLengthSeconds;
|
|
27
|
+
this.strideLengthSeconds = strideLengthSeconds;
|
|
28
|
+
}
|
|
29
|
+
stitch(chunks, audioDurationSeconds) {
|
|
30
|
+
const groups = this.splitByGenerationWindow(chunks);
|
|
31
|
+
if (groups.length <= 1)
|
|
32
|
+
return chunks;
|
|
33
|
+
const boundaries = this.trustBoundariesBetween(groups);
|
|
34
|
+
return groups.flatMap((group, index) => this.cropGroup(group, this.leftBoundaryOf(index, boundaries), this.rightBoundaryOf(index, boundaries, groups.length, audioDurationSeconds)));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Splits the merged chunk stream into per-window groups. Windows emit
|
|
38
|
+
* in generation order and each window's own timestamps are monotonic,
|
|
39
|
+
* so a chunk whose anchor is earlier than the previous chunk's marks
|
|
40
|
+
* the start of the next window.
|
|
41
|
+
*/
|
|
42
|
+
splitByGenerationWindow(chunks) {
|
|
43
|
+
const groups = [];
|
|
44
|
+
let current = [];
|
|
45
|
+
let previousAnchor = null;
|
|
46
|
+
for (const chunk of chunks) {
|
|
47
|
+
const anchor = this.anchorOf(chunk);
|
|
48
|
+
if (anchor !== null && previousAnchor !== null && anchor < previousAnchor) {
|
|
49
|
+
groups.push(current);
|
|
50
|
+
current = [];
|
|
51
|
+
}
|
|
52
|
+
current.push(chunk);
|
|
53
|
+
if (anchor !== null)
|
|
54
|
+
previousAnchor = anchor;
|
|
55
|
+
}
|
|
56
|
+
if (current.length > 0)
|
|
57
|
+
groups.push(current);
|
|
58
|
+
return groups;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The split points between consecutive window groups, in absolute
|
|
62
|
+
* seconds. `boundaries[i]` is the second at which trust hands over
|
|
63
|
+
* from window `i` to window `i + 1`.
|
|
64
|
+
*/
|
|
65
|
+
trustBoundariesBetween(groups) {
|
|
66
|
+
const advance = this.chunkLengthSeconds - 2 * this.strideLengthSeconds;
|
|
67
|
+
const boundaries = [];
|
|
68
|
+
for (let index = 0; index < groups.length - 1; index++) {
|
|
69
|
+
const overlapMidpoint = index * advance + this.chunkLengthSeconds - this.strideLengthSeconds;
|
|
70
|
+
const nextGroupFirstAnchor = this.firstAnchorOf(groups[index + 1]);
|
|
71
|
+
boundaries.push(nextGroupFirstAnchor === null
|
|
72
|
+
? overlapMidpoint
|
|
73
|
+
: Math.max(overlapMidpoint, nextGroupFirstAnchor));
|
|
74
|
+
}
|
|
75
|
+
return boundaries;
|
|
76
|
+
}
|
|
77
|
+
leftBoundaryOf(groupIndex, boundaries) {
|
|
78
|
+
return groupIndex === 0 ? 0 : boundaries[groupIndex - 1];
|
|
79
|
+
}
|
|
80
|
+
rightBoundaryOf(groupIndex, boundaries, groupCount, audioDurationSeconds) {
|
|
81
|
+
return groupIndex === groupCount - 1 ? audioDurationSeconds : boundaries[groupIndex];
|
|
82
|
+
}
|
|
83
|
+
cropGroup(group, leftSeconds, rightSeconds) {
|
|
84
|
+
return group.filter((chunk) => {
|
|
85
|
+
const anchor = this.anchorOf(chunk);
|
|
86
|
+
return anchor !== null && anchor >= leftSeconds && anchor < rightSeconds;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
anchorOf(chunk) {
|
|
90
|
+
return chunk.timestamp[0] ?? chunk.timestamp[1];
|
|
91
|
+
}
|
|
92
|
+
firstAnchorOf(group) {
|
|
93
|
+
for (const chunk of group) {
|
|
94
|
+
const anchor = this.anchorOf(chunk);
|
|
95
|
+
if (anchor !== null)
|
|
96
|
+
return anchor;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=WhisperChunkStitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperChunkStitcher.js","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperChunkStitcher.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,oBAAoB;IAEZ;IACA;IAFnB,YACmB,kBAA0B,EAC1B,mBAA2B;QAD3B,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,wBAAmB,GAAnB,mBAAmB,CAAQ;IAC3C,CAAC;IAEJ,MAAM,CAAC,MAAsB,EAAE,oBAA4B;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO,MAAM,CAAC;QACtC,MAAM,UAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACvD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CACpD,KAAK,EACL,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,EACtC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,UA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rC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the device the transcriber was asked to run on is not
|
|
3
|
+
* usable — either the model does not ship the artefacts needed for
|
|
4
|
+
* that device, or the browser does not expose the runtime that device
|
|
5
|
+
* relies on. Fired before any model file is fetched.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export declare class WhisperDeviceUnavailableError extends Error {
|
|
13
|
+
static readonly ERROR_NAME = "WhisperDeviceUnavailableError";
|
|
14
|
+
readonly name = "WhisperDeviceUnavailableError";
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperDeviceUnavailableError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperDeviceUnavailableError.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperDeviceUnavailableError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,MAAM,CAAC,QAAQ,CAAC,UAAU,mCAAmC;IAC7D,QAAQ,CAAC,IAAI,mCAA4C;CAC1D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the device the transcriber was asked to run on is not
|
|
3
|
+
* usable — either the model does not ship the artefacts needed for
|
|
4
|
+
* that device, or the browser does not expose the runtime that device
|
|
5
|
+
* relies on. Fired before any model file is fetched.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export class WhisperDeviceUnavailableError extends Error {
|
|
13
|
+
static ERROR_NAME = 'WhisperDeviceUnavailableError';
|
|
14
|
+
name = WhisperDeviceUnavailableError.ERROR_NAME;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperDeviceUnavailableError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperDeviceUnavailableError.js","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperDeviceUnavailableError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtD,MAAM,CAAU,UAAU,GAAG,+BAA+B,CAAC;IACpD,IAAI,GAAG,6BAA6B,CAAC,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the Whisper pipeline was loaded successfully but the
|
|
3
|
+
* inference call itself rejected — the model ran out of memory, the
|
|
4
|
+
* WebGPU device was lost mid-decode, the input audio was too short,
|
|
5
|
+
* or any other runtime error surfaced while transcribing.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export declare class WhisperInferenceFailedError extends Error {
|
|
13
|
+
static readonly ERROR_NAME = "WhisperInferenceFailedError";
|
|
14
|
+
readonly name = "WhisperInferenceFailedError";
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperInferenceFailedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperInferenceFailedError.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperInferenceFailedError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,MAAM,CAAC,QAAQ,CAAC,UAAU,iCAAiC;IAC3D,QAAQ,CAAC,IAAI,iCAA0C;CACxD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the Whisper pipeline was loaded successfully but the
|
|
3
|
+
* inference call itself rejected — the model ran out of memory, the
|
|
4
|
+
* WebGPU device was lost mid-decode, the input audio was too short,
|
|
5
|
+
* or any other runtime error surfaced while transcribing.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export class WhisperInferenceFailedError extends Error {
|
|
13
|
+
static ERROR_NAME = 'WhisperInferenceFailedError';
|
|
14
|
+
name = WhisperInferenceFailedError.ERROR_NAME;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperInferenceFailedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperInferenceFailedError.js","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperInferenceFailedError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,MAAM,CAAU,UAAU,GAAG,6BAA6B,CAAC;IAClD,IAAI,GAAG,2BAA2B,CAAC,UAAU,CAAC"}
|