@pixerate/editor-react 0.197.0 → 0.198.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,6 +35,7 @@ __export(paint_editor_exports, {
35
35
  BrushLibraryBrowser: () => BrushLibraryBrowser,
36
36
  BrushPanel: () => BrushPanel,
37
37
  ColorPanel: () => ColorPanel,
38
+ CulturePanel: () => CulturePanel,
38
39
  EvolutionPanel: () => EvolutionPanel,
39
40
  FerroPanel: () => FerroPanel,
40
41
  PaintCanvas: () => PaintCanvas,
@@ -190,8 +191,14 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
190
191
  if (ctx && typeof ctx.createImageData === "function") (0, import_paint_editor2.drawWaterOverlay)(controller, ctx);
191
192
  }, [state, controller]);
192
193
  (0, import_react2.useEffect)(() => {
194
+ const stopCatchUp = (0, import_paint_editor2.startCultureCatchUp)(controller);
193
195
  const player = controller.playEffects();
194
- return () => player.stop();
196
+ const cultures = controller.playCultures();
197
+ return () => {
198
+ stopCatchUp();
199
+ player.stop();
200
+ cultures.stop();
201
+ };
195
202
  }, [controller]);
196
203
  (0, import_react2.useEffect)(() => {
197
204
  const el = viewport.current;
@@ -1299,7 +1306,7 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
1299
1306
 
1300
1307
  // src/paint-editor/PaperPanel.tsx
1301
1308
  var import_react12 = require("react");
1302
- var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1309
+ var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1303
1310
 
1304
1311
  // src/paint-editor/FerroPanel.tsx
1305
1312
  var import_react11 = require("react");
@@ -1433,20 +1440,102 @@ var TimeMachinePanel = ({ controller, className }) => {
1433
1440
  ] });
1434
1441
  };
1435
1442
 
1436
- // src/paint-editor/PaperPanel.tsx
1443
+ // src/paint-editor/CulturePanel.tsx
1444
+ var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1437
1445
  var import_jsx_runtime13 = require("react/jsx-runtime");
1446
+ var CulturePanel = ({ controller, className }) => {
1447
+ const state = usePaintEditorState(controller);
1448
+ const [error, attempt] = useAttempt();
1449
+ const { cultures, brush } = state;
1450
+ const activeId = state.document.activeLayerId;
1451
+ const activeColony = cultures.layers.find((l) => l.layerId === activeId) ?? cultures.layers[0] ?? null;
1452
+ const totalTips = cultures.layers.reduce((acc, l) => acc + l.tips, 0);
1453
+ const totalSegments = cultures.layers.reduce((acc, l) => acc + l.segments, 0);
1454
+ const canCarryCulture = ["dab", "mixer", "impasto", "particle", "bristle"].includes(brush.engine);
1455
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "culture-panel", children: [
1456
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1457
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "Biopaint (mycelial ink)" }),
1458
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex gap-1", children: [
1459
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.growCultures({ steps: 40 })), children: "Grow" }),
1460
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1461
+ "button",
1462
+ {
1463
+ type: "button",
1464
+ "aria-pressed": cultures.paused,
1465
+ className: chip(cultures.paused),
1466
+ onClick: () => controller.setCulturePaused(!cultures.paused),
1467
+ children: cultures.paused ? "Paused" : "Pause"
1468
+ }
1469
+ ),
1470
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1471
+ "button",
1472
+ {
1473
+ type: "button",
1474
+ className: button,
1475
+ disabled: !activeColony || activeColony.tips === 0,
1476
+ onClick: () => attempt(() => controller.removeCultures(activeColony?.layerId)),
1477
+ children: "Kill colony"
1478
+ }
1479
+ )
1480
+ ] })
1481
+ ] }),
1482
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-between text-[11px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: activeColony ? `${totalTips} living tips \xB7 ${totalSegments} segments (${activeColony.status})` : "No mycelial colony on canvas" }) }),
1483
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2 text-[11px]", children: [
1484
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1485
+ "input",
1486
+ {
1487
+ type: "checkbox",
1488
+ checked: cultures.growWhileClosed,
1489
+ onChange: (e) => attempt(() => controller.setCultureOptions({ growWhileClosed: e.target.checked }))
1490
+ }
1491
+ ),
1492
+ "Grow while closed"
1493
+ ] }),
1494
+ canCarryCulture && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1 border-t border-slate-800 pt-1.5", children: [
1495
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1496
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-slate-400", children: "Brush spores" }),
1497
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1498
+ "button",
1499
+ {
1500
+ type: "button",
1501
+ "aria-pressed": Boolean(brush.culture),
1502
+ className: chip(Boolean(brush.culture)),
1503
+ onClick: () => attempt(() => controller.setBrush({ culture: brush.culture ? null : {} })),
1504
+ children: brush.culture ? "On" : "Off"
1505
+ }
1506
+ )
1507
+ ] }),
1508
+ brush.culture && import_paint_editor8.CULTURE_SLIDERS.map((c) => {
1509
+ const key = c.path.replace(/^culture\./, "");
1510
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1511
+ PaintSlider,
1512
+ {
1513
+ control: c,
1514
+ value: (0, import_paint_editor8.readPath)(brush.culture, key),
1515
+ onCommit: (v) => attempt(() => controller.setBrush({ culture: { [key]: v } }))
1516
+ },
1517
+ c.path
1518
+ );
1519
+ })
1520
+ ] }),
1521
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1522
+ ] });
1523
+ };
1524
+
1525
+ // src/paint-editor/PaperPanel.tsx
1526
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1438
1527
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
1439
1528
  var PaperPanel = ({ controller, className }) => {
1440
1529
  const state = usePaintEditorState(controller);
1441
1530
  const [error, attempt] = useAttempt();
1442
1531
  const [tiltFollow, setTiltFollow] = (0, import_react12.useState)(false);
1443
- (0, import_react12.useEffect)(() => tiltFollow ? (0, import_paint_editor8.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1532
+ (0, import_react12.useEffect)(() => tiltFollow ? (0, import_paint_editor9.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1444
1533
  const paper = state.document.paper;
1445
- const previews = (0, import_react12.useMemo)(() => new Map(import_paint_editor8.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor8.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1446
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1447
- import_paint_editor8.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
1448
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1449
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor8.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1534
+ const previews = (0, import_react12.useMemo)(() => new Map(import_paint_editor9.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor9.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1535
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1536
+ import_paint_editor9.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1537
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1538
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor9.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1450
1539
  "button",
1451
1540
  {
1452
1541
  type: "button",
@@ -1455,74 +1544,75 @@ var PaperPanel = ({ controller, className }) => {
1455
1544
  title: p.name,
1456
1545
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
1457
1546
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
1458
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1547
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1459
1548
  },
1460
1549
  p.preset
1461
1550
  )) })
1462
1551
  ] }, family)),
1463
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-slate-300", children: paper.name }),
1464
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between", children: [
1465
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1466
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1552
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-slate-300", children: paper.name }),
1553
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1554
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1555
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1467
1556
  ] }),
1468
- import_paint_editor8.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor8.patchPath)(paper, c.path, v))) }, c.path)),
1469
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between", children: [
1470
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1471
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor8.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1557
+ import_paint_editor9.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor9.patchPath)(paper, c.path, v))) }, c.path)),
1558
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1559
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1560
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor9.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1472
1561
  ] }),
1473
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1474
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1562
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1563
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1475
1564
  " Mirror tiling"
1476
1565
  ] }),
1477
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1478
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1479
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1480
- import_paint_editor8.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1481
- import_paint_editor8.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1482
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1483
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1566
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1567
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1568
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1569
+ import_paint_editor9.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1570
+ import_paint_editor9.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1571
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1572
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1484
1573
  "button",
1485
1574
  {
1486
1575
  type: "button",
1487
1576
  "aria-pressed": tiltFollow,
1488
1577
  className: chip(tiltFollow),
1489
1578
  onClick: () => attempt(async () => {
1490
- if (!tiltFollow && !await (0, import_paint_editor8.requestDeviceTiltPermission)()) return;
1579
+ if (!tiltFollow && !await (0, import_paint_editor9.requestDeviceTiltPermission)()) return;
1491
1580
  setTiltFollow((v) => !v);
1492
1581
  }),
1493
1582
  children: "Device tilt"
1494
1583
  }
1495
1584
  ),
1496
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1585
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1497
1586
  ] })
1498
1587
  ] }),
1499
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1500
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1501
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1502
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1588
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1589
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1590
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1591
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1503
1592
  " UV blacklight"
1504
1593
  ] }),
1505
- import_paint_editor8.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1506
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1507
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1508
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" }),
1509
- state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1594
+ import_paint_editor9.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1595
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1596
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1597
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" }),
1598
+ state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1510
1599
  Math.round(state.heat.max * 100),
1511
1600
  "% warm"
1512
1601
  ] })
1513
1602
  ] })
1514
1603
  ] }),
1515
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FerroPanel, { controller }),
1516
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TimeMachinePanel, { controller }),
1517
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1604
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FerroPanel, { controller }),
1605
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TimeMachinePanel, { controller }),
1606
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CulturePanel, { controller }),
1607
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1518
1608
  ] });
1519
1609
  };
1520
1610
 
1521
1611
  // src/paint-editor/ColorPanel.tsx
1522
1612
  var import_react13 = require("react");
1523
- var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1524
1613
  var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1525
- var import_jsx_runtime14 = require("react/jsx-runtime");
1614
+ var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1615
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1526
1616
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
1527
1617
  const state = usePaintEditorState(controller);
1528
1618
  const [error, attempt] = useAttempt();
@@ -1533,54 +1623,54 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1533
1623
  const [parts, setParts] = (0, import_react13.useState)([1, 1]);
1534
1624
  const [padName, setPadName] = (0, import_react13.useState)("");
1535
1625
  const padPoints = (0, import_react13.useRef)(null);
1536
- const ring = (0, import_react13.useMemo)(() => (0, import_paint_editor9.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1626
+ const ring = (0, import_react13.useMemo)(() => (0, import_paint_editor10.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1537
1627
  const color = state.color;
1538
1628
  const harmony = (0, import_react13.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1539
- const [r, g, b] = (0, import_paint_editor9.parseHexColor)(color);
1540
- const hsv = (0, import_paint_editor9.rgbToHsv)(r, g, b);
1629
+ const [r, g, b] = (0, import_paint_editor10.parseHexColor)(color);
1630
+ const hsv = (0, import_paint_editor10.rgbToHsv)(r, g, b);
1541
1631
  const effectWell = (0, import_react13.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1542
- const pad = (0, import_react13.useMemo)(() => ({ width: import_paint_editor9.MIXING_PAD_WIDTH, height: import_paint_editor9.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1632
+ const pad = (0, import_react13.useMemo)(() => ({ width: import_paint_editor10.MIXING_PAD_WIDTH, height: import_paint_editor10.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1543
1633
  const R = wheelSize / 2;
1544
1634
  const mid = R * 0.82;
1545
- const setHsv = (s, v) => controller.setColor((0, import_paint_editor9.rgbToHexColor)(...(0, import_paint_editor9.hsvToRgb)(hsv.h, s, v)));
1635
+ const setHsv = (s, v) => controller.setColor((0, import_paint_editor10.rgbToHexColor)(...(0, import_paint_editor10.hsvToRgb)(hsv.h, s, v)));
1546
1636
  const padPoint = (e) => {
1547
1637
  const rect = e.currentTarget.getBoundingClientRect();
1548
- const kx = import_paint_editor9.MIXING_PAD_WIDTH / (rect.width || import_paint_editor9.MIXING_PAD_WIDTH);
1549
- const ky = import_paint_editor9.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor9.MIXING_PAD_HEIGHT);
1550
- const x = Math.min(import_paint_editor9.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1551
- const y = Math.min(import_paint_editor9.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1638
+ const kx = import_paint_editor10.MIXING_PAD_WIDTH / (rect.width || import_paint_editor10.MIXING_PAD_WIDTH);
1639
+ const ky = import_paint_editor10.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor10.MIXING_PAD_HEIGHT);
1640
+ const x = Math.min(import_paint_editor10.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1641
+ const y = Math.min(import_paint_editor10.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1552
1642
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
1553
1643
  };
1554
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1555
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1556
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1644
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1645
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1646
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1557
1647
  "div",
1558
1648
  {
1559
1649
  role: "slider",
1560
1650
  "aria-label": "Hue wheel",
1561
1651
  "aria-valuemin": 0,
1562
1652
  "aria-valuemax": 360,
1563
- "aria-valuenow": Math.round((0, import_paint_editor9.hueToWheel)(hsv.h, wheel)),
1653
+ "aria-valuenow": Math.round((0, import_paint_editor10.hueToWheel)(hsv.h, wheel)),
1564
1654
  tabIndex: 0,
1565
1655
  className: "absolute inset-0 cursor-crosshair",
1566
1656
  onPointerDown: (e) => {
1567
1657
  const rect = e.currentTarget.getBoundingClientRect();
1568
- controller.setColor((0, import_paint_editor9.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1658
+ controller.setColor((0, import_paint_editor10.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1569
1659
  },
1570
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1660
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1571
1661
  }
1572
1662
  ),
1573
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1574
- const p = (0, import_paint_editor9.wheelPoint)(h.angle, mid);
1575
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1663
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1664
+ const p = (0, import_paint_editor10.wheelPoint)(h.angle, mid);
1665
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1576
1666
  }) }),
1577
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1667
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1578
1668
  ] }),
1579
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
1580
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1581
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1582
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1669
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
1670
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1671
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1672
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1673
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1584
1674
  "input",
1585
1675
  {
1586
1676
  "aria-label": "Hex colour",
@@ -1591,49 +1681,49 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1591
1681
  color
1592
1682
  )
1593
1683
  ] }),
1594
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1595
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1684
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1685
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1596
1686
  "span",
1597
1687
  {
1598
1688
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
1599
1689
  "aria-label": state.effectPaint ? `Effect paint: ${state.effectPaint.effect}` : state.paint.type === "gradient" ? "Gradient paint" : "Paint colour",
1600
1690
  "data-testid": "paint-well",
1601
1691
  "data-effect-paint": state.effectPaint ? state.effectPaint.effect : void 0,
1602
- style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor10.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1692
+ style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor11.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1603
1693
  }
1604
1694
  ),
1605
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1695
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1606
1696
  "button",
1607
1697
  {
1608
1698
  type: "button",
1609
1699
  className: chip(state.paint.type === "gradient"),
1610
1700
  "aria-pressed": state.paint.type === "gradient",
1611
1701
  title: "Paint that changes colour as the stroke goes",
1612
- onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor10.DEFAULT_PAINT_GRADIENT)),
1702
+ onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor11.DEFAULT_PAINT_GRADIENT)),
1613
1703
  children: "Gradient"
1614
1704
  }
1615
1705
  )
1616
1706
  ] }),
1617
- state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1618
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1619
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1620
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1707
+ state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1708
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1709
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1710
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1621
1711
  ] }),
1622
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1623
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1624
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1712
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1713
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1714
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1625
1715
  ] }),
1626
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1627
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor9.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: k, children: k }, k)) }),
1628
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1629
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1716
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
1717
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor10.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: k, children: k }, k)) }),
1718
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1719
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1630
1720
  ] }),
1631
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1632
- harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1633
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1721
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1722
+ harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1723
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1634
1724
  ] }),
1635
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1636
- state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1725
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1726
+ state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1637
1727
  "button",
1638
1728
  {
1639
1729
  type: "button",
@@ -1642,7 +1732,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1642
1732
  "aria-label": s.name ?? (s.paint ? "Gradient" : s.color),
1643
1733
  title: `${s.name ?? (s.paint ? "Gradient" : s.color)} (right-click to remove)`,
1644
1734
  className: "h-5 w-5 rounded ring-1 ring-slate-700",
1645
- style: { background: s.paint ? (0, import_paint_editor10.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1735
+ style: { background: s.paint ? (0, import_paint_editor11.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1646
1736
  onClick: () => attempt(() => s.paint ? controller.setPaint(s.paint) : controller.setColor(s.color)),
1647
1737
  onContextMenu: (e) => {
1648
1738
  e.preventDefault();
@@ -1651,15 +1741,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1651
1741
  },
1652
1742
  i
1653
1743
  )),
1654
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1744
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1655
1745
  ] }),
1656
- mixingPad && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1657
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1658
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1659
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1660
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1746
+ mixingPad && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1747
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
1748
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1749
+ ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1750
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1661
1751
  ] }),
1662
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1752
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1663
1753
  "div",
1664
1754
  {
1665
1755
  role: "application",
@@ -1668,7 +1758,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1668
1758
  onPointerDown: (e) => {
1669
1759
  const p = padPoint(e);
1670
1760
  if (padTool === "pick") {
1671
- attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor9.padSampleRadius)(sample) }));
1761
+ attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor10.padSampleRadius)(sample) }));
1672
1762
  return;
1673
1763
  }
1674
1764
  padPoints.current = [p];
@@ -1680,20 +1770,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1680
1770
  padPoints.current = null;
1681
1771
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1682
1772
  },
1683
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor9.MIXING_PAD_WIDTH} / ${import_paint_editor9.MIXING_PAD_HEIGHT}` } })
1773
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor10.MIXING_PAD_WIDTH} / ${import_paint_editor10.MIXING_PAD_HEIGHT}` } })
1684
1774
  }
1685
1775
  ),
1686
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
1687
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1688
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor9.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1776
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
1777
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1778
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor10.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1689
1779
  ] }) }),
1690
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1691
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1692
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1693
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-500", children: ":" }),
1694
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1695
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1696
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1780
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1781
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1782
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1783
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-500", children: ":" }),
1784
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1785
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1786
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1697
1787
  "button",
1698
1788
  {
1699
1789
  type: "button",
@@ -1712,22 +1802,22 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1712
1802
  }
1713
1803
  )
1714
1804
  ] }),
1715
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1716
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1717
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1805
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1806
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1807
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1718
1808
  ] }),
1719
- state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "flex items-center gap-1", children: [
1720
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1721
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1809
+ state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: "flex items-center gap-1", children: [
1810
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1811
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1722
1812
  ] }, p.id)) })
1723
1813
  ] }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1814
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1725
1815
  ] });
1726
1816
  };
1727
1817
 
1728
1818
  // src/paint-editor/PaintLayersPanel.tsx
1729
1819
  var import_react16 = require("react");
1730
- var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1820
+ var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1731
1821
 
1732
1822
  // src/image-editor/LayerEffectsPanel.tsx
1733
1823
  var import_react15 = require("react");
@@ -1740,16 +1830,16 @@ var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent"
1740
1830
 
1741
1831
  // src/image-editor/controls/controls.tsx
1742
1832
  var import_react14 = require("react");
1743
- var import_jsx_runtime15 = require("react/jsx-runtime");
1833
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1744
1834
  var ControlsContext = (0, import_react14.createContext)({});
1745
1835
  function useImageEditorControls() {
1746
1836
  return (0, import_react14.useContext)(ControlsContext);
1747
1837
  }
1748
1838
  function ImageCheckbox(props) {
1749
1839
  const Host = useImageEditorControls().Checkbox;
1750
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1840
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1751
1841
  const { checked, label, disabled, onChange, className = "" } = props;
1752
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1842
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1753
1843
  "input",
1754
1844
  {
1755
1845
  type: "checkbox",
@@ -1763,9 +1853,9 @@ function ImageCheckbox(props) {
1763
1853
  }
1764
1854
  function ImageRange(props) {
1765
1855
  const Host = useImageEditorControls().Range;
1766
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1856
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1767
1857
  const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1768
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1858
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1769
1859
  "input",
1770
1860
  {
1771
1861
  type: "range",
@@ -1786,18 +1876,18 @@ function ImageRange(props) {
1786
1876
  }
1787
1877
  function ImageSelect(props) {
1788
1878
  const Host = useImageEditorControls().Select;
1789
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1879
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1790
1880
  const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1791
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1792
- placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: placeholder }),
1793
- options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.value, children: o.label }, o.value))
1881
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1882
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: placeholder }),
1883
+ options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: o.value, children: o.label }, o.value))
1794
1884
  ] });
1795
1885
  }
1796
1886
  function ImageColor(props) {
1797
1887
  const Host = useImageEditorControls().Color;
1798
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1888
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1799
1889
  const { value, label, alpha, disabled, onChange, className = "" } = props;
1800
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1890
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1801
1891
  "input",
1802
1892
  {
1803
1893
  type: "color",
@@ -1811,7 +1901,7 @@ function ImageColor(props) {
1811
1901
  }
1812
1902
 
1813
1903
  // src/image-editor/LayerEffectsPanel.tsx
1814
- var import_jsx_runtime16 = require("react/jsx-runtime");
1904
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1815
1905
  var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1816
1906
  const [, setTick] = (0, import_react15.useState)(0);
1817
1907
  (0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
@@ -1830,7 +1920,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1830
1920
  }
1831
1921
  };
1832
1922
  if (!model.available || !id) {
1833
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1923
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1834
1924
  }
1835
1925
  const effects = controller.getLayerEffects(id);
1836
1926
  const patterns = controller.getDocumentPatterns();
@@ -1845,14 +1935,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1845
1935
  case "range": {
1846
1936
  const k = c.percent ? 100 : 1;
1847
1937
  const shown = Math.round(c.value * k * 100) / 100;
1848
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1849
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-muted-foreground", children: [
1938
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1939
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-muted-foreground", children: [
1850
1940
  label,
1851
1941
  " ",
1852
1942
  shown,
1853
1943
  c.unit
1854
1944
  ] }),
1855
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1945
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1856
1946
  ImageRange,
1857
1947
  {
1858
1948
  label,
@@ -1869,19 +1959,19 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1869
1959
  ] }, c.key);
1870
1960
  }
1871
1961
  case "color":
1872
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1873
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1962
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1963
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1874
1964
  label
1875
1965
  ] }, c.key);
1876
1966
  case "checkbox":
1877
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1878
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1967
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1968
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1879
1969
  label
1880
1970
  ] }, c.key);
1881
1971
  case "select":
1882
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1883
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: label }),
1884
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1972
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1973
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: label }),
1974
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1885
1975
  ImageSelect,
1886
1976
  {
1887
1977
  label,
@@ -1894,16 +1984,16 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1894
1984
  ] }, c.key);
1895
1985
  }
1896
1986
  };
1897
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1898
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1899
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1900
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1901
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1987
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1988
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1989
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1990
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1991
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1902
1992
  "On"
1903
1993
  ] }),
1904
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1994
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1905
1995
  "Scale",
1906
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1996
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1907
1997
  "input",
1908
1998
  {
1909
1999
  type: "number",
@@ -1922,7 +2012,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1922
2012
  ),
1923
2013
  "%"
1924
2014
  ] }),
1925
- heading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2015
+ heading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1926
2016
  ImageSelect,
1927
2017
  {
1928
2018
  label: "Add style",
@@ -1938,14 +2028,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1938
2028
  }
1939
2029
  )
1940
2030
  ] }),
1941
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1942
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
2031
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
2032
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1943
2033
  const effect = effects.items.find((e) => e.id === row.id);
1944
2034
  const expanded = open === row.id;
1945
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1946
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1947
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1948
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2035
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
2036
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
2037
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
2038
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1949
2039
  "button",
1950
2040
  {
1951
2041
  type: "button",
@@ -1955,17 +2045,17 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1955
2045
  children: row.label
1956
2046
  }
1957
2047
  ),
1958
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
2048
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1959
2049
  ] }),
1960
- expanded && /* @__PURE__ */ (0, import_jsx_runtime16.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_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
2050
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime17.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_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1961
2051
  ] }, row.id);
1962
2052
  }) }),
1963
- error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-destructive", children: error })
2053
+ error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1964
2054
  ] });
1965
2055
  };
1966
2056
 
1967
2057
  // src/paint-editor/PaintLayersPanel.tsx
1968
- var import_jsx_runtime17 = require("react/jsx-runtime");
2058
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1969
2059
  function siblingIndex(layers, l) {
1970
2060
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1971
2061
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1983,18 +2073,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1983
2073
  const to = Math.min(count - 1, Math.max(0, index + delta));
1984
2074
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1985
2075
  };
1986
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1987
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1988
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1989
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1990
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1991
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1992
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1993
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1994
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1995
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
2076
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
2077
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2078
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
2079
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
2080
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
2081
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
2082
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
2083
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
2084
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
2085
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1996
2086
  ] }),
1997
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2087
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1998
2088
  "li",
1999
2089
  {
2000
2090
  role: "treeitem",
@@ -2003,7 +2093,7 @@ var PaintLayersPanel = ({ controller, className }) => {
2003
2093
  style: { paddingLeft: 6 + l.depth * 12 },
2004
2094
  onClick: () => controller.setActiveLayer(l.id),
2005
2095
  children: [
2006
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2096
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2007
2097
  "button",
2008
2098
  {
2009
2099
  type: "button",
@@ -2016,7 +2106,7 @@ var PaintLayersPanel = ({ controller, className }) => {
2016
2106
  children: l.visible ? "\u25CF" : "\u25CB"
2017
2107
  }
2018
2108
  ),
2019
- renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2109
+ renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2020
2110
  "input",
2021
2111
  {
2022
2112
  autoFocus: true,
@@ -2033,23 +2123,23 @@ var PaintLayersPanel = ({ controller, className }) => {
2033
2123
  if (e.key === "Escape") setRenaming(null);
2034
2124
  }
2035
2125
  }
2036
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
2126
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
2037
2127
  l.type === "group" ? "\u25B8 " : "",
2038
- l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
2128
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
2039
2129
  "\u270E",
2040
2130
  " "
2041
2131
  ] }),
2042
2132
  l.name
2043
2133
  ] }),
2044
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
2134
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
2045
2135
  ]
2046
2136
  },
2047
2137
  l.id
2048
2138
  )) }),
2049
- active && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2050
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2051
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
2052
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2139
+ active && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2140
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2141
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
2142
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2053
2143
  "input",
2054
2144
  {
2055
2145
  type: "range",
@@ -2063,40 +2153,40 @@ var PaintLayersPanel = ({ controller, className }) => {
2063
2153
  }
2064
2154
  )
2065
2155
  ] }),
2066
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2067
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
2068
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
2069
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "pass-through", children: "Pass through" }),
2070
- import_paint_editor11.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
2156
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2157
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
2158
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
2159
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "pass-through", children: "Pass through" }),
2160
+ import_paint_editor12.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
2071
2161
  ] })
2072
2162
  ] }),
2073
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-1", children: [
2074
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
2075
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2163
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-1", children: [
2164
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
2165
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2076
2166
  ] }),
2077
- light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2078
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between", children: [
2079
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2080
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2167
+ light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2168
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2169
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2170
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2081
2171
  ] }),
2082
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
2083
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2084
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2172
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
2173
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2174
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2085
2175
  ] }),
2086
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2087
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2088
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2176
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2177
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2178
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2089
2179
  ] })
2090
2180
  ] }),
2091
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2181
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2092
2182
  ] }),
2093
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorLine, { error })
2183
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
2094
2184
  ] });
2095
2185
  };
2096
2186
 
2097
2187
  // src/paint-editor/WetPanel.tsx
2098
- var import_paint_editor12 = require("@pixerate/editor/paint-editor");
2099
- var import_jsx_runtime18 = require("react/jsx-runtime");
2188
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2189
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2100
2190
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
2101
2191
  var WetPanel = ({ controller, className }) => {
2102
2192
  const state = usePaintEditorState(controller);
@@ -2106,31 +2196,31 @@ var WetPanel = ({ controller, className }) => {
2106
2196
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
2107
2197
  const livePattern = layerId ? controller.getLivePatterns(layerId).layers[0] ?? null : null;
2108
2198
  const backend = controller.wetState();
2109
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2110
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2111
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2112
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2199
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2200
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2201
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2202
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2113
2203
  "step ",
2114
2204
  wet.clock
2115
2205
  ] })
2116
2206
  ] }),
2117
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2118
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2119
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2120
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2121
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
2122
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2207
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2208
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2209
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2210
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2211
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
2212
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2123
2213
  ] }),
2124
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: import_paint_editor12.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2125
- import_paint_editor12.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2126
- info && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2127
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2128
- import_paint_editor12.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2129
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2130
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2131
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2214
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: import_paint_editor13.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2215
+ import_paint_editor13.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2216
+ info && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2217
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2218
+ import_paint_editor13.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2219
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2220
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2221
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor13.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2132
2222
  ] }),
2133
- info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2223
+ info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2134
2224
  PaintSlider,
2135
2225
  {
2136
2226
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -2139,10 +2229,10 @@ var WetPanel = ({ controller, className }) => {
2139
2229
  }
2140
2230
  )
2141
2231
  ] }),
2142
- livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2143
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2144
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2145
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2232
+ livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2233
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2234
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2235
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2146
2236
  "button",
2147
2237
  {
2148
2238
  type: "button",
@@ -2157,35 +2247,35 @@ var WetPanel = ({ controller, className }) => {
2157
2247
  }
2158
2248
  )
2159
2249
  ] }),
2160
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2161
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2162
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2250
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2251
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2252
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2163
2253
  "select",
2164
2254
  {
2165
2255
  "aria-label": "Live pattern",
2166
2256
  value: livePattern.settings.pattern,
2167
2257
  onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { pattern: e.target.value }))),
2168
2258
  className: "rounded bg-slate-800 px-1 py-0.5",
2169
- children: import_paint_editor12.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: k, children: import_paint_editor12.LIVE_PATTERN_LABELS[k] }, k))
2259
+ children: import_paint_editor13.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k, children: import_paint_editor13.LIVE_PATTERN_LABELS[k] }, k))
2170
2260
  }
2171
2261
  )
2172
2262
  ] }),
2173
- import_paint_editor12.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2263
+ import_paint_editor13.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2174
2264
  ] }),
2175
- backend.message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2176
- backend.backend && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
2177
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2178
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2179
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2265
+ backend.message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2266
+ backend.backend && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
2267
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2268
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2269
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor13.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2180
2270
  ] }),
2181
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor12.wetEngineSummary)(backend.engine) }),
2182
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
2271
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor13.wetEngineSummary)(backend.engine) }),
2272
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2183
2273
  ] });
2184
2274
  };
2185
2275
 
2186
2276
  // src/paint-editor/StickerPanel.tsx
2187
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2188
- var import_jsx_runtime19 = require("react/jsx-runtime");
2277
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2278
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2189
2279
  var StickerPanel = ({ controller, className }) => {
2190
2280
  const state = usePaintEditorState(controller);
2191
2281
  const [error, attempt] = useAttempt();
@@ -2195,16 +2285,16 @@ var StickerPanel = ({ controller, className }) => {
2195
2285
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
2196
2286
  if (!stickers.length) return null;
2197
2287
  const sel = stickers.find((s) => s.id === picked) ?? null;
2198
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2199
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-medium text-slate-300", children: [
2288
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2289
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2200
2290
  "Stickers (",
2201
2291
  stickers.length,
2202
2292
  ")"
2203
2293
  ] }),
2204
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor13.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
2205
- sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2206
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2207
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2294
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor14.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
2295
+ sel && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2296
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2297
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2208
2298
  StickerPicker,
2209
2299
  {
2210
2300
  controller,
@@ -2218,9 +2308,9 @@ var StickerPanel = ({ controller, className }) => {
2218
2308
  )
2219
2309
  }
2220
2310
  ),
2221
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2222
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Position" }),
2223
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2311
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2312
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Position" }),
2313
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2224
2314
  "input",
2225
2315
  {
2226
2316
  type: "number",
@@ -2234,24 +2324,24 @@ var StickerPanel = ({ controller, className }) => {
2234
2324
  `${sel.id}-${k}-${sel[k]}`
2235
2325
  )) })
2236
2326
  ] }),
2237
- import_paint_editor13.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2238
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between", children: [
2239
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2240
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2327
+ import_paint_editor14.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2328
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between", children: [
2329
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2330
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2241
2331
  ] }),
2242
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2243
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2244
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2245
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2332
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2333
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2334
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2335
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2246
2336
  ] })
2247
2337
  ] }),
2248
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2338
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2249
2339
  ] });
2250
2340
  };
2251
2341
 
2252
2342
  // src/paint-editor/StrokePanel.tsx
2253
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2254
- var import_jsx_runtime20 = require("react/jsx-runtime");
2343
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2344
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2255
2345
  var StrokePanel = ({ controller, className }) => {
2256
2346
  const state = usePaintEditorState(controller);
2257
2347
  const [error, attempt] = useAttempt();
@@ -2260,17 +2350,17 @@ var StrokePanel = ({ controller, className }) => {
2260
2350
  if (!layerId || !strokes) return null;
2261
2351
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
2262
2352
  const sel = index >= 0 ? strokes[index] : null;
2263
- const brushes = state.brushes.filter((b) => !(0, import_paint_editor14.liveStrokeRefusal)(b));
2264
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2265
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
2266
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2353
+ const brushes = state.brushes.filter((b) => !(0, import_paint_editor15.liveStrokeRefusal)(b));
2354
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2355
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
2356
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-medium text-slate-300", children: [
2267
2357
  "Strokes (",
2268
2358
  strokes.length,
2269
2359
  ")"
2270
2360
  ] }),
2271
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2361
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2272
2362
  ] }),
2273
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2363
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2274
2364
  "button",
2275
2365
  {
2276
2366
  type: "button",
@@ -2283,10 +2373,10 @@ var StrokePanel = ({ controller, className }) => {
2283
2373
  },
2284
2374
  s.id
2285
2375
  )) }),
2286
- sel && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2287
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2288
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2289
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2376
+ sel && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2377
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2378
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2379
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2290
2380
  "select",
2291
2381
  {
2292
2382
  "aria-label": "Stroke brush",
@@ -2294,41 +2384,41 @@ var StrokePanel = ({ controller, className }) => {
2294
2384
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
2295
2385
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
2296
2386
  children: [
2297
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: sel.brush.name }),
2298
- brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: b.id, children: b.name }, b.id))
2387
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: sel.brush.name }),
2388
+ brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: b.id, children: b.name }, b.id))
2299
2389
  ]
2300
2390
  }
2301
2391
  )
2302
2392
  ] }),
2303
- import_paint_editor14.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
2304
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between", children: [
2305
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2306
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2393
+ import_paint_editor15.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor15.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
2394
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between", children: [
2395
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2396
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2307
2397
  ] }),
2308
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2309
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2310
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
2311
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2312
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2398
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2399
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2400
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
2401
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2402
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2313
2403
  ] })
2314
2404
  ] }),
2315
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2405
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2316
2406
  ] });
2317
2407
  };
2318
2408
 
2319
2409
  // src/paint-editor/PathStrokePanel.tsx
2320
2410
  var import_react17 = require("react");
2321
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2322
- var import_jsx_runtime21 = require("react/jsx-runtime");
2411
+ var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2412
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2323
2413
  var PathStrokePanel = ({ controller, className }) => {
2324
2414
  const state = usePaintEditorState(controller);
2325
2415
  const [error, attempt] = useAttempt();
2326
2416
  const [path, setPath] = (0, import_react17.useState)("");
2327
- const [taper, setTaper] = (0, import_react17.useState)(import_paint_editor15.PATH_STROKE_TAPERS[0].id);
2328
- const pressure = import_paint_editor15.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2329
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2330
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2331
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2417
+ const [taper, setTaper] = (0, import_react17.useState)(import_paint_editor16.PATH_STROKE_TAPERS[0].id);
2418
+ const pressure = import_paint_editor16.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2419
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2420
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2421
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2332
2422
  "textarea",
2333
2423
  {
2334
2424
  "aria-label": "SVG path data",
@@ -2339,18 +2429,18 @@ var PathStrokePanel = ({ controller, className }) => {
2339
2429
  className: "w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"
2340
2430
  }
2341
2431
  ),
2342
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
2343
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor15.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2344
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2432
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
2433
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor16.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2434
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2345
2435
  ] }),
2346
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2436
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
2347
2437
  ] });
2348
2438
  };
2349
2439
 
2350
2440
  // src/paint-editor/EvolutionPanel.tsx
2351
2441
  var import_react18 = require("react");
2352
- var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2353
- var import_jsx_runtime22 = require("react/jsx-runtime");
2442
+ var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2443
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2354
2444
  var EvolutionPanel = ({ controller, proposals, className }) => {
2355
2445
  const state = usePaintEditorState(controller);
2356
2446
  const store = proposals ?? controller.proposals;
@@ -2360,12 +2450,12 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2360
2450
  const [selectedProposals, setSelectedProposals] = (0, import_react18.useState)([]);
2361
2451
  const [count, setCount] = (0, import_react18.useState)(4);
2362
2452
  const [seed, setSeed] = (0, import_react18.useState)(1);
2363
- const [mutation, setMutation] = (0, import_react18.useState)(() => (0, import_paint_editor16.normalizeMutationRates)());
2453
+ const [mutation, setMutation] = (0, import_react18.useState)(() => (0, import_paint_editor17.normalizeMutationRates)());
2364
2454
  const [contactSheetUrl, setContactSheetUrl] = (0, import_react18.useState)(null);
2365
- const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor16.liveStrokeRefusal)(s.brush));
2455
+ const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor17.liveStrokeRefusal)(s.brush));
2366
2456
  const activeStrokeIds = selectedStrokes.filter((id) => eligibleStrokes.some((s) => s.id === id));
2367
2457
  const effectiveStrokeIds = activeStrokeIds.length > 0 ? activeStrokeIds : state.selectedStroke && eligibleStrokes.some((s) => s.id === state.selectedStroke) ? [state.selectedStroke] : eligibleStrokes.length > 0 ? [eligibleStrokes[eligibleStrokes.length - 1].id] : [];
2368
- const variants = proposalState.proposals.filter((p) => (0, import_paint_editor16.proposalGenomeStrokes)(p).length > 0);
2458
+ const variants = proposalState.proposals.filter((p) => (0, import_paint_editor17.proposalGenomeStrokes)(p).length > 0);
2369
2459
  const activeProposalIds = selectedProposals.filter((id) => variants.some((v) => v.id === id));
2370
2460
  const toggleStroke = (id) => {
2371
2461
  setSelectedStrokes((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-15), id]);
@@ -2373,16 +2463,16 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2373
2463
  const toggleProposal = (id) => {
2374
2464
  setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
2375
2465
  };
2376
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2377
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
2378
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "font-medium text-slate-300", children: [
2466
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2467
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
2468
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-medium text-slate-300", children: [
2379
2469
  "Evolution (",
2380
2470
  eligibleStrokes.length,
2381
2471
  ")"
2382
2472
  ] }),
2383
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2384
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Count" }),
2385
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2473
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2474
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Count" }),
2475
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2386
2476
  "input",
2387
2477
  {
2388
2478
  type: "number",
@@ -2396,9 +2486,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2396
2486
  )
2397
2487
  ] }) })
2398
2488
  ] }),
2399
- eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
2489
+ eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
2400
2490
  const on = effectiveStrokeIds.includes(s.id);
2401
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2491
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2402
2492
  "button",
2403
2493
  {
2404
2494
  type: "button",
@@ -2412,9 +2502,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2412
2502
  s.id
2413
2503
  );
2414
2504
  }) }),
2415
- import_paint_editor16.EVOLUTION_SLIDERS.map((c) => {
2505
+ import_paint_editor17.EVOLUTION_SLIDERS.map((c) => {
2416
2506
  const key = c.path;
2417
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2507
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2418
2508
  PaintSlider,
2419
2509
  {
2420
2510
  control: c,
@@ -2424,8 +2514,8 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2424
2514
  c.path
2425
2515
  );
2426
2516
  }),
2427
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2428
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2517
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2518
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2429
2519
  "button",
2430
2520
  {
2431
2521
  type: "button",
@@ -2438,7 +2528,7 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2438
2528
  children: "Breed strokes"
2439
2529
  }
2440
2530
  ),
2441
- activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2531
+ activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2442
2532
  "button",
2443
2533
  {
2444
2534
  type: "button",
@@ -2451,29 +2541,29 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2451
2541
  children: "Cross over (2)"
2452
2542
  }
2453
2543
  ),
2454
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2544
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2455
2545
  "button",
2456
2546
  {
2457
2547
  type: "button",
2458
2548
  className: button,
2459
2549
  onClick: () => attempt(() => {
2460
- const sheet = (0, import_paint_editor16.exportProposalContactSheetPng)(controller, variants);
2550
+ const sheet = (0, import_paint_editor17.exportProposalContactSheetPng)(controller, variants);
2461
2551
  setContactSheetUrl(`data:image/png;base64,${sheet.base64}`);
2462
2552
  }),
2463
2553
  children: "Contact sheet"
2464
2554
  }
2465
2555
  )
2466
2556
  ] }),
2467
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2468
- const g = (0, import_paint_editor16.paintProposalGhost)(p);
2557
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2558
+ const g = (0, import_paint_editor17.paintProposalGhost)(p);
2469
2559
  const picked = activeProposalIds.includes(p.id);
2470
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2560
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2471
2561
  "div",
2472
2562
  {
2473
2563
  "data-testid": `evolution-variant-${p.id}`,
2474
2564
  className: `flex flex-col gap-1 rounded border p-1.5 ${picked ? "border-indigo-500 bg-slate-800/90" : "border-slate-800 bg-slate-950/60"}`,
2475
2565
  children: [
2476
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2566
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2477
2567
  "button",
2478
2568
  {
2479
2569
  type: "button",
@@ -2483,10 +2573,10 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2483
2573
  children: p.title
2484
2574
  }
2485
2575
  ) }),
2486
- g && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2487
- p.rationale && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2488
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2489
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2576
+ g && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2577
+ p.rationale && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2578
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2579
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2490
2580
  "button",
2491
2581
  {
2492
2582
  type: "button",
@@ -2499,26 +2589,26 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2499
2589
  children: "Breed from"
2500
2590
  }
2501
2591
  ),
2502
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2503
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2592
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2593
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2504
2594
  ] })
2505
2595
  ]
2506
2596
  },
2507
2597
  p.id
2508
2598
  );
2509
2599
  }) }),
2510
- contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2511
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
2600
+ contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2601
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ErrorLine, { error })
2512
2602
  ] });
2513
2603
  };
2514
2604
 
2515
2605
  // src/paint-editor/PaintEditor.tsx
2516
2606
  var import_react32 = require("react");
2517
- var import_paint_editor18 = require("@pixerate/editor/paint-editor");
2607
+ var import_paint_editor19 = require("@pixerate/editor/paint-editor");
2518
2608
 
2519
2609
  // src/playback/AgentPlaybackContext.tsx
2520
2610
  var import_react19 = require("react");
2521
- var import_jsx_runtime23 = require("react/jsx-runtime");
2611
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2522
2612
  var AgentPlaybackContext = (0, import_react19.createContext)(null);
2523
2613
  function useAgentPlayback() {
2524
2614
  return (0, import_react19.useContext)(AgentPlaybackContext);
@@ -2567,12 +2657,12 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2567
2657
 
2568
2658
  // src/playback/PresenceLayer.tsx
2569
2659
  var import_react21 = __toESM(require("react"), 1);
2570
- var import_jsx_runtime24 = require("react/jsx-runtime");
2660
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2571
2661
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
2572
2662
  const { actors } = (0, import_react21.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2573
2663
  if (!actors.length) return null;
2574
2664
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
2575
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2665
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2576
2666
  "div",
2577
2667
  {
2578
2668
  className: `pixerate-presence ${className}`.trim(),
@@ -2586,19 +2676,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2586
2676
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
2587
2677
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
2588
2678
  })();
2589
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react21.default.Fragment, { children: [
2590
- ring && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2679
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react21.default.Fragment, { children: [
2680
+ ring && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2591
2681
  "div",
2592
2682
  {
2593
2683
  "data-actor-focus": a.id,
2594
2684
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
2595
2685
  }
2596
2686
  ),
2597
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2598
- /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.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 } }) }),
2599
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2600
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2601
- a.message && /* @__PURE__ */ (0, import_jsx_runtime24.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 })
2687
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
2688
+ /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.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 } }) }),
2689
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2690
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2691
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime25.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 })
2602
2692
  ] })
2603
2693
  ] }) })
2604
2694
  ] }, a.id);
@@ -2609,7 +2699,7 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2609
2699
 
2610
2700
  // src/paint-editor/PaintEffectsPanel.tsx
2611
2701
  var import_react31 = require("react");
2612
- var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2702
+ var import_paint_editor18 = require("@pixerate/editor/paint-editor");
2613
2703
  var import_effects4 = require("@pixerate/editor/effects");
2614
2704
 
2615
2705
  // src/effects/useEffects.ts
@@ -2634,7 +2724,7 @@ function useEffectDescription(provider, effect) {
2634
2724
  // src/effects/EffectThumbnail.tsx
2635
2725
  var import_react23 = require("react");
2636
2726
  var import_effects = require("@pixerate/editor/effects");
2637
- var import_jsx_runtime25 = require("react/jsx-runtime");
2727
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2638
2728
  var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
2639
2729
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2640
2730
  const ref = (0, import_react23.useRef)(null);
@@ -2654,13 +2744,13 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2654
2744
  live = false;
2655
2745
  };
2656
2746
  }, [provider, effect, width, height]);
2657
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2747
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2658
2748
  "div",
2659
2749
  {
2660
2750
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2661
2751
  style: { aspectRatio: `${width} / ${height}` },
2662
2752
  "data-effect-thumbnail": effect.id,
2663
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2753
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2664
2754
  }
2665
2755
  );
2666
2756
  }
@@ -2668,7 +2758,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2668
2758
  // src/effects/EffectsBrowser.tsx
2669
2759
  var import_react24 = require("react");
2670
2760
  var import_effects2 = require("@pixerate/editor/effects");
2671
- var import_jsx_runtime26 = require("react/jsx-runtime");
2761
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2672
2762
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2673
2763
  const [all, setAll] = (0, import_react24.useState)([]);
2674
2764
  const [query, setQuery] = (0, import_react24.useState)("");
@@ -2699,11 +2789,11 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2699
2789
  const categories = (0, import_react24.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2700
2790
  const shown = found.filter(allowed);
2701
2791
  if (!provider)
2702
- return /* @__PURE__ */ (0, import_jsx_runtime26.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." });
2703
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2704
- title && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2705
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2706
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2792
+ return /* @__PURE__ */ (0, import_jsx_runtime27.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." });
2793
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2794
+ title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2795
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2796
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2707
2797
  "input",
2708
2798
  {
2709
2799
  type: "search",
@@ -2714,17 +2804,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2714
2804
  onChange: (e) => setQuery(e.currentTarget.value)
2715
2805
  }
2716
2806
  ),
2717
- /* @__PURE__ */ (0, import_jsx_runtime26.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: [
2718
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "", children: "All categories" }),
2719
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: c, children: c }, c))
2807
+ /* @__PURE__ */ (0, import_jsx_runtime27.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: [
2808
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "All categories" }),
2809
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: c, children: c }, c))
2720
2810
  ] }),
2721
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime26.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: [
2722
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "", children: "Any use" }),
2723
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2811
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime27.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: [
2812
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "Any use" }),
2813
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2724
2814
  ] })
2725
2815
  ] }),
2726
- error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2727
- /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2816
+ error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2817
+ /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
2728
2818
  "button",
2729
2819
  {
2730
2820
  type: "button",
@@ -2733,13 +2823,13 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2733
2823
  "data-effect-id": e.id,
2734
2824
  onClick: () => onPick(e),
2735
2825
  children: [
2736
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(EffectThumbnail, { provider, effect: e }),
2737
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2738
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2826
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EffectThumbnail, { provider, effect: e }),
2827
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2828
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2739
2829
  ]
2740
2830
  }
2741
2831
  ) }, e.id)) }),
2742
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2832
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2743
2833
  ] });
2744
2834
  }
2745
2835
 
@@ -2764,7 +2854,7 @@ __export(color_exports, {
2764
2854
  // src/color/ColorPicker.tsx
2765
2855
  var import_react25 = require("react");
2766
2856
  var import_color = require("@pixerate/editor/color");
2767
- var import_jsx_runtime27 = require("react/jsx-runtime");
2857
+ var import_jsx_runtime28 = require("react/jsx-runtime");
2768
2858
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2769
2859
  function readLocalRecents() {
2770
2860
  try {
@@ -2971,7 +3061,7 @@ var ColorPicker = ({
2971
3061
  }, [value, contrastAgainst]);
2972
3062
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2973
3063
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2974
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3064
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2975
3065
  "div",
2976
3066
  {
2977
3067
  id: pickerId,
@@ -2995,7 +3085,7 @@ var ColorPicker = ({
2995
3085
  pointerEvents: disabled ? "none" : "auto"
2996
3086
  },
2997
3087
  children: [
2998
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3088
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2999
3089
  "span",
3000
3090
  {
3001
3091
  role: "status",
@@ -3014,7 +3104,7 @@ var ColorPicker = ({
3014
3104
  children: liveDescription
3015
3105
  }
3016
3106
  ),
3017
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3107
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3018
3108
  "div",
3019
3109
  {
3020
3110
  role: "slider",
@@ -3036,7 +3126,7 @@ var ColorPicker = ({
3036
3126
  touchAction: "none",
3037
3127
  outline: "none"
3038
3128
  },
3039
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3129
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3040
3130
  "div",
3041
3131
  {
3042
3132
  style: {
@@ -3056,7 +3146,7 @@ var ColorPicker = ({
3056
3146
  )
3057
3147
  }
3058
3148
  ),
3059
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3149
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3060
3150
  "div",
3061
3151
  {
3062
3152
  role: "slider",
@@ -3079,7 +3169,7 @@ var ColorPicker = ({
3079
3169
  touchAction: "none",
3080
3170
  outline: "none"
3081
3171
  },
3082
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3172
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3083
3173
  "div",
3084
3174
  {
3085
3175
  style: {
@@ -3099,7 +3189,7 @@ var ColorPicker = ({
3099
3189
  )
3100
3190
  }
3101
3191
  ),
3102
- alpha && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3192
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3103
3193
  "div",
3104
3194
  {
3105
3195
  role: "slider",
@@ -3125,7 +3215,7 @@ var ColorPicker = ({
3125
3215
  overflow: "hidden"
3126
3216
  },
3127
3217
  children: [
3128
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3218
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3129
3219
  "div",
3130
3220
  {
3131
3221
  style: {
@@ -3135,7 +3225,7 @@ var ColorPicker = ({
3135
3225
  }
3136
3226
  }
3137
3227
  ),
3138
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3228
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3139
3229
  "div",
3140
3230
  {
3141
3231
  style: {
@@ -3156,8 +3246,8 @@ var ColorPicker = ({
3156
3246
  ]
3157
3247
  }
3158
3248
  ),
3159
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3160
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3249
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3250
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3161
3251
  "div",
3162
3252
  {
3163
3253
  style: {
@@ -3171,7 +3261,7 @@ var ColorPicker = ({
3171
3261
  flexShrink: 0,
3172
3262
  border: "1px solid rgba(255,255,255,0.15)"
3173
3263
  },
3174
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3264
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3175
3265
  "div",
3176
3266
  {
3177
3267
  style: {
@@ -3183,7 +3273,7 @@ var ColorPicker = ({
3183
3273
  )
3184
3274
  }
3185
3275
  ),
3186
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3276
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3187
3277
  "input",
3188
3278
  {
3189
3279
  type: "text",
@@ -3213,7 +3303,7 @@ var ColorPicker = ({
3213
3303
  }
3214
3304
  }
3215
3305
  ),
3216
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3306
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3217
3307
  "button",
3218
3308
  {
3219
3309
  type: "button",
@@ -3233,7 +3323,7 @@ var ColorPicker = ({
3233
3323
  color: "inherit",
3234
3324
  cursor: disabled ? "default" : "pointer"
3235
3325
  },
3236
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3326
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3237
3327
  "svg",
3238
3328
  {
3239
3329
  width: "14",
@@ -3245,16 +3335,16 @@ var ColorPicker = ({
3245
3335
  strokeLinecap: "round",
3246
3336
  strokeLinejoin: "round",
3247
3337
  children: [
3248
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
3249
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3250
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m14 6 4 4" })
3338
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
3339
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3340
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 6 4 4" })
3251
3341
  ]
3252
3342
  }
3253
3343
  )
3254
3344
  }
3255
3345
  )
3256
3346
  ] }),
3257
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3347
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3258
3348
  "div",
3259
3349
  {
3260
3350
  role: "note",
@@ -3270,10 +3360,10 @@ var ColorPicker = ({
3270
3360
  borderRadius: "4px",
3271
3361
  alignSelf: "flex-start"
3272
3362
  },
3273
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3363
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3274
3364
  }
3275
3365
  ),
3276
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3366
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3277
3367
  "div",
3278
3368
  {
3279
3369
  style: {
@@ -3287,15 +3377,15 @@ var ColorPicker = ({
3287
3377
  border: "1px solid rgba(255,255,255,0.1)"
3288
3378
  },
3289
3379
  children: [
3290
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
3380
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3291
3381
  "Contrast: ",
3292
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("strong", { children: [
3382
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { children: [
3293
3383
  contrastResult.ratio.toFixed(2),
3294
3384
  ":1"
3295
3385
  ] })
3296
3386
  ] }),
3297
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3298
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3387
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3388
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3299
3389
  "span",
3300
3390
  {
3301
3391
  style: {
@@ -3308,7 +3398,7 @@ var ColorPicker = ({
3308
3398
  ]
3309
3399
  }
3310
3400
  ),
3311
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3401
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3312
3402
  "span",
3313
3403
  {
3314
3404
  style: {
@@ -3325,9 +3415,9 @@ var ColorPicker = ({
3325
3415
  ]
3326
3416
  }
3327
3417
  ),
3328
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3329
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3330
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3418
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3419
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3420
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3331
3421
  "button",
3332
3422
  {
3333
3423
  type: "button",
@@ -3353,9 +3443,9 @@ var ColorPicker = ({
3353
3443
  `${color}-${idx}`
3354
3444
  )) })
3355
3445
  ] }),
3356
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3357
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3358
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3446
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3447
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3448
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3359
3449
  "button",
3360
3450
  {
3361
3451
  type: "button",
@@ -3388,7 +3478,7 @@ var ColorPicker = ({
3388
3478
  // src/color/DualColorPicker.tsx
3389
3479
  var import_react26 = require("react");
3390
3480
  var import_color2 = require("@pixerate/editor/color");
3391
- var import_jsx_runtime28 = require("react/jsx-runtime");
3481
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3392
3482
  function DualColorPicker({
3393
3483
  value,
3394
3484
  onChange,
@@ -3447,7 +3537,7 @@ function DualColorPicker({
3447
3537
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
3448
3538
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
3449
3539
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
3450
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3540
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3451
3541
  "div",
3452
3542
  {
3453
3543
  className: `pixerate-dual-color-picker ${className}`,
@@ -3466,7 +3556,7 @@ function DualColorPicker({
3466
3556
  boxSizing: "border-box"
3467
3557
  },
3468
3558
  children: [
3469
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3559
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3470
3560
  "div",
3471
3561
  {
3472
3562
  role: "tablist",
@@ -3479,7 +3569,7 @@ function DualColorPicker({
3479
3569
  gap: "2px"
3480
3570
  },
3481
3571
  children: [
3482
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3572
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3483
3573
  "button",
3484
3574
  {
3485
3575
  type: "button",
@@ -3502,7 +3592,7 @@ function DualColorPicker({
3502
3592
  children: "Light"
3503
3593
  }
3504
3594
  ),
3505
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3595
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3506
3596
  "button",
3507
3597
  {
3508
3598
  type: "button",
@@ -3528,8 +3618,8 @@ function DualColorPicker({
3528
3618
  ]
3529
3619
  }
3530
3620
  ),
3531
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3532
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3621
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3622
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3533
3623
  "button",
3534
3624
  {
3535
3625
  type: "button",
@@ -3551,7 +3641,7 @@ function DualColorPicker({
3551
3641
  outline: "none"
3552
3642
  },
3553
3643
  children: [
3554
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3644
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3555
3645
  "span",
3556
3646
  {
3557
3647
  style: {
@@ -3563,11 +3653,11 @@ function DualColorPicker({
3563
3653
  }
3564
3654
  }
3565
3655
  ),
3566
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3656
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3567
3657
  ]
3568
3658
  }
3569
3659
  ),
3570
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3660
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3571
3661
  "button",
3572
3662
  {
3573
3663
  type: "button",
@@ -3589,7 +3679,7 @@ function DualColorPicker({
3589
3679
  outline: "none"
3590
3680
  },
3591
3681
  children: [
3592
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3682
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3593
3683
  "span",
3594
3684
  {
3595
3685
  style: {
@@ -3601,12 +3691,12 @@ function DualColorPicker({
3601
3691
  }
3602
3692
  }
3603
3693
  ),
3604
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3694
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3605
3695
  ]
3606
3696
  }
3607
3697
  )
3608
3698
  ] }),
3609
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3699
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3610
3700
  "div",
3611
3701
  {
3612
3702
  style: {
@@ -3617,7 +3707,7 @@ function DualColorPicker({
3617
3707
  padding: "2px 0"
3618
3708
  },
3619
3709
  children: [
3620
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3710
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3621
3711
  "label",
3622
3712
  {
3623
3713
  htmlFor: sameId,
@@ -3631,7 +3721,7 @@ function DualColorPicker({
3631
3721
  color: "#c4cad4"
3632
3722
  },
3633
3723
  children: [
3634
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3724
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3635
3725
  "input",
3636
3726
  {
3637
3727
  id: sameId,
@@ -3642,11 +3732,11 @@ function DualColorPicker({
3642
3732
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3643
3733
  }
3644
3734
  ),
3645
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Same in both" })
3735
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Same in both" })
3646
3736
  ]
3647
3737
  }
3648
3738
  ),
3649
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3739
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3650
3740
  "button",
3651
3741
  {
3652
3742
  type: "button",
@@ -3668,7 +3758,7 @@ function DualColorPicker({
3668
3758
  ]
3669
3759
  }
3670
3760
  ),
3671
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3761
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3672
3762
  "div",
3673
3763
  {
3674
3764
  "data-testid": "dual-contrast-summary",
@@ -3682,20 +3772,20 @@ function DualColorPicker({
3682
3772
  color: "#8c95a6"
3683
3773
  },
3684
3774
  children: [
3685
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3775
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
3686
3776
  "Light:",
3687
3777
  " ",
3688
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3778
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3689
3779
  dualContrast.light.ratio.toFixed(2),
3690
3780
  " (",
3691
3781
  dualContrast.light.level,
3692
3782
  ")"
3693
3783
  ] })
3694
3784
  ] }),
3695
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3785
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
3696
3786
  "Dark:",
3697
3787
  " ",
3698
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3788
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3699
3789
  dualContrast.dark.ratio.toFixed(2),
3700
3790
  " (",
3701
3791
  dualContrast.dark.level,
@@ -3705,7 +3795,7 @@ function DualColorPicker({
3705
3795
  ]
3706
3796
  }
3707
3797
  ),
3708
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3798
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3709
3799
  ColorPicker,
3710
3800
  {
3711
3801
  value: activeColor,
@@ -3793,7 +3883,7 @@ __reExport(color_exports, require("@pixerate/editor/color"));
3793
3883
 
3794
3884
  // src/parameters/controls.tsx
3795
3885
  var import_react28 = require("react");
3796
- var import_jsx_runtime29 = require("react/jsx-runtime");
3886
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3797
3887
  var ParameterComponentsContext = (0, import_react28.createContext)({});
3798
3888
  function useParameterComponents() {
3799
3889
  return (0, import_react28.useContext)(ParameterComponentsContext);
@@ -3808,7 +3898,7 @@ function resolveParameterComponents(explicit, context) {
3808
3898
  }
3809
3899
 
3810
3900
  // src/parameters/fields.tsx
3811
- var import_jsx_runtime30 = require("react/jsx-runtime");
3901
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3812
3902
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3813
3903
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3814
3904
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3863,7 +3953,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3863
3953
  if (typeof forwarded === "function") forwarded(el);
3864
3954
  else if (forwarded) forwarded.current = el;
3865
3955
  };
3866
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "text", ...props, ref: setRef });
3956
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "text", ...props, ref: setRef });
3867
3957
  }
3868
3958
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3869
3959
  function ParameterNumberInput(props) {
@@ -3897,9 +3987,9 @@ function ParameterNumberInput(props) {
3897
3987
  onCommit: handleCommit,
3898
3988
  onKeyDown: handleKeyDown
3899
3989
  };
3900
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3901
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterCommitInput, { ...inputProps }),
3902
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3990
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3991
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterCommitInput, { ...inputProps }),
3992
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3903
3993
  ] });
3904
3994
  }
3905
3995
  function ParameterSlider(props) {
@@ -3918,7 +4008,7 @@ function ParameterSlider(props) {
3918
4008
  dragging.current = false;
3919
4009
  onGestureEnd?.();
3920
4010
  };
3921
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterNumberInput, { ...props });
4011
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props });
3922
4012
  const step = (0, import_parameters.parameterStep)(field);
3923
4013
  const sliderProps = {
3924
4014
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3932,8 +4022,8 @@ function ParameterSlider(props) {
3932
4022
  className: rangeClass,
3933
4023
  style: parameterRangeStyle
3934
4024
  };
3935
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
3936
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4025
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4026
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3937
4027
  CustomSlider,
3938
4028
  {
3939
4029
  ...sliderProps,
@@ -3943,7 +4033,7 @@ function ParameterSlider(props) {
3943
4033
  onGestureStart: start,
3944
4034
  onGestureEnd: end
3945
4035
  }
3946
- ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4036
+ ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3947
4037
  "input",
3948
4038
  {
3949
4039
  type: "range",
@@ -3955,11 +4045,11 @@ function ParameterSlider(props) {
3955
4045
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3956
4046
  }
3957
4047
  ),
3958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
4048
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3959
4049
  ] });
3960
4050
  }
3961
4051
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3962
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4052
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3963
4053
  "button",
3964
4054
  {
3965
4055
  type: "button",
@@ -3970,7 +4060,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3970
4060
  disabled: disabled || field.readOnly,
3971
4061
  onClick: () => onChange(!value),
3972
4062
  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"}`,
3973
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4063
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3974
4064
  "span",
3975
4065
  {
3976
4066
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3987,7 +4077,7 @@ function ParameterSelect(props) {
3987
4077
  const options = (0, import_parameters.getChoiceOptions)(field);
3988
4078
  const off = disabled || field.readOnly;
3989
4079
  if (field.control === "segmented") {
3990
- return /* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)(
4080
+ return /* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.jsx)(
3991
4081
  "button",
3992
4082
  {
3993
4083
  type: "button",
@@ -4004,7 +4094,7 @@ function ParameterSelect(props) {
4004
4094
  }
4005
4095
  if (CustomSelect) {
4006
4096
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
4007
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4097
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4008
4098
  CustomSelect,
4009
4099
  {
4010
4100
  id,
@@ -4020,7 +4110,7 @@ function ParameterSelect(props) {
4020
4110
  );
4021
4111
  }
4022
4112
  const index = options.findIndex((o) => o.value === value);
4023
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4113
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4024
4114
  "select",
4025
4115
  {
4026
4116
  id,
@@ -4033,7 +4123,7 @@ function ParameterSelect(props) {
4033
4123
  },
4034
4124
  className: parameterInputClass,
4035
4125
  style: parameterSelectStyle,
4036
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
4126
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
4037
4127
  }
4038
4128
  );
4039
4129
  }
@@ -4071,7 +4161,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4071
4161
  };
4072
4162
  }, [open]);
4073
4163
  if (CustomColor) {
4074
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4164
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4075
4165
  CustomColor,
4076
4166
  {
4077
4167
  id,
@@ -4086,9 +4176,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4086
4176
  }
4087
4177
  );
4088
4178
  }
4089
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4090
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
4091
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4179
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4180
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4181
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4092
4182
  "button",
4093
4183
  {
4094
4184
  ref: buttonRef,
@@ -4099,10 +4189,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4099
4189
  disabled: off,
4100
4190
  onClick: () => setOpen((prev) => !prev),
4101
4191
  className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
4102
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4192
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4103
4193
  }
4104
4194
  ),
4105
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4195
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4106
4196
  ParameterCommitInput,
4107
4197
  {
4108
4198
  id,
@@ -4118,7 +4208,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4118
4208
  }
4119
4209
  )
4120
4210
  ] }),
4121
- open && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4211
+ open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4122
4212
  "div",
4123
4213
  {
4124
4214
  ref: popoverRef,
@@ -4132,7 +4222,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4132
4222
  },
4133
4223
  className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
4134
4224
  style: { background: "var(--popover, var(--background, #fff))" },
4135
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4225
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4136
4226
  ColorPicker,
4137
4227
  {
4138
4228
  value: shown,
@@ -4150,11 +4240,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4150
4240
  }
4151
4241
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
4152
4242
  const size = (0, import_parameters.vectorSize)(field);
4153
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4243
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4154
4244
  const component = (0, import_parameters.vectorComponentField)(field, i);
4155
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4156
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4157
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4245
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4246
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4247
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4158
4248
  ParameterNumberInput,
4159
4249
  {
4160
4250
  field: component,
@@ -4172,11 +4262,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
4172
4262
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4173
4263
  const off = disabled || field.readOnly;
4174
4264
  const name = (0, import_parameters.parameterLabel)(field);
4175
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "space-y-1.5", children: [
4176
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
4177
- /* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4178
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4179
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4265
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1.5", children: [
4266
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4267
+ /* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4268
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4269
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4180
4270
  ParameterCommitInput,
4181
4271
  {
4182
4272
  id,
@@ -4187,15 +4277,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4187
4277
  onCommit: (text) => onChange(text.trim())
4188
4278
  }
4189
4279
  ),
4190
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
4191
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4280
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
4281
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4192
4282
  "label",
4193
4283
  {
4194
4284
  style: parameterButtonStyle,
4195
4285
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
4196
4286
  children: [
4197
4287
  "Choose file\u2026",
4198
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4288
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4199
4289
  "input",
4200
4290
  {
4201
4291
  type: "file",
@@ -4213,7 +4303,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4213
4303
  ]
4214
4304
  }
4215
4305
  ),
4216
- value && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4306
+ value && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4217
4307
  "button",
4218
4308
  {
4219
4309
  type: "button",
@@ -4228,7 +4318,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4228
4318
  ] })
4229
4319
  ] })
4230
4320
  ] }),
4231
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4321
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4232
4322
  "button",
4233
4323
  {
4234
4324
  type: "button",
@@ -4238,14 +4328,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4238
4328
  disabled: off,
4239
4329
  onClick: () => onChange(o.url),
4240
4330
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
4241
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4331
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4242
4332
  },
4243
4333
  o.url
4244
4334
  )) })
4245
4335
  ] });
4246
4336
  }
4247
4337
  function ParameterText({ field, value, onChange, disabled, id }) {
4248
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4338
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4249
4339
  ParameterCommitInput,
4250
4340
  {
4251
4341
  id,
@@ -4264,24 +4354,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
4264
4354
  switch (field.type) {
4265
4355
  case "number":
4266
4356
  case "int":
4267
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4357
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4268
4358
  case "boolean":
4269
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4359
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4270
4360
  case "choice":
4271
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4361
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4272
4362
  case "color":
4273
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4363
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4274
4364
  case "vector":
4275
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4365
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4276
4366
  case "image":
4277
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4367
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4278
4368
  case "text":
4279
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4369
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4280
4370
  }
4281
4371
  }
4282
4372
 
4283
4373
  // src/effects/EffectParameters.tsx
4284
- var import_jsx_runtime31 = require("react/jsx-runtime");
4374
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4285
4375
  function EffectParameters({
4286
4376
  description,
4287
4377
  values,
@@ -4310,8 +4400,8 @@ function EffectParameters({
4310
4400
  if (preset) onPreset({ ...description.defaults, ...preset.values });
4311
4401
  }
4312
4402
  };
4313
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4314
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4403
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4404
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4315
4405
  CustomPresetSelect,
4316
4406
  {
4317
4407
  "aria-label": `${description.name} presets`,
@@ -4326,7 +4416,7 @@ function EffectParameters({
4326
4416
  ],
4327
4417
  onChange: (name) => handlePresetSelect(String(name))
4328
4418
  }
4329
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4419
+ ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4330
4420
  "select",
4331
4421
  {
4332
4422
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -4336,8 +4426,8 @@ function EffectParameters({
4336
4426
  disabled,
4337
4427
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
4338
4428
  children: [
4339
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4340
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4429
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4430
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4341
4431
  ]
4342
4432
  }
4343
4433
  )),
@@ -4347,14 +4437,14 @@ function EffectParameters({
4347
4437
  const keyed = keyframed?.has(field.id) ?? false;
4348
4438
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
4349
4439
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
4350
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4351
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4352
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4353
- keyed && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4440
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4441
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4442
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4443
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4354
4444
  renderControlAddon?.(field.id),
4355
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime31.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" })
4445
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime32.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" })
4356
4446
  ] }),
4357
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4447
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4358
4448
  ParameterFieldControl,
4359
4449
  {
4360
4450
  field,
@@ -4369,12 +4459,12 @@ function EffectParameters({
4369
4459
  )
4370
4460
  ] }, field.id);
4371
4461
  }),
4372
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4462
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4373
4463
  ] });
4374
4464
  }
4375
4465
 
4376
4466
  // src/paint-editor/PaintEffectsPanel.tsx
4377
- var import_jsx_runtime32 = require("react/jsx-runtime");
4467
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4378
4468
  function usePaintEffectsProvider(controller) {
4379
4469
  const [provider, setProvider] = (0, import_react31.useState)(controller.effectsProvider);
4380
4470
  (0, import_react31.useEffect)(() => {
@@ -4387,25 +4477,25 @@ function usePaintEffectsTools(registry, controller, options = {}) {
4387
4477
  const { id, namespace, readOnly, playbackSurface } = options;
4388
4478
  (0, import_react31.useEffect)(() => {
4389
4479
  if (!registry) return;
4390
- return registry.register((0, import_paint_editor17.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4480
+ return registry.register((0, import_paint_editor18.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4391
4481
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
4392
4482
  }
4393
4483
  function Controls({ provider, effect, name, values, apply }) {
4394
4484
  const { description, error } = useEffectDescription(provider, effect);
4395
4485
  const drags = (0, import_react31.useRef)(/* @__PURE__ */ new Set());
4396
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4486
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4397
4487
  'No effects provider: "',
4398
4488
  name ?? effect,
4399
4489
  '" is kept as it was drawn.'
4400
4490
  ] });
4401
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4402
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4491
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4492
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4403
4493
  const commit = (gesture) => {
4404
4494
  if (!gesture || drags.current.has(gesture)) return !gesture;
4405
4495
  drags.current.add(gesture);
4406
4496
  return true;
4407
4497
  };
4408
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4498
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4409
4499
  EffectParameters,
4410
4500
  {
4411
4501
  description,
@@ -4458,28 +4548,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
4458
4548
  };
4459
4549
  const toggle = (b) => setBrowse(browse === b ? null : b);
4460
4550
  const pixel = active?.type === "pixel";
4461
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4462
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4463
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4464
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4465
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4466
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4467
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
4468
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
4551
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4552
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4553
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4554
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4555
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4556
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4557
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
4558
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
4469
4559
  ] }),
4470
- !provider && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4471
- browse && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4472
- paper && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4473
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4474
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4560
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4561
+ browse && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4562
+ paper && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4563
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4564
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4475
4565
  "Paper: ",
4476
4566
  paper.name ?? paper.effect
4477
4567
  ] }),
4478
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4568
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4479
4569
  ] }),
4480
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4481
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4482
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4570
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4571
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4572
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4483
4573
  "input",
4484
4574
  {
4485
4575
  type: "range",
@@ -4501,43 +4591,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4501
4591
  `o${paper.opacity}`
4502
4592
  )
4503
4593
  ] }),
4504
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4505
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4506
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
4594
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4595
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4596
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
4507
4597
  const blend = e.currentTarget.value;
4508
4598
  run(() => controller.updatePaperEffect({ blend }));
4509
- }, children: import_paint_editor17.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: b, children: b }, b)) })
4599
+ }, children: import_paint_editor18.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: b, children: b }, b)) })
4510
4600
  ] }),
4511
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4601
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4512
4602
  ] }),
4513
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4514
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4515
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4516
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4603
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4604
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4605
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4606
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4517
4607
  "Paint: ",
4518
4608
  effectPaint.effect,
4519
4609
  state.effectPaintRendering ? " (rendering\u2026)" : ""
4520
4610
  ] }),
4521
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4611
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4522
4612
  ] }),
4523
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4524
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4525
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4613
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4614
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4615
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4526
4616
  "Along the stroke"
4527
4617
  ] }),
4528
- hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4529
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4618
+ hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4619
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4530
4620
  "Along the stroke (native)"
4531
4621
  ] }),
4532
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4533
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4622
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4623
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4534
4624
  "Live"
4535
4625
  ] })
4536
4626
  ] }),
4537
- effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4538
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4539
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-slate-400", children: "Length" }),
4540
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4627
+ effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4628
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4629
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-slate-400", children: "Length" }),
4630
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4541
4631
  "input",
4542
4632
  {
4543
4633
  type: "number",
@@ -4551,43 +4641,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4551
4641
  effectPaint.map.length
4552
4642
  )
4553
4643
  ] }),
4554
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4555
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "repeat", children: "Repeat" }),
4556
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "mirror", children: "Mirror" }),
4557
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "clamp", children: "Clamp" })
4644
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4645
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "repeat", children: "Repeat" }),
4646
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "mirror", children: "Mirror" }),
4647
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "clamp", children: "Clamp" })
4558
4648
  ] })
4559
4649
  ] }),
4560
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4650
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4561
4651
  ] }),
4562
- animation && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4563
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4652
+ animation && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4653
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4564
4654
  "Live paint: ",
4565
4655
  animation.strokes,
4566
4656
  " ",
4567
4657
  animation.strokes === 1 ? "stroke" : "strokes"
4568
4658
  ] }),
4569
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4570
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4571
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-slate-400", children: "fps" }),
4572
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4659
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4660
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4661
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-slate-400", children: "fps" }),
4662
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4573
4663
  ] })
4574
4664
  ] }),
4575
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4576
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4577
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4665
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4666
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4667
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4578
4668
  "Layer: ",
4579
4669
  layerEffect.name ?? layerEffect.effect
4580
4670
  ] }),
4581
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4671
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4582
4672
  ] }),
4583
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4673
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4584
4674
  ] }),
4585
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ErrorLine, { error })
4675
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ErrorLine, { error })
4586
4676
  ] });
4587
4677
  };
4588
4678
 
4589
4679
  // src/paint-editor/PaintEditor.tsx
4590
- var import_jsx_runtime33 = require("react/jsx-runtime");
4680
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4591
4681
  var PAINT_CONTROLS = {
4592
4682
  "mixing-pad": '[data-testid="mixing-pad"]',
4593
4683
  lighting: '[data-testid="light-panel"]',
@@ -4600,7 +4690,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4600
4690
  const tabRef = (0, import_react32.useRef)(tab);
4601
4691
  tabRef.current = tab;
4602
4692
  const rootRef = (0, import_react32.useRef)(null);
4603
- const [ownPresence] = (0, import_react32.useState)(() => new import_paint_editor18.PaintPresence());
4693
+ const [ownPresence] = (0, import_react32.useState)(() => new import_paint_editor19.PaintPresence());
4604
4694
  const ambientPlayback = useAgentPlayback();
4605
4695
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4606
4696
  const viewBox = () => {
@@ -4611,12 +4701,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4611
4701
  const docToClient = (p) => {
4612
4702
  const r = viewBox();
4613
4703
  if (!r) return null;
4614
- const q = (0, import_paint_editor18.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4704
+ const q = (0, import_paint_editor19.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4615
4705
  return { x: r.left + q.x, y: r.top + q.y };
4616
4706
  };
4617
4707
  const clientToDoc = (p) => {
4618
4708
  const r = viewBox();
4619
- return r ? (0, import_paint_editor18.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4709
+ return r ? (0, import_paint_editor19.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4620
4710
  };
4621
4711
  const elementRect = (selector) => {
4622
4712
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -4659,27 +4749,27 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4659
4749
  const [error, setError] = (0, import_react32.useState)(null);
4660
4750
  const effects = usePaintEffectsProvider(controller);
4661
4751
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
4662
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
4663
- playing && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4664
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4665
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4666
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4667
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4668
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4669
- error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4752
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
4753
+ playing && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4754
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4755
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4756
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4757
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4758
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4759
+ error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4670
4760
  ] }),
4671
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4672
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
4673
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4674
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColorPanel, { controller }),
4675
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(WetPanel, { controller }),
4676
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaperPanel, { controller }),
4677
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintLayersPanel, { controller }),
4678
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StrokePanel, { controller }),
4679
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PathStrokePanel, { controller }),
4680
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EvolutionPanel, { controller, proposals }),
4681
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StickerPanel, { controller }),
4682
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintEffectsPanel, { controller })
4761
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4762
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
4763
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4764
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ColorPanel, { controller }),
4765
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(WetPanel, { controller }),
4766
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaperPanel, { controller }),
4767
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintLayersPanel, { controller }),
4768
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StrokePanel, { controller }),
4769
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PathStrokePanel, { controller }),
4770
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EvolutionPanel, { controller, proposals }),
4771
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StickerPanel, { controller }),
4772
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintEffectsPanel, { controller })
4683
4773
  ] })
4684
4774
  ] })
4685
4775
  ] })
@@ -4691,6 +4781,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4691
4781
  BrushLibraryBrowser,
4692
4782
  BrushPanel,
4693
4783
  ColorPanel,
4784
+ CulturePanel,
4694
4785
  EvolutionPanel,
4695
4786
  FerroPanel,
4696
4787
  PaintCanvas,