@pixerate/editor-react 0.163.0 → 0.164.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.
@@ -130,7 +130,16 @@ var import_react2 = require("react");
130
130
  var import_video_editor2 = require("@pixerate/editor/video-editor");
131
131
  var import_jsx_runtime = require("react/jsx-runtime");
132
132
  function VideoPreview({ controller, resolution, onFrame, className = "", style }) {
133
- const { project } = useVideoEditorState(controller);
133
+ const { project, pathDrawing } = useVideoEditorState(controller);
134
+ const gesture = (0, import_react2.useMemo)(() => new import_video_editor2.VideoPathGesture(project), [project.width, project.height]);
135
+ const [drawn, setDrawn] = (0, import_react2.useState)([]);
136
+ (0, import_react2.useEffect)(() => {
137
+ if (!pathDrawing) return;
138
+ const onKey = (e) => e.key === "Escape" && controller.cancelPathDrawing();
139
+ window.addEventListener("keydown", onKey);
140
+ return () => window.removeEventListener("keydown", onKey);
141
+ }, [controller, pathDrawing]);
142
+ const box = (el) => el.getBoundingClientRect();
134
143
  const canvas = (0, import_react2.useRef)(null);
135
144
  const frameRef = (0, import_react2.useRef)(onFrame);
136
145
  frameRef.current = onFrame;
@@ -140,7 +149,7 @@ function VideoPreview({ controller, resolution, onFrame, className = "", style }
140
149
  const engine = new import_video_editor2.VideoPreviewEngine(controller, el, { resolution, onFrame: (frame) => frameRef.current?.(frame) });
141
150
  return () => engine.destroy();
142
151
  }, [controller, resolution]);
143
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ const preview = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
153
  "canvas",
145
154
  {
146
155
  ref: canvas,
@@ -151,6 +160,32 @@ function VideoPreview({ controller, resolution, onFrame, className = "", style }
151
160
  "data-video-preview": ""
152
161
  }
153
162
  );
163
+ if (!pathDrawing) return preview;
164
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { position: "relative" }, children: [
165
+ preview,
166
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
167
+ "svg",
168
+ {
169
+ viewBox: `0 0 ${project.width} ${project.height}`,
170
+ style: { position: "absolute", inset: 0, width: "100%", height: "100%", cursor: "crosshair", touchAction: "none" },
171
+ role: "application",
172
+ "aria-label": "Draw the effect's path",
173
+ "data-video-path-drawing": "",
174
+ onPointerDown: (e) => {
175
+ e.currentTarget.setPointerCapture?.(e.pointerId);
176
+ gesture.down(e, box(e.currentTarget));
177
+ setDrawn([...gesture.points]);
178
+ },
179
+ onPointerMove: (e) => gesture.move(e, box(e.currentTarget)) && setDrawn([...gesture.points]),
180
+ onPointerUp: () => {
181
+ const points = gesture.up();
182
+ setDrawn([]);
183
+ if (points) void controller.finishPathDrawing(points);
184
+ },
185
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: drawn.join(" "), fill: "none", stroke: "#22d3ee", strokeWidth: Math.max(2, project.width / 300), strokeLinecap: "round", strokeLinejoin: "round" })
186
+ }
187
+ )
188
+ ] });
154
189
  }
155
190
 
156
191
  // src/video-editor/VideoScopes.tsx
@@ -4102,9 +4137,25 @@ var import_react28 = require("react");
4102
4137
  // src/video-editor/VideoEffectsPanel.tsx
4103
4138
  var import_react27 = require("react");
4104
4139
  var import_video_editor12 = require("@pixerate/editor/video-editor");
4140
+ var import_effects7 = require("@pixerate/editor/effects");
4105
4141
  var import_jsx_runtime22 = require("react/jsx-runtime");
4106
4142
  var btn8 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
4107
4143
  var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => (0, import_video_editor12.isVideoKeyframes)(v)).map(([k]) => k));
4144
+ function PathControls({ controller, clip, instance, provider, disabled, report }) {
4145
+ const state = useVideoEditorState(controller);
4146
+ const [words, setWords] = (0, import_react27.useState)("");
4147
+ const drawing = state.pathDrawing?.clip === clip.id && state.pathDrawing.instance === instance;
4148
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-effect-part": "path", children: [
4149
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Path" }),
4150
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled, "aria-pressed": drawing, title: "Draw the path on the preview", onClick: () => drawing ? controller.cancelPathDrawing() : controller.startPathDrawing({ clip: clip.id, instance }), children: drawing ? "Drawing\u2026 (Esc)" : "Draw path" }),
4151
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled: disabled || !clip.mask, title: clip.mask ? "Run it along this clip's mask outline" : "Give the clip a mask first", onClick: () => report(controller.setEffectPath(clip.id, instance, { mask: { clip: clip.id } })), children: "Use mask outline" }),
4152
+ provider.pathFromText && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4153
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { className: "w-24 rounded border border-border bg-transparent px-1 py-0.5", "aria-label": "Words to write along the path", placeholder: "Words", value: words, disabled, onChange: (e) => setWords(e.currentTarget.value) }),
4154
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled: disabled || !words.trim(), onClick: () => report(controller.setEffectPath(clip.id, instance, { text: words })), children: "Write" })
4155
+ ] }),
4156
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn8, disabled, onClick: () => report(controller.setEffectPath(clip.id, instance, { d: "" })), children: "Clear path" })
4157
+ ] });
4158
+ }
4108
4159
  function EffectControls({
4109
4160
  provider,
4110
4161
  effect,
@@ -4112,7 +4163,8 @@ function EffectControls({
4112
4163
  values,
4113
4164
  disabled,
4114
4165
  onChange,
4115
- onPreset
4166
+ onPreset,
4167
+ path
4116
4168
  }) {
4117
4169
  const { description, error } = useEffectDescription(provider, effect);
4118
4170
  if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
@@ -4122,7 +4174,10 @@ function EffectControls({
4122
4174
  ] });
4123
4175
  if (error) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
4124
4176
  if (!description) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
4125
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
4177
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4178
+ path && (0, import_effects7.pathControlsOf)(description).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PathControls, { ...path, provider, disabled }),
4179
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset })
4180
+ ] });
4126
4181
  }
4127
4182
  function VideoEffectsPanel({ controller, className = "" }) {
4128
4183
  const state = useVideoEditorState(controller);
@@ -4163,7 +4218,8 @@ function VideoEffectsPanel({ controller, className = "" }) {
4163
4218
  values: clip.values,
4164
4219
  disabled,
4165
4220
  onChange: (k, v, gesture) => report(controller.updateEffectValues(clip.id, "generator", { [k]: v }, { merge: gesture ?? void 0 })),
4166
- onPreset: (values) => report(controller.updateEffectValues(clip.id, "generator", values))
4221
+ onPreset: (values) => report(controller.updateEffectValues(clip.id, "generator", values)),
4222
+ path: { controller, clip, instance: "generator", report }
4167
4223
  }
4168
4224
  )
4169
4225
  ] }),
@@ -4243,7 +4299,8 @@ function VideoEffectsPanel({ controller, className = "" }) {
4243
4299
  values: e.values,
4244
4300
  disabled,
4245
4301
  onChange: (k, v, gesture) => report(controller.updateClipEffect(clip.id, e.id, { values: { [k]: v } }, { merge: gesture ?? void 0 })),
4246
- onPreset: (values) => report(controller.updateClipEffect(clip.id, e.id, { values }))
4302
+ onPreset: (values) => report(controller.updateClipEffect(clip.id, e.id, { values })),
4303
+ path: { controller, clip, instance: e.id, report }
4247
4304
  }
4248
4305
  )
4249
4306
  ] })
@@ -93,11 +93,20 @@ function useVideoMusicTools(registry, controller, options = {}) {
93
93
  }
94
94
 
95
95
  // src/video-editor/VideoPreview.tsx
96
- import { useEffect as useEffect2, useRef as useRef2 } from "react";
97
- import { VideoPreviewEngine } from "@pixerate/editor/video-editor";
98
- import { jsx } from "react/jsx-runtime";
96
+ import { useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState } from "react";
97
+ import { VideoPathGesture, VideoPreviewEngine } from "@pixerate/editor/video-editor";
98
+ import { jsx, jsxs } from "react/jsx-runtime";
99
99
  function VideoPreview({ controller, resolution, onFrame, className = "", style }) {
100
- const { project } = useVideoEditorState(controller);
100
+ const { project, pathDrawing } = useVideoEditorState(controller);
101
+ const gesture = useMemo2(() => new VideoPathGesture(project), [project.width, project.height]);
102
+ const [drawn, setDrawn] = useState([]);
103
+ useEffect2(() => {
104
+ if (!pathDrawing) return;
105
+ const onKey = (e) => e.key === "Escape" && controller.cancelPathDrawing();
106
+ window.addEventListener("keydown", onKey);
107
+ return () => window.removeEventListener("keydown", onKey);
108
+ }, [controller, pathDrawing]);
109
+ const box = (el) => el.getBoundingClientRect();
101
110
  const canvas = useRef2(null);
102
111
  const frameRef = useRef2(onFrame);
103
112
  frameRef.current = onFrame;
@@ -107,7 +116,7 @@ function VideoPreview({ controller, resolution, onFrame, className = "", style }
107
116
  const engine = new VideoPreviewEngine(controller, el, { resolution, onFrame: (frame) => frameRef.current?.(frame) });
108
117
  return () => engine.destroy();
109
118
  }, [controller, resolution]);
110
- return /* @__PURE__ */ jsx(
119
+ const preview = /* @__PURE__ */ jsx(
111
120
  "canvas",
112
121
  {
113
122
  ref: canvas,
@@ -118,17 +127,43 @@ function VideoPreview({ controller, resolution, onFrame, className = "", style }
118
127
  "data-video-preview": ""
119
128
  }
120
129
  );
130
+ if (!pathDrawing) return preview;
131
+ return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
132
+ preview,
133
+ /* @__PURE__ */ jsx(
134
+ "svg",
135
+ {
136
+ viewBox: `0 0 ${project.width} ${project.height}`,
137
+ style: { position: "absolute", inset: 0, width: "100%", height: "100%", cursor: "crosshair", touchAction: "none" },
138
+ role: "application",
139
+ "aria-label": "Draw the effect's path",
140
+ "data-video-path-drawing": "",
141
+ onPointerDown: (e) => {
142
+ e.currentTarget.setPointerCapture?.(e.pointerId);
143
+ gesture.down(e, box(e.currentTarget));
144
+ setDrawn([...gesture.points]);
145
+ },
146
+ onPointerMove: (e) => gesture.move(e, box(e.currentTarget)) && setDrawn([...gesture.points]),
147
+ onPointerUp: () => {
148
+ const points = gesture.up();
149
+ setDrawn([]);
150
+ if (points) void controller.finishPathDrawing(points);
151
+ },
152
+ children: /* @__PURE__ */ jsx("polyline", { points: drawn.join(" "), fill: "none", stroke: "#22d3ee", strokeWidth: Math.max(2, project.width / 300), strokeLinecap: "round", strokeLinejoin: "round" })
153
+ }
154
+ )
155
+ ] });
121
156
  }
122
157
 
123
158
  // src/video-editor/VideoScopes.tsx
124
- import { useEffect as useEffect3, useRef as useRef3, useState } from "react";
159
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
125
160
  import { readVideoScopesPanel, VIDEO_SCOPE_KINDS } from "@pixerate/editor/video-editor";
126
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
161
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
127
162
  var LABELS = { histogram: "Histogram", waveform: "Luma waveform", vectorscope: "Vectorscope" };
128
163
  var pct = (v) => `${Math.round(v * 1e3) / 10}%`;
129
164
  function VideoScopes({ controller, scopes = VIDEO_SCOPE_KINDS, width = 256, height = 128, className = "" }) {
130
165
  const canvases = useRef3({});
131
- const [reading, setReading] = useState(() => ({ ok: false, message: "Show the preview to see its scopes." }));
166
+ const [reading, setReading] = useState2(() => ({ ok: false, message: "Show the preview to see its scopes." }));
132
167
  const key = scopes.join(",");
133
168
  useEffect3(() => {
134
169
  const feed = controller.previewPixels;
@@ -156,16 +191,16 @@ function VideoScopes({ controller, scopes = VIDEO_SCOPE_KINDS, width = 256, heig
156
191
  if (frame) caf(frame);
157
192
  };
158
193
  }, [controller, key, width, height]);
159
- return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-video-scopes": "", children: [
194
+ return /* @__PURE__ */ jsxs2("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-video-scopes": "", children: [
160
195
  /* @__PURE__ */ jsx2("div", { className: "flex flex-wrap gap-2", children: scopes.map((kind) => {
161
196
  const w = kind === "vectorscope" ? height : width;
162
- return /* @__PURE__ */ jsxs("figure", { className: "m-0 flex min-w-0 max-w-full flex-col gap-1", children: [
197
+ return /* @__PURE__ */ jsxs2("figure", { className: "m-0 flex min-w-0 max-w-full flex-col gap-1", children: [
163
198
  /* @__PURE__ */ jsx2("canvas", { ref: (el) => void (canvases.current[kind] = el), width: w, height, className: "rounded border border-border bg-black", style: { width: w, maxWidth: "100%", height: "auto", aspectRatio: `${w} / ${height}` }, "aria-label": LABELS[kind], "data-scope": kind }),
164
199
  /* @__PURE__ */ jsx2("figcaption", { className: "text-[11px] text-muted-foreground", children: LABELS[kind] })
165
200
  ] }, kind);
166
201
  }) }),
167
- reading.ok ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", "data-scope-stats": "", children: [
168
- /* @__PURE__ */ jsxs("div", { className: "tabular-nums", children: [
202
+ reading.ok ? /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-0.5", "data-scope-stats": "", children: [
203
+ /* @__PURE__ */ jsxs2("div", { className: "tabular-nums", children: [
169
204
  "Luma ",
170
205
  reading.stats.luma.mean.toFixed(2),
171
206
  " mean \xB7 ",
@@ -190,17 +225,17 @@ function VideoScopes({ controller, scopes = VIDEO_SCOPE_KINDS, width = 256, heig
190
225
 
191
226
  // src/video-editor/VideoTransport.tsx
192
227
  import { formatVideoTimecode, parseVideoPreviewScale, VIDEO_PREVIEW_SCALE_OPTIONS, videoAddAdjustmentEdits, videoProjectHasProxies } from "@pixerate/editor/video-editor";
193
- import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
228
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
194
229
  var btn = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
195
230
  function VideoTransport({ controller, editable = true, className = "" }) {
196
231
  const state = useVideoEditorState(controller);
197
232
  const { time, duration, playing, project, selection, readOnly } = state;
198
233
  const canEdit = editable && !readOnly;
199
- return /* @__PURE__ */ jsxs2("div", { className: `flex flex-wrap items-center gap-1.5 text-xs ${className}`, "data-video-transport": "", children: [
234
+ return /* @__PURE__ */ jsxs3("div", { className: `flex flex-wrap items-center gap-1.5 text-xs ${className}`, "data-video-transport": "", children: [
200
235
  /* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.step(-1), "aria-label": "Previous frame", title: "Previous frame (\u2190)", "data-step-back": "", children: "\u25C0|" }),
201
236
  /* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.toggle(), "aria-label": playing ? "Pause" : "Play", title: "Play / pause (Space)", disabled: duration <= 0, "data-play": "", children: playing ? "Pause" : "Play" }),
202
237
  /* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.step(1), "aria-label": "Next frame", title: "Next frame (\u2192)", "data-step-forward": "", children: "|\u25B6" }),
203
- /* @__PURE__ */ jsxs2("span", { className: "px-1 tabular-nums text-muted-foreground", "data-timecode": "", children: [
238
+ /* @__PURE__ */ jsxs3("span", { className: "px-1 tabular-nums text-muted-foreground", "data-timecode": "", children: [
204
239
  formatVideoTimecode(time, project.fps),
205
240
  " / ",
206
241
  formatVideoTimecode(duration, project.fps)
@@ -217,7 +252,7 @@ function VideoTransport({ controller, editable = true, className = "" }) {
217
252
  children: VIDEO_PREVIEW_SCALE_OPTIONS.map((o) => /* @__PURE__ */ jsx3("option", { value: o.value, children: o.label }, o.value))
218
253
  }
219
254
  ),
220
- editable && /* @__PURE__ */ jsxs2(Fragment, { children: [
255
+ editable && /* @__PURE__ */ jsxs3(Fragment, { children: [
221
256
  /* @__PURE__ */ jsx3("span", { className: "mx-1 h-4 w-px bg-border" }),
222
257
  /* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.splitAtPlayhead(), disabled: !canEdit, title: "Split at the playhead (S)", "data-split": "", children: "Split" }),
223
258
  /* @__PURE__ */ jsx3("button", { type: "button", className: btn, onClick: () => controller.deleteSelection(), disabled: !canEdit || !selection.length, title: "Delete the selected clips (Delete)", "data-delete": "", children: "Delete" }),
@@ -258,7 +293,7 @@ function VideoTransport({ controller, editable = true, className = "" }) {
258
293
  }
259
294
 
260
295
  // src/video-editor/VideoTimeline.tsx
261
- import { useEffect as useEffect4, useMemo as useMemo2, useRef as useRef4, useState as useState2, useSyncExternalStore as useSyncExternalStore2 } from "react";
296
+ import { useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState3, useSyncExternalStore as useSyncExternalStore2 } from "react";
262
297
  import {
263
298
  planVideoClipDrag,
264
299
  videoDragLabel,
@@ -273,7 +308,7 @@ import {
273
308
  formatVideoSeconds,
274
309
  parseVideoTimeRef
275
310
  } from "@pixerate/editor/video-editor";
276
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
311
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
277
312
  var HEADER = 150;
278
313
  var RULER = 24;
279
314
  var ROW = 44;
@@ -291,13 +326,13 @@ function ClipWaveform({ controller, clip, asset, width, height }) {
291
326
  controller.audioPeaks.load(asset).catch(() => {
292
327
  });
293
328
  }, [controller, asset]);
294
- const d = useMemo2(() => peaks ? videoClipWaveformPath(clip, peaks, width, height) : "", [peaks, clip, width, height]);
329
+ const d = useMemo3(() => peaks ? videoClipWaveformPath(clip, peaks, width, height) : "", [peaks, clip, width, height]);
295
330
  if (!d) return null;
296
331
  return /* @__PURE__ */ jsx4("svg", { className: "pointer-events-none absolute inset-0", width, height, "aria-hidden": "true", "data-waveform": clip.id, children: /* @__PURE__ */ jsx4("path", { d, fill: "currentColor", fillOpacity: 0.45 }) });
297
332
  }
298
333
  var isField = (el) => el instanceof HTMLElement && /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);
299
334
  function useCachedRanges(controller, project, px) {
300
- const [ranges, setRanges] = useState2([]);
335
+ const [ranges, setRanges] = useState3([]);
301
336
  useEffect4(() => {
302
337
  const cache = controller.frameCache;
303
338
  if (!cache) return setRanges([]);
@@ -320,10 +355,10 @@ function useCachedRanges(controller, project, px) {
320
355
  function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable = true, waveforms = "audio", className = "", playback, playbackId = "video", onPlaybackReveal }) {
321
356
  const state = useVideoEditorState(controller);
322
357
  const { project, duration, time, selection, readOnly, error } = state;
323
- const [ownZoom, setOwnZoom] = useState2(pxPerSecond ?? 100);
358
+ const [ownZoom, setOwnZoom] = useState3(pxPerSecond ?? 100);
324
359
  const px = onPxPerSecondChange ? pxPerSecond ?? 100 : ownZoom;
325
360
  const canEdit = editable && !readOnly;
326
- const [drag, setDrag] = useState2(null);
361
+ const [drag, setDrag] = useState3(null);
327
362
  const dragRef = useRef4(null);
328
363
  const rows = useRef4(/* @__PURE__ */ new Map());
329
364
  const ruler = useRef4(null);
@@ -495,9 +530,9 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
495
530
  children: field2 === "muted" ? "M" : field2 === "hidden" ? "H" : "L"
496
531
  }
497
532
  );
498
- return /* @__PURE__ */ jsxs3("div", { ref: wrapperRef, className: `relative flex flex-col gap-1 ${className}`, "data-video-timeline-wrapper": "", children: [
533
+ return /* @__PURE__ */ jsxs4("div", { ref: wrapperRef, className: `relative flex flex-col gap-1 ${className}`, "data-video-timeline-wrapper": "", children: [
499
534
  playing && /* @__PURE__ */ jsx4(PresenceLayer, { presence: agentPresence }),
500
- !onPxPerSecondChange && /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-2 self-end text-xs text-muted-foreground", children: [
535
+ !onPxPerSecondChange && /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2 self-end text-xs text-muted-foreground", children: [
501
536
  "Zoom",
502
537
  /* @__PURE__ */ jsx4("input", { type: "range", min: MIN_ZOOM, max: MAX_ZOOM, step: 5, value: ownZoom, "aria-label": "Timeline zoom", onChange: (e) => setOwnZoom(Number(e.target.value)), "data-zoom": "" })
503
538
  ] }),
@@ -510,10 +545,10 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
510
545
  "aria-label": "Video timeline",
511
546
  onKeyDown,
512
547
  "data-video-timeline": "",
513
- children: /* @__PURE__ */ jsxs3("div", { className: "relative", style: { width: HEADER + width }, children: [
514
- /* @__PURE__ */ jsxs3("div", { className: "flex", style: { height: RULER }, children: [
548
+ children: /* @__PURE__ */ jsxs4("div", { className: "relative", style: { width: HEADER + width }, children: [
549
+ /* @__PURE__ */ jsxs4("div", { className: "flex", style: { height: RULER }, children: [
515
550
  /* @__PURE__ */ jsx4("div", { className: "sticky left-0 z-20 shrink-0 border-b border-r border-border bg-background", style: { width: HEADER } }),
516
- /* @__PURE__ */ jsxs3(
551
+ /* @__PURE__ */ jsxs4(
517
552
  "div",
518
553
  {
519
554
  ref: ruler,
@@ -552,13 +587,13 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
552
587
  }
553
588
  )
554
589
  ] }),
555
- placed.map(({ track, clips }) => /* @__PURE__ */ jsxs3("div", { className: "flex border-b border-border last:border-b-0", style: { height: ROW }, "data-track": track.id, children: [
556
- /* @__PURE__ */ jsxs3("div", { className: "sticky left-0 z-20 flex shrink-0 flex-col justify-center gap-0.5 border-r border-border bg-background px-2 text-xs", style: { width: HEADER }, "data-track-header": "", children: [
557
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1", children: [
590
+ placed.map(({ track, clips }) => /* @__PURE__ */ jsxs4("div", { className: "flex border-b border-border last:border-b-0", style: { height: ROW }, "data-track": track.id, children: [
591
+ /* @__PURE__ */ jsxs4("div", { className: "sticky left-0 z-20 flex shrink-0 flex-col justify-center gap-0.5 border-r border-border bg-background px-2 text-xs", style: { width: HEADER }, "data-track-header": "", children: [
592
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
558
593
  /* @__PURE__ */ jsx4("span", { className: "truncate font-medium", children: track.name ?? track.id }),
559
594
  /* @__PURE__ */ jsx4("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-track-kind": "", children: track.kind })
560
595
  ] }),
561
- editable && /* @__PURE__ */ jsxs3("div", { className: "flex gap-1", children: [
596
+ editable && /* @__PURE__ */ jsxs4("div", { className: "flex gap-1", children: [
562
597
  toggle(track, "muted", "Mute"),
563
598
  track.kind === "video" && toggle(track, "hidden", "Hide"),
564
599
  toggle(track, "locked", "Lock")
@@ -581,7 +616,7 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
581
616
  const asset = clip.type === "media" ? assets.get(clip.asset) : void 0;
582
617
  const selected = selection.includes(clip.id);
583
618
  const label = videoClipLabel(clip, asset, clip.type === "sequence" ? sequences.get(clip.sequence) : void 0);
584
- return /* @__PURE__ */ jsxs3(
619
+ return /* @__PURE__ */ jsxs4(
585
620
  "div",
586
621
  {
587
622
  className: `absolute top-1 bottom-1 select-none touch-none overflow-hidden rounded text-[11px] text-white ${canEdit && !home.locked ? "cursor-grab" : "cursor-default"} ${dragging ? "opacity-80 shadow-lg" : ""}`,
@@ -603,11 +638,11 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
603
638
  children: [
604
639
  videoClipShowsWaveform(clip, asset, waveforms) && /* @__PURE__ */ jsx4(ClipWaveform, { controller, clip, asset, width: Math.max(2, msToPx(clip.duration)), height: ROW - 8 }),
605
640
  /* @__PURE__ */ jsx4("span", { className: "pointer-events-none relative block truncate px-1.5 py-0.5 leading-4", children: label }),
606
- clip.transition && /* @__PURE__ */ jsxs3("span", { className: "pointer-events-none absolute left-1 bottom-0.5 rounded bg-black/40 px-1 text-[9px] leading-3", title: `${clip.transition.type} ${clip.transition.duration} ms`, "data-transition": clip.transition.type, children: [
641
+ clip.transition && /* @__PURE__ */ jsxs4("span", { className: "pointer-events-none absolute left-1 bottom-0.5 rounded bg-black/40 px-1 text-[9px] leading-3", title: `${clip.transition.type} ${clip.transition.duration} ms`, "data-transition": clip.transition.type, children: [
607
642
  "\u29D3 ",
608
643
  clip.transition.type
609
644
  ] }),
610
- canEdit && !home.locked && /* @__PURE__ */ jsxs3(Fragment2, { children: [
645
+ canEdit && !home.locked && /* @__PURE__ */ jsxs4(Fragment2, { children: [
611
646
  /* @__PURE__ */ jsx4("div", { className: "absolute inset-y-0 left-0 cursor-ew-resize bg-white/0 hover:bg-white/40", style: { width: HANDLE }, "data-handle": "start", "aria-hidden": "true" }),
612
647
  /* @__PURE__ */ jsx4("div", { className: "absolute inset-y-0 right-0 cursor-ew-resize bg-white/0 hover:bg-white/40", style: { width: HANDLE }, "data-handle": "end", "aria-hidden": "true" })
613
648
  ] })
@@ -628,12 +663,12 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
628
663
  }
629
664
 
630
665
  // src/video-editor/ClipInspector.tsx
631
- import { useState as useState4 } from "react";
666
+ import { useState as useState5 } from "react";
632
667
 
633
668
  // src/video-editor/ClipCameraMoves.tsx
634
- import React4, { useEffect as useEffect5, useState as useState3 } from "react";
669
+ import React4, { useEffect as useEffect5, useState as useState4 } from "react";
635
670
  import { findVideoClip, videoClipCameraMove } from "@pixerate/editor/video-editor";
636
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
671
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
637
672
  var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
638
673
  var ROLES = [
639
674
  { role: "transition", label: "Move in", none: "none" },
@@ -643,7 +678,7 @@ function MoveControls({ controller, clip, role }) {
643
678
  const state = useVideoEditorState(controller);
644
679
  const move = videoClipCameraMove(findVideoClip(state.project, clip)?.clip, role);
645
680
  const { description, error } = useEffectDescription(state.effectsProvider, move?.move);
646
- const [message, setMessage] = useState3(null);
681
+ const [message, setMessage] = useState4(null);
647
682
  if (!move) return null;
648
683
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
649
684
  const set = (changes, merge) => {
@@ -653,8 +688,8 @@ function MoveControls({ controller, clip, role }) {
653
688
  };
654
689
  if (error) return /* @__PURE__ */ jsx5("p", { className: "text-[11px] text-amber-500", children: error });
655
690
  if (!description) return null;
656
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
657
- role === "transition" && /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-1 text-xs", children: [
691
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1 border-l border-border pl-2", "data-camera-move-controls": role, children: [
692
+ role === "transition" && /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-1 text-xs", children: [
658
693
  /* @__PURE__ */ jsx5("span", { className: "w-16 text-muted-foreground", children: "Length" }),
659
694
  /* @__PURE__ */ jsx5(
660
695
  "input",
@@ -696,8 +731,8 @@ function MoveControls({ controller, clip, role }) {
696
731
  }
697
732
  function ClipCameraMoves({ controller, clip, className = "" }) {
698
733
  const state = useVideoEditorState(controller);
699
- const [moves, setMoves] = useState3({ transition: [], hold: [] });
700
- const [message, setMessage] = useState3(null);
734
+ const [moves, setMoves] = useState4({ transition: [], hold: [] });
735
+ const [message, setMessage] = useState4(null);
701
736
  useEffect5(() => {
702
737
  let live = true;
703
738
  void Promise.all([controller.cameraMoves("transition"), controller.cameraMoves("hold")]).then(
@@ -712,21 +747,21 @@ function ClipCameraMoves({ controller, clip, className = "" }) {
712
747
  if (!at || at.track.kind === "audio" || at.clip.type === "adjustment") return null;
713
748
  const current = at.clip;
714
749
  if (!moves.transition.length && !moves.hold.length)
715
- return current.camera ? /* @__PURE__ */ jsxs4("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
750
+ return current.camera ? /* @__PURE__ */ jsxs5("p", { className: `text-[10px] text-muted-foreground ${className}`, "data-camera-moves": "unavailable", children: [
716
751
  "This clip's camera moves are baked into its keys; ",
717
752
  state.effectsProvider ? `${state.effectsProvider.name} has no camera moves` : "no effects provider is set",
718
753
  ", so they cannot be changed here."
719
754
  ] }) : null;
720
755
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
721
756
  const disabled = state.readOnly || !!at.track.locked;
722
- return /* @__PURE__ */ jsxs4("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-camera-moves": "", children: [
757
+ return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-camera-moves": "", children: [
723
758
  ROLES.map(({ role, label, none }) => {
724
759
  const move = videoClipCameraMove(current, role);
725
760
  const known = moves[role].some((m) => m.id === move?.move);
726
- return /* @__PURE__ */ jsxs4(React4.Fragment, { children: [
727
- /* @__PURE__ */ jsxs4("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
761
+ return /* @__PURE__ */ jsxs5(React4.Fragment, { children: [
762
+ /* @__PURE__ */ jsxs5("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
728
763
  /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: label }),
729
- /* @__PURE__ */ jsxs4(
764
+ /* @__PURE__ */ jsxs5(
730
765
  "select",
731
766
  {
732
767
  className: input,
@@ -736,7 +771,7 @@ function ClipCameraMoves({ controller, clip, className = "" }) {
736
771
  onChange: (e) => report(e.target.value ? controller.setClipCameraMove(clip, role, e.target.value) : controller.clearClipCameraMove(clip, role)),
737
772
  children: [
738
773
  /* @__PURE__ */ jsx5("option", { value: "", children: none }),
739
- move && !known && /* @__PURE__ */ jsxs4("option", { value: move.move, children: [
774
+ move && !known && /* @__PURE__ */ jsxs5("option", { value: move.move, children: [
740
775
  move.move,
741
776
  " (not in the provider)"
742
777
  ] }),
@@ -748,7 +783,7 @@ function ClipCameraMoves({ controller, clip, className = "" }) {
748
783
  move && known && !disabled && /* @__PURE__ */ jsx5(MoveControls, { controller, clip, role })
749
784
  ] }, role);
750
785
  }),
751
- current.camera && !disabled && /* @__PURE__ */ jsxs4("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
786
+ current.camera && !disabled && /* @__PURE__ */ jsxs5("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2", children: [
752
787
  /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: "Camera zoom" }),
753
788
  /* @__PURE__ */ jsx5(
754
789
  "input",
@@ -811,7 +846,7 @@ import {
811
846
  VIDEO_MASK_SHAPES,
812
847
  VIDEO_MASK_SHAPE_LABELS
813
848
  } from "@pixerate/editor/video-editor";
814
- import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
849
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
815
850
  var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
816
851
  var field = "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs disabled:opacity-50";
817
852
  var DEFAULT_TRANSITION = 500;
@@ -840,7 +875,7 @@ function Commit({
840
875
  return /* @__PURE__ */ jsx6("input", { className: field, ...rest, defaultValue: value, onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(), onBlur: (e) => commit(e.currentTarget.value) }, value);
841
876
  }
842
877
  function LutControls({ controller, clip, disabled }) {
843
- const [message, setMessage] = useState4(null);
878
+ const [message, setMessage] = useState5(null);
844
879
  const lut = clip.grade?.lut;
845
880
  const apply = (setting, label) => {
846
881
  const r = controller.apply(videoLutEdits(controller.getProject(), [clip.id], setting), label);
@@ -864,10 +899,10 @@ function LutControls({ controller, clip, disabled }) {
864
899
  setMessage(`${file.name}: ${e instanceof Error ? e.message : String(e)}`);
865
900
  }
866
901
  };
867
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
868
- /* @__PURE__ */ jsx6(Row, { label: "LUT", name: "grade.lut", children: /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 gap-1", children: [
902
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
903
+ /* @__PURE__ */ jsx6(Row, { label: "LUT", name: "grade.lut", children: /* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 gap-1", children: [
869
904
  /* @__PURE__ */ jsx6(Commit, { value: lut?.src ?? "", placeholder: "look.cube", "aria-label": "LUT file", disabled, onCommit: (raw) => void choose(raw.trim()) }),
870
- /* @__PURE__ */ jsxs5("label", { className: `${btn2} cursor-pointer whitespace-nowrap`, title: "Load a .cube file", children: [
905
+ /* @__PURE__ */ jsxs6("label", { className: `${btn2} cursor-pointer whitespace-nowrap`, title: "Load a .cube file", children: [
871
906
  "Load",
872
907
  /* @__PURE__ */ jsx6("input", { type: "file", accept: ".cube", className: "sr-only", disabled, "aria-label": "Load a .cube LUT", onChange: (e) => void readFile(e.currentTarget.files?.[0]) })
873
908
  ] }),
@@ -913,7 +948,7 @@ function LutControls({ controller, clip, disabled }) {
913
948
  ] });
914
949
  }
915
950
  function Row({ label, name, children }) {
916
- return /* @__PURE__ */ jsxs5("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2 text-xs", "data-field": name, children: [
951
+ return /* @__PURE__ */ jsxs6("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2 text-xs", "data-field": name, children: [
917
952
  /* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: label }),
918
953
  children
919
954
  ] });
@@ -946,8 +981,8 @@ function ClipInspector({ controller, className = "" }) {
946
981
  return /* @__PURE__ */ jsx6(Commit, { type: "number", value: value === void 0 ? "" : String(value), "aria-label": label, disabled, onCommit: (raw) => num(key, raw, `Change ${label.toLowerCase()}`), ...attrs });
947
982
  };
948
983
  const transition = clip.transition;
949
- return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
950
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 text-xs", children: [
984
+ return /* @__PURE__ */ jsxs6("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
985
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 text-xs", children: [
951
986
  /* @__PURE__ */ jsx6("span", { className: "font-medium", children: videoClipHeading(clip) }),
952
987
  /* @__PURE__ */ jsx6("code", { className: "text-muted-foreground", children: clip.id }),
953
988
  at.track.locked && /* @__PURE__ */ jsx6("span", { className: "text-amber-500", children: "locked track" })
@@ -955,7 +990,7 @@ function ClipInspector({ controller, className = "" }) {
955
990
  /* @__PURE__ */ jsx6(Row, { label: "Name", name: "name", children: text("name", "Name") }),
956
991
  /* @__PURE__ */ jsx6(Row, { label: "Start", name: "start", children: /* @__PURE__ */ jsx6("span", { className: "tabular-nums text-xs", children: formatVideoSeconds2(clip.start) }) }),
957
992
  /* @__PURE__ */ jsx6(Row, { label: "Duration", name: "duration", children: /* @__PURE__ */ jsx6("span", { className: "tabular-nums text-xs", children: formatVideoSeconds2(clip.duration) }) }),
958
- videoKeyframeRows(project, clip.id, time).map((row) => /* @__PURE__ */ jsx6(Row, { label: row.label, name: row.property, children: /* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 items-center gap-1", "data-keyframe-row": row.property, children: [
993
+ videoKeyframeRows(project, clip.id, time).map((row) => /* @__PURE__ */ jsx6(Row, { label: row.label, name: row.property, children: /* @__PURE__ */ jsxs6("span", { className: "flex min-w-0 items-center gap-1", "data-keyframe-row": row.property, children: [
959
994
  /* @__PURE__ */ jsx6(
960
995
  Commit,
961
996
  {
@@ -995,8 +1030,8 @@ function ClipInspector({ controller, className = "" }) {
995
1030
  row.keyed && /* @__PURE__ */ jsx6("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", "data-keyframe-count": row.property, children: row.keys })
996
1031
  ] }) }, row.property)),
997
1032
  at.track.kind === "video" && /* @__PURE__ */ jsx6(Row, { label: "Blend", name: "blend", children: /* @__PURE__ */ jsx6("select", { className: field, value: clip.blend ?? "normal", disabled, "aria-label": "Blend mode", onChange: (e) => set("blend", e.target.value === "normal" ? void 0 : e.target.value, "Change blend mode"), children: VIDEO_BLEND_MODES.map((m) => /* @__PURE__ */ jsx6("option", { value: m, children: VIDEO_BLEND_MODE_LABELS[m] }, m)) }) }),
998
- at.track.kind === "video" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
999
- /* @__PURE__ */ jsx6(Row, { label: "Look", name: "gradePreset", children: /* @__PURE__ */ jsxs5(
1033
+ at.track.kind === "video" && /* @__PURE__ */ jsxs6(Fragment3, { children: [
1034
+ /* @__PURE__ */ jsx6(Row, { label: "Look", name: "gradePreset", children: /* @__PURE__ */ jsxs6(
1000
1035
  "select",
1001
1036
  {
1002
1037
  className: field,
@@ -1034,7 +1069,7 @@ function ClipInspector({ controller, className = "" }) {
1034
1069
  ) }, c.key)),
1035
1070
  /* @__PURE__ */ jsx6(LutControls, { controller, clip, disabled })
1036
1071
  ] }),
1037
- clip.type === "adjustment" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1072
+ clip.type === "adjustment" && /* @__PURE__ */ jsxs6(Fragment3, { children: [
1038
1073
  /* @__PURE__ */ jsx6(Row, { label: "Changes", name: "scope", children: /* @__PURE__ */ jsx6(
1039
1074
  "select",
1040
1075
  {
@@ -1053,8 +1088,8 @@ function ClipInspector({ controller, className = "" }) {
1053
1088
  ) }),
1054
1089
  clip.scope === "track" && /* @__PURE__ */ jsx6(Row, { label: "Track", name: "targetTrack", children: /* @__PURE__ */ jsx6("select", { className: field, value: clip.targetTrack ?? "", disabled, "aria-label": "Adjusted track", onChange: (e) => set("targetTrack", e.target.value, "Change adjusted track"), children: project.tracks.filter((t) => t.kind === "video").map((t) => /* @__PURE__ */ jsx6("option", { value: t.id, children: t.name ?? t.id }, t.id)) }) })
1055
1090
  ] }),
1056
- at.track.kind === "video" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1057
- /* @__PURE__ */ jsx6(Row, { label: "Mask", name: "mask", children: /* @__PURE__ */ jsxs5(
1091
+ at.track.kind === "video" && /* @__PURE__ */ jsxs6(Fragment3, { children: [
1092
+ /* @__PURE__ */ jsx6(Row, { label: "Mask", name: "mask", children: /* @__PURE__ */ jsxs6(
1058
1093
  "select",
1059
1094
  {
1060
1095
  className: field,
@@ -1115,7 +1150,7 @@ function ClipInspector({ controller, className = "" }) {
1115
1150
  }
1116
1151
  ) })
1117
1152
  ] }),
1118
- at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ jsx6(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ jsxs5(
1153
+ at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ jsx6(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ jsxs6(
1119
1154
  "select",
1120
1155
  {
1121
1156
  className: field,
@@ -1134,12 +1169,12 @@ function ClipInspector({ controller, className = "" }) {
1134
1169
  ) }, key)),
1135
1170
  /* @__PURE__ */ jsx6(Row, { label: "Fade in (ms)", name: "fadeIn", children: number("fadeIn", "Fade in", { min: 0, step: 100 }) }),
1136
1171
  /* @__PURE__ */ jsx6(Row, { label: "Fade out (ms)", name: "fadeOut", children: number("fadeOut", "Fade out", { min: 0, step: 100 }) }),
1137
- clip.type === "media" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1138
- /* @__PURE__ */ jsx6(Row, { label: "Speed", name: "speed", children: clip.timeRemap ? /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-1", "data-ramped": "", children: [
1172
+ clip.type === "media" && /* @__PURE__ */ jsxs6(Fragment3, { children: [
1173
+ /* @__PURE__ */ jsx6(Row, { label: "Speed", name: "speed", children: clip.timeRemap ? /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1", "data-ramped": "", children: [
1139
1174
  /* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: "ramped" }),
1140
1175
  /* @__PURE__ */ jsx6("button", { type: "button", className: btn2, disabled, onClick: () => controller.apply({ op: "set_time_remap", clip: clip.id, keys: null, ripple: true }, "Remove speed ramp"), children: "Remove ramp" })
1141
1176
  ] }) : number("speed", "Speed", { min: 0.1, step: 0.25 }) }),
1142
- project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */ jsx6(Row, { label: "Retime", name: "retime", children: /* @__PURE__ */ jsxs5("span", { className: "flex flex-wrap gap-1", children: [
1177
+ project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */ jsx6(Row, { label: "Retime", name: "retime", children: /* @__PURE__ */ jsxs6("span", { className: "flex flex-wrap gap-1", children: [
1143
1178
  /* @__PURE__ */ jsx6(
1144
1179
  "button",
1145
1180
  {
@@ -1171,14 +1206,14 @@ function ClipInspector({ controller, className = "" }) {
1171
1206
  ) }, key) : null
1172
1207
  )
1173
1208
  ] }),
1174
- clip.type === "text" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1209
+ clip.type === "text" && /* @__PURE__ */ jsxs6(Fragment3, { children: [
1175
1210
  /* @__PURE__ */ jsx6(Row, { label: "Text", name: "text", children: /* @__PURE__ */ jsx6(Commit, { multiline: true, value: clip.text, "aria-label": "Text", disabled, onCommit: (raw) => set("text", raw, "Change text") }) }),
1176
1211
  /* @__PURE__ */ jsx6(Row, { label: "Colour", name: "color", children: text("color", "Colour") }),
1177
1212
  /* @__PURE__ */ jsx6(Row, { label: "Font size", name: "fontSize", children: number("fontSize", "Font size", { min: 1, step: 2 }) }),
1178
1213
  /* @__PURE__ */ jsx6(Row, { label: "Background", name: "background", children: text("background", "Background") })
1179
1214
  ] }),
1180
- clip.type === "sequence" && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1181
- /* @__PURE__ */ jsx6(Row, { label: "Sequence", name: "sequence", children: /* @__PURE__ */ jsxs5("span", { className: "truncate", title: "A compound clip plays its sequence as one picture and sound; its clips cannot be edited here yet", children: [
1215
+ clip.type === "sequence" && /* @__PURE__ */ jsxs6(Fragment3, { children: [
1216
+ /* @__PURE__ */ jsx6(Row, { label: "Sequence", name: "sequence", children: /* @__PURE__ */ jsxs6("span", { className: "truncate", title: "A compound clip plays its sequence as one picture and sound; its clips cannot be edited here yet", children: [
1182
1217
  project.sequences?.find((q) => q.id === clip.sequence)?.name ?? clip.sequence,
1183
1218
  " \xB7 from ",
1184
1219
  formatVideoSeconds2(clip.in ?? 0)
@@ -1187,7 +1222,7 @@ function ClipInspector({ controller, className = "" }) {
1187
1222
  ] }),
1188
1223
  clip.type === "effect" && /* @__PURE__ */ jsx6(Row, { label: "Effect", name: "effect", children: /* @__PURE__ */ jsx6("span", { className: "truncate text-xs", title: "Change its controls in the Effects panel", children: clip.name ?? clip.effect }) }),
1189
1224
  clip.type === "color" && /* @__PURE__ */ jsx6(Row, { label: "Colour", name: "color", children: /* @__PURE__ */ jsx6(Commit, { value: clip.color, "aria-label": "Colour", disabled, onCommit: (raw) => raw.trim() && set("color", raw.trim(), "Change colour") }) }),
1190
- /* @__PURE__ */ jsx6(Row, { label: "Transition in", name: "transition", children: /* @__PURE__ */ jsxs5(
1225
+ /* @__PURE__ */ jsx6(Row, { label: "Transition in", name: "transition", children: /* @__PURE__ */ jsxs6(
1191
1226
  "select",
1192
1227
  {
1193
1228
  className: field,
@@ -1255,23 +1290,23 @@ function ClipInspector({ controller, className = "" }) {
1255
1290
  }
1256
1291
 
1257
1292
  // src/video-editor/MediaBin.tsx
1258
- import { useState as useState5 } from "react";
1293
+ import { useState as useState6 } from "react";
1259
1294
  import {
1260
1295
  formatVideoSeconds as formatVideoSeconds3,
1261
1296
  probeVideoMedia,
1262
1297
  videoAssetDropEdit,
1263
1298
  videoAssetKindOf
1264
1299
  } from "@pixerate/editor/video-editor";
1265
- import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1300
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1266
1301
  var btn3 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
1267
1302
  function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMedia, className = "" }) {
1268
1303
  const { project, readOnly } = useVideoEditorState(controller);
1269
1304
  const canEdit = editable && !readOnly;
1270
- const [url, setUrl] = useState5("");
1271
- const [urlKind, setUrlKind] = useState5("");
1272
- const [busy, setBusy] = useState5(0);
1273
- const [problem, setProblem] = useState5(null);
1274
- const [over, setOver] = useState5(false);
1305
+ const [url, setUrl] = useState6("");
1306
+ const [urlKind, setUrlKind] = useState6("");
1307
+ const [busy, setBusy] = useState6(0);
1308
+ const [problem, setProblem] = useState6(null);
1309
+ const [over, setOver] = useState6(false);
1275
1310
  const addSource = async (src, kind, name) => {
1276
1311
  setBusy((n) => n + 1);
1277
1312
  try {
@@ -1319,7 +1354,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
1319
1354
  if (added) controller.select([added]);
1320
1355
  }
1321
1356
  };
1322
- return /* @__PURE__ */ jsxs6(
1357
+ return /* @__PURE__ */ jsxs7(
1323
1358
  "div",
1324
1359
  {
1325
1360
  className: `flex flex-col gap-2 rounded ${over ? "ring-2 ring-rose-500/60" : ""} ${className}`,
@@ -1338,18 +1373,18 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
1338
1373
  },
1339
1374
  children: [
1340
1375
  /* @__PURE__ */ jsx7("div", { className: "text-xs font-medium", children: "Media" }),
1341
- project.assets.length ? /* @__PURE__ */ jsx7("ul", { className: "flex flex-col gap-1", "aria-label": "Media assets", children: project.assets.map((asset) => /* @__PURE__ */ jsxs6("li", { className: "flex items-center gap-2 text-xs", "data-asset": asset.id, children: [
1376
+ project.assets.length ? /* @__PURE__ */ jsx7("ul", { className: "flex flex-col gap-1", "aria-label": "Media assets", children: project.assets.map((asset) => /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-2 text-xs", "data-asset": asset.id, children: [
1342
1377
  /* @__PURE__ */ jsx7("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-asset-kind": "", children: asset.kind }),
1343
1378
  /* @__PURE__ */ jsx7("span", { className: "min-w-0 flex-1 truncate", title: asset.src, children: asset.name ?? asset.id }),
1344
1379
  asset.proxies?.length ? /* @__PURE__ */ jsx7("span", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", title: `Proxies: ${asset.proxies.map((p) => `${p.scale * 100}%`).join(", ")} (the preview can play these; exports use the original)`, "data-asset-proxies": "", children: "proxy" }) : null,
1345
1380
  asset.duration !== void 0 && /* @__PURE__ */ jsx7("span", { className: "tabular-nums text-muted-foreground", children: formatVideoSeconds3(asset.duration) }),
1346
1381
  editable && /* @__PURE__ */ jsx7("button", { type: "button", className: btn3, disabled: !canEdit, onClick: () => addToTimeline(asset), "data-add-to-timeline": "", children: "Add to timeline" })
1347
- ] }, asset.id)) }) : /* @__PURE__ */ jsxs6("p", { className: "text-xs text-muted-foreground", children: [
1382
+ ] }, asset.id)) }) : /* @__PURE__ */ jsxs7("p", { className: "text-xs text-muted-foreground", children: [
1348
1383
  "No media yet.",
1349
1384
  editable ? " Choose or drop files, or add a URL." : ""
1350
1385
  ] }),
1351
- editable && /* @__PURE__ */ jsxs6(Fragment4, { children: [
1352
- /* @__PURE__ */ jsxs6("label", { className: "flex flex-col gap-1 rounded border border-dashed border-border p-2 text-xs text-muted-foreground", children: [
1386
+ editable && /* @__PURE__ */ jsxs7(Fragment4, { children: [
1387
+ /* @__PURE__ */ jsxs7("label", { className: "flex flex-col gap-1 rounded border border-dashed border-border p-2 text-xs text-muted-foreground", children: [
1353
1388
  "Choose or drop video, audio or image files",
1354
1389
  /* @__PURE__ */ jsx7(
1355
1390
  "input",
@@ -1368,7 +1403,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
1368
1403
  }
1369
1404
  )
1370
1405
  ] }),
1371
- /* @__PURE__ */ jsxs6(
1406
+ /* @__PURE__ */ jsxs7(
1372
1407
  "form",
1373
1408
  {
1374
1409
  className: "flex items-center gap-1",
@@ -1388,7 +1423,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
1388
1423
  onChange: (e) => setUrl(e.target.value)
1389
1424
  }
1390
1425
  ),
1391
- /* @__PURE__ */ jsxs6("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", value: urlKind, disabled: !canEdit, "aria-label": "Media kind", onChange: (e) => setUrlKind(e.target.value), children: [
1426
+ /* @__PURE__ */ jsxs7("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", value: urlKind, disabled: !canEdit, "aria-label": "Media kind", onChange: (e) => setUrlKind(e.target.value), children: [
1392
1427
  /* @__PURE__ */ jsx7("option", { value: "", children: "Auto" }),
1393
1428
  /* @__PURE__ */ jsx7("option", { value: "video", children: "Video" }),
1394
1429
  /* @__PURE__ */ jsx7("option", { value: "audio", children: "Audio" }),
@@ -1407,7 +1442,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = probeVideoMe
1407
1442
  }
1408
1443
 
1409
1444
  // src/video-editor/TranscriptPanel.tsx
1410
- import React7, { useMemo as useMemo3, useState as useState6 } from "react";
1445
+ import React7, { useMemo as useMemo4, useState as useState7 } from "react";
1411
1446
  import {
1412
1447
  findVideoFillers,
1413
1448
  findVideoTranscriptPauses,
@@ -1417,16 +1452,16 @@ import {
1417
1452
  videoWordAt,
1418
1453
  videoWordsRange
1419
1454
  } from "@pixerate/editor/video-editor";
1420
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1455
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1421
1456
  var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1422
1457
  function TranscriptPanel({ controller, track, editable = true, className = "" }) {
1423
1458
  const state = useVideoEditorState(controller);
1424
1459
  const { project, time, readOnly } = state;
1425
1460
  const canEdit = editable && !readOnly;
1426
- const [anchor, setAnchor] = useState6(null);
1427
- const [focus, setFocus] = useState6(null);
1428
- const [message, setMessage] = useState6(null);
1429
- const words = useMemo3(() => {
1461
+ const [anchor, setAnchor] = useState7(null);
1462
+ const [focus, setFocus] = useState7(null);
1463
+ const [message, setMessage] = useState7(null);
1464
+ const words = useMemo4(() => {
1430
1465
  try {
1431
1466
  return videoTimelineTranscript(project, { track });
1432
1467
  } catch {
@@ -1452,8 +1487,8 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1452
1487
  setMessage(e instanceof Error ? e.message : String(e));
1453
1488
  }
1454
1489
  };
1455
- return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-panel": "", children: [
1456
- words.length > 0 ? /* @__PURE__ */ jsxs7(Fragment5, { children: [
1490
+ return /* @__PURE__ */ jsxs8("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-panel": "", children: [
1491
+ words.length > 0 ? /* @__PURE__ */ jsxs8(Fragment5, { children: [
1457
1492
  /* @__PURE__ */ jsx8(
1458
1493
  "div",
1459
1494
  {
@@ -1470,7 +1505,7 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1470
1505
  },
1471
1506
  children: words.map((w, i) => {
1472
1507
  const inSelection = selected !== null && i >= selected[0] && i <= selected[1];
1473
- return /* @__PURE__ */ jsxs7(React7.Fragment, { children: [
1508
+ return /* @__PURE__ */ jsxs8(React7.Fragment, { children: [
1474
1509
  /* @__PURE__ */ jsx8(
1475
1510
  "span",
1476
1511
  {
@@ -1497,16 +1532,16 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1497
1532
  })
1498
1533
  }
1499
1534
  ),
1500
- canEdit && /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-1", children: [
1535
+ canEdit && /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", children: [
1501
1536
  /* @__PURE__ */ jsx8("button", { type: "button", className: btn4, disabled: !selected, onClick: () => selected && cut([videoWordsRange(words, selected[0], selected[1])], "Cut words", "Select words to cut."), children: "Delete selected words" }),
1502
1537
  /* @__PURE__ */ jsx8("button", { type: "button", className: btn4, onClick: () => cut(findVideoFillers(words), "Remove fillers", "No filler words found."), children: "Remove fillers" }),
1503
1538
  /* @__PURE__ */ jsx8("button", { type: "button", className: btn4, onClick: () => cut(findVideoTranscriptPauses(words, { fps: project.fps }), "Tighten pauses", "No long pauses found."), children: "Tighten pauses" })
1504
1539
  ] })
1505
1540
  ] }) : /* @__PURE__ */ jsx8("p", { className: "text-muted-foreground", "data-transcript-empty": "", children: "No transcribed media on the timeline. Load a transcript (Whisper JSON, .srt or .vtt) for a video or audio asset to edit by text." }),
1506
- canEdit && sound.length > 0 && /* @__PURE__ */ jsxs7("details", { children: [
1541
+ canEdit && sound.length > 0 && /* @__PURE__ */ jsxs8("details", { children: [
1507
1542
  /* @__PURE__ */ jsx8("summary", { className: "cursor-pointer text-muted-foreground", children: "Transcripts" }),
1508
- /* @__PURE__ */ jsx8("ul", { className: "mt-1 space-y-1", children: sound.map((a) => /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-2", children: [
1509
- /* @__PURE__ */ jsxs7("span", { className: "min-w-0 flex-1 truncate", children: [
1543
+ /* @__PURE__ */ jsx8("ul", { className: "mt-1 space-y-1", children: sound.map((a) => /* @__PURE__ */ jsxs8("li", { className: "flex items-center gap-2", children: [
1544
+ /* @__PURE__ */ jsxs8("span", { className: "min-w-0 flex-1 truncate", children: [
1510
1545
  a.name ?? a.id,
1511
1546
  " ",
1512
1547
  a.transcript ? `\xB7 ${a.transcript.length} words` : ""
@@ -1519,7 +1554,7 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1519
1554
  }
1520
1555
 
1521
1556
  // src/video-editor/TranscriptEditor.tsx
1522
- import React8, { useState as useState7 } from "react";
1557
+ import React8, { useState as useState8 } from "react";
1523
1558
 
1524
1559
  // src/video-editor/useTranscriptVideo.ts
1525
1560
  import { useEffect as useEffect6, useRef as useRef5, useSyncExternalStore as useSyncExternalStore3 } from "react";
@@ -1540,7 +1575,7 @@ function useTranscriptVideoState(transcript) {
1540
1575
  }
1541
1576
 
1542
1577
  // src/video-editor/TranscriptEditor.tsx
1543
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1578
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1544
1579
  var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1545
1580
  var CHIP = {
1546
1581
  filler: "bg-amber-400/30 text-amber-700 dark:text-amber-300",
@@ -1551,12 +1586,12 @@ var KIND_LABEL = { filler: "filler", pause: "pause", repetition: "repeat" };
1551
1586
  function TranscriptEditor({ controller, track, planFirst = false, editable = true, className = "" }) {
1552
1587
  const transcript = useTranscriptVideoController(controller, { track, planFirst });
1553
1588
  const state = useTranscriptVideoState(transcript);
1554
- const [anchor, setAnchor] = useState7(null);
1589
+ const [anchor, setAnchor] = useState8(null);
1555
1590
  const canEdit = editable && state.editable;
1556
1591
  const { words, current, selection, disfluencies, flags } = state;
1557
1592
  if (!words.length)
1558
1593
  return /* @__PURE__ */ jsx9("p", { className: `text-xs text-muted-foreground ${className}`, "data-transcript-editor": "", "data-transcript-empty": "", children: "No transcribed media on the timeline. Attach a transcript (Whisper JSON, .srt or .vtt) to edit by text." });
1559
- return /* @__PURE__ */ jsxs8("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-editor": "", children: [
1594
+ return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-editor": "", children: [
1560
1595
  /* @__PURE__ */ jsx9(
1561
1596
  "div",
1562
1597
  {
@@ -1574,7 +1609,7 @@ function TranscriptEditor({ controller, track, planFirst = false, editable = tru
1574
1609
  children: words.map((w, i) => {
1575
1610
  const selected = !!selection && i >= selection[0] && i <= selection[1];
1576
1611
  const kinds = flags[i];
1577
- return /* @__PURE__ */ jsxs8(React8.Fragment, { children: [
1612
+ return /* @__PURE__ */ jsxs9(React8.Fragment, { children: [
1578
1613
  /* @__PURE__ */ jsx9(
1579
1614
  "span",
1580
1615
  {
@@ -1603,16 +1638,16 @@ function TranscriptEditor({ controller, track, planFirst = false, editable = tru
1603
1638
  })
1604
1639
  }
1605
1640
  ),
1606
- canEdit && /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
1641
+ canEdit && /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", children: [
1607
1642
  /* @__PURE__ */ jsx9("button", { type: "button", className: btn5, disabled: !selection, onClick: () => transcript.deleteSelection(), "data-delete-words": "", children: planFirst ? "Propose deleting words" : "Delete words" }),
1608
- /* @__PURE__ */ jsxs8("button", { type: "button", className: btn5, disabled: !disfluencies.length, onClick: () => transcript.planCleanup(), "data-plan-cleanup": "", children: [
1643
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: btn5, disabled: !disfluencies.length, onClick: () => transcript.planCleanup(), "data-plan-cleanup": "", children: [
1609
1644
  "Plan cleanup (",
1610
1645
  disfluencies.length,
1611
1646
  ")"
1612
1647
  ] })
1613
1648
  ] }),
1614
- disfluencies.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "flex flex-wrap gap-1", "aria-label": "Disfluencies", "data-disfluencies": "", children: disfluencies.map((d, i) => /* @__PURE__ */ jsxs8("li", { className: `flex items-center gap-1 rounded px-1 ${CHIP[d.kind]}`, "data-disfluency-chip": d.kind, children: [
1615
- /* @__PURE__ */ jsxs8("button", { type: "button", className: "tabular-nums", title: "Go to it", onClick: () => controller.seek(d.from), children: [
1649
+ disfluencies.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "flex flex-wrap gap-1", "aria-label": "Disfluencies", "data-disfluencies": "", children: disfluencies.map((d, i) => /* @__PURE__ */ jsxs9("li", { className: `flex items-center gap-1 rounded px-1 ${CHIP[d.kind]}`, "data-disfluency-chip": d.kind, children: [
1650
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "tabular-nums", title: "Go to it", onClick: () => controller.seek(d.from), children: [
1616
1651
  KIND_LABEL[d.kind],
1617
1652
  ": ",
1618
1653
  d.kind === "pause" ? `${((d.to - d.from) / 1e3).toFixed(1)} s` : d.text
@@ -1624,29 +1659,29 @@ function TranscriptEditor({ controller, track, planFirst = false, editable = tru
1624
1659
  }
1625
1660
 
1626
1661
  // src/video-editor/EditPlanPreview.tsx
1627
- import { useState as useState8 } from "react";
1662
+ import { useState as useState9 } from "react";
1628
1663
  import { describeVideoEditPlan, formatVideoSeconds as formatVideoSeconds4 } from "@pixerate/editor/video-editor";
1629
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1664
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1630
1665
  var btn6 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
1631
1666
  function EditPlanPreview({ controller, editable = true, className = "" }) {
1632
1667
  const state = useVideoEditorState(controller);
1633
- const [message, setMessage] = useState8(null);
1668
+ const [message, setMessage] = useState9(null);
1634
1669
  if (!state.plans.length) return null;
1635
1670
  const total = Math.max(1, state.duration);
1636
- return /* @__PURE__ */ jsxs9("section", { className: `flex flex-col gap-2 rounded-md border border-amber-500/50 bg-amber-500/5 p-2 text-xs ${className}`, "aria-label": "Proposed edits", "data-edit-plans": "", children: [
1671
+ return /* @__PURE__ */ jsxs10("section", { className: `flex flex-col gap-2 rounded-md border border-amber-500/50 bg-amber-500/5 p-2 text-xs ${className}`, "aria-label": "Proposed edits", "data-edit-plans": "", children: [
1637
1672
  state.plans.map((plan) => {
1638
1673
  const s = plan.summary;
1639
1674
  const stale = controller.isPlanStale(plan.id);
1640
- return /* @__PURE__ */ jsxs9("article", { className: "flex flex-col gap-1", "data-edit-plan": plan.id, children: [
1641
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
1675
+ return /* @__PURE__ */ jsxs10("article", { className: "flex flex-col gap-1", "data-edit-plan": plan.id, children: [
1676
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1642
1677
  /* @__PURE__ */ jsx10("h3", { className: "flex-1 font-semibold", children: plan.title }),
1643
- /* @__PURE__ */ jsxs9("span", { className: `tabular-nums ${s.durationDelta < 0 ? "text-emerald-600" : "text-muted-foreground"}`, "data-plan-delta": "", children: [
1678
+ /* @__PURE__ */ jsxs10("span", { className: `tabular-nums ${s.durationDelta < 0 ? "text-emerald-600" : "text-muted-foreground"}`, "data-plan-delta": "", children: [
1644
1679
  s.durationDelta < 0 ? "\u2212" : s.durationDelta > 0 ? "+" : "\xB1",
1645
1680
  formatVideoSeconds4(Math.abs(s.durationDelta))
1646
1681
  ] })
1647
1682
  ] }),
1648
1683
  plan.description && /* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: plan.description }),
1649
- /* @__PURE__ */ jsxs9("p", { className: "text-muted-foreground", "data-plan-summary": "", children: [
1684
+ /* @__PURE__ */ jsxs10("p", { className: "text-muted-foreground", "data-plan-summary": "", children: [
1650
1685
  describeVideoEditPlan(plan),
1651
1686
  " \xB7 ",
1652
1687
  formatVideoSeconds4(s.durationBefore),
@@ -1665,7 +1700,7 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
1665
1700
  },
1666
1701
  i
1667
1702
  )) }),
1668
- s.newIssues.length > 0 && /* @__PURE__ */ jsxs9("p", { className: "text-amber-600", children: [
1703
+ s.newIssues.length > 0 && /* @__PURE__ */ jsxs10("p", { className: "text-amber-600", children: [
1669
1704
  "It would add ",
1670
1705
  s.newIssues.length,
1671
1706
  " problem",
@@ -1674,7 +1709,7 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
1674
1709
  s.newIssues[0].message
1675
1710
  ] }),
1676
1711
  stale && /* @__PURE__ */ jsx10("p", { className: "text-amber-600", "data-plan-stale": "", children: "The project changed since this plan was made; it is checked again when accepted." }),
1677
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-1", children: [
1712
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-1", children: [
1678
1713
  /* @__PURE__ */ jsx10(
1679
1714
  "button",
1680
1715
  {
@@ -1701,15 +1736,31 @@ function EditPlanPreview({ controller, editable = true, className = "" }) {
1701
1736
  import { useEffect as useEffect8 } from "react";
1702
1737
 
1703
1738
  // src/video-editor/VideoEffectsPanel.tsx
1704
- import { useEffect as useEffect7, useState as useState9 } from "react";
1739
+ import { useEffect as useEffect7, useState as useState10 } from "react";
1705
1740
  import {
1706
1741
  findVideoClip as findVideoClip3,
1707
1742
  isVideoKeyframes,
1708
1743
  openVideoClipEffectAuthoring
1709
1744
  } from "@pixerate/editor/video-editor";
1710
- import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1745
+ import { pathControlsOf } from "@pixerate/editor/effects";
1746
+ import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
1711
1747
  var btn7 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1712
1748
  var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => isVideoKeyframes(v)).map(([k]) => k));
1749
+ function PathControls({ controller, clip, instance, provider, disabled, report }) {
1750
+ const state = useVideoEditorState(controller);
1751
+ const [words, setWords] = useState10("");
1752
+ const drawing = state.pathDrawing?.clip === clip.id && state.pathDrawing.instance === instance;
1753
+ return /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-1", "data-effect-part": "path", children: [
1754
+ /* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: "Path" }),
1755
+ /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled, "aria-pressed": drawing, title: "Draw the path on the preview", onClick: () => drawing ? controller.cancelPathDrawing() : controller.startPathDrawing({ clip: clip.id, instance }), children: drawing ? "Drawing\u2026 (Esc)" : "Draw path" }),
1756
+ /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !clip.mask, title: clip.mask ? "Run it along this clip's mask outline" : "Give the clip a mask first", onClick: () => report(controller.setEffectPath(clip.id, instance, { mask: { clip: clip.id } })), children: "Use mask outline" }),
1757
+ provider.pathFromText && /* @__PURE__ */ jsxs11(Fragment6, { children: [
1758
+ /* @__PURE__ */ jsx11("input", { className: "w-24 rounded border border-border bg-transparent px-1 py-0.5", "aria-label": "Words to write along the path", placeholder: "Words", value: words, disabled, onChange: (e) => setWords(e.currentTarget.value) }),
1759
+ /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !words.trim(), onClick: () => report(controller.setEffectPath(clip.id, instance, { text: words })), children: "Write" })
1760
+ ] }),
1761
+ /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled, onClick: () => report(controller.setEffectPath(clip.id, instance, { d: "" })), children: "Clear path" })
1762
+ ] });
1763
+ }
1713
1764
  function EffectControls({
1714
1765
  provider,
1715
1766
  effect,
@@ -1717,25 +1768,29 @@ function EffectControls({
1717
1768
  values,
1718
1769
  disabled,
1719
1770
  onChange,
1720
- onPreset
1771
+ onPreset,
1772
+ path
1721
1773
  }) {
1722
1774
  const { description, error } = useEffectDescription(provider, effect);
1723
- if (!provider) return /* @__PURE__ */ jsxs10("p", { className: "text-[11px] text-muted-foreground", children: [
1775
+ if (!provider) return /* @__PURE__ */ jsxs11("p", { className: "text-[11px] text-muted-foreground", children: [
1724
1776
  'No effects provider: "',
1725
1777
  name ?? effect,
1726
1778
  '" is kept and shown as a placeholder.'
1727
1779
  ] });
1728
1780
  if (error) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-500", children: error });
1729
1781
  if (!description) return /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
1730
- return /* @__PURE__ */ jsx11(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
1782
+ return /* @__PURE__ */ jsxs11(Fragment6, { children: [
1783
+ path && pathControlsOf(description).length > 0 && /* @__PURE__ */ jsx11(PathControls, { ...path, provider, disabled }),
1784
+ /* @__PURE__ */ jsx11(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset })
1785
+ ] });
1731
1786
  }
1732
1787
  function VideoEffectsPanel({ controller, className = "" }) {
1733
1788
  const state = useVideoEditorState(controller);
1734
1789
  const provider = state.effectsProvider;
1735
- const [browse, setBrowse] = useState9(null);
1736
- const [message, setMessage] = useState9(null);
1737
- const [open, setOpen] = useState9(null);
1738
- const [authoring, setAuthoring] = useState9(null);
1790
+ const [browse, setBrowse] = useState10(null);
1791
+ const [message, setMessage] = useState10(null);
1792
+ const [open, setOpen] = useState10(null);
1793
+ const [authoring, setAuthoring] = useState10(null);
1739
1794
  useEffect7(() => () => authoring?.dispose(), [authoring]);
1740
1795
  const selected = state.selection[0];
1741
1796
  const at = selected ? findVideoClip3(state.project, selected) : null;
@@ -1747,8 +1802,8 @@ function VideoEffectsPanel({ controller, className = "" }) {
1747
1802
  if (!track) return setMessage("Add a video track first.");
1748
1803
  report(controller.addEffectClip(track, effect, { start: Math.round(state.time), mode: "overwrite" }).then((r) => (r.ok && r.clip && controller.select([r.clip]), r)));
1749
1804
  };
1750
- return /* @__PURE__ */ jsxs10("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
1751
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
1805
+ return /* @__PURE__ */ jsxs11("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
1806
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
1752
1807
  /* @__PURE__ */ jsx11("h3", { className: "flex-1 font-semibold", children: "Effects" }),
1753
1808
  /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
1754
1809
  ] }),
@@ -1756,8 +1811,8 @@ function VideoEffectsPanel({ controller, className = "" }) {
1756
1811
  browse === "generator" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
1757
1812
  /* @__PURE__ */ jsx11(EffectTemplates, { provider, disabled, fillLabel: "Insert template", onFill: (t, v) => controller.fillTemplate(t, v, { at: Math.round(state.time) }).then((r) => (r.ok && r.notes.length && setMessage(r.notes.join(" ")), r)) }),
1758
1813
  !clip && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
1759
- clip && /* @__PURE__ */ jsxs10(Fragment6, { children: [
1760
- clip.type === "effect" && /* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "generator", children: [
1814
+ clip && /* @__PURE__ */ jsxs11(Fragment6, { children: [
1815
+ clip.type === "effect" && /* @__PURE__ */ jsxs11("div", { className: "space-y-1", "data-effect-part": "generator", children: [
1761
1816
  /* @__PURE__ */ jsx11("div", { className: "font-medium", children: clip.name ?? clip.effect }),
1762
1817
  /* @__PURE__ */ jsx11(
1763
1818
  EffectControls,
@@ -1768,12 +1823,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
1768
1823
  values: clip.values,
1769
1824
  disabled,
1770
1825
  onChange: (k, v, gesture) => report(controller.updateEffectValues(clip.id, "generator", { [k]: v }, { merge: gesture ?? void 0 })),
1771
- onPreset: (values) => report(controller.updateEffectValues(clip.id, "generator", values))
1826
+ onPreset: (values) => report(controller.updateEffectValues(clip.id, "generator", values)),
1827
+ path: { controller, clip, instance: "generator", report }
1772
1828
  }
1773
1829
  )
1774
1830
  ] }),
1775
- /* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "transition", children: [
1776
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
1831
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-1", "data-effect-part": "transition", children: [
1832
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
1777
1833
  /* @__PURE__ */ jsx11("span", { className: "flex-1 font-medium", children: "Transition in" }),
1778
1834
  clip.transition?.type === "effect" ? /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
1779
1835
  ] }),
@@ -1791,14 +1847,14 @@ function VideoEffectsPanel({ controller, className = "" }) {
1791
1847
  }
1792
1848
  )
1793
1849
  ] }),
1794
- /* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "stack", children: [
1795
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
1850
+ /* @__PURE__ */ jsxs11("div", { className: "space-y-1", "data-effect-part": "stack", children: [
1851
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
1796
1852
  /* @__PURE__ */ jsx11("span", { className: "flex-1 font-medium", children: "On this clip" }),
1797
1853
  /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
1798
1854
  ] }),
1799
1855
  browse === "clip" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
1800
- /* @__PURE__ */ jsx11("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ jsxs10("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
1801
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
1856
+ /* @__PURE__ */ jsx11("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ jsxs11("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
1857
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
1802
1858
  /* @__PURE__ */ jsx11("input", { type: "checkbox", checked: e.enabled !== false, disabled, "aria-label": `${e.name ?? e.effect} on`, onChange: (ev) => report(controller.updateClipEffect(clip.id, e.id, { enabled: ev.currentTarget.checked })) }),
1803
1859
  /* @__PURE__ */ jsx11("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.id, onClick: () => setOpen(open === e.id ? null : e.id), children: e.name ?? e.effect }),
1804
1860
  /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled: disabled || i === 0, "aria-label": "Move up", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i - 1 })), children: "\u2191" }),
@@ -1821,8 +1877,8 @@ function VideoEffectsPanel({ controller, className = "" }) {
1821
1877
  ),
1822
1878
  /* @__PURE__ */ jsx11("button", { type: "button", className: btn7, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
1823
1879
  ] }),
1824
- open === e.id && /* @__PURE__ */ jsxs10("div", { className: "mt-1 space-y-2", children: [
1825
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
1880
+ open === e.id && /* @__PURE__ */ jsxs11("div", { className: "mt-1 space-y-2", children: [
1881
+ /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
1826
1882
  /* @__PURE__ */ jsx11("span", { className: "w-14 text-[11px]", children: "Opacity" }),
1827
1883
  /* @__PURE__ */ jsx11(
1828
1884
  "input",
@@ -1848,7 +1904,8 @@ function VideoEffectsPanel({ controller, className = "" }) {
1848
1904
  values: e.values,
1849
1905
  disabled,
1850
1906
  onChange: (k, v, gesture) => report(controller.updateClipEffect(clip.id, e.id, { values: { [k]: v } }, { merge: gesture ?? void 0 })),
1851
- onPreset: (values) => report(controller.updateClipEffect(clip.id, e.id, { values }))
1907
+ onPreset: (values) => report(controller.updateClipEffect(clip.id, e.id, { values })),
1908
+ path: { controller, clip, instance: e.id, report }
1852
1909
  }
1853
1910
  )
1854
1911
  ] })
@@ -1856,9 +1913,9 @@ function VideoEffectsPanel({ controller, className = "" }) {
1856
1913
  !clip.effects?.length && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
1857
1914
  ] })
1858
1915
  ] }),
1859
- authoring && /* @__PURE__ */ jsxs10("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
1916
+ authoring && /* @__PURE__ */ jsxs11("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
1860
1917
  /* @__PURE__ */ jsx11(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
1861
- /* @__PURE__ */ jsxs10("div", { className: "flex gap-1", children: [
1918
+ /* @__PURE__ */ jsxs11("div", { className: "flex gap-1", children: [
1862
1919
  /* @__PURE__ */ jsx11(
1863
1920
  "button",
1864
1921
  {
@@ -1881,7 +1938,7 @@ function VideoEffectsPanel({ controller, className = "" }) {
1881
1938
  }
1882
1939
 
1883
1940
  // src/video-editor/VideoEditor.tsx
1884
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1941
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1885
1942
  function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, transcriptMode = "panel", showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
1886
1943
  const { controller, state } = useVideoEditor(given ?? options ?? {});
1887
1944
  useEffects(controller, effects);
@@ -1894,15 +1951,15 @@ function VideoEditor({ controller: given, options, editable = true, pxPerSecond,
1894
1951
  }, [controller, editable]);
1895
1952
  const { issues } = state;
1896
1953
  const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ jsx12("ul", { className: "space-y-0.5 text-xs", "aria-label": "Video issues", "data-video-issues": "", children: issues.map((issue, i) => /* @__PURE__ */ jsx12("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", "data-issue": issue.code, children: issue.message }, i)) });
1897
- return /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
1898
- /* @__PURE__ */ jsxs11("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
1954
+ return /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
1955
+ /* @__PURE__ */ jsxs12("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
1899
1956
  editable && /* @__PURE__ */ jsx12(MediaBin, { controller, className: "min-w-0" }),
1900
- /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-col gap-2", children: [
1957
+ /* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-col gap-2", children: [
1901
1958
  /* @__PURE__ */ jsx12(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
1902
1959
  /* @__PURE__ */ jsx12(VideoTransport, { controller, editable }),
1903
1960
  showScopes && /* @__PURE__ */ jsx12(VideoScopes, { controller })
1904
1961
  ] }),
1905
- editable && /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-col gap-3", children: [
1962
+ editable && /* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-col gap-3", children: [
1906
1963
  /* @__PURE__ */ jsx12(ClipInspector, { controller, className: "min-w-0" }),
1907
1964
  effectsShown && /* @__PURE__ */ jsx12(VideoEffectsPanel, { controller, className: "min-w-0" })
1908
1965
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.163.0",
3
+ "version": "0.164.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -254,7 +254,7 @@
254
254
  "dependencies": {},
255
255
  "peerDependencies": {
256
256
  "@dagrejs/dagre": "^1.1.8",
257
- "@pixerate/editor": ">=0.241.0 <1.0.0-0",
257
+ "@pixerate/editor": ">=0.242.0 <1.0.0-0",
258
258
  "@tiptap/core": "^2.27.3",
259
259
  "@tiptap/extension-bubble-menu": "^2.27.3",
260
260
  "@tiptap/extension-placeholder": "^2.27.3",
@@ -305,7 +305,7 @@
305
305
  "tsup": "^9.0.0",
306
306
  "typescript": "^5.7.3",
307
307
  "vitest": "^5.0.5",
308
- "@pixerate/editor": "0.241.0"
308
+ "@pixerate/editor": "0.242.0"
309
309
  },
310
310
  "scripts": {
311
311
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",