@pixerate/editor-react 0.104.0 → 0.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,7 +32,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  var video_editor_exports = {};
33
33
  __export(video_editor_exports, {
34
34
  ClipInspector: () => ClipInspector,
35
+ EditPlanPreview: () => EditPlanPreview,
35
36
  MediaBin: () => MediaBin,
37
+ TranscriptEditor: () => TranscriptEditor,
36
38
  TranscriptPanel: () => TranscriptPanel,
37
39
  VideoEditor: () => VideoEditor,
38
40
  VideoEffectsPanel: () => VideoEffectsPanel,
@@ -40,11 +42,15 @@ __export(video_editor_exports, {
40
42
  VideoScopes: () => VideoScopes,
41
43
  VideoTimeline: () => VideoTimeline,
42
44
  VideoTransport: () => VideoTransport,
45
+ useTranscriptVideoController: () => useTranscriptVideoController,
46
+ useTranscriptVideoState: () => useTranscriptVideoState,
47
+ useVideoDialogueTools: () => useVideoDialogueTools,
43
48
  useVideoEditor: () => useVideoEditor,
44
49
  useVideoEditorController: () => useVideoEditorController,
45
50
  useVideoEditorState: () => useVideoEditorState,
46
51
  useVideoEditorTools: () => useVideoEditorTools,
47
- useVideoEffectsTools: () => useVideoEffectsTools
52
+ useVideoEffectsTools: () => useVideoEffectsTools,
53
+ useVideoMusicTools: () => useVideoMusicTools
48
54
  });
49
55
  module.exports = __toCommonJS(video_editor_exports);
50
56
 
@@ -103,6 +109,20 @@ function useVideoEffectsTools(registry, controller, options = {}) {
103
109
  return registry.register((0, import_video_editor.createVideoEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
104
110
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
105
111
  }
112
+ function useVideoDialogueTools(registry, controller, options = {}) {
113
+ const { id, namespace, readOnly, playbackSurface } = options;
114
+ (0, import_react.useEffect)(() => {
115
+ if (!registry) return;
116
+ return registry.register((0, import_video_editor.createVideoDialogueToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
117
+ }, [registry, controller, id, namespace, readOnly, playbackSurface]);
118
+ }
119
+ function useVideoMusicTools(registry, controller, options = {}) {
120
+ const { id, namespace, readOnly, playbackSurface } = options;
121
+ (0, import_react.useEffect)(() => {
122
+ if (!registry) return;
123
+ return registry.register((0, import_video_editor.createVideoMusicToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
124
+ }, [registry, controller, id, namespace, readOnly, playbackSurface]);
125
+ }
106
126
 
107
127
  // src/video-editor/VideoPreview.tsx
108
128
  var import_react2 = require("react");
@@ -245,6 +265,24 @@ function VideoTransport({ controller, editable = true, className = "" }) {
245
265
  children: "Ripple delete"
246
266
  }
247
267
  ),
268
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
269
+ "button",
270
+ {
271
+ type: "button",
272
+ className: btn,
273
+ onClick: () => {
274
+ const r = controller.apply((0, import_video_editor4.videoAddAdjustmentEdits)(project, time), "Add adjustment clip");
275
+ if (r.ok) {
276
+ const added = r.outcomes[r.outcomes.length - 1].clip;
277
+ if (added) controller.select([added]);
278
+ }
279
+ },
280
+ disabled: !canEdit,
281
+ title: "Add an adjustment clip at the playhead over every track: its grade, effects and mask change the pictures underneath",
282
+ "data-add-adjustment": "",
283
+ children: "Adjustment"
284
+ }
285
+ ),
248
286
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: btn, onClick: () => controller.undo(), disabled: !canEdit || !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
249
287
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: btn, onClick: () => controller.redo(), disabled: !canEdit || !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" })
250
288
  ] })
@@ -782,6 +820,26 @@ function LutControls({ controller, clip, disabled }) {
782
820
  }
783
821
  }
784
822
  ) }),
823
+ lut && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Protect skin", name: "grade.lut.preserveSkinTones", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
824
+ Commit,
825
+ {
826
+ type: "number",
827
+ min: 0,
828
+ max: 1,
829
+ step: 0.1,
830
+ value: String(lut.preserveSkinTones ?? 0),
831
+ "aria-label": "Protect skin tones",
832
+ title: "How much of the LUT to hold back on skin tones (0 to 1)",
833
+ disabled,
834
+ onCommit: (raw) => {
835
+ const n = Number(raw);
836
+ if (raw.trim() && Number.isFinite(n)) {
837
+ const r = controller.apply((0, import_video_editor6.videoSkinProtectionEdits)(controller.getProject(), [clip.id], n), n > 0 ? "Protect skin tones" : "Stop protecting skin tones");
838
+ setMessage(r.ok ? null : r.error);
839
+ }
840
+ }
841
+ }
842
+ ) }),
785
843
  message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-red-500", role: "alert", "data-lut-error": "", children: message })
786
844
  ] });
787
845
  }
@@ -821,7 +879,7 @@ function ClipInspector({ controller, className = "" }) {
821
879
  const transition = clip.transition;
822
880
  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: [
823
881
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
824
- /* @__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" }),
882
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-medium", children: (0, import_video_editor6.videoClipHeading)(clip) }),
825
883
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { className: "text-muted-foreground", children: clip.id }),
826
884
  at.track.locked && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-amber-500", children: "locked track" })
827
885
  ] }),
@@ -907,6 +965,87 @@ function ClipInspector({ controller, className = "" }) {
907
965
  ) }, c.key)),
908
966
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LutControls, { controller, clip, disabled })
909
967
  ] }),
968
+ clip.type === "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
969
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Changes", name: "scope", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
970
+ "select",
971
+ {
972
+ className: field,
973
+ value: clip.scope ?? "underneath",
974
+ disabled,
975
+ "aria-label": "Adjustment scope",
976
+ onChange: (e) => {
977
+ const scope = e.target.value;
978
+ const target = project.tracks.find((t) => t.kind === "video" && t.id !== at.track.id)?.id;
979
+ if (scope === "track") controller.apply({ op: "update_clip", clip: clip.id, set: { scope, targetTrack: clip.targetTrack ?? target ?? at.track.id } }, "Change adjustment scope");
980
+ else controller.apply({ op: "update_clip", clip: clip.id, ...scope === "underneath" ? { remove: ["scope", "targetTrack"] } : { set: { scope }, remove: ["targetTrack"] } }, "Change adjustment scope");
981
+ },
982
+ children: import_video_editor6.VIDEO_ADJUSTMENT_SCOPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: s, children: import_video_editor6.VIDEO_ADJUSTMENT_SCOPE_LABELS[s] }, s))
983
+ }
984
+ ) }),
985
+ clip.scope === "track" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Track", name: "targetTrack", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("select", { className: field, value: clip.targetTrack ?? "", disabled, "aria-label": "Adjusted track", onChange: (e) => set("targetTrack", e.target.value, "Change adjusted track"), children: project.tracks.filter((t) => t.kind === "video").map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: t.id, children: t.name ?? t.id }, t.id)) }) })
986
+ ] }),
987
+ at.track.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
988
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Mask", name: "mask", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
989
+ "select",
990
+ {
991
+ className: field,
992
+ value: clip.mask?.shape ?? "",
993
+ disabled,
994
+ "aria-label": "Mask shape",
995
+ onChange: (e) => {
996
+ const shape = e.target.value;
997
+ const points = [
998
+ { x: 0.5, y: 0.2 },
999
+ { x: 0.8, y: 0.8 },
1000
+ { x: 0.2, y: 0.8 }
1001
+ ];
1002
+ const { points: _p, cornerRadius: _c, ...rest } = clip.mask ?? { shape: "ellipse" };
1003
+ controller.apply((0, import_video_editor6.videoMaskEdit)(clip.id, shape ? { ...rest, shape, ...shape === "polygon" ? { points } : {} } : null), shape ? "Mask clip" : "Remove mask");
1004
+ },
1005
+ children: [
1006
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "None" }),
1007
+ import_video_editor6.VIDEO_MASK_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: s, children: import_video_editor6.VIDEO_MASK_SHAPE_LABELS[s] }, s))
1008
+ ]
1009
+ }
1010
+ ) }),
1011
+ clip.mask && [
1012
+ ["width", "Mask width", 0.05],
1013
+ ["height", "Mask height", 0.05],
1014
+ ["feather", "Feather (px)", 5],
1015
+ ["rotation", "Mask angle", 5]
1016
+ ].map(([key, label, step]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label, name: `mask.${key}`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1017
+ Commit,
1018
+ {
1019
+ type: "number",
1020
+ step,
1021
+ min: key === "rotation" ? void 0 : 0,
1022
+ value: clip.mask[key] === void 0 ? "" : String(clip.mask[key]),
1023
+ placeholder: key === "feather" || key === "rotation" ? "0" : "0.5",
1024
+ "aria-label": label,
1025
+ disabled,
1026
+ onCommit: (raw) => {
1027
+ const n = Number(raw);
1028
+ if (raw.trim() && !Number.isFinite(n)) return;
1029
+ const { [key]: _old, ...rest } = clip.mask;
1030
+ controller.apply((0, import_video_editor6.videoMaskEdit)(clip.id, raw.trim() ? { ...rest, [key]: n } : rest), "Change mask");
1031
+ }
1032
+ }
1033
+ ) }, key)),
1034
+ clip.mask && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Row, { label: "Invert mask", name: "mask.inverted", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1035
+ "input",
1036
+ {
1037
+ type: "checkbox",
1038
+ className: "justify-self-start",
1039
+ checked: !!clip.mask.inverted,
1040
+ disabled,
1041
+ "aria-label": "Invert mask",
1042
+ onChange: (e) => {
1043
+ const { inverted: _i, ...rest } = clip.mask;
1044
+ controller.apply((0, import_video_editor6.videoMaskEdit)(clip.id, e.target.checked ? { ...rest, inverted: true } : rest), "Invert mask");
1045
+ }
1046
+ }
1047
+ ) })
1048
+ ] }),
910
1049
  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)(
911
1050
  "select",
912
1051
  {
@@ -1296,21 +1435,200 @@ function TranscriptPanel({ controller, track, editable = true, className = "" })
1296
1435
  ] });
1297
1436
  }
1298
1437
 
1438
+ // src/video-editor/TranscriptEditor.tsx
1439
+ var import_react12 = __toESM(require("react"), 1);
1440
+
1441
+ // src/video-editor/useTranscriptVideo.ts
1442
+ var import_react11 = require("react");
1443
+ var import_video_editor9 = require("@pixerate/editor/video-editor");
1444
+ function useTranscriptVideoController(controller, options = {}) {
1445
+ const ref = (0, import_react11.useRef)(null);
1446
+ const key = `${options.track ?? ""}|${options.planFirst ? 1 : 0}`;
1447
+ if (!ref.current || ref.current.editor !== controller || ref.current.key !== key) {
1448
+ ref.current?.transcript.destroy();
1449
+ ref.current = { key, editor: controller, transcript: new import_video_editor9.TranscriptVideoController(controller, options) };
1450
+ }
1451
+ const transcript = ref.current.transcript;
1452
+ (0, import_react11.useEffect)(() => () => transcript.destroy(), [transcript]);
1453
+ return transcript;
1454
+ }
1455
+ function useTranscriptVideoState(transcript) {
1456
+ return (0, import_react11.useSyncExternalStore)(transcript.subscribe, transcript.getState, transcript.getState);
1457
+ }
1458
+
1459
+ // src/video-editor/TranscriptEditor.tsx
1460
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1461
+ var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1462
+ var CHIP = {
1463
+ filler: "bg-amber-400/30 text-amber-700 dark:text-amber-300",
1464
+ pause: "bg-sky-400/25 text-sky-700 dark:text-sky-300",
1465
+ repetition: "bg-violet-400/25 text-violet-700 dark:text-violet-300"
1466
+ };
1467
+ var KIND_LABEL = { filler: "filler", pause: "pause", repetition: "repeat" };
1468
+ function TranscriptEditor({ controller, track, planFirst = false, editable = true, className = "" }) {
1469
+ const transcript = useTranscriptVideoController(controller, { track, planFirst });
1470
+ const state = useTranscriptVideoState(transcript);
1471
+ const [anchor, setAnchor] = (0, import_react12.useState)(null);
1472
+ const canEdit = editable && state.editable;
1473
+ const { words, current, selection, disfluencies, flags } = state;
1474
+ if (!words.length)
1475
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: `text-xs text-muted-foreground ${className}`, "data-transcript-editor": "", "data-transcript-empty": "", children: "No transcribed media on the timeline. Attach a transcript (Whisper JSON, .srt or .vtt) to edit by text." });
1476
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`, "data-transcript-editor": "", children: [
1477
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1478
+ "div",
1479
+ {
1480
+ className: "max-h-56 overflow-y-auto leading-6",
1481
+ role: "listbox",
1482
+ "aria-label": "Transcript",
1483
+ "aria-multiselectable": "true",
1484
+ tabIndex: 0,
1485
+ onKeyDown: (e) => {
1486
+ if (canEdit && selection && (e.key === "Delete" || e.key === "Backspace")) {
1487
+ e.preventDefault();
1488
+ transcript.deleteSelection();
1489
+ }
1490
+ },
1491
+ children: words.map((w, i) => {
1492
+ const selected = !!selection && i >= selection[0] && i <= selection[1];
1493
+ const kinds = flags[i];
1494
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react12.default.Fragment, { children: [
1495
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1496
+ "span",
1497
+ {
1498
+ role: "option",
1499
+ "aria-selected": selected,
1500
+ tabIndex: -1,
1501
+ className: `cursor-pointer rounded px-0.5 ${selected ? "bg-rose-500/30" : i === current ? "bg-amber-400/50" : kinds?.length ? CHIP[kinds[0]] : "hover:bg-muted"}`,
1502
+ "data-word": i,
1503
+ "data-current": i === current ? "" : void 0,
1504
+ "data-selected": selected ? "" : void 0,
1505
+ "data-disfluency": kinds?.join(" ") || void 0,
1506
+ title: kinds?.length ? kinds.map((k) => KIND_LABEL[k]).join(", ") : void 0,
1507
+ onClick: (e) => {
1508
+ if (e.shiftKey && anchor !== null) transcript.select(anchor, i);
1509
+ else {
1510
+ setAnchor(i);
1511
+ transcript.select(i);
1512
+ transcript.seekToWord(i);
1513
+ }
1514
+ },
1515
+ children: w.word
1516
+ }
1517
+ ),
1518
+ kinds?.includes("pause") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "mx-0.5 text-sky-500", "aria-hidden": "true", children: "\u23F8" }) : " "
1519
+ ] }, `${w.clip}:${w.index}`);
1520
+ })
1521
+ }
1522
+ ),
1523
+ canEdit && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1524
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: btn5, disabled: !selection, onClick: () => transcript.deleteSelection(), "data-delete-words": "", children: planFirst ? "Propose deleting words" : "Delete words" }),
1525
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: btn5, disabled: !disfluencies.length, onClick: () => transcript.planCleanup(), "data-plan-cleanup": "", children: [
1526
+ "Plan cleanup (",
1527
+ disfluencies.length,
1528
+ ")"
1529
+ ] })
1530
+ ] }),
1531
+ disfluencies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "flex flex-wrap gap-1", "aria-label": "Disfluencies", "data-disfluencies": "", children: disfluencies.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: `flex items-center gap-1 rounded px-1 ${CHIP[d.kind]}`, "data-disfluency-chip": d.kind, children: [
1532
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "tabular-nums", title: "Go to it", onClick: () => controller.seek(d.from), children: [
1533
+ KIND_LABEL[d.kind],
1534
+ ": ",
1535
+ d.kind === "pause" ? `${((d.to - d.from) / 1e3).toFixed(1)} s` : d.text
1536
+ ] }),
1537
+ canEdit && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": `Cut ${KIND_LABEL[d.kind]} ${d.text}`, onClick: () => transcript.removeDisfluency(i), "data-cut-disfluency": i, children: "\u2715" })
1538
+ ] }, `${d.kind}:${d.from}`)) }),
1539
+ state.error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-red-500", role: "alert", "data-transcript-error": "", children: state.error })
1540
+ ] });
1541
+ }
1542
+
1543
+ // src/video-editor/EditPlanPreview.tsx
1544
+ var import_react13 = require("react");
1545
+ var import_video_editor10 = require("@pixerate/editor/video-editor");
1546
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1547
+ var btn6 = "rounded border border-border px-2 py-0.5 text-[11px] disabled:opacity-40";
1548
+ function EditPlanPreview({ controller, editable = true, className = "" }) {
1549
+ const state = useVideoEditorState(controller);
1550
+ const [message, setMessage] = (0, import_react13.useState)(null);
1551
+ if (!state.plans.length) return null;
1552
+ const total = Math.max(1, state.duration);
1553
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 rounded-md border border-amber-500/50 bg-amber-500/5 p-2 text-xs ${className}`, "aria-label": "Proposed edits", "data-edit-plans": "", children: [
1554
+ state.plans.map((plan) => {
1555
+ const s = plan.summary;
1556
+ const stale = controller.isPlanStale(plan.id);
1557
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("article", { className: "flex flex-col gap-1", "data-edit-plan": plan.id, children: [
1558
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1559
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "flex-1 font-semibold", children: plan.title }),
1560
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: `tabular-nums ${s.durationDelta < 0 ? "text-emerald-600" : "text-muted-foreground"}`, "data-plan-delta": "", children: [
1561
+ s.durationDelta < 0 ? "\u2212" : s.durationDelta > 0 ? "+" : "\xB1",
1562
+ (0, import_video_editor10.formatVideoSeconds)(Math.abs(s.durationDelta))
1563
+ ] })
1564
+ ] }),
1565
+ plan.description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-muted-foreground", children: plan.description }),
1566
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "text-muted-foreground", "data-plan-summary": "", children: [
1567
+ (0, import_video_editor10.describeVideoEditPlan)(plan),
1568
+ " \xB7 ",
1569
+ (0, import_video_editor10.formatVideoSeconds)(s.durationBefore),
1570
+ " \u2192 ",
1571
+ (0, import_video_editor10.formatVideoSeconds)(s.durationAfter)
1572
+ ] }),
1573
+ plan.ranges && plan.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative h-3 w-full overflow-hidden rounded bg-muted", "aria-label": "Stretches the plan cuts", "data-plan-strip": "", children: plan.ranges.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1574
+ "button",
1575
+ {
1576
+ type: "button",
1577
+ className: "absolute top-0 h-full bg-rose-500/70 hover:bg-rose-600",
1578
+ style: { left: `${r.from / total * 100}%`, width: `${Math.max(0.4, (r.to - r.from) / total * 100)}%` },
1579
+ title: `${r.reason ? `${r.reason}: ` : ""}${r.text ?? ""} (${(0, import_video_editor10.formatVideoSeconds)(r.from)})`,
1580
+ "aria-label": `Go to ${r.reason ?? "cut"} at ${(0, import_video_editor10.formatVideoSeconds)(r.from)}`,
1581
+ onClick: () => controller.seek(r.from)
1582
+ },
1583
+ i
1584
+ )) }),
1585
+ s.newIssues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "text-amber-600", children: [
1586
+ "It would add ",
1587
+ s.newIssues.length,
1588
+ " problem",
1589
+ s.newIssues.length > 1 ? "s" : "",
1590
+ ": ",
1591
+ s.newIssues[0].message
1592
+ ] }),
1593
+ stale && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-amber-600", "data-plan-stale": "", children: "The project changed since this plan was made; it is checked again when accepted." }),
1594
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-1", children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1596
+ "button",
1597
+ {
1598
+ type: "button",
1599
+ className: btn6,
1600
+ disabled: !editable || state.readOnly,
1601
+ "data-accept-plan": "",
1602
+ onClick: () => {
1603
+ const r = controller.applyPlan(plan.id);
1604
+ setMessage(r.ok ? null : r.error);
1605
+ },
1606
+ children: "Accept plan"
1607
+ }
1608
+ ),
1609
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn6, "data-discard-plan": "", onClick: () => (controller.discardPlan(plan.id), setMessage(null)), children: "Discard" })
1610
+ ] })
1611
+ ] }, plan.id);
1612
+ }),
1613
+ message && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-red-500", role: "alert", "data-plan-error": "", children: message })
1614
+ ] });
1615
+ }
1616
+
1299
1617
  // src/video-editor/VideoEditor.tsx
1300
- var import_react20 = require("react");
1618
+ var import_react25 = require("react");
1301
1619
 
1302
1620
  // src/effects/useEffects.ts
1303
- var import_react11 = require("react");
1621
+ var import_react14 = require("react");
1304
1622
  function useEffects(host, provider) {
1305
- (0, import_react11.useEffect)(() => {
1623
+ (0, import_react14.useEffect)(() => {
1306
1624
  if (!host || !provider) return;
1307
1625
  return host.useEffects(provider);
1308
1626
  }, [host, provider]);
1309
1627
  }
1310
1628
  function useEffectDescription(provider, effect) {
1311
- const [state, setState] = (0, import_react11.useState)({ key: "", description: null, error: null });
1629
+ const [state, setState] = (0, import_react14.useState)({ key: "", description: null, error: null });
1312
1630
  const key = provider && effect ? `${provider.id}:${effect}` : "";
1313
- (0, import_react11.useEffect)(() => {
1631
+ (0, import_react14.useEffect)(() => {
1314
1632
  if (!provider || !effect) return;
1315
1633
  let live = true;
1316
1634
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1325,13 +1643,13 @@ function useEffectDescription(provider, effect) {
1325
1643
  }
1326
1644
 
1327
1645
  // src/effects/EffectThumbnail.tsx
1328
- var import_react12 = require("react");
1646
+ var import_react15 = require("react");
1329
1647
  var import_effects = require("@pixerate/editor/effects");
1330
- var import_jsx_runtime10 = require("react/jsx-runtime");
1648
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1331
1649
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1332
- const ref = (0, import_react12.useRef)(null);
1333
- const [failed, setFailed] = (0, import_react12.useState)(effect.kind === "motion");
1334
- (0, import_react12.useEffect)(() => {
1650
+ const ref = (0, import_react15.useRef)(null);
1651
+ const [failed, setFailed] = (0, import_react15.useState)(effect.kind === "motion");
1652
+ (0, import_react15.useEffect)(() => {
1335
1653
  if (effect.kind === "motion") return;
1336
1654
  let live = true;
1337
1655
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1346,28 +1664,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1346
1664
  live = false;
1347
1665
  };
1348
1666
  }, [provider, effect, width, height]);
1349
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1667
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1350
1668
  "div",
1351
1669
  {
1352
1670
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1353
1671
  style: { aspectRatio: `${width} / ${height}` },
1354
1672
  "data-effect-thumbnail": effect.id,
1355
- 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" })
1673
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime12.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_runtime12.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1356
1674
  }
1357
1675
  );
1358
1676
  }
1359
1677
 
1360
1678
  // src/effects/EffectsBrowser.tsx
1361
- var import_react13 = require("react");
1679
+ var import_react16 = require("react");
1362
1680
  var import_effects2 = require("@pixerate/editor/effects");
1363
- var import_jsx_runtime11 = require("react/jsx-runtime");
1681
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1364
1682
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1365
- const [all, setAll] = (0, import_react13.useState)([]);
1366
- const [query, setQuery] = (0, import_react13.useState)("");
1367
- const [category, setCategory] = (0, import_react13.useState)("");
1368
- const [use, setUse] = (0, import_react13.useState)("");
1369
- const [error, setError] = (0, import_react13.useState)(null);
1370
- (0, import_react13.useEffect)(() => {
1683
+ const [all, setAll] = (0, import_react16.useState)([]);
1684
+ const [query, setQuery] = (0, import_react16.useState)("");
1685
+ const [category, setCategory] = (0, import_react16.useState)("");
1686
+ const [use, setUse] = (0, import_react16.useState)("");
1687
+ const [error, setError] = (0, import_react16.useState)(null);
1688
+ (0, import_react16.useEffect)(() => {
1371
1689
  if (!provider) return setAll([]);
1372
1690
  let live = true;
1373
1691
  Promise.resolve().then(() => provider.list()).then(
@@ -1378,8 +1696,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1378
1696
  live = false;
1379
1697
  };
1380
1698
  }, [provider]);
1381
- const [found, setFound] = (0, import_react13.useState)([]);
1382
- (0, import_react13.useEffect)(() => {
1699
+ const [found, setFound] = (0, import_react16.useState)([]);
1700
+ (0, import_react16.useEffect)(() => {
1383
1701
  if (!provider) return setFound([]);
1384
1702
  let live = true;
1385
1703
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1388,14 +1706,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1388
1706
  };
1389
1707
  }, [provider, query, category, use]);
1390
1708
  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)));
1391
- const categories = (0, import_react13.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1709
+ const categories = (0, import_react16.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1392
1710
  const shown = found.filter(allowed);
1393
1711
  if (!provider)
1394
- 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." });
1395
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1396
- title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1397
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1398
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1712
+ return /* @__PURE__ */ (0, import_jsx_runtime13.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." });
1713
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1714
+ title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1715
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1716
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1399
1717
  "input",
1400
1718
  {
1401
1719
  type: "search",
@@ -1406,17 +1724,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1406
1724
  onChange: (e) => setQuery(e.currentTarget.value)
1407
1725
  }
1408
1726
  ),
1409
- /* @__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: [
1410
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "All categories" }),
1411
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: c, children: c }, c))
1727
+ /* @__PURE__ */ (0, import_jsx_runtime13.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: [
1728
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "All categories" }),
1729
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: c, children: c }, c))
1412
1730
  ] }),
1413
- 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: [
1414
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Any use" }),
1415
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1731
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.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: [
1732
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Any use" }),
1733
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1416
1734
  ] })
1417
1735
  ] }),
1418
- error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1419
- /* @__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)(
1736
+ error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1737
+ /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1420
1738
  "button",
1421
1739
  {
1422
1740
  type: "button",
@@ -1425,23 +1743,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1425
1743
  "data-effect-id": e.id,
1426
1744
  onClick: () => onPick(e),
1427
1745
  children: [
1428
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectThumbnail, { provider, effect: e }),
1429
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1430
- /* @__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 ") })
1746
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectThumbnail, { provider, effect: e }),
1747
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1748
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1431
1749
  ]
1432
1750
  }
1433
1751
  ) }, e.id)) }),
1434
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1752
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1435
1753
  ] });
1436
1754
  }
1437
1755
 
1438
1756
  // src/effects/EffectParameters.tsx
1439
- var import_react18 = __toESM(require("react"), 1);
1757
+ var import_react21 = __toESM(require("react"), 1);
1440
1758
  var import_effects3 = require("@pixerate/editor/effects");
1441
1759
  var import_parameters2 = require("@pixerate/editor/parameters");
1442
1760
 
1443
1761
  // src/parameters/fields.tsx
1444
- var import_react17 = require("react");
1762
+ var import_react20 = require("react");
1445
1763
  var import_parameters = require("@pixerate/editor/parameters");
1446
1764
 
1447
1765
  // src/color/index.ts
@@ -1454,9 +1772,9 @@ __export(color_exports, {
1454
1772
  });
1455
1773
 
1456
1774
  // src/color/ColorPicker.tsx
1457
- var import_react14 = require("react");
1775
+ var import_react17 = require("react");
1458
1776
  var import_color = require("@pixerate/editor/color");
1459
- var import_jsx_runtime12 = require("react/jsx-runtime");
1777
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1460
1778
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
1461
1779
  function readLocalRecents() {
1462
1780
  try {
@@ -1494,24 +1812,24 @@ var ColorPicker = ({
1494
1812
  id,
1495
1813
  "aria-label": ariaLabel = "Color picker"
1496
1814
  }) => {
1497
- const generatedId = (0, import_react14.useId)();
1815
+ const generatedId = (0, import_react17.useId)();
1498
1816
  const pickerId = id || generatedId;
1499
- const [pickerState, setPickerState] = (0, import_react14.useState)(
1817
+ const [pickerState, setPickerState] = (0, import_react17.useState)(
1500
1818
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
1501
1819
  );
1502
- const stateRef = (0, import_react14.useRef)(pickerState);
1820
+ const stateRef = (0, import_react17.useRef)(pickerState);
1503
1821
  stateRef.current = pickerState;
1504
- (0, import_react14.useEffect)(() => {
1822
+ (0, import_react17.useEffect)(() => {
1505
1823
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
1506
1824
  if (next) {
1507
1825
  setPickerState(next);
1508
1826
  }
1509
1827
  }, [value]);
1510
- const [internalRecent, setInternalRecent] = (0, import_react14.useState)(
1828
+ const [internalRecent, setInternalRecent] = (0, import_react17.useState)(
1511
1829
  () => controlledRecent ? [] : readLocalRecents()
1512
1830
  );
1513
1831
  const activeRecent = controlledRecent ?? internalRecent;
1514
- const recordRecent = (0, import_react14.useCallback)(
1832
+ const recordRecent = (0, import_react17.useCallback)(
1515
1833
  (color) => {
1516
1834
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
1517
1835
  if (!controlledRecent) {
@@ -1522,11 +1840,11 @@ var ColorPicker = ({
1522
1840
  },
1523
1841
  [activeRecent, controlledRecent, onRecentChange]
1524
1842
  );
1525
- const [textDraft, setTextDraft] = (0, import_react14.useState)(value);
1526
- const [isInvalid, setIsInvalid] = (0, import_react14.useState)(false);
1527
- const [isClipped, setIsClipped] = (0, import_react14.useState)(false);
1528
- const isTypingRef = (0, import_react14.useRef)(false);
1529
- (0, import_react14.useEffect)(() => {
1843
+ const [textDraft, setTextDraft] = (0, import_react17.useState)(value);
1844
+ const [isInvalid, setIsInvalid] = (0, import_react17.useState)(false);
1845
+ const [isClipped, setIsClipped] = (0, import_react17.useState)(false);
1846
+ const isTypingRef = (0, import_react17.useRef)(false);
1847
+ (0, import_react17.useEffect)(() => {
1530
1848
  if (!isTypingRef.current) {
1531
1849
  setTextDraft(value);
1532
1850
  setIsInvalid(false);
@@ -1534,11 +1852,11 @@ var ColorPicker = ({
1534
1852
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
1535
1853
  }
1536
1854
  }, [value]);
1537
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react14.useState)(false);
1538
- (0, import_react14.useEffect)(() => {
1855
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react17.useState)(false);
1856
+ (0, import_react17.useEffect)(() => {
1539
1857
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
1540
1858
  }, []);
1541
- const emitColorChange = (0, import_react14.useCallback)(
1859
+ const emitColorChange = (0, import_react17.useCallback)(
1542
1860
  (nextState) => {
1543
1861
  setPickerState(nextState);
1544
1862
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -1546,10 +1864,10 @@ var ColorPicker = ({
1546
1864
  },
1547
1865
  [alpha, onChange]
1548
1866
  );
1549
- const latest = (0, import_react14.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
1867
+ const latest = (0, import_react17.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
1550
1868
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
1551
- const endDragRef = (0, import_react14.useRef)(null);
1552
- (0, import_react14.useEffect)(() => () => endDragRef.current?.(), []);
1869
+ const endDragRef = (0, import_react17.useRef)(null);
1870
+ (0, import_react17.useEffect)(() => () => endDragRef.current?.(), []);
1553
1871
  const startDrag = (e, next) => {
1554
1872
  if (disabled) return;
1555
1873
  e.preventDefault();
@@ -1651,7 +1969,7 @@ var ColorPicker = ({
1651
1969
  } catch {
1652
1970
  }
1653
1971
  };
1654
- const contrastResult = (0, import_react14.useMemo)(() => {
1972
+ const contrastResult = (0, import_react17.useMemo)(() => {
1655
1973
  if (!contrastAgainst) return null;
1656
1974
  const fg = (0, import_color.parseColor)(value);
1657
1975
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -1663,7 +1981,7 @@ var ColorPicker = ({
1663
1981
  }, [value, contrastAgainst]);
1664
1982
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
1665
1983
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
1666
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1984
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1667
1985
  "div",
1668
1986
  {
1669
1987
  id: pickerId,
@@ -1687,7 +2005,7 @@ var ColorPicker = ({
1687
2005
  pointerEvents: disabled ? "none" : "auto"
1688
2006
  },
1689
2007
  children: [
1690
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2008
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1691
2009
  "span",
1692
2010
  {
1693
2011
  role: "status",
@@ -1706,7 +2024,7 @@ var ColorPicker = ({
1706
2024
  children: liveDescription
1707
2025
  }
1708
2026
  ),
1709
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2027
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1710
2028
  "div",
1711
2029
  {
1712
2030
  role: "slider",
@@ -1728,7 +2046,7 @@ var ColorPicker = ({
1728
2046
  touchAction: "none",
1729
2047
  outline: "none"
1730
2048
  },
1731
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2049
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1732
2050
  "div",
1733
2051
  {
1734
2052
  style: {
@@ -1748,7 +2066,7 @@ var ColorPicker = ({
1748
2066
  )
1749
2067
  }
1750
2068
  ),
1751
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2069
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1752
2070
  "div",
1753
2071
  {
1754
2072
  role: "slider",
@@ -1771,7 +2089,7 @@ var ColorPicker = ({
1771
2089
  touchAction: "none",
1772
2090
  outline: "none"
1773
2091
  },
1774
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2092
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1775
2093
  "div",
1776
2094
  {
1777
2095
  style: {
@@ -1791,7 +2109,7 @@ var ColorPicker = ({
1791
2109
  )
1792
2110
  }
1793
2111
  ),
1794
- alpha && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2112
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1795
2113
  "div",
1796
2114
  {
1797
2115
  role: "slider",
@@ -1817,7 +2135,7 @@ var ColorPicker = ({
1817
2135
  overflow: "hidden"
1818
2136
  },
1819
2137
  children: [
1820
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2138
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1821
2139
  "div",
1822
2140
  {
1823
2141
  style: {
@@ -1827,7 +2145,7 @@ var ColorPicker = ({
1827
2145
  }
1828
2146
  }
1829
2147
  ),
1830
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2148
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1831
2149
  "div",
1832
2150
  {
1833
2151
  style: {
@@ -1848,8 +2166,8 @@ var ColorPicker = ({
1848
2166
  ]
1849
2167
  }
1850
2168
  ),
1851
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
1852
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2169
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2170
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1853
2171
  "div",
1854
2172
  {
1855
2173
  style: {
@@ -1863,7 +2181,7 @@ var ColorPicker = ({
1863
2181
  flexShrink: 0,
1864
2182
  border: "1px solid rgba(255,255,255,0.15)"
1865
2183
  },
1866
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2184
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1867
2185
  "div",
1868
2186
  {
1869
2187
  style: {
@@ -1875,7 +2193,7 @@ var ColorPicker = ({
1875
2193
  )
1876
2194
  }
1877
2195
  ),
1878
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2196
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1879
2197
  "input",
1880
2198
  {
1881
2199
  type: "text",
@@ -1905,7 +2223,7 @@ var ColorPicker = ({
1905
2223
  }
1906
2224
  }
1907
2225
  ),
1908
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2226
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1909
2227
  "button",
1910
2228
  {
1911
2229
  type: "button",
@@ -1925,7 +2243,7 @@ var ColorPicker = ({
1925
2243
  color: "inherit",
1926
2244
  cursor: disabled ? "default" : "pointer"
1927
2245
  },
1928
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2246
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1929
2247
  "svg",
1930
2248
  {
1931
2249
  width: "14",
@@ -1937,16 +2255,16 @@ var ColorPicker = ({
1937
2255
  strokeLinecap: "round",
1938
2256
  strokeLinejoin: "round",
1939
2257
  children: [
1940
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
1941
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
1942
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m14 6 4 4" })
2258
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2259
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2260
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m14 6 4 4" })
1943
2261
  ]
1944
2262
  }
1945
2263
  )
1946
2264
  }
1947
2265
  )
1948
2266
  ] }),
1949
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2267
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1950
2268
  "div",
1951
2269
  {
1952
2270
  role: "note",
@@ -1962,10 +2280,10 @@ var ColorPicker = ({
1962
2280
  borderRadius: "4px",
1963
2281
  alignSelf: "flex-start"
1964
2282
  },
1965
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2283
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
1966
2284
  }
1967
2285
  ),
1968
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2286
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1969
2287
  "div",
1970
2288
  {
1971
2289
  style: {
@@ -1979,15 +2297,15 @@ var ColorPicker = ({
1979
2297
  border: "1px solid rgba(255,255,255,0.1)"
1980
2298
  },
1981
2299
  children: [
1982
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
2300
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
1983
2301
  "Contrast: ",
1984
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
2302
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("strong", { children: [
1985
2303
  contrastResult.ratio.toFixed(2),
1986
2304
  ":1"
1987
2305
  ] })
1988
2306
  ] }),
1989
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
1990
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2307
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2308
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1991
2309
  "span",
1992
2310
  {
1993
2311
  style: {
@@ -2000,7 +2318,7 @@ var ColorPicker = ({
2000
2318
  ]
2001
2319
  }
2002
2320
  ),
2003
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2321
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2004
2322
  "span",
2005
2323
  {
2006
2324
  style: {
@@ -2017,9 +2335,9 @@ var ColorPicker = ({
2017
2335
  ]
2018
2336
  }
2019
2337
  ),
2020
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2021
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2022
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2338
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2339
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2340
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2023
2341
  "button",
2024
2342
  {
2025
2343
  type: "button",
@@ -2045,9 +2363,9 @@ var ColorPicker = ({
2045
2363
  `${color}-${idx}`
2046
2364
  )) })
2047
2365
  ] }),
2048
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2049
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2050
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2366
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2367
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2368
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2051
2369
  "button",
2052
2370
  {
2053
2371
  type: "button",
@@ -2078,9 +2396,9 @@ var ColorPicker = ({
2078
2396
  };
2079
2397
 
2080
2398
  // src/color/DualColorPicker.tsx
2081
- var import_react15 = require("react");
2399
+ var import_react18 = require("react");
2082
2400
  var import_color2 = require("@pixerate/editor/color");
2083
- var import_jsx_runtime13 = require("react/jsx-runtime");
2401
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2084
2402
  function DualColorPicker({
2085
2403
  value,
2086
2404
  onChange,
@@ -2095,8 +2413,8 @@ function DualColorPicker({
2095
2413
  disabled = false,
2096
2414
  className = ""
2097
2415
  }) {
2098
- const sameId = (0, import_react15.useId)();
2099
- const [internalScheme, setInternalScheme] = (0, import_react15.useState)("light");
2416
+ const sameId = (0, import_react18.useId)();
2417
+ const [internalScheme, setInternalScheme] = (0, import_react18.useState)("light");
2100
2418
  const activeScheme = controlledScheme ?? internalScheme;
2101
2419
  const handleSchemeSelect = (nextScheme) => {
2102
2420
  if (onSchemeChange) {
@@ -2107,7 +2425,7 @@ function DualColorPicker({
2107
2425
  };
2108
2426
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2109
2427
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2110
- const [sameInBoth, setSameInBoth] = (0, import_react15.useState)(isSame);
2428
+ const [sameInBoth, setSameInBoth] = (0, import_react18.useState)(isSame);
2111
2429
  const handleSameToggle = (e) => {
2112
2430
  const nextSame = e.target.checked;
2113
2431
  setSameInBoth(nextSame);
@@ -2139,7 +2457,7 @@ function DualColorPicker({
2139
2457
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2140
2458
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2141
2459
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2142
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2460
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2143
2461
  "div",
2144
2462
  {
2145
2463
  className: `pixerate-dual-color-picker ${className}`,
@@ -2158,7 +2476,7 @@ function DualColorPicker({
2158
2476
  boxSizing: "border-box"
2159
2477
  },
2160
2478
  children: [
2161
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2479
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2162
2480
  "div",
2163
2481
  {
2164
2482
  role: "tablist",
@@ -2171,7 +2489,7 @@ function DualColorPicker({
2171
2489
  gap: "2px"
2172
2490
  },
2173
2491
  children: [
2174
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2492
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2175
2493
  "button",
2176
2494
  {
2177
2495
  type: "button",
@@ -2194,7 +2512,7 @@ function DualColorPicker({
2194
2512
  children: "Light"
2195
2513
  }
2196
2514
  ),
2197
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2515
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2198
2516
  "button",
2199
2517
  {
2200
2518
  type: "button",
@@ -2220,8 +2538,8 @@ function DualColorPicker({
2220
2538
  ]
2221
2539
  }
2222
2540
  ),
2223
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2224
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2541
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2542
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2225
2543
  "button",
2226
2544
  {
2227
2545
  type: "button",
@@ -2243,7 +2561,7 @@ function DualColorPicker({
2243
2561
  outline: "none"
2244
2562
  },
2245
2563
  children: [
2246
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2564
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2247
2565
  "span",
2248
2566
  {
2249
2567
  style: {
@@ -2255,11 +2573,11 @@ function DualColorPicker({
2255
2573
  }
2256
2574
  }
2257
2575
  ),
2258
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2576
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2259
2577
  ]
2260
2578
  }
2261
2579
  ),
2262
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2580
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2263
2581
  "button",
2264
2582
  {
2265
2583
  type: "button",
@@ -2281,7 +2599,7 @@ function DualColorPicker({
2281
2599
  outline: "none"
2282
2600
  },
2283
2601
  children: [
2284
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2602
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2285
2603
  "span",
2286
2604
  {
2287
2605
  style: {
@@ -2293,12 +2611,12 @@ function DualColorPicker({
2293
2611
  }
2294
2612
  }
2295
2613
  ),
2296
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2614
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2297
2615
  ]
2298
2616
  }
2299
2617
  )
2300
2618
  ] }),
2301
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2619
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2302
2620
  "div",
2303
2621
  {
2304
2622
  style: {
@@ -2309,7 +2627,7 @@ function DualColorPicker({
2309
2627
  padding: "2px 0"
2310
2628
  },
2311
2629
  children: [
2312
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2630
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2313
2631
  "label",
2314
2632
  {
2315
2633
  htmlFor: sameId,
@@ -2323,7 +2641,7 @@ function DualColorPicker({
2323
2641
  color: "#c4cad4"
2324
2642
  },
2325
2643
  children: [
2326
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2644
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2327
2645
  "input",
2328
2646
  {
2329
2647
  id: sameId,
@@ -2334,11 +2652,11 @@ function DualColorPicker({
2334
2652
  style: { cursor: disabled ? "not-allowed" : "pointer" }
2335
2653
  }
2336
2654
  ),
2337
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "Same in both" })
2655
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Same in both" })
2338
2656
  ]
2339
2657
  }
2340
2658
  ),
2341
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2659
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2342
2660
  "button",
2343
2661
  {
2344
2662
  type: "button",
@@ -2360,7 +2678,7 @@ function DualColorPicker({
2360
2678
  ]
2361
2679
  }
2362
2680
  ),
2363
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2681
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2364
2682
  "div",
2365
2683
  {
2366
2684
  "data-testid": "dual-contrast-summary",
@@ -2374,20 +2692,20 @@ function DualColorPicker({
2374
2692
  color: "#8c95a6"
2375
2693
  },
2376
2694
  children: [
2377
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
2695
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
2378
2696
  "Light:",
2379
2697
  " ",
2380
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2698
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2381
2699
  dualContrast.light.ratio.toFixed(2),
2382
2700
  " (",
2383
2701
  dualContrast.light.level,
2384
2702
  ")"
2385
2703
  ] })
2386
2704
  ] }),
2387
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
2705
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
2388
2706
  "Dark:",
2389
2707
  " ",
2390
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2708
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2391
2709
  dualContrast.dark.ratio.toFixed(2),
2392
2710
  " (",
2393
2711
  dualContrast.dark.level,
@@ -2397,7 +2715,7 @@ function DualColorPicker({
2397
2715
  ]
2398
2716
  }
2399
2717
  ),
2400
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2718
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2401
2719
  ColorPicker,
2402
2720
  {
2403
2721
  value: activeColor,
@@ -2416,7 +2734,7 @@ function DualColorPicker({
2416
2734
  }
2417
2735
 
2418
2736
  // src/color/useColorScheme.ts
2419
- var import_react16 = require("react");
2737
+ var import_react19 = require("react");
2420
2738
  var import_color3 = require("@pixerate/editor/color");
2421
2739
  function getSnapshot(attribute) {
2422
2740
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -2441,7 +2759,7 @@ function getServerSnapshot() {
2441
2759
  function useColorScheme(options) {
2442
2760
  const override = options?.override;
2443
2761
  const attribute = options?.attribute;
2444
- const subscribe = (0, import_react16.useMemo)(() => {
2762
+ const subscribe = (0, import_react19.useMemo)(() => {
2445
2763
  return (callback) => {
2446
2764
  if (typeof window === "undefined" || typeof document === "undefined") {
2447
2765
  return () => {
@@ -2467,7 +2785,7 @@ function useColorScheme(options) {
2467
2785
  };
2468
2786
  };
2469
2787
  }, [attribute]);
2470
- const detected = (0, import_react16.useSyncExternalStore)(
2788
+ const detected = (0, import_react19.useSyncExternalStore)(
2471
2789
  subscribe,
2472
2790
  () => getSnapshot(attribute),
2473
2791
  getServerSnapshot
@@ -2484,7 +2802,7 @@ function useResolvedColor(value, scheme) {
2484
2802
  __reExport(color_exports, require("@pixerate/editor/color"));
2485
2803
 
2486
2804
  // src/parameters/fields.tsx
2487
- var import_jsx_runtime14 = require("react/jsx-runtime");
2805
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2488
2806
  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";
2489
2807
  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";
2490
2808
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -2508,7 +2826,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
2508
2826
  onKeyDown: keyDown,
2509
2827
  ...rest
2510
2828
  };
2511
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "text", ...props }, value);
2829
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "text", ...props }, value);
2512
2830
  }
2513
2831
  var plainNumber = (field2, value) => (0, import_parameters.formatParameterNumber)({ ...field2, unit: void 0 }, value);
2514
2832
  function ParameterNumberInput({
@@ -2519,8 +2837,8 @@ function ParameterNumberInput({
2519
2837
  id,
2520
2838
  "aria-label": ariaLabel
2521
2839
  }) {
2522
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2523
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2840
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2841
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2524
2842
  ParameterCommitInput,
2525
2843
  {
2526
2844
  id,
@@ -2542,21 +2860,21 @@ function ParameterNumberInput({
2542
2860
  }
2543
2861
  }
2544
2862
  ),
2545
- field2.unit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field2.unit })
2863
+ field2.unit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field2.unit })
2546
2864
  ] });
2547
2865
  }
2548
2866
  function ParameterSlider(props) {
2549
2867
  const { field: field2, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
2550
- const dragging = (0, import_react17.useRef)(false);
2868
+ const dragging = (0, import_react20.useRef)(false);
2551
2869
  const end = () => {
2552
2870
  if (!dragging.current) return;
2553
2871
  dragging.current = false;
2554
2872
  onGestureEnd?.();
2555
2873
  };
2556
- if (!(0, import_parameters.isSliderField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterNumberInput, { ...props });
2874
+ if (!(0, import_parameters.isSliderField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterNumberInput, { ...props });
2557
2875
  const step = (0, import_parameters.parameterStep)(field2);
2558
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
2559
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2876
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2877
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2560
2878
  "input",
2561
2879
  {
2562
2880
  type: "range",
@@ -2579,11 +2897,11 @@ function ParameterSlider(props) {
2579
2897
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field2, Number(e.target.value)))
2580
2898
  }
2581
2899
  ),
2582
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field2)} value` }) })
2900
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field2)} value` }) })
2583
2901
  ] });
2584
2902
  }
2585
2903
  function ParameterToggle({ field: field2, value, onChange, disabled, id }) {
2586
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2904
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2587
2905
  "button",
2588
2906
  {
2589
2907
  type: "button",
@@ -2594,7 +2912,7 @@ function ParameterToggle({ field: field2, value, onChange, disabled, id }) {
2594
2912
  disabled: disabled || field2.readOnly,
2595
2913
  onClick: () => onChange(!value),
2596
2914
  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"}`,
2597
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2915
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2598
2916
  "span",
2599
2917
  {
2600
2918
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -2607,7 +2925,7 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
2607
2925
  const options = (0, import_parameters.getChoiceOptions)(field2);
2608
2926
  const off = disabled || field2.readOnly;
2609
2927
  if (field2.control === "segmented") {
2610
- return /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)(
2928
+ return /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)(
2611
2929
  "button",
2612
2930
  {
2613
2931
  type: "button",
@@ -2623,7 +2941,7 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
2623
2941
  )) });
2624
2942
  }
2625
2943
  const index = options.findIndex((o) => o.value === value);
2626
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2944
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2627
2945
  "select",
2628
2946
  {
2629
2947
  id,
@@ -2635,22 +2953,22 @@ function ParameterSelect({ field: field2, value, onChange, disabled, id }) {
2635
2953
  if (option) onChange(option.value);
2636
2954
  },
2637
2955
  className: parameterInputClass,
2638
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2956
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2639
2957
  }
2640
2958
  );
2641
2959
  }
2642
2960
  function ParameterColor({ field: field2, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
2643
- const [open, setOpen] = (0, import_react17.useState)(false);
2644
- const containerRef = (0, import_react17.useRef)(null);
2645
- const buttonRef = (0, import_react17.useRef)(null);
2646
- const popoverRef = (0, import_react17.useRef)(null);
2961
+ const [open, setOpen] = (0, import_react20.useState)(false);
2962
+ const containerRef = (0, import_react20.useRef)(null);
2963
+ const buttonRef = (0, import_react20.useRef)(null);
2964
+ const popoverRef = (0, import_react20.useRef)(null);
2647
2965
  const alpha = !!field2.alpha;
2648
2966
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
2649
2967
  const rgb = hex.slice(0, 7);
2650
2968
  const shown = alpha ? hex : rgb;
2651
2969
  const off = disabled || field2.readOnly;
2652
2970
  const name = (0, import_parameters.parameterLabel)(field2);
2653
- (0, import_react17.useEffect)(() => {
2971
+ (0, import_react20.useEffect)(() => {
2654
2972
  if (!open) return;
2655
2973
  const onPointerDown = (e) => {
2656
2974
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -2671,9 +2989,9 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
2671
2989
  window.removeEventListener("keydown", onKeyDown, true);
2672
2990
  };
2673
2991
  }, [open]);
2674
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
2675
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
2676
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2992
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
2993
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2994
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2677
2995
  "button",
2678
2996
  {
2679
2997
  ref: buttonRef,
@@ -2684,10 +3002,10 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
2684
3002
  disabled: off,
2685
3003
  onClick: () => setOpen((prev) => !prev),
2686
3004
  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] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
2687
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3005
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
2688
3006
  }
2689
3007
  ),
2690
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3008
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2691
3009
  ParameterCommitInput,
2692
3010
  {
2693
3011
  id,
@@ -2703,7 +3021,7 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
2703
3021
  }
2704
3022
  )
2705
3023
  ] }),
2706
- open && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3024
+ open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2707
3025
  "div",
2708
3026
  {
2709
3027
  ref: popoverRef,
@@ -2717,7 +3035,7 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
2717
3035
  },
2718
3036
  className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
2719
3037
  style: { background: "var(--popover, var(--background, #fff))" },
2720
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3038
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2721
3039
  ColorPicker,
2722
3040
  {
2723
3041
  value: shown,
@@ -2735,11 +3053,11 @@ function ParameterColor({ field: field2, value, onChange, onGestureStart, onGest
2735
3053
  }
2736
3054
  function ParameterVector({ field: field2, value, onChange, disabled, id }) {
2737
3055
  const size = (0, import_parameters.vectorSize)(field2);
2738
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3056
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
2739
3057
  const component = (0, import_parameters.vectorComponentField)(field2, i);
2740
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
2741
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
2742
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3058
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3059
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3060
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2743
3061
  ParameterNumberInput,
2744
3062
  {
2745
3063
  field: component,
@@ -2756,11 +3074,11 @@ function ParameterVector({ field: field2, value, onChange, disabled, id }) {
2756
3074
  function ParameterImage({ field: field2, value, onChange, disabled, id, resolveFile }) {
2757
3075
  const off = disabled || field2.readOnly;
2758
3076
  const name = (0, import_parameters.parameterLabel)(field2);
2759
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1.5", children: [
2760
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
2761
- /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
2762
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
2763
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3077
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1.5", children: [
3078
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3079
+ /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3080
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3081
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2764
3082
  ParameterCommitInput,
2765
3083
  {
2766
3084
  id,
@@ -2771,10 +3089,10 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
2771
3089
  onCommit: (text) => onChange(text.trim())
2772
3090
  }
2773
3091
  ),
2774
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex gap-1", children: [
2775
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
3092
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
3093
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
2776
3094
  "Choose file\u2026",
2777
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3095
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2778
3096
  "input",
2779
3097
  {
2780
3098
  type: "file",
@@ -2790,11 +3108,11 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
2790
3108
  }
2791
3109
  )
2792
3110
  ] }),
2793
- value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
3111
+ value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
2794
3112
  ] })
2795
3113
  ] })
2796
3114
  ] }),
2797
- field2.options && field2.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3115
+ field2.options && field2.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-1", children: field2.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2798
3116
  "button",
2799
3117
  {
2800
3118
  type: "button",
@@ -2804,14 +3122,14 @@ function ParameterImage({ field: field2, value, onChange, disabled, id, resolveF
2804
3122
  disabled: off,
2805
3123
  onClick: () => onChange(o.url),
2806
3124
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
2807
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3125
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
2808
3126
  },
2809
3127
  o.url
2810
3128
  )) })
2811
3129
  ] });
2812
3130
  }
2813
3131
  function ParameterText({ field: field2, value, onChange, disabled, id }) {
2814
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3132
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2815
3133
  ParameterCommitInput,
2816
3134
  {
2817
3135
  id,
@@ -2830,24 +3148,24 @@ function ParameterFieldControl({ field: field2, value, onChange, resolveFile, ..
2830
3148
  switch (field2.type) {
2831
3149
  case "number":
2832
3150
  case "int":
2833
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterSlider, { field: field2, value, onChange: set, ...rest });
3151
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSlider, { field: field2, value, onChange: set, ...rest });
2834
3152
  case "boolean":
2835
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterToggle, { field: field2, value, onChange: set, ...rest });
3153
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterToggle, { field: field2, value, onChange: set, ...rest });
2836
3154
  case "choice":
2837
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterSelect, { field: field2, value, onChange: set, ...rest });
3155
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSelect, { field: field2, value, onChange: set, ...rest });
2838
3156
  case "color":
2839
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterColor, { field: field2, value, onChange: set, ...rest });
3157
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterColor, { field: field2, value, onChange: set, ...rest });
2840
3158
  case "vector":
2841
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterVector, { field: field2, value, onChange: set, ...rest });
3159
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterVector, { field: field2, value, onChange: set, ...rest });
2842
3160
  case "image":
2843
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterImage, { field: field2, value, onChange: set, resolveFile, ...rest });
3161
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterImage, { field: field2, value, onChange: set, resolveFile, ...rest });
2844
3162
  case "text":
2845
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterText, { field: field2, value, onChange: set, ...rest });
3163
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterText, { field: field2, value, onChange: set, ...rest });
2846
3164
  }
2847
3165
  }
2848
3166
 
2849
3167
  // src/effects/EffectParameters.tsx
2850
- var import_jsx_runtime15 = require("react/jsx-runtime");
3168
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2851
3169
  function EffectParameters({
2852
3170
  description,
2853
3171
  values,
@@ -2860,12 +3178,12 @@ function EffectParameters({
2860
3178
  disabled = false,
2861
3179
  className = ""
2862
3180
  }) {
2863
- const fields = (0, import_react18.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
2864
- const idBase = (0, import_react18.useId)();
2865
- const gesture = import_react18.default.useRef(null);
2866
- const count = import_react18.default.useRef(0);
2867
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
2868
- (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3181
+ const fields = (0, import_react21.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
3182
+ const idBase = (0, import_react21.useId)();
3183
+ const gesture = import_react21.default.useRef(null);
3184
+ const count = import_react21.default.useRef(0);
3185
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3186
+ (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2869
3187
  "select",
2870
3188
  {
2871
3189
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -2883,8 +3201,8 @@ function EffectParameters({
2883
3201
  }
2884
3202
  },
2885
3203
  children: [
2886
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Presets\u2026" }),
2887
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: p.name, children: p.name }, p.name))
3204
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Presets\u2026" }),
3205
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: p.name, children: p.name }, p.name))
2888
3206
  ]
2889
3207
  }
2890
3208
  ),
@@ -2894,14 +3212,14 @@ function EffectParameters({
2894
3212
  const keyed = keyframed?.has(field2.id) ?? false;
2895
3213
  const value = (0, import_effects3.effectFieldValue)(field2, values[field2.id]);
2896
3214
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field2.default);
2897
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1", "data-effect-control": field2.id, children: [
2898
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1.5", children: [
2899
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field2.description, children: label }),
2900
- keyed && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3215
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1", "data-effect-control": field2.id, children: [
3216
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3217
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field2.description, children: label }),
3218
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
2901
3219
  renderControlAddon?.(field2.id),
2902
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime15.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" })
3220
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime17.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" })
2903
3221
  ] }),
2904
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3222
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2905
3223
  ParameterFieldControl,
2906
3224
  {
2907
3225
  field: field2,
@@ -2915,16 +3233,446 @@ function EffectParameters({
2915
3233
  )
2916
3234
  ] }, field2.id);
2917
3235
  }),
2918
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3236
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3237
+ ] });
3238
+ }
3239
+
3240
+ // src/effects/useEffectAuthoring.ts
3241
+ var import_react22 = require("react");
3242
+ function useEffectAuthoring(session) {
3243
+ return (0, import_react22.useSyncExternalStore)(
3244
+ (callback) => {
3245
+ if (!session) return () => {
3246
+ };
3247
+ return session.subscribe(callback);
3248
+ },
3249
+ () => session ? session.getState() : null,
3250
+ () => null
3251
+ );
3252
+ }
3253
+
3254
+ // src/effects/EffectAuthoringEditor.tsx
3255
+ var import_react23 = require("react");
3256
+ var import_effects4 = require("@pixerate/editor/effects");
3257
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3258
+ function EffectAuthoringEditor({
3259
+ session,
3260
+ showSource = true,
3261
+ showTimeline = true,
3262
+ previewSize = { width: 480, height: 270 },
3263
+ className = ""
3264
+ }) {
3265
+ const state = useEffectAuthoring(session);
3266
+ const canvasRef = (0, import_react23.useRef)(null);
3267
+ const rendererRef = (0, import_react23.useRef)(null);
3268
+ const [rendererReady, setRendererReady] = (0, import_react23.useState)(0);
3269
+ const renderingRef = (0, import_react23.useRef)(false);
3270
+ const pendingRef = (0, import_react23.useRef)(false);
3271
+ const timeRef = (0, import_react23.useRef)(0);
3272
+ const inputsRef = (0, import_react23.useRef)({});
3273
+ const [savingPreset, setSavingPreset] = (0, import_react23.useState)(false);
3274
+ const [presetName, setPresetName] = (0, import_react23.useState)("");
3275
+ const textareaRef = (0, import_react23.useRef)(null);
3276
+ const gutterRef = (0, import_react23.useRef)(null);
3277
+ const [sourceCode, setSourceCode] = (0, import_react23.useState)("");
3278
+ const sourceDebounceRef = (0, import_react23.useRef)(null);
3279
+ (0, import_react23.useEffect)(() => {
3280
+ if (!session) {
3281
+ if (rendererRef.current) {
3282
+ rendererRef.current.dispose();
3283
+ rendererRef.current = null;
3284
+ }
3285
+ return;
3286
+ }
3287
+ let live = true;
3288
+ let createdRenderer = null;
3289
+ Promise.resolve(session.createPreview(previewSize)).then((renderer) => {
3290
+ if (!live) {
3291
+ renderer.dispose();
3292
+ return;
3293
+ }
3294
+ createdRenderer = renderer;
3295
+ rendererRef.current = renderer;
3296
+ setRendererReady((c) => c + 1);
3297
+ });
3298
+ return () => {
3299
+ live = false;
3300
+ if (createdRenderer) {
3301
+ createdRenderer.dispose();
3302
+ }
3303
+ if (rendererRef.current === createdRenderer) {
3304
+ rendererRef.current = null;
3305
+ }
3306
+ };
3307
+ }, [session, previewSize.width, previewSize.height]);
3308
+ const pump = (0, import_react23.useCallback)(async () => {
3309
+ if (renderingRef.current) {
3310
+ pendingRef.current = true;
3311
+ return;
3312
+ }
3313
+ renderingRef.current = true;
3314
+ try {
3315
+ do {
3316
+ pendingRef.current = false;
3317
+ const renderer = rendererRef.current;
3318
+ if (!renderer) break;
3319
+ try {
3320
+ const pixels = await renderer.render({ time: timeRef.current, inputs: inputsRef.current });
3321
+ const ctx = rendererRef.current === renderer ? canvasRef.current?.getContext("2d") : null;
3322
+ if (ctx && typeof ImageData !== "undefined") {
3323
+ ctx.putImageData(new ImageData(new Uint8ClampedArray(pixels.data), pixels.width, pixels.height), 0, 0);
3324
+ }
3325
+ } catch {
3326
+ }
3327
+ } while (pendingRef.current);
3328
+ } finally {
3329
+ renderingRef.current = false;
3330
+ }
3331
+ }, []);
3332
+ const inputSpecs = state?.description.inputs;
3333
+ (0, import_react23.useEffect)(() => {
3334
+ inputsRef.current = inputSpecs ? (0, import_effects4.effectSampleInputs)({ inputs: inputSpecs }, previewSize) : {};
3335
+ }, [inputSpecs, previewSize.width, previewSize.height]);
3336
+ (0, import_react23.useEffect)(() => {
3337
+ if (!state) return;
3338
+ timeRef.current = state.time;
3339
+ void pump();
3340
+ }, [state, rendererReady, pump]);
3341
+ (0, import_react23.useEffect)(() => {
3342
+ if (state?.source !== null && state?.source !== void 0) {
3343
+ setSourceCode(state.source);
3344
+ }
3345
+ }, [state?.source]);
3346
+ (0, import_react23.useEffect)(() => {
3347
+ return () => {
3348
+ if (sourceDebounceRef.current) clearTimeout(sourceDebounceRef.current);
3349
+ };
3350
+ }, []);
3351
+ if (!session || !state) {
3352
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `p-4 text-center text-xs text-muted-foreground ${className}`, children: "No effect authoring session is open." });
3353
+ }
3354
+ const hasSource = showSource && state.sourceLanguage !== null && typeof session.setSource === "function";
3355
+ const handleSourceChange = (e) => {
3356
+ const val = e.target.value;
3357
+ setSourceCode(val);
3358
+ if (sourceDebounceRef.current) clearTimeout(sourceDebounceRef.current);
3359
+ sourceDebounceRef.current = setTimeout(() => {
3360
+ session.setSource?.(val);
3361
+ }, 300);
3362
+ };
3363
+ const handleSavePreset = (e) => {
3364
+ e.preventDefault();
3365
+ const trimmed = presetName.trim();
3366
+ if (trimmed) {
3367
+ session.savePreset(trimmed);
3368
+ setSavingPreset(false);
3369
+ setPresetName("");
3370
+ }
3371
+ };
3372
+ const jumpToLine = (lineNum) => {
3373
+ if (!textareaRef.current) return;
3374
+ const lines = sourceCode.split("\n");
3375
+ let offset = 0;
3376
+ for (let i = 0; i < lineNum - 1 && i < lines.length; i++) {
3377
+ offset += lines[i].length + 1;
3378
+ }
3379
+ textareaRef.current.focus();
3380
+ textareaRef.current.setSelectionRange(offset, offset);
3381
+ };
3382
+ const sourceLines = sourceCode.split("\n");
3383
+ const issueLines = new Set(
3384
+ state.issues.map((i) => i.line).filter((l) => typeof l === "number")
3385
+ );
3386
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-4 rounded border border-border bg-background p-4 text-foreground ${className}`, "data-effect-authoring-editor": state.name, children: [
3387
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3", children: [
3388
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3389
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3390
+ "button",
3391
+ {
3392
+ type: "button",
3393
+ className: "rounded border border-border px-2.5 py-1 text-xs font-medium hover:bg-muted",
3394
+ "aria-label": state.playing ? "Pause playback" : "Start playback",
3395
+ onClick: () => state.playing ? session.pause() : session.play(),
3396
+ children: state.playing ? "Pause" : "Play"
3397
+ }
3398
+ ),
3399
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-mono text-xs text-muted-foreground", "data-time-readout": true, children: [
3400
+ state.time,
3401
+ "ms / ",
3402
+ state.duration,
3403
+ "ms"
3404
+ ] })
3405
+ ] }),
3406
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3407
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3408
+ "button",
3409
+ {
3410
+ type: "button",
3411
+ className: "rounded border border-border px-2 py-1 text-xs disabled:opacity-40 hover:bg-muted",
3412
+ "aria-label": "Undo",
3413
+ disabled: !state.canUndo,
3414
+ onClick: () => session.undo(),
3415
+ children: "Undo"
3416
+ }
3417
+ ),
3418
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3419
+ "button",
3420
+ {
3421
+ type: "button",
3422
+ className: "rounded border border-border px-2 py-1 text-xs disabled:opacity-40 hover:bg-muted",
3423
+ "aria-label": "Redo",
3424
+ disabled: !state.canRedo,
3425
+ onClick: () => session.redo(),
3426
+ children: "Redo"
3427
+ }
3428
+ ),
3429
+ savingPreset ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("form", { onSubmit: handleSavePreset, className: "flex items-center gap-1", children: [
3430
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3431
+ "input",
3432
+ {
3433
+ type: "text",
3434
+ className: "rounded border border-border bg-background px-1.5 py-0.5 text-xs",
3435
+ placeholder: "Preset name",
3436
+ autoFocus: true,
3437
+ value: presetName,
3438
+ onChange: (e) => setPresetName(e.target.value)
3439
+ }
3440
+ ),
3441
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3442
+ "button",
3443
+ {
3444
+ type: "submit",
3445
+ className: "rounded bg-primary px-2 py-0.5 text-xs text-primary-foreground",
3446
+ children: "Save"
3447
+ }
3448
+ ),
3449
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3450
+ "button",
3451
+ {
3452
+ type: "button",
3453
+ className: "rounded border border-border px-1.5 py-0.5 text-xs hover:bg-muted",
3454
+ onClick: () => setSavingPreset(false),
3455
+ children: "Cancel"
3456
+ }
3457
+ )
3458
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3459
+ "button",
3460
+ {
3461
+ type: "button",
3462
+ className: "rounded border border-border px-2 py-1 text-xs hover:bg-muted",
3463
+ onClick: () => setSavingPreset(true),
3464
+ children: "Save preset\u2026"
3465
+ }
3466
+ )
3467
+ ] })
3468
+ ] }),
3469
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
3470
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2", children: [
3471
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Preview" }),
3472
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "relative flex aspect-video w-full items-center justify-center overflow-hidden rounded border border-border bg-black", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3473
+ "canvas",
3474
+ {
3475
+ ref: canvasRef,
3476
+ width: previewSize.width,
3477
+ height: previewSize.height,
3478
+ className: "h-full w-full object-contain",
3479
+ "aria-label": "Effect preview canvas"
3480
+ }
3481
+ ) }),
3482
+ state.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "space-y-1 rounded border border-destructive/20 bg-destructive/10 p-2 text-xs", "data-effect-issues": true, children: state.issues.map((issue, idx) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3483
+ "div",
3484
+ {
3485
+ className: `cursor-pointer ${issue.severity === "error" ? "text-destructive" : "text-amber-500"}`,
3486
+ onClick: () => issue.line !== void 0 && jumpToLine(issue.line),
3487
+ children: [
3488
+ issue.line !== void 0 ? `Line ${issue.line}: ` : "",
3489
+ issue.message
3490
+ ]
3491
+ },
3492
+ idx
3493
+ )) })
3494
+ ] }),
3495
+ hasSource && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2", "data-effect-source-pane": true, children: [
3496
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-between text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
3497
+ "Source (",
3498
+ state.sourceLanguage,
3499
+ ")"
3500
+ ] }) }),
3501
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex h-64 rounded border border-border bg-muted/20 font-mono text-xs", children: [
3502
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: gutterRef, className: "select-none overflow-hidden border-r border-border bg-muted/40 px-2 py-2 text-right text-muted-foreground", "aria-hidden": "true", children: sourceLines.map((_, i) => {
3503
+ const lineNum = i + 1;
3504
+ const hasIssue = issueLines.has(lineNum);
3505
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3506
+ "div",
3507
+ {
3508
+ "data-gutter-line": lineNum,
3509
+ className: hasIssue ? "font-bold text-destructive" : "",
3510
+ children: lineNum
3511
+ },
3512
+ i
3513
+ );
3514
+ }) }),
3515
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3516
+ "textarea",
3517
+ {
3518
+ ref: textareaRef,
3519
+ value: sourceCode,
3520
+ onChange: handleSourceChange,
3521
+ onScroll: (e) => {
3522
+ if (gutterRef.current) gutterRef.current.scrollTop = e.currentTarget.scrollTop;
3523
+ },
3524
+ "aria-label": "Effect source code",
3525
+ spellCheck: false,
3526
+ wrap: "off",
3527
+ className: "flex-1 resize-none bg-transparent p-2 font-mono text-xs text-foreground focus:outline-none"
3528
+ }
3529
+ )
3530
+ ] })
3531
+ ] })
3532
+ ] }),
3533
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2 border-t border-border pt-4", children: [
3534
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Parameters" }),
3535
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3536
+ EffectParameters,
3537
+ {
3538
+ description: state.description,
3539
+ values: state.values,
3540
+ onChange: (control, val, gesture) => session.setValue(control, val, { gesture }),
3541
+ onReset: (control) => session.resetValues([control]),
3542
+ onPresetName: (name) => session.applyPreset(name),
3543
+ renderControlAddon: (control) => {
3544
+ const track = state.tracks[control];
3545
+ const isAnimated = Boolean(track && track.length > 0);
3546
+ const hasKeyframeAtPlayhead = isAnimated && track.some((kf) => kf.time === state.time);
3547
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3548
+ "button",
3549
+ {
3550
+ type: "button",
3551
+ "data-keyframe-toggle": control,
3552
+ "aria-label": hasKeyframeAtPlayhead ? `Remove keyframe for ${control}` : `Add keyframe for ${control}`,
3553
+ onClick: () => {
3554
+ if (hasKeyframeAtPlayhead) {
3555
+ session.removeKeyframe(control, state.time);
3556
+ } else {
3557
+ session.setKeyframe(control, state.time);
3558
+ }
3559
+ },
3560
+ className: `rounded px-1 text-xs transition-colors ${hasKeyframeAtPlayhead ? "text-primary font-bold" : isAnimated ? "text-foreground" : "text-muted-foreground hover:text-foreground"}`,
3561
+ title: hasKeyframeAtPlayhead ? "Remove keyframe at playhead" : "Add keyframe at playhead",
3562
+ children: hasKeyframeAtPlayhead ? "\u25C6" : "\u25C7"
3563
+ }
3564
+ );
3565
+ }
3566
+ }
3567
+ )
3568
+ ] }),
3569
+ showTimeline && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-3 border-t border-border pt-4", "data-effect-timeline": true, children: [
3570
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
3571
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Timeline" }),
3572
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-3 text-xs", children: [
3573
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5", children: [
3574
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Duration:" }),
3575
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DurationField, { duration: state.duration, onCommit: (duration) => session.setTiming({ duration }) }),
3576
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-muted-foreground", children: "ms" })
3577
+ ] }),
3578
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5 cursor-pointer", children: [
3579
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3580
+ "input",
3581
+ {
3582
+ type: "checkbox",
3583
+ "aria-label": "Loop playback",
3584
+ checked: state.loop,
3585
+ onChange: (e) => session.setTiming({ loop: e.target.checked })
3586
+ }
3587
+ ),
3588
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Loop" })
3589
+ ] })
3590
+ ] })
3591
+ ] }),
3592
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3593
+ "input",
3594
+ {
3595
+ type: "range",
3596
+ "aria-label": "Timeline scrubber",
3597
+ min: 0,
3598
+ max: state.duration,
3599
+ value: state.time,
3600
+ onChange: (e) => session.seek(Number(e.target.value)),
3601
+ className: "w-full cursor-pointer accent-primary"
3602
+ }
3603
+ ) }),
3604
+ Object.entries(state.tracks).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "space-y-2 pt-1", children: Object.entries(state.tracks).map(([control, keyframes]) => {
3605
+ if (!keyframes || keyframes.length === 0) return null;
3606
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", "data-track": control, children: [
3607
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3608
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium", children: control }),
3609
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3610
+ "button",
3611
+ {
3612
+ type: "button",
3613
+ className: "text-[11px] hover:text-foreground",
3614
+ onClick: () => session.clearTrack(control),
3615
+ "aria-label": `Clear animation track for ${control}`,
3616
+ children: "Clear track"
3617
+ }
3618
+ )
3619
+ ] }),
3620
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "relative h-4 w-full rounded bg-muted/40", children: keyframes.map((kf, i) => {
3621
+ const leftPct = Math.max(
3622
+ 0,
3623
+ Math.min(100, kf.time / (state.duration || 1) * 100)
3624
+ );
3625
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3626
+ "button",
3627
+ {
3628
+ type: "button",
3629
+ onClick: () => session.seek(kf.time),
3630
+ "aria-label": `Seek to ${control} keyframe at ${kf.time}ms`,
3631
+ title: `${control} @ ${kf.time}ms`,
3632
+ style: { left: `${leftPct}%` },
3633
+ className: "absolute top-1/2 -translate-x-1/2 -translate-y-1/2 text-[10px] text-primary hover:scale-125",
3634
+ children: "\u25C6"
3635
+ },
3636
+ i
3637
+ );
3638
+ }) })
3639
+ ] }, control);
3640
+ }) })
3641
+ ] })
2919
3642
  ] });
2920
3643
  }
3644
+ function DurationField({ duration, onCommit }) {
3645
+ const [draft, setDraft] = (0, import_react23.useState)(String(duration));
3646
+ (0, import_react23.useEffect)(() => setDraft(String(duration)), [duration]);
3647
+ const commit = () => {
3648
+ const next = Number(draft);
3649
+ if (Number.isFinite(next) && next >= 1 && next !== duration) onCommit(next);
3650
+ else setDraft(String(duration));
3651
+ };
3652
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3653
+ "input",
3654
+ {
3655
+ type: "number",
3656
+ "aria-label": "Duration",
3657
+ min: 1,
3658
+ value: draft,
3659
+ onChange: (e) => setDraft(e.target.value),
3660
+ onBlur: commit,
3661
+ onKeyDown: (e) => {
3662
+ if (e.key === "Enter") commit();
3663
+ else if (e.key === "Escape") setDraft(String(duration));
3664
+ },
3665
+ className: "w-16 rounded border border-border bg-background px-1.5 py-0.5 text-xs font-mono"
3666
+ }
3667
+ );
3668
+ }
2921
3669
 
2922
3670
  // src/video-editor/VideoEffectsPanel.tsx
2923
- var import_react19 = require("react");
2924
- var import_video_editor9 = require("@pixerate/editor/video-editor");
2925
- var import_jsx_runtime16 = require("react/jsx-runtime");
2926
- var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
2927
- var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => (0, import_video_editor9.isVideoKeyframes)(v)).map(([k]) => k));
3671
+ var import_react24 = require("react");
3672
+ var import_video_editor11 = require("@pixerate/editor/video-editor");
3673
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3674
+ var btn7 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
3675
+ var keyedOf = (values) => new Set(Object.entries(values ?? {}).filter(([, v]) => (0, import_video_editor11.isVideoKeyframes)(v)).map(([k]) => k));
2928
3676
  function EffectControls({
2929
3677
  provider,
2930
3678
  effect,
@@ -2935,23 +3683,25 @@ function EffectControls({
2935
3683
  onPreset
2936
3684
  }) {
2937
3685
  const { description, error } = useEffectDescription(provider, effect);
2938
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
3686
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
2939
3687
  'No effects provider: "',
2940
3688
  name ?? effect,
2941
3689
  '" is kept and shown as a placeholder.'
2942
3690
  ] });
2943
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
2944
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
2945
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
3691
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3692
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3693
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectParameters, { description, values: values ?? {}, keyframed: keyedOf(values), disabled, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
2946
3694
  }
2947
3695
  function VideoEffectsPanel({ controller, className = "" }) {
2948
3696
  const state = useVideoEditorState(controller);
2949
3697
  const provider = state.effectsProvider;
2950
- const [browse, setBrowse] = (0, import_react19.useState)(null);
2951
- const [message, setMessage] = (0, import_react19.useState)(null);
2952
- const [open, setOpen] = (0, import_react19.useState)(null);
3698
+ const [browse, setBrowse] = (0, import_react24.useState)(null);
3699
+ const [message, setMessage] = (0, import_react24.useState)(null);
3700
+ const [open, setOpen] = (0, import_react24.useState)(null);
3701
+ const [authoring, setAuthoring] = (0, import_react24.useState)(null);
3702
+ (0, import_react24.useEffect)(() => () => authoring?.dispose(), [authoring]);
2953
3703
  const selected = state.selection[0];
2954
- const at = selected ? (0, import_video_editor9.findVideoClip)(state.project, selected) : null;
3704
+ const at = selected ? (0, import_video_editor11.findVideoClip)(state.project, selected) : null;
2955
3705
  const clip = at?.clip ?? null;
2956
3706
  const disabled = state.readOnly;
2957
3707
  const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? null : x.error));
@@ -2960,18 +3710,18 @@ function VideoEffectsPanel({ controller, className = "" }) {
2960
3710
  if (!track) return setMessage("Add a video track first.");
2961
3711
  report(controller.addEffectClip(track, effect, { start: Math.round(state.time), mode: "overwrite" }).then((r) => (r.ok && r.clip && controller.select([r.clip]), r)));
2962
3712
  };
2963
- return /* @__PURE__ */ (0, import_jsx_runtime16.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: [
2964
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
2965
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
2966
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
3713
+ return /* @__PURE__ */ (0, import_jsx_runtime19.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: [
3714
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3715
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "flex-1 font-semibold", children: "Effects" }),
3716
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, onClick: () => setBrowse(browse === "generator" ? null : "generator"), "aria-pressed": browse === "generator", children: "Add effect clip" })
2967
3717
  ] }),
2968
- !provider && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
2969
- browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
2970
- !clip && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
2971
- clip && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
2972
- clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
2973
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
2974
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3718
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the project are kept and drawn as placeholders." }),
3719
+ browse === "generator" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectsBrowser, { provider, uses: ["generator", "title", "overlay"], title: "Generators and titles", onPick: (e) => (setBrowse(null), addEffectClip(e.id)) }),
3720
+ !clip && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a clip to see its effects." }),
3721
+ clip && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3722
+ clip.type === "effect" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
3723
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "font-medium", children: clip.name ?? clip.effect }),
3724
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2975
3725
  EffectControls,
2976
3726
  {
2977
3727
  provider,
@@ -2984,13 +3734,13 @@ function VideoEffectsPanel({ controller, className = "" }) {
2984
3734
  }
2985
3735
  )
2986
3736
  ] }),
2987
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
2988
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
2989
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
2990
- clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
3737
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", "data-effect-part": "transition", children: [
3738
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3739
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex-1 font-medium", children: "Transition in" }),
3740
+ clip.transition?.type === "effect" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled, onClick: () => report(controller.apply({ op: "set_transition", clip: clip.id, transition: null }, "Remove transition")), children: "Remove" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Effect transition\u2026" })
2991
3741
  ] }),
2992
- browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
2993
- clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3742
+ browse === "transition" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), report(controller.setEffectTransition(clip.id, e.id))) }),
3743
+ clip.transition?.type === "effect" && clip.transition.effect && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2994
3744
  EffectControls,
2995
3745
  {
2996
3746
  provider,
@@ -3003,24 +3753,40 @@ function VideoEffectsPanel({ controller, className = "" }) {
3003
3753
  }
3004
3754
  )
3005
3755
  ] }),
3006
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
3007
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
3008
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
3009
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
3756
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", "data-effect-part": "stack", children: [
3757
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3758
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex-1 font-medium", children: "On this clip" }),
3759
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || !provider, "aria-pressed": browse === "clip", onClick: () => setBrowse(browse === "clip" ? null : "clip"), children: "Add effect\u2026" })
3010
3760
  ] }),
3011
- browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
3012
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
3013
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
3014
- /* @__PURE__ */ (0, import_jsx_runtime16.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 })) }),
3015
- /* @__PURE__ */ (0, import_jsx_runtime16.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 }),
3016
- /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
3017
- /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
3018
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
3761
+ browse === "clip" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectsBrowser, { provider, uses: ["filter", "overlay"], title: "Filters and overlays", onPick: (e) => (setBrowse(null), report(controller.applyClipEffect(clip.id, e.id))) }),
3762
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ol", { className: "space-y-1", children: (clip.effects ?? []).map((e, i, all) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { className: "rounded border border-border p-1", "data-clip-effect": e.id, children: [
3763
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3764
+ /* @__PURE__ */ (0, import_jsx_runtime19.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 })) }),
3765
+ /* @__PURE__ */ (0, import_jsx_runtime19.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 }),
3766
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || i === 0, "aria-label": "Move up", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i - 1 })), children: "\u2191" }),
3767
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled: disabled || i === all.length - 1, "aria-label": "Move down", onClick: () => report(controller.updateClipEffect(clip.id, e.id, { index: i + 1 })), children: "\u2193" }),
3768
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3769
+ "button",
3770
+ {
3771
+ type: "button",
3772
+ className: btn7,
3773
+ disabled: disabled || !provider,
3774
+ "aria-label": `Author ${e.name ?? e.effect}`,
3775
+ title: "Tune and keyframe it in the effect authoring editor",
3776
+ "data-author-effect": e.id,
3777
+ onClick: () => void (0, import_video_editor11.openVideoClipEffectAuthoring)(controller, clip.id, e.id).then(
3778
+ (a) => setAuthoring(a),
3779
+ (err) => setMessage(err instanceof Error ? err.message : String(err))
3780
+ ),
3781
+ children: "\u270E"
3782
+ }
3783
+ ),
3784
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeClipEffect(clip.id, e.id)), children: "\u2715" })
3019
3785
  ] }),
3020
- open === e.id && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mt-1 space-y-2", children: [
3021
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
3022
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
3023
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3786
+ open === e.id && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mt-1 space-y-2", children: [
3787
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3788
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-14 text-[11px]", children: "Opacity" }),
3789
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3024
3790
  "input",
3025
3791
  {
3026
3792
  type: "range",
@@ -3028,14 +3794,14 @@ function VideoEffectsPanel({ controller, className = "" }) {
3028
3794
  max: 1,
3029
3795
  step: 0.01,
3030
3796
  className: "flex-1",
3031
- disabled: disabled || (0, import_video_editor9.isVideoKeyframes)(e.opacity),
3797
+ disabled: disabled || (0, import_video_editor11.isVideoKeyframes)(e.opacity),
3032
3798
  value: typeof e.opacity === "number" ? e.opacity : 1,
3033
3799
  "aria-label": `${e.name ?? e.effect} opacity`,
3034
3800
  onChange: (ev) => report(controller.updateClipEffect(clip.id, e.id, { opacity: Number(ev.currentTarget.value) }, { merge: `opacity:${clip.id}:${e.id}` }))
3035
3801
  }
3036
3802
  )
3037
3803
  ] }),
3038
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3804
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3039
3805
  EffectControls,
3040
3806
  {
3041
3807
  provider,
@@ -3049,49 +3815,72 @@ function VideoEffectsPanel({ controller, className = "" }) {
3049
3815
  )
3050
3816
  ] })
3051
3817
  ] }, e.id)) }),
3052
- !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
3818
+ !clip.effects?.length && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects on this clip." })
3053
3819
  ] })
3054
3820
  ] }),
3055
- message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3821
+ authoring && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-effect-authoring": authoring.instance, children: [
3822
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectAuthoringEditor, { session: authoring.session, showSource: false, previewSize: { width: 240, height: 135 } }),
3823
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
3824
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3825
+ "button",
3826
+ {
3827
+ type: "button",
3828
+ className: btn7,
3829
+ disabled,
3830
+ "data-apply-authoring": "",
3831
+ onClick: () => void authoring.commit().then((r) => {
3832
+ setMessage(r.ok ? r.notes?.join(" ") ?? null : r.error);
3833
+ if (r.ok) setAuthoring(null);
3834
+ }),
3835
+ children: "Apply to clip"
3836
+ }
3837
+ ),
3838
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: btn7, onClick: () => setAuthoring(null), children: "Close" })
3839
+ ] })
3840
+ ] }),
3841
+ message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3056
3842
  ] });
3057
3843
  }
3058
3844
 
3059
3845
  // src/video-editor/VideoEditor.tsx
3060
- var import_jsx_runtime17 = require("react/jsx-runtime");
3061
- function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
3846
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3847
+ function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, transcriptMode = "panel", showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
3062
3848
  const { controller, state } = useVideoEditor(given ?? options ?? {});
3063
3849
  useEffects(controller, effects);
3064
- const effectsShown = showEffects ?? !!(state.effectsProvider || state.project.tracks.some((t) => t.clips.some((c) => c.type === "effect" || c.effects?.length || c.transition?.type === "effect")));
3065
- (0, import_react20.useEffect)(() => {
3850
+ const effectsShown = showEffects ?? !!(state.effectsProvider || state.project.tracks.some((t) => t.clips.some((c) => c.type === "effect" || c.type === "adjustment" || c.effects?.length || c.transition?.type === "effect")));
3851
+ (0, import_react25.useEffect)(() => {
3066
3852
  if (editable) return;
3067
3853
  const was = controller.getState().readOnly;
3068
3854
  controller.setReadOnly(true);
3069
3855
  return () => controller.setReadOnly(was);
3070
3856
  }, [controller, editable]);
3071
3857
  const { issues } = state;
3072
- const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.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_runtime17.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)) });
3073
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
3074
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
3075
- editable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MediaBin, { controller, className: "min-w-0" }),
3076
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
3077
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
3078
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VideoTransport, { controller, editable }),
3079
- showScopes && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VideoScopes, { controller })
3858
+ const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.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)) });
3859
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-3 ${className}`, "data-video-editor": "", children: [
3860
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `grid gap-3 ${editable ? "lg:grid-cols-[16rem_minmax(0,1fr)_18rem]" : ""}`, children: [
3861
+ editable && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MediaBin, { controller, className: "min-w-0" }),
3862
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
3863
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoPreview, { controller, resolution, className: "rounded-md border border-border" }),
3864
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoTransport, { controller, editable }),
3865
+ showScopes && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoScopes, { controller })
3080
3866
  ] }),
3081
- editable && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3082
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ClipInspector, { controller, className: "min-w-0" }),
3083
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
3867
+ editable && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3868
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ClipInspector, { controller, className: "min-w-0" }),
3869
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoEffectsPanel, { controller, className: "min-w-0" })
3084
3870
  ] })
3085
3871
  ] }),
3086
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
3087
- showTranscript && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TranscriptPanel, { controller, editable }),
3872
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
3873
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EditPlanPreview, { controller, editable }),
3874
+ showTranscript && (transcriptMode === "editor" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranscriptEditor, { controller, editable }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranscriptPanel, { controller, editable })),
3088
3875
  issueList
3089
3876
  ] });
3090
3877
  }
3091
3878
  // Annotate the CommonJS export names for ESM import in node:
3092
3879
  0 && (module.exports = {
3093
3880
  ClipInspector,
3881
+ EditPlanPreview,
3094
3882
  MediaBin,
3883
+ TranscriptEditor,
3095
3884
  TranscriptPanel,
3096
3885
  VideoEditor,
3097
3886
  VideoEffectsPanel,
@@ -3099,9 +3888,13 @@ function VideoEditor({ controller: given, options, editable = true, pxPerSecond,
3099
3888
  VideoScopes,
3100
3889
  VideoTimeline,
3101
3890
  VideoTransport,
3891
+ useTranscriptVideoController,
3892
+ useTranscriptVideoState,
3893
+ useVideoDialogueTools,
3102
3894
  useVideoEditor,
3103
3895
  useVideoEditorController,
3104
3896
  useVideoEditorState,
3105
3897
  useVideoEditorTools,
3106
- useVideoEffectsTools
3898
+ useVideoEffectsTools,
3899
+ useVideoMusicTools
3107
3900
  });