@remotion/studio 4.0.521 → 4.0.523

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 (264) hide show
  1. package/dist/api/install-package.js +4 -2
  2. package/dist/components/AssetAudioVolume.d.ts +5 -0
  3. package/dist/components/AssetAudioVolume.js +33 -0
  4. package/dist/components/Canvas.js +5 -6
  5. package/dist/components/CanvasIfSizeIsAvailable.js +7 -0
  6. package/dist/components/CaptionInspector.js +74 -20
  7. package/dist/components/CheckboardToggle.js +8 -6
  8. package/dist/components/Checkbox.d.ts +1 -0
  9. package/dist/components/Checkbox.js +2 -2
  10. package/dist/components/CompositionContextButton.js +4 -1
  11. package/dist/components/CompositionSelectorItem.js +2 -2
  12. package/dist/components/ConfigureLicenseModal.js +1 -1
  13. package/dist/components/CopyButton.js +7 -14
  14. package/dist/components/CurrentAsset.js +40 -6
  15. package/dist/components/Editor.js +6 -5
  16. package/dist/components/EditorContent.js +1 -1
  17. package/dist/components/EditorContexts.js +3 -1
  18. package/dist/components/ElementInstallConfirmation.js +290 -136
  19. package/dist/components/FixComputedValueModal.js +56 -16
  20. package/dist/components/FullscreenToggle.js +9 -8
  21. package/dist/components/GlobalKeybindings.js +50 -49
  22. package/dist/components/HighlightedElementSource.d.ts +5 -0
  23. package/dist/components/HighlightedElementSource.js +78 -0
  24. package/dist/components/InspectorLocationCopy.js +10 -5
  25. package/dist/components/InspectorPanel/MultiSequenceField.d.ts +12 -0
  26. package/dist/components/InspectorPanel/MultiSequenceField.js +131 -0
  27. package/dist/components/InspectorPanel/MultiSequenceInspector.d.ts +8 -0
  28. package/dist/components/InspectorPanel/MultiSequenceInspector.js +102 -0
  29. package/dist/components/InspectorPanel/MultiSequenceNumberField.d.ts +9 -0
  30. package/dist/components/InspectorPanel/MultiSequenceNumberField.js +88 -0
  31. package/dist/components/InspectorPanel.js +4 -0
  32. package/dist/components/InspectorSequenceSection.js +64 -1
  33. package/dist/components/InstallPackage.js +4 -5
  34. package/dist/components/KeyboardShortcutsSettings.js +212 -33
  35. package/dist/components/MenuBuildIndicator.js +7 -2
  36. package/dist/components/MenuCompositionName.js +62 -6
  37. package/dist/components/MenuToolbar.js +7 -5
  38. package/dist/components/ModalContainer.d.ts +1 -0
  39. package/dist/components/ModalContainer.js +2 -2
  40. package/dist/components/Modals.js +3 -1
  41. package/dist/components/ModelManager.d.ts +16 -0
  42. package/dist/components/ModelManager.js +200 -0
  43. package/dist/components/ModelsSettings.d.ts +2 -0
  44. package/dist/components/ModelsSettings.js +133 -0
  45. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  46. package/dist/components/NewComposition/DismissableModal.js +2 -2
  47. package/dist/components/NewComposition/InputDragger.d.ts +2 -2
  48. package/dist/components/NewComposition/InputDragger.js +6 -6
  49. package/dist/components/NewComposition/NewFolder.js +11 -8
  50. package/dist/components/NewComposition/RenameFolder.js +17 -10
  51. package/dist/components/OptionalPackageModal.d.ts +11 -0
  52. package/dist/components/OptionalPackageModal.js +155 -0
  53. package/dist/components/PlayPause.js +4 -8
  54. package/dist/components/PlaybackKeyboardShortcutsManager.js +3 -6
  55. package/dist/components/PreviewToolbarOverflowButton.js +11 -2
  56. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +5 -2
  57. package/dist/components/RadioButton.d.ts +1 -0
  58. package/dist/components/RadioButton.js +2 -2
  59. package/dist/components/RenderButton.js +5 -1
  60. package/dist/components/RenderModal/CliCopyButton.js +13 -27
  61. package/dist/components/RenderModal/NumberSetting.d.ts +6 -1
  62. package/dist/components/RenderModal/NumberSetting.js +2 -2
  63. package/dist/components/RenderModal/RenderModalBasic.js +1 -1
  64. package/dist/components/RenderModal/RenderModalOutputName.d.ts +3 -1
  65. package/dist/components/RenderModal/RenderModalOutputName.js +4 -4
  66. package/dist/components/RenderModal/SeparateAudioOption.js +1 -1
  67. package/dist/components/RenderModal/WebRenderModalBasic.js +1 -1
  68. package/dist/components/RenderQueue/CaptionQueueItem.d.ts +6 -0
  69. package/dist/components/RenderQueue/CaptionQueueItem.js +129 -0
  70. package/dist/components/RenderQueue/CaptionQueueProcessor.d.ts +1 -0
  71. package/dist/components/RenderQueue/CaptionQueueProcessor.js +110 -0
  72. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.d.ts +2 -0
  73. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.js +54 -0
  74. package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +7 -4
  75. package/dist/components/RenderQueue/RenderQueueItem.js +3 -3
  76. package/dist/components/RenderQueue/VideoMattingQueueItem.d.ts +6 -0
  77. package/dist/components/RenderQueue/VideoMattingQueueItem.js +129 -0
  78. package/dist/components/RenderQueue/VideoMattingQueueProcessor.d.ts +1 -0
  79. package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +105 -0
  80. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.d.ts +2 -0
  81. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.js +54 -0
  82. package/dist/components/RenderQueue/caption-job-types.d.ts +47 -0
  83. package/dist/components/RenderQueue/caption-job-types.js +7 -0
  84. package/dist/components/RenderQueue/context.d.ts +16 -0
  85. package/dist/components/RenderQueue/context.js +224 -11
  86. package/dist/components/RenderQueue/index.js +34 -10
  87. package/dist/components/RenderQueue/item-style.d.ts +1 -0
  88. package/dist/components/RenderQueue/item-style.js +2 -1
  89. package/dist/components/RenderQueue/load-model-for-job.d.ts +11 -0
  90. package/dist/components/RenderQueue/load-model-for-job.js +14 -0
  91. package/dist/components/RenderQueue/video-matting-job-types.d.ts +38 -0
  92. package/dist/components/RenderQueue/video-matting-job-types.js +5 -0
  93. package/dist/components/RendersTab.js +4 -4
  94. package/dist/components/SegmentedControl.d.ts +2 -2
  95. package/dist/components/SegmentedControl.js +38 -13
  96. package/dist/components/SelectedOutlinePolygon.js +8 -2
  97. package/dist/components/SettingsButton.d.ts +4 -0
  98. package/dist/components/SettingsButton.js +49 -0
  99. package/dist/components/SettingsModal.d.ts +1 -1
  100. package/dist/components/SettingsModal.js +3 -1
  101. package/dist/components/ShowOutlinesProvider.js +12 -0
  102. package/dist/components/SidebarCollapserControls.js +21 -16
  103. package/dist/components/SizeSelector.js +10 -2
  104. package/dist/components/SkillsSettings.js +11 -8
  105. package/dist/components/SnappingToggle.js +5 -2
  106. package/dist/components/Splitter/SplitterContainer.js +63 -10
  107. package/dist/components/Splitter/SplitterContext.d.ts +3 -0
  108. package/dist/components/Splitter/SplitterContext.js +5 -1
  109. package/dist/components/Splitter/SplitterElement.js +11 -2
  110. package/dist/components/Splitter/SplitterHandle.d.ts +1 -0
  111. package/dist/components/Splitter/SplitterHandle.js +55 -25
  112. package/dist/components/Tabs/vertical.d.ts +1 -0
  113. package/dist/components/Tabs/vertical.js +2 -2
  114. package/dist/components/TimeValue.js +2 -3
  115. package/dist/components/Timeline/SequencePropsObserver.js +4 -0
  116. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -1
  117. package/dist/components/Timeline/SubscribeToNodePaths.js +2 -1
  118. package/dist/components/Timeline/Timeline.js +17 -46
  119. package/dist/components/Timeline/TimelineClipboardKeybindings.js +2 -4
  120. package/dist/components/Timeline/TimelineDeleteKeybindings.js +3 -18
  121. package/dist/components/Timeline/TimelineDragHandler.js +11 -6
  122. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  123. package/dist/components/Timeline/TimelinePinchZoom.js +6 -30
  124. package/dist/components/Timeline/TimelinePlayCursorSyncer.js +1 -7
  125. package/dist/components/Timeline/TimelineRowChrome.js +11 -3
  126. package/dist/components/Timeline/TimelineSchemaField.js +8 -4
  127. package/dist/components/Timeline/TimelineSelection.d.ts +2 -0
  128. package/dist/components/Timeline/TimelineSelection.js +55 -2
  129. package/dist/components/Timeline/TimelineSequence.js +148 -25
  130. package/dist/components/Timeline/TimelineSequenceItem.d.ts +0 -1
  131. package/dist/components/Timeline/TimelineSequenceItem.js +220 -112
  132. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +35 -5
  133. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +233 -138
  134. package/dist/components/Timeline/TimelineSlider.js +1 -4
  135. package/dist/components/Timeline/TimelineTimeIndicators.js +1 -0
  136. package/dist/components/Timeline/TimelineWidthProvider.js +2 -5
  137. package/dist/components/Timeline/TimelineZoomControls.js +20 -20
  138. package/dist/components/Timeline/get-sequence-split-menu-item.d.ts +11 -0
  139. package/dist/components/Timeline/get-sequence-split-menu-item.js +55 -0
  140. package/dist/components/Timeline/use-asset-timeline-context-menu.d.ts +2 -0
  141. package/dist/components/Timeline/use-asset-timeline-context-menu.js +52 -0
  142. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -2
  143. package/dist/components/Timeline/use-sequence-props-subscription.js +4 -10
  144. package/dist/components/TimelineInOutToggle.js +20 -17
  145. package/dist/components/TopPanel.js +3 -19
  146. package/dist/components/Transcription/LazyModels.d.ts +1 -0
  147. package/dist/components/Transcription/LazyModels.js +5 -0
  148. package/dist/components/Transcription/Models.d.ts +6 -0
  149. package/dist/components/Transcription/Models.js +18 -0
  150. package/dist/components/Transcription/TranscriptionModal.d.ts +3 -0
  151. package/dist/components/Transcription/TranscriptionModal.js +428 -0
  152. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.d.ts +5 -0
  153. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +48 -0
  154. package/dist/components/Transcription/caption-output-name.d.ts +2 -0
  155. package/dist/components/Transcription/caption-output-name.js +10 -0
  156. package/dist/components/Transcription/resample-media-to-16-khz.d.ts +6 -0
  157. package/dist/components/Transcription/resample-media-to-16-khz.js +82 -0
  158. package/dist/components/Transcription/whisper-languages.d.ts +2 -0
  159. package/dist/components/Transcription/whisper-languages.js +104 -0
  160. package/dist/components/Transcription/whisper-webgpu-capability.d.ts +2 -0
  161. package/dist/components/Transcription/whisper-webgpu-capability.js +7 -0
  162. package/dist/components/UndoRedoButtons.js +13 -38
  163. package/dist/components/UpdatesSettings.js +17 -17
  164. package/dist/components/VideoMatting/LazyModels.d.ts +1 -0
  165. package/dist/components/VideoMatting/LazyModels.js +5 -0
  166. package/dist/components/VideoMatting/Models.d.ts +6 -0
  167. package/dist/components/VideoMatting/Models.js +18 -0
  168. package/dist/components/VideoMatting/VideoMattingModal.d.ts +3 -0
  169. package/dist/components/VideoMatting/VideoMattingModal.js +207 -0
  170. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.d.ts +5 -0
  171. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +46 -0
  172. package/dist/components/VideoMatting/video-matting-capability.d.ts +2 -0
  173. package/dist/components/VideoMatting/video-matting-capability.js +7 -0
  174. package/dist/components/WebMcp.js +439 -22
  175. package/dist/components/ZoomPersistor.js +6 -3
  176. package/dist/components/composition-menu-items.js +1 -1
  177. package/dist/components/import-assets.d.ts +3 -2
  178. package/dist/components/import-assets.js +5 -9
  179. package/dist/components/keyboard-shortcuts.d.ts +17 -1
  180. package/dist/components/keyboard-shortcuts.js +177 -89
  181. package/dist/components/public-output-name.d.ts +5 -0
  182. package/dist/components/public-output-name.js +60 -0
  183. package/dist/components/use-model-cache-status.d.ts +7 -0
  184. package/dist/components/use-model-cache-status.js +35 -0
  185. package/dist/esm/CaptionQueueProcessor-k0yrm3dj.mjs +211 -0
  186. package/dist/esm/HighlightedElementSource-jfc66k4p.mjs +1236 -0
  187. package/dist/esm/LazyModels-2trdm224.mjs +11 -0
  188. package/dist/esm/LazyModels-fjb5ckaq.mjs +11 -0
  189. package/dist/esm/TranscriptionModal-916jqhry.mjs +1011 -0
  190. package/dist/esm/VideoMattingModal-2tm79s9b.mjs +374 -0
  191. package/dist/esm/VideoMattingQueueProcessor-t1hgm2rm.mjs +109 -0
  192. package/dist/esm/index-1x7bsdh6.mjs +261 -0
  193. package/dist/esm/index-3hgr6gjx.mjs +41 -0
  194. package/dist/esm/index-5qddp5h7.mjs +36 -0
  195. package/dist/esm/index-5zrb1ft4.mjs +39 -0
  196. package/dist/esm/index-6cvm9a65.mjs +45923 -0
  197. package/dist/esm/index-7tt71e8n.mjs +36 -0
  198. package/dist/esm/index-9x6e1dq0.mjs +428 -0
  199. package/dist/esm/index-cw0pnpg5.mjs +50 -0
  200. package/dist/esm/index-czwvnn9g.mjs +35 -0
  201. package/dist/esm/index-hy4xcgty.mjs +1366 -0
  202. package/dist/esm/{chunk-je0h1bgt.js → index-jg13hf2g.mjs} +3 -1
  203. package/dist/esm/{chunk-6jf1natv.js → index-rcv7qkt5.mjs} +18 -1
  204. package/dist/esm/index-sgtmgc4h.mjs +423 -0
  205. package/dist/esm/index-te66vvrp.mjs +142 -0
  206. package/dist/esm/index-v4tr1bft.mjs +20 -0
  207. package/dist/esm/index-x7t2y7ws.mjs +54194 -0
  208. package/dist/esm/index-xhe2m2qr.mjs +1146 -0
  209. package/dist/esm/index.mjs +45 -933
  210. package/dist/esm/internals.mjs +13 -114127
  211. package/dist/esm/previewEntry.mjs +387 -114784
  212. package/dist/esm/renderEntry.mjs +3 -3
  213. package/dist/esm/{chunk-m0jqdbkr.js → resolve-composition-component-location-14148845.mjs} +1 -1
  214. package/dist/helpers/copy-text.js +1 -2
  215. package/dist/helpers/drag-aware-double-click.d.ts +2 -1
  216. package/dist/helpers/drag-aware-double-click.js +12 -1
  217. package/dist/helpers/get-asset-metadata.d.ts +1 -0
  218. package/dist/helpers/get-asset-metadata.js +4 -0
  219. package/dist/helpers/hoverable.js +8 -0
  220. package/dist/helpers/inject-css.js +2 -0
  221. package/dist/helpers/optional-package-dependencies.d.ts +3 -0
  222. package/dist/helpers/optional-package-dependencies.js +24 -0
  223. package/dist/helpers/pointer-session.d.ts +6 -0
  224. package/dist/helpers/pointer-session.js +36 -14
  225. package/dist/helpers/prism-tomorrow.d.ts +1 -0
  226. package/dist/helpers/prism-tomorrow.js +151 -0
  227. package/dist/helpers/sequence-node-path-mutations.js +11 -0
  228. package/dist/helpers/slugify-name.d.ts +1 -0
  229. package/dist/helpers/slugify-name.js +14 -0
  230. package/dist/helpers/studio-runtime-config.d.ts +1 -0
  231. package/dist/helpers/studio-runtime-config.js +6 -1
  232. package/dist/helpers/use-copy-feedback.d.ts +4 -0
  233. package/dist/helpers/use-copy-feedback.js +19 -0
  234. package/dist/helpers/use-keybinding.d.ts +9 -3
  235. package/dist/helpers/use-keybinding.js +8 -9
  236. package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -0
  237. package/dist/helpers/use-keyboard-shortcut-label.js +15 -0
  238. package/dist/helpers/use-menu-structure.js +58 -13
  239. package/dist/icons/copy.d.ts +5 -0
  240. package/dist/icons/copy.js +12 -0
  241. package/dist/icons/input-props.d.ts +1 -1
  242. package/dist/icons/input-props.js +2 -2
  243. package/dist/icons/models.d.ts +4 -0
  244. package/dist/icons/models.js +7 -0
  245. package/dist/icons/separation.d.ts +4 -0
  246. package/dist/icons/separation.js +7 -0
  247. package/dist/icons/transcription.d.ts +4 -0
  248. package/dist/icons/transcription.js +7 -0
  249. package/dist/icons/upload.js +1 -1
  250. package/dist/state/canvas-ref.d.ts +1 -0
  251. package/dist/state/canvas-ref.js +2 -1
  252. package/dist/state/modals.d.ts +14 -2
  253. package/dist/state/sidebar.d.ts +3 -0
  254. package/dist/state/sidebar.js +6 -1
  255. package/dist/state/timeline-zoom.d.ts +1 -1
  256. package/dist/state/timeline-zoom.js +3 -3
  257. package/dist/visual-controls/VisualControls.js +4 -0
  258. package/package.json +34 -20
  259. package/dist/components/UpdateCheck.d.ts +0 -1
  260. package/dist/components/UpdateCheck.js +0 -79
  261. package/dist/esm/chunk-emw4k5b0.js +0 -99527
  262. package/dist/esm/chunk-vkrvnx2h.js +0 -99378
  263. package/dist/helpers/use-max-media-duration.d.ts +0 -2
  264. package/dist/helpers/use-max-media-duration.js +0 -61
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CaptionQueueItem = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../../helpers/colors");
7
+ const url_state_1 = require("../../helpers/url-state");
8
+ const InlineAction_1 = require("../InlineAction");
9
+ const layout_1 = require("../layout");
10
+ const use_select_asset_1 = require("../use-select-asset");
11
+ const CircularProgress_1 = require("./CircularProgress");
12
+ const context_1 = require("./context");
13
+ const item_style_1 = require("./item-style");
14
+ const SuccessIcon_1 = require("./SuccessIcon");
15
+ const container = {
16
+ padding: 12,
17
+ display: 'flex',
18
+ flexDirection: 'row',
19
+ paddingBottom: 10,
20
+ paddingRight: 4,
21
+ marginBottom: 1,
22
+ marginLeft: 4,
23
+ borderRadius: 4,
24
+ width: 'calc(100% - 4px)',
25
+ };
26
+ const title = {
27
+ fontSize: 13,
28
+ lineHeight: 1,
29
+ };
30
+ const right = {
31
+ flex: 1,
32
+ display: 'flex',
33
+ flexDirection: 'column',
34
+ overflow: 'hidden',
35
+ };
36
+ const subtitleContainer = {
37
+ maxWidth: '100%',
38
+ flex: 1,
39
+ display: 'flex',
40
+ overflow: 'hidden',
41
+ };
42
+ const subtitle = {
43
+ ...item_style_1.renderQueueItemSubtitleStyle,
44
+ cursor: 'default',
45
+ };
46
+ const statusIcon = {
47
+ height: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
48
+ width: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
49
+ };
50
+ const removeIcon = {
51
+ height: 16,
52
+ color: colors_1.CURRENT_COLOR,
53
+ };
54
+ const CaptionJobStatus = ({ job }) => {
55
+ if (job.status === 'running') {
56
+ return (jsx_runtime_1.jsx("div", { style: statusIcon, role: "progressbar", "aria-label": "Caption job progress", "aria-valuetext": job.progress.message, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(job.progress.value * 100), children: jsx_runtime_1.jsx(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress.value) }) }));
57
+ }
58
+ if (job.status === 'done') {
59
+ return jsx_runtime_1.jsx(SuccessIcon_1.SuccessIcon, {});
60
+ }
61
+ if (job.status === 'failed') {
62
+ return (jsx_runtime_1.jsx("svg", { style: statusIcon, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.FAIL_COLOR, d: "M0 160V352L160 512H352L512 352V160L352 0H160L0 160zm353.9 32l-17 17-47 47 47 47 17 17L320 353.9l-17-17-47-47-47 47-17 17L158.1 320l17-17 47-47-47-47-17-17L192 158.1l17 17 47 47 47-47 17-17L353.9 192z" }) }));
63
+ }
64
+ return (jsx_runtime_1.jsx("svg", { style: statusIcon, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256s-114.6 256-256 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" }) }));
65
+ };
66
+ const CaptionQueueItem = ({ job, selected }) => {
67
+ const [hovered, setHovered] = (0, react_1.useState)(false);
68
+ const { removeCaptionJob } = (0, react_1.useContext)(context_1.RenderQueueContext);
69
+ const selectAsset = (0, use_select_asset_1.useSelectAsset)();
70
+ const isHoverable = job.status === 'done';
71
+ const containerStyle = (0, react_1.useMemo)(() => {
72
+ return {
73
+ ...container,
74
+ backgroundColor: (0, colors_1.getBackgroundFromHoverState)({
75
+ hovered: isHoverable && hovered,
76
+ selected,
77
+ }),
78
+ userSelect: 'none',
79
+ WebkitUserSelect: 'none',
80
+ };
81
+ }, [hovered, isHoverable, selected]);
82
+ const onPointerEnter = (0, react_1.useCallback)(() => {
83
+ setHovered(true);
84
+ }, []);
85
+ const onPointerLeave = (0, react_1.useCallback)(() => {
86
+ setHovered(false);
87
+ }, []);
88
+ const scrollCurrentIntoView = (0, react_1.useCallback)(() => {
89
+ var _a;
90
+ (_a = document
91
+ .querySelector(`.${item_style_1.RENDER_QUEUE_ITEM_SELECTED_CLASSNAME}`)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
92
+ }, []);
93
+ const onClick = (0, react_1.useCallback)(() => {
94
+ if (job.status !== 'done') {
95
+ return;
96
+ }
97
+ selectAsset(job.outName);
98
+ (0, url_state_1.pushUrl)(`/assets/${job.outName}`);
99
+ }, [job, selectAsset]);
100
+ (0, react_1.useEffect)(() => {
101
+ if (selected) {
102
+ scrollCurrentIntoView();
103
+ }
104
+ }, [scrollCurrentIntoView, selected]);
105
+ const onRemove = (0, react_1.useCallback)((event) => {
106
+ event.stopPropagation();
107
+ removeCaptionJob(job.id);
108
+ }, [job.id, removeCaptionJob]);
109
+ const renderRemoveAction = (0, react_1.useCallback)((color) => {
110
+ return (jsx_runtime_1.jsx("svg", { style: removeIcon, viewBox: "0 0 320 512", children: jsx_runtime_1.jsx("path", { fill: color, d: "M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z" }) }));
111
+ }, []);
112
+ const message = (0, react_1.useMemo)(() => {
113
+ if (job.status === 'idle') {
114
+ return 'Queued for transcription';
115
+ }
116
+ if (job.status === 'running') {
117
+ return job.progress.message;
118
+ }
119
+ if (job.status === 'failed') {
120
+ return job.error.message;
121
+ }
122
+ return job.outName;
123
+ }, [job]);
124
+ return (jsx_runtime_1.jsxs(layout_1.Row, { "data-render-queue-item": job.id, style: containerStyle, align: "center", onClick: onClick, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, className: selected ? item_style_1.RENDER_QUEUE_ITEM_SELECTED_CLASSNAME : undefined, children: [
125
+ jsx_runtime_1.jsx(CaptionJobStatus, { job: job }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs("div", { style: right, children: [
126
+ jsx_runtime_1.jsx("div", { style: title, children: job.displayName }), jsx_runtime_1.jsx("div", { style: subtitleContainer, children: jsx_runtime_1.jsx("span", { style: subtitle, title: message, children: message }) })
127
+ ] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), job.status === 'running' ? null : (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderRemoveAction, onClick: onRemove, title: "Remove", variant: null }))] }));
128
+ };
129
+ exports.CaptionQueueItem = CaptionQueueItem;
@@ -0,0 +1 @@
1
+ export declare const CaptionQueueProcessor: React.FC;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CaptionQueueProcessor = void 0;
4
+ const whisper_webgpu_1 = require("@remotion/whisper-webgpu");
5
+ const react_1 = require("react");
6
+ const write_static_file_1 = require("../../api/write-static-file");
7
+ const resample_media_to_16_khz_1 = require("../Transcription/resample-media-to-16-khz");
8
+ const context_1 = require("./context");
9
+ const load_model_for_job_1 = require("./load-model-for-job");
10
+ const CaptionQueueProcessor = () => {
11
+ const { updateCaptionJobProgress, markCaptionJobDone, markCaptionJobFailed, setProcessCaptionJobCallback, } = (0, react_1.useContext)(context_1.RenderQueueContext);
12
+ const processJob = (0, react_1.useCallback)(async (job) => {
13
+ let captionCount = null;
14
+ let processingError = null;
15
+ try {
16
+ updateCaptionJobProgress(job.id, {
17
+ message: 'Checking WebGPU support...',
18
+ value: 0,
19
+ });
20
+ const support = await (0, whisper_webgpu_1.canUseWhisperWebGpu)();
21
+ if (!support.supported) {
22
+ throw new Error(support.detailedReason);
23
+ }
24
+ updateCaptionJobProgress(job.id, {
25
+ message: `Checking ${job.model}...`,
26
+ value: 0.02,
27
+ });
28
+ await (0, whisper_webgpu_1.clearStaleModels)();
29
+ await (0, load_model_for_job_1.loadModelForJob)({
30
+ model: job.model,
31
+ progressStart: 0.03,
32
+ progressSpan: 0.27,
33
+ isModelCached: (model) => (0, whisper_webgpu_1.isWhisperModelCached)({ model }),
34
+ loadModel: (model, onProgress) => (0, whisper_webgpu_1.loadWhisperModel)({
35
+ model,
36
+ onProgress: (progress) => onProgress(progress.progress),
37
+ }),
38
+ updateProgress: (progress) => updateCaptionJobProgress(job.id, progress),
39
+ });
40
+ updateCaptionJobProgress(job.id, {
41
+ message: `Preparing ${job.displayName}...`,
42
+ value: 0.3,
43
+ });
44
+ const channelWaveform = await (0, resample_media_to_16_khz_1.resampleMediaTo16Khz)({
45
+ src: job.src,
46
+ audioStreamIndex: job.audioStreamIndex,
47
+ requestInit: job.requestInit,
48
+ onProgress: (progress) => {
49
+ updateCaptionJobProgress(job.id, {
50
+ message: `Preparing ${job.displayName}...`,
51
+ value: 0.3 + progress * 0.2,
52
+ });
53
+ },
54
+ });
55
+ updateCaptionJobProgress(job.id, {
56
+ message: `Transcribing ${job.displayName}...`,
57
+ value: 0.5,
58
+ });
59
+ const transcription = await (0, whisper_webgpu_1.transcribe)({
60
+ channelWaveform,
61
+ model: job.model,
62
+ task: job.task,
63
+ chunkLengthInSeconds: job.chunkLengthInSeconds,
64
+ strideLengthInSeconds: job.strideLengthInSeconds,
65
+ forceFullSequences: job.forceFullSequences,
66
+ doSample: job.doSample,
67
+ temperature: job.temperature,
68
+ topK: job.topK,
69
+ repetitionPenalty: job.repetitionPenalty,
70
+ noRepeatNgramSize: job.noRepeatNgramSize,
71
+ ...(job.language === null ? {} : { language: job.language }),
72
+ });
73
+ const { captions } = (0, whisper_webgpu_1.toCaptions)({
74
+ whisperWebGpuOutput: transcription,
75
+ });
76
+ updateCaptionJobProgress(job.id, {
77
+ message: `Saving ${job.outName}...`,
78
+ value: 0.95,
79
+ });
80
+ await (0, write_static_file_1.writeStaticFile)({
81
+ contents: JSON.stringify(captions, null, 2),
82
+ filePath: job.outName,
83
+ });
84
+ captionCount = captions.length;
85
+ }
86
+ catch (error) {
87
+ processingError =
88
+ error instanceof Error ? error : new Error(String(error));
89
+ }
90
+ try {
91
+ await (0, whisper_webgpu_1.disposeWhisperModel)({ model: job.model });
92
+ }
93
+ catch (_a) {
94
+ // The pipeline is removed from the in-memory registry before disposal.
95
+ // A cleanup failure should not hide a successfully written caption file.
96
+ }
97
+ if (processingError) {
98
+ markCaptionJobFailed(job.id, processingError);
99
+ }
100
+ else {
101
+ markCaptionJobDone(job.id, captionCount !== null && captionCount !== void 0 ? captionCount : 0);
102
+ }
103
+ }, [markCaptionJobDone, markCaptionJobFailed, updateCaptionJobProgress]);
104
+ (0, react_1.useEffect)(() => {
105
+ setProcessCaptionJobCallback(processJob);
106
+ return () => setProcessCaptionJobCallback(null);
107
+ }, [processJob, setProcessCaptionJobCallback]);
108
+ return null;
109
+ };
110
+ exports.CaptionQueueProcessor = CaptionQueueProcessor;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const CaptionQueueProcessorLoader: React.FC;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CaptionQueueProcessorLoader = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const react_1 = __importStar(require("react"));
39
+ const OptionalPackageModal_1 = require("../OptionalPackageModal");
40
+ const whisper_webgpu_capability_1 = require("../Transcription/whisper-webgpu-capability");
41
+ const context_1 = require("./context");
42
+ const LazyCaptionQueueProcessor = react_1.default.lazy(async () => {
43
+ const { CaptionQueueProcessor } = await Promise.resolve().then(() => __importStar(require('./CaptionQueueProcessor')));
44
+ return { default: CaptionQueueProcessor };
45
+ });
46
+ const CaptionQueueProcessorLoader = () => {
47
+ const { captionJobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
48
+ const installed = (0, OptionalPackageModal_1.useOptionalPackageInstalled)(whisper_webgpu_capability_1.WHISPER_WEBGPU_PACKAGE);
49
+ if (!installed || captionJobs.length === 0) {
50
+ return null;
51
+ }
52
+ return (jsx_runtime_1.jsx(react_1.Suspense, { fallback: null, children: jsx_runtime_1.jsx(LazyCaptionQueueProcessor, {}) }));
53
+ };
54
+ exports.CaptionQueueProcessorLoader = CaptionQueueProcessorLoader;
@@ -5,7 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
7
7
  const get_asset_metadata_1 = require("../../helpers/get-asset-metadata");
8
- const clipboard_1 = require("../../icons/clipboard");
8
+ const use_copy_feedback_1 = require("../../helpers/use-copy-feedback");
9
+ const copy_1 = require("../../icons/copy");
9
10
  const InlineAction_1 = require("../InlineAction");
10
11
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
11
12
  const revealIconStyle = {
@@ -29,9 +30,10 @@ const supportsCopyingToClipboard = (job) => {
29
30
  };
30
31
  exports.supportsCopyingToClipboard = supportsCopyingToClipboard;
31
32
  const RenderQueueCopyToClipboard = ({ job }) => {
33
+ const { copied, markCopied } = (0, use_copy_feedback_1.useCopyFeedback)();
32
34
  const renderCopyAction = (0, react_1.useCallback)((color) => {
33
- return jsx_runtime_1.jsx(clipboard_1.ClipboardIcon, { style: revealIconStyle, color: color });
34
- }, []);
35
+ return jsx_runtime_1.jsx(copy_1.CopyIcon, { copied: copied, style: revealIconStyle, color: color });
36
+ }, [copied]);
35
37
  const onClick = (0, react_1.useCallback)(async (e) => {
36
38
  e.stopPropagation();
37
39
  try {
@@ -47,12 +49,13 @@ const RenderQueueCopyToClipboard = ({ job }) => {
47
49
  [contentType]: blob,
48
50
  }),
49
51
  ]);
52
+ markCopied();
50
53
  (0, NotificationCenter_1.showNotification)('Copied to clipboard!', 1000);
51
54
  }
52
55
  catch (err) {
53
56
  (0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 2000);
54
57
  }
55
- }, [job.outName]);
58
+ }, [job.outName, markCopied]);
56
59
  return (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: "Copy to clipboard", renderAction: renderCopyAction, onClick: onClick }));
57
60
  };
58
61
  exports.RenderQueueCopyToClipboard = RenderQueueCopyToClipboard;
@@ -10,6 +10,7 @@ const url_state_1 = require("../../helpers/url-state");
10
10
  const layout_1 = require("../layout");
11
11
  const client_side_render_types_1 = require("./client-side-render-types");
12
12
  const context_1 = require("./context");
13
+ const item_style_1 = require("./item-style");
13
14
  const RenderQueueCancelledMessage_1 = require("./RenderQueueCancelledMessage");
14
15
  const RenderQueueCopyToClipboard_1 = require("./RenderQueueCopyToClipboard");
15
16
  const RenderQueueDownloadItem_1 = require("./RenderQueueDownloadItem");
@@ -50,7 +51,6 @@ const subtitle = {
50
51
  display: 'flex',
51
52
  overflow: 'hidden',
52
53
  };
53
- const SELECTED_CLASSNAME = '__remotion_selected_classname';
54
54
  const RenderQueueItem = ({ job, selected }) => {
55
55
  const [hovered, setHovered] = (0, react_1.useState)(false);
56
56
  const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
@@ -78,7 +78,7 @@ const RenderQueueItem = ({ job, selected }) => {
78
78
  const scrollCurrentIntoView = (0, react_1.useCallback)(() => {
79
79
  var _a;
80
80
  (_a = document
81
- .querySelector(`.${SELECTED_CLASSNAME}`)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
81
+ .querySelector(`.${item_style_1.RENDER_QUEUE_ITEM_SELECTED_CLASSNAME}`)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
82
82
  }, []);
83
83
  const clientBlobInfo = (0, react_1.useMemo)(() => {
84
84
  if (!isClientJob || job.status !== 'done' || !job.getBlob) {
@@ -146,7 +146,7 @@ const RenderQueueItem = ({ job, selected }) => {
146
146
  job.status === 'failed' ||
147
147
  job.status === 'cancelled') &&
148
148
  !((0, context_1.isClientRenderJob)(job) && (0, client_side_render_types_1.isRestoredClientJob)(job));
149
- return (jsx_runtime_1.jsxs(layout_1.Row, { "data-render-queue-item": job.id, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, style: containerStyle, align: "center", onClick: onClick, draggable: canDrag, onDragStart: onDragStart, onDragEnd: onDragEnd, className: selected ? SELECTED_CLASSNAME : undefined, children: [
149
+ return (jsx_runtime_1.jsxs(layout_1.Row, { "data-render-queue-item": job.id, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, style: containerStyle, align: "center", onClick: onClick, draggable: canDrag, onDragStart: onDragStart, onDragEnd: onDragEnd, className: selected ? item_style_1.RENDER_QUEUE_ITEM_SELECTED_CLASSNAME : undefined, children: [
150
150
  jsx_runtime_1.jsx(RenderQueueItemStatus_1.RenderQueueItemStatus, { job: job }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs("div", { style: right, children: [
151
151
  jsx_runtime_1.jsx("div", { style: title, children: job.compositionId }), jsx_runtime_1.jsx("div", { style: subtitle, children: job.status === 'done' ? (jsx_runtime_1.jsx(RenderQueueOutputName_1.RenderQueueOutputName, { job: job })) : job.status === 'failed' ? (jsx_runtime_1.jsx(RenderQueueError_1.RenderQueueError, { job: job })) : job.status === 'running' ? (jsx_runtime_1.jsx(RenderQueueProgressMessage_1.RenderQueueProgressMessage, { job: job })) : job.status === 'saving' ? (jsx_runtime_1.jsx(RenderQueueSavingMessage_1.RenderQueueSavingMessage, {})) : job.status === 'cancelled' ? (jsx_runtime_1.jsx(RenderQueueCancelledMessage_1.RenderQueueCancelledMessage, {})) : null })
152
152
  ] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), !isDragging ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [canCopyToClipboard ? (jsx_runtime_1.jsx(RenderQueueCopyToClipboard_1.RenderQueueCopyToClipboard, { job: job })) : null, canRepeat ? jsx_runtime_1.jsx(RenderQueueRepeat_1.RenderQueueRepeatItem, { job: job }) : null, job.status === 'running' ? (jsx_runtime_1.jsx(RenderQueueItemCancelButton_1.RenderQueueCancelButton, { job: job })) : isBrowserStudio ? null : (jsx_runtime_1.jsx(RenderQueueRemoveItem_1.RenderQueueRemoveItem, { job: job })), job.status === 'done' ? (clientBlobInfo ? (jsx_runtime_1.jsx(RenderQueueDownloadItem_1.RenderQueueDownloadItem, { job: job })) : isBrowserStudio ? null : (jsx_runtime_1.jsx(RenderQueueOpenInFolder_1.RenderQueueOpenInFinderItem, { job: job }))) : null] })) : null] }));
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { VideoMattingJob } from './video-matting-job-types';
3
+ export declare const VideoMattingQueueItem: React.FC<{
4
+ readonly job: VideoMattingJob;
5
+ readonly selected: boolean;
6
+ }>;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoMattingQueueItem = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../../helpers/colors");
7
+ const url_state_1 = require("../../helpers/url-state");
8
+ const ellipsis_1 = require("../../icons/ellipsis");
9
+ const InlineAction_1 = require("../InlineAction");
10
+ const InlineDropdown_1 = require("../InlineDropdown");
11
+ const layout_1 = require("../layout");
12
+ const use_select_asset_1 = require("../use-select-asset");
13
+ const CircularProgress_1 = require("./CircularProgress");
14
+ const context_1 = require("./context");
15
+ const item_style_1 = require("./item-style");
16
+ const SuccessIcon_1 = require("./SuccessIcon");
17
+ const container = {
18
+ borderRadius: 4,
19
+ display: 'flex',
20
+ marginBottom: 1,
21
+ marginLeft: 4,
22
+ padding: 12,
23
+ paddingBottom: 10,
24
+ paddingRight: 4,
25
+ width: 'calc(100% - 4px)',
26
+ };
27
+ const title = { fontSize: 13, lineHeight: 1 };
28
+ const right = {
29
+ display: 'flex',
30
+ flex: 1,
31
+ flexDirection: 'column',
32
+ overflow: 'hidden',
33
+ };
34
+ const subtitle = {
35
+ ...item_style_1.renderQueueItemSubtitleStyle,
36
+ cursor: 'default',
37
+ };
38
+ const subtitles = {
39
+ display: 'flex',
40
+ flexDirection: 'column',
41
+ overflow: 'hidden',
42
+ };
43
+ const statusIcon = {
44
+ height: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
45
+ width: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
46
+ };
47
+ const removeIcon = { color: colors_1.CURRENT_COLOR, height: 16 };
48
+ const ellipsisIconStyle = {
49
+ style: { height: 12 },
50
+ };
51
+ const Status = ({ job }) => {
52
+ if (job.status === 'running') {
53
+ return (jsx_runtime_1.jsx("div", { style: statusIcon, role: "progressbar", "aria-label": "Video matting progress", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(job.progress.value * 100), "aria-valuetext": job.progress.message, children: jsx_runtime_1.jsx(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress.value) }) }));
54
+ }
55
+ if (job.status === 'done')
56
+ return jsx_runtime_1.jsx(SuccessIcon_1.SuccessIcon, {});
57
+ if (job.status === 'failed')
58
+ return (jsx_runtime_1.jsx("svg", { style: statusIcon, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.FAIL_COLOR, d: "M0 160V352L160 512H352L512 352V160L352 0H160L0 160zm353.9 32-64 64 64 64L320 353.9l-64-64-64 64L158.1 320l64-64-64-64L192 158.1l64 64 64-64z" }) }));
59
+ return (jsx_runtime_1.jsx("svg", { style: statusIcon, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512C114.6 512 0 397.4 0 256S114.6 0 256 0s256 114.6 256 256-114.6 256-256 256zM232 120v136c0 8 4 15.5 10.7 20l96 64 26.6-39.9-85.3-56.9V120z" }) }));
60
+ };
61
+ const VideoMattingQueueItem = ({ job, selected }) => {
62
+ const [hovered, setHovered] = (0, react_1.useState)(false);
63
+ const { removeVideoMattingJob } = (0, react_1.useContext)(context_1.RenderQueueContext);
64
+ const selectAsset = (0, use_select_asset_1.useSelectAsset)();
65
+ const done = job.status === 'done';
66
+ const style = (0, react_1.useMemo)(() => ({
67
+ ...container,
68
+ backgroundColor: (0, colors_1.getBackgroundFromHoverState)({
69
+ hovered: done && hovered,
70
+ selected,
71
+ }),
72
+ userSelect: 'none',
73
+ }), [done, hovered, selected]);
74
+ const messages = job.status === 'idle'
75
+ ? ['Queued for video matting']
76
+ : job.status === 'running'
77
+ ? [job.progress.message, job.progress.detail].filter((message) => message !== null)
78
+ : job.status === 'failed'
79
+ ? [job.error.message]
80
+ : [job.baseOutName, job.foregroundOutName];
81
+ const tooltip = messages.join('\n');
82
+ const revealAsset = (0, react_1.useCallback)((assetName) => {
83
+ selectAsset(assetName);
84
+ (0, url_state_1.pushUrl)(`/assets/${assetName}`);
85
+ }, [selectAsset]);
86
+ const onClick = (0, react_1.useCallback)(() => {
87
+ if (!done)
88
+ return;
89
+ revealAsset(job.foregroundOutName);
90
+ }, [done, job.foregroundOutName, revealAsset]);
91
+ const revealItems = (0, react_1.useMemo)(() => {
92
+ return [
93
+ {
94
+ disabled: false,
95
+ id: 'reveal-foreground',
96
+ keyHint: null,
97
+ label: 'Reveal foreground',
98
+ leftItem: null,
99
+ onClick: () => revealAsset(job.foregroundOutName),
100
+ quickSwitcherLabel: null,
101
+ subMenu: null,
102
+ type: 'item',
103
+ value: 'reveal-foreground',
104
+ },
105
+ {
106
+ disabled: false,
107
+ id: 'reveal-background',
108
+ keyHint: null,
109
+ label: 'Reveal background',
110
+ leftItem: null,
111
+ onClick: () => revealAsset(job.baseOutName),
112
+ quickSwitcherLabel: null,
113
+ subMenu: null,
114
+ type: 'item',
115
+ value: 'reveal-background',
116
+ },
117
+ ];
118
+ }, [job.baseOutName, job.foregroundOutName, revealAsset]);
119
+ const onRemove = (0, react_1.useCallback)((event) => {
120
+ event.stopPropagation();
121
+ removeVideoMattingJob(job.id);
122
+ }, [job.id, removeVideoMattingJob]);
123
+ const renderRemove = (0, react_1.useCallback)((color) => (jsx_runtime_1.jsx("svg", { style: removeIcon, viewBox: "0 0 320 512", children: jsx_runtime_1.jsx("path", { fill: color, d: "M310.6 150.6 205.3 256l105.3 105.4-45.3 45.3L160 301.3 54.6 406.6 9.4 361.4 114.7 256 9.4 150.6l45.2-45.2L160 210.7l105.3-105.3z" }) })), []);
124
+ return (jsx_runtime_1.jsxs(layout_1.Row, { "data-render-queue-item": job.id, style: style, align: "center", onClick: onClick, onPointerEnter: () => setHovered(true), onPointerLeave: () => setHovered(false), children: [
125
+ jsx_runtime_1.jsx(Status, { job: job }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs("div", { style: right, children: [
126
+ jsx_runtime_1.jsx("div", { style: title, children: job.displayName }), jsx_runtime_1.jsx("div", { style: subtitles, title: tooltip, children: messages.map((message) => (jsx_runtime_1.jsx("span", { style: subtitle, children: message }, message))) })
127
+ ] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), done ? (jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { renderAction: (color) => (jsx_runtime_1.jsx(ellipsis_1.EllipsisIcon, { fill: color, svgProps: ellipsisIconStyle })), title: "Reveal video layer", values: revealItems, variant: null })) : null, job.status === 'running' ? null : (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderRemove, onClick: onRemove, title: "Remove", variant: null }))] }));
128
+ };
129
+ exports.VideoMattingQueueItem = VideoMattingQueueItem;
@@ -0,0 +1 @@
1
+ export declare const VideoMattingQueueProcessor: React.FC;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoMattingQueueProcessor = void 0;
4
+ const video_matting_1 = require("@remotion/video-matting");
5
+ const react_1 = require("react");
6
+ const write_static_file_1 = require("../../api/write-static-file");
7
+ const context_1 = require("./context");
8
+ const load_model_for_job_1 = require("./load-model-for-job");
9
+ const VideoMattingQueueProcessor = () => {
10
+ const { markVideoMattingJobDone, markVideoMattingJobFailed, setProcessVideoMattingJobCallback, updateVideoMattingJobProgress, } = (0, react_1.useContext)(context_1.RenderQueueContext);
11
+ const processJob = (0, react_1.useCallback)(async (job) => {
12
+ let outputs = null;
13
+ let processingError = null;
14
+ try {
15
+ updateVideoMattingJobProgress(job.id, {
16
+ detail: null,
17
+ message: 'Checking WebGPU support...',
18
+ value: 0,
19
+ });
20
+ const support = await (0, video_matting_1.canUseVideoMatting)({ model: job.model });
21
+ if (!support.supported) {
22
+ throw new Error(support.detailedReason);
23
+ }
24
+ await (0, load_model_for_job_1.loadModelForJob)({
25
+ model: job.model,
26
+ progressStart: 0,
27
+ progressSpan: 0.2,
28
+ isModelCached: (model) => (0, video_matting_1.isVideoMattingModelCached)({ model }),
29
+ loadModel: (model, onProgress) => (0, video_matting_1.loadVideoMattingModel)({
30
+ model,
31
+ onProgress: (progress) => onProgress(progress.progress),
32
+ }),
33
+ updateProgress: (progress) => updateVideoMattingJobProgress(job.id, {
34
+ ...progress,
35
+ detail: null,
36
+ }),
37
+ });
38
+ outputs = await (0, video_matting_1.separateVideoLayers)({
39
+ src: job.src,
40
+ model: job.model,
41
+ audio: job.audio,
42
+ videoBitrate: job.videoBitrate,
43
+ onProgress: (progress) => {
44
+ var _a;
45
+ updateVideoMattingJobProgress(job.id, {
46
+ detail: progress.stage === 'finalizing'
47
+ ? `Processed ${progress.processedFrames} ${progress.processedFrames === 1 ? 'frame' : 'frames'}`
48
+ : `Processed ${progress.processedFrames} ${progress.processedFrames === 1 ? 'frame' : 'frames'} · ${Math.round(progress.progress * 100)}%`,
49
+ message: progress.stage === 'finalizing'
50
+ ? 'Finalizing video layers...'
51
+ : 'Separating foreground...',
52
+ value: 0.2 + ((_a = progress.progress) !== null && _a !== void 0 ? _a : 1) * 0.65,
53
+ });
54
+ },
55
+ });
56
+ updateVideoMattingJobProgress(job.id, {
57
+ detail: null,
58
+ message: 'Saving video layers...',
59
+ value: 0.88,
60
+ });
61
+ const [base, foreground] = await Promise.all([
62
+ outputs.base.getBlob(),
63
+ outputs.foreground.getBlob(),
64
+ ]);
65
+ await Promise.all([
66
+ base
67
+ .arrayBuffer()
68
+ .then((contents) => (0, write_static_file_1.writeStaticFile)({ contents, filePath: job.baseOutName })),
69
+ foreground
70
+ .arrayBuffer()
71
+ .then((contents) => (0, write_static_file_1.writeStaticFile)({ contents, filePath: job.foregroundOutName })),
72
+ ]);
73
+ }
74
+ catch (error) {
75
+ processingError =
76
+ error instanceof Error ? error : new Error(String(error));
77
+ }
78
+ try {
79
+ await Promise.all([
80
+ outputs === null || outputs === void 0 ? void 0 : outputs.base.dispose(),
81
+ outputs === null || outputs === void 0 ? void 0 : outputs.foreground.dispose(),
82
+ ]);
83
+ await (0, video_matting_1.disposeVideoMattingModel)({ model: job.model });
84
+ }
85
+ catch (_a) {
86
+ // Cleanup errors must not hide successfully written outputs.
87
+ }
88
+ if (processingError) {
89
+ markVideoMattingJobFailed(job.id, processingError);
90
+ }
91
+ else {
92
+ markVideoMattingJobDone(job.id);
93
+ }
94
+ }, [
95
+ markVideoMattingJobDone,
96
+ markVideoMattingJobFailed,
97
+ updateVideoMattingJobProgress,
98
+ ]);
99
+ (0, react_1.useEffect)(() => {
100
+ setProcessVideoMattingJobCallback(processJob);
101
+ return () => setProcessVideoMattingJobCallback(null);
102
+ }, [processJob, setProcessVideoMattingJobCallback]);
103
+ return null;
104
+ };
105
+ exports.VideoMattingQueueProcessor = VideoMattingQueueProcessor;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const VideoMattingQueueProcessorLoader: React.FC;