@pixerate/editor-react 0.92.0 → 0.94.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.
Files changed (51) hide show
  1. package/dist/animation-editor/AnimationEditor.d.cts +14 -3
  2. package/dist/animation-editor/AnimationEditor.d.ts +14 -3
  3. package/dist/animation-editor/AnimationRecordPanel.d.cts +17 -0
  4. package/dist/animation-editor/AnimationRecordPanel.d.ts +17 -0
  5. package/dist/animation-editor/AnimationStage.d.cts +8 -2
  6. package/dist/animation-editor/AnimationStage.d.ts +8 -2
  7. package/dist/animation-editor/index.cjs +607 -405
  8. package/dist/animation-editor/index.d.cts +1 -0
  9. package/dist/animation-editor/index.d.ts +1 -0
  10. package/dist/animation-editor/index.js +359 -242
  11. package/dist/canvas/index.cjs +3 -2
  12. package/dist/canvas/index.js +4 -4
  13. package/dist/chart/ChartEditor.d.cts +12 -1
  14. package/dist/chart/ChartEditor.d.ts +12 -1
  15. package/dist/chart/index.cjs +187 -29
  16. package/dist/chart/index.js +74 -10
  17. package/dist/{chunk-6MDTFAPY.js → chunk-6YRSQW2V.js} +5 -5
  18. package/dist/chunk-7I73DW4V.js +43 -0
  19. package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
  20. package/dist/{chunk-ECBC4HD7.js → chunk-IPVWWVSF.js} +3 -2
  21. package/dist/image-editor/index.cjs +3 -2
  22. package/dist/image-editor/index.js +2 -2
  23. package/dist/index.cjs +609 -527
  24. package/dist/index.js +10 -6
  25. package/dist/paint-editor/PaintEditor.d.cts +12 -1
  26. package/dist/paint-editor/PaintEditor.d.ts +12 -1
  27. package/dist/paint-editor/index.cjs +319 -164
  28. package/dist/paint-editor/index.js +84 -11
  29. package/dist/parameters/ParametersPanel.d.cts +11 -1
  30. package/dist/parameters/ParametersPanel.d.ts +11 -1
  31. package/dist/parameters/index.cjs +190 -41
  32. package/dist/parameters/index.js +23 -4
  33. package/dist/playback/index.d.cts +1 -0
  34. package/dist/playback/index.d.ts +1 -0
  35. package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
  36. package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
  37. package/dist/playback/usePlaybackSurface.d.cts +3 -1
  38. package/dist/playback/usePlaybackSurface.d.ts +3 -1
  39. package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
  40. package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
  41. package/dist/spreadsheet/index.cjs +443 -313
  42. package/dist/spreadsheet/index.js +2 -1
  43. package/dist/vector/index.cjs +3 -2
  44. package/dist/vector/index.js +5 -5
  45. package/dist/video-editor/VideoEditor.d.cts +6 -1
  46. package/dist/video-editor/VideoEditor.d.ts +6 -1
  47. package/dist/video-editor/VideoTimeline.d.cts +11 -1
  48. package/dist/video-editor/VideoTimeline.d.ts +11 -1
  49. package/dist/video-editor/index.cjs +463 -332
  50. package/dist/video-editor/index.js +53 -5
  51. package/package.json +3 -3
@@ -32,6 +32,7 @@ var animation_editor_exports = {};
32
32
  __export(animation_editor_exports, {
33
33
  AnimationEditor: () => AnimationEditor,
34
34
  AnimationEffectsPanel: () => AnimationEffectsPanel,
35
+ AnimationRecordPanel: () => AnimationRecordPanel,
35
36
  AnimationStage: () => AnimationStage,
36
37
  CommandInspector: () => CommandInspector,
37
38
  CommandList: () => CommandList,
@@ -104,26 +105,44 @@ function useAnimationEffectsTools(registry, controller, options = {}) {
104
105
  var import_react2 = require("react");
105
106
  var import_animation_editor2 = require("@pixerate/editor/animation-editor");
106
107
  var import_jsx_runtime = require("react/jsx-runtime");
107
- function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, className = "" }) {
108
+ function AnimationStage({ controller, values, onionSkin, motionPaths, onPick, highlight, recordMode = "move", className = "" }) {
108
109
  const state = useAnimationEditorState(controller);
109
- const { scene, time } = state;
110
+ const { scene, time, recording } = state;
111
+ const samples = recording?.samples ?? -1;
112
+ const dragging = (0, import_react2.useRef)(null);
113
+ const point = (e) => controller.clientToDocument(e.currentTarget.getBoundingClientRect(), e.clientX, e.clientY);
110
114
  const key = highlight?.join("\0") ?? "";
111
115
  const svg = (0, import_react2.useMemo)(
112
116
  () => (0, import_animation_editor2.highlightMotionSvg)(
113
117
  controller.toSvg(time, { pretty: false, idPrefix: "ae-", values, onionSkin, motionPaths }).replace(/<svg ([^>]*?)width="[^"]*" height="[^"]*"/, '<svg $1width="100%" height="100%"'),
114
118
  highlight ?? []
115
119
  ),
116
- [controller, scene, time, values, onionSkin, motionPaths, key]
120
+ [controller, scene, time, samples, values, onionSkin, motionPaths, key]
117
121
  );
118
122
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
119
123
  "div",
120
124
  {
121
- className: `relative overflow-hidden ${onPick ? "cursor-crosshair" : ""} ${className}`,
125
+ className: `relative overflow-hidden ${recording ? "cursor-grab touch-none" : onPick ? "cursor-crosshair" : ""} ${className}`,
122
126
  style: { aspectRatio: `${scene.artwork.width} / ${scene.artwork.height}` },
123
127
  "data-animation-stage": "",
128
+ "data-recording": recording ? "" : void 0,
124
129
  role: "img",
125
130
  "aria-label": `${scene.name} at ${(time / 1e3).toFixed(2)} s`,
126
131
  onClick: onPick ? (e) => onPick((0, import_animation_editor2.motionNodeAtElement)(scene, e.target, e.currentTarget), e) : void 0,
132
+ onPointerDown: recording ? (e) => {
133
+ const id = (0, import_animation_editor2.motionNodeAtElement)(scene, e.target, e.currentTarget);
134
+ if (!id || !controller.beginRecordGesture(id, recordMode, point(e))) return;
135
+ dragging.current = e.pointerId;
136
+ e.currentTarget.setPointerCapture?.(e.pointerId);
137
+ e.preventDefault();
138
+ } : void 0,
139
+ onPointerMove: recording ? (e) => dragging.current === e.pointerId && controller.updateRecordGesture(point(e)) : void 0,
140
+ onPointerUp: recording ? (e) => {
141
+ if (dragging.current !== e.pointerId) return;
142
+ dragging.current = null;
143
+ controller.endRecordGesture();
144
+ } : void 0,
145
+ onPointerCancel: recording ? () => (dragging.current = null, controller.endRecordGesture()) : void 0,
127
146
  dangerouslySetInnerHTML: { __html: svg }
128
147
  }
129
148
  );
@@ -200,26 +219,166 @@ function ShotTimeline({ controller, className = "" }) {
200
219
  }
201
220
 
202
221
  // src/animation-editor/AnimationEditor.tsx
203
- var import_react15 = require("react");
204
- var import_animation_editor10 = require("@pixerate/editor/animation-editor");
222
+ var import_react18 = require("react");
223
+
224
+ // src/playback/AgentPlaybackContext.tsx
225
+ var import_react3 = require("react");
226
+ var import_jsx_runtime3 = require("react/jsx-runtime");
227
+ var AgentPlaybackContext = (0, import_react3.createContext)(null);
228
+ function useAgentPlayback() {
229
+ return (0, import_react3.useContext)(AgentPlaybackContext);
230
+ }
231
+
232
+ // src/playback/usePlaybackSurface.ts
233
+ var import_react4 = require("react");
234
+ var import_tools = require("@pixerate/editor/tools");
235
+ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
236
+ const ambient = useAgentPlayback();
237
+ const target = playback === void 0 ? ambient : playback;
238
+ const [ownPresence] = (0, import_react4.useState)(() => new import_tools.PresenceStore());
239
+ const presence = sharedPresence ?? ownPresence;
240
+ const latest = (0, import_react4.useRef)(options);
241
+ latest.current = options;
242
+ (0, import_react4.useEffect)(() => {
243
+ if (!target || !id) return;
244
+ const o = () => latest.current;
245
+ const surface = {
246
+ presence,
247
+ locate: (ref) => o().locate?.(ref) ?? null,
248
+ bounds: () => o().bounds?.() ?? null,
249
+ visible: () => o().visible?.() ?? true,
250
+ toViewport: (p) => o().toViewport?.(p) ?? p,
251
+ fromViewport: (p) => o().fromViewport?.(p) ?? p,
252
+ beginGesture: (key) => o().beginGesture?.(key),
253
+ endGesture: () => o().endGesture?.(),
254
+ reveal: () => o().reveal?.(),
255
+ open: (ref) => o().open?.(ref),
256
+ get defaultKind() {
257
+ return o().defaultKind;
258
+ }
259
+ };
260
+ const detach = target.attach(id, surface);
261
+ return () => {
262
+ detach();
263
+ for (const a of presence.getState().actors) presence.remove(a.id);
264
+ };
265
+ }, [target, id, presence]);
266
+ return presence;
267
+ }
268
+
269
+ // src/playback/PresenceLayer.tsx
270
+ var import_react5 = __toESM(require("react"), 1);
271
+ var import_jsx_runtime4 = require("react/jsx-runtime");
272
+ function PresenceLayer({ presence, viewport, className = "" }) {
273
+ const { actors } = (0, import_react5.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
274
+ if (!actors.length) return null;
275
+ const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
276
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
277
+ "div",
278
+ {
279
+ className: `pixerate-presence ${className}`.trim(),
280
+ "aria-hidden": "true",
281
+ "data-testid": "presence-layer",
282
+ style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
283
+ children: actors.map((a) => {
284
+ const at = map(a);
285
+ const ring = a.focus && (() => {
286
+ const tl = map(a.focus);
287
+ const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
288
+ return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
289
+ })();
290
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react5.default.Fragment, { children: [
291
+ ring && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
292
+ "div",
293
+ {
294
+ "data-actor-focus": a.id,
295
+ style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
296
+ }
297
+ ),
298
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
299
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
300
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
301
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
302
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
303
+ ] })
304
+ ] })
305
+ ] }, a.id);
306
+ })
307
+ }
308
+ );
309
+ }
310
+
311
+ // src/animation-editor/AnimationEditor.tsx
312
+ var import_animation_editor11 = require("@pixerate/editor/animation-editor");
313
+
314
+ // src/animation-editor/AnimationRecordPanel.tsx
315
+ var import_animation_editor3 = require("@pixerate/editor/animation-editor");
316
+ var import_jsx_runtime5 = require("react/jsx-runtime");
317
+ var btn = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
318
+ var MODE_LABELS = { move: "Move", scale: "Scale", rotate: "Rotate" };
319
+ var hex6 = (c) => c && /^#[0-9a-f]{6}/i.test(c) ? c.slice(0, 7).toLowerCase() : "#000000";
320
+ function AnimationRecordPanel({ controller, node, mode, onModeChange, className = "" }) {
321
+ const state = useAnimationEditorState(controller);
322
+ const { recording, readOnly, error } = state;
323
+ const pose = recording && node ? controller.pose(node) : null;
324
+ const sample = (values) => node && controller.recordSample(node, values);
325
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs ${className}`, "data-animation-record": "", children: [
326
+ recording ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
327
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: `${btn} border-red-500 text-red-600`, onClick: () => controller.stopRecording(), "data-record-stop": "", children: "\u25A0 Stop" }),
328
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn, onClick: () => controller.cancelRecording(), "data-record-cancel": "", children: "Cancel" }),
329
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn, onClick: () => controller.toggle(), children: state.playing ? "Pause" : "Resume" }),
330
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "tabular-nums text-red-600", "aria-live": "polite", children: [
331
+ "\u25CF REC ",
332
+ (recording.elapsed / 1e3).toFixed(1),
333
+ " s \xB7 ",
334
+ recording.samples,
335
+ " samples"
336
+ ] })
337
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: btn, onClick: () => controller.startRecording(), disabled: readOnly, title: "Perform changes live on the stage and keep them as a new shot", "data-record-start": "", children: "\u25CF Record" }),
338
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": "Drag to", children: [
339
+ "Drag to",
340
+ import_animation_editor3.MOTION_RECORD_GESTURE_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-0.5", children: [
341
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "radio", name: "animation-record-mode", checked: mode === m, onChange: () => onModeChange(m) }),
342
+ " ",
343
+ MODE_LABELS[m]
344
+ ] }, m))
345
+ ] }),
346
+ pose && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-2", "data-record-paint": "", children: [
347
+ pose.fill !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1", children: [
348
+ "Fill ",
349
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", value: hex6(pose.fill), onChange: (e) => sample({ fill: e.target.value }) })
350
+ ] }),
351
+ pose.stroke !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1", children: [
352
+ "Stroke ",
353
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", value: hex6(pose.stroke), onChange: (e) => sample({ stroke: e.target.value }) })
354
+ ] }),
355
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1", children: [
356
+ "Opacity ",
357
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "range", min: 0, max: 1, step: 0.01, value: pose.opacity, onChange: (e) => sample({ opacity: Number(e.target.value) }) })
358
+ ] })
359
+ ] }),
360
+ recording && !node && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground", children: "Drag an element; click one to record its paint and opacity." }),
361
+ !recording && error && /record/i.test(error) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-amber-600", children: error })
362
+ ] });
363
+ }
205
364
 
206
365
  // src/animation-editor/CommandInspector.tsx
207
- var import_react4 = __toESM(require("react"), 1);
208
- var import_animation_editor4 = require("@pixerate/editor/animation-editor");
366
+ var import_react7 = __toESM(require("react"), 1);
367
+ var import_animation_editor5 = require("@pixerate/editor/animation-editor");
209
368
 
210
369
  // src/animation-editor/EasePicker.tsx
211
- var import_react3 = require("react");
212
- var import_animation_editor3 = require("@pixerate/editor/animation-editor");
213
- var import_jsx_runtime3 = require("react/jsx-runtime");
370
+ var import_react6 = require("react");
371
+ var import_animation_editor4 = require("@pixerate/editor/animation-editor");
372
+ var import_jsx_runtime6 = require("react/jsx-runtime");
214
373
  var W = 72;
215
374
  var H = 44;
216
375
  function EasePicker({ value, onChange, disabled, className = "" }) {
217
- const key = (0, import_animation_editor3.motionEaseKey)(value);
218
- const curve = (0, import_react3.useMemo)(() => (0, import_animation_editor3.motionEasingCurve)(value ?? "ease-out"), [value]);
219
- const guides = (0, import_animation_editor3.motionEasingGuides)(curve, H);
376
+ const key = (0, import_animation_editor4.motionEaseKey)(value);
377
+ const curve = (0, import_react6.useMemo)(() => (0, import_animation_editor4.motionEasingCurve)(value ?? "ease-out"), [value]);
378
+ const guides = (0, import_animation_editor4.motionEasingGuides)(curve, H);
220
379
  const spring = typeof value === "string" ? value.startsWith("spring") : value?.type === "spring";
221
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `flex items-center gap-2 ${className}`, "data-ease-picker": "", children: [
222
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
380
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex items-center gap-2 ${className}`, "data-ease-picker": "", children: [
381
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
223
382
  "select",
224
383
  {
225
384
  className: "min-w-0 flex-1 rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -231,17 +390,17 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
231
390
  onChange(e.target.value ? e.target.value : void 0);
232
391
  },
233
392
  children: [
234
- import_animation_editor3.MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: c.value, children: c.label }, c.value)),
235
- key === "custom" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "custom", children: "Custom" })
393
+ import_animation_editor4.MOTION_EASE_CHOICES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: c.value, children: c.label }, c.value)),
394
+ key === "custom" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "custom", children: "Custom" })
236
395
  ]
237
396
  }
238
397
  ),
239
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: W, height: H, viewBox: `0 0 ${W} ${H}`, className: "shrink-0 rounded border border-border", "data-ease-curve": key || "default", "aria-hidden": "true", children: [
240
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: 0, x2: W, y1: guides.zero, y2: guides.zero, stroke: "currentColor", strokeOpacity: 0.2 }),
241
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: 0, x2: W, y1: guides.one, y2: guides.one, stroke: "currentColor", strokeOpacity: 0.2, strokeDasharray: "2 2" }),
242
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: (0, import_animation_editor3.motionEasingPath)(curve, W, H), fill: "none", stroke: "#f43f5e", strokeWidth: 1.5 })
398
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { width: W, height: H, viewBox: `0 0 ${W} ${H}`, className: "shrink-0 rounded border border-border", "data-ease-curve": key || "default", "aria-hidden": "true", children: [
399
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: 0, x2: W, y1: guides.zero, y2: guides.zero, stroke: "currentColor", strokeOpacity: 0.2 }),
400
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: 0, x2: W, y1: guides.one, y2: guides.one, stroke: "currentColor", strokeOpacity: 0.2, strokeDasharray: "2 2" }),
401
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: (0, import_animation_editor4.motionEasingPath)(curve, W, H), fill: "none", stroke: "#f43f5e", strokeWidth: 1.5 })
243
402
  ] }),
244
- spring && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: [
403
+ spring && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: [
245
404
  Math.round(curve.durationMs),
246
405
  " ms"
247
406
  ] })
@@ -249,9 +408,9 @@ function EasePicker({ value, onChange, disabled, className = "" }) {
249
408
  }
250
409
 
251
410
  // src/animation-editor/CommitInput.tsx
252
- var import_jsx_runtime4 = require("react/jsx-runtime");
411
+ var import_jsx_runtime7 = require("react/jsx-runtime");
253
412
  function CommitInput({ value, onCommit, ...rest }) {
254
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
413
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
255
414
  "input",
256
415
  {
257
416
  ...rest,
@@ -266,25 +425,25 @@ function CommitInput({ value, onCommit, ...rest }) {
266
425
  }
267
426
 
268
427
  // src/animation-editor/CommandInspector.tsx
269
- var import_jsx_runtime5 = require("react/jsx-runtime");
428
+ var import_jsx_runtime8 = require("react/jsx-runtime");
270
429
  var input = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
271
430
  function CommandInspector({ controller, picked, className = "" }) {
272
431
  const state = useAnimationEditorState(controller);
273
432
  const { scene, selection, readOnly, error } = state;
274
- const [local, setLocalState] = (0, import_react4.useState)(null);
433
+ const [local, setLocalState] = (0, import_react7.useState)(null);
275
434
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
276
- const elements = (0, import_react4.useMemo)(() => (0, import_animation_editor4.describeMotionElements)(scene), [scene.artwork]);
435
+ const elements = (0, import_react7.useMemo)(() => (0, import_animation_editor5.describeMotionElements)(scene), [scene.artwork]);
277
436
  const shot = selection ? scene.shots.find((s) => s.id === selection.shot) : void 0;
278
437
  const index = selection?.command;
279
438
  const command = shot && index !== void 0 ? shot.run[index] : void 0;
280
439
  if (!shot || index === void 0 || !command) {
281
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-inspector": "", children: "Select a command to edit it." });
440
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-inspector": "", children: "Select a command to edit it." });
282
441
  }
283
442
  const values = command;
284
- const fields = (0, import_animation_editor4.motionCommandFields)(command.type);
285
- const primitive = (0, import_animation_editor4.motionFlairPrimitive)(command);
443
+ const fields = (0, import_animation_editor5.motionCommandFields)(command.type);
444
+ const primitive = (0, import_animation_editor5.motionFlairPrimitive)(command);
286
445
  const commit = (field, raw) => {
287
- const edit = (0, import_animation_editor4.motionFieldEdit)(shot.id, index, field, raw);
446
+ const edit = (0, import_animation_editor5.motionFieldEdit)(shot.id, index, field, raw);
288
447
  if ("error" in edit) return setLocal(edit.error);
289
448
  setLocal(null);
290
449
  controller.apply(edit, `Set ${field.label.toLowerCase()}`);
@@ -297,45 +456,45 @@ function CommandInspector({ controller, picked, className = "" }) {
297
456
  const common = { disabled: readOnly, "aria-label": field.label, title: field.description };
298
457
  switch (field.kind) {
299
458
  case "targets":
300
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-targets": "", children: [
301
- targets.map((id) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-0.5 rounded bg-muted px-1 text-[11px]", "data-target": id, children: [
459
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-targets": "", children: [
460
+ targets.map((id) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex items-center gap-0.5 rounded bg-muted px-1 text-[11px]", "data-target": id, children: [
302
461
  name(id),
303
- !readOnly && targets.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", "aria-label": `Remove ${id}`, onClick: () => commit(field, targets.filter((t) => t !== id)), children: "\xD7" })
462
+ !readOnly && targets.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": `Remove ${id}`, onClick: () => commit(field, targets.filter((t) => t !== id)), children: "\xD7" })
304
463
  ] }, id)),
305
- !readOnly && picked && !targets.includes(picked) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "rounded border border-rose-500 px-1 text-[11px] text-rose-500", onClick: () => commit(field, [...targets, picked]), "data-add-picked": "", children: [
464
+ !readOnly && picked && !targets.includes(picked) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", className: "rounded border border-rose-500 px-1 text-[11px] text-rose-500", onClick: () => commit(field, [...targets, picked]), "data-add-picked": "", children: [
306
465
  "+ ",
307
466
  name(picked)
308
467
  ] }),
309
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Add target", value: "", onChange: (e) => e.target.value && commit(field, [...targets, e.target.value]), children: [
310
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "+ target\u2026" }),
311
- elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: e.id, children: e.name ? `${e.name} (${e.id})` : e.id }, e.id))
468
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Add target", value: "", onChange: (e) => e.target.value && commit(field, [...targets, e.target.value]), children: [
469
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "+ target\u2026" }),
470
+ elements.filter((e) => !targets.includes(e.id)).map((e) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: e.id, children: e.name ? `${e.name} (${e.id})` : e.id }, e.id))
312
471
  ] })
313
472
  ] });
314
473
  case "node":
315
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
316
- !field.required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "\u2014" }),
317
- elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: e.id, children: [
474
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
475
+ !field.required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "\u2014" }),
476
+ elements.filter((e) => field.name !== "path" || e.type === "path").map((e) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("option", { value: e.id, children: [
318
477
  e.name ? `${e.name} (${e.id})` : e.id,
319
478
  e.hidden ? " \xB7 hidden" : ""
320
479
  ] }, e.id))
321
480
  ] });
322
481
  case "enum":
323
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
324
- !field.required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "default" }),
325
- field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: o, children: o }, o))
482
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input, ...common, value: typeof v === "string" ? v : "", onChange: (e) => commit(field, e.target.value), children: [
483
+ !field.required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "default" }),
484
+ field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o, children: o }, o))
326
485
  ] });
327
486
  case "boolean":
328
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", ...common, checked: v === true, onChange: (e) => commit(field, e.target.checked) });
487
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", ...common, checked: v === true, onChange: (e) => commit(field, e.target.checked) });
329
488
  case "ease":
330
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EasePicker, { value: v, disabled: readOnly, onChange: (ease) => commit(field, ease === void 0 ? "" : ease) });
489
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(EasePicker, { value: v, disabled: readOnly, onChange: (ease) => commit(field, ease === void 0 ? "" : ease) });
331
490
  case "color":
332
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1", children: [
333
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", disabled: readOnly, "aria-label": `${field.label} swatch`, value: typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v) ? v : "#000000", onChange: (e) => commit(field, e.target.value) }),
334
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", placeholder: "unchanged", onCommit: (raw) => commit(field, raw) })
491
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
492
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", disabled: readOnly, "aria-label": `${field.label} swatch`, value: typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v) ? v : "#000000", onChange: (e) => commit(field, e.target.value) }),
493
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", placeholder: "unchanged", onCommit: (raw) => commit(field, raw) })
335
494
  ] });
336
495
  case "point": {
337
496
  const p = v ?? void 0;
338
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex items-center gap-1", children: ["x", "y"].map((axis) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
497
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-1", children: ["x", "y"].map((axis) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
339
498
  CommitInput,
340
499
  {
341
500
  className: input,
@@ -352,8 +511,8 @@ function CommandInspector({ controller, picked, className = "" }) {
352
511
  case "scale":
353
512
  case "number":
354
513
  case "integer":
355
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1", children: [
356
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
514
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
515
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
357
516
  CommitInput,
358
517
  {
359
518
  className: input,
@@ -367,50 +526,50 @@ function CommandInspector({ controller, picked, className = "" }) {
367
526
  onCommit: (raw) => commit(field, raw)
368
527
  }
369
528
  ),
370
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: field.unit })
529
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: field.unit })
371
530
  ] });
372
531
  default:
373
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", onCommit: (raw) => commit(field, raw) });
532
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CommitInput, { className: input, ...common, value: typeof v === "string" ? v : "", onCommit: (raw) => commit(field, raw) });
374
533
  }
375
534
  };
376
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-command-inspector": "", "data-command-type": command.type, children: [
377
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
378
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "font-medium", children: [
535
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-command-inspector": "", "data-command-type": command.type, children: [
536
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
537
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "font-medium", children: [
379
538
  index + 1,
380
539
  ". ",
381
540
  command.type
382
541
  ] }),
383
- primitive ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { className: "rounded bg-muted px-1 text-[10px]", "data-flair-primitive": primitive, title: "The Flair motion primitive this command plays", children: primitive }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "editor-only (no Flair primitive)" })
542
+ primitive ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className: "rounded bg-muted px-1 text-[10px]", "data-flair-primitive": primitive, title: "The Flair motion primitive this command plays", children: primitive }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "editor-only (no Flair primitive)" })
384
543
  ] }),
385
- ["main", "timing"].map((group) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("fieldset", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
386
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("legend", { className: "mb-1 text-[10px] uppercase tracking-wide text-muted-foreground", children: group === "main" ? "Command" : "Timing" }),
387
- fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
388
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "truncate text-muted-foreground", title: field.description, children: [
544
+ ["main", "timing"].map((group) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("fieldset", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
545
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("legend", { className: "mb-1 text-[10px] uppercase tracking-wide text-muted-foreground", children: group === "main" ? "Command" : "Timing" }),
546
+ fields.filter((f) => f.group === group).map((field) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.default.Fragment, { children: [
547
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "truncate text-muted-foreground", title: field.description, children: [
389
548
  field.label,
390
549
  field.required ? " *" : ""
391
550
  ] }),
392
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-field": field.name, children: control(field) })
551
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { "data-field": field.name, children: control(field) })
393
552
  ] }, field.name))
394
553
  ] }, group)),
395
- message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
554
+ message && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
396
555
  ] });
397
556
  }
398
557
 
399
558
  // src/animation-editor/CommandList.tsx
400
- var import_react5 = require("react");
401
- var import_animation_editor5 = require("@pixerate/editor/animation-editor");
402
- var import_jsx_runtime6 = require("react/jsx-runtime");
403
- var btn = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
559
+ var import_react8 = require("react");
560
+ var import_animation_editor6 = require("@pixerate/editor/animation-editor");
561
+ var import_jsx_runtime9 = require("react/jsx-runtime");
562
+ var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
404
563
  function CommandList({ controller, shot, targets, className = "" }) {
405
564
  const state = useAnimationEditorState(controller);
406
565
  const { scene, selection, readOnly, error } = state;
407
566
  const shotId = shot ?? selection?.shot ?? scene.shots[0]?.id;
408
567
  const current = scene.shots.find((s) => s.id === shotId);
409
- const [type, setType] = (0, import_react5.useState)("enter");
410
- const [local, setLocalState] = (0, import_react5.useState)(null);
568
+ const [type, setType] = (0, import_react8.useState)("enter");
569
+ const [local, setLocalState] = (0, import_react8.useState)(null);
411
570
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
412
- if (!current) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-list": "", children: "Add a shot to start." });
413
- const rows = (0, import_animation_editor5.motionCommandRows)(scene, current.id);
571
+ if (!current) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `text-xs text-muted-foreground ${className}`, "data-command-list": "", children: "Add a shot to start." });
572
+ const rows = (0, import_animation_editor6.motionCommandRows)(scene, current.id);
414
573
  const selected = selection?.shot === current.id ? selection.command : void 0;
415
574
  const run = (edit, label) => {
416
575
  setLocal(null);
@@ -418,22 +577,22 @@ function CommandList({ controller, shot, targets, className = "" }) {
418
577
  };
419
578
  const add = () => {
420
579
  const from = targets?.length ? targets : selected !== void 0 ? current.run[selected].targets ?? [] : [];
421
- const command = (0, import_animation_editor5.defaultMotionCommand)(type, from, scene);
580
+ const command = (0, import_animation_editor6.defaultMotionCommand)(type, from, scene);
422
581
  if ("error" in command) return setLocal(command.error);
423
582
  const at = selected !== void 0 ? selected + 1 : current.run.length;
424
583
  const result = run({ op: "add_commands", shot: current.id, commands: [command], at }, `Add ${type}`);
425
584
  if (result.ok) controller.select({ shot: current.id, command: at });
426
585
  };
427
586
  const message = (local && local.revision === state.revision ? local.text : null) ?? error;
428
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-command-list": "", "data-for-shot": current.id, children: [
429
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "font-medium", children: [
587
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1 text-xs ${className}`, "data-command-list": "", "data-for-shot": current.id, children: [
588
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "font-medium", children: [
430
589
  "Commands in ",
431
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-rose-500", children: current.label ?? current.id })
590
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-rose-500", children: current.label ?? current.id })
432
591
  ] }),
433
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ol", { className: "flex flex-col gap-1", "aria-label": "Commands", children: rows.map((row) => {
592
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ol", { className: "flex flex-col gap-1", "aria-label": "Commands", children: rows.map((row) => {
434
593
  const c = row.command;
435
594
  const isSelected = row.index === selected;
436
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
595
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
437
596
  "li",
438
597
  {
439
598
  className: `flex flex-wrap items-center gap-1 rounded border px-1.5 py-1 ${isSelected ? "border-rose-500 bg-rose-500/10" : "border-border"}`,
@@ -441,18 +600,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
441
600
  "data-selected": isSelected || void 0,
442
601
  onClick: () => controller.select({ shot: current.id, command: row.index }),
443
602
  children: [
444
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "min-w-0 flex-1 truncate", title: row.summary, children: [
603
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "min-w-0 flex-1 truncate", title: row.summary, children: [
445
604
  row.index + 1,
446
605
  ". ",
447
606
  row.summary
448
607
  ] }),
449
- row.flairPrimitive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", "data-flair-primitive": row.flairPrimitive, children: row.flairPrimitive }),
450
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "tabular-nums text-[10px] text-muted-foreground", children: [
608
+ row.flairPrimitive && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "rounded bg-muted px-1 text-[10px] text-muted-foreground", "data-flair-primitive": row.flairPrimitive, children: row.flairPrimitive }),
609
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "tabular-nums text-[10px] text-muted-foreground", children: [
451
610
  ((row.end - row.start) / 1e3).toFixed(2),
452
611
  " s"
453
612
  ] }),
454
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center gap-1", onClick: (e) => e.stopPropagation(), children: [
455
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
613
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex w-full items-center gap-1", onClick: (e) => e.stopPropagation(), children: [
614
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
456
615
  "select",
457
616
  {
458
617
  className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]",
@@ -464,14 +623,14 @@ function CommandList({ controller, shot, targets, className = "" }) {
464
623
  "Change start"
465
624
  ),
466
625
  children: [
467
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "after", children: "after previous" }),
468
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "previous", children: "with previous" })
626
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "after", children: "after previous" }),
627
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "previous", children: "with previous" })
469
628
  ]
470
629
  }
471
630
  ),
472
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-0.5 text-muted-foreground", children: [
631
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-0.5 text-muted-foreground", children: [
473
632
  "+",
474
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
633
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
475
634
  "input",
476
635
  {
477
636
  className: "w-14 rounded border border-border bg-transparent px-1 py-0.5 text-[11px] tabular-nums",
@@ -495,11 +654,11 @@ function CommandList({ controller, shot, targets, className = "" }) {
495
654
  ),
496
655
  "ms"
497
656
  ] }),
498
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
499
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Move up", disabled: readOnly || row.index === 0, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index - 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index - 1 }), children: "\u2191" }),
500
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Move down", disabled: readOnly || row.index === rows.length - 1, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index + 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u2193" }),
501
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Duplicate", disabled: readOnly, onClick: () => run((0, import_animation_editor5.duplicateMotionCommandEdit)(scene, current.id, row.index), "Duplicate command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u29C9" }),
502
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, "aria-label": "Delete", disabled: readOnly, onClick: () => run({ op: "delete_commands", shot: current.id, commands: [row.index] }, "Delete command"), children: "\u2715" })
657
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
658
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn2, "aria-label": "Move up", disabled: readOnly || row.index === 0, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index - 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index - 1 }), children: "\u2191" }),
659
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn2, "aria-label": "Move down", disabled: readOnly || row.index === rows.length - 1, onClick: () => run({ op: "move_command", shot: current.id, command: row.index, to: row.index + 1 }, "Move command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u2193" }),
660
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn2, "aria-label": "Duplicate", disabled: readOnly, onClick: () => run((0, import_animation_editor6.duplicateMotionCommandEdit)(scene, current.id, row.index), "Duplicate command").ok && controller.select({ shot: current.id, command: row.index + 1 }), children: "\u29C9" }),
661
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn2, "aria-label": "Delete", disabled: readOnly, onClick: () => run({ op: "delete_commands", shot: current.id, commands: [row.index] }, "Delete command"), children: "\u2715" })
503
662
  ] })
504
663
  ] })
505
664
  ]
@@ -507,18 +666,18 @@ function CommandList({ controller, shot, targets, className = "" }) {
507
666
  `${row.index}:${row.summary}`
508
667
  );
509
668
  }) }),
510
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
511
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { className: "flex-1 rounded border border-border bg-transparent px-1 py-0.5", "aria-label": "New command type", value: type, onChange: (e) => setType(e.target.value), children: import_animation_editor5.MOTION_COMMAND_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: t, children: t }, t)) }),
512
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: btn, onClick: add, "data-add-command": "", children: "Add command" })
669
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
670
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("select", { className: "flex-1 rounded border border-border bg-transparent px-1 py-0.5", "aria-label": "New command type", value: type, onChange: (e) => setType(e.target.value), children: import_animation_editor6.MOTION_COMMAND_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: t, children: t }, t)) }),
671
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn2, onClick: add, "data-add-command": "", children: "Add command" })
513
672
  ] }),
514
- message && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
673
+ message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
515
674
  ] });
516
675
  }
517
676
 
518
677
  // src/animation-editor/PlayheadScrubber.tsx
519
- var import_react6 = require("react");
520
- var import_animation_editor6 = require("@pixerate/editor/animation-editor");
521
- var import_jsx_runtime7 = require("react/jsx-runtime");
678
+ var import_react9 = require("react");
679
+ var import_animation_editor7 = require("@pixerate/editor/animation-editor");
680
+ var import_jsx_runtime10 = require("react/jsx-runtime");
522
681
  var seconds2 = (ms) => `${(ms / 1e3).toFixed(2)} s`;
523
682
  function worst2(issues) {
524
683
  if (issues.some((i) => i.severity === "error")) return "error";
@@ -529,16 +688,16 @@ function PlayheadScrubber({ controller, className = "" }) {
529
688
  const state = useAnimationEditorState(controller);
530
689
  const { duration, shots, time, playing, selection, issues, scene, readOnly } = state;
531
690
  const span = Math.max(1, duration);
532
- const track = (0, import_react6.useRef)(null);
533
- const [width, setWidth] = (0, import_react6.useState)(600);
534
- (0, import_react6.useEffect)(() => {
691
+ const track = (0, import_react9.useRef)(null);
692
+ const [width, setWidth] = (0, import_react9.useState)(600);
693
+ (0, import_react9.useEffect)(() => {
535
694
  const el = track.current;
536
695
  if (!el || typeof ResizeObserver === "undefined") return;
537
696
  const observer = new ResizeObserver(() => setWidth(el.clientWidth || 600));
538
697
  observer.observe(el);
539
698
  return () => observer.disconnect();
540
699
  }, []);
541
- const ticks = (0, import_animation_editor6.motionRulerTicks)(duration, width);
700
+ const ticks = (0, import_animation_editor7.motionRulerTicks)(duration, width);
542
701
  const pct = (ms) => `${Math.min(span, Math.max(0, ms)) / span * 100}%`;
543
702
  const seekAt = (clientX) => {
544
703
  const box = track.current.getBoundingClientRect();
@@ -546,18 +705,18 @@ function PlayheadScrubber({ controller, className = "" }) {
546
705
  };
547
706
  const beats = [];
548
707
  if (scene.beat && scene.beat.bpm > 0) {
549
- for (let b = 0, t = (0, import_animation_editor6.motionBeatTime)(scene.beat, 0); t <= span && beats.length < 400; t = (0, import_animation_editor6.motionBeatTime)(scene.beat, ++b)) if (t >= 0) beats.push(t);
708
+ for (let b = 0, t = (0, import_animation_editor7.motionBeatTime)(scene.beat, 0); t <= span && beats.length < 400; t = (0, import_animation_editor7.motionBeatTime)(scene.beat, ++b)) if (t >= 0) beats.push(t);
550
709
  }
551
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, "data-playhead-scrubber": "", "data-shot-timeline": "", children: [
552
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
553
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => controller.toggle(), "aria-label": playing ? "Pause" : "Play", disabled: !shots.length, children: playing ? "Pause" : "Play" }),
554
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => {
710
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, "data-playhead-scrubber": "", "data-shot-timeline": "", children: [
711
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
712
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => controller.toggle(), "aria-label": playing ? "Pause" : "Play", disabled: !shots.length, children: playing ? "Pause" : "Play" }),
713
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "rounded border border-border px-2 py-0.5", onClick: () => {
555
714
  controller.pause();
556
715
  controller.seek(0);
557
716
  }, "aria-label": "Back to start", children: "\u23EE" }),
558
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
717
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
559
718
  "Loop",
560
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
719
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
561
720
  "select",
562
721
  {
563
722
  className: "rounded border border-border bg-transparent px-1 py-0.5",
@@ -566,20 +725,20 @@ function PlayheadScrubber({ controller, className = "" }) {
566
725
  "aria-label": "Loop",
567
726
  onChange: (e) => controller.apply({ op: "set_settings", loop: e.target.value }, "Change loop"),
568
727
  children: [
569
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "none", children: "Off" }),
570
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "loop", children: "Loop" }),
571
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
728
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "none", children: "Off" }),
729
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "loop", children: "Loop" }),
730
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
572
731
  ]
573
732
  }
574
733
  )
575
734
  ] }),
576
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "ml-auto tabular-nums text-muted-foreground", "data-time": "", children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "ml-auto tabular-nums text-muted-foreground", "data-time": "", children: [
577
736
  seconds2(time),
578
737
  " / ",
579
738
  seconds2(duration)
580
739
  ] })
581
740
  ] }),
582
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
741
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
583
742
  "div",
584
743
  {
585
744
  ref: track,
@@ -609,17 +768,17 @@ function PlayheadScrubber({ controller, className = "" }) {
609
768
  e.preventDefault();
610
769
  },
611
770
  children: [
612
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative h-5 border-b border-border text-[10px] text-muted-foreground", "data-ruler": "", children: [
613
- beats.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute bottom-0 h-1.5 w-px bg-sky-500/60", style: { left: pct(t) }, "data-beat": i }, `b${i}`)),
614
- scene.narration?.words.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute top-0 h-1.5 w-px bg-emerald-500/70", style: { left: pct(w.start) }, title: `\u201C${w.text}\u201D at ${seconds2(w.start)}`, "data-word": i }, `w${i}`)),
615
- ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `absolute bottom-0 w-px ${t.major ? "h-2.5 bg-muted-foreground/70" : "h-1 bg-muted-foreground/40"}`, style: { left: pct(t.time) }, children: t.label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "absolute -top-0.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time))
771
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative h-5 border-b border-border text-[10px] text-muted-foreground", "data-ruler": "", children: [
772
+ beats.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute bottom-0 h-1.5 w-px bg-sky-500/60", style: { left: pct(t) }, "data-beat": i }, `b${i}`)),
773
+ scene.narration?.words.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute top-0 h-1.5 w-px bg-emerald-500/70", style: { left: pct(w.start) }, title: `\u201C${w.text}\u201D at ${seconds2(w.start)}`, "data-word": i }, `w${i}`)),
774
+ ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `absolute bottom-0 w-px ${t.major ? "h-2.5 bg-muted-foreground/70" : "h-1 bg-muted-foreground/40"}`, style: { left: pct(t.time) }, children: t.label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute -top-0.5 left-1 whitespace-nowrap tabular-nums", children: t.label }) }, t.time))
616
775
  ] }),
617
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-1 flex w-full gap-px", role: "group", "aria-label": "Shots", children: shots.map((shot, i) => {
776
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-1 flex w-full gap-px", role: "group", "aria-label": "Shots", children: shots.map((shot, i) => {
618
777
  const mark = worst2(issues.filter((x) => x.shot === shot.id));
619
778
  const selected = selection?.shot === shot.id;
620
779
  const cue = scene.shots[i]?.at;
621
- const cueTime = cue ? (0, import_animation_editor6.motionCueTime)(scene, cue) : void 0;
622
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
780
+ const cueTime = cue ? (0, import_animation_editor7.motionCueTime)(scene, cue) : void 0;
781
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
623
782
  "button",
624
783
  {
625
784
  type: "button",
@@ -634,14 +793,14 @@ function PlayheadScrubber({ controller, className = "" }) {
634
793
  controller.seekShot(shot.id);
635
794
  },
636
795
  children: [
637
- mark && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: mark === "error" ? "text-red-500" : "text-amber-500", children: "\u25CF " }),
796
+ mark && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: mark === "error" ? "text-red-500" : "text-amber-500", children: "\u25CF " }),
638
797
  shot.label ?? shot.id
639
798
  ]
640
799
  },
641
800
  shot.id
642
801
  );
643
802
  }) }),
644
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "pointer-events-none absolute inset-y-0 w-0.5 -translate-x-1/2 bg-rose-500", style: { left: pct(time) }, "data-playhead": "" })
803
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "pointer-events-none absolute inset-y-0 w-0.5 -translate-x-1/2 bg-rose-500", style: { left: pct(time) }, "data-playhead": "" })
645
804
  ]
646
805
  }
647
806
  )
@@ -649,18 +808,18 @@ function PlayheadScrubber({ controller, className = "" }) {
649
808
  }
650
809
 
651
810
  // src/animation-editor/SceneSettings.tsx
652
- var import_react7 = require("react");
653
- var import_animation_editor7 = require("@pixerate/editor/animation-editor");
654
- var import_jsx_runtime8 = require("react/jsx-runtime");
811
+ var import_react10 = require("react");
812
+ var import_animation_editor8 = require("@pixerate/editor/animation-editor");
813
+ var import_jsx_runtime11 = require("react/jsx-runtime");
655
814
  var input2 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
656
- var btn2 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
657
- var unit = (u) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: u });
815
+ var btn3 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
816
+ var unit = (u) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: u });
658
817
  function SceneSettings({ controller, className = "" }) {
659
818
  const state = useAnimationEditorState(controller);
660
819
  const { scene, readOnly, error, duration } = state;
661
- const [local, setLocalState] = (0, import_react7.useState)(null);
820
+ const [local, setLocalState] = (0, import_react10.useState)(null);
662
821
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
663
- const [fitTo, setFitTo] = (0, import_react7.useState)("");
822
+ const [fitTo, setFitTo] = (0, import_react10.useState)("");
664
823
  const apply = (edit, label) => {
665
824
  setLocal(null);
666
825
  return controller.apply(edit, label);
@@ -678,7 +837,7 @@ function SceneSettings({ controller, className = "" }) {
678
837
  const s = Number(fitSeconds);
679
838
  if (!(Number.isFinite(s) && s > 0)) return setLocal("Give the length to fit in seconds, above 0.");
680
839
  try {
681
- const edits = (0, import_animation_editor7.fitMotionSceneEdits)(scene, s * 1e3);
840
+ const edits = (0, import_animation_editor8.fitMotionSceneEdits)(scene, s * 1e3);
682
841
  if (edits.length) apply(edits, `Fit to ${s} s`);
683
842
  else setLocal(null);
684
843
  } catch (e) {
@@ -687,32 +846,32 @@ function SceneSettings({ controller, className = "" }) {
687
846
  };
688
847
  const beat = scene.beat;
689
848
  const message = (local && local.revision === state.revision ? local.text : null) ?? error;
690
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-scene-settings": "", children: [
691
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
692
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Loop" }),
693
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input2, "aria-label": "Scene loop", disabled: readOnly, value: scene.loop ?? "none", onChange: (e) => settings({ loop: e.target.value }, "Change loop"), children: [
694
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "none", children: "Off" }),
695
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "loop", children: "Loop" }),
696
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
849
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-scene-settings": "", children: [
850
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
851
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Loop" }),
852
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: input2, "aria-label": "Scene loop", disabled: readOnly, value: scene.loop ?? "none", onChange: (e) => settings({ loop: e.target.value }, "Change loop"), children: [
853
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "none", children: "Off" }),
854
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "loop", children: "Loop" }),
855
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "ping-pong", children: "Ping-pong" })
697
856
  ] }),
698
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Motion blur" }),
699
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input2, "aria-label": "Motion blur", disabled: readOnly, value: scene.motionBlur ? String(scene.motionBlur.shutter ?? 180) : "", onChange: (e) => settings({ motionBlur: e.target.value ? { ...scene.motionBlur ?? {}, shutter: Number(e.target.value) } : null }, "Change motion blur"), children: [
700
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Off" }),
701
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "90", children: "Light (90\xB0)" }),
702
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "180", children: "Normal (180\xB0)" }),
703
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "360", children: "Heavy (360\xB0)" })
857
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Motion blur" }),
858
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: input2, "aria-label": "Motion blur", disabled: readOnly, value: scene.motionBlur ? String(scene.motionBlur.shutter ?? 180) : "", onChange: (e) => settings({ motionBlur: e.target.value ? { ...scene.motionBlur ?? {}, shutter: Number(e.target.value) } : null }, "Change motion blur"), children: [
859
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Off" }),
860
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "90", children: "Light (90\xB0)" }),
861
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "180", children: "Normal (180\xB0)" }),
862
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "360", children: "Heavy (360\xB0)" })
704
863
  ] }),
705
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Plays on" }),
706
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { className: input2, "aria-label": "Scene trigger", title: "How a viewer plays it when exported to Flair", disabled: readOnly, value: scene.trigger ?? "", onChange: (e) => settings({ trigger: e.target.value || null }, "Change trigger"), children: [
707
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Its own (autoplay)" }),
708
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "click", children: "Click (a shot per click)" }),
709
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "hover", children: "Hover" }),
710
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "press", children: "Press" }),
711
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "scroll", children: "Scroll" })
864
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Plays on" }),
865
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: input2, "aria-label": "Scene trigger", title: "How a viewer plays it when exported to Flair", disabled: readOnly, value: scene.trigger ?? "", onChange: (e) => settings({ trigger: e.target.value || null }, "Change trigger"), children: [
866
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Its own (autoplay)" }),
867
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "click", children: "Click (a shot per click)" }),
868
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "hover", children: "Hover" }),
869
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "press", children: "Press" }),
870
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "scroll", children: "Scroll" })
712
871
  ] }),
713
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Frame rate" }),
714
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
715
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
872
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Frame rate" }),
873
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
874
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
716
875
  CommitInput,
717
876
  {
718
877
  className: input2,
@@ -728,9 +887,9 @@ function SceneSettings({ controller, className = "" }) {
728
887
  ),
729
888
  unit("fps")
730
889
  ] }),
731
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", title: "Hold changes on a grid of this many frames a second (12 = on twos); empty is smooth", children: "Steps" }),
732
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
733
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
890
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", title: "Hold changes on a grid of this many frames a second (12 = on twos); empty is smooth", children: "Steps" }),
891
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
892
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
734
893
  CommitInput,
735
894
  {
736
895
  className: input2,
@@ -746,9 +905,9 @@ function SceneSettings({ controller, className = "" }) {
746
905
  ),
747
906
  unit("fps")
748
907
  ] }),
749
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Target length" }),
750
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
751
- [0, 1].map((i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
908
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Target length" }),
909
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
910
+ [0, 1].map((i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
752
911
  CommitInput,
753
912
  {
754
913
  className: input2,
@@ -771,15 +930,15 @@ function SceneSettings({ controller, className = "" }) {
771
930
  )),
772
931
  unit("s")
773
932
  ] }),
774
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Fit to" }),
775
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
776
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { className: input2, type: "number", min: 0.1, step: 0.5, "aria-label": "Fit to", value: fitSeconds, onChange: (e) => setFitTo(e.target.value) }),
933
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Fit to" }),
934
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
935
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { className: input2, type: "number", min: 0.1, step: 0.5, "aria-label": "Fit to", value: fitSeconds, onChange: (e) => setFitTo(e.target.value) }),
777
936
  unit("s"),
778
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: btn2, disabled: readOnly || !scene.shots.length, onClick: fit, "data-fit": "", title: "Change the shots' speeds so the scene lasts this long", children: "Fit" })
937
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn3, disabled: readOnly || !scene.shots.length, onClick: fit, "data-fit": "", title: "Change the shots' speeds so the scene lasts this long", children: "Fit" })
779
938
  ] }),
780
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-muted-foreground", children: "Beat grid" }),
781
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", "data-beat-grid": "", children: [
782
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
939
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { className: "text-muted-foreground", children: "Beat grid" }),
940
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", "data-beat-grid": "", children: [
941
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
783
942
  CommitInput,
784
943
  {
785
944
  className: input2,
@@ -792,7 +951,7 @@ function SceneSettings({ controller, className = "" }) {
792
951
  onCommit: (raw) => num(raw, "BPM must be above 0.", (n) => n > 0, (n) => settings({ beat: n === null ? null : { ...beat ?? {}, bpm: n } }, n === null ? "Clear beat grid" : "Change tempo"))
793
952
  }
794
953
  ),
795
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
954
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
796
955
  CommitInput,
797
956
  {
798
957
  className: input2,
@@ -804,7 +963,7 @@ function SceneSettings({ controller, className = "" }) {
804
963
  onCommit: (raw) => beat && num(raw, "The offset is a number of ms.", () => true, (n) => settings({ beat: { ...beat, offset: n ?? 0 } }, "Change beat offset"))
805
964
  }
806
965
  ),
807
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
966
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
808
967
  CommitInput,
809
968
  {
810
969
  className: input2,
@@ -820,63 +979,63 @@ function SceneSettings({ controller, className = "" }) {
820
979
  )
821
980
  ] })
822
981
  ] }),
823
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
824
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: "Narration (a word a line: start ms, then the word)" }),
825
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
982
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
983
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-muted-foreground", children: "Narration (a word a line: start ms, then the word)" }),
984
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
826
985
  "textarea",
827
986
  {
828
987
  className: `${input2} h-20 font-mono`,
829
988
  "aria-label": "Narration",
830
989
  placeholder: "0 Meet\n320 the\n480 badge",
831
990
  disabled: readOnly,
832
- defaultValue: (0, import_animation_editor7.formatMotionNarration)(scene.narration),
991
+ defaultValue: (0, import_animation_editor8.formatMotionNarration)(scene.narration),
833
992
  onBlur: (e) => {
834
- if (e.currentTarget.value === (0, import_animation_editor7.formatMotionNarration)(scene.narration)) return;
835
- const parsed = (0, import_animation_editor7.parseMotionNarration)(e.currentTarget.value);
993
+ if (e.currentTarget.value === (0, import_animation_editor8.formatMotionNarration)(scene.narration)) return;
994
+ const parsed = (0, import_animation_editor8.parseMotionNarration)(e.currentTarget.value);
836
995
  if ("error" in parsed) return setLocal(parsed.error);
837
996
  settings({ narration: parsed.narration }, parsed.narration ? "Change narration" : "Clear narration");
838
997
  }
839
998
  },
840
- (0, import_animation_editor7.formatMotionNarration)(scene.narration)
999
+ (0, import_animation_editor8.formatMotionNarration)(scene.narration)
841
1000
  )
842
1001
  ] }),
843
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
844
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: "Drivers (one a line: target.property <- source.property * factor)" }),
845
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1002
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1003
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-muted-foreground", children: "Drivers (one a line: target.property <- source.property * factor)" }),
1004
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
846
1005
  "textarea",
847
1006
  {
848
1007
  className: `${input2} h-14 font-mono`,
849
1008
  "aria-label": "Drivers",
850
1009
  placeholder: "back.x <- front.x * 0.5\nwheel.rotation <- wheel.x * 2.86",
851
1010
  disabled: readOnly,
852
- defaultValue: (0, import_animation_editor7.formatMotionDrivers)(scene.drivers),
1011
+ defaultValue: (0, import_animation_editor8.formatMotionDrivers)(scene.drivers),
853
1012
  onBlur: (e) => {
854
- if (e.currentTarget.value === (0, import_animation_editor7.formatMotionDrivers)(scene.drivers)) return;
855
- const parsed = (0, import_animation_editor7.parseMotionDrivers)(e.currentTarget.value);
1013
+ if (e.currentTarget.value === (0, import_animation_editor8.formatMotionDrivers)(scene.drivers)) return;
1014
+ const parsed = (0, import_animation_editor8.parseMotionDrivers)(e.currentTarget.value);
856
1015
  if ("error" in parsed) return setLocal(parsed.error);
857
1016
  apply({ op: "set_drivers", drivers: parsed.drivers }, parsed.drivers.length ? "Set drivers" : "Clear drivers");
858
1017
  }
859
1018
  },
860
- (0, import_animation_editor7.formatMotionDrivers)(scene.drivers)
1019
+ (0, import_animation_editor8.formatMotionDrivers)(scene.drivers)
861
1020
  )
862
1021
  ] }),
863
- message && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
1022
+ message && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
864
1023
  ] });
865
1024
  }
866
1025
 
867
1026
  // src/animation-editor/ShotInspector.tsx
868
- var import_react8 = require("react");
869
- var import_animation_editor8 = require("@pixerate/editor/animation-editor");
870
- var import_jsx_runtime9 = require("react/jsx-runtime");
1027
+ var import_react11 = require("react");
1028
+ var import_animation_editor9 = require("@pixerate/editor/animation-editor");
1029
+ var import_jsx_runtime12 = require("react/jsx-runtime");
871
1030
  var input3 = "w-full min-w-0 rounded border border-border bg-transparent px-1 py-0.5 text-xs";
872
- var btn3 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1031
+ var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
873
1032
  function ShotInspector({ controller, shot, className = "" }) {
874
1033
  const state = useAnimationEditorState(controller);
875
1034
  const { scene, selection, readOnly, error } = state;
876
- const [local, setLocalState] = (0, import_react8.useState)(null);
1035
+ const [local, setLocalState] = (0, import_react11.useState)(null);
877
1036
  const setLocal = (text) => setLocalState(text ? { text, revision: state.revision } : null);
878
- const elements = (0, import_react8.useMemo)(() => (0, import_animation_editor8.describeMotionElements)(scene), [scene.artwork]);
879
- const cues = (0, import_react8.useMemo)(() => (0, import_animation_editor8.motionCueChoices)(scene), [scene]);
1037
+ const elements = (0, import_react11.useMemo)(() => (0, import_animation_editor9.describeMotionElements)(scene), [scene.artwork]);
1038
+ const cues = (0, import_react11.useMemo)(() => (0, import_animation_editor9.motionCueChoices)(scene), [scene]);
880
1039
  const id = shot ?? selection?.shot ?? scene.shots[0]?.id;
881
1040
  const index = scene.shots.findIndex((s) => s.id === id);
882
1041
  const current = scene.shots[index];
@@ -885,7 +1044,7 @@ function ShotInspector({ controller, shot, className = "" }) {
885
1044
  return controller.apply(edit, label);
886
1045
  };
887
1046
  const addShot = () => {
888
- const newId = (0, import_animation_editor8.freshShotId)(scene, "shot");
1047
+ const newId = (0, import_animation_editor9.freshShotId)(scene, "shot");
889
1048
  const at = index >= 0 ? index + 1 : scene.shots.length;
890
1049
  if (apply({ op: "insert_shots", shots: [{ id: newId, label: "New shot", run: [] }], at }, "Add shot").ok) {
891
1050
  controller.select({ shot: newId });
@@ -899,36 +1058,36 @@ function ShotInspector({ controller, shot, className = "" }) {
899
1058
  apply({ op: "update_shot", shot: current.id, set: { [key]: n } }, label);
900
1059
  };
901
1060
  const message = (local && local.revision === state.revision ? local.text : null) ?? error;
902
- const cueKey = current ? (0, import_animation_editor8.motionCueKey)(current.at) : "";
1061
+ const cueKey = current ? (0, import_animation_editor9.motionCueKey)(current.at) : "";
903
1062
  const frame = current?.camera && "frame" in current.camera ? current.camera.frame : "";
904
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
905
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
906
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium", children: "Shot" }),
907
- current && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
908
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
909
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
910
- current && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
911
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, "aria-label": "Move shot earlier", disabled: readOnly || index === 0, onClick: () => apply({ op: "move_shot", shot: current.id, to: index - 1 }, "Move shot"), children: "\u2190" }),
912
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, "aria-label": "Move shot later", disabled: readOnly || index === scene.shots.length - 1, onClick: () => apply({ op: "move_shot", shot: current.id, to: index + 1 }, "Move shot"), children: "\u2192" }),
913
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: btn3, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
1063
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-shot-inspector": "", children: [
1064
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1065
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium", children: "Shot" }),
1066
+ current && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { className: "text-[10px] text-muted-foreground", children: current.id }),
1067
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "ml-auto flex gap-0.5", children: [
1068
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn4, disabled: readOnly, onClick: addShot, "data-add-shot": "", children: "+ Shot" }),
1069
+ current && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1070
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn4, "aria-label": "Move shot earlier", disabled: readOnly || index === 0, onClick: () => apply({ op: "move_shot", shot: current.id, to: index - 1 }, "Move shot"), children: "\u2190" }),
1071
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn4, "aria-label": "Move shot later", disabled: readOnly || index === scene.shots.length - 1, onClick: () => apply({ op: "move_shot", shot: current.id, to: index + 1 }, "Move shot"), children: "\u2192" }),
1072
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: btn4, "aria-label": "Delete shot", disabled: readOnly, onClick: () => apply({ op: "delete_shots", shots: [current.id] }, "Delete shot"), children: "\u2715" })
914
1073
  ] })
915
1074
  ] })
916
1075
  ] }),
917
- current && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
918
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Label" }),
919
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitInput, { className: input3, "aria-label": "Shot label", disabled: readOnly, value: current.label ?? "", onCommit: (raw) => apply(raw.trim() ? { op: "update_shot", shot: current.id, set: { label: raw.trim() } } : { op: "update_shot", shot: current.id, remove: ["label"] }, "Rename shot") }),
920
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Hold" }),
921
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
922
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitInput, { className: input3, type: "number", min: 0, step: 50, "aria-label": "Hold", placeholder: "600", disabled: readOnly, value: current.hold !== void 0 ? String(current.hold) : "", onCommit: (raw) => number("hold", raw, "Change hold") }),
923
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
1076
+ current && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-[6.5rem_1fr] items-center gap-x-2 gap-y-1", children: [
1077
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Label" }),
1078
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CommitInput, { className: input3, "aria-label": "Shot label", disabled: readOnly, value: current.label ?? "", onCommit: (raw) => apply(raw.trim() ? { op: "update_shot", shot: current.id, set: { label: raw.trim() } } : { op: "update_shot", shot: current.id, remove: ["label"] }, "Rename shot") }),
1079
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Hold" }),
1080
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1081
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CommitInput, { className: input3, type: "number", min: 0, step: 50, "aria-label": "Hold", placeholder: "600", disabled: readOnly, value: current.hold !== void 0 ? String(current.hold) : "", onCommit: (raw) => number("hold", raw, "Change hold") }),
1082
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "ms" })
924
1083
  ] }),
925
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Speed" }),
926
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
927
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitInput, { className: input3, type: "number", min: 0.05, step: 0.05, "aria-label": "Speed", placeholder: "1", disabled: readOnly, value: current.speed !== void 0 ? String(current.speed) : "", onCommit: (raw) => number("speed", raw, "Change speed") }),
928
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
1084
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Speed" }),
1085
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1086
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CommitInput, { className: input3, type: "number", min: 0.05, step: 0.05, "aria-label": "Speed", placeholder: "1", disabled: readOnly, value: current.speed !== void 0 ? String(current.speed) : "", onCommit: (raw) => number("speed", raw, "Change speed") }),
1087
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "\xD7" })
929
1088
  ] }),
930
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Camera" }),
931
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1089
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Camera" }),
1090
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
932
1091
  "select",
933
1092
  {
934
1093
  className: input3,
@@ -941,17 +1100,17 @@ function ShotInspector({ controller, shot, className = "" }) {
941
1100
  else if (v.startsWith("frame:")) apply({ op: "update_shot", shot: current.id, set: { camera: { frame: v.slice(6), padding: 24 } } }, "Frame camera");
942
1101
  },
943
1102
  children: [
944
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "keep framing" }),
945
- current.camera && !frame && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "rect", children: "a rectangle" }),
946
- elements.map((e) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("option", { value: `frame:${e.id}`, children: [
1103
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "keep framing" }),
1104
+ current.camera && !frame && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "rect", children: "a rectangle" }),
1105
+ elements.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("option", { value: `frame:${e.id}`, children: [
947
1106
  "frame ",
948
1107
  e.name ?? e.id
949
1108
  ] }, e.id))
950
1109
  ]
951
1110
  }
952
1111
  ),
953
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-muted-foreground", children: "Starts on" }),
954
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1112
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "text-muted-foreground", children: "Starts on" }),
1113
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
955
1114
  "select",
956
1115
  {
957
1116
  className: input3,
@@ -959,34 +1118,34 @@ function ShotInspector({ controller, shot, className = "" }) {
959
1118
  disabled: readOnly || index === 0,
960
1119
  value: cueKey,
961
1120
  onChange: (e) => {
962
- const cue = (0, import_animation_editor8.motionCueFromKey)(e.target.value);
1121
+ const cue = (0, import_animation_editor9.motionCueFromKey)(e.target.value);
963
1122
  apply(cue ? { op: "update_shot", shot: current.id, set: { at: cue } } : { op: "update_shot", shot: current.id, remove: ["at"] }, "Cue shot");
964
1123
  },
965
1124
  children: [
966
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "after the shot before" }),
967
- cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: cueKey, children: cueKey }),
968
- cues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: c.value, children: c.label }, c.value))
1125
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "after the shot before" }),
1126
+ cueKey && !cues.some((c) => c.value === cueKey) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: cueKey, children: cueKey }),
1127
+ cues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: c.value, children: c.label }, c.value))
969
1128
  ]
970
1129
  }
971
1130
  ),
972
- !cues.length && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "Add a beat grid or narration in the scene settings to cue shots to them." })
1131
+ !cues.length && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "col-span-2 text-[10px] text-muted-foreground", children: "Add a beat grid or narration in the scene settings to cue shots to them." })
973
1132
  ] }),
974
- message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
1133
+ message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-red-500", role: "alert", "data-edit-error": "", children: message })
975
1134
  ] });
976
1135
  }
977
1136
 
978
1137
  // src/effects/useEffects.ts
979
- var import_react9 = require("react");
1138
+ var import_react12 = require("react");
980
1139
  function useEffects(host, provider) {
981
- (0, import_react9.useEffect)(() => {
1140
+ (0, import_react12.useEffect)(() => {
982
1141
  if (!host || !provider) return;
983
1142
  return host.useEffects(provider);
984
1143
  }, [host, provider]);
985
1144
  }
986
1145
  function useEffectDescription(provider, effect) {
987
- const [state, setState] = (0, import_react9.useState)({ key: "", description: null, error: null });
1146
+ const [state, setState] = (0, import_react12.useState)({ key: "", description: null, error: null });
988
1147
  const key = provider && effect ? `${provider.id}:${effect}` : "";
989
- (0, import_react9.useEffect)(() => {
1148
+ (0, import_react12.useEffect)(() => {
990
1149
  if (!provider || !effect) return;
991
1150
  let live = true;
992
1151
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1001,13 +1160,13 @@ function useEffectDescription(provider, effect) {
1001
1160
  }
1002
1161
 
1003
1162
  // src/effects/EffectThumbnail.tsx
1004
- var import_react10 = require("react");
1163
+ var import_react13 = require("react");
1005
1164
  var import_effects = require("@pixerate/editor/effects");
1006
- var import_jsx_runtime10 = require("react/jsx-runtime");
1165
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1007
1166
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1008
- const ref = (0, import_react10.useRef)(null);
1009
- const [failed, setFailed] = (0, import_react10.useState)(effect.kind === "motion");
1010
- (0, import_react10.useEffect)(() => {
1167
+ const ref = (0, import_react13.useRef)(null);
1168
+ const [failed, setFailed] = (0, import_react13.useState)(effect.kind === "motion");
1169
+ (0, import_react13.useEffect)(() => {
1011
1170
  if (effect.kind === "motion") return;
1012
1171
  let live = true;
1013
1172
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1022,28 +1181,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1022
1181
  live = false;
1023
1182
  };
1024
1183
  }, [provider, effect, width, height]);
1025
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1184
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1026
1185
  "div",
1027
1186
  {
1028
1187
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1029
1188
  style: { aspectRatio: `${width} / ${height}` },
1030
1189
  "data-effect-thumbnail": effect.id,
1031
- 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" })
1190
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1032
1191
  }
1033
1192
  );
1034
1193
  }
1035
1194
 
1036
1195
  // src/effects/EffectsBrowser.tsx
1037
- var import_react11 = require("react");
1196
+ var import_react14 = require("react");
1038
1197
  var import_effects2 = require("@pixerate/editor/effects");
1039
- var import_jsx_runtime11 = require("react/jsx-runtime");
1198
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1040
1199
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1041
- const [all, setAll] = (0, import_react11.useState)([]);
1042
- const [query, setQuery] = (0, import_react11.useState)("");
1043
- const [category, setCategory] = (0, import_react11.useState)("");
1044
- const [use, setUse] = (0, import_react11.useState)("");
1045
- const [error, setError] = (0, import_react11.useState)(null);
1046
- (0, import_react11.useEffect)(() => {
1200
+ const [all, setAll] = (0, import_react14.useState)([]);
1201
+ const [query, setQuery] = (0, import_react14.useState)("");
1202
+ const [category, setCategory] = (0, import_react14.useState)("");
1203
+ const [use, setUse] = (0, import_react14.useState)("");
1204
+ const [error, setError] = (0, import_react14.useState)(null);
1205
+ (0, import_react14.useEffect)(() => {
1047
1206
  if (!provider) return setAll([]);
1048
1207
  let live = true;
1049
1208
  Promise.resolve().then(() => provider.list()).then(
@@ -1054,8 +1213,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1054
1213
  live = false;
1055
1214
  };
1056
1215
  }, [provider]);
1057
- const [found, setFound] = (0, import_react11.useState)([]);
1058
- (0, import_react11.useEffect)(() => {
1216
+ const [found, setFound] = (0, import_react14.useState)([]);
1217
+ (0, import_react14.useEffect)(() => {
1059
1218
  if (!provider) return setFound([]);
1060
1219
  let live = true;
1061
1220
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1064,14 +1223,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1064
1223
  };
1065
1224
  }, [provider, query, category, use]);
1066
1225
  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)));
1067
- const categories = (0, import_react11.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1226
+ const categories = (0, import_react14.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1068
1227
  const shown = found.filter(allowed);
1069
1228
  if (!provider)
1070
- 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." });
1071
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1072
- title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1073
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1074
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1229
+ return /* @__PURE__ */ (0, import_jsx_runtime14.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." });
1230
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1231
+ title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1232
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1233
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1075
1234
  "input",
1076
1235
  {
1077
1236
  type: "search",
@@ -1082,17 +1241,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1082
1241
  onChange: (e) => setQuery(e.currentTarget.value)
1083
1242
  }
1084
1243
  ),
1085
- /* @__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: [
1086
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "All categories" }),
1087
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: c, children: c }, c))
1244
+ /* @__PURE__ */ (0, import_jsx_runtime14.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: [
1245
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "All categories" }),
1246
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: c, children: c }, c))
1088
1247
  ] }),
1089
- 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: [
1090
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Any use" }),
1091
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1248
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.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: [
1249
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Any use" }),
1250
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1092
1251
  ] })
1093
1252
  ] }),
1094
- error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1095
- /* @__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)(
1253
+ error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1254
+ /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1096
1255
  "button",
1097
1256
  {
1098
1257
  type: "button",
@@ -1101,25 +1260,25 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1101
1260
  "data-effect-id": e.id,
1102
1261
  onClick: () => onPick(e),
1103
1262
  children: [
1104
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectThumbnail, { provider, effect: e }),
1105
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1106
- /* @__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 ") })
1263
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectThumbnail, { provider, effect: e }),
1264
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1265
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1107
1266
  ]
1108
1267
  }
1109
1268
  ) }, e.id)) }),
1110
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1269
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1111
1270
  ] });
1112
1271
  }
1113
1272
 
1114
1273
  // src/effects/EffectParameters.tsx
1115
- var import_react13 = __toESM(require("react"), 1);
1274
+ var import_react16 = __toESM(require("react"), 1);
1116
1275
  var import_effects3 = require("@pixerate/editor/effects");
1117
1276
  var import_parameters2 = require("@pixerate/editor/parameters");
1118
1277
 
1119
1278
  // src/parameters/fields.tsx
1120
- var import_react12 = require("react");
1279
+ var import_react15 = require("react");
1121
1280
  var import_parameters = require("@pixerate/editor/parameters");
1122
- var import_jsx_runtime12 = require("react/jsx-runtime");
1281
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1123
1282
  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";
1124
1283
  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";
1125
1284
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -1143,7 +1302,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
1143
1302
  onKeyDown: keyDown,
1144
1303
  ...rest
1145
1304
  };
1146
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "text", ...props }, value);
1305
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "text", ...props }, value);
1147
1306
  }
1148
1307
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
1149
1308
  function ParameterNumberInput({
@@ -1154,8 +1313,8 @@ function ParameterNumberInput({
1154
1313
  id,
1155
1314
  "aria-label": ariaLabel
1156
1315
  }) {
1157
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1158
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1316
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1317
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1159
1318
  ParameterCommitInput,
1160
1319
  {
1161
1320
  id,
@@ -1177,21 +1336,21 @@ function ParameterNumberInput({
1177
1336
  }
1178
1337
  }
1179
1338
  ),
1180
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
1339
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
1181
1340
  ] });
1182
1341
  }
1183
1342
  function ParameterSlider(props) {
1184
1343
  const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
1185
- const dragging = (0, import_react12.useRef)(false);
1344
+ const dragging = (0, import_react15.useRef)(false);
1186
1345
  const end = () => {
1187
1346
  if (!dragging.current) return;
1188
1347
  dragging.current = false;
1189
1348
  onGestureEnd?.();
1190
1349
  };
1191
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterNumberInput, { ...props });
1350
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props });
1192
1351
  const step = (0, import_parameters.parameterStep)(field);
1193
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1194
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1352
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
1353
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1195
1354
  "input",
1196
1355
  {
1197
1356
  type: "range",
@@ -1214,11 +1373,11 @@ function ParameterSlider(props) {
1214
1373
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
1215
1374
  }
1216
1375
  ),
1217
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
1376
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
1218
1377
  ] });
1219
1378
  }
1220
1379
  function ParameterToggle({ field, value, onChange, disabled, id }) {
1221
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1380
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1222
1381
  "button",
1223
1382
  {
1224
1383
  type: "button",
@@ -1229,7 +1388,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
1229
1388
  disabled: disabled || field.readOnly,
1230
1389
  onClick: () => onChange(!value),
1231
1390
  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"}`,
1232
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1391
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1233
1392
  "span",
1234
1393
  {
1235
1394
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -1242,7 +1401,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1242
1401
  const options = (0, import_parameters.getChoiceOptions)(field);
1243
1402
  const off = disabled || field.readOnly;
1244
1403
  if (field.control === "segmented") {
1245
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1404
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1246
1405
  "button",
1247
1406
  {
1248
1407
  type: "button",
@@ -1258,7 +1417,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1258
1417
  )) });
1259
1418
  }
1260
1419
  const index = options.findIndex((o) => o.value === value);
1261
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1420
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1262
1421
  "select",
1263
1422
  {
1264
1423
  id,
@@ -1270,12 +1429,12 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1270
1429
  if (option) onChange(option.value);
1271
1430
  },
1272
1431
  className: parameterInputClass,
1273
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1432
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1274
1433
  }
1275
1434
  );
1276
1435
  }
1277
1436
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
1278
- const picking = (0, import_react12.useRef)(false);
1437
+ const picking = (0, import_react15.useRef)(false);
1279
1438
  const alpha = !!field.alpha;
1280
1439
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
1281
1440
  const rgb = hex.slice(0, 7);
@@ -1291,11 +1450,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1291
1450
  picking.current = false;
1292
1451
  onGestureEnd?.();
1293
1452
  };
1294
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5", children: [
1295
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1296
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
1297
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1298
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1453
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1.5", children: [
1454
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
1455
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]", children: [
1456
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1457
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1299
1458
  "input",
1300
1459
  {
1301
1460
  type: "color",
@@ -1311,7 +1470,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1311
1470
  }
1312
1471
  )
1313
1472
  ] }),
1314
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1473
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1315
1474
  ParameterCommitInput,
1316
1475
  {
1317
1476
  id,
@@ -1327,7 +1486,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1327
1486
  }
1328
1487
  )
1329
1488
  ] }),
1330
- alpha && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1489
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1331
1490
  "input",
1332
1491
  {
1333
1492
  type: "range",
@@ -1345,10 +1504,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1345
1504
  onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
1346
1505
  }
1347
1506
  ),
1348
- field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
1507
+ field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
1349
1508
  const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
1350
1509
  if (!swatch) return null;
1351
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1510
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1352
1511
  "button",
1353
1512
  {
1354
1513
  type: "button",
@@ -1367,11 +1526,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1367
1526
  }
1368
1527
  function ParameterVector({ field, value, onChange, disabled, id }) {
1369
1528
  const size = (0, import_parameters.vectorSize)(field);
1370
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1529
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1371
1530
  const component = (0, import_parameters.vectorComponentField)(field, i);
1372
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1373
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1374
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1531
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1532
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1533
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1375
1534
  ParameterNumberInput,
1376
1535
  {
1377
1536
  field: component,
@@ -1388,11 +1547,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
1388
1547
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1389
1548
  const off = disabled || field.readOnly;
1390
1549
  const name = (0, import_parameters.parameterLabel)(field);
1391
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1.5", children: [
1392
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1393
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1394
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1550
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1.5", children: [
1551
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
1552
+ /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1553
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1554
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1396
1555
  ParameterCommitInput,
1397
1556
  {
1398
1557
  id,
@@ -1403,10 +1562,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1403
1562
  onCommit: (text) => onChange(text.trim())
1404
1563
  }
1405
1564
  ),
1406
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-1", children: [
1407
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1565
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
1566
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1408
1567
  "Choose file\u2026",
1409
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1568
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1410
1569
  "input",
1411
1570
  {
1412
1571
  type: "file",
@@ -1422,11 +1581,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1422
1581
  }
1423
1582
  )
1424
1583
  ] }),
1425
- value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1584
+ value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1426
1585
  ] })
1427
1586
  ] })
1428
1587
  ] }),
1429
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1588
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1430
1589
  "button",
1431
1590
  {
1432
1591
  type: "button",
@@ -1436,14 +1595,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1436
1595
  disabled: off,
1437
1596
  onClick: () => onChange(o.url),
1438
1597
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
1439
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1598
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1440
1599
  },
1441
1600
  o.url
1442
1601
  )) })
1443
1602
  ] });
1444
1603
  }
1445
1604
  function ParameterText({ field, value, onChange, disabled, id }) {
1446
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1605
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1447
1606
  ParameterCommitInput,
1448
1607
  {
1449
1608
  id,
@@ -1462,31 +1621,31 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
1462
1621
  switch (field.type) {
1463
1622
  case "number":
1464
1623
  case "int":
1465
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
1624
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
1466
1625
  case "boolean":
1467
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
1626
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
1468
1627
  case "choice":
1469
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
1628
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
1470
1629
  case "color":
1471
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
1630
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
1472
1631
  case "vector":
1473
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
1632
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
1474
1633
  case "image":
1475
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
1634
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
1476
1635
  case "text":
1477
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParameterText, { field, value, onChange: set, ...rest });
1636
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterText, { field, value, onChange: set, ...rest });
1478
1637
  }
1479
1638
  }
1480
1639
 
1481
1640
  // src/effects/EffectParameters.tsx
1482
- var import_jsx_runtime13 = require("react/jsx-runtime");
1641
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1483
1642
  function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
1484
- const fields = (0, import_react13.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1485
- const idBase = (0, import_react13.useId)();
1486
- const gesture = import_react13.default.useRef(null);
1487
- const count = import_react13.default.useRef(0);
1488
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1489
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1643
+ const fields = (0, import_react16.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1644
+ const idBase = (0, import_react16.useId)();
1645
+ const gesture = import_react16.default.useRef(null);
1646
+ const count = import_react16.default.useRef(0);
1647
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1648
+ onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1490
1649
  "select",
1491
1650
  {
1492
1651
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -1498,8 +1657,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1498
1657
  if (preset) onPreset({ ...description.defaults, ...preset.values });
1499
1658
  },
1500
1659
  children: [
1501
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Presets\u2026" }),
1502
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: p.name, children: p.name }, p.name))
1660
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Presets\u2026" }),
1661
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: p.name, children: p.name }, p.name))
1503
1662
  ]
1504
1663
  }
1505
1664
  ),
@@ -1509,13 +1668,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1509
1668
  const keyed = keyframed?.has(field.id) ?? false;
1510
1669
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
1511
1670
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
1512
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
1513
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1514
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
1515
- keyed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1516
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
1671
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
1672
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1673
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
1674
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1675
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
1517
1676
  ] }),
1518
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1677
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1519
1678
  ParameterFieldControl,
1520
1679
  {
1521
1680
  field,
@@ -1529,25 +1688,25 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1529
1688
  )
1530
1689
  ] }, field.id);
1531
1690
  }),
1532
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1691
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1533
1692
  ] });
1534
1693
  }
1535
1694
 
1536
1695
  // src/animation-editor/AnimationEffectsPanel.tsx
1537
- var import_react14 = require("react");
1538
- var import_animation_editor9 = require("@pixerate/editor/animation-editor");
1539
- var import_jsx_runtime14 = require("react/jsx-runtime");
1540
- var btn4 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1696
+ var import_react17 = require("react");
1697
+ var import_animation_editor10 = require("@pixerate/editor/animation-editor");
1698
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1699
+ var btn5 = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
1541
1700
  function Controls({ controller, instance, effect, values }) {
1542
1701
  const provider = controller.effectsProvider;
1543
1702
  const { description, error } = useEffectDescription(provider, effect);
1544
- const [message, setMessage] = (0, import_react14.useState)(null);
1703
+ const [message, setMessage] = (0, import_react17.useState)(null);
1545
1704
  const report = (r) => void r.then((x) => setMessage(x.ok ? null : x.error));
1546
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
1547
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
1548
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
1549
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1550
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1705
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider: its commands are kept as they are." });
1706
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
1707
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
1708
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1709
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1551
1710
  EffectParameters,
1552
1711
  {
1553
1712
  description,
@@ -1557,67 +1716,104 @@ function Controls({ controller, instance, effect, values }) {
1557
1716
  onPreset: (v) => report(controller.updateMotionEffect(instance, v))
1558
1717
  }
1559
1718
  ),
1560
- message && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
1719
+ message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
1561
1720
  ] });
1562
1721
  }
1563
1722
  function AnimationEffectsPanel({ controller, node, className = "" }) {
1564
1723
  const state = useAnimationEditorState(controller);
1565
1724
  const provider = state.effectsProvider;
1566
- const nodes = (0, import_react14.useMemo)(() => [...(0, import_animation_editor9.indexMotionNodes)(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
1567
- const [chosen, setChosen] = (0, import_react14.useState)("");
1725
+ const nodes = (0, import_react17.useMemo)(() => [...(0, import_animation_editor10.indexMotionNodes)(state.scene.artwork.nodes).keys()], [state.scene.artwork]);
1726
+ const [chosen, setChosen] = (0, import_react17.useState)("");
1568
1727
  const target = node && nodes.includes(node) ? node : chosen && nodes.includes(chosen) ? chosen : "";
1569
- const [browse, setBrowse] = (0, import_react14.useState)(null);
1570
- const [open, setOpen] = (0, import_react14.useState)(null);
1571
- const [message, setMessage] = (0, import_react14.useState)(null);
1728
+ const [browse, setBrowse] = (0, import_react17.useState)(null);
1729
+ const [open, setOpen] = (0, import_react17.useState)(null);
1730
+ const [message, setMessage] = (0, import_react17.useState)(null);
1572
1731
  const report = (r) => void Promise.resolve(r).then((x) => setMessage(x.ok ? x.notes.length ? x.notes.join(" ") : null : x.error));
1573
- const applied = (0, import_react14.useMemo)(() => controller.appliedEffects(), [controller, state.scene]);
1732
+ const applied = (0, import_react17.useMemo)(() => controller.appliedEffects(), [controller, state.scene]);
1574
1733
  const disabled = state.readOnly;
1575
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
1576
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1577
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
1578
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Node to animate", value: target, disabled: !!node, onChange: (e) => setChosen(e.currentTarget.value), children: [
1579
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Node\u2026" }),
1580
- nodes.map((id) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: id, children: id }, id))
1734
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-animation-effects": "", children: [
1735
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1736
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
1737
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-[11px]", "aria-label": "Node to animate", value: target, disabled: !!node, onChange: (e) => setChosen(e.currentTarget.value), children: [
1738
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Node\u2026" }),
1739
+ nodes.map((id) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: id, children: id }, id))
1581
1740
  ] }),
1582
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn4, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn4, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
1741
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider || !target, "aria-pressed": browse === "motion", onClick: () => setBrowse(browse === "motion" ? null : "motion"), children: "Animate\u2026" }),
1742
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, disabled: disabled || !provider, "aria-pressed": browse === "vector", onClick: () => setBrowse(browse === "vector" ? null : "vector"), children: "Vector effect\u2026" })
1584
1743
  ] }),
1585
- !provider && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
1586
- browse === "motion" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
1587
- browse === "vector" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
1588
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
1589
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1590
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.instance, onClick: () => setOpen(open === e.instance ? null : e.instance), children: [
1744
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Commands effects made are kept." }),
1745
+ browse === "motion" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, uses: ["motion"], kinds: ["motion"], title: `Motion for ${target}`, onPick: (e) => (setBrowse(null), report(controller.applyMotionEffect(e.id, [target]))) }),
1746
+ browse === "vector" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, kinds: ["vector"], title: "Vector effects", onPick: (e) => (setBrowse(null), report(controller.addVectorEffect(e.id))) }),
1747
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ol", { className: "space-y-1", children: applied.map((e) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "rounded border border-border p-1", "data-motion-effect": e.instance, children: [
1748
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
1749
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left", "aria-expanded": open === e.instance, onClick: () => setOpen(open === e.instance ? null : e.instance), children: [
1591
1750
  e.name ?? e.effect,
1592
1751
  " ",
1593
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-muted-foreground", children: [
1752
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-muted-foreground", children: [
1594
1753
  "\xB7 ",
1595
1754
  e.kind === "vector" ? "picture" : e.targets.join(", ")
1596
1755
  ] })
1597
1756
  ] }),
1598
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn4, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
1757
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn5, disabled, "aria-label": `Remove ${e.name ?? e.effect}`, onClick: () => report(controller.removeMotionEffect(e.instance)), children: "\u2715" })
1599
1758
  ] }),
1600
- open === e.instance && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
1759
+ open === e.instance && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Controls, { controller, instance: e.instance, effect: e.effect, values: e.values }) })
1601
1760
  ] }, e.instance)) }),
1602
- !applied.length && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
1603
- message && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
1761
+ !applied.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No provider effects in this scene." }),
1762
+ message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-effects-message": "", children: message })
1604
1763
  ] });
1605
1764
  }
1606
1765
 
1607
1766
  // src/animation-editor/AnimationEditor.tsx
1608
- var import_jsx_runtime15 = require("react/jsx-runtime");
1767
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1609
1768
  var ONION = { before: 3, after: 1 };
1610
- var btn5 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
1611
- function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "" }) {
1769
+ var btn6 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
1770
+ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
1612
1771
  const state = useAnimationEditorState(controller);
1772
+ const rootRef = (0, import_react18.useRef)(null);
1773
+ const ambientPlayback = useAgentPlayback();
1774
+ const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
1775
+ const rectIn = (el) => {
1776
+ const box = rootRef.current?.getBoundingClientRect();
1777
+ const r = el?.getBoundingClientRect();
1778
+ return box && r && r.width > 0 ? { x: r.left - box.left, y: r.top - box.top, width: r.width, height: r.height } : null;
1779
+ };
1780
+ const agentPresence = usePlaybackSurface(playing, playbackId, {
1781
+ defaultKind: "shot",
1782
+ locate: (ref) => {
1783
+ const root = rootRef.current;
1784
+ if (!root) return null;
1785
+ if (ref.kind === "shot") return rectIn(root.querySelector(`[data-shot="${CSS.escape(ref.id)}"]`));
1786
+ if (ref.kind === "element") return rectIn(root.querySelector(`[data-animation-stage] [id="ae-${CSS.escape(ref.id)}"]`));
1787
+ return null;
1788
+ },
1789
+ bounds: () => {
1790
+ const r = rootRef.current?.getBoundingClientRect();
1791
+ return r && r.width > 0 ? { x: 0, y: 0, width: r.width, height: r.height } : null;
1792
+ },
1793
+ visible: () => {
1794
+ const r = rootRef.current?.getBoundingClientRect();
1795
+ return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
1796
+ },
1797
+ toViewport: (p) => {
1798
+ const r = rootRef.current?.getBoundingClientRect();
1799
+ return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
1800
+ },
1801
+ fromViewport: (p) => {
1802
+ const r = rootRef.current?.getBoundingClientRect();
1803
+ return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
1804
+ },
1805
+ reveal: () => onPlaybackReveal?.()
1806
+ });
1807
+ const presenceLayer = playing ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PresenceLayer, { presence: agentPresence }) : null;
1613
1808
  useEffects(controller, effects);
1614
1809
  const { issues, scene, selection, readOnly } = state;
1615
- const [picked, setPicked] = (0, import_react15.useState)(null);
1616
- const [onion, setOnion] = (0, import_react15.useState)(false);
1617
- const [paths, setPaths] = (0, import_react15.useState)(false);
1810
+ const [picked, setPicked] = (0, import_react18.useState)(null);
1811
+ const [onion, setOnion] = (0, import_react18.useState)(false);
1812
+ const [paths, setPaths] = (0, import_react18.useState)(false);
1813
+ const [recordMode, setRecordMode] = (0, import_react18.useState)("move");
1618
1814
  const command = selection?.command !== void 0 ? scene.shots.find((s) => s.id === selection.shot)?.run[selection.command] : void 0;
1619
1815
  const targets = command && "targets" in command ? command.targets : [];
1620
- const nodes = (0, import_react15.useMemo)(() => (0, import_animation_editor10.indexMotionNodes)(scene.artwork.nodes), [scene.artwork]);
1816
+ const nodes = (0, import_react18.useMemo)(() => (0, import_animation_editor11.indexMotionNodes)(scene.artwork.nodes), [scene.artwork]);
1621
1817
  const pickedValid = picked && nodes.has(picked) ? picked : null;
1622
1818
  const onPick = (id, event) => {
1623
1819
  if (event.shiftKey && id && command && "targets" in command && selection?.command !== void 0 && !readOnly) {
@@ -1627,7 +1823,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1627
1823
  }
1628
1824
  setPicked(id);
1629
1825
  };
1630
- const stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1826
+ const stage = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1631
1827
  AnimationStage,
1632
1828
  {
1633
1829
  controller,
@@ -1636,20 +1832,23 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1636
1832
  motionPaths: motionPaths ?? paths,
1637
1833
  onPick: editable ? onPick : void 0,
1638
1834
  highlight: editable ? [...pickedValid ? [pickedValid] : [], ...targets] : void 0,
1835
+ recordMode,
1639
1836
  className: "rounded-md border border-border bg-muted/40"
1640
1837
  }
1641
1838
  );
1642
- const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: (0, import_animation_editor10.motionIssueLine)(issue) }, i)) });
1839
+ const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: (0, import_animation_editor11.motionIssueLine)(issue) }, i)) });
1643
1840
  if (!editable)
1644
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
1841
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
1842
+ presenceLayer,
1645
1843
  stage,
1646
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PlayheadScrubber, { controller }),
1844
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayheadScrubber, { controller }),
1647
1845
  issueList
1648
1846
  ] });
1649
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1847
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1650
1848
  "div",
1651
1849
  {
1652
- className: `grid gap-3 lg:grid-cols-[minmax(0,1fr)_20rem] ${className}`,
1850
+ ref: rootRef,
1851
+ className: `relative grid gap-3 lg:grid-cols-[minmax(0,1fr)_20rem] ${className}`,
1653
1852
  "data-animation-editor": "",
1654
1853
  onKeyDown: (e) => {
1655
1854
  const el = e.target;
@@ -1659,40 +1858,42 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1659
1858
  else controller.undo();
1660
1859
  },
1661
1860
  children: [
1662
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
1861
+ presenceLayer,
1862
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
1663
1863
  stage,
1664
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PlayheadScrubber, { controller }),
1665
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
1666
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn5, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
1667
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn5, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
1668
- onionSkin === void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
1669
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
1864
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayheadScrubber, { controller }),
1865
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
1866
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn6, onClick: () => controller.undo(), disabled: !state.canUndo, title: state.canUndo ? `Undo ${state.undoLabel}` : "Nothing to undo", "data-undo": "", children: "Undo" }),
1867
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn6, onClick: () => controller.redo(), disabled: !state.canRedo, title: state.canRedo ? `Redo ${state.redoLabel}` : "Nothing to redo", "data-redo": "", children: "Redo" }),
1868
+ onionSkin === void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
1869
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: onion, onChange: (e) => setOnion(e.target.checked) }),
1670
1870
  " Onion skin"
1671
1871
  ] }),
1672
- motionPaths === void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
1673
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
1872
+ motionPaths === void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
1873
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: paths, onChange: (e) => setPaths(e.target.checked) }),
1674
1874
  " Motion paths"
1675
1875
  ] }),
1676
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1876
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ml-auto", "data-picked-element": pickedValid ?? void 0, children: pickedValid ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1677
1877
  "Picked ",
1678
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { className: "text-rose-500", children: pickedValid }),
1878
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { className: "text-rose-500", children: pickedValid }),
1679
1879
  " ",
1680
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
1880
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "underline", onClick: () => setPicked(null), children: "clear" })
1681
1881
  ] }) : "Click the stage to pick an element; shift-click to toggle it as a target." })
1682
1882
  ] }),
1883
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AnimationRecordPanel, { controller, node: pickedValid, mode: recordMode, onModeChange: setRecordMode, className: "border-t border-border pt-2" }),
1683
1884
  issueList
1684
1885
  ] }),
1685
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
1686
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
1687
- (state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
1688
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
1689
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { open: true, className: "border-t border-border pt-2", children: [
1690
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
1691
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ShotInspector, { controller, className: "mt-1" })
1886
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
1887
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CommandList, { controller, targets: pickedValid ? [pickedValid] : void 0 }),
1888
+ (state.effectsProvider || controller.appliedEffects().length > 0) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AnimationEffectsPanel, { controller, node: pickedValid, className: "border-t border-border pt-2" }),
1889
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CommandInspector, { controller, picked: pickedValid, className: "border-t border-border pt-2" }),
1890
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { open: true, className: "border-t border-border pt-2", children: [
1891
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Shot" }),
1892
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ShotInspector, { controller, className: "mt-1" })
1692
1893
  ] }),
1693
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "border-t border-border pt-2", children: [
1694
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
1695
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SceneSettings, { controller, className: "mt-1" })
1894
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { className: "border-t border-border pt-2", children: [
1895
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("summary", { className: "cursor-pointer text-xs font-medium", children: "Scene settings" }),
1896
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SceneSettings, { controller, className: "mt-1" })
1696
1897
  ] })
1697
1898
  ] })
1698
1899
  ]
@@ -1703,6 +1904,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1703
1904
  0 && (module.exports = {
1704
1905
  AnimationEditor,
1705
1906
  AnimationEffectsPanel,
1907
+ AnimationRecordPanel,
1706
1908
  AnimationStage,
1707
1909
  CommandInspector,
1708
1910
  CommandList,