@pixerate/editor-react 0.91.1 → 0.92.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 (33) hide show
  1. package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
  2. package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
  3. package/dist/canvas/index.cjs +1032 -893
  4. package/dist/canvas/index.d.cts +2 -0
  5. package/dist/canvas/index.d.ts +2 -0
  6. package/dist/canvas/index.js +125 -74
  7. package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
  8. package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
  9. package/dist/{chunk-SMMO7CZB.js → chunk-6MDTFAPY.js} +84 -2
  10. package/dist/chunk-ECBC4HD7.js +95 -0
  11. package/dist/hooks/useAgentToolProvider.d.cts +6 -2
  12. package/dist/hooks/useAgentToolProvider.d.ts +6 -2
  13. package/dist/image-editor/ImageEditor.d.cts +10 -0
  14. package/dist/image-editor/ImageEditor.d.ts +10 -0
  15. package/dist/image-editor/index.cjs +1027 -864
  16. package/dist/image-editor/index.js +2 -1
  17. package/dist/index.cjs +1986 -1810
  18. package/dist/index.d.cts +1 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +16 -2
  21. package/dist/playback/AgentPlaybackContext.d.cts +9 -0
  22. package/dist/playback/AgentPlaybackContext.d.ts +9 -0
  23. package/dist/playback/PresenceLayer.d.cts +28 -0
  24. package/dist/playback/PresenceLayer.d.ts +28 -0
  25. package/dist/playback/index.d.cts +3 -0
  26. package/dist/playback/index.d.ts +3 -0
  27. package/dist/playback/usePlaybackSurface.d.cts +9 -0
  28. package/dist/playback/usePlaybackSurface.d.ts +9 -0
  29. package/dist/vector/VectorCanvas.d.cts +11 -1
  30. package/dist/vector/VectorCanvas.d.ts +11 -1
  31. package/dist/vector/index.cjs +945 -826
  32. package/dist/vector/index.js +42 -3
  33. package/package.json +3 -3
@@ -218,21 +218,109 @@ function useImageEffectsTools(registry, controller, options = {}) {
218
218
  }
219
219
 
220
220
  // src/image-editor/ImageEditor.tsx
221
- var import_react21 = __toESM(require("react"), 1);
221
+ var import_react24 = __toESM(require("react"), 1);
222
+
223
+ // src/playback/AgentPlaybackContext.tsx
224
+ var import_react2 = require("react");
225
+ var import_jsx_runtime = require("react/jsx-runtime");
226
+ var AgentPlaybackContext = (0, import_react2.createContext)(null);
227
+ function useAgentPlayback() {
228
+ return (0, import_react2.useContext)(AgentPlaybackContext);
229
+ }
230
+
231
+ // src/playback/usePlaybackSurface.ts
232
+ var import_react3 = require("react");
233
+ var import_tools = require("@pixerate/editor/tools");
234
+ function usePlaybackSurface(playback, id, options = {}) {
235
+ const ambient = useAgentPlayback();
236
+ const target = playback === void 0 ? ambient : playback;
237
+ const [presence] = (0, import_react3.useState)(() => new import_tools.PresenceStore());
238
+ const latest = (0, import_react3.useRef)(options);
239
+ latest.current = options;
240
+ (0, import_react3.useEffect)(() => {
241
+ if (!target || !id) return;
242
+ const o = () => latest.current;
243
+ const surface = {
244
+ presence,
245
+ locate: (ref) => o().locate?.(ref) ?? null,
246
+ bounds: () => o().bounds?.() ?? null,
247
+ visible: () => o().visible?.() ?? true,
248
+ toViewport: (p) => o().toViewport?.(p) ?? p,
249
+ fromViewport: (p) => o().fromViewport?.(p) ?? p,
250
+ beginGesture: (key) => o().beginGesture?.(key),
251
+ endGesture: () => o().endGesture?.(),
252
+ reveal: () => o().reveal?.(),
253
+ open: (ref) => o().open?.(ref),
254
+ get defaultKind() {
255
+ return o().defaultKind;
256
+ }
257
+ };
258
+ const detach = target.attach(id, surface);
259
+ return () => {
260
+ detach();
261
+ for (const a of presence.getState().actors) presence.remove(a.id);
262
+ };
263
+ }, [target, id, presence]);
264
+ return presence;
265
+ }
266
+
267
+ // src/playback/PresenceLayer.tsx
268
+ var import_react4 = __toESM(require("react"), 1);
269
+ var import_jsx_runtime2 = require("react/jsx-runtime");
270
+ function PresenceLayer({ presence, viewport, className = "" }) {
271
+ const { actors } = (0, import_react4.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
272
+ if (!actors.length) return null;
273
+ const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
274
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
275
+ "div",
276
+ {
277
+ className: `pixerate-presence ${className}`.trim(),
278
+ "aria-hidden": "true",
279
+ "data-testid": "presence-layer",
280
+ style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
281
+ children: actors.map((a) => {
282
+ const at = map(a);
283
+ const ring = a.focus && (() => {
284
+ const tl = map(a.focus);
285
+ const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
286
+ return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
287
+ })();
288
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react4.default.Fragment, { children: [
289
+ ring && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
290
+ "div",
291
+ {
292
+ "data-actor-focus": a.id,
293
+ style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
294
+ }
295
+ ),
296
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
297
+ /* @__PURE__ */ (0, import_jsx_runtime2.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_runtime2.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 } }) }),
298
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
299
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
300
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime2.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 })
301
+ ] })
302
+ ] })
303
+ ] }, a.id);
304
+ })
305
+ }
306
+ );
307
+ }
308
+
309
+ // src/image-editor/ImageEditor.tsx
222
310
  var import_image_editor18 = require("@pixerate/editor/image-editor");
223
311
 
224
312
  // src/image-editor/ControlSlider.tsx
225
313
  var import_image_editor2 = require("@pixerate/editor/image-editor");
226
- var import_jsx_runtime = require("react/jsx-runtime");
314
+ var import_jsx_runtime3 = require("react/jsx-runtime");
227
315
  var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
228
316
  const name = label ?? spec.label;
229
317
  const track = (0, import_image_editor2.controlTrackBackground)(spec);
230
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "data-control-id": spec.id, children: [
231
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
232
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: name }),
233
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-mono", children: (0, import_image_editor2.formatControlValue)(spec, value) })
318
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { "data-control-id": spec.id, children: [
319
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
320
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: name }),
321
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "font-mono", children: (0, import_image_editor2.formatControlValue)(spec, value) })
234
322
  ] }),
235
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
323
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
236
324
  "input",
237
325
  {
238
326
  type: "range",
@@ -246,14 +334,14 @@ var ControlSlider = ({ spec, value, onChange, disabled, label }) => {
246
334
  className: "w-full accent-indigo-500 disabled:opacity-40"
247
335
  }
248
336
  ),
249
- track && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
337
+ track && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
250
338
  ] });
251
339
  };
252
340
 
253
341
  // src/image-editor/Histogram.tsx
254
- var import_react2 = require("react");
342
+ var import_react5 = require("react");
255
343
  var import_image_editor3 = require("@pixerate/editor/image-editor");
256
- var import_jsx_runtime2 = require("react/jsx-runtime");
344
+ var import_jsx_runtime4 = require("react/jsx-runtime");
257
345
  var FILL = {
258
346
  luminance: "rgba(148, 163, 184, 0.45)",
259
347
  red: "rgba(239, 68, 68, 0.45)",
@@ -263,14 +351,14 @@ var FILL = {
263
351
  var W = 256;
264
352
  var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", style }) => {
265
353
  const channels = channel === "rgb" ? ["luminance", "red", "green", "blue"] : [channel];
266
- const paths = (0, import_react2.useMemo)(
354
+ const paths = (0, import_react5.useMemo)(
267
355
  () => histogram && histogram.samples > 0 ? channels.map((c) => ({ c, d: (0, import_image_editor3.histogramPath)(histogram, c, W, height) })) : [],
268
356
  // eslint-disable-next-line react-hooks/exhaustive-deps
269
357
  [histogram, channel, height]
270
358
  );
271
359
  const clipLow = histogram && histogram.samples ? Math.max(...histogram.shadows) / histogram.samples : 0;
272
360
  const clipHigh = histogram && histogram.samples ? Math.max(...histogram.highlights) / histogram.samples : 0;
273
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
361
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
274
362
  "svg",
275
363
  {
276
364
  viewBox: `0 0 ${W} ${height}`,
@@ -281,32 +369,32 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
281
369
  className: `w-full rounded bg-slate-950/60 ${className}`,
282
370
  style: { height, ...style },
283
371
  children: [
284
- paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
285
- clipLow > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: 0, y: 0, width: 3, height, fill: "#3b82f6", "data-testid": "histogram-clip-shadows" }),
286
- clipHigh > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: W - 3, y: 0, width: 3, height, fill: "#ef4444", "data-testid": "histogram-clip-highlights" })
372
+ paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
373
+ clipLow > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: 0, y: 0, width: 3, height, fill: "#3b82f6", "data-testid": "histogram-clip-shadows" }),
374
+ clipHigh > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: W - 3, y: 0, width: 3, height, fill: "#ef4444", "data-testid": "histogram-clip-highlights" })
287
375
  ]
288
376
  }
289
377
  );
290
378
  };
291
379
  function useImageHistogram(controller) {
292
- const [histogram, setHistogram] = (0, import_react2.useState)(() => controller.getHistogram());
293
- (0, import_react2.useEffect)(() => controller.subscribeHistogram(setHistogram), [controller]);
380
+ const [histogram, setHistogram] = (0, import_react5.useState)(() => controller.getHistogram());
381
+ (0, import_react5.useEffect)(() => controller.subscribeHistogram(setHistogram), [controller]);
294
382
  return histogram;
295
383
  }
296
384
 
297
385
  // src/image-editor/AdjustmentLayersPanel.tsx
298
- var import_react4 = require("react");
386
+ var import_react7 = require("react");
299
387
  var import_image_editor5 = require("@pixerate/editor/image-editor");
300
388
 
301
389
  // src/image-editor/CurvesEditor.tsx
302
- var import_react3 = require("react");
390
+ var import_react6 = require("react");
303
391
  var import_image_editor4 = require("@pixerate/editor/image-editor");
304
- var import_jsx_runtime3 = require("react/jsx-runtime");
392
+ var import_jsx_runtime5 = require("react/jsx-runtime");
305
393
  var BOX = 256;
306
394
  var STROKE = { master: "#e2e8f0", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
307
395
  var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200 }) => {
308
- const svgRef = (0, import_react3.useRef)(null);
309
- const [drag, setDrag] = (0, import_react3.useState)(null);
396
+ const svgRef = (0, import_react6.useRef)(null);
397
+ const [drag, setDrag] = (0, import_react6.useState)(null);
310
398
  const toBox = (e) => {
311
399
  const rect = svgRef.current?.getBoundingClientRect();
312
400
  if (!rect || !rect.width || !rect.height) return { x: 0, y: 0 };
@@ -335,7 +423,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
335
423
  if (index !== -1 && points.length > 2) onChange((0, import_image_editor4.removeCurvePoint)(points, index), true);
336
424
  };
337
425
  const histChannel = channel === "master" ? "luminance" : channel;
338
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
426
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
339
427
  "svg",
340
428
  {
341
429
  ref: svgRef,
@@ -352,16 +440,16 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
352
440
  onPointerCancel: () => setDrag(null),
353
441
  onDoubleClick,
354
442
  children: [
355
- histogram && histogram.samples > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: (0, import_image_editor4.histogramPath)(histogram, histChannel, BOX, BOX), fill: "rgba(148, 163, 184, 0.25)" }),
356
- [64, 128, 192].map((v) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { stroke: "rgba(148, 163, 184, 0.2)", strokeWidth: 1, children: [
357
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: v, y1: 0, x2: v, y2: BOX }),
358
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: 0, y1: v, x2: BOX, y2: v })
443
+ histogram && histogram.samples > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: (0, import_image_editor4.histogramPath)(histogram, histChannel, BOX, BOX), fill: "rgba(148, 163, 184, 0.25)" }),
444
+ [64, 128, 192].map((v) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { stroke: "rgba(148, 163, 184, 0.2)", strokeWidth: 1, children: [
445
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: v, y1: 0, x2: v, y2: BOX }),
446
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: 0, y1: v, x2: BOX, y2: v })
359
447
  ] }, v)),
360
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: 0, y1: BOX, x2: BOX, y2: 0, stroke: "rgba(148, 163, 184, 0.35)", strokeDasharray: "4 4" }),
361
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: (0, import_image_editor4.curveSvgPath)(points, BOX, BOX), fill: "none", stroke: STROKE[channel], strokeWidth: 2 }),
448
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: 0, y1: BOX, x2: BOX, y2: 0, stroke: "rgba(148, 163, 184, 0.35)", strokeDasharray: "4 4" }),
449
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: (0, import_image_editor4.curveSvgPath)(points, BOX, BOX), fill: "none", stroke: STROKE[channel], strokeWidth: 2 }),
362
450
  points.map((p, i) => {
363
451
  const b = (0, import_image_editor4.curvePointToBox)(p, BOX, BOX);
364
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
452
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
365
453
  "circle",
366
454
  {
367
455
  cx: b.x,
@@ -381,7 +469,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
381
469
  };
382
470
 
383
471
  // src/image-editor/AdjustmentLayersPanel.tsx
384
- var import_jsx_runtime4 = require("react/jsx-runtime");
472
+ var import_jsx_runtime6 = require("react/jsx-runtime");
385
473
  var CHANNELS = [
386
474
  { id: "master", label: "RGB" },
387
475
  { id: "red", label: "Red" },
@@ -397,26 +485,26 @@ var selectClass = "bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text
397
485
  var chipClass = (on) => `px-2 py-0.5 rounded text-[10px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-400 hover:text-slate-200"}`;
398
486
  var HueRangeStrip = ({ bounds }) => {
399
487
  const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor5.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
400
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
401
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("linearGradient", { id: "pixerate-hue-strip", children: [0, 60, 120, 180, 240, 300, 360].map((h) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("stop", { offset: `${h / 360 * 100}%`, stopColor: `hsl(${h}, 90%, 50%)` }, h)) }) }),
402
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { width: 360, height: 20, fill: "url(#pixerate-hue-strip)", opacity: 0.6 }),
403
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
488
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
489
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("linearGradient", { id: "pixerate-hue-strip", children: [0, 60, 120, 180, 240, 300, 360].map((h) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", { offset: `${h / 360 * 100}%`, stopColor: `hsl(${h}, 90%, 50%)` }, h)) }) }),
490
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { width: 360, height: 20, fill: "url(#pixerate-hue-strip)", opacity: 0.6 }),
491
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
404
492
  ] });
405
493
  };
406
494
  var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
407
495
  const follow = layersProp === void 0;
408
- const [, setTick] = (0, import_react4.useState)(0);
409
- (0, import_react4.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
496
+ const [, setTick] = (0, import_react7.useState)(0);
497
+ (0, import_react7.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
410
498
  const layers = layersProp ?? controller.getAdjustmentLayers();
411
- const [newKind, setNewKind] = (0, import_react4.useState)("curves");
412
- const [selectedId, setSelectedId] = (0, import_react4.useState)(null);
413
- const [channel, setChannel] = (0, import_react4.useState)("master");
414
- const [range, setRange] = (0, import_react4.useState)(-1);
415
- const [tone, setTone] = (0, import_react4.useState)("midtones");
499
+ const [newKind, setNewKind] = (0, import_react7.useState)("curves");
500
+ const [selectedId, setSelectedId] = (0, import_react7.useState)(null);
501
+ const [channel, setChannel] = (0, import_react7.useState)("master");
502
+ const [range, setRange] = (0, import_react7.useState)(-1);
503
+ const [tone, setTone] = (0, import_react7.useState)("midtones");
416
504
  const selected = layers.find((l) => l.id === selectedId) ?? null;
417
505
  const topFirst = [...layers].reverse();
418
506
  const setParam = (layer, path, value, commit = true) => controller.updateAdjustmentLayer(layer.id, { params: (0, import_image_editor5.setControlPath)(layer.params, path, value) }, commit);
419
- const slider = (layer, spec, label) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
507
+ const slider = (layer, spec, label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
420
508
  ControlSlider,
421
509
  {
422
510
  spec,
@@ -427,8 +515,8 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
427
515
  spec.id
428
516
  );
429
517
  const controlsOf = (layer, filter = () => true) => import_image_editor5.ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
430
- const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
431
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
518
+ const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
519
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
432
520
  "input",
433
521
  {
434
522
  type: "checkbox",
@@ -442,9 +530,9 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
442
530
  const editor = (layer) => {
443
531
  switch (layer.kind) {
444
532
  case "curves":
445
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2", children: [
446
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Curve channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
447
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
533
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
534
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Curve channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
535
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
448
536
  CurvesEditor,
449
537
  {
450
538
  points: layer.params[channel],
@@ -455,33 +543,33 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
455
543
  )
456
544
  ] });
457
545
  case "levels":
458
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2", children: [
459
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Levels channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
546
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
547
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Levels channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
460
548
  controlsOf(layer, (s) => s.id.startsWith(`${channel}.`)).map((s) => slider(layer, s))
461
549
  ] });
462
550
  case "hueSaturation":
463
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2", children: [
464
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Hue range", children: [
465
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: chipClass(range === -1), onClick: () => setRange(-1), children: "Master" }),
466
- import_image_editor5.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: chipClass(range === i), onClick: () => setRange(i), disabled: layer.params.colorize, children: name }, name))
551
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
552
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Hue range", children: [
553
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(range === -1), onClick: () => setRange(-1), children: "Master" }),
554
+ import_image_editor5.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(range === i), onClick: () => setRange(i), disabled: layer.params.colorize, children: name }, name))
467
555
  ] }),
468
- range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HueRangeStrip, { bounds: layer.params.ranges[range].bounds }),
556
+ range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HueRangeStrip, { bounds: layer.params.ranges[range].bounds }),
469
557
  controlsOf(layer, (s) => range === -1 || layer.params.colorize ? !s.id.startsWith("ranges.") : s.id.startsWith(`ranges.${range}.`)).map(
470
558
  (s) => slider(layer, s)
471
559
  ),
472
560
  range === -1 && checkbox(layer, "colorize", "Colorize")
473
561
  ] });
474
562
  case "colorBalance":
475
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2", children: [
476
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Tone", children: TONES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: chipClass(tone === t.id), onClick: () => setTone(t.id), children: t.label }, t.id)) }),
563
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
564
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Tone", children: TONES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: chipClass(tone === t.id), onClick: () => setTone(t.id), children: t.label }, t.id)) }),
477
565
  controlsOf(layer, (s) => s.id.startsWith(`${tone}.`)).map((s) => slider(layer, s)),
478
566
  checkbox(layer, "preserveLuminosity", "Preserve luminosity")
479
567
  ] });
480
568
  case "blackWhite":
481
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2", children: [
569
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
482
570
  controlsOf(layer).map((s) => slider(layer, s)),
483
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
484
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
571
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
572
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
485
573
  "input",
486
574
  {
487
575
  type: "checkbox",
@@ -491,7 +579,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
491
579
  }
492
580
  ),
493
581
  "Tint",
494
- layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
582
+ layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
495
583
  "input",
496
584
  {
497
585
  type: "color",
@@ -504,10 +592,10 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
504
592
  ] })
505
593
  ] });
506
594
  case "photoFilter":
507
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2", children: [
508
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
595
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2", children: [
596
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
509
597
  "Filter colour",
510
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
598
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
511
599
  "input",
512
600
  {
513
601
  type: "color",
@@ -522,25 +610,25 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
522
610
  checkbox(layer, "preserveLuminosity", "Preserve luminosity")
523
611
  ] });
524
612
  case "invert":
525
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-slate-500 text-[11px]", children: "Invert has no settings." });
613
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-slate-500 text-[11px]", children: "Invert has no settings." });
526
614
  default:
527
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
615
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
528
616
  }
529
617
  };
530
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2 text-xs", "data-testid": "adjustment-layers-panel", children: [
531
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Adjustment Layers" }) }),
532
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex gap-1.5", children: [
533
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
618
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2 text-xs", "data-testid": "adjustment-layers-panel", children: [
619
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Adjustment Layers" }) }),
620
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-1.5", children: [
621
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
534
622
  "select",
535
623
  {
536
624
  "aria-label": "New adjustment layer kind",
537
625
  className: `${selectClass} flex-1`,
538
626
  value: newKind,
539
627
  onChange: (e) => setNewKind(e.target.value),
540
- children: import_image_editor5.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: k.kind, children: k.label }, k.kind))
628
+ children: import_image_editor5.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: k.kind, children: k.label }, k.kind))
541
629
  }
542
630
  ),
543
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
631
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
544
632
  "button",
545
633
  {
546
634
  type: "button",
@@ -554,15 +642,15 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
554
642
  }
555
643
  )
556
644
  ] }),
557
- topFirst.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Adjustment layers", children: topFirst.map((layer) => {
645
+ topFirst.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Adjustment layers", children: topFirst.map((layer) => {
558
646
  const index = layers.indexOf(layer);
559
647
  const label = layer.name || (0, import_image_editor5.adjustmentKindLabel)(layer.kind);
560
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
648
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
561
649
  "li",
562
650
  {
563
651
  className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-indigo-600/20 ring-1 ring-indigo-500/50" : "bg-slate-800/60"}`,
564
652
  children: [
565
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
653
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
566
654
  "input",
567
655
  {
568
656
  type: "checkbox",
@@ -572,7 +660,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
572
660
  className: "accent-indigo-500"
573
661
  }
574
662
  ),
575
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
663
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
576
664
  "button",
577
665
  {
578
666
  type: "button",
@@ -582,7 +670,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
582
670
  children: label
583
671
  }
584
672
  ),
585
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
673
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
586
674
  "button",
587
675
  {
588
676
  type: "button",
@@ -593,7 +681,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
593
681
  children: "\u2191"
594
682
  }
595
683
  ),
596
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
684
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
597
685
  "button",
598
686
  {
599
687
  type: "button",
@@ -604,7 +692,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
604
692
  children: "\u2193"
605
693
  }
606
694
  ),
607
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
695
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
608
696
  "button",
609
697
  {
610
698
  type: "button",
@@ -622,21 +710,21 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
622
710
  layer.id
623
711
  );
624
712
  }) }),
625
- selected && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-slate-700/60 p-2", "data-testid": "adjustment-layer-editor", children: [
626
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-2", children: [
627
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-slate-400", children: "Blend" }),
628
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
713
+ selected && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-slate-700/60 p-2", "data-testid": "adjustment-layer-editor", children: [
714
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
715
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400", children: "Blend" }),
716
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
629
717
  "select",
630
718
  {
631
719
  "aria-label": "Blend mode",
632
720
  className: `${selectClass} flex-1`,
633
721
  value: selected.blend,
634
722
  onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
635
- children: import_image_editor5.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: m.id, children: m.label }, m.id))
723
+ children: import_image_editor5.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: m.id, children: m.label }, m.id))
636
724
  }
637
725
  )
638
726
  ] }),
639
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
727
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
640
728
  ControlSlider,
641
729
  {
642
730
  spec: import_image_editor5.ADJUSTMENT_LAYER_OPACITY_CONTROL,
@@ -651,19 +739,19 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram }) => {
651
739
  };
652
740
 
653
741
  // src/image-editor/LayersPanel.tsx
654
- var import_react6 = require("react");
742
+ var import_react9 = require("react");
655
743
 
656
744
  // src/image-editor/LayerEffectsPanel.tsx
657
- var import_react5 = require("react");
745
+ var import_react8 = require("react");
658
746
  var import_image_editor6 = require("@pixerate/editor/image-editor");
659
- var import_jsx_runtime5 = require("react/jsx-runtime");
747
+ var import_jsx_runtime7 = require("react/jsx-runtime");
660
748
  var button = "px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300 hover:text-white disabled:opacity-40";
661
749
  var LayerEffectsPanel = ({ controller, layerId, className }) => {
662
- const [, setTick] = (0, import_react5.useState)(0);
663
- (0, import_react5.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
664
- const [open, setOpen] = (0, import_react5.useState)(null);
665
- const [error, setError] = (0, import_react5.useState)(null);
666
- const commitNext = (0, import_react5.useRef)(true);
750
+ const [, setTick] = (0, import_react8.useState)(0);
751
+ (0, import_react8.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
752
+ const [open, setOpen] = (0, import_react8.useState)(null);
753
+ const [error, setError] = (0, import_react8.useState)(null);
754
+ const commitNext = (0, import_react8.useRef)(true);
667
755
  const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
668
756
  const model = (0, import_image_editor6.layerEffectsPanel)(layer);
669
757
  const id = layer?.id;
@@ -681,7 +769,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
681
769
  onKeyDown: () => commitNext.current = true
682
770
  };
683
771
  if (!model.available || !id) {
684
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `text-xs text-slate-500 ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
772
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `text-xs text-slate-500 ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
685
773
  }
686
774
  const effects = controller.getLayerEffects(id);
687
775
  const patterns = controller.getDocumentPatterns();
@@ -696,14 +784,14 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
696
784
  case "range": {
697
785
  const k = c.percent ? 100 : 1;
698
786
  const shown = Math.round(c.value * k * 100) / 100;
699
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
700
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "text-slate-400", children: [
787
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
788
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "text-slate-400", children: [
701
789
  label,
702
790
  " ",
703
791
  shown,
704
792
  c.unit
705
793
  ] }),
706
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
794
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
707
795
  "input",
708
796
  {
709
797
  type: "range",
@@ -721,19 +809,19 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
721
809
  ] }, c.key);
722
810
  }
723
811
  case "color":
724
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
725
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
812
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
813
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
726
814
  label
727
815
  ] }, c.key);
728
816
  case "checkbox":
729
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
730
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-indigo-500" }),
817
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
818
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-indigo-500" }),
731
819
  label
732
820
  ] }, c.key);
733
821
  case "select":
734
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
735
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-slate-400", children: label }),
736
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
822
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
823
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: label }),
824
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
737
825
  "select",
738
826
  {
739
827
  "aria-label": label,
@@ -741,17 +829,17 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
741
829
  disabled: model.readOnly,
742
830
  onChange: (e) => change(effectId, c, e.target.value),
743
831
  className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
744
- children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: o.value, children: o.label }, o.value))
832
+ children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: o.value, children: o.label }, o.value))
745
833
  }
746
834
  )
747
835
  ] }, c.key);
748
836
  }
749
837
  };
750
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
751
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
752
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "font-semibold text-slate-300", children: "fx Effects" }),
753
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1 text-slate-300", children: [
754
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
838
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
839
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
840
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-semibold text-slate-300", children: "fx Effects" }),
841
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1 text-slate-300", children: [
842
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
755
843
  "input",
756
844
  {
757
845
  type: "checkbox",
@@ -764,9 +852,9 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
764
852
  ),
765
853
  "On"
766
854
  ] }),
767
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
855
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
768
856
  "Scale",
769
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
857
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
770
858
  "input",
771
859
  {
772
860
  type: "number",
@@ -785,7 +873,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
785
873
  ),
786
874
  "%"
787
875
  ] }),
788
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
876
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
789
877
  "select",
790
878
  {
791
879
  "aria-label": "Add effect",
@@ -798,19 +886,19 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
798
886
  },
799
887
  className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
800
888
  children: [
801
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "Add effect\u2026" }),
802
- import_image_editor6.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: m.kind, children: m.label }, m.kind))
889
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", children: "Add effect\u2026" }),
890
+ import_image_editor6.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: m.kind, children: m.label }, m.kind))
803
891
  ]
804
892
  }
805
893
  )
806
894
  ] }),
807
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-slate-500", children: model.reason }),
808
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
895
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-slate-500", children: model.reason }),
896
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
809
897
  const effect = effects.items.find((e) => e.id === row.id);
810
898
  const expanded = open === row.id;
811
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-slate-900/60 ring-1 ring-slate-800", children: [
812
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
813
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
899
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-slate-900/60 ring-1 ring-slate-800", children: [
900
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
901
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
814
902
  "input",
815
903
  {
816
904
  type: "checkbox",
@@ -821,7 +909,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
821
909
  className: "accent-indigo-500"
822
910
  }
823
911
  ),
824
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
912
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
825
913
  "button",
826
914
  {
827
915
  type: "button",
@@ -831,18 +919,18 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
831
919
  children: row.label
832
920
  }
833
921
  ),
834
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
922
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
835
923
  ] }),
836
- expanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_image_editor6.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
924
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_image_editor6.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
837
925
  ] }, row.id);
838
926
  }) }),
839
- error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
927
+ error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
840
928
  ] });
841
929
  };
842
930
 
843
931
  // src/image-editor/LayersPanel.tsx
844
932
  var import_image_editor7 = require("@pixerate/editor/image-editor");
845
- var import_jsx_runtime6 = require("react/jsx-runtime");
933
+ var import_jsx_runtime8 = require("react/jsx-runtime");
846
934
  var iconButton = "px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300 hover:text-white disabled:opacity-40";
847
935
  var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "hover:bg-slate-800"}`;
848
936
  var Thumbnail = ({
@@ -853,8 +941,8 @@ var Thumbnail = ({
853
941
  selected,
854
942
  testId
855
943
  }) => {
856
- const ref = (0, import_react6.useRef)(null);
857
- (0, import_react6.useEffect)(() => {
944
+ const ref = (0, import_react9.useRef)(null);
945
+ (0, import_react9.useEffect)(() => {
858
946
  const canvas = ref.current;
859
947
  const ctx = canvas?.getContext("2d");
860
948
  if (!canvas || !ctx || !pixels || typeof ctx.createImageData !== "function") return;
@@ -864,7 +952,7 @@ var Thumbnail = ({
864
952
  img.data.set(pixels.data);
865
953
  ctx.putImageData(img, 0, 0);
866
954
  }, [pixels]);
867
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
955
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
868
956
  "canvas",
869
957
  {
870
958
  ref,
@@ -878,14 +966,14 @@ var Thumbnail = ({
878
966
  );
879
967
  };
880
968
  var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
881
- const [, setTick] = (0, import_react6.useState)(0);
882
- (0, import_react6.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
883
- const [error, setError] = (0, import_react6.useState)(null);
884
- const [renaming, setRenaming] = (0, import_react6.useState)(null);
885
- const [menu, setMenu] = (0, import_react6.useState)(null);
886
- const [drag, setDrag] = (0, import_react6.useState)(null);
887
- const [psdNotes, setPsdNotes] = (0, import_react6.useState)([]);
888
- const fileInput = (0, import_react6.useRef)(null);
969
+ const [, setTick] = (0, import_react9.useState)(0);
970
+ (0, import_react9.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
971
+ const [error, setError] = (0, import_react9.useState)(null);
972
+ const [renaming, setRenaming] = (0, import_react9.useState)(null);
973
+ const [menu, setMenu] = (0, import_react9.useState)(null);
974
+ const [drag, setDrag] = (0, import_react9.useState)(null);
975
+ const [psdNotes, setPsdNotes] = (0, import_react9.useState)([]);
976
+ const fileInput = (0, import_react9.useRef)(null);
889
977
  const psdTask = async (fn) => {
890
978
  try {
891
979
  setError(null);
@@ -894,7 +982,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
894
982
  setError(err instanceof Error ? err.message : String(err));
895
983
  }
896
984
  };
897
- const commitNext = (0, import_react6.useRef)(true);
985
+ const commitNext = (0, import_react9.useRef)(true);
898
986
  const state = controller.getState();
899
987
  const rows = (0, import_image_editor7.layerPanelRows)(state.layers, state.activeLayerId);
900
988
  const active = controller.getActiveLayer();
@@ -932,14 +1020,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
932
1020
  const thumb = (layer) => (0, import_image_editor7.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
933
1021
  const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
934
1022
  const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
935
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
936
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
937
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: iconButton, onClick: () => run("new-layer"), children: "New Layer" }),
938
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: iconButton, onClick: () => run("new-group"), children: "New Group" }),
939
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
940
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
941
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
942
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1023
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
1024
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
1025
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => run("new-layer"), children: "New Layer" }),
1026
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => run("new-group"), children: "New Group" }),
1027
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
1028
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
1029
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
1030
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
943
1031
  "button",
944
1032
  {
945
1033
  type: "button",
@@ -954,7 +1042,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
954
1042
  children: "\u22EF"
955
1043
  }
956
1044
  ),
957
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1045
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
958
1046
  "select",
959
1047
  {
960
1048
  "aria-label": "Bits per channel",
@@ -962,13 +1050,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
962
1050
  className: "rounded bg-slate-800 px-1 py-0.5 text-[11px] text-slate-200",
963
1051
  value: controller.bitDepth,
964
1052
  onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
965
- children: import_image_editor7.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
1053
+ children: import_image_editor7.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
966
1054
  }
967
1055
  ),
968
- psd && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
969
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: iconButton, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
970
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: iconButton, onClick: () => psdTask(async () => (await (0, import_image_editor7.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
971
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1056
+ psd && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1057
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
1058
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: iconButton, onClick: () => psdTask(async () => (await (0, import_image_editor7.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
1059
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
972
1060
  "input",
973
1061
  {
974
1062
  ref: fileInput,
@@ -986,18 +1074,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
986
1074
  )
987
1075
  ] })
988
1076
  ] }),
989
- psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ul", { className: "rounded bg-amber-900/30 text-amber-200 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
990
- psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { children: n }, n)),
991
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
1077
+ psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("ul", { className: "rounded bg-amber-900/30 text-amber-200 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
1078
+ psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: n }, n)),
1079
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
992
1080
  ] }),
993
- active && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
994
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
995
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-slate-400", children: [
1081
+ active && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
1082
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1083
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-slate-400", children: [
996
1084
  "Opacity ",
997
1085
  Math.round(active.opacity * 100),
998
1086
  "%"
999
1087
  ] }),
1000
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1088
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1001
1089
  "input",
1002
1090
  {
1003
1091
  type: "range",
@@ -1011,13 +1099,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1011
1099
  }
1012
1100
  )
1013
1101
  ] }),
1014
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1015
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-slate-400", children: [
1102
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1103
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-slate-400", children: [
1016
1104
  "Fill ",
1017
1105
  Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
1018
1106
  "%"
1019
1107
  ] }),
1020
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1108
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1021
1109
  "input",
1022
1110
  {
1023
1111
  type: "range",
@@ -1032,7 +1120,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1032
1120
  }
1033
1121
  )
1034
1122
  ] }),
1035
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1123
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1036
1124
  "select",
1037
1125
  {
1038
1126
  "aria-label": "Layer blend mode",
@@ -1040,13 +1128,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1040
1128
  value: active.blend,
1041
1129
  onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
1042
1130
  children: [
1043
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "pass-through", children: "Pass Through" }),
1044
- import_image_editor7.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: m.id, children: m.label }, m.id))
1131
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "pass-through", children: "Pass Through" }),
1132
+ import_image_editor7.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: m.id, children: m.label }, m.id))
1045
1133
  ]
1046
1134
  }
1047
1135
  ),
1048
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
1049
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1136
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-slate-300", children: [
1137
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1050
1138
  "input",
1051
1139
  {
1052
1140
  type: "checkbox",
@@ -1058,8 +1146,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1058
1146
  ),
1059
1147
  "Clip to below"
1060
1148
  ] }),
1061
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-slate-400", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-1", children: [
1062
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1149
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-slate-400", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1", children: [
1150
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1063
1151
  "input",
1064
1152
  {
1065
1153
  type: "checkbox",
@@ -1072,10 +1160,10 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1072
1160
  k
1073
1161
  ] }, k)) })
1074
1162
  ] }),
1075
- effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LayerEffectsPanel, { controller, className: "border-t border-slate-800 pt-1.5" }),
1076
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
1163
+ effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LayerEffectsPanel, { controller, className: "border-t border-slate-800 pt-1.5" }),
1164
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
1077
1165
  const { layer } = row;
1078
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1166
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1079
1167
  "li",
1080
1168
  {
1081
1169
  role: "treeitem",
@@ -1105,7 +1193,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1105
1193
  className: rowClass(row.active),
1106
1194
  style: { paddingLeft: 6 + row.depth * 14 },
1107
1195
  children: [
1108
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1196
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1109
1197
  "button",
1110
1198
  {
1111
1199
  type: "button",
@@ -1119,7 +1207,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1119
1207
  children: layer.visible ? "\u25CF" : "\u25CB"
1120
1208
  }
1121
1209
  ),
1122
- layer.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1210
+ layer.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1123
1211
  "button",
1124
1212
  {
1125
1213
  type: "button",
@@ -1132,9 +1220,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1132
1220
  children: layer.collapsed ? "\u25B8" : "\u25BE"
1133
1221
  }
1134
1222
  ),
1135
- row.clipped && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-500", "aria-label": "Clipped", children: "\u21B3" }),
1136
- (0, import_image_editor7.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "relative shrink-0", children: [
1137
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1223
+ row.clipped && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-500", "aria-label": "Clipped", children: "\u21B3" }),
1224
+ (0, import_image_editor7.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "relative shrink-0", children: [
1225
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1138
1226
  Thumbnail,
1139
1227
  {
1140
1228
  pixels: thumb(layer),
@@ -1143,7 +1231,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1143
1231
  selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask)
1144
1232
  }
1145
1233
  ),
1146
- layer.type !== "pixel" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1234
+ layer.type !== "pixel" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1147
1235
  "span",
1148
1236
  {
1149
1237
  "data-testid": "layer-kind-badge",
@@ -1151,7 +1239,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1151
1239
  children: (0, import_image_editor7.layerBadge)(layer)
1152
1240
  }
1153
1241
  )
1154
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1242
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1155
1243
  "span",
1156
1244
  {
1157
1245
  className: "shrink-0 grid place-items-center rounded bg-slate-800 text-[9px] text-slate-400 ring-1 ring-slate-700",
@@ -1159,7 +1247,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1159
1247
  children: (0, import_image_editor7.layerBadge)(layer)
1160
1248
  }
1161
1249
  ),
1162
- layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1250
+ layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1163
1251
  "button",
1164
1252
  {
1165
1253
  type: "button",
@@ -1175,7 +1263,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1175
1263
  children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
1176
1264
  }
1177
1265
  ),
1178
- layer.mask && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1266
+ layer.mask && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1179
1267
  Thumbnail,
1180
1268
  {
1181
1269
  pixels: maskThumb(layer),
@@ -1190,7 +1278,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1190
1278
  }
1191
1279
  }
1192
1280
  ),
1193
- renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1281
+ renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1194
1282
  "input",
1195
1283
  {
1196
1284
  autoFocus: true,
@@ -1207,7 +1295,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1207
1295
  if (e.key === "Escape") setRenaming(null);
1208
1296
  }
1209
1297
  }
1210
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1298
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1211
1299
  "span",
1212
1300
  {
1213
1301
  className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-slate-500"}`,
@@ -1218,8 +1306,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1218
1306
  children: row.label
1219
1307
  }
1220
1308
  ),
1221
- (0, import_image_editor7.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor7.layerWarning)(layer), title: (0, import_image_editor7.layerWarning)(layer), className: "text-[10px] text-amber-400", children: "\u26A0" }),
1222
- (0, import_image_editor7.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1309
+ (0, import_image_editor7.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor7.layerWarning)(layer), title: (0, import_image_editor7.layerWarning)(layer), className: "text-[10px] text-amber-400", children: "\u26A0" }),
1310
+ (0, import_image_editor7.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1223
1311
  "button",
1224
1312
  {
1225
1313
  type: "button",
@@ -1234,15 +1322,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1234
1322
  children: "fx"
1235
1323
  }
1236
1324
  ),
1237
- locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-label": "Locked", className: "text-slate-400", children: "\u{1F512}" }),
1238
- layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[9px] text-slate-500", children: layer.blend })
1325
+ locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-label": "Locked", className: "text-slate-400", children: "\u{1F512}" }),
1326
+ layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-[9px] text-slate-500", children: layer.blend })
1239
1327
  ]
1240
1328
  },
1241
1329
  layer.id
1242
1330
  );
1243
1331
  }) }),
1244
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
1245
- menu && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1332
+ error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
1333
+ menu && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1246
1334
  "div",
1247
1335
  {
1248
1336
  role: "menu",
@@ -1251,7 +1339,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1251
1339
  style: { left: menu.x, top: menu.y },
1252
1340
  onClick: (e) => e.stopPropagation(),
1253
1341
  onKeyDown: (e) => e.key === "Escape" && setMenu(null),
1254
- children: (0, import_image_editor7.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1342
+ children: (0, import_image_editor7.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1255
1343
  "button",
1256
1344
  {
1257
1345
  type: "button",
@@ -1269,21 +1357,21 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1269
1357
  };
1270
1358
 
1271
1359
  // src/image-editor/ImageProviderEffectsPanel.tsx
1272
- var import_react12 = __toESM(require("react"), 1);
1360
+ var import_react15 = __toESM(require("react"), 1);
1273
1361
  var import_image_editor8 = require("@pixerate/editor/image-editor");
1274
1362
 
1275
1363
  // src/effects/useEffects.ts
1276
- var import_react7 = require("react");
1364
+ var import_react10 = require("react");
1277
1365
  function useEffects(host, provider) {
1278
- (0, import_react7.useEffect)(() => {
1366
+ (0, import_react10.useEffect)(() => {
1279
1367
  if (!host || !provider) return;
1280
1368
  return host.useEffects(provider);
1281
1369
  }, [host, provider]);
1282
1370
  }
1283
1371
  function useEffectDescription(provider, effect) {
1284
- const [state, setState] = (0, import_react7.useState)({ key: "", description: null, error: null });
1372
+ const [state, setState] = (0, import_react10.useState)({ key: "", description: null, error: null });
1285
1373
  const key = provider && effect ? `${provider.id}:${effect}` : "";
1286
- (0, import_react7.useEffect)(() => {
1374
+ (0, import_react10.useEffect)(() => {
1287
1375
  if (!provider || !effect) return;
1288
1376
  let live = true;
1289
1377
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1298,13 +1386,13 @@ function useEffectDescription(provider, effect) {
1298
1386
  }
1299
1387
 
1300
1388
  // src/effects/EffectThumbnail.tsx
1301
- var import_react8 = require("react");
1389
+ var import_react11 = require("react");
1302
1390
  var import_effects = require("@pixerate/editor/effects");
1303
- var import_jsx_runtime7 = require("react/jsx-runtime");
1391
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1304
1392
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1305
- const ref = (0, import_react8.useRef)(null);
1306
- const [failed, setFailed] = (0, import_react8.useState)(effect.kind === "motion");
1307
- (0, import_react8.useEffect)(() => {
1393
+ const ref = (0, import_react11.useRef)(null);
1394
+ const [failed, setFailed] = (0, import_react11.useState)(effect.kind === "motion");
1395
+ (0, import_react11.useEffect)(() => {
1308
1396
  if (effect.kind === "motion") return;
1309
1397
  let live = true;
1310
1398
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1319,28 +1407,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1319
1407
  live = false;
1320
1408
  };
1321
1409
  }, [provider, effect, width, height]);
1322
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1410
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1323
1411
  "div",
1324
1412
  {
1325
1413
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1326
1414
  style: { aspectRatio: `${width} / ${height}` },
1327
1415
  "data-effect-thumbnail": effect.id,
1328
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime7.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_runtime7.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1416
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1329
1417
  }
1330
1418
  );
1331
1419
  }
1332
1420
 
1333
1421
  // src/effects/EffectsBrowser.tsx
1334
- var import_react9 = require("react");
1422
+ var import_react12 = require("react");
1335
1423
  var import_effects2 = require("@pixerate/editor/effects");
1336
- var import_jsx_runtime8 = require("react/jsx-runtime");
1424
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1337
1425
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1338
- const [all, setAll] = (0, import_react9.useState)([]);
1339
- const [query, setQuery] = (0, import_react9.useState)("");
1340
- const [category, setCategory] = (0, import_react9.useState)("");
1341
- const [use, setUse] = (0, import_react9.useState)("");
1342
- const [error, setError] = (0, import_react9.useState)(null);
1343
- (0, import_react9.useEffect)(() => {
1426
+ const [all, setAll] = (0, import_react12.useState)([]);
1427
+ const [query, setQuery] = (0, import_react12.useState)("");
1428
+ const [category, setCategory] = (0, import_react12.useState)("");
1429
+ const [use, setUse] = (0, import_react12.useState)("");
1430
+ const [error, setError] = (0, import_react12.useState)(null);
1431
+ (0, import_react12.useEffect)(() => {
1344
1432
  if (!provider) return setAll([]);
1345
1433
  let live = true;
1346
1434
  Promise.resolve().then(() => provider.list()).then(
@@ -1351,8 +1439,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1351
1439
  live = false;
1352
1440
  };
1353
1441
  }, [provider]);
1354
- const [found, setFound] = (0, import_react9.useState)([]);
1355
- (0, import_react9.useEffect)(() => {
1442
+ const [found, setFound] = (0, import_react12.useState)([]);
1443
+ (0, import_react12.useEffect)(() => {
1356
1444
  if (!provider) return setFound([]);
1357
1445
  let live = true;
1358
1446
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1361,14 +1449,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1361
1449
  };
1362
1450
  }, [provider, query, category, use]);
1363
1451
  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)));
1364
- const categories = (0, import_react9.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1452
+ const categories = (0, import_react12.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1365
1453
  const shown = found.filter(allowed);
1366
1454
  if (!provider)
1367
- return /* @__PURE__ */ (0, import_jsx_runtime8.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." });
1368
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1369
- title && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1370
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1371
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1455
+ return /* @__PURE__ */ (0, import_jsx_runtime10.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." });
1456
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1457
+ title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1458
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1459
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1372
1460
  "input",
1373
1461
  {
1374
1462
  type: "search",
@@ -1379,17 +1467,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1379
1467
  onChange: (e) => setQuery(e.currentTarget.value)
1380
1468
  }
1381
1469
  ),
1382
- /* @__PURE__ */ (0, import_jsx_runtime8.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: [
1383
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "All categories" }),
1384
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: c, children: c }, c))
1470
+ /* @__PURE__ */ (0, import_jsx_runtime10.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: [
1471
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "All categories" }),
1472
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: c, children: c }, c))
1385
1473
  ] }),
1386
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.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: [
1387
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Any use" }),
1388
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1474
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime10.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: [
1475
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Any use" }),
1476
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1389
1477
  ] })
1390
1478
  ] }),
1391
- error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1392
- /* @__PURE__ */ (0, import_jsx_runtime8.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_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1479
+ error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1480
+ /* @__PURE__ */ (0, import_jsx_runtime10.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_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1393
1481
  "button",
1394
1482
  {
1395
1483
  type: "button",
@@ -1398,25 +1486,25 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1398
1486
  "data-effect-id": e.id,
1399
1487
  onClick: () => onPick(e),
1400
1488
  children: [
1401
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(EffectThumbnail, { provider, effect: e }),
1402
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1403
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1489
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(EffectThumbnail, { provider, effect: e }),
1490
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1491
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1404
1492
  ]
1405
1493
  }
1406
1494
  ) }, e.id)) }),
1407
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1495
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1408
1496
  ] });
1409
1497
  }
1410
1498
 
1411
1499
  // src/effects/EffectParameters.tsx
1412
- var import_react11 = __toESM(require("react"), 1);
1500
+ var import_react14 = __toESM(require("react"), 1);
1413
1501
  var import_effects3 = require("@pixerate/editor/effects");
1414
1502
  var import_parameters2 = require("@pixerate/editor/parameters");
1415
1503
 
1416
1504
  // src/parameters/fields.tsx
1417
- var import_react10 = require("react");
1505
+ var import_react13 = require("react");
1418
1506
  var import_parameters = require("@pixerate/editor/parameters");
1419
- var import_jsx_runtime9 = require("react/jsx-runtime");
1507
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1420
1508
  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";
1421
1509
  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";
1422
1510
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -1440,7 +1528,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
1440
1528
  onKeyDown: keyDown,
1441
1529
  ...rest
1442
1530
  };
1443
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "text", ...props }, value);
1531
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "text", ...props }, value);
1444
1532
  }
1445
1533
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
1446
1534
  function ParameterNumberInput({
@@ -1451,8 +1539,8 @@ function ParameterNumberInput({
1451
1539
  id,
1452
1540
  "aria-label": ariaLabel
1453
1541
  }) {
1454
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1455
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1542
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
1543
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1456
1544
  ParameterCommitInput,
1457
1545
  {
1458
1546
  id,
@@ -1474,21 +1562,21 @@ function ParameterNumberInput({
1474
1562
  }
1475
1563
  }
1476
1564
  ),
1477
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
1565
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
1478
1566
  ] });
1479
1567
  }
1480
1568
  function ParameterSlider(props) {
1481
1569
  const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
1482
- const dragging = (0, import_react10.useRef)(false);
1570
+ const dragging = (0, import_react13.useRef)(false);
1483
1571
  const end = () => {
1484
1572
  if (!dragging.current) return;
1485
1573
  dragging.current = false;
1486
1574
  onGestureEnd?.();
1487
1575
  };
1488
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterNumberInput, { ...props });
1576
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props });
1489
1577
  const step = (0, import_parameters.parameterStep)(field);
1490
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
1491
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1578
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1579
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1492
1580
  "input",
1493
1581
  {
1494
1582
  type: "range",
@@ -1511,11 +1599,11 @@ function ParameterSlider(props) {
1511
1599
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
1512
1600
  }
1513
1601
  ),
1514
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
1602
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
1515
1603
  ] });
1516
1604
  }
1517
1605
  function ParameterToggle({ field, value, onChange, disabled, id }) {
1518
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1606
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1519
1607
  "button",
1520
1608
  {
1521
1609
  type: "button",
@@ -1526,7 +1614,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
1526
1614
  disabled: disabled || field.readOnly,
1527
1615
  onClick: () => onChange(!value),
1528
1616
  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"}`,
1529
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1617
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1530
1618
  "span",
1531
1619
  {
1532
1620
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -1539,7 +1627,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1539
1627
  const options = (0, import_parameters.getChoiceOptions)(field);
1540
1628
  const off = disabled || field.readOnly;
1541
1629
  if (field.control === "segmented") {
1542
- return /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)(
1630
+ return /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)(
1543
1631
  "button",
1544
1632
  {
1545
1633
  type: "button",
@@ -1555,7 +1643,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1555
1643
  )) });
1556
1644
  }
1557
1645
  const index = options.findIndex((o) => o.value === value);
1558
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1646
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1559
1647
  "select",
1560
1648
  {
1561
1649
  id,
@@ -1567,12 +1655,12 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
1567
1655
  if (option) onChange(option.value);
1568
1656
  },
1569
1657
  className: parameterInputClass,
1570
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1658
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
1571
1659
  }
1572
1660
  );
1573
1661
  }
1574
1662
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
1575
- const picking = (0, import_react10.useRef)(false);
1663
+ const picking = (0, import_react13.useRef)(false);
1576
1664
  const alpha = !!field.alpha;
1577
1665
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
1578
1666
  const rgb = hex.slice(0, 7);
@@ -1588,11 +1676,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1588
1676
  picking.current = false;
1589
1677
  onGestureEnd?.();
1590
1678
  };
1591
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
1592
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
1593
- /* @__PURE__ */ (0, import_jsx_runtime9.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: [
1594
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1595
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1679
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1.5", children: [
1680
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1681
+ /* @__PURE__ */ (0, import_jsx_runtime11.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: [
1682
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
1683
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1596
1684
  "input",
1597
1685
  {
1598
1686
  type: "color",
@@ -1608,7 +1696,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1608
1696
  }
1609
1697
  )
1610
1698
  ] }),
1611
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1699
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1612
1700
  ParameterCommitInput,
1613
1701
  {
1614
1702
  id,
@@ -1624,7 +1712,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1624
1712
  }
1625
1713
  )
1626
1714
  ] }),
1627
- alpha && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1715
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1628
1716
  "input",
1629
1717
  {
1630
1718
  type: "range",
@@ -1642,10 +1730,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1642
1730
  onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
1643
1731
  }
1644
1732
  ),
1645
- field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
1733
+ field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
1646
1734
  const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
1647
1735
  if (!swatch) return null;
1648
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1736
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1649
1737
  "button",
1650
1738
  {
1651
1739
  type: "button",
@@ -1664,11 +1752,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1664
1752
  }
1665
1753
  function ParameterVector({ field, value, onChange, disabled, id }) {
1666
1754
  const size = (0, import_parameters.vectorSize)(field);
1667
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1755
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
1668
1756
  const component = (0, import_parameters.vectorComponentField)(field, i);
1669
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1670
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1671
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1757
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
1758
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
1759
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1672
1760
  ParameterNumberInput,
1673
1761
  {
1674
1762
  field: component,
@@ -1685,11 +1773,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
1685
1773
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1686
1774
  const off = disabled || field.readOnly;
1687
1775
  const name = (0, import_parameters.parameterLabel)(field);
1688
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
1689
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
1690
- /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1691
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1692
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1776
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1.5", children: [
1777
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
1778
+ /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
1779
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
1780
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1693
1781
  ParameterCommitInput,
1694
1782
  {
1695
1783
  id,
@@ -1700,10 +1788,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1700
1788
  onCommit: (text) => onChange(text.trim())
1701
1789
  }
1702
1790
  ),
1703
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-1", children: [
1704
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1791
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-1", children: [
1792
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
1705
1793
  "Choose file\u2026",
1706
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1794
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1707
1795
  "input",
1708
1796
  {
1709
1797
  type: "file",
@@ -1719,11 +1807,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1719
1807
  }
1720
1808
  )
1721
1809
  ] }),
1722
- value && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1810
+ value && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
1723
1811
  ] })
1724
1812
  ] })
1725
1813
  ] }),
1726
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1814
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1727
1815
  "button",
1728
1816
  {
1729
1817
  type: "button",
@@ -1733,14 +1821,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
1733
1821
  disabled: off,
1734
1822
  onClick: () => onChange(o.url),
1735
1823
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
1736
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1824
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
1737
1825
  },
1738
1826
  o.url
1739
1827
  )) })
1740
1828
  ] });
1741
1829
  }
1742
1830
  function ParameterText({ field, value, onChange, disabled, id }) {
1743
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1831
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1744
1832
  ParameterCommitInput,
1745
1833
  {
1746
1834
  id,
@@ -1759,31 +1847,31 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
1759
1847
  switch (field.type) {
1760
1848
  case "number":
1761
1849
  case "int":
1762
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
1850
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
1763
1851
  case "boolean":
1764
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
1852
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
1765
1853
  case "choice":
1766
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
1854
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
1767
1855
  case "color":
1768
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
1856
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
1769
1857
  case "vector":
1770
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
1858
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
1771
1859
  case "image":
1772
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
1860
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
1773
1861
  case "text":
1774
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterText, { field, value, onChange: set, ...rest });
1862
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterText, { field, value, onChange: set, ...rest });
1775
1863
  }
1776
1864
  }
1777
1865
 
1778
1866
  // src/effects/EffectParameters.tsx
1779
- var import_jsx_runtime10 = require("react/jsx-runtime");
1867
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1780
1868
  function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
1781
- const fields = (0, import_react11.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1782
- const idBase = (0, import_react11.useId)();
1783
- const gesture = import_react11.default.useRef(null);
1784
- const count = import_react11.default.useRef(0);
1785
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1786
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1869
+ const fields = (0, import_react14.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1870
+ const idBase = (0, import_react14.useId)();
1871
+ const gesture = import_react14.default.useRef(null);
1872
+ const count = import_react14.default.useRef(0);
1873
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
1874
+ onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1787
1875
  "select",
1788
1876
  {
1789
1877
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -1795,8 +1883,8 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1795
1883
  if (preset) onPreset({ ...description.defaults, ...preset.values });
1796
1884
  },
1797
1885
  children: [
1798
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Presets\u2026" }),
1799
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: p.name, children: p.name }, p.name))
1886
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Presets\u2026" }),
1887
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: p.name, children: p.name }, p.name))
1800
1888
  ]
1801
1889
  }
1802
1890
  ),
@@ -1806,13 +1894,13 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1806
1894
  const keyed = keyframed?.has(field.id) ?? false;
1807
1895
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
1808
1896
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
1809
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
1810
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1811
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
1812
- keyed && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1813
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime10.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" })
1897
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
1898
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1899
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
1900
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
1901
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime12.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" })
1814
1902
  ] }),
1815
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1903
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1816
1904
  ParameterFieldControl,
1817
1905
  {
1818
1906
  field,
@@ -1826,12 +1914,12 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
1826
1914
  )
1827
1915
  ] }, field.id);
1828
1916
  }),
1829
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1917
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
1830
1918
  ] });
1831
1919
  }
1832
1920
 
1833
1921
  // src/image-editor/ImageProviderEffectsPanel.tsx
1834
- var import_jsx_runtime11 = require("react/jsx-runtime");
1922
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1835
1923
  var btn = "rounded border border-slate-700 px-1.5 py-0.5 text-[11px] text-slate-300 hover:text-white disabled:opacity-40";
1836
1924
  function Controls({
1837
1925
  provider,
@@ -1842,21 +1930,21 @@ function Controls({
1842
1930
  onPreset
1843
1931
  }) {
1844
1932
  const { description, error } = useEffectDescription(provider, effect);
1845
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
1933
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
1846
1934
  'No effects provider: "',
1847
1935
  name ?? effect,
1848
1936
  '" is kept but not drawn.'
1849
1937
  ] });
1850
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
1851
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
1852
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
1938
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
1939
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
1940
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
1853
1941
  }
1854
1942
  function ImageProviderEffectsPanel({ controller, className = "" }) {
1855
- const [, setTick] = (0, import_react12.useState)(0);
1856
- (0, import_react12.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1857
- const [browse, setBrowse] = (0, import_react12.useState)(null);
1858
- const [message, setMessage] = (0, import_react12.useState)(null);
1859
- const [open, setOpen] = (0, import_react12.useState)(null);
1943
+ const [, setTick] = (0, import_react15.useState)(0);
1944
+ (0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1945
+ const [browse, setBrowse] = (0, import_react15.useState)(null);
1946
+ const [message, setMessage] = (0, import_react15.useState)(null);
1947
+ const [open, setOpen] = (0, import_react15.useState)(null);
1860
1948
  const provider = controller.effectsProvider;
1861
1949
  const state = controller.getState();
1862
1950
  const layer = state.activeLayerId ? (0, import_image_editor8.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -1864,7 +1952,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1864
1952
  setMessage(null);
1865
1953
  Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
1866
1954
  };
1867
- const drags = import_react12.default.useRef(/* @__PURE__ */ new Set());
1955
+ const drags = import_react15.default.useRef(/* @__PURE__ */ new Set());
1868
1956
  const commit = (gesture) => {
1869
1957
  if (gesture) {
1870
1958
  if (!drags.current.has(gesture)) {
@@ -1878,21 +1966,21 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1878
1966
  const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
1879
1967
  const generator = layer?.type === "pixel" ? layer.generator : void 0;
1880
1968
  const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
1881
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
1882
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
1883
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-slate-200", children: "Effects" }),
1884
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
1885
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
1969
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
1970
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
1971
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-slate-200", children: "Effects" }),
1972
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
1973
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
1886
1974
  ] }),
1887
- !provider && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the document are kept." }),
1888
- browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
1889
- browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
1890
- generator && layer && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
1891
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
1892
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex-1 font-medium text-slate-200", children: generator.name ?? generator.effect }),
1893
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
1975
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the document are kept." }),
1976
+ browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
1977
+ browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
1978
+ generator && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
1979
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
1980
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 font-medium text-slate-200", children: generator.name ?? generator.effect }),
1981
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
1894
1982
  ] }),
1895
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1983
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1896
1984
  Controls,
1897
1985
  {
1898
1986
  provider,
@@ -1904,26 +1992,26 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1904
1992
  }
1905
1993
  )
1906
1994
  ] }),
1907
- filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
1995
+ filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
1908
1996
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
1909
1997
  const all = layer.smartFilters.filters;
1910
1998
  const index = all.indexOf(f);
1911
1999
  if (f.kind !== "effect") return null;
1912
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { className: "rounded border border-slate-700 p-1", "data-smart-effect": f.id, children: [
1913
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
1914
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
2000
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("li", { className: "rounded border border-slate-700 p-1", "data-smart-effect": f.id, children: [
2001
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
2002
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
1915
2003
  const enabled = e.currentTarget.checked;
1916
2004
  run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
1917
2005
  } }),
1918
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-slate-200", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
1919
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
1920
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
1921
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
2006
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-slate-200", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
2007
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
2008
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
2009
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
1922
2010
  ] }),
1923
- open === f.id && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mt-1 space-y-2", children: [
1924
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-1", children: [
1925
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-14 text-[11px] text-slate-300", children: "Opacity" }),
1926
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2011
+ open === f.id && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mt-1 space-y-2", children: [
2012
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-1", children: [
2013
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-14 text-[11px] text-slate-300", children: "Opacity" }),
2014
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1927
2015
  "input",
1928
2016
  {
1929
2017
  type: "range",
@@ -1940,7 +2028,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1940
2028
  }
1941
2029
  )
1942
2030
  ] }),
1943
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2031
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1944
2032
  Controls,
1945
2033
  {
1946
2034
  provider,
@@ -1954,13 +2042,13 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
1954
2042
  ] })
1955
2043
  ] }, f.id);
1956
2044
  }) }),
1957
- !layer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-slate-400", children: "Select a layer to apply effects to it." }),
1958
- message && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: message })
2045
+ !layer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-slate-400", children: "Select a layer to apply effects to it." }),
2046
+ message && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: message })
1959
2047
  ] });
1960
2048
  }
1961
2049
 
1962
2050
  // src/image-editor/BrushOptionsBar.tsx
1963
- var import_react14 = require("react");
2051
+ var import_react17 = require("react");
1964
2052
  var import_image_editor10 = require("@pixerate/editor/image-editor");
1965
2053
  var import_image_editor11 = require("@pixerate/editor/image-editor");
1966
2054
 
@@ -1968,8 +2056,8 @@ var import_image_editor11 = require("@pixerate/editor/image-editor");
1968
2056
  var import_image_editor9 = require("@pixerate/editor/image-editor");
1969
2057
 
1970
2058
  // src/paint-editor/PaintGradientEditorView.tsx
1971
- var import_react13 = require("react");
1972
- var import_jsx_runtime12 = require("react/jsx-runtime");
2059
+ var import_react16 = require("react");
2060
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1973
2061
  var button2 = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
1974
2062
  var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
1975
2063
  var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
@@ -1990,7 +2078,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
1990
2078
  reversePaintGradient,
1991
2079
  updatePaintGradientStop
1992
2080
  } = kit;
1993
- const [selected, setSelected] = (0, import_react13.useState)(0);
2081
+ const [selected, setSelected] = (0, import_react16.useState)(0);
1994
2082
  const sel = Math.min(selected, value.stops.length - 1);
1995
2083
  const stop = value.stops[sel];
1996
2084
  const map = value.map;
@@ -2000,15 +2088,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
2000
2088
  setSelected(r.index);
2001
2089
  onChange(r.paint);
2002
2090
  };
2003
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
2004
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
2005
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
2006
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Presets\u2026" }),
2007
- PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: i, children: p.name }, p.name))
2091
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
2092
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
2093
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
2094
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Presets\u2026" }),
2095
+ PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: i, children: p.name }, p.name))
2008
2096
  ] }),
2009
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button2, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
2097
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button2, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
2010
2098
  ] }),
2011
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2099
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2012
2100
  "div",
2013
2101
  {
2014
2102
  role: "slider",
@@ -2030,7 +2118,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
2030
2118
  }
2031
2119
  }
2032
2120
  ),
2033
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2121
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2034
2122
  "button",
2035
2123
  {
2036
2124
  type: "button",
@@ -2042,64 +2130,64 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
2042
2130
  },
2043
2131
  i
2044
2132
  )) }),
2045
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
2046
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
2047
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "color", children: "Colour" }),
2048
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "paint", children: "Paint colour" }),
2049
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "secondary", children: "Second colour" })
2133
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
2134
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
2135
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "color", children: "Colour" }),
2136
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "paint", children: "Paint colour" }),
2137
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "secondary", children: "Second colour" })
2050
2138
  ] }),
2051
- stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
2052
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1", children: [
2139
+ stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
2140
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
2053
2141
  "At",
2054
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
2142
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
2055
2143
  "%"
2056
2144
  ] }),
2057
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1", children: [
2145
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
2058
2146
  "Opacity",
2059
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
2147
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
2060
2148
  "%"
2061
2149
  ] }),
2062
- sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1", children: [
2150
+ sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
2063
2151
  "Midpoint",
2064
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
2152
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
2065
2153
  "%"
2066
2154
  ] }),
2067
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button2, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
2155
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button2, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
2068
2156
  ] }),
2069
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
2070
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
2071
- map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2072
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
2073
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
2074
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "px", children: "px" }),
2075
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "dabs", children: "dabs" })
2157
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
2158
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
2159
+ map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2160
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
2161
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
2162
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "px", children: "px" }),
2163
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "dabs", children: "dabs" })
2076
2164
  ] })
2077
2165
  ] }),
2078
- map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
2079
- map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
2080
- (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
2166
+ map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
2167
+ map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
2168
+ (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
2081
2169
  ] }),
2082
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
2083
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
2084
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
2170
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
2171
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
2172
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
2085
2173
  "Softness",
2086
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
2174
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
2087
2175
  ] })
2088
2176
  ] })
2089
2177
  ] });
2090
2178
  };
2091
2179
 
2092
2180
  // src/image-editor/PaintGradientEditor.tsx
2093
- var import_jsx_runtime13 = require("react/jsx-runtime");
2094
- var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
2181
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2182
+ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor9.PAINT_GRADIENT_KIT });
2095
2183
 
2096
2184
  // src/image-editor/BrushOptionsBar.tsx
2097
- var import_jsx_runtime14 = require("react/jsx-runtime");
2185
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2098
2186
  var chip = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
2099
2187
  var BrushOptionsBar = ({ controller, className }) => {
2100
- const [, setTick] = (0, import_react14.useState)(0);
2101
- (0, import_react14.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2102
- const [error, setError] = (0, import_react14.useState)(null);
2188
+ const [, setTick] = (0, import_react17.useState)(0);
2189
+ (0, import_react17.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2190
+ const [error, setError] = (0, import_react17.useState)(null);
2103
2191
  const state = controller.getState();
2104
2192
  const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
2105
2193
  const tool = state.activeTool;
@@ -2111,8 +2199,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2111
2199
  setError(err instanceof Error ? err.message : String(err));
2112
2200
  }
2113
2201
  };
2114
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "brush-options", children: [
2115
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor10.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2202
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "brush-options", children: [
2203
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor10.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2116
2204
  "button",
2117
2205
  {
2118
2206
  type: "button",
@@ -2124,9 +2212,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2124
2212
  },
2125
2213
  t.id
2126
2214
  )) }),
2127
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2128
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
2129
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2215
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2216
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
2217
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2130
2218
  "input",
2131
2219
  {
2132
2220
  type: "color",
@@ -2136,10 +2224,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2136
2224
  className: "h-6 w-8 rounded border border-slate-700 bg-transparent"
2137
2225
  }
2138
2226
  ),
2139
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "FG" })
2227
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "FG" })
2140
2228
  ] }),
2141
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
2142
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2229
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
2230
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2143
2231
  "input",
2144
2232
  {
2145
2233
  type: "color",
@@ -2149,11 +2237,11 @@ var BrushOptionsBar = ({ controller, className }) => {
2149
2237
  className: "h-6 w-8 rounded border border-slate-700 bg-transparent"
2150
2238
  }
2151
2239
  ),
2152
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "BG" })
2240
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "BG" })
2153
2241
  ] }),
2154
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", title: "Swap colours (X)", className: chip(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
2155
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", title: "Default colours (D)", className: chip(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
2156
- state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2242
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Swap colours (X)", className: chip(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
2243
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Default colours (D)", className: chip(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
2244
+ state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2157
2245
  "button",
2158
2246
  {
2159
2247
  type: "button",
@@ -2165,8 +2253,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2165
2253
  }
2166
2254
  )
2167
2255
  ] }),
2168
- state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
2169
- import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2256
+ state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
2257
+ import_image_editor10.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2170
2258
  ControlSlider,
2171
2259
  {
2172
2260
  spec,
@@ -2175,9 +2263,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2175
2263
  },
2176
2264
  spec.id
2177
2265
  )),
2178
- state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
2179
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
2180
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2266
+ state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
2267
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2268
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2181
2269
  "span",
2182
2270
  {
2183
2271
  "aria-label": "Brush load",
@@ -2186,10 +2274,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2186
2274
  style: { background: mixerLoad.reservoir ? (0, import_image_editor10.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
2187
2275
  }
2188
2276
  ),
2189
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: chip(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
2190
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: chip(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
2277
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: chip(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
2278
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: chip(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
2191
2279
  ] }),
2192
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2280
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor10.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2193
2281
  "button",
2194
2282
  {
2195
2283
  type: "button",
@@ -2201,10 +2289,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2201
2289
  },
2202
2290
  m.id
2203
2291
  )) }),
2204
- import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
2205
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: [
2206
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2207
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2292
+ import_image_editor10.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
2293
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: [
2294
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2295
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2208
2296
  "input",
2209
2297
  {
2210
2298
  type: "checkbox",
@@ -2216,8 +2304,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2216
2304
  ),
2217
2305
  "Load each stroke"
2218
2306
  ] }),
2219
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2220
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2307
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2308
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2221
2309
  "input",
2222
2310
  {
2223
2311
  type: "checkbox",
@@ -2231,22 +2319,22 @@ var BrushOptionsBar = ({ controller, className }) => {
2231
2319
  ] })
2232
2320
  ] })
2233
2321
  ] }),
2234
- (0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
2235
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
2236
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
2237
- cloneSource && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", title: "Forget the source point", className: chip(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
2322
+ (0, import_image_editor10.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2 border-t border-slate-800 pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
2323
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
2324
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", "data-testid": "clone-source", children: (0, import_image_editor10.cloneSourceLabel)(controller) }),
2325
+ cloneSource && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Forget the source point", className: chip(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
2238
2326
  ] }),
2239
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
2240
- import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ControlSlider, { spec, value: (0, import_image_editor10.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor10.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
2241
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
2242
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
2243
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
2244
- !(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: chip(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
2327
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
2328
+ import_image_editor10.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: (0, import_image_editor10.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor10.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
2329
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
2330
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
2331
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor10.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: chip((0, import_image_editor10.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor10.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
2332
+ !(0, import_image_editor10.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: chip(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
2245
2333
  ] })
2246
2334
  ] }),
2247
- import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
2248
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: choice.label }),
2249
- choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2335
+ import_image_editor10.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
2336
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: choice.label }),
2337
+ choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2250
2338
  "button",
2251
2339
  {
2252
2340
  type: "button",
@@ -2259,9 +2347,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2259
2347
  o.id
2260
2348
  ))
2261
2349
  ] }, choice.id)),
2262
- import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
2263
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: import_image_editor10.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2264
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2350
+ import_image_editor10.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
2351
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-3 text-slate-300", children: import_image_editor10.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2352
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2265
2353
  "input",
2266
2354
  {
2267
2355
  type: "checkbox",
@@ -2274,9 +2362,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2274
2362
  t.label
2275
2363
  ] }, t.id)) })
2276
2364
  ] }),
2277
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", role: "group", "aria-label": "Pressure", children: [
2278
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2279
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2365
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-3 text-slate-300", role: "group", "aria-label": "Pressure", children: [
2366
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2367
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2280
2368
  "input",
2281
2369
  {
2282
2370
  type: "checkbox",
@@ -2288,8 +2376,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2288
2376
  ),
2289
2377
  "Pressure size"
2290
2378
  ] }),
2291
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2292
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2379
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5", children: [
2380
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2293
2381
  "input",
2294
2382
  {
2295
2383
  type: "checkbox",
@@ -2302,27 +2390,27 @@ var BrushOptionsBar = ({ controller, className }) => {
2302
2390
  "Pressure opacity"
2303
2391
  ] })
2304
2392
  ] }),
2305
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex gap-1", children: [
2306
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
2307
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
2393
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
2394
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
2395
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
2308
2396
  ] }),
2309
- error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2397
+ error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2310
2398
  ] });
2311
2399
  };
2312
2400
 
2313
2401
  // src/image-editor/ColorProfilePanel.tsx
2314
- var import_react15 = require("react");
2402
+ var import_react18 = require("react");
2315
2403
  var import_image_editor12 = require("@pixerate/editor/image-editor");
2316
- var import_jsx_runtime15 = require("react/jsx-runtime");
2404
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2317
2405
  var chip2 = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-300 hover:text-white";
2318
2406
  var select2 = "rounded bg-slate-800 px-1 py-0.5 text-[11px] text-slate-200";
2319
2407
  var ColorProfilePanel = ({ controller, className }) => {
2320
- const [, setTick] = (0, import_react15.useState)(0);
2321
- (0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2322
- const [target, setTarget] = (0, import_react15.useState)("display-p3");
2323
- const [intent, setIntent] = (0, import_react15.useState)("relative");
2324
- const [bpc, setBpc] = (0, import_react15.useState)(true);
2325
- const [error, setError] = (0, import_react15.useState)(null);
2408
+ const [, setTick] = (0, import_react18.useState)(0);
2409
+ (0, import_react18.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2410
+ const [target, setTarget] = (0, import_react18.useState)("display-p3");
2411
+ const [intent, setIntent] = (0, import_react18.useState)("relative");
2412
+ const [bpc, setBpc] = (0, import_react18.useState)(true);
2413
+ const [error, setError] = (0, import_react18.useState)(null);
2326
2414
  const view = (0, import_image_editor12.colorPanelView)(controller);
2327
2415
  const attempt = (fn) => {
2328
2416
  try {
@@ -2344,29 +2432,29 @@ var ColorProfilePanel = ({ controller, className }) => {
2344
2432
  })
2345
2433
  );
2346
2434
  };
2347
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
2348
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
2349
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Profile" }),
2350
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
2435
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
2436
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
2437
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Profile" }),
2438
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
2351
2439
  ] }),
2352
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
2353
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Mode" }),
2354
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor12.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2355
- view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: view.cmykProfileName })
2440
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
2441
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Mode" }),
2442
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor12.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2443
+ view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: view.cmykProfileName })
2356
2444
  ] }),
2357
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
2358
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor12.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
2359
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2360
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
2361
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-indigo-500" }),
2445
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
2446
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor12.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
2447
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2448
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
2449
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-indigo-500" }),
2362
2450
  "BPC"
2363
2451
  ] }),
2364
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
2365
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
2452
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
2453
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip2, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
2366
2454
  ] }),
2367
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
2368
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Proof" }),
2369
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2455
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
2456
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Proof" }),
2457
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2370
2458
  "select",
2371
2459
  {
2372
2460
  "aria-label": "Proof profile",
@@ -2374,31 +2462,31 @@ var ColorProfilePanel = ({ controller, className }) => {
2374
2462
  value: view.proof?.id ?? "",
2375
2463
  onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
2376
2464
  children: [
2377
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Off" }),
2378
- import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.id, children: o.label }, o.id))
2465
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "Off" }),
2466
+ import_image_editor12.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id))
2379
2467
  ]
2380
2468
  }
2381
2469
  ),
2382
- view.proof && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2383
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
2384
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
2385
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-indigo-500" }),
2470
+ view.proof && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2471
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor12.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
2472
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
2473
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-indigo-500" }),
2386
2474
  "Paper"
2387
2475
  ] }),
2388
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
2389
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-indigo-500" }),
2476
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
2477
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-indigo-500" }),
2390
2478
  "Gamut warning"
2391
2479
  ] })
2392
2480
  ] })
2393
2481
  ] }),
2394
- error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2482
+ error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2395
2483
  ] });
2396
2484
  };
2397
2485
 
2398
2486
  // src/image-editor/SelectionOptionsBar.tsx
2399
- var import_react16 = require("react");
2487
+ var import_react19 = require("react");
2400
2488
  var import_image_editor13 = require("@pixerate/editor/image-editor");
2401
- var import_jsx_runtime16 = require("react/jsx-runtime");
2489
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2402
2490
  var MODIFY_OPS = [
2403
2491
  { op: "grow", label: "Grow" },
2404
2492
  { op: "shrink", label: "Shrink" },
@@ -2415,20 +2503,20 @@ var SelectionOptionsBar = ({
2415
2503
  quickMask,
2416
2504
  className = ""
2417
2505
  }) => {
2418
- const [radius, setRadius] = (0, import_react16.useState)(2);
2506
+ const [radius, setRadius] = (0, import_react19.useState)(2);
2419
2507
  const set = (patch) => onOptionsChange({ ...options, ...patch });
2420
2508
  const sel = selection === void 0 ? controller.getSelection() : selection;
2421
2509
  const qm = quickMask ?? Boolean(controller.getState().quickMask);
2422
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
2423
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn2(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
2424
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn2(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor13.SELECTION_MODE_LABELS[m] }, m)) }),
2425
- options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2", children: [
2426
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-1", children: [
2427
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2428
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Tolerance" }),
2429
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-mono", children: options.tolerance })
2510
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
2511
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn2(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
2512
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor13.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn2(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor13.SELECTION_MODE_LABELS[m] }, m)) }),
2513
+ options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
2514
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-col gap-1", children: [
2515
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2516
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Tolerance" }),
2517
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-mono", children: options.tolerance })
2430
2518
  ] }),
2431
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2519
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2432
2520
  "input",
2433
2521
  {
2434
2522
  type: "range",
@@ -2442,17 +2530,17 @@ var SelectionOptionsBar = ({
2442
2530
  }
2443
2531
  )
2444
2532
  ] }),
2445
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2446
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
2533
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2534
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
2447
2535
  "Contiguous"
2448
2536
  ] }),
2449
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2450
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
2537
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2538
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
2451
2539
  "Sample adjusted image"
2452
2540
  ] }),
2453
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2541
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2454
2542
  "Sample",
2455
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2543
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2456
2544
  "select",
2457
2545
  {
2458
2546
  "aria-label": "Sample from",
@@ -2460,27 +2548,27 @@ var SelectionOptionsBar = ({
2460
2548
  onChange: (e) => set({ sample: e.target.value }),
2461
2549
  className: "bg-slate-800 border border-slate-700 rounded px-1 py-0.5",
2462
2550
  children: [
2463
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "composite", children: "All layers" }),
2464
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "active-layer", children: "Active layer" })
2551
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "composite", children: "All layers" }),
2552
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "active-layer", children: "Active layer" })
2465
2553
  ]
2466
2554
  }
2467
2555
  )
2468
2556
  ] })
2469
2557
  ] }),
2470
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2471
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
2558
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2559
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
2472
2560
  "Anti-alias"
2473
2561
  ] }),
2474
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2475
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.selectAll(), children: "Select All" }),
2476
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
2477
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
2478
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": qm, className: btn2(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
2562
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2563
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.selectAll(), children: "Select All" }),
2564
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
2565
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
2566
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": qm, className: btn2(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
2479
2567
  ] }),
2480
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
2481
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
2568
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
2569
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1 text-slate-400", children: [
2482
2570
  "Radius",
2483
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2571
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2484
2572
  "input",
2485
2573
  {
2486
2574
  type: "number",
@@ -2494,24 +2582,24 @@ var SelectionOptionsBar = ({
2494
2582
  }
2495
2583
  )
2496
2584
  ] }),
2497
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
2585
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: btn2(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
2498
2586
  ] }),
2499
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { "data-testid": "selection-status", className: "text-slate-400", children: (0, import_image_editor13.describeSelection)(sel) })
2587
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { "data-testid": "selection-status", className: "text-slate-400", children: (0, import_image_editor13.describeSelection)(sel) })
2500
2588
  ] });
2501
2589
  };
2502
2590
 
2503
2591
  // src/image-editor/RefineEdgePanel.tsx
2504
- var import_react17 = require("react");
2592
+ var import_react20 = require("react");
2505
2593
  var import_image_editor14 = require("@pixerate/editor/image-editor");
2506
- var import_jsx_runtime17 = require("react/jsx-runtime");
2594
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2507
2595
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
2508
2596
  var button3 = "px-2 py-1 rounded-md border border-slate-800 bg-slate-950 text-[11px] text-slate-200 hover:text-white disabled:opacity-40";
2509
2597
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2510
- const [params, setParams] = (0, import_react17.useState)(DEFAULT_PARAMS);
2511
- const [busy, setBusy] = (0, import_react17.useState)(false);
2512
- const [error, setError] = (0, import_react17.useState)(null);
2513
- const [layerId, setLayerId] = (0, import_react17.useState)("");
2514
- const [newKind, setNewKind] = (0, import_react17.useState)("hueSaturation");
2598
+ const [params, setParams] = (0, import_react20.useState)(DEFAULT_PARAMS);
2599
+ const [busy, setBusy] = (0, import_react20.useState)(false);
2600
+ const [error, setError] = (0, import_react20.useState)(null);
2601
+ const [layerId, setLayerId] = (0, import_react20.useState)("");
2602
+ const [newKind, setNewKind] = (0, import_react20.useState)("hueSaturation");
2515
2603
  const sel = selection === void 0 ? controller.getSelection() : selection;
2516
2604
  const list = layers ?? controller.getAdjustmentLayers();
2517
2605
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -2526,17 +2614,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2526
2614
  setBusy(false);
2527
2615
  }
2528
2616
  };
2529
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
2530
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Refine Edge" }),
2531
- import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-1", children: [
2532
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2533
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: c.label }),
2534
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "font-mono", children: [
2617
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
2618
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Refine Edge" }),
2619
+ import_image_editor14.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
2620
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2621
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: c.label }),
2622
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
2535
2623
  params[c.id],
2536
2624
  c.unit
2537
2625
  ] })
2538
2626
  ] }),
2539
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2627
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2540
2628
  "input",
2541
2629
  {
2542
2630
  type: "range",
@@ -2550,28 +2638,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2550
2638
  }
2551
2639
  )
2552
2640
  ] }, c.id)),
2553
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2554
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
2641
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2 text-slate-300", children: [
2642
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
2555
2643
  "Smart Radius"
2556
2644
  ] }),
2557
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-1", children: [
2558
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
2559
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
2645
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
2646
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
2647
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
2560
2648
  ] }),
2561
- error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
2562
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
2563
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-1 items-center", children: [
2564
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2649
+ error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-rose-400", children: error }),
2650
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
2651
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1 items-center", children: [
2652
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2565
2653
  "select",
2566
2654
  {
2567
2655
  "aria-label": "New masked layer kind",
2568
2656
  value: newKind,
2569
2657
  onChange: (e) => setNewKind(e.target.value),
2570
2658
  className: "flex-1 bg-slate-950 border border-slate-800 rounded px-1 py-1 text-slate-200",
2571
- children: import_image_editor14.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: k.kind, children: k.label }, k.kind))
2659
+ children: import_image_editor14.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k.kind, children: k.label }, k.kind))
2572
2660
  }
2573
2661
  ),
2574
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2662
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2575
2663
  "button",
2576
2664
  {
2577
2665
  type: "button",
@@ -2582,35 +2670,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2582
2670
  }
2583
2671
  )
2584
2672
  ] }),
2585
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-2", children: [
2586
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2673
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-2", children: [
2674
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2587
2675
  "select",
2588
2676
  {
2589
2677
  "aria-label": "Mask layer",
2590
2678
  value: target.id,
2591
2679
  onChange: (e) => setLayerId(e.target.value),
2592
2680
  className: "bg-slate-950 border border-slate-800 rounded px-1 py-1 text-slate-200",
2593
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("option", { value: l.id, children: [
2681
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: l.id, children: [
2594
2682
  l.name || (0, import_image_editor14.adjustmentKindLabel)(l.kind),
2595
2683
  l.mask ? " (masked)" : ""
2596
2684
  ] }, l.id))
2597
2685
  }
2598
2686
  ),
2599
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2600
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
2601
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
2602
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
2687
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2688
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
2689
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
2690
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button3, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
2603
2691
  ] }),
2604
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2605
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-1", children: [
2606
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2607
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Density" }),
2608
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "font-mono", children: [
2692
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2693
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
2694
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2695
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Density" }),
2696
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
2609
2697
  Math.round((target.mask.density ?? 1) * 100),
2610
2698
  "%"
2611
2699
  ] })
2612
2700
  ] }),
2613
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2701
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2614
2702
  "input",
2615
2703
  {
2616
2704
  type: "range",
@@ -2624,15 +2712,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2624
2712
  }
2625
2713
  )
2626
2714
  ] }),
2627
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-1", children: [
2628
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2629
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Mask Feather" }),
2630
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "font-mono", children: [
2715
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-col gap-1", children: [
2716
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex justify-between text-slate-400", children: [
2717
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Mask Feather" }),
2718
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono", children: [
2631
2719
  target.mask.feather ?? 0,
2632
2720
  "px"
2633
2721
  ] })
2634
2722
  ] }),
2635
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2723
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2636
2724
  "input",
2637
2725
  {
2638
2726
  type: "range",
@@ -2652,14 +2740,14 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
2652
2740
  };
2653
2741
 
2654
2742
  // src/image-editor/FreeTransformOptionsBar.tsx
2655
- var import_react18 = require("react");
2743
+ var import_react21 = require("react");
2656
2744
  var import_image_editor15 = require("@pixerate/editor/image-editor");
2657
- var import_jsx_runtime18 = require("react/jsx-runtime");
2745
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2658
2746
  var chip3 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
2659
2747
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
2660
2748
  var FreeTransformOptionsBar = ({ tool, className }) => {
2661
- const [, setTick] = (0, import_react18.useState)(0);
2662
- (0, import_react18.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
2749
+ const [, setTick] = (0, import_react21.useState)(0);
2750
+ (0, import_react21.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
2663
2751
  const bar = tool.bar();
2664
2752
  if (!tool.active || !bar) return null;
2665
2753
  const warp = tool.warpBar();
@@ -2671,17 +2759,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2671
2759
  const v = Number(raw);
2672
2760
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
2673
2761
  };
2674
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
2675
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor15.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: chip3(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
2676
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor15.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-slate-700 hover:bg-indigo-500", onClick: () => tool.setReference(a) }, a)) }),
2677
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
2678
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
2679
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Warp" }),
2680
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5", children: import_image_editor15.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: o.id, children: o.label }, o.id)) })
2762
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
2763
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor15.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: chip3(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
2764
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor15.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-slate-700 hover:bg-indigo-500", onClick: () => tool.setReference(a) }, a)) }),
2765
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
2766
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2767
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Warp" }),
2768
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5", children: import_image_editor15.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: o.id, children: o.label }, o.id)) })
2681
2769
  ] }),
2682
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
2683
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
2684
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2770
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2771
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
2772
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2685
2773
  "input",
2686
2774
  {
2687
2775
  type: "number",
@@ -2702,9 +2790,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2702
2790
  },
2703
2791
  `${k}:${warp[k]}`
2704
2792
  ),
2705
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-500", children: "%" })
2793
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-500", children: "%" })
2706
2794
  ] }, k)),
2707
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2795
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2708
2796
  "button",
2709
2797
  {
2710
2798
  type: "button",
@@ -2716,9 +2804,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2716
2804
  children: "Vertical"
2717
2805
  }
2718
2806
  ),
2719
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
2720
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Grid" }),
2721
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2807
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2808
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Grid" }),
2809
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2722
2810
  "select",
2723
2811
  {
2724
2812
  "aria-label": "Warp grid",
@@ -2728,14 +2816,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2728
2816
  tool.setWarp({ columns: g.columns, rows: g.rows });
2729
2817
  },
2730
2818
  className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
2731
- children: import_image_editor15.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: g.id, children: g.label }, g.id))
2819
+ children: import_image_editor15.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: g.id, children: g.label }, g.id))
2732
2820
  }
2733
2821
  )
2734
2822
  ] })
2735
2823
  ] }),
2736
- tool.mode !== "warp" && import_image_editor15.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
2737
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: f.label }),
2738
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2824
+ tool.mode !== "warp" && import_image_editor15.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
2825
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: f.label }),
2826
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2739
2827
  "input",
2740
2828
  {
2741
2829
  type: "number",
@@ -2755,8 +2843,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2755
2843
  },
2756
2844
  `${f.id}:${round(bar[f.id], f.unit)}`
2757
2845
  ),
2758
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-500", children: f.unit }),
2759
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2846
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-500", children: f.unit }),
2847
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2760
2848
  "button",
2761
2849
  {
2762
2850
  type: "button",
@@ -2771,34 +2859,34 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
2771
2859
  }
2772
2860
  )
2773
2861
  ] }, f.id)),
2774
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
2775
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Interpolation" }),
2776
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2862
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
2863
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Interpolation" }),
2864
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2777
2865
  "select",
2778
2866
  {
2779
2867
  "aria-label": "Interpolation",
2780
2868
  value: tool.interpolation,
2781
2869
  onChange: (e) => tool.setInterpolation(e.target.value),
2782
2870
  className: "rounded border border-slate-700 bg-slate-900 px-1 py-0.5",
2783
- children: import_image_editor15.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
2871
+ children: import_image_editor15.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
2784
2872
  }
2785
2873
  )
2786
2874
  ] }),
2787
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-emerald-600 text-white hover:bg-emerald-500", onClick: () => tool.commit(), children: "Commit" }),
2788
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", title: "Cancel (Esc)", className: chip3(false), onClick: () => tool.cancel(), children: "Cancel" }),
2789
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { role: "alert", className: "text-rose-400", children: tool.error })
2875
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-emerald-600 text-white hover:bg-emerald-500", onClick: () => tool.commit(), children: "Commit" }),
2876
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Cancel (Esc)", className: chip3(false), onClick: () => tool.cancel(), children: "Cancel" }),
2877
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { role: "alert", className: "text-rose-400", children: tool.error })
2790
2878
  ] });
2791
2879
  };
2792
2880
 
2793
2881
  // src/image-editor/ShapeOptionsBar.tsx
2794
- var import_react19 = require("react");
2882
+ var import_react22 = require("react");
2795
2883
  var import_image_editor16 = require("@pixerate/editor/image-editor");
2796
- var import_jsx_runtime19 = require("react/jsx-runtime");
2884
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2797
2885
  var chip4 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
2798
2886
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2799
- const [, setTick] = (0, import_react19.useState)(0);
2800
- (0, import_react19.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2801
- const [error, setError] = (0, import_react19.useState)(null);
2887
+ const [, setTick] = (0, import_react22.useState)(0);
2888
+ (0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2889
+ const [error, setError] = (0, import_react22.useState)(null);
2802
2890
  const active = controller.getActiveLayer();
2803
2891
  const shapeId = active?.type === "shape" ? active.id : null;
2804
2892
  const set = (change) => {
@@ -2812,13 +2900,13 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2812
2900
  }
2813
2901
  };
2814
2902
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
2815
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "shape-options", children: [
2816
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor16.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: chip4(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor16.SHAPE_KIND_LABELS[k] }, k)) }),
2817
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
2818
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2819
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
2903
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "shape-options", children: [
2904
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor16.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: chip4(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor16.SHAPE_KIND_LABELS[k] }, k)) }),
2905
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
2906
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2907
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
2820
2908
  "Fill",
2821
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2909
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2822
2910
  "input",
2823
2911
  {
2824
2912
  type: "color",
@@ -2830,10 +2918,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2830
2918
  }
2831
2919
  )
2832
2920
  ] }),
2833
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2834
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", "aria-label": "Stroke", checked: options.stroke !== null, onChange: (e) => set({ stroke: e.target.checked ? "#000000" : null }) }),
2921
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2922
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Stroke", checked: options.stroke !== null, onChange: (e) => set({ stroke: e.target.checked ? "#000000" : null }) }),
2835
2923
  "Stroke",
2836
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2924
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2837
2925
  "input",
2838
2926
  {
2839
2927
  type: "color",
@@ -2845,9 +2933,9 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2845
2933
  }
2846
2934
  )
2847
2935
  ] }),
2848
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2936
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2849
2937
  "Width",
2850
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2938
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2851
2939
  "input",
2852
2940
  {
2853
2941
  type: "number",
@@ -2861,23 +2949,23 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2861
2949
  )
2862
2950
  ] })
2863
2951
  ] }),
2864
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
2865
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2952
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
2953
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2866
2954
  "Radius",
2867
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2955
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2868
2956
  ] }),
2869
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2957
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2870
2958
  "Sides",
2871
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2959
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2872
2960
  ] }),
2873
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2874
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2961
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2962
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2875
2963
  "Points",
2876
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2964
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2877
2965
  ] }),
2878
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2966
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2879
2967
  "Inner",
2880
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2968
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2881
2969
  "input",
2882
2970
  {
2883
2971
  type: "range",
@@ -2892,33 +2980,33 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2892
2980
  )
2893
2981
  ] })
2894
2982
  ] }),
2895
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2896
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2983
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2984
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2897
2985
  "Weight",
2898
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2986
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: "w-14 rounded border border-slate-700 bg-slate-950 px-1 py-0.5" })
2899
2987
  ] }),
2900
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
2901
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
2988
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
2989
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
2902
2990
  "Arrowhead"
2903
2991
  ] })
2904
2992
  ] })
2905
2993
  ] }),
2906
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-500", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
2907
- error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2994
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[10px] text-slate-500", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
2995
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2908
2996
  ] });
2909
2997
  };
2910
2998
 
2911
2999
  // src/image-editor/TypeOptionsBar.tsx
2912
- var import_react20 = require("react");
3000
+ var import_react23 = require("react");
2913
3001
  var import_image_editor17 = require("@pixerate/editor/image-editor");
2914
- var import_jsx_runtime20 = require("react/jsx-runtime");
3002
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2915
3003
  var chip5 = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
2916
3004
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
2917
3005
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
2918
- const [, setTick] = (0, import_react20.useState)(0);
2919
- (0, import_react20.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2920
- (0, import_react20.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
2921
- const [error, setError] = (0, import_react20.useState)(null);
3006
+ const [, setTick] = (0, import_react23.useState)(0);
3007
+ (0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3008
+ (0, import_react23.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
3009
+ const [error, setError] = (0, import_react23.useState)(null);
2922
3010
  const active = controller.getActiveLayer();
2923
3011
  const typeId = !session && active?.type === "type" ? active.id : null;
2924
3012
  const here = session?.alive ? session.styleHere() : {};
@@ -2950,11 +3038,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
2950
3038
  setError(e instanceof Error ? e.message : String(e));
2951
3039
  }
2952
3040
  };
2953
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "type-options", children: [
2954
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
2955
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
3041
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "type-options", children: [
3042
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3043
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
2956
3044
  "Font",
2957
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3045
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2958
3046
  "input",
2959
3047
  {
2960
3048
  list: "pixerate-type-fonts",
@@ -2964,11 +3052,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
2964
3052
  className: "w-32 rounded border border-slate-700 bg-slate-950 px-1 py-0.5"
2965
3053
  }
2966
3054
  ),
2967
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: f }, f)) })
3055
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: f }, f)) })
2968
3056
  ] }),
2969
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
3057
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
2970
3058
  "Size",
2971
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3059
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2972
3060
  "input",
2973
3061
  {
2974
3062
  type: "number",
@@ -2981,24 +3069,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
2981
3069
  }
2982
3070
  )
2983
3071
  ] }),
2984
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${chip5(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
2985
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${chip5(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
2986
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: "h-6 w-8 rounded border border-slate-700 bg-transparent" })
3072
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${chip5(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
3073
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${chip5(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
3074
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: "h-6 w-8 rounded border border-slate-700 bg-transparent" })
2987
3075
  ] }),
2988
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor17.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: chip5(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
2989
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-500", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
2990
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { role: "status", className: "text-amber-400", "data-testid": "type-missing-fonts", children: [
3076
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor17.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: chip5(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
3077
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[10px] text-slate-500", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
3078
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { role: "status", className: "text-amber-400", "data-testid": "type-missing-fonts", children: [
2991
3079
  "Missing ",
2992
3080
  missing.length === 1 ? "font" : "fonts",
2993
3081
  ": ",
2994
3082
  missing.join(", ")
2995
3083
  ] }),
2996
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
3084
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-rose-400", children: error })
2997
3085
  ] });
2998
3086
  };
2999
3087
 
3000
3088
  // src/image-editor/ImageEditor.tsx
3001
- var import_jsx_runtime21 = require("react/jsx-runtime");
3089
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3002
3090
  var ImageEditor = ({
3003
3091
  editor: externalEditor,
3004
3092
  src,
@@ -3009,7 +3097,10 @@ var ImageEditor = ({
3009
3097
  onInpaint,
3010
3098
  onRemoveBackground,
3011
3099
  aiHooks,
3012
- effects
3100
+ effects,
3101
+ playback,
3102
+ playbackId = "image",
3103
+ onPlaybackReveal
3013
3104
  }) => {
3014
3105
  const internalEditor = useImageEditor({ image: src });
3015
3106
  const editor = externalEditor || internalEditor;
@@ -3019,29 +3110,91 @@ var ImageEditor = ({
3019
3110
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
3020
3111
  });
3021
3112
  const legacyProcess = (0, import_image_editor18.normalizeProcessVersion)(state.adjustments.process) < import_image_editor18.LATEST_PROCESS_VERSION;
3022
- const canvasRef = (0, import_react21.useRef)(null);
3023
- const containerRef = (0, import_react21.useRef)(null);
3024
- const [activeTab, setActiveTab] = (0, import_react21.useState)("crop");
3025
- const [activeCropRatio, setActiveCropRatio] = (0, import_react21.useState)(null);
3026
- const [selectionOptions, setSelectionOptions] = (0, import_react21.useState)(import_image_editor18.DEFAULT_SELECTION_TOOL_OPTIONS);
3027
- const selectionOptionsRef = (0, import_react21.useRef)(selectionOptions);
3113
+ const canvasRef = (0, import_react24.useRef)(null);
3114
+ const containerRef = (0, import_react24.useRef)(null);
3115
+ const [activeTab, setActiveTab] = (0, import_react24.useState)("crop");
3116
+ const rootRef = (0, import_react24.useRef)(null);
3117
+ const activeTabRef = (0, import_react24.useRef)(activeTab);
3118
+ activeTabRef.current = activeTab;
3119
+ const ambientPlayback = useAgentPlayback();
3120
+ const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
3121
+ const [locateLayer] = (0, import_react24.useState)(() => (0, import_image_editor18.createImagePlaybackLocator)(controller));
3122
+ const docToRoot = (p) => {
3123
+ const canvas = canvasRef.current;
3124
+ const root = rootRef.current;
3125
+ if (!canvas || !root || !canvas.width) return p;
3126
+ const r = canvas.getBoundingClientRect();
3127
+ const box = root.getBoundingClientRect();
3128
+ const c = (0, import_image_editor18.imageToCanvasPoint)(p, controller.getState(), canvas.width, canvas.height, activeTabRef.current === "crop");
3129
+ return { x: r.left - box.left + c.x * r.width / canvas.width, y: r.top - box.top + c.y * r.height / canvas.height };
3130
+ };
3131
+ const clientToDoc = (p) => {
3132
+ const canvas = canvasRef.current;
3133
+ if (!canvas || !canvas.width) return p;
3134
+ const r = canvas.getBoundingClientRect();
3135
+ const sx = r.width > 0 ? canvas.width / r.width : 1;
3136
+ const sy = r.height > 0 ? canvas.height / r.height : 1;
3137
+ return (0, import_image_editor18.canvasToImagePoint)({ x: (p.x - r.left) * sx, y: (p.y - r.top) * sy }, controller.getState(), canvas.width, canvas.height, activeTabRef.current === "crop");
3138
+ };
3139
+ const elementRect = (selector) => {
3140
+ const el = rootRef.current?.querySelector(selector);
3141
+ const r = el?.getBoundingClientRect();
3142
+ if (!r || r.width <= 0) return null;
3143
+ const a = clientToDoc({ x: r.left, y: r.top });
3144
+ const b = clientToDoc({ x: r.right, y: r.bottom });
3145
+ return { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), width: Math.abs(b.x - a.x), height: Math.abs(b.y - a.y) };
3146
+ };
3147
+ const agentPresence = usePlaybackSurface(playing, playbackId, {
3148
+ defaultKind: "layer",
3149
+ locate: (ref) => {
3150
+ if (ref.kind === "panel") return elementRect(`[data-image-tab="${CSS.escape(ref.id)}"]`);
3151
+ if (ref.kind === "control") return elementRect(`[data-control-id="${CSS.escape(ref.id)}"]`);
3152
+ return locateLayer(ref) ?? (ref.kind === "layer" || ref.kind === "item" ? elementRect(`[data-layer-id="${CSS.escape(ref.id)}"]`) : null);
3153
+ },
3154
+ open: async (ref) => {
3155
+ if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
3156
+ rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
3157
+ await new Promise((resolve) => setTimeout(resolve, 60));
3158
+ },
3159
+ bounds: () => {
3160
+ const r = canvasRef.current?.getBoundingClientRect();
3161
+ if (!r || r.width <= 0) return null;
3162
+ const a = clientToDoc({ x: r.left, y: r.top });
3163
+ const b = clientToDoc({ x: r.right, y: r.bottom });
3164
+ return { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), width: Math.abs(b.x - a.x), height: Math.abs(b.y - a.y) };
3165
+ },
3166
+ visible: () => {
3167
+ const r = rootRef.current?.getBoundingClientRect();
3168
+ return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
3169
+ },
3170
+ toViewport: (p) => {
3171
+ const box = rootRef.current?.getBoundingClientRect();
3172
+ const q = docToRoot(p);
3173
+ return { x: (box?.left ?? 0) + q.x, y: (box?.top ?? 0) + q.y };
3174
+ },
3175
+ fromViewport: clientToDoc,
3176
+ reveal: () => onPlaybackReveal?.()
3177
+ });
3178
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react24.useState)(null);
3179
+ const [selectionOptions, setSelectionOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_SELECTION_TOOL_OPTIONS);
3180
+ const selectionOptionsRef = (0, import_react24.useRef)(selectionOptions);
3028
3181
  selectionOptionsRef.current = selectionOptions;
3029
- const selectionGestureRef = (0, import_react21.useRef)(null);
3182
+ const selectionGestureRef = (0, import_react24.useRef)(null);
3030
3183
  if (!selectionGestureRef.current || selectionGestureRef.current.controller !== controller) {
3031
3184
  selectionGestureRef.current = new import_image_editor18.SelectionGesture(controller, () => selectionOptionsRef.current);
3032
3185
  }
3033
- const selectionDraftRef = (0, import_react21.useRef)(null);
3034
- const [selectionError, setSelectionError] = (0, import_react21.useState)(null);
3035
- const paintGestureRef = (0, import_react21.useRef)(null);
3036
- const paintControllerRef = (0, import_react21.useRef)(controller);
3186
+ const selectionDraftRef = (0, import_react24.useRef)(null);
3187
+ const [selectionError, setSelectionError] = (0, import_react24.useState)(null);
3188
+ const paintGestureRef = (0, import_react24.useRef)(null);
3189
+ const paintControllerRef = (0, import_react24.useRef)(controller);
3037
3190
  if (!paintGestureRef.current || paintControllerRef.current !== controller) {
3038
3191
  paintGestureRef.current = new import_image_editor18.PaintGesture(controller);
3039
3192
  paintControllerRef.current = controller;
3040
3193
  }
3041
- const brushCursorRef = (0, import_react21.useRef)(null);
3042
- const [paintError, setPaintError] = (0, import_react21.useState)(null);
3043
- const transformToolRef = (0, import_react21.useRef)(null);
3044
- const transformControllerRef = (0, import_react21.useRef)(controller);
3194
+ const brushCursorRef = (0, import_react24.useRef)(null);
3195
+ const [paintError, setPaintError] = (0, import_react24.useState)(null);
3196
+ const transformToolRef = (0, import_react24.useRef)(null);
3197
+ const transformControllerRef = (0, import_react24.useRef)(controller);
3045
3198
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
3046
3199
  transformToolRef.current?.cancel();
3047
3200
  transformToolRef.current = new import_image_editor18.FreeTransformTool(controller, {
@@ -3050,33 +3203,33 @@ var ImageEditor = ({
3050
3203
  transformControllerRef.current = controller;
3051
3204
  }
3052
3205
  const transformTool = transformToolRef.current;
3053
- const [, setTransformTick] = (0, import_react21.useState)(0);
3054
- const [transformCursor, setTransformCursor] = (0, import_react21.useState)("default");
3055
- const [shapeOptions, setShapeOptions] = (0, import_react21.useState)(import_image_editor18.DEFAULT_SHAPE_TOOL_OPTIONS);
3056
- const shapeOptionsRef = (0, import_react21.useRef)(shapeOptions);
3206
+ const [, setTransformTick] = (0, import_react24.useState)(0);
3207
+ const [transformCursor, setTransformCursor] = (0, import_react24.useState)("default");
3208
+ const [shapeOptions, setShapeOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_SHAPE_TOOL_OPTIONS);
3209
+ const shapeOptionsRef = (0, import_react24.useRef)(shapeOptions);
3057
3210
  shapeOptionsRef.current = shapeOptions;
3058
- const [typeOptions, setTypeOptions] = (0, import_react21.useState)(import_image_editor18.DEFAULT_TYPE_TOOL_OPTIONS);
3059
- const typeOptionsRef = (0, import_react21.useRef)(typeOptions);
3211
+ const [typeOptions, setTypeOptions] = (0, import_react24.useState)(import_image_editor18.DEFAULT_TYPE_TOOL_OPTIONS);
3212
+ const typeOptionsRef = (0, import_react24.useRef)(typeOptions);
3060
3213
  typeOptionsRef.current = typeOptions;
3061
- const shapeGestureRef = (0, import_react21.useRef)(null);
3062
- const typeToolRef = (0, import_react21.useRef)(null);
3063
- const shapeTypeControllerRef = (0, import_react21.useRef)(controller);
3214
+ const shapeGestureRef = (0, import_react24.useRef)(null);
3215
+ const typeToolRef = (0, import_react24.useRef)(null);
3216
+ const shapeTypeControllerRef = (0, import_react24.useRef)(controller);
3064
3217
  if (!shapeGestureRef.current || !typeToolRef.current || shapeTypeControllerRef.current !== controller) {
3065
3218
  typeToolRef.current?.finish();
3066
3219
  shapeGestureRef.current = new import_image_editor18.ShapeDrawGesture(controller, () => shapeOptionsRef.current);
3067
3220
  typeToolRef.current = new import_image_editor18.TypeToolGesture(controller, () => typeOptionsRef.current);
3068
3221
  shapeTypeControllerRef.current = controller;
3069
3222
  }
3070
- const typeInputRef = (0, import_react21.useRef)(null);
3071
- const [typeSession, setTypeSession] = (0, import_react21.useState)(typeToolRef.current.session);
3072
- const [shapeTypeError, setShapeTypeError] = (0, import_react21.useState)(null);
3073
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react21.useState)("");
3074
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react21.useState)("annotations");
3075
- const [isRemovingBg, setIsRemovingBg] = (0, import_react21.useState)(false);
3076
- const [isInpainting, setIsInpainting] = (0, import_react21.useState)(false);
3077
- const [aiError, setAiError] = (0, import_react21.useState)(null);
3078
- const [aiSuccess, setAiSuccess] = (0, import_react21.useState)(null);
3079
- const [aiTarget, setAiTarget] = (0, import_react21.useState)("auto");
3223
+ const typeInputRef = (0, import_react24.useRef)(null);
3224
+ const [typeSession, setTypeSession] = (0, import_react24.useState)(typeToolRef.current.session);
3225
+ const [shapeTypeError, setShapeTypeError] = (0, import_react24.useState)(null);
3226
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react24.useState)("");
3227
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react24.useState)("annotations");
3228
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react24.useState)(false);
3229
+ const [isInpainting, setIsInpainting] = (0, import_react24.useState)(false);
3230
+ const [aiError, setAiError] = (0, import_react24.useState)(null);
3231
+ const [aiSuccess, setAiSuccess] = (0, import_react24.useState)(null);
3232
+ const [aiTarget, setAiTarget] = (0, import_react24.useState)("auto");
3080
3233
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
3081
3234
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
3082
3235
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -3139,18 +3292,18 @@ var ImageEditor = ({
3139
3292
  setIsInpainting(false);
3140
3293
  }
3141
3294
  };
3142
- const [activeColor, setActiveColor] = (0, import_react21.useState)("#ef4444");
3143
- const [strokeWidth, setStrokeWidth] = (0, import_react21.useState)(3);
3144
- const [fontSize, setFontSize] = (0, import_react21.useState)(24);
3145
- const [textInput, setTextInput] = (0, import_react21.useState)("");
3146
- const draftAnnotationRef = (0, import_react21.useRef)(null);
3147
- const draftCropRef = (0, import_react21.useRef)(null);
3148
- const cropDragInfoRef = (0, import_react21.useRef)(null);
3149
- const annotationDragInfoRef = (0, import_react21.useRef)(null);
3150
- const isDrawingRef = (0, import_react21.useRef)(false);
3151
- const currentPathRef = (0, import_react21.useRef)([]);
3152
- const dragStartPointRef = (0, import_react21.useRef)(null);
3153
- const renderCanvas = (0, import_react21.useCallback)(
3295
+ const [activeColor, setActiveColor] = (0, import_react24.useState)("#ef4444");
3296
+ const [strokeWidth, setStrokeWidth] = (0, import_react24.useState)(3);
3297
+ const [fontSize, setFontSize] = (0, import_react24.useState)(24);
3298
+ const [textInput, setTextInput] = (0, import_react24.useState)("");
3299
+ const draftAnnotationRef = (0, import_react24.useRef)(null);
3300
+ const draftCropRef = (0, import_react24.useRef)(null);
3301
+ const cropDragInfoRef = (0, import_react24.useRef)(null);
3302
+ const annotationDragInfoRef = (0, import_react24.useRef)(null);
3303
+ const isDrawingRef = (0, import_react24.useRef)(false);
3304
+ const currentPathRef = (0, import_react24.useRef)([]);
3305
+ const dragStartPointRef = (0, import_react24.useRef)(null);
3306
+ const renderCanvas = (0, import_react24.useCallback)(
3154
3307
  async (draftAnnotation, draftCrop) => {
3155
3308
  const canvas = canvasRef.current;
3156
3309
  const container = containerRef.current;
@@ -3173,8 +3326,8 @@ var ImageEditor = ({
3173
3326
  },
3174
3327
  [controller, activeTab, transformTool]
3175
3328
  );
3176
- (0, import_react21.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
3177
- (0, import_react21.useEffect)(() => {
3329
+ (0, import_react24.useEffect)(() => typeSession?.subscribe(() => void renderCanvas()), [typeSession, renderCanvas]);
3330
+ (0, import_react24.useEffect)(() => {
3178
3331
  if (activeTab === "annotate" && state.activeTool === "type") return;
3179
3332
  if (typeToolRef.current?.session) {
3180
3333
  typeToolRef.current.finish();
@@ -3209,7 +3362,7 @@ var ImageEditor = ({
3209
3362
  el.value = "";
3210
3363
  }
3211
3364
  };
3212
- (0, import_react21.useEffect)(() => transformTool.subscribe(() => {
3365
+ (0, import_react24.useEffect)(() => transformTool.subscribe(() => {
3213
3366
  setTransformTick((n) => n + 1);
3214
3367
  void renderCanvas();
3215
3368
  }), [transformTool, renderCanvas]);
@@ -3252,7 +3405,7 @@ var ImageEditor = ({
3252
3405
  transformTool.up();
3253
3406
  return true;
3254
3407
  };
3255
- (0, import_react21.useEffect)(() => {
3408
+ (0, import_react24.useEffect)(() => {
3256
3409
  if (typeof window === "undefined") return;
3257
3410
  const onKey = (e) => {
3258
3411
  if (transformTool.key(e)) e.preventDefault();
@@ -3260,7 +3413,7 @@ var ImageEditor = ({
3260
3413
  window.addEventListener("keydown", onKey);
3261
3414
  return () => window.removeEventListener("keydown", onKey);
3262
3415
  }, [transformTool]);
3263
- (0, import_react21.useEffect)(() => {
3416
+ (0, import_react24.useEffect)(() => {
3264
3417
  const raf = typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : (cb) => setTimeout(cb, 0);
3265
3418
  const caf = typeof cancelAnimationFrame !== "undefined" ? cancelAnimationFrame : (id) => clearTimeout(id);
3266
3419
  const animId = raf(() => {
@@ -3268,12 +3421,12 @@ var ImageEditor = ({
3268
3421
  });
3269
3422
  return () => caf(animId);
3270
3423
  }, [renderCanvas, state]);
3271
- (0, import_react21.useEffect)(() => {
3424
+ (0, import_react24.useEffect)(() => {
3272
3425
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
3273
3426
  editor.setTool("crop");
3274
3427
  }
3275
3428
  }, [activeTab, editor]);
3276
- (0, import_react21.useEffect)(() => {
3429
+ (0, import_react24.useEffect)(() => {
3277
3430
  const container = containerRef.current;
3278
3431
  if (!container) return;
3279
3432
  if (typeof ResizeObserver !== "undefined") {
@@ -3341,7 +3494,7 @@ var ImageEditor = ({
3341
3494
  if (g.error) setPaintError(g.error);
3342
3495
  }
3343
3496
  };
3344
- (0, import_react21.useEffect)(() => {
3497
+ (0, import_react24.useEffect)(() => {
3345
3498
  if (activeTab !== "paint" || typeof window === "undefined") return;
3346
3499
  const onKey = (e) => {
3347
3500
  if ((0, import_image_editor18.handlePaintShortcut)(controller, e)) e.preventDefault();
@@ -3736,18 +3889,21 @@ var ImageEditor = ({
3736
3889
  link.click();
3737
3890
  }
3738
3891
  };
3739
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3892
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3740
3893
  "div",
3741
3894
  {
3742
- className: `flex flex-col bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-2xl text-slate-100 ${className}`,
3895
+ ref: rootRef,
3896
+ className: `relative flex flex-col bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-2xl text-slate-100 ${className}`,
3743
3897
  style,
3744
3898
  children: [
3745
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center justify-between px-4 py-3 bg-slate-950/80 border-b border-slate-800 gap-3", children: [
3746
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1 bg-slate-900 p-1 rounded-lg border border-slate-800 text-xs", children: [
3747
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3899
+ playing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3900
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center justify-between px-4 py-3 bg-slate-950/80 border-b border-slate-800 gap-3", children: [
3901
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1 bg-slate-900 p-1 rounded-lg border border-slate-800 text-xs", children: [
3902
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3748
3903
  "button",
3749
3904
  {
3750
3905
  type: "button",
3906
+ "data-image-tab": "crop",
3751
3907
  onClick: () => {
3752
3908
  setActiveTab("crop");
3753
3909
  editor.setTool("crop");
@@ -3756,10 +3912,11 @@ var ImageEditor = ({
3756
3912
  children: "Transform & Crop"
3757
3913
  }
3758
3914
  ),
3759
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3915
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3760
3916
  "button",
3761
3917
  {
3762
3918
  type: "button",
3919
+ "data-image-tab": "adjust",
3763
3920
  onClick: () => {
3764
3921
  setActiveTab("adjust");
3765
3922
  editor.setTool("select");
@@ -3768,10 +3925,11 @@ var ImageEditor = ({
3768
3925
  children: "Adjustments"
3769
3926
  }
3770
3927
  ),
3771
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3928
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3772
3929
  "button",
3773
3930
  {
3774
3931
  type: "button",
3932
+ "data-image-tab": "layers",
3775
3933
  onClick: () => {
3776
3934
  setActiveTab("layers");
3777
3935
  editor.setTool("select");
@@ -3780,10 +3938,11 @@ var ImageEditor = ({
3780
3938
  children: "Layers"
3781
3939
  }
3782
3940
  ),
3783
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3941
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3784
3942
  "button",
3785
3943
  {
3786
3944
  type: "button",
3945
+ "data-image-tab": "paint",
3787
3946
  onClick: () => {
3788
3947
  setActiveTab("paint");
3789
3948
  editor.setTool("brush");
@@ -3792,10 +3951,11 @@ var ImageEditor = ({
3792
3951
  children: "Paint"
3793
3952
  }
3794
3953
  ),
3795
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3954
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3796
3955
  "button",
3797
3956
  {
3798
3957
  type: "button",
3958
+ "data-image-tab": "select",
3799
3959
  onClick: () => {
3800
3960
  setActiveTab("select");
3801
3961
  editor.setTool("select");
@@ -3804,10 +3964,11 @@ var ImageEditor = ({
3804
3964
  children: "Select & Mask"
3805
3965
  }
3806
3966
  ),
3807
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3967
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3808
3968
  "button",
3809
3969
  {
3810
3970
  type: "button",
3971
+ "data-image-tab": "annotate",
3811
3972
  onClick: () => {
3812
3973
  setActiveTab("annotate");
3813
3974
  editor.setTool("pen");
@@ -3816,10 +3977,11 @@ var ImageEditor = ({
3816
3977
  children: "Annotations"
3817
3978
  }
3818
3979
  ),
3819
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3980
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3820
3981
  "button",
3821
3982
  {
3822
3983
  type: "button",
3984
+ "data-image-tab": "depth",
3823
3985
  onClick: () => {
3824
3986
  setActiveTab("depth");
3825
3987
  editor.setTool("select");
@@ -3828,24 +3990,25 @@ var ImageEditor = ({
3828
3990
  children: "Depth Mask"
3829
3991
  }
3830
3992
  ),
3831
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3993
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3832
3994
  "button",
3833
3995
  {
3834
3996
  type: "button",
3997
+ "data-image-tab": "ai",
3835
3998
  onClick: () => {
3836
3999
  setActiveTab("ai");
3837
4000
  editor.setTool("select");
3838
4001
  },
3839
4002
  className: `px-3 py-1.5 rounded-md font-medium transition-colors flex items-center gap-1.5 ${activeTab === "ai" ? "bg-indigo-600 text-white shadow" : "text-slate-400 hover:text-slate-200"}`,
3840
4003
  children: [
3841
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4004
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
3842
4005
  "AI Tools"
3843
4006
  ]
3844
4007
  }
3845
4008
  )
3846
4009
  ] }),
3847
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
3848
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4010
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
4011
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3849
4012
  "button",
3850
4013
  {
3851
4014
  type: "button",
@@ -3856,7 +4019,7 @@ var ImageEditor = ({
3856
4019
  children: "\u21A9"
3857
4020
  }
3858
4021
  ),
3859
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4022
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3860
4023
  "button",
3861
4024
  {
3862
4025
  type: "button",
@@ -3867,7 +4030,7 @@ var ImageEditor = ({
3867
4030
  children: "\u21AA"
3868
4031
  }
3869
4032
  ),
3870
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4033
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3871
4034
  "button",
3872
4035
  {
3873
4036
  type: "button",
@@ -3876,8 +4039,8 @@ var ImageEditor = ({
3876
4039
  children: "Reset"
3877
4040
  }
3878
4041
  ),
3879
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
3880
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4042
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
4043
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3881
4044
  "button",
3882
4045
  {
3883
4046
  type: "button",
@@ -3887,11 +4050,11 @@ var ImageEditor = ({
3887
4050
  children: "-"
3888
4051
  }
3889
4052
  ),
3890
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-mono text-slate-400 w-10 text-center", children: [
4053
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono text-slate-400 w-10 text-center", children: [
3891
4054
  Math.round(state.zoom * 100),
3892
4055
  "%"
3893
4056
  ] }),
3894
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4057
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3895
4058
  "button",
3896
4059
  {
3897
4060
  type: "button",
@@ -3901,8 +4064,8 @@ var ImageEditor = ({
3901
4064
  children: "+"
3902
4065
  }
3903
4066
  ),
3904
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
3905
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4067
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-4 w-px bg-slate-800 mx-1" }),
4068
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3906
4069
  "button",
3907
4070
  {
3908
4071
  type: "button",
@@ -3913,7 +4076,7 @@ var ImageEditor = ({
3913
4076
  children: "Hold Compare"
3914
4077
  }
3915
4078
  ),
3916
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4079
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3917
4080
  "button",
3918
4081
  {
3919
4082
  type: "button",
@@ -3924,16 +4087,16 @@ var ImageEditor = ({
3924
4087
  )
3925
4088
  ] })
3926
4089
  ] }),
3927
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-slate-800 bg-slate-900/95 px-4 py-2" }),
3928
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "alert", className: "border-b border-rose-900 bg-rose-950/80 px-4 py-1.5 text-xs text-rose-200", children: transformTool.error }),
3929
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
3930
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4090
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-slate-800 bg-slate-900/95 px-4 py-2" }),
4091
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "alert", className: "border-b border-rose-900 bg-rose-950/80 px-4 py-1.5 text-xs text-rose-200", children: transformTool.error }),
4092
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
4093
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3931
4094
  "div",
3932
4095
  {
3933
4096
  ref: containerRef,
3934
4097
  className: "relative flex-1 h-[360px] md:h-full min-h-[320px] bg-slate-950 overflow-hidden select-none",
3935
4098
  children: [
3936
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4099
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3937
4100
  "canvas",
3938
4101
  {
3939
4102
  ref: canvasRef,
@@ -3950,7 +4113,7 @@ var ImageEditor = ({
3950
4113
  className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : activeTab === "paint" ? "touch-none cursor-crosshair" : activeTab === "annotate" && state.activeTool === "type" ? "cursor-text" : activeTab === "annotate" && state.activeTool === "shape" ? "cursor-crosshair" : ""}`
3951
4114
  }
3952
4115
  ),
3953
- typeSession && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4116
+ typeSession && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3954
4117
  "textarea",
3955
4118
  {
3956
4119
  ref: typeInputRef,
@@ -3972,11 +4135,11 @@ var ImageEditor = ({
3972
4135
  ]
3973
4136
  }
3974
4137
  ),
3975
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "w-full md:w-80 bg-slate-900/90 border-t md:border-t-0 md:border-l border-slate-800 p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]", children: [
3976
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
3977
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Aspect Ratio Presets" }),
3978
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
3979
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4138
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full md:w-80 bg-slate-900/90 border-t md:border-t-0 md:border-l border-slate-800 p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]", children: [
4139
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4140
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Aspect Ratio Presets" }),
4141
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
4142
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3980
4143
  "button",
3981
4144
  {
3982
4145
  type: "button",
@@ -3988,7 +4151,7 @@ var ImageEditor = ({
3988
4151
  children: "Freeform"
3989
4152
  }
3990
4153
  ),
3991
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4154
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3992
4155
  "button",
3993
4156
  {
3994
4157
  type: "button",
@@ -4000,7 +4163,7 @@ var ImageEditor = ({
4000
4163
  children: "1:1 Square"
4001
4164
  }
4002
4165
  ),
4003
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4166
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4004
4167
  "button",
4005
4168
  {
4006
4169
  type: "button",
@@ -4012,7 +4175,7 @@ var ImageEditor = ({
4012
4175
  children: "4:3 Standard"
4013
4176
  }
4014
4177
  ),
4015
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4178
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4016
4179
  "button",
4017
4180
  {
4018
4181
  type: "button",
@@ -4024,7 +4187,7 @@ var ImageEditor = ({
4024
4187
  children: "16:9 Wide"
4025
4188
  }
4026
4189
  ),
4027
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4190
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4028
4191
  "button",
4029
4192
  {
4030
4193
  type: "button",
@@ -4036,7 +4199,7 @@ var ImageEditor = ({
4036
4199
  children: "3:2 Photo"
4037
4200
  }
4038
4201
  ),
4039
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4202
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4040
4203
  "button",
4041
4204
  {
4042
4205
  type: "button",
@@ -4049,10 +4212,10 @@ var ImageEditor = ({
4049
4212
  }
4050
4213
  )
4051
4214
  ] }),
4052
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4053
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Orientation & Flips" }),
4054
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
4055
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4215
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4216
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Orientation & Flips" }),
4217
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
4218
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4056
4219
  "button",
4057
4220
  {
4058
4221
  type: "button",
@@ -4061,7 +4224,7 @@ var ImageEditor = ({
4061
4224
  children: "Rotate -90\xB0"
4062
4225
  }
4063
4226
  ),
4064
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4227
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4065
4228
  "button",
4066
4229
  {
4067
4230
  type: "button",
@@ -4070,7 +4233,7 @@ var ImageEditor = ({
4070
4233
  children: "Rotate +90\xB0"
4071
4234
  }
4072
4235
  ),
4073
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4236
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4074
4237
  "button",
4075
4238
  {
4076
4239
  type: "button",
@@ -4079,7 +4242,7 @@ var ImageEditor = ({
4079
4242
  children: "Flip Horizontal"
4080
4243
  }
4081
4244
  ),
4082
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4245
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4083
4246
  "button",
4084
4247
  {
4085
4248
  type: "button",
@@ -4090,10 +4253,10 @@ var ImageEditor = ({
4090
4253
  )
4091
4254
  ] })
4092
4255
  ] }),
4093
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4094
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
4095
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Color Adjustments" }),
4096
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4256
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4257
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4258
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Color Adjustments" }),
4259
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4097
4260
  "button",
4098
4261
  {
4099
4262
  type: "button",
@@ -4103,9 +4266,9 @@ var ImageEditor = ({
4103
4266
  }
4104
4267
  )
4105
4268
  ] }),
4106
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Histogram, { histogram: editor.histogram }),
4107
- import_image_editor18.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react21.default.Fragment, { children: [
4108
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4269
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Histogram, { histogram: editor.histogram }),
4270
+ import_image_editor18.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react24.default.Fragment, { children: [
4271
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4109
4272
  ControlSlider,
4110
4273
  {
4111
4274
  spec,
@@ -4114,14 +4277,14 @@ var ImageEditor = ({
4114
4277
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
4115
4278
  }
4116
4279
  ),
4117
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4280
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4118
4281
  "div",
4119
4282
  {
4120
4283
  className: "flex items-center justify-between gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-200",
4121
4284
  "data-testid": "image-editor-process-notice",
4122
4285
  children: [
4123
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
4124
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4286
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
4287
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4125
4288
  "button",
4126
4289
  {
4127
4290
  type: "button",
@@ -4134,7 +4297,7 @@ var ImageEditor = ({
4134
4297
  }
4135
4298
  )
4136
4299
  ] }, spec.id)),
4137
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4300
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4138
4301
  AdjustmentLayersPanel,
4139
4302
  {
4140
4303
  controller,
@@ -4143,9 +4306,9 @@ var ImageEditor = ({
4143
4306
  }
4144
4307
  ) })
4145
4308
  ] }),
4146
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4147
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Layers" }),
4148
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4309
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4310
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Layers" }),
4311
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4149
4312
  "button",
4150
4313
  {
4151
4314
  type: "button",
@@ -4156,15 +4319,15 @@ var ImageEditor = ({
4156
4319
  children: "Free Transform"
4157
4320
  }
4158
4321
  ),
4159
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LayersPanel, { controller }),
4160
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageProviderEffectsPanel, { controller, className: "border-t border-slate-700/60 pt-3" }),
4161
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Colour" }),
4162
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ColorProfilePanel, { controller })
4322
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersPanel, { controller }),
4323
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageProviderEffectsPanel, { controller, className: "border-t border-slate-700/60 pt-3" }),
4324
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Colour" }),
4325
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ColorProfilePanel, { controller })
4163
4326
  ] }),
4164
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4165
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Paint" }),
4166
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BrushOptionsBar, { controller }),
4167
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4327
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4328
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Paint" }),
4329
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BrushOptionsBar, { controller }),
4330
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4168
4331
  "button",
4169
4332
  {
4170
4333
  type: "button",
@@ -4175,12 +4338,12 @@ var ImageEditor = ({
4175
4338
  children: "Free Transform"
4176
4339
  }
4177
4340
  ),
4178
- paintError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "paint-error", children: paintError }),
4179
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LayersPanel, { controller }) })
4341
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "paint-error", children: paintError }),
4342
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "border-t border-slate-700/60 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersPanel, { controller }) })
4180
4343
  ] }),
4181
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4182
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Shape & Type Layers" }),
4183
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4344
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4345
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Shape & Type Layers" }),
4346
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4184
4347
  "button",
4185
4348
  {
4186
4349
  type: "button",
@@ -4191,13 +4354,13 @@ var ImageEditor = ({
4191
4354
  },
4192
4355
  t
4193
4356
  )) }),
4194
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
4195
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
4196
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-slate-800 px-2 py-1 text-[11px] text-slate-200 hover:bg-slate-700", children: "Done editing text" }),
4197
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "shape-type-error", children: shapeTypeError }),
4198
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4199
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Draw & Annotate" }),
4200
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4357
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
4358
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
4359
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-slate-800 px-2 py-1 text-[11px] text-slate-200 hover:bg-slate-700", children: "Done editing text" }),
4360
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", "data-testid": "shape-type-error", children: shapeTypeError }),
4361
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4362
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Draw & Annotate" }),
4363
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4201
4364
  "button",
4202
4365
  {
4203
4366
  type: "button",
@@ -4207,9 +4370,9 @@ var ImageEditor = ({
4207
4370
  },
4208
4371
  t
4209
4372
  )) }),
4210
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
4211
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-slate-400", children: "Color:" }),
4212
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4373
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
4374
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { className: "text-slate-400", children: "Color:" }),
4375
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4213
4376
  "input",
4214
4377
  {
4215
4378
  type: "color",
@@ -4218,15 +4381,15 @@ var ImageEditor = ({
4218
4381
  className: "w-8 h-8 rounded border border-slate-700 cursor-pointer bg-transparent"
4219
4382
  }
4220
4383
  ),
4221
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex-1 ml-2", children: [
4222
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex justify-between text-slate-400 mb-0.5", children: [
4223
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Width:" }),
4224
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-mono", children: [
4384
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 ml-2", children: [
4385
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-0.5", children: [
4386
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Width:" }),
4387
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
4225
4388
  strokeWidth,
4226
4389
  "px"
4227
4390
  ] })
4228
4391
  ] }),
4229
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4392
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4230
4393
  "input",
4231
4394
  {
4232
4395
  type: "range",
@@ -4239,10 +4402,10 @@ var ImageEditor = ({
4239
4402
  )
4240
4403
  ] })
4241
4404
  ] }),
4242
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4243
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Add Text" }),
4244
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-2", children: [
4245
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4405
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4406
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Add Text" }),
4407
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
4408
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4246
4409
  "input",
4247
4410
  {
4248
4411
  type: "text",
@@ -4253,7 +4416,7 @@ var ImageEditor = ({
4253
4416
  className: "flex-1 bg-slate-950 border border-slate-700 rounded-lg px-2.5 py-1.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500"
4254
4417
  }
4255
4418
  ),
4256
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4419
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4257
4420
  "button",
4258
4421
  {
4259
4422
  type: "button",
@@ -4263,14 +4426,14 @@ var ImageEditor = ({
4263
4426
  }
4264
4427
  )
4265
4428
  ] }),
4266
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between text-slate-400", children: [
4267
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Font Size:" }),
4268
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-mono", children: [
4429
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between text-slate-400", children: [
4430
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Font Size:" }),
4431
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
4269
4432
  fontSize,
4270
4433
  "px"
4271
4434
  ] })
4272
4435
  ] }),
4273
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4436
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4274
4437
  "input",
4275
4438
  {
4276
4439
  type: "range",
@@ -4281,14 +4444,14 @@ var ImageEditor = ({
4281
4444
  className: "w-full accent-indigo-500"
4282
4445
  }
4283
4446
  ),
4284
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4285
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
4286
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-slate-400", children: [
4447
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-px bg-slate-800 my-1" }),
4448
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4449
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "text-slate-400", children: [
4287
4450
  "Layers (",
4288
4451
  state.annotations.length,
4289
4452
  ")"
4290
4453
  ] }),
4291
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4454
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4292
4455
  "button",
4293
4456
  {
4294
4457
  type: "button",
@@ -4297,7 +4460,7 @@ var ImageEditor = ({
4297
4460
  children: "Delete Selected"
4298
4461
  }
4299
4462
  ),
4300
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4463
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4301
4464
  "button",
4302
4465
  {
4303
4466
  type: "button",
@@ -4308,10 +4471,10 @@ var ImageEditor = ({
4308
4471
  )
4309
4472
  ] })
4310
4473
  ] }),
4311
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4312
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
4313
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Depth Masking" }),
4314
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4474
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
4475
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4476
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px]", children: "Depth Masking" }),
4477
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4315
4478
  "button",
4316
4479
  {
4317
4480
  type: "button",
@@ -4321,8 +4484,8 @@ var ImageEditor = ({
4321
4484
  }
4322
4485
  )
4323
4486
  ] }),
4324
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300", children: [
4325
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4487
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300", children: [
4488
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4326
4489
  "input",
4327
4490
  {
4328
4491
  type: "checkbox",
@@ -4331,12 +4494,12 @@ var ImageEditor = ({
4331
4494
  className: "rounded accent-indigo-500"
4332
4495
  }
4333
4496
  ),
4334
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Enable Depth / Alpha Mask" })
4497
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Enable Depth / Alpha Mask" })
4335
4498
  ] }),
4336
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4337
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
4338
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-slate-400 block mb-1", children: "Mask Image URL:" }),
4339
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4499
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4500
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4501
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { className: "text-slate-400 block mb-1", children: "Mask Image URL:" }),
4502
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4340
4503
  "input",
4341
4504
  {
4342
4505
  type: "text",
@@ -4347,8 +4510,8 @@ var ImageEditor = ({
4347
4510
  }
4348
4511
  )
4349
4512
  ] }),
4350
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-2", children: [
4351
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4513
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
4514
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4352
4515
  "button",
4353
4516
  {
4354
4517
  type: "button",
@@ -4357,7 +4520,7 @@ var ImageEditor = ({
4357
4520
  children: "Threshold Mode"
4358
4521
  }
4359
4522
  ),
4360
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4523
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4361
4524
  "button",
4362
4525
  {
4363
4526
  type: "button",
@@ -4367,12 +4530,12 @@ var ImageEditor = ({
4367
4530
  }
4368
4531
  )
4369
4532
  ] }),
4370
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
4371
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4372
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Depth Start (Lower):" }),
4373
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
4533
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4534
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4535
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Depth Start (Lower):" }),
4536
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
4374
4537
  ] }),
4375
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4538
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4376
4539
  "input",
4377
4540
  {
4378
4541
  type: "range",
@@ -4386,12 +4549,12 @@ var ImageEditor = ({
4386
4549
  }
4387
4550
  )
4388
4551
  ] }),
4389
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
4390
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4391
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Depth Stop (Upper):" }),
4392
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
4552
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4553
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4554
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Depth Stop (Upper):" }),
4555
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
4393
4556
  ] }),
4394
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4557
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4395
4558
  "input",
4396
4559
  {
4397
4560
  type: "range",
@@ -4405,12 +4568,12 @@ var ImageEditor = ({
4405
4568
  }
4406
4569
  )
4407
4570
  ] }),
4408
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
4409
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4410
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Softness:" }),
4411
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
4571
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
4572
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between text-slate-400 mb-1", children: [
4573
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Softness:" }),
4574
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
4412
4575
  ] }),
4413
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4576
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4414
4577
  "input",
4415
4578
  {
4416
4579
  type: "range",
@@ -4422,8 +4585,8 @@ var ImageEditor = ({
4422
4585
  }
4423
4586
  )
4424
4587
  ] }),
4425
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300 mt-1", children: [
4426
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4588
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-slate-300 mt-1", children: [
4589
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4427
4590
  "input",
4428
4591
  {
4429
4592
  type: "checkbox",
@@ -4432,12 +4595,12 @@ var ImageEditor = ({
4432
4595
  className: "rounded accent-indigo-500"
4433
4596
  }
4434
4597
  ),
4435
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Invert Mask" })
4598
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Invert Mask" })
4436
4599
  ] })
4437
4600
  ] })
4438
4601
  ] }),
4439
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4440
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4602
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4603
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4441
4604
  SelectionOptionsBar,
4442
4605
  {
4443
4606
  controller,
@@ -4447,9 +4610,9 @@ var ImageEditor = ({
4447
4610
  quickMask: Boolean(state.quickMask)
4448
4611
  }
4449
4612
  ),
4450
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-rose-400", children: selectionError }),
4451
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1", children: [
4452
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4613
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-rose-400", children: selectionError }),
4614
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
4615
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4453
4616
  "button",
4454
4617
  {
4455
4618
  type: "button",
@@ -4460,7 +4623,7 @@ var ImageEditor = ({
4460
4623
  children: "Transform Selection"
4461
4624
  }
4462
4625
  ),
4463
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4626
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4464
4627
  "button",
4465
4628
  {
4466
4629
  type: "button",
@@ -4472,12 +4635,12 @@ var ImageEditor = ({
4472
4635
  }
4473
4636
  )
4474
4637
  ] }),
4475
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
4638
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
4476
4639
  ] }),
4477
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4478
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between gap-2 text-slate-300", children: [
4479
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Results go to" }),
4480
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4640
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
4641
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center justify-between gap-2 text-slate-300", children: [
4642
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Results go to" }),
4643
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4481
4644
  "select",
4482
4645
  {
4483
4646
  "aria-label": "AI result target",
@@ -4485,54 +4648,54 @@ var ImageEditor = ({
4485
4648
  onChange: (e) => setAiTarget(e.target.value),
4486
4649
  className: "bg-slate-800 border border-slate-700 rounded px-1.5 py-1",
4487
4650
  children: [
4488
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
4489
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
4490
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "replace", children: "Replace image" })
4651
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
4652
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
4653
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "replace", children: "Replace image" })
4491
4654
  ]
4492
4655
  }
4493
4656
  )
4494
4657
  ] }),
4495
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
4496
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
4497
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4498
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { className: "w-3.5 h-3.5 text-indigo-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
4658
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
4659
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4660
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4661
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5 text-indigo-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
4499
4662
  "Background Removal"
4500
4663
  ] }),
4501
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-900/60 text-indigo-300 animate-pulse", children: "Removing..." })
4664
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-900/60 text-indigo-300 animate-pulse", children: "Removing..." })
4502
4665
  ] }),
4503
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
4504
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4666
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
4667
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4505
4668
  "button",
4506
4669
  {
4507
4670
  type: "button",
4508
4671
  onClick: handleRemoveBackground,
4509
4672
  disabled: isRemovingBg || isInpainting,
4510
4673
  className: "mt-1 px-3 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
4511
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4512
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
4674
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4675
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
4513
4676
  "Removing Background..."
4514
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4515
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4677
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4678
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4516
4679
  "Remove Background"
4517
4680
  ] })
4518
4681
  }
4519
4682
  )
4520
4683
  ] }),
4521
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
4522
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
4523
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4524
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { className: "w-3.5 h-3.5 text-purple-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
4525
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
4526
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m14 7 3 3" })
4684
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 rounded-lg bg-slate-950/60 border border-slate-800 flex flex-col gap-2.5", children: [
4685
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
4686
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-semibold text-slate-200 uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4687
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { className: "w-3.5 h-3.5 text-purple-400", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
4688
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
4689
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m14 7 3 3" })
4527
4690
  ] }),
4528
4691
  "Generative Inpainting"
4529
4692
  ] }),
4530
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-purple-900/60 text-purple-300 animate-pulse", children: "Inpainting..." })
4693
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-purple-900/60 text-purple-300 animate-pulse", children: "Inpainting..." })
4531
4694
  ] }),
4532
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
4533
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
4534
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-slate-300 text-[11px] font-medium", children: "Prompt" }),
4535
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4695
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-slate-400 text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
4696
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", children: [
4697
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-slate-300 text-[11px] font-medium", children: "Prompt" }),
4698
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4536
4699
  "textarea",
4537
4700
  {
4538
4701
  id: "ai-inpaint-prompt-react",
@@ -4544,10 +4707,10 @@ var ImageEditor = ({
4544
4707
  }
4545
4708
  )
4546
4709
  ] }),
4547
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
4548
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-300 text-[11px] font-medium", children: "Target Mask Region" }),
4549
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
4550
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4710
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", children: [
4711
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-slate-300 text-[11px] font-medium", children: "Target Mask Region" }),
4712
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
4713
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4551
4714
  "button",
4552
4715
  {
4553
4716
  type: "button",
@@ -4560,7 +4723,7 @@ var ImageEditor = ({
4560
4723
  ]
4561
4724
  }
4562
4725
  ),
4563
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4726
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4564
4727
  "button",
4565
4728
  {
4566
4729
  type: "button",
@@ -4575,25 +4738,25 @@ var ImageEditor = ({
4575
4738
  )
4576
4739
  ] })
4577
4740
  ] }),
4578
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4741
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4579
4742
  "button",
4580
4743
  {
4581
4744
  type: "button",
4582
4745
  onClick: handleInpaint,
4583
4746
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
4584
4747
  className: "mt-1 px-3 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 disabled:opacity-50 text-white font-medium shadow transition-colors flex items-center justify-center gap-2",
4585
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4586
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
4748
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4749
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
4587
4750
  "Generating Inpaint..."
4588
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4589
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4751
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4752
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4590
4753
  "Apply Inpainting"
4591
4754
  ] })
4592
4755
  }
4593
4756
  )
4594
4757
  ] }),
4595
- aiError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "p-2.5 rounded-lg bg-rose-950/60 border border-rose-800 text-rose-300 text-[11px]", children: aiError }),
4596
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-950/60 border border-emerald-800 text-emerald-300 text-[11px]", children: aiSuccess })
4758
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-2.5 rounded-lg bg-rose-950/60 border border-rose-800 text-rose-300 text-[11px]", children: aiError }),
4759
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-950/60 border border-emerald-800 text-emerald-300 text-[11px]", children: aiSuccess })
4597
4760
  ] })
4598
4761
  ] })
4599
4762
  ] })