@pixerate/editor-react 0.91.1 → 0.93.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/animation-editor/AnimationEditor.d.cts +11 -1
  2. package/dist/animation-editor/AnimationEditor.d.ts +11 -1
  3. package/dist/animation-editor/index.cjs +494 -366
  4. package/dist/animation-editor/index.js +48 -4
  5. package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
  6. package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
  7. package/dist/canvas/index.cjs +1033 -893
  8. package/dist/canvas/index.d.cts +2 -0
  9. package/dist/canvas/index.d.ts +2 -0
  10. package/dist/canvas/index.js +125 -74
  11. package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
  12. package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
  13. package/dist/chart/ChartEditor.d.cts +12 -1
  14. package/dist/chart/ChartEditor.d.ts +12 -1
  15. package/dist/chart/index.cjs +187 -29
  16. package/dist/chart/index.js +74 -10
  17. package/dist/{chunk-SMMO7CZB.js → chunk-6YRSQW2V.js} +84 -2
  18. package/dist/chunk-7I73DW4V.js +43 -0
  19. package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
  20. package/dist/chunk-IPVWWVSF.js +96 -0
  21. package/dist/hooks/useAgentToolProvider.d.cts +6 -2
  22. package/dist/hooks/useAgentToolProvider.d.ts +6 -2
  23. package/dist/image-editor/ImageEditor.d.cts +10 -0
  24. package/dist/image-editor/ImageEditor.d.ts +10 -0
  25. package/dist/image-editor/index.cjs +1028 -864
  26. package/dist/image-editor/index.js +2 -1
  27. package/dist/index.cjs +2070 -1812
  28. package/dist/index.d.cts +1 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +21 -3
  31. package/dist/paint-editor/PaintEditor.d.cts +12 -1
  32. package/dist/paint-editor/PaintEditor.d.ts +12 -1
  33. package/dist/paint-editor/index.cjs +319 -164
  34. package/dist/paint-editor/index.js +84 -11
  35. package/dist/parameters/ParametersPanel.d.cts +11 -1
  36. package/dist/parameters/ParametersPanel.d.ts +11 -1
  37. package/dist/parameters/index.cjs +190 -41
  38. package/dist/parameters/index.js +23 -4
  39. package/dist/playback/AgentPlaybackContext.d.cts +9 -0
  40. package/dist/playback/AgentPlaybackContext.d.ts +9 -0
  41. package/dist/playback/PresenceLayer.d.cts +28 -0
  42. package/dist/playback/PresenceLayer.d.ts +28 -0
  43. package/dist/playback/index.d.cts +4 -0
  44. package/dist/playback/index.d.ts +4 -0
  45. package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
  46. package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
  47. package/dist/playback/usePlaybackSurface.d.cts +11 -0
  48. package/dist/playback/usePlaybackSurface.d.ts +11 -0
  49. package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
  50. package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
  51. package/dist/spreadsheet/index.cjs +443 -313
  52. package/dist/spreadsheet/index.js +2 -1
  53. package/dist/vector/VectorCanvas.d.cts +11 -1
  54. package/dist/vector/VectorCanvas.d.ts +11 -1
  55. package/dist/vector/index.cjs +946 -826
  56. package/dist/vector/index.js +42 -3
  57. package/dist/video-editor/VideoEditor.d.cts +6 -1
  58. package/dist/video-editor/VideoEditor.d.ts +6 -1
  59. package/dist/video-editor/VideoTimeline.d.cts +11 -1
  60. package/dist/video-editor/VideoTimeline.d.ts +11 -1
  61. package/dist/video-editor/index.cjs +463 -332
  62. package/dist/video-editor/index.js +53 -5
  63. package/package.json +3 -3
@@ -249,9 +249,98 @@ function VideoTransport({ controller, editable = true, className = "" }) {
249
249
  }
250
250
 
251
251
  // src/video-editor/VideoTimeline.tsx
252
- var import_react4 = require("react");
252
+ var import_react7 = require("react");
253
253
  var import_video_editor5 = require("@pixerate/editor/video-editor");
254
+
255
+ // src/playback/AgentPlaybackContext.tsx
256
+ var import_react4 = require("react");
254
257
  var import_jsx_runtime4 = require("react/jsx-runtime");
258
+ var AgentPlaybackContext = (0, import_react4.createContext)(null);
259
+ function useAgentPlayback() {
260
+ return (0, import_react4.useContext)(AgentPlaybackContext);
261
+ }
262
+
263
+ // src/playback/usePlaybackSurface.ts
264
+ var import_react5 = require("react");
265
+ var import_tools = require("@pixerate/editor/tools");
266
+ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
267
+ const ambient = useAgentPlayback();
268
+ const target = playback === void 0 ? ambient : playback;
269
+ const [ownPresence] = (0, import_react5.useState)(() => new import_tools.PresenceStore());
270
+ const presence = sharedPresence ?? ownPresence;
271
+ const latest = (0, import_react5.useRef)(options);
272
+ latest.current = options;
273
+ (0, import_react5.useEffect)(() => {
274
+ if (!target || !id) return;
275
+ const o = () => latest.current;
276
+ const surface = {
277
+ presence,
278
+ locate: (ref) => o().locate?.(ref) ?? null,
279
+ bounds: () => o().bounds?.() ?? null,
280
+ visible: () => o().visible?.() ?? true,
281
+ toViewport: (p) => o().toViewport?.(p) ?? p,
282
+ fromViewport: (p) => o().fromViewport?.(p) ?? p,
283
+ beginGesture: (key) => o().beginGesture?.(key),
284
+ endGesture: () => o().endGesture?.(),
285
+ reveal: () => o().reveal?.(),
286
+ open: (ref) => o().open?.(ref),
287
+ get defaultKind() {
288
+ return o().defaultKind;
289
+ }
290
+ };
291
+ const detach = target.attach(id, surface);
292
+ return () => {
293
+ detach();
294
+ for (const a of presence.getState().actors) presence.remove(a.id);
295
+ };
296
+ }, [target, id, presence]);
297
+ return presence;
298
+ }
299
+
300
+ // src/playback/PresenceLayer.tsx
301
+ var import_react6 = __toESM(require("react"), 1);
302
+ var import_jsx_runtime5 = require("react/jsx-runtime");
303
+ function PresenceLayer({ presence, viewport, className = "" }) {
304
+ const { actors } = (0, import_react6.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
305
+ if (!actors.length) return null;
306
+ const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
307
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
308
+ "div",
309
+ {
310
+ className: `pixerate-presence ${className}`.trim(),
311
+ "aria-hidden": "true",
312
+ "data-testid": "presence-layer",
313
+ style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
314
+ children: actors.map((a) => {
315
+ const at = map(a);
316
+ const ring = a.focus && (() => {
317
+ const tl = map(a.focus);
318
+ const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
319
+ return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
320
+ })();
321
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react6.default.Fragment, { children: [
322
+ ring && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
323
+ "div",
324
+ {
325
+ "data-actor-focus": a.id,
326
+ style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
327
+ }
328
+ ),
329
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
330
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
331
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
332
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
333
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
334
+ ] })
335
+ ] })
336
+ ] }, a.id);
337
+ })
338
+ }
339
+ );
340
+ }
341
+
342
+ // src/video-editor/VideoTimeline.tsx
343
+ var import_jsx_runtime6 = require("react/jsx-runtime");
255
344
  var HEADER = 150;
256
345
  var RULER = 24;
257
346
  var ROW = 44;
@@ -260,23 +349,23 @@ var DRAG_THRESHOLD = 3;
260
349
  var MIN_ZOOM = 10;
261
350
  var MAX_ZOOM = 400;
262
351
  function ClipWaveform({ controller, clip, asset, width, height }) {
263
- const peaks = (0, import_react4.useSyncExternalStore)(
352
+ const peaks = (0, import_react7.useSyncExternalStore)(
264
353
  (notify) => controller.audioPeaks.subscribe(notify),
265
354
  () => controller.audioPeaks.peek(asset),
266
355
  () => void 0
267
356
  );
268
- (0, import_react4.useEffect)(() => {
357
+ (0, import_react7.useEffect)(() => {
269
358
  controller.audioPeaks.load(asset).catch(() => {
270
359
  });
271
360
  }, [controller, asset]);
272
- const d = (0, import_react4.useMemo)(() => peaks ? (0, import_video_editor5.videoClipWaveformPath)(clip, peaks, width, height) : "", [peaks, clip, width, height]);
361
+ const d = (0, import_react7.useMemo)(() => peaks ? (0, import_video_editor5.videoClipWaveformPath)(clip, peaks, width, height) : "", [peaks, clip, width, height]);
273
362
  if (!d) return null;
274
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { className: "pointer-events-none absolute inset-0", width, height, "aria-hidden": "true", "data-waveform": clip.id, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d, fill: "currentColor", fillOpacity: 0.45 }) });
363
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { className: "pointer-events-none absolute inset-0", width, height, "aria-hidden": "true", "data-waveform": clip.id, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d, fill: "currentColor", fillOpacity: 0.45 }) });
275
364
  }
276
365
  var isField = (el) => el instanceof HTMLElement && /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);
277
366
  function useCachedRanges(controller, project, px) {
278
- const [ranges, setRanges] = (0, import_react4.useState)([]);
279
- (0, import_react4.useEffect)(() => {
367
+ const [ranges, setRanges] = (0, import_react7.useState)([]);
368
+ (0, import_react7.useEffect)(() => {
280
369
  const cache = controller.frameCache;
281
370
  if (!cache) return setRanges([]);
282
371
  let timer = null;
@@ -295,19 +384,60 @@ function useCachedRanges(controller, project, px) {
295
384
  }, [controller, project, px]);
296
385
  return ranges;
297
386
  }
298
- function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable = true, waveforms = "audio", className = "" }) {
387
+ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable = true, waveforms = "audio", className = "", playback, playbackId = "video", onPlaybackReveal }) {
299
388
  const state = useVideoEditorState(controller);
300
389
  const { project, duration, time, selection, readOnly, error } = state;
301
- const [ownZoom, setOwnZoom] = (0, import_react4.useState)(pxPerSecond ?? 100);
390
+ const [ownZoom, setOwnZoom] = (0, import_react7.useState)(pxPerSecond ?? 100);
302
391
  const px = onPxPerSecondChange ? pxPerSecond ?? 100 : ownZoom;
303
392
  const canEdit = editable && !readOnly;
304
- const [drag, setDrag] = (0, import_react4.useState)(null);
305
- const dragRef = (0, import_react4.useRef)(null);
306
- const rows = (0, import_react4.useRef)(/* @__PURE__ */ new Map());
307
- const ruler = (0, import_react4.useRef)(null);
393
+ const [drag, setDrag] = (0, import_react7.useState)(null);
394
+ const dragRef = (0, import_react7.useRef)(null);
395
+ const rows = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
396
+ const ruler = (0, import_react7.useRef)(null);
308
397
  const assets = (0, import_video_editor5.videoAssetMap)(project);
309
398
  const sequences = (0, import_video_editor5.videoSequenceMap)(project);
310
399
  const msToPx = (ms) => ms * px / 1e3;
400
+ const wrapperRef = (0, import_react7.useRef)(null);
401
+ const pxRef = (0, import_react7.useRef)(px);
402
+ pxRef.current = px;
403
+ const ambientPlayback = useAgentPlayback();
404
+ const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
405
+ const rectIn = (el) => {
406
+ const box = wrapperRef.current?.getBoundingClientRect();
407
+ const r = el?.getBoundingClientRect();
408
+ return box && r && r.width > 0 ? { x: r.left - box.left, y: r.top - box.top, width: r.width, height: r.height } : null;
409
+ };
410
+ const q = (selector) => wrapperRef.current?.querySelector(selector);
411
+ const agentPresence = usePlaybackSurface(playing, playbackId, {
412
+ defaultKind: "clip",
413
+ locate: (ref) => {
414
+ if (ref.kind === "clip") return rectIn(q(`[data-clip="${CSS.escape(ref.id)}"]`));
415
+ if (ref.kind === "track") return rectIn(q(`[data-track-lane="${CSS.escape(ref.id)}"]`));
416
+ if (ref.kind === "marker") return rectIn(q(`[data-marker="${CSS.escape(ref.id)}"]`));
417
+ const at = (0, import_video_editor5.parseVideoTimeRef)(ref);
418
+ if (!at) return null;
419
+ const lane = at.track ? q(`[data-track-lane="${CSS.escape(at.track)}"]`) : at.clip ? q(`[data-clip="${CSS.escape(at.clip)}"]`)?.closest("[data-track-lane]") : ruler.current;
420
+ const row = rectIn(lane);
421
+ return row ? { x: row.x + at.time * pxRef.current / 1e3 - 3, y: row.y, width: 6, height: row.height } : null;
422
+ },
423
+ bounds: () => {
424
+ const r = wrapperRef.current?.getBoundingClientRect();
425
+ return r && r.width > 0 ? { x: 0, y: 0, width: r.width, height: r.height } : null;
426
+ },
427
+ visible: () => {
428
+ const r = wrapperRef.current?.getBoundingClientRect();
429
+ return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
430
+ },
431
+ toViewport: (p) => {
432
+ const r = wrapperRef.current?.getBoundingClientRect();
433
+ return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
434
+ },
435
+ fromViewport: (p) => {
436
+ const r = wrapperRef.current?.getBoundingClientRect();
437
+ return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
438
+ },
439
+ reveal: () => onPlaybackReveal?.()
440
+ });
311
441
  const span = Math.max(duration + 5e3, 1e4);
312
442
  const width = msToPx(span);
313
443
  const ticks = (0, import_video_editor5.videoRulerTicks)(span, px, project.fps);
@@ -337,10 +467,10 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
337
467
  dragRef.current = next;
338
468
  setDrag(next);
339
469
  };
340
- const live = (0, import_react4.useRef)({ planFor, selection });
470
+ const live = (0, import_react7.useRef)({ planFor, selection });
341
471
  live.current = { planFor, selection };
342
- const stopDrag = (0, import_react4.useRef)(null);
343
- (0, import_react4.useEffect)(() => () => stopDrag.current?.(), []);
472
+ const stopDrag = (0, import_react7.useRef)(null);
473
+ (0, import_react7.useEffect)(() => () => stopDrag.current?.(), []);
344
474
  const onClipPointerDown = (e, clip, track) => {
345
475
  if (e.button !== void 0 && e.button !== 0) return;
346
476
  e.stopPropagation();
@@ -418,7 +548,7 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
418
548
  }).filter((x) => x !== null)
419
549
  )
420
550
  }));
421
- const toggle = (track, field2, label) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
551
+ const toggle = (track, field2, label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
422
552
  "button",
423
553
  {
424
554
  type: "button",
@@ -432,12 +562,13 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
432
562
  children: field2 === "muted" ? "M" : field2 === "hidden" ? "H" : "L"
433
563
  }
434
564
  );
435
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, "data-video-timeline-wrapper": "", children: [
436
- !onPxPerSecondChange && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-2 self-end text-xs text-muted-foreground", children: [
565
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: wrapperRef, className: `relative flex flex-col gap-1 ${className}`, "data-video-timeline-wrapper": "", children: [
566
+ playing && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PresenceLayer, { presence: agentPresence }),
567
+ !onPxPerSecondChange && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 self-end text-xs text-muted-foreground", children: [
437
568
  "Zoom",
438
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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": "" })
569
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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": "" })
439
570
  ] }),
440
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
571
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
441
572
  "div",
442
573
  {
443
574
  className: "relative overflow-x-auto rounded border border-border outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50",
@@ -446,10 +577,10 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
446
577
  "aria-label": "Video timeline",
447
578
  onKeyDown,
448
579
  "data-video-timeline": "",
449
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", style: { width: HEADER + width }, children: [
450
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex", style: { height: RULER }, children: [
451
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sticky left-0 z-20 shrink-0 border-b border-r border-border bg-background", style: { width: HEADER } }),
452
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
580
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", style: { width: HEADER + width }, children: [
581
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex", style: { height: RULER }, children: [
582
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sticky left-0 z-20 shrink-0 border-b border-r border-border bg-background", style: { width: HEADER } }),
583
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
453
584
  "div",
454
585
  {
455
586
  ref: ruler,
@@ -472,9 +603,9 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
472
603
  if (e.buttons & 1) seekAt(e.clientX);
473
604
  },
474
605
  children: [
475
- ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `absolute bottom-0 w-px ${t.major ? "h-2.5 bg-muted-foreground/70" : "h-1 bg-muted-foreground/40"}`, style: { left: t.x }, "data-tick": t.time, children: t.label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "absolute -top-3.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time)),
476
- cached.map((r) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "pointer-events-none absolute bottom-0 h-[3px] bg-emerald-500/70", style: { left: msToPx(r.start), width: Math.max(1, msToPx(r.end - r.start)) }, title: "Frames cached: plays and scrubs without waiting", "data-cached-range": "" }, r.start)),
477
- (project.markers ?? []).map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
606
+ ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `absolute bottom-0 w-px ${t.major ? "h-2.5 bg-muted-foreground/70" : "h-1 bg-muted-foreground/40"}`, style: { left: t.x }, "data-tick": t.time, children: t.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute -top-3.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time)),
607
+ cached.map((r) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "pointer-events-none absolute bottom-0 h-[3px] bg-emerald-500/70", style: { left: msToPx(r.start), width: Math.max(1, msToPx(r.end - r.start)) }, title: "Frames cached: plays and scrubs without waiting", "data-cached-range": "" }, r.start)),
608
+ (project.markers ?? []).map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
478
609
  "div",
479
610
  {
480
611
  className: "absolute top-0 h-2.5 w-2.5 -translate-x-1/2 rotate-45",
@@ -488,19 +619,19 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
488
619
  }
489
620
  )
490
621
  ] }),
491
- placed.map(({ track, clips }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex border-b border-border last:border-b-0", style: { height: ROW }, "data-track": track.id, children: [
492
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
493
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-1", children: [
494
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "truncate font-medium", children: track.name ?? track.id }),
495
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-track-kind": "", children: track.kind })
622
+ placed.map(({ track, clips }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex border-b border-border last:border-b-0", style: { height: ROW }, "data-track": track.id, children: [
623
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("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: [
624
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
625
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate font-medium", children: track.name ?? track.id }),
626
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-track-kind": "", children: track.kind })
496
627
  ] }),
497
- editable && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex gap-1", children: [
628
+ editable && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-1", children: [
498
629
  toggle(track, "muted", "Mute"),
499
630
  track.kind === "video" && toggle(track, "hidden", "Hide"),
500
631
  toggle(track, "locked", "Lock")
501
632
  ] })
502
633
  ] }),
503
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
634
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
504
635
  "div",
505
636
  {
506
637
  ref: (el) => {
@@ -517,7 +648,7 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
517
648
  const asset = clip.type === "media" ? assets.get(clip.asset) : void 0;
518
649
  const selected = selection.includes(clip.id);
519
650
  const label = (0, import_video_editor5.videoClipLabel)(clip, asset, clip.type === "sequence" ? sequences.get(clip.sequence) : void 0);
520
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
651
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
521
652
  "div",
522
653
  {
523
654
  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" : ""}`,
@@ -537,15 +668,15 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
537
668
  "aria-selected": selected,
538
669
  onPointerDown: (e) => onClipPointerDown(e, clip, home),
539
670
  children: [
540
- (0, import_video_editor5.videoClipShowsWaveform)(clip, asset, waveforms) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClipWaveform, { controller, clip, asset, width: Math.max(2, msToPx(clip.duration)), height: ROW - 8 }),
541
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "pointer-events-none relative block truncate px-1.5 py-0.5 leading-4", children: label }),
542
- clip.transition && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
671
+ (0, import_video_editor5.videoClipShowsWaveform)(clip, asset, waveforms) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ClipWaveform, { controller, clip, asset, width: Math.max(2, msToPx(clip.duration)), height: ROW - 8 }),
672
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "pointer-events-none relative block truncate px-1.5 py-0.5 leading-4", children: label }),
673
+ clip.transition && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("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: [
543
674
  "\u29D3 ",
544
675
  clip.transition.type
545
676
  ] }),
546
- canEdit && !home.locked && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
547
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" }),
548
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" })
677
+ canEdit && !home.locked && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
678
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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" }),
679
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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" })
549
680
  ] })
550
681
  ]
551
682
  },
@@ -555,18 +686,18 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
555
686
  }
556
687
  )
557
688
  ] }, track.id)),
558
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "pointer-events-none absolute top-0 bottom-0 w-0.5 -translate-x-1/2 bg-rose-500", style: { left: HEADER + msToPx(time), zIndex: 15 }, "data-playhead": "" })
689
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "pointer-events-none absolute top-0 bottom-0 w-0.5 -translate-x-1/2 bg-rose-500", style: { left: HEADER + msToPx(time), zIndex: 15 }, "data-playhead": "" })
559
690
  ] })
560
691
  }
561
692
  ),
562
- error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-edit-error": "", children: error })
693
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-edit-error": "", children: error })
563
694
  ] });
564
695
  }
565
696
 
566
697
  // src/video-editor/ClipInspector.tsx
567
- var import_react5 = require("react");
698
+ var import_react8 = require("react");
568
699
  var import_video_editor6 = require("@pixerate/editor/video-editor");
569
- var import_jsx_runtime5 = require("react/jsx-runtime");
700
+ var import_jsx_runtime7 = require("react/jsx-runtime");
570
701
  var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
571
702
  var field = "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs disabled:opacity-50";
572
703
  var DEFAULT_TRANSITION = 500;
@@ -580,7 +711,7 @@ function Commit({
580
711
  if (raw !== value) onCommit(raw);
581
712
  };
582
713
  if (multiline)
583
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
714
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
584
715
  "textarea",
585
716
  {
586
717
  className: field,
@@ -592,10 +723,10 @@ function Commit({
592
723
  },
593
724
  value
594
725
  );
595
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { className: field, ...rest, defaultValue: value, onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(), onBlur: (e) => commit(e.currentTarget.value) }, value);
726
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { className: field, ...rest, defaultValue: value, onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(), onBlur: (e) => commit(e.currentTarget.value) }, value);
596
727
  }
597
728
  function LutControls({ controller, clip, disabled }) {
598
- const [message, setMessage] = (0, import_react5.useState)(null);
729
+ const [message, setMessage] = (0, import_react8.useState)(null);
599
730
  const lut = clip.grade?.lut;
600
731
  const apply = (setting, label) => {
601
732
  const r = controller.apply((0, import_video_editor6.videoLutEdits)(controller.getProject(), [clip.id], setting), label);
@@ -619,16 +750,16 @@ function LutControls({ controller, clip, disabled }) {
619
750
  setMessage(`${file.name}: ${e instanceof Error ? e.message : String(e)}`);
620
751
  }
621
752
  };
622
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
623
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "LUT", name: "grade.lut", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex min-w-0 gap-1", children: [
624
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Commit, { value: lut?.src ?? "", placeholder: "look.cube", "aria-label": "LUT file", disabled, onCommit: (raw) => void choose(raw.trim()) }),
625
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: `${btn2} cursor-pointer whitespace-nowrap`, title: "Load a .cube file", children: [
753
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
754
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "LUT", name: "grade.lut", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex min-w-0 gap-1", children: [
755
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Commit, { value: lut?.src ?? "", placeholder: "look.cube", "aria-label": "LUT file", disabled, onCommit: (raw) => void choose(raw.trim()) }),
756
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: `${btn2} cursor-pointer whitespace-nowrap`, title: "Load a .cube file", children: [
626
757
  "Load",
627
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "file", accept: ".cube", className: "sr-only", disabled, "aria-label": "Load a .cube LUT", onChange: (e) => void readFile(e.currentTarget.files?.[0]) })
758
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "file", accept: ".cube", className: "sr-only", disabled, "aria-label": "Load a .cube LUT", onChange: (e) => void readFile(e.currentTarget.files?.[0]) })
628
759
  ] }),
629
- lut && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn2, disabled, "aria-label": "Remove LUT", onClick: () => apply(null, "Remove LUT"), children: "\u2715" })
760
+ lut && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: btn2, disabled, "aria-label": "Remove LUT", onClick: () => apply(null, "Remove LUT"), children: "\u2715" })
630
761
  ] }) }),
631
- lut && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "LUT strength", name: "grade.lut.strength", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
762
+ lut && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "LUT strength", name: "grade.lut.strength", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
632
763
  Commit,
633
764
  {
634
765
  type: "number",
@@ -644,12 +775,12 @@ function LutControls({ controller, clip, disabled }) {
644
775
  }
645
776
  }
646
777
  ) }),
647
- message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-lut-error": "", children: message })
778
+ message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-lut-error": "", children: message })
648
779
  ] });
649
780
  }
650
781
  function Row({ label, name, children }) {
651
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2 text-xs", "data-field": name, children: [
652
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground", children: label }),
782
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2 text-xs", "data-field": name, children: [
783
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground", children: label }),
653
784
  children
654
785
  ] });
655
786
  }
@@ -657,7 +788,7 @@ function ClipInspector({ controller, className = "" }) {
657
788
  const state = useVideoEditorState(controller);
658
789
  const { project, selection, readOnly, time } = state;
659
790
  if (selection.length !== 1)
660
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: `text-xs text-muted-foreground ${className}`, "data-clip-inspector": "", children: selection.length ? `${selection.length} clips selected. Select one clip to edit it.` : "Select a clip on the timeline to edit it." });
791
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: `text-xs text-muted-foreground ${className}`, "data-clip-inspector": "", children: selection.length ? `${selection.length} clips selected. Select one clip to edit it.` : "Select a clip on the timeline to edit it." });
661
792
  const at = (0, import_video_editor6.findVideoClip)(project, selection[0]);
662
793
  if (!at) return null;
663
794
  const clip = at.clip;
@@ -674,24 +805,24 @@ function ClipInspector({ controller, className = "" }) {
674
805
  };
675
806
  const text = (key, label) => {
676
807
  const value = clip[key];
677
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Commit, { value: value === void 0 ? "" : String(value), "aria-label": label ?? key, disabled, onCommit: (raw) => set(key, raw.trim() || void 0, `Change ${label ?? key}`) });
808
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Commit, { value: value === void 0 ? "" : String(value), "aria-label": label ?? key, disabled, onCommit: (raw) => set(key, raw.trim() || void 0, `Change ${label ?? key}`) });
678
809
  };
679
810
  const number = (key, label, attrs = {}) => {
680
811
  const value = clip[key];
681
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Commit, { type: "number", value: value === void 0 ? "" : String(value), "aria-label": label, disabled, onCommit: (raw) => num(key, raw, `Change ${label.toLowerCase()}`), ...attrs });
812
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Commit, { type: "number", value: value === void 0 ? "" : String(value), "aria-label": label, disabled, onCommit: (raw) => num(key, raw, `Change ${label.toLowerCase()}`), ...attrs });
682
813
  };
683
814
  const transition = clip.transition;
684
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
685
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
686
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "font-medium", children: clip.type === "media" ? "Media clip" : clip.type === "text" ? "Title" : clip.type === "sequence" ? "Compound clip" : "Colour clip" }),
687
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { className: "text-muted-foreground", children: clip.id }),
688
- at.track.locked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-amber-500", children: "locked track" })
815
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-1.5 ${className}`, "data-clip-inspector": "", "data-clip-id": clip.id, children: [
816
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
817
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-medium", children: clip.type === "media" ? "Media clip" : clip.type === "text" ? "Title" : clip.type === "sequence" ? "Compound clip" : "Colour clip" }),
818
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className: "text-muted-foreground", children: clip.id }),
819
+ at.track.locked && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-amber-500", children: "locked track" })
689
820
  ] }),
690
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Name", name: "name", children: text("name", "Name") }),
691
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Start", name: "start", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor6.formatVideoSeconds)(clip.start) }) }),
692
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Duration", name: "duration", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor6.formatVideoSeconds)(clip.duration) }) }),
693
- (0, import_video_editor6.videoKeyframeRows)(project, clip.id, time).map((row) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: row.label, name: row.property, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex min-w-0 items-center gap-1", "data-keyframe-row": row.property, children: [
694
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
821
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Name", name: "name", children: text("name", "Name") }),
822
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Start", name: "start", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor6.formatVideoSeconds)(clip.start) }) }),
823
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Duration", name: "duration", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "tabular-nums text-xs", children: (0, import_video_editor6.formatVideoSeconds)(clip.duration) }) }),
824
+ (0, import_video_editor6.videoKeyframeRows)(project, clip.id, time).map((row) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: row.label, name: row.property, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex min-w-0 items-center gap-1", "data-keyframe-row": row.property, children: [
825
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
695
826
  Commit,
696
827
  {
697
828
  type: "number",
@@ -710,7 +841,7 @@ function ClipInspector({ controller, className = "" }) {
710
841
  }
711
842
  }
712
843
  ),
713
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
844
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
714
845
  "button",
715
846
  {
716
847
  type: "button",
@@ -727,11 +858,11 @@ function ClipInspector({ controller, className = "" }) {
727
858
  children: row.onKey ? "\u25C6" : "\u25C7"
728
859
  }
729
860
  ),
730
- row.keyed && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", "data-keyframe-count": row.property, children: row.keys })
861
+ row.keyed && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", "data-keyframe-count": row.property, children: row.keys })
731
862
  ] }) }, row.property)),
732
- at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Blend", name: "blend", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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: import_video_editor6.VIDEO_BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: m, children: import_video_editor6.VIDEO_BLEND_MODE_LABELS[m] }, m)) }) }),
733
- at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
734
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Look", name: "gradePreset", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
863
+ at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Blend", name: "blend", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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: import_video_editor6.VIDEO_BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: m, children: import_video_editor6.VIDEO_BLEND_MODE_LABELS[m] }, m)) }) }),
864
+ at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
865
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Look", name: "gradePreset", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
735
866
  "select",
736
867
  {
737
868
  className: field,
@@ -743,12 +874,12 @@ function ClipInspector({ controller, className = "" }) {
743
874
  if (grade) controller.apply({ op: "update_clip", clip: clip.id, set: { grade } }, `Apply ${e.target.value} look`);
744
875
  },
745
876
  children: [
746
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: clip.grade ? "Graded" : "None" }),
747
- import_video_editor6.VIDEO_GRADE_PRESET_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: name, children: name.replace(/-/g, " ") }, name))
877
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: clip.grade ? "Graded" : "None" }),
878
+ import_video_editor6.VIDEO_GRADE_PRESET_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: name, children: name.replace(/-/g, " ") }, name))
748
879
  ]
749
880
  }
750
881
  ) }),
751
- import_video_editor6.VIDEO_GRADE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: c.label, name: `grade.${c.key}`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
882
+ import_video_editor6.VIDEO_GRADE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: c.label, name: `grade.${c.key}`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
752
883
  Commit,
753
884
  {
754
885
  type: "number",
@@ -767,9 +898,9 @@ function ClipInspector({ controller, className = "" }) {
767
898
  }
768
899
  }
769
900
  ) }, c.key)),
770
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LutControls, { controller, clip, disabled })
901
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LutControls, { controller, clip, disabled })
771
902
  ] }),
772
- at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
903
+ at.track.kind === "video" && ["animateIn", "animateOut"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: key === "animateIn" ? "Animate in" : "Animate out", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
773
904
  "select",
774
905
  {
775
906
  className: field,
@@ -781,20 +912,20 @@ function ClipInspector({ controller, className = "" }) {
781
912
  set(key, effect ? { ...clip[key], effect } : void 0, key === "animateIn" ? "Change entrance" : "Change exit");
782
913
  },
783
914
  children: [
784
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "None" }),
785
- import_video_editor6.VIDEO_CLIP_ANIMATION_EFFECTS.map((effect) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: effect, children: import_video_editor6.VIDEO_CLIP_ANIMATION_LABELS[effect] }, effect))
915
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "None" }),
916
+ import_video_editor6.VIDEO_CLIP_ANIMATION_EFFECTS.map((effect) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: effect, children: import_video_editor6.VIDEO_CLIP_ANIMATION_LABELS[effect] }, effect))
786
917
  ]
787
918
  }
788
919
  ) }, key)),
789
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Fade in (ms)", name: "fadeIn", children: number("fadeIn", "Fade in", { min: 0, step: 100 }) }),
790
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Fade out (ms)", name: "fadeOut", children: number("fadeOut", "Fade out", { min: 0, step: 100 }) }),
791
- clip.type === "media" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
792
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Speed", name: "speed", children: clip.timeRemap ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-1", "data-ramped": "", children: [
793
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground", children: "ramped" }),
794
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" })
920
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Fade in (ms)", name: "fadeIn", children: number("fadeIn", "Fade in", { min: 0, step: 100 }) }),
921
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Fade out (ms)", name: "fadeOut", children: number("fadeOut", "Fade out", { min: 0, step: 100 }) }),
922
+ clip.type === "media" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
923
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Speed", name: "speed", children: clip.timeRemap ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex items-center gap-1", "data-ramped": "", children: [
924
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground", children: "ramped" }),
925
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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" })
795
926
  ] }) : number("speed", "Speed", { min: 0.1, step: 0.25 }) }),
796
- project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Retime", name: "retime", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex flex-wrap gap-1", children: [
797
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
927
+ project.assets.find((a) => a.id === clip.asset)?.kind !== "image" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Retime", name: "retime", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex flex-wrap gap-1", children: [
928
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
798
929
  "button",
799
930
  {
800
931
  type: "button",
@@ -805,11 +936,11 @@ function ClipInspector({ controller, className = "" }) {
805
936
  children: "Freeze 1 s here"
806
937
  }
807
938
  ),
808
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn2, disabled, title: "Normal speed, then a glide into 0.3\xD7 slow motion", onClick: () => controller.apply((0, import_video_editor6.videoSpeedRampEdit)(clip, (0, import_video_editor6.videoSlowMotionRamp)(clip.duration)), "Speed ramp"), children: "Slow-mo ramp" })
939
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: btn2, disabled, title: "Normal speed, then a glide into 0.3\xD7 slow motion", onClick: () => controller.apply((0, import_video_editor6.videoSpeedRampEdit)(clip, (0, import_video_editor6.videoSlowMotionRamp)(clip.duration)), "Speed ramp"), children: "Slow-mo ramp" })
809
940
  ] }) }),
810
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) }),
941
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) }),
811
942
  ["fadeInCurve", "fadeOutCurve"].map(
812
- (key) => (key === "fadeInCurve" ? clip.fadeIn : clip.fadeOut) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: key === "fadeInCurve" ? "Fade in sound" : "Fade out sound", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
943
+ (key) => (key === "fadeInCurve" ? clip.fadeIn : clip.fadeOut) ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: key === "fadeInCurve" ? "Fade in sound" : "Fade out sound", name: key, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
813
944
  "select",
814
945
  {
815
946
  className: field,
@@ -820,28 +951,28 @@ function ClipInspector({ controller, className = "" }) {
820
951
  const curve = e.target.value;
821
952
  set(key, curve === "linear" ? void 0 : curve, key === "fadeInCurve" ? "Change fade in curve" : "Change fade out curve");
822
953
  },
823
- children: import_video_editor6.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: c, children: import_video_editor6.VIDEO_FADE_CURVE_LABELS[c] }, c))
954
+ children: import_video_editor6.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: c, children: import_video_editor6.VIDEO_FADE_CURVE_LABELS[c] }, c))
824
955
  }
825
956
  ) }, key) : null
826
957
  )
827
958
  ] }),
828
- clip.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
829
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Text", name: "text", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Commit, { multiline: true, value: clip.text, "aria-label": "Text", disabled, onCommit: (raw) => set("text", raw, "Change text") }) }),
830
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Colour", name: "color", children: text("color", "Colour") }),
831
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Font size", name: "fontSize", children: number("fontSize", "Font size", { min: 1, step: 2 }) }),
832
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Background", name: "background", children: text("background", "Background") })
959
+ clip.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
960
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Text", name: "text", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Commit, { multiline: true, value: clip.text, "aria-label": "Text", disabled, onCommit: (raw) => set("text", raw, "Change text") }) }),
961
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Colour", name: "color", children: text("color", "Colour") }),
962
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Font size", name: "fontSize", children: number("fontSize", "Font size", { min: 1, step: 2 }) }),
963
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Background", name: "background", children: text("background", "Background") })
833
964
  ] }),
834
- clip.type === "sequence" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
835
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Sequence", name: "sequence", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "truncate", title: "A compound clip plays its sequence as one picture and sound; its clips cannot be edited here yet", children: [
965
+ clip.type === "sequence" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
966
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Sequence", name: "sequence", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "truncate", title: "A compound clip plays its sequence as one picture and sound; its clips cannot be edited here yet", children: [
836
967
  project.sequences?.find((q) => q.id === clip.sequence)?.name ?? clip.sequence,
837
968
  " \xB7 from ",
838
969
  (0, import_video_editor6.formatVideoSeconds)(clip.in ?? 0)
839
970
  ] }) }),
840
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) })
971
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Muted", name: "muted", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", className: "justify-self-start", checked: !!clip.muted, disabled, "aria-label": "Muted", onChange: (e) => set("muted", e.target.checked || void 0, e.target.checked ? "Mute clip" : "Unmute clip") }) })
841
972
  ] }),
842
- clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Effect", name: "effect", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate text-xs", title: "Change its controls in the Effects panel", children: clip.name ?? clip.effect }) }),
843
- clip.type === "color" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Colour", name: "color", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Commit, { value: clip.color, "aria-label": "Colour", disabled, onCommit: (raw) => raw.trim() && set("color", raw.trim(), "Change colour") }) }),
844
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Transition in", name: "transition", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
973
+ clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Effect", name: "effect", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "truncate text-xs", title: "Change its controls in the Effects panel", children: clip.name ?? clip.effect }) }),
974
+ clip.type === "color" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Colour", name: "color", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Commit, { value: clip.color, "aria-label": "Colour", disabled, onCommit: (raw) => raw.trim() && set("color", raw.trim(), "Change colour") }) }),
975
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Transition in", name: "transition", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
845
976
  "select",
846
977
  {
847
978
  className: field,
@@ -857,12 +988,12 @@ function ClipInspector({ controller, className = "" }) {
857
988
  );
858
989
  },
859
990
  children: [
860
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "None" }),
861
- import_video_editor6.VIDEO_TRANSITION_TYPES.filter((t) => t !== "effect" || transition?.type === "effect").map((t) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: t, children: t === "effect" ? `Effect: ${transition?.effect?.name ?? transition?.effect?.effect}` : import_video_editor6.VIDEO_TRANSITION_LABELS[t] }, t))
991
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "None" }),
992
+ import_video_editor6.VIDEO_TRANSITION_TYPES.filter((t) => t !== "effect" || transition?.type === "effect").map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: t, children: t === "effect" ? `Effect: ${transition?.effect?.name ?? transition?.effect?.effect}` : import_video_editor6.VIDEO_TRANSITION_LABELS[t] }, t))
862
993
  ]
863
994
  }
864
995
  ) }),
865
- transition && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Length (ms)", name: "transitionDuration", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
996
+ transition && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Length (ms)", name: "transitionDuration", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
866
997
  Commit,
867
998
  {
868
999
  type: "number",
@@ -877,7 +1008,7 @@ function ClipInspector({ controller, className = "" }) {
877
1008
  }
878
1009
  }
879
1010
  ) }),
880
- transition && (0, import_video_editor6.videoTransitionHasDirection)(transition.type) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Direction", name: "transitionDirection", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1011
+ transition && (0, import_video_editor6.videoTransitionHasDirection)(transition.type) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Direction", name: "transitionDirection", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
881
1012
  "select",
882
1013
  {
883
1014
  className: field,
@@ -885,10 +1016,10 @@ function ClipInspector({ controller, className = "" }) {
885
1016
  disabled,
886
1017
  "aria-label": "Transition direction",
887
1018
  onChange: (e) => controller.apply({ op: "set_transition", clip: clip.id, transition: { ...transition, direction: e.target.value } }, "Change transition direction"),
888
- children: import_video_editor6.VIDEO_WIPE_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: d, children: d }, d))
1019
+ children: import_video_editor6.VIDEO_WIPE_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: d, children: d }, d))
889
1020
  }
890
1021
  ) }),
891
- transition && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { label: "Transition sound", name: "transitionAudioCurve", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1022
+ transition && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Transition sound", name: "transitionAudioCurve", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
892
1023
  "select",
893
1024
  {
894
1025
  className: field,
@@ -901,25 +1032,25 @@ function ClipInspector({ controller, className = "" }) {
901
1032
  const next = curve === (0, import_video_editor6.videoTransitionAudioCurve)(rest) ? rest : { ...rest, audioCurve: curve };
902
1033
  controller.apply({ op: "set_transition", clip: clip.id, transition: next }, "Change transition sound");
903
1034
  },
904
- children: import_video_editor6.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: c, children: import_video_editor6.VIDEO_FADE_CURVE_LABELS[c] }, c))
1035
+ children: import_video_editor6.VIDEO_FADE_CURVES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: c, children: import_video_editor6.VIDEO_FADE_CURVE_LABELS[c] }, c))
905
1036
  }
906
1037
  ) })
907
1038
  ] });
908
1039
  }
909
1040
 
910
1041
  // src/video-editor/MediaBin.tsx
911
- var import_react6 = require("react");
1042
+ var import_react9 = require("react");
912
1043
  var import_video_editor7 = require("@pixerate/editor/video-editor");
913
- var import_jsx_runtime6 = require("react/jsx-runtime");
1044
+ var import_jsx_runtime8 = require("react/jsx-runtime");
914
1045
  var btn3 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
915
1046
  function MediaBin({ controller, editable = true, fileToUrl, probe = import_video_editor7.probeVideoMedia, className = "" }) {
916
1047
  const { project, readOnly } = useVideoEditorState(controller);
917
1048
  const canEdit = editable && !readOnly;
918
- const [url, setUrl] = (0, import_react6.useState)("");
919
- const [urlKind, setUrlKind] = (0, import_react6.useState)("");
920
- const [busy, setBusy] = (0, import_react6.useState)(0);
921
- const [problem, setProblem] = (0, import_react6.useState)(null);
922
- const [over, setOver] = (0, import_react6.useState)(false);
1049
+ const [url, setUrl] = (0, import_react9.useState)("");
1050
+ const [urlKind, setUrlKind] = (0, import_react9.useState)("");
1051
+ const [busy, setBusy] = (0, import_react9.useState)(0);
1052
+ const [problem, setProblem] = (0, import_react9.useState)(null);
1053
+ const [over, setOver] = (0, import_react9.useState)(false);
923
1054
  const addSource = async (src, kind, name) => {
924
1055
  setBusy((n) => n + 1);
925
1056
  try {
@@ -967,7 +1098,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
967
1098
  if (added) controller.select([added]);
968
1099
  }
969
1100
  };
970
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1101
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
971
1102
  "div",
972
1103
  {
973
1104
  className: `flex flex-col gap-2 rounded ${over ? "ring-2 ring-rose-500/60" : ""} ${className}`,
@@ -985,21 +1116,21 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
985
1116
  void addFiles(e.dataTransfer.files);
986
1117
  },
987
1118
  children: [
988
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-xs font-medium", children: "Media" }),
989
- project.assets.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Media assets", children: project.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center gap-2 text-xs", "data-asset": asset.id, children: [
990
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-asset-kind": "", children: asset.kind }),
991
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "min-w-0 flex-1 truncate", title: asset.src, children: asset.name ?? asset.id }),
992
- asset.proxies?.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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,
993
- asset.duration !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "tabular-nums text-muted-foreground", children: (0, import_video_editor7.formatVideoSeconds)(asset.duration) }),
994
- editable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn3, disabled: !canEdit, onClick: () => addToTimeline(asset), "data-add-to-timeline": "", children: "Add to timeline" })
995
- ] }, asset.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
1119
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-xs font-medium", children: "Media" }),
1120
+ project.assets.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Media assets", children: project.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: "flex items-center gap-2 text-xs", "data-asset": asset.id, children: [
1121
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rounded bg-muted px-1 text-[10px] uppercase text-muted-foreground", "data-asset-kind": "", children: asset.kind }),
1122
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "min-w-0 flex-1 truncate", title: asset.src, children: asset.name ?? asset.id }),
1123
+ asset.proxies?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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,
1124
+ asset.duration !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "tabular-nums text-muted-foreground", children: (0, import_video_editor7.formatVideoSeconds)(asset.duration) }),
1125
+ editable && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn3, disabled: !canEdit, onClick: () => addToTimeline(asset), "data-add-to-timeline": "", children: "Add to timeline" })
1126
+ ] }, asset.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
996
1127
  "No media yet.",
997
1128
  editable ? " Choose or drop files, or add a URL." : ""
998
1129
  ] }),
999
- editable && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1000
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex flex-col gap-1 rounded border border-dashed border-border p-2 text-xs text-muted-foreground", children: [
1130
+ editable && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1131
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-1 rounded border border-dashed border-border p-2 text-xs text-muted-foreground", children: [
1001
1132
  "Choose or drop video, audio or image files",
1002
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1133
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1003
1134
  "input",
1004
1135
  {
1005
1136
  type: "file",
@@ -1016,7 +1147,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
1016
1147
  }
1017
1148
  )
1018
1149
  ] }),
1019
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1150
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1020
1151
  "form",
1021
1152
  {
1022
1153
  className: "flex items-center gap-1",
@@ -1025,7 +1156,7 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
1025
1156
  void addUrl();
1026
1157
  },
1027
1158
  children: [
1028
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1159
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1029
1160
  "input",
1030
1161
  {
1031
1162
  className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -1036,37 +1167,37 @@ function MediaBin({ controller, editable = true, fileToUrl, probe = import_video
1036
1167
  onChange: (e) => setUrl(e.target.value)
1037
1168
  }
1038
1169
  ),
1039
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("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: [
1040
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: "Auto" }),
1041
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "video", children: "Video" }),
1042
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "audio", children: "Audio" }),
1043
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "image", children: "Image" })
1170
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("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: [
1171
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Auto" }),
1172
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "video", children: "Video" }),
1173
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "audio", children: "Audio" }),
1174
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "image", children: "Image" })
1044
1175
  ] }),
1045
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "submit", className: btn3, disabled: !canEdit || !url.trim(), "data-add-url": "", children: "Add" })
1176
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "submit", className: btn3, disabled: !canEdit || !url.trim(), "data-add-url": "", children: "Add" })
1046
1177
  ]
1047
1178
  }
1048
1179
  )
1049
1180
  ] }),
1050
- busy > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-muted-foreground", children: "Reading media\u2026" }),
1051
- problem && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-media-error": "", children: problem })
1181
+ busy > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-muted-foreground", children: "Reading media\u2026" }),
1182
+ problem && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-media-error": "", children: problem })
1052
1183
  ]
1053
1184
  }
1054
1185
  );
1055
1186
  }
1056
1187
 
1057
1188
  // src/video-editor/TranscriptPanel.tsx
1058
- var import_react7 = __toESM(require("react"), 1);
1189
+ var import_react10 = __toESM(require("react"), 1);
1059
1190
  var import_video_editor8 = require("@pixerate/editor/video-editor");
1060
- var import_jsx_runtime7 = require("react/jsx-runtime");
1191
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1061
1192
  var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1062
1193
  function TranscriptPanel({ controller, track, editable = true, className = "" }) {
1063
1194
  const state = useVideoEditorState(controller);
1064
1195
  const { project, time, readOnly } = state;
1065
1196
  const canEdit = editable && !readOnly;
1066
- const [anchor, setAnchor] = (0, import_react7.useState)(null);
1067
- const [focus, setFocus] = (0, import_react7.useState)(null);
1068
- const [message, setMessage] = (0, import_react7.useState)(null);
1069
- const words = (0, import_react7.useMemo)(() => {
1197
+ const [anchor, setAnchor] = (0, import_react10.useState)(null);
1198
+ const [focus, setFocus] = (0, import_react10.useState)(null);
1199
+ const [message, setMessage] = (0, import_react10.useState)(null);
1200
+ const words = (0, import_react10.useMemo)(() => {
1070
1201
  try {
1071
1202
  return (0, import_video_editor8.videoTimelineTranscript)(project, { track });
1072
1203
  } catch {
@@ -1092,9 +1223,9 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1092
1223
  setMessage(e instanceof Error ? e.message : String(e));
1093
1224
  }
1094
1225
  };
1095
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-panel": "", children: [
1096
- words.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1097
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1226
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-panel": "", children: [
1227
+ words.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1228
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1098
1229
  "div",
1099
1230
  {
1100
1231
  className: "max-h-48 overflow-y-auto leading-6",
@@ -1110,8 +1241,8 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1110
1241
  },
1111
1242
  children: words.map((w, i) => {
1112
1243
  const inSelection = selected !== null && i >= selected[0] && i <= selected[1];
1113
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react7.default.Fragment, { children: [
1114
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1244
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react10.default.Fragment, { children: [
1245
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1115
1246
  "span",
1116
1247
  {
1117
1248
  role: "option",
@@ -1137,42 +1268,42 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1137
1268
  })
1138
1269
  }
1139
1270
  ),
1140
- canEdit && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1141
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: btn4, disabled: !selected, onClick: () => selected && cut([(0, import_video_editor8.videoWordsRange)(words, selected[0], selected[1])], "Cut words", "Select words to cut."), children: "Delete selected words" }),
1142
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: btn4, onClick: () => cut((0, import_video_editor8.findVideoFillers)(words), "Remove fillers", "No filler words found."), children: "Remove fillers" }),
1143
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: btn4, onClick: () => cut((0, import_video_editor8.findVideoTranscriptPauses)(words, { fps: project.fps }), "Tighten pauses", "No long pauses found."), children: "Tighten pauses" })
1271
+ canEdit && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1272
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn4, disabled: !selected, onClick: () => selected && cut([(0, import_video_editor8.videoWordsRange)(words, selected[0], selected[1])], "Cut words", "Select words to cut."), children: "Delete selected words" }),
1273
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn4, onClick: () => cut((0, import_video_editor8.findVideoFillers)(words), "Remove fillers", "No filler words found."), children: "Remove fillers" }),
1274
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn4, onClick: () => cut((0, import_video_editor8.findVideoTranscriptPauses)(words, { fps: project.fps }), "Tighten pauses", "No long pauses found."), children: "Tighten pauses" })
1144
1275
  ] })
1145
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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." }),
1146
- canEdit && sound.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("details", { children: [
1147
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("summary", { className: "cursor-pointer text-muted-foreground", children: "Transcripts" }),
1148
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "mt-1 space-y-1", children: sound.map((a) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { className: "flex items-center gap-2", children: [
1149
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
1276
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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." }),
1277
+ canEdit && sound.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("summary", { className: "cursor-pointer text-muted-foreground", children: "Transcripts" }),
1279
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "mt-1 space-y-1", children: sound.map((a) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { className: "flex items-center gap-2", children: [
1280
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
1150
1281
  a.name ?? a.id,
1151
1282
  " ",
1152
1283
  a.transcript ? `\xB7 ${a.transcript.length} words` : ""
1153
1284
  ] }),
1154
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "file", accept: ".json,.srt,.vtt,application/json,text/vtt", "aria-label": `Load a transcript for ${a.name ?? a.id}`, className: "w-40 text-[10px]", onChange: (e) => void load(a.id, e.target.files?.[0]) })
1285
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "file", accept: ".json,.srt,.vtt,application/json,text/vtt", "aria-label": `Load a transcript for ${a.name ?? a.id}`, className: "w-40 text-[10px]", onChange: (e) => void load(a.id, e.target.files?.[0]) })
1155
1286
  ] }, a.id)) })
1156
1287
  ] }),
1157
- message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: message })
1288
+ message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: message })
1158
1289
  ] });
1159
1290
  }
1160
1291
 
1161
1292
  // src/video-editor/VideoEditor.tsx
1162
- var import_react14 = require("react");
1293
+ var import_react17 = require("react");
1163
1294
 
1164
1295
  // src/effects/useEffects.ts
1165
- var import_react8 = require("react");
1296
+ var import_react11 = require("react");
1166
1297
  function useEffects(host, provider) {
1167
- (0, import_react8.useEffect)(() => {
1298
+ (0, import_react11.useEffect)(() => {
1168
1299
  if (!host || !provider) return;
1169
1300
  return host.useEffects(provider);
1170
1301
  }, [host, provider]);
1171
1302
  }
1172
1303
  function useEffectDescription(provider, effect) {
1173
- const [state, setState] = (0, import_react8.useState)({ key: "", description: null, error: null });
1304
+ const [state, setState] = (0, import_react11.useState)({ key: "", description: null, error: null });
1174
1305
  const key = provider && effect ? `${provider.id}:${effect}` : "";
1175
- (0, import_react8.useEffect)(() => {
1306
+ (0, import_react11.useEffect)(() => {
1176
1307
  if (!provider || !effect) return;
1177
1308
  let live = true;
1178
1309
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1187,13 +1318,13 @@ function useEffectDescription(provider, effect) {
1187
1318
  }
1188
1319
 
1189
1320
  // src/effects/EffectThumbnail.tsx
1190
- var import_react9 = require("react");
1321
+ var import_react12 = require("react");
1191
1322
  var import_effects = require("@pixerate/editor/effects");
1192
- var import_jsx_runtime8 = require("react/jsx-runtime");
1323
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1193
1324
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1194
- const ref = (0, import_react9.useRef)(null);
1195
- const [failed, setFailed] = (0, import_react9.useState)(effect.kind === "motion");
1196
- (0, import_react9.useEffect)(() => {
1325
+ const ref = (0, import_react12.useRef)(null);
1326
+ const [failed, setFailed] = (0, import_react12.useState)(effect.kind === "motion");
1327
+ (0, import_react12.useEffect)(() => {
1197
1328
  if (effect.kind === "motion") return;
1198
1329
  let live = true;
1199
1330
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1208,28 +1339,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1208
1339
  live = false;
1209
1340
  };
1210
1341
  }, [provider, effect, width, height]);
1211
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1342
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1212
1343
  "div",
1213
1344
  {
1214
1345
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1215
1346
  style: { aspectRatio: `${width} / ${height}` },
1216
1347
  "data-effect-thumbnail": effect.id,
1217
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1348
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1218
1349
  }
1219
1350
  );
1220
1351
  }
1221
1352
 
1222
1353
  // src/effects/EffectsBrowser.tsx
1223
- var import_react10 = require("react");
1354
+ var import_react13 = require("react");
1224
1355
  var import_effects2 = require("@pixerate/editor/effects");
1225
- var import_jsx_runtime9 = require("react/jsx-runtime");
1356
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1226
1357
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1227
- const [all, setAll] = (0, import_react10.useState)([]);
1228
- const [query, setQuery] = (0, import_react10.useState)("");
1229
- const [category, setCategory] = (0, import_react10.useState)("");
1230
- const [use, setUse] = (0, import_react10.useState)("");
1231
- const [error, setError] = (0, import_react10.useState)(null);
1232
- (0, import_react10.useEffect)(() => {
1358
+ const [all, setAll] = (0, import_react13.useState)([]);
1359
+ const [query, setQuery] = (0, import_react13.useState)("");
1360
+ const [category, setCategory] = (0, import_react13.useState)("");
1361
+ const [use, setUse] = (0, import_react13.useState)("");
1362
+ const [error, setError] = (0, import_react13.useState)(null);
1363
+ (0, import_react13.useEffect)(() => {
1233
1364
  if (!provider) return setAll([]);
1234
1365
  let live = true;
1235
1366
  Promise.resolve().then(() => provider.list()).then(
@@ -1240,8 +1371,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1240
1371
  live = false;
1241
1372
  };
1242
1373
  }, [provider]);
1243
- const [found, setFound] = (0, import_react10.useState)([]);
1244
- (0, import_react10.useEffect)(() => {
1374
+ const [found, setFound] = (0, import_react13.useState)([]);
1375
+ (0, import_react13.useEffect)(() => {
1245
1376
  if (!provider) return setFound([]);
1246
1377
  let live = true;
1247
1378
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1250,14 +1381,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1250
1381
  };
1251
1382
  }, [provider, query, category, use]);
1252
1383
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (uses ? e.kind !== "motion" || uses.includes("motion") : e.kind !== "motion") && (!uses || e.uses.some((u) => uses.includes(u)));
1253
- const categories = (0, import_react10.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1384
+ const categories = (0, import_react13.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1254
1385
  const shown = found.filter(allowed);
1255
1386
  if (!provider)
1256
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
1257
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1258
- title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1259
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1260
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1387
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
1388
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1389
+ title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1390
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1391
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1261
1392
  "input",
1262
1393
  {
1263
1394
  type: "search",
@@ -1268,17 +1399,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1268
1399
  onChange: (e) => setQuery(e.currentTarget.value)
1269
1400
  }
1270
1401
  ),
1271
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
1272
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "All categories" }),
1273
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: c, children: c }, c))
1402
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
1403
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "All categories" }),
1404
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: c, children: c }, c))
1274
1405
  ] }),
1275
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
1276
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "Any use" }),
1277
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1406
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
1407
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Any use" }),
1408
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1278
1409
  ] })
1279
1410
  ] }),
1280
- error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1281
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1411
+ error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1412
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1282
1413
  "button",
1283
1414
  {
1284
1415
  type: "button",
@@ -1287,25 +1418,25 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1287
1418
  "data-effect-id": e.id,
1288
1419
  onClick: () => onPick(e),
1289
1420
  children: [
1290
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(EffectThumbnail, { provider, effect: e }),
1291
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1292
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1421
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectThumbnail, { provider, effect: e }),
1422
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1423
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1293
1424
  ]
1294
1425
  }
1295
1426
  ) }, e.id)) }),
1296
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1427
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1297
1428
  ] });
1298
1429
  }
1299
1430
 
1300
1431
  // src/effects/EffectParameters.tsx
1301
- var import_react12 = __toESM(require("react"), 1);
1432
+ var import_react15 = __toESM(require("react"), 1);
1302
1433
  var import_effects3 = require("@pixerate/editor/effects");
1303
1434
  var import_parameters2 = require("@pixerate/editor/parameters");
1304
1435
 
1305
1436
  // src/parameters/fields.tsx
1306
- var import_react11 = require("react");
1437
+ var import_react14 = require("react");
1307
1438
  var import_parameters = require("@pixerate/editor/parameters");
1308
- var import_jsx_runtime10 = require("react/jsx-runtime");
1439
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1309
1440
  var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
1310
1441
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
1311
1442
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -1329,7 +1460,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
1329
1460
  onKeyDown: keyDown,
1330
1461
  ...rest
1331
1462
  };
1332
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "text", ...props }, value);
1463
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "text", ...props }, value);
1333
1464
  }
1334
1465
  var plainNumber = (field2, value) => (0, import_parameters.formatParameterNumber)({ ...field2, unit: void 0 }, value);
1335
1466
  function ParameterNumberInput({
@@ -1340,8 +1471,8 @@ function ParameterNumberInput({
1340
1471
  id,
1341
1472
  "aria-label": ariaLabel
1342
1473
  }) {
1343
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1344
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1474
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1475
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1345
1476
  ParameterCommitInput,
1346
1477
  {
1347
1478
  id,
@@ -1363,21 +1494,21 @@ function ParameterNumberInput({
1363
1494
  }
1364
1495
  }
1365
1496
  ),
1366
- field2.unit && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field2.unit })
1497
+ field2.unit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field2.unit })
1367
1498
  ] });
1368
1499
  }
1369
1500
  function ParameterSlider(props) {
1370
1501
  const { field: field2, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
1371
- const dragging = (0, import_react11.useRef)(false);
1502
+ const dragging = (0, import_react14.useRef)(false);
1372
1503
  const end = () => {
1373
1504
  if (!dragging.current) return;
1374
1505
  dragging.current = false;
1375
1506
  onGestureEnd?.();
1376
1507
  };
1377
- if (!(0, import_parameters.isSliderField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterNumberInput, { ...props });
1508
+ if (!(0, import_parameters.isSliderField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterNumberInput, { ...props });
1378
1509
  const step = (0, import_parameters.parameterStep)(field2);
1379
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
1380
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1510
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1511
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1381
1512
  "input",
1382
1513
  {
1383
1514
  type: "range",
@@ -1400,11 +1531,11 @@ function ParameterSlider(props) {
1400
1531
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field2, Number(e.target.value)))
1401
1532
  }
1402
1533
  ),
1403
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field2)} value` }) })
1534
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field2)} value` }) })
1404
1535
  ] });
1405
1536
  }
1406
1537
  function ParameterToggle({ field: field2, value, onChange, disabled, id }) {
1407
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1538
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1408
1539
  "button",
1409
1540
  {
1410
1541
  type: "button",
@@ -1415,7 +1546,7 @@ function ParameterToggle({ field: field2, value, onChange, disabled, id }) {
1415
1546
  disabled: disabled || field2.readOnly,
1416
1547
  onClick: () => onChange(!value),
1417
1548
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
1418
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1549
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1419
1550
  "span",
1420
1551
  {
1421
1552
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -1428,7 +1559,7 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
1428
1559
  const options = (0, import_parameters.getChoiceOptions)(field2);
1429
1560
  const off = disabled || field2.readOnly;
1430
1561
  if (field2.control === "segmented") {
1431
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field2), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1562
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field2), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1432
1563
  "button",
1433
1564
  {
1434
1565
  type: "button",
@@ -1444,7 +1575,7 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
1444
1575
  )) });
1445
1576
  }
1446
1577
  const index = options.findIndex((o) => o.value === value);
1447
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1578
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1448
1579
  "select",
1449
1580
  {
1450
1581
  id,
@@ -1456,12 +1587,12 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
1456
1587
  if (option) onChange(option.value);
1457
1588
  },
1458
1589
  className: parameterInputClass,
1459
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1590
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1460
1591
  }
1461
1592
  );
1462
1593
  }
1463
1594
  function ParameterColor({ field: field2, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
1464
- const picking = (0, import_react11.useRef)(false);
1595
+ const picking = (0, import_react14.useRef)(false);
1465
1596
  const alpha = !!field2.alpha;
1466
1597
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
1467
1598
  const rgb = hex.slice(0, 7);
@@ -1477,11 +1608,11 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
1477
1608
  picking.current = false;
1478
1609
  onGestureEnd?.();
1479
1610
  };
1480
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1.5", children: [
1481
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
1482
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
1483
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1484
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1611
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5", children: [
1612
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1613
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
1614
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1615
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1485
1616
  "input",
1486
1617
  {
1487
1618
  type: "color",
@@ -1497,7 +1628,7 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
1497
1628
  }
1498
1629
  )
1499
1630
  ] }),
1500
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1631
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1501
1632
  ParameterCommitInput,
1502
1633
  {
1503
1634
  id,
@@ -1513,7 +1644,7 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
1513
1644
  }
1514
1645
  )
1515
1646
  ] }),
1516
- alpha && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1647
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1517
1648
  "input",
1518
1649
  {
1519
1650
  type: "range",
@@ -1531,10 +1662,10 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
1531
1662
  onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
1532
1663
  }
1533
1664
  ),
1534
- field2.swatches && field2.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.swatches.map((s) => {
1665
+ field2.swatches && field2.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.swatches.map((s) => {
1535
1666
  const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
1536
1667
  if (!swatch) return null;
1537
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1668
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1538
1669
  "button",
1539
1670
  {
1540
1671
  type: "button",
@@ -1553,11 +1684,11 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
1553
1684
  }
1554
1685
  function ParameterVector({ field: field2, value, onChange, disabled, id }) {
1555
1686
  const size = (0, import_parameters.vectorSize)(field2);
1556
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1687
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1557
1688
  const component = (0, import_parameters.vectorComponentField)(field2, i);
1558
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1559
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1560
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1689
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1690
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1691
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1561
1692
  ParameterNumberInput,
1562
1693
  {
1563
1694
  field: component,
@@ -1574,11 +1705,11 @@ function ParameterVector({ field: field2, value, onChange, disabled, id }) {
1574
1705
  function ParameterImage({ field: field2, value, onChange, disabled, id, resolveFile }) {
1575
1706
  const off = disabled || field2.readOnly;
1576
1707
  const name = (0, import_parameters.parameterLabel)(field2);
1577
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1.5", children: [
1578
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
1579
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1580
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1581
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1708
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5", children: [
1709
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1710
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1711
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1712
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1582
1713
  ParameterCommitInput,
1583
1714
  {
1584
1715
  id,
@@ -1589,10 +1720,10 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
1589
1720
  onCommit: (text) => onChange(text.trim())
1590
1721
  }
1591
1722
  ),
1592
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-1", children: [
1593
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1723
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-1", children: [
1724
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1594
1725
  "Choose file\u2026",
1595
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1726
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1596
1727
  "input",
1597
1728
  {
1598
1729
  type: "file",
@@ -1608,11 +1739,11 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
1608
1739
  }
1609
1740
  )
1610
1741
  ] }),
1611
- value && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1742
+ value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1612
1743
  ] })
1613
1744
  ] })
1614
1745
  ] }),
1615
- field2.options && field2.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1746
+ field2.options && field2.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1616
1747
  "button",
1617
1748
  {
1618
1749
  type: "button",
@@ -1622,14 +1753,14 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
1622
1753
  disabled: off,
1623
1754
  onClick: () => onChange(o.url),
1624
1755
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
1625
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1756
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1626
1757
  },
1627
1758
  o.url
1628
1759
  )) })
1629
1760
  ] });
1630
1761
  }
1631
1762
  function ParameterText({ field: field2, value, onChange, disabled, id }) {
1632
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1763
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1633
1764
  ParameterCommitInput,
1634
1765
  {
1635
1766
  id,
@@ -1648,31 +1779,31 @@ function ParameterFieldControl({ field: field2, value, onChange, resolveFile, ..
1648
1779
  switch (field2.type) {
1649
1780
  case "number":
1650
1781
  case "int":
1651
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterSlider, { field: field2, value, onChange: set, ...rest });
1782
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterSlider, { field: field2, value, onChange: set, ...rest });
1652
1783
  case "boolean":
1653
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterToggle, { field: field2, value, onChange: set, ...rest });
1784
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterToggle, { field: field2, value, onChange: set, ...rest });
1654
1785
  case "choice":
1655
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterSelect, { field: field2, value, onChange: set, ...rest });
1786
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterSelect, { field: field2, value, onChange: set, ...rest });
1656
1787
  case "color":
1657
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterColor, { field: field2, value, onChange: set, ...rest });
1788
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterColor, { field: field2, value, onChange: set, ...rest });
1658
1789
  case "vector":
1659
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterVector, { field: field2, value, onChange: set, ...rest });
1790
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterVector, { field: field2, value, onChange: set, ...rest });
1660
1791
  case "image":
1661
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterImage, { field: field2, value, onChange: set, resolveFile, ...rest });
1792
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterImage, { field: field2, value, onChange: set, resolveFile, ...rest });
1662
1793
  case "text":
1663
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ParameterText, { field: field2, value, onChange: set, ...rest });
1794
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterText, { field: field2, value, onChange: set, ...rest });
1664
1795
  }
1665
1796
  }
1666
1797
 
1667
1798
  // src/effects/EffectParameters.tsx
1668
- var import_jsx_runtime11 = require("react/jsx-runtime");
1799
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1669
1800
  function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
1670
- const fields = (0, import_react12.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1671
- const idBase = (0, import_react12.useId)();
1672
- const gesture = import_react12.default.useRef(null);
1673
- const count = import_react12.default.useRef(0);
1674
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1675
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1801
+ const fields = (0, import_react15.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1802
+ const idBase = (0, import_react15.useId)();
1803
+ const gesture = import_react15.default.useRef(null);
1804
+ const count = import_react15.default.useRef(0);
1805
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1806
+ onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1676
1807
  "select",
1677
1808
  {
1678
1809
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -1684,8 +1815,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1684
1815
  if (preset) onPreset({ ...description.defaults, ...preset.values });
1685
1816
  },
1686
1817
  children: [
1687
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Presets\u2026" }),
1688
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: p.name, children: p.name }, p.name))
1818
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Presets\u2026" }),
1819
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: p.name, children: p.name }, p.name))
1689
1820
  ]
1690
1821
  }
1691
1822
  ),
@@ -1695,13 +1826,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1695
1826
  const keyed = keyframed?.has(field2.id) ?? false;
1696
1827
  const value = (0, import_effects3.effectFieldValue)(field2, values[field2.id]);
1697
1828
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field2.default);
1698
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1", "data-effect-control": field2.id, children: [
1699
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1700
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field2.description, children: label }),
1701
- keyed && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1702
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field2.id), children: "\u21BA" })
1829
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1", "data-effect-control": field2.id, children: [
1830
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1831
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field2.description, children: label }),
1832
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1833
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field2.id), children: "\u21BA" })
1703
1834
  ] }),
1704
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1835
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1705
1836
  ParameterFieldControl,
1706
1837
  {
1707
1838
  field: field2,
@@ -1715,14 +1846,14 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1715
1846
  )
1716
1847
  ] }, field2.id);
1717
1848
  }),
1718
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1849
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1719
1850
  ] });
1720
1851
  }
1721
1852
 
1722
1853
  // src/video-editor/VideoEffectsPanel.tsx
1723
- var import_react13 = require("react");
1854
+ var import_react16 = require("react");
1724
1855
  var import_video_editor9 = require("@pixerate/editor/video-editor");
1725
- var import_jsx_runtime12 = require("react/jsx-runtime");
1856
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1726
1857
  var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1727
1858
  var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => (0, import_video_editor9.isVideoKeyframes)(v)).map(([k]) => k));
1728
1859
  function EffectControls({
@@ -1735,21 +1866,21 @@ function EffectControls({
1735
1866
  onPreset
1736
1867
  }) {
1737
1868
  const { description, error } = useEffectDescription(provider, effect);
1738
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
1869
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
1739
1870
  'No effects provider: "',
1740
1871
  name ?? effect,
1741
1872
  '" is kept and shown as a placeholder.'
1742
1873
  ] });
1743
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
1744
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
1745
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
1874
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
1875
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
1876
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
1746
1877
  }
1747
1878
  function VideoEffectsPanel({ controller, className = "" }) {
1748
1879
  const state = useVideoEditorState(controller);
1749
1880
  const provider = state.effectsProvider;
1750
- const [browse, setBrowse] = (0, import_react13.useState)(null);
1751
- const [message, setMessage] = (0, import_react13.useState)(null);
1752
- const [open, setOpen] = (0, import_react13.useState)(null);
1881
+ const [browse, setBrowse] = (0, import_react16.useState)(null);
1882
+ const [message, setMessage] = (0, import_react16.useState)(null);
1883
+ const [open, setOpen] = (0, import_react16.useState)(null);
1753
1884
  const selected = state.selection[0];
1754
1885
  const at = selected ? (0, import_video_editor9.findVideoClip)(state.project, selected) : null;
1755
1886
  const clip = at?.clip ?? null;
@@ -1760,18 +1891,18 @@ function VideoEffectsPanel({ controller, className = "" }) {
1760
1891
  if (!track) return setMessage("Add a video track first.");
1761
1892
  report(controller.addEffectClip(track, effect, { start: Math.round(state.time), mode: "overwrite" }).then((r) => (r.ok && r.clip && controller.select([r.clip]), r)));
1762
1893
  };
1763
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
1764
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1765
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
1766
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
1894
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: `flex flex-col gap-2 rounded-md border border-border p-2 text-xs ${className}`, "aria-label": "Effects", "data-video-effects": "", children: [
1895
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1896
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
1897
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
1767
1898
  ] }),
1768
- !provider && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
1769
- browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
1770
- !clip && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
1771
- clip && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1772
- clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
1773
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1899
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
1900
+ browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
1901
+ !clip && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
1902
+ clip && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1903
+ clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
1904
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
1905
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1775
1906
  EffectControls,
1776
1907
  {
1777
1908
  provider,
@@ -1784,13 +1915,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
1784
1915
  }
1785
1916
  )
1786
1917
  ] }),
1787
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
1788
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1789
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
1790
- clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn5, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
1918
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
1919
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1920
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
1921
+ clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn5, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
1791
1922
  ] }),
1792
- browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
1793
- clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1923
+ browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
1924
+ clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1794
1925
  EffectControls,
1795
1926
  {
1796
1927
  provider,
@@ -1803,24 +1934,24 @@ function VideoEffectsPanel({ controller, className = "" }) {
1803
1934
  }
1804
1935
  )
1805
1936
  ] }),
1806
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
1807
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1808
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
1809
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
1937
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
1938
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1939
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
1940
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
1810
1941
  ] }),
1811
- browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
1812
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
1813
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1814
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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 })) }),
1815
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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 }),
1816
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn5, disabled: disabled || i === 0, "aria-label": "Move up", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i - 1 })), children: "\u2191" }),
1817
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn5, disabled: disabled || i === all.length - 1, "aria-label": "Move down", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i + 1 })), children: "\u2193" }),
1818
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
1942
+ browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
1943
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
1944
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1945
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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 })) }),
1946
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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 }),
1947
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn5, disabled: disabled || i === 0, "aria-label": "Move up", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i - 1 })), children: "\u2191" }),
1948
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn5, disabled: disabled || i === all.length - 1, "aria-label": "Move down", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i + 1 })), children: "\u2193" }),
1949
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
1819
1950
  ] }),
1820
- open === e.id && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-1 space-y-2", children: [
1821
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1", children: [
1822
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
1823
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1951
+ open === e.id && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mt-1 space-y-2", children: [
1952
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
1953
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
1954
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1824
1955
  "input",
1825
1956
  {
1826
1957
  type: "range",
@@ -1835,7 +1966,7 @@ function VideoEffectsPanel({ controller, className = "" }) {
1835
1966
  }
1836
1967
  )
1837
1968
  ] }),
1838
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1969
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1839
1970
  EffectControls,
1840
1971
  {
1841
1972
  provider,
@@ -1849,42 +1980,42 @@ function VideoEffectsPanel({ controller, className = "" }) {
1849
1980
  )
1850
1981
  ] })
1851
1982
  ] }, e.id)) }),
1852
- !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
1983
+ !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
1853
1984
  ] })
1854
1985
  ] }),
1855
- message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
1986
+ message && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
1856
1987
  ] });
1857
1988
  }
1858
1989
 
1859
1990
  // src/video-editor/VideoEditor.tsx
1860
- var import_jsx_runtime13 = require("react/jsx-runtime");
1861
- function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, showScopes = false, effects, showEffects, className = "" }) {
1991
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1992
+ function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
1862
1993
  const { controller, state } = useVideoEditor(given ?? options ?? {});
1863
1994
  useEffects(controller, effects);
1864
1995
  const effectsShown = showEffects ?? !!(state.effectsProvider || state.project.tracks.some((t) => t.clips.some((c) => c.type === "effect" || c.effects?.length || c.transition?.type === "effect")));
1865
- (0, import_react14.useEffect)(() => {
1996
+ (0, import_react17.useEffect)(() => {
1866
1997
  if (editable) return;
1867
1998
  const was = controller.getState().readOnly;
1868
1999
  controller.setReadOnly(true);
1869
2000
  return () => controller.setReadOnly(was);
1870
2001
  }, [controller, editable]);
1871
2002
  const { issues } = state;
1872
- const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Video issues", "data-video-issues": "", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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)) });
1873
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
1874
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
1875
- editable && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MediaBin, { controller, className: "min-w-0" }),
1876
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
1877
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
1878
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VideoTransport, { controller, editable }),
1879
- showScopes && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VideoScopes, { controller })
2003
+ const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Video issues", "data-video-issues": "", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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)) });
2004
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
2005
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
2006
+ editable && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MediaBin, { controller, className: "min-w-0" }),
2007
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
2008
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
2009
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VideoTransport, { controller, editable }),
2010
+ showScopes && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VideoScopes, { controller })
1880
2011
  ] }),
1881
- editable && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
1882
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClipInspector, { controller, className: "min-w-0" }),
1883
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
2012
+ editable && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
2013
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ClipInspector, { controller, className: "min-w-0" }),
2014
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
1884
2015
  ] })
1885
2016
  ] }),
1886
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange }),
1887
- showTranscript && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TranscriptPanel, { controller, editable }),
2017
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
2018
+ showTranscript && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TranscriptPanel, { controller, editable }),
1888
2019
  issueList
1889
2020
  ] });
1890
2021
  }