@pixerate/editor-react 0.148.0 → 0.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
190
190
  }
191
191
 
192
192
  // src/image-editor/ImageEditor.tsx
193
- import React23, { useRef as useRef13, useEffect as useEffect17, useState as useState24 } from "react";
193
+ import React25, { useRef as useRef13, useEffect as useEffect17, useState as useState26 } from "react";
194
194
  import {
195
195
  normalizeProcessVersion,
196
196
  LATEST_PROCESS_VERSION,
@@ -1538,7 +1538,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1538
1538
  };
1539
1539
 
1540
1540
  // src/image-editor/LayersPanel.tsx
1541
- import { useEffect as useEffect6, useRef as useRef6, useState as useState8 } from "react";
1541
+ import { useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
1542
1542
 
1543
1543
  // src/image-editor/LayerEffectsPanel.tsx
1544
1544
  import { useEffect as useEffect5, useRef as useRef4, useState as useState6 } from "react";
@@ -1782,6 +1782,56 @@ var EdgeColorPanel = ({ controller, layer, className = "" }) => {
1782
1782
  ] });
1783
1783
  };
1784
1784
 
1785
+ // src/image-editor/VectorMaskEdgesPanel.tsx
1786
+ import { useState as useState8 } from "react";
1787
+ import { Fragment, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1788
+ var MODES = ["hard", "feather", "matte"];
1789
+ var input = "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground";
1790
+ var VectorMaskEdgesPanel = ({ controller, layer, className = "" }) => {
1791
+ const [error, setError] = useState8(null);
1792
+ const info = controller.getVectorMask(layer.id);
1793
+ if (!info) return null;
1794
+ const set = (e, mode, options = {}) => {
1795
+ setError(null);
1796
+ try {
1797
+ controller.setVectorMaskEdge(layer.id, { component: e.component, subpath: e.subpath, segment: e.segment }, mode, options);
1798
+ } catch (err) {
1799
+ setError(err instanceof Error ? err.message : String(err));
1800
+ }
1801
+ };
1802
+ const num = (v, fallback) => Number.isFinite(Number(v)) && Number(v) > 0 ? Number(v) : fallback;
1803
+ return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-1.5 text-xs ${className}`, "data-testid": "vector-mask-edges", children: [
1804
+ /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Vector mask edges" }),
1805
+ /* @__PURE__ */ jsx9("p", { className: "text-muted-foreground", children: "Alt+Shift-click a segment with Direct Selection to make it feathered or a hair matte." }),
1806
+ info.edges.length === 0 && /* @__PURE__ */ jsx9("p", { className: "text-muted-foreground", children: "Every segment is hard." }),
1807
+ /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-1", children: info.edges.map((e) => /* @__PURE__ */ jsxs9("li", { "data-testid": "vector-mask-edge", className: "flex flex-wrap items-center gap-1.5", children: [
1808
+ /* @__PURE__ */ jsxs9("span", { className: "font-mono text-muted-foreground", children: [
1809
+ e.component,
1810
+ "/",
1811
+ e.subpath,
1812
+ "/",
1813
+ e.segment
1814
+ ] }),
1815
+ /* @__PURE__ */ jsx9("select", { "aria-label": "Edge mode", value: e.mode, onChange: (ev) => set(e, ev.target.value), className: "bg-background border border-border rounded px-1 py-0.5 text-foreground", children: MODES.map((m) => /* @__PURE__ */ jsx9("option", { value: m, children: m }, m)) }),
1816
+ e.mode === "feather" && /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1817
+ "radius",
1818
+ /* @__PURE__ */ jsx9("input", { type: "number", min: 0.5, max: 250, step: 0.5, "aria-label": "Edge feather radius", value: e.radius, onChange: (ev) => set(e, "feather", { radius: num(ev.target.value, 4) }), className: input })
1819
+ ] }),
1820
+ e.mode === "matte" && /* @__PURE__ */ jsxs9(Fragment, { children: [
1821
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1822
+ "in",
1823
+ /* @__PURE__ */ jsx9("input", { type: "number", min: 0.5, max: 200, step: 0.5, "aria-label": "Edge matte inner", value: e.inner, onChange: (ev) => set(e, "matte", { inner: num(ev.target.value, 4), outer: e.outer }), className: input })
1824
+ ] }),
1825
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1826
+ "out",
1827
+ /* @__PURE__ */ jsx9("input", { type: "number", min: 0.5, max: 200, step: 0.5, "aria-label": "Edge matte outer", value: e.outer, onChange: (ev) => set(e, "matte", { inner: e.inner, outer: num(ev.target.value, 8) }), className: input })
1828
+ ] })
1829
+ ] })
1830
+ ] }, `${e.component}:${e.subpath}:${e.segment}`)) }),
1831
+ error && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-destructive", children: error })
1832
+ ] });
1833
+ };
1834
+
1785
1835
  // src/image-editor/LayersPanel.tsx
1786
1836
  import {
1787
1837
  BIT_DEPTH_OPTIONS,
@@ -1803,7 +1853,7 @@ import {
1803
1853
  layerPanelRows,
1804
1854
  runLayerMenuAction
1805
1855
  } from "@pixerate/editor/image-editor";
1806
- import { Fragment, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1856
+ import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1807
1857
  var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`;
1808
1858
  var Thumbnail = ({
1809
1859
  pixels,
@@ -1825,7 +1875,7 @@ var Thumbnail = ({
1825
1875
  img.data.set(pixels.data);
1826
1876
  ctx.putImageData(img, 0, 0);
1827
1877
  }, [pixels]);
1828
- return /* @__PURE__ */ jsx9(
1878
+ return /* @__PURE__ */ jsx10(
1829
1879
  "canvas",
1830
1880
  {
1831
1881
  ref,
@@ -1840,13 +1890,13 @@ var Thumbnail = ({
1840
1890
  );
1841
1891
  };
1842
1892
  var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
1843
- const [, setTick] = useState8(0);
1893
+ const [, setTick] = useState9(0);
1844
1894
  useEffect6(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1845
- const [error, setError] = useState8(null);
1846
- const [renaming, setRenaming] = useState8(null);
1847
- const [menu, setMenu] = useState8(null);
1848
- const [drag, setDrag] = useState8(null);
1849
- const [psdNotes, setPsdNotes] = useState8([]);
1895
+ const [error, setError] = useState9(null);
1896
+ const [renaming, setRenaming] = useState9(null);
1897
+ const [menu, setMenu] = useState9(null);
1898
+ const [drag, setDrag] = useState9(null);
1899
+ const [psdNotes, setPsdNotes] = useState9([]);
1850
1900
  const fileInput = useRef6(null);
1851
1901
  const psdTask = async (fn) => {
1852
1902
  try {
@@ -1896,14 +1946,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1896
1946
  const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
1897
1947
  const vectorThumb = (layer) => layer.vectorMask ? vectorMaskThumbnail(layer.vectorMask, state.imageDimensions.width, state.imageDimensions.height, 64) : null;
1898
1948
  const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
1899
- return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
1900
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
1901
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
1902
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
1903
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
1904
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
1905
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
1906
- /* @__PURE__ */ jsx9(
1949
+ return /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
1950
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
1951
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
1952
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
1953
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
1954
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
1955
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
1956
+ /* @__PURE__ */ jsx10(
1907
1957
  "button",
1908
1958
  {
1909
1959
  type: "button",
@@ -1918,7 +1968,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1918
1968
  children: "\u22EF"
1919
1969
  }
1920
1970
  ),
1921
- /* @__PURE__ */ jsx9(
1971
+ /* @__PURE__ */ jsx10(
1922
1972
  "select",
1923
1973
  {
1924
1974
  "aria-label": "Bits per channel",
@@ -1926,13 +1976,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1926
1976
  className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
1927
1977
  value: controller.bitDepth,
1928
1978
  onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
1929
- children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx9("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
1979
+ children: BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ jsx10("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
1930
1980
  }
1931
1981
  ),
1932
- psd && /* @__PURE__ */ jsxs9(Fragment, { children: [
1933
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
1934
- /* @__PURE__ */ jsx9("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
1935
- /* @__PURE__ */ jsx9(
1982
+ psd && /* @__PURE__ */ jsxs10(Fragment2, { children: [
1983
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
1984
+ /* @__PURE__ */ jsx10("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await downloadPsd(controller, psdFileName)).warnings), children: "Export PSD" }),
1985
+ /* @__PURE__ */ jsx10(
1936
1986
  "input",
1937
1987
  {
1938
1988
  ref: fileInput,
@@ -1950,18 +2000,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1950
2000
  )
1951
2001
  ] })
1952
2002
  ] }),
1953
- psdNotes.length > 0 && /* @__PURE__ */ jsxs9("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
1954
- psdNotes.map((n) => /* @__PURE__ */ jsx9("li", { children: n }, n)),
1955
- /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
2003
+ psdNotes.length > 0 && /* @__PURE__ */ jsxs10("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
2004
+ psdNotes.map((n) => /* @__PURE__ */ jsx10("li", { children: n }, n)),
2005
+ /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
1956
2006
  ] }),
1957
- active && /* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
1958
- /* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
1959
- /* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
2007
+ active && /* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
2008
+ /* @__PURE__ */ jsxs10("label", { className: "flex flex-col gap-0.5", children: [
2009
+ /* @__PURE__ */ jsxs10("span", { className: "text-muted-foreground", children: [
1960
2010
  "Opacity ",
1961
2011
  Math.round(active.opacity * 100),
1962
2012
  "%"
1963
2013
  ] }),
1964
- /* @__PURE__ */ jsx9(
2014
+ /* @__PURE__ */ jsx10(
1965
2015
  "input",
1966
2016
  {
1967
2017
  type: "range",
@@ -1975,13 +2025,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1975
2025
  }
1976
2026
  )
1977
2027
  ] }),
1978
- /* @__PURE__ */ jsxs9("label", { className: "flex flex-col gap-0.5", children: [
1979
- /* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
2028
+ /* @__PURE__ */ jsxs10("label", { className: "flex flex-col gap-0.5", children: [
2029
+ /* @__PURE__ */ jsxs10("span", { className: "text-muted-foreground", children: [
1980
2030
  "Fill ",
1981
2031
  Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
1982
2032
  "%"
1983
2033
  ] }),
1984
- /* @__PURE__ */ jsx9(
2034
+ /* @__PURE__ */ jsx10(
1985
2035
  "input",
1986
2036
  {
1987
2037
  type: "range",
@@ -1996,7 +2046,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1996
2046
  }
1997
2047
  )
1998
2048
  ] }),
1999
- /* @__PURE__ */ jsxs9(
2049
+ /* @__PURE__ */ jsxs10(
2000
2050
  "select",
2001
2051
  {
2002
2052
  "aria-label": "Layer blend mode",
@@ -2004,13 +2054,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2004
2054
  value: active.blend,
2005
2055
  onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
2006
2056
  children: [
2007
- active.type === "group" && /* @__PURE__ */ jsx9("option", { value: "pass-through", children: "Pass Through" }),
2008
- BLEND_MODES2.map((m) => /* @__PURE__ */ jsx9("option", { value: m.id, children: m.label }, m.id))
2057
+ active.type === "group" && /* @__PURE__ */ jsx10("option", { value: "pass-through", children: "Pass Through" }),
2058
+ BLEND_MODES2.map((m) => /* @__PURE__ */ jsx10("option", { value: m.id, children: m.label }, m.id))
2009
2059
  ]
2010
2060
  }
2011
2061
  ),
2012
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1.5 text-foreground", children: [
2013
- /* @__PURE__ */ jsx9(
2062
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5 text-foreground", children: [
2063
+ /* @__PURE__ */ jsx10(
2014
2064
  "input",
2015
2065
  {
2016
2066
  type: "checkbox",
@@ -2022,8 +2072,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2022
2072
  ),
2023
2073
  "Clip to below"
2024
2074
  ] }),
2025
- /* @__PURE__ */ jsx9("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
2026
- /* @__PURE__ */ jsx9(
2075
+ /* @__PURE__ */ jsx10("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
2076
+ /* @__PURE__ */ jsx10(
2027
2077
  "input",
2028
2078
  {
2029
2079
  type: "checkbox",
@@ -2036,11 +2086,12 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2036
2086
  k
2037
2087
  ] }, k)) })
2038
2088
  ] }),
2039
- active && (active.type === "pixel" || active.type === "shape" || active.type === "type" || active.type === "smart") && /* @__PURE__ */ jsx9(EdgeColorPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }, active.id),
2040
- effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx9(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
2041
- /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
2089
+ active && (active.type === "pixel" || active.type === "shape" || active.type === "type" || active.type === "smart") && /* @__PURE__ */ jsx10(EdgeColorPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }, active.id),
2090
+ active?.vectorMask && /* @__PURE__ */ jsx10(VectorMaskEdgesPanel, { controller, layer: active, className: "border-t border-border pt-1.5" }),
2091
+ effects && active && active.type !== "adjustment" && /* @__PURE__ */ jsx10(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
2092
+ /* @__PURE__ */ jsx10("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
2042
2093
  const { layer } = row;
2043
- return /* @__PURE__ */ jsxs9(
2094
+ return /* @__PURE__ */ jsxs10(
2044
2095
  "li",
2045
2096
  {
2046
2097
  role: "treeitem",
@@ -2070,7 +2121,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2070
2121
  className: rowClass(row.active),
2071
2122
  style: { paddingLeft: 6 + row.depth * 14 },
2072
2123
  children: [
2073
- /* @__PURE__ */ jsx9(
2124
+ /* @__PURE__ */ jsx10(
2074
2125
  "button",
2075
2126
  {
2076
2127
  type: "button",
@@ -2084,7 +2135,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2084
2135
  children: layer.visible ? "\u25CF" : "\u25CB"
2085
2136
  }
2086
2137
  ),
2087
- layer.type === "group" && /* @__PURE__ */ jsx9(
2138
+ layer.type === "group" && /* @__PURE__ */ jsx10(
2088
2139
  "button",
2089
2140
  {
2090
2141
  type: "button",
@@ -2097,9 +2148,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2097
2148
  children: layer.collapsed ? "\u25B8" : "\u25BE"
2098
2149
  }
2099
2150
  ),
2100
- row.clipped && /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
2101
- layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs9("span", { className: "relative shrink-0", children: [
2102
- /* @__PURE__ */ jsx9(
2151
+ row.clipped && /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
2152
+ layerHasThumbnail(layer) ? /* @__PURE__ */ jsxs10("span", { className: "relative shrink-0", children: [
2153
+ /* @__PURE__ */ jsx10(
2103
2154
  Thumbnail,
2104
2155
  {
2105
2156
  pixels: thumb(layer),
@@ -2115,7 +2166,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2115
2166
  }
2116
2167
  }
2117
2168
  ),
2118
- layer.type !== "pixel" && /* @__PURE__ */ jsx9(
2169
+ layer.type !== "pixel" && /* @__PURE__ */ jsx10(
2119
2170
  "span",
2120
2171
  {
2121
2172
  "data-testid": "layer-kind-badge",
@@ -2123,7 +2174,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2123
2174
  children: layerBadge(layer)
2124
2175
  }
2125
2176
  )
2126
- ] }) : /* @__PURE__ */ jsx9(
2177
+ ] }) : /* @__PURE__ */ jsx10(
2127
2178
  "span",
2128
2179
  {
2129
2180
  className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
@@ -2131,7 +2182,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2131
2182
  children: layerBadge(layer)
2132
2183
  }
2133
2184
  ),
2134
- layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ jsx9(
2185
+ layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ jsx10(
2135
2186
  "button",
2136
2187
  {
2137
2188
  type: "button",
@@ -2147,7 +2198,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2147
2198
  children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
2148
2199
  }
2149
2200
  ),
2150
- layer.mask && /* @__PURE__ */ jsx9(
2201
+ layer.mask && /* @__PURE__ */ jsx10(
2151
2202
  Thumbnail,
2152
2203
  {
2153
2204
  pixels: maskThumb(layer),
@@ -2162,7 +2213,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2162
2213
  }
2163
2214
  }
2164
2215
  ),
2165
- layer.vectorMask && /* @__PURE__ */ jsx9(
2216
+ layer.vectorMask && /* @__PURE__ */ jsx10(
2166
2217
  Thumbnail,
2167
2218
  {
2168
2219
  pixels: vectorThumb(layer),
@@ -2176,7 +2227,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2176
2227
  }
2177
2228
  }
2178
2229
  ),
2179
- renaming === layer.id ? /* @__PURE__ */ jsx9(
2230
+ renaming === layer.id ? /* @__PURE__ */ jsx10(
2180
2231
  "input",
2181
2232
  {
2182
2233
  autoFocus: true,
@@ -2193,7 +2244,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2193
2244
  if (e.key === "Escape") setRenaming(null);
2194
2245
  }
2195
2246
  }
2196
- ) : /* @__PURE__ */ jsx9(
2247
+ ) : /* @__PURE__ */ jsx10(
2197
2248
  "span",
2198
2249
  {
2199
2250
  className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
@@ -2204,8 +2255,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2204
2255
  children: row.label
2205
2256
  }
2206
2257
  ),
2207
- layerWarning(layer) && /* @__PURE__ */ jsx9("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
2208
- layerEffectsBadge(layer) && /* @__PURE__ */ jsx9(
2258
+ layerWarning(layer) && /* @__PURE__ */ jsx10("span", { role: "img", "data-testid": "layer-warning", "aria-label": layerWarning(layer), title: layerWarning(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
2259
+ layerEffectsBadge(layer) && /* @__PURE__ */ jsx10(
2209
2260
  "button",
2210
2261
  {
2211
2262
  type: "button",
@@ -2220,15 +2271,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2220
2271
  children: "fx"
2221
2272
  }
2222
2273
  ),
2223
- locked(layer) && /* @__PURE__ */ jsx9("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
2224
- layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx9("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
2274
+ locked(layer) && /* @__PURE__ */ jsx10("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
2275
+ layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ jsx10("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
2225
2276
  ]
2226
2277
  },
2227
2278
  layer.id
2228
2279
  );
2229
2280
  }) }),
2230
- error && /* @__PURE__ */ jsx9("p", { role: "alert", className: "text-destructive", children: error }),
2231
- menu && /* @__PURE__ */ jsx9(
2281
+ error && /* @__PURE__ */ jsx10("p", { role: "alert", className: "text-destructive", children: error }),
2282
+ menu && /* @__PURE__ */ jsx10(
2232
2283
  "div",
2233
2284
  {
2234
2285
  role: "menu",
@@ -2237,7 +2288,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2237
2288
  style: { left: menu.x, top: menu.y },
2238
2289
  onClick: (e) => e.stopPropagation(),
2239
2290
  onKeyDown: (e) => e.key === "Escape" && setMenu(null),
2240
- children: layerMenu(controller).map((item) => /* @__PURE__ */ jsx9(
2291
+ children: layerMenu(controller).map((item) => /* @__PURE__ */ jsx10(
2241
2292
  "button",
2242
2293
  {
2243
2294
  type: "button",
@@ -2255,14 +2306,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2255
2306
  };
2256
2307
 
2257
2308
  // src/image-editor/ImageProviderEffectsPanel.tsx
2258
- import { useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
2309
+ import { useEffect as useEffect7, useRef as useRef7, useState as useState10 } from "react";
2259
2310
  import { EFFECT_LAYER_USES, effectLayerTiming, findLayer } from "@pixerate/editor/image-editor";
2260
2311
 
2261
2312
  // src/image-editor/controls/parameterControls.tsx
2262
2313
  import { matchParameterOptionValue } from "@pixerate/editor/parameters";
2263
- import { jsx as jsx10 } from "react/jsx-runtime";
2314
+ import { jsx as jsx11 } from "react/jsx-runtime";
2264
2315
  function ImageParameterSlider({ value, min, max, step, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
2265
- return /* @__PURE__ */ jsx10(
2316
+ return /* @__PURE__ */ jsx11(
2266
2317
  ImageRange,
2267
2318
  {
2268
2319
  value,
@@ -2279,7 +2330,7 @@ function ImageParameterSlider({ value, min, max, step, label, disabled, classNam
2279
2330
  );
2280
2331
  }
2281
2332
  function ImageParameterSelect({ value, options, label, disabled, className, onChange }) {
2282
- return /* @__PURE__ */ jsx10(
2333
+ return /* @__PURE__ */ jsx11(
2283
2334
  ImageSelect,
2284
2335
  {
2285
2336
  value: String(value),
@@ -2292,7 +2343,7 @@ function ImageParameterSelect({ value, options, label, disabled, className, onCh
2292
2343
  );
2293
2344
  }
2294
2345
  function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
2295
- return /* @__PURE__ */ jsx10(
2346
+ return /* @__PURE__ */ jsx11(
2296
2347
  ImageColor,
2297
2348
  {
2298
2349
  value,
@@ -2315,33 +2366,33 @@ function imageEditorParameterComponents(controls) {
2315
2366
  }
2316
2367
 
2317
2368
  // src/image-editor/ImageEffectControls.tsx
2318
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2369
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2319
2370
  function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className, components }) {
2320
2371
  const { description, error } = useEffectDescription(provider, effect);
2321
2372
  const fallback = resolveParameterComponents(useParameterComponents(), imageEditorParameterComponents(useImageEditorControls()));
2322
2373
  const effectiveComponents = resolveParameterComponents(components, fallback);
2323
2374
  let body;
2324
- if (!provider) body = /* @__PURE__ */ jsxs10("p", { className: "text-[11px] text-muted-foreground", children: [
2375
+ if (!provider) body = /* @__PURE__ */ jsxs11("p", { className: "text-[11px] text-muted-foreground", children: [
2325
2376
  'No effects provider: "',
2326
2377
  name ?? effect,
2327
2378
  '" is kept but not drawn.'
2328
2379
  ] });
2329
- else if (error) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-amber-600", children: error });
2330
- else if (!description) body = /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
2331
- else body = /* @__PURE__ */ jsx11(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
2332
- return /* @__PURE__ */ jsx11("div", { className, "data-testid": "image-effect-controls", children: body });
2380
+ else if (error) body = /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-amber-600", children: error });
2381
+ else if (!description) body = /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
2382
+ else body = /* @__PURE__ */ jsx12(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
2383
+ return /* @__PURE__ */ jsx12("div", { className, "data-testid": "image-effect-controls", children: body });
2333
2384
  }
2334
2385
 
2335
2386
  // src/image-editor/ImageProviderEffectsPanel.tsx
2336
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2387
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2337
2388
  var fmt = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
2338
2389
  function ImageProviderEffectsPanel({ controller, className = "", components }) {
2339
- const [, setTick] = useState9(0);
2390
+ const [, setTick] = useState10(0);
2340
2391
  useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2341
- const [browse, setBrowse] = useState9(null);
2342
- const [message, setMessage] = useState9(null);
2343
- const [open, setOpen] = useState9(null);
2344
- const [scrubbed, setScrubbed] = useState9(null);
2392
+ const [browse, setBrowse] = useState10(null);
2393
+ const [message, setMessage] = useState10(null);
2394
+ const [open, setOpen] = useState10(null);
2395
+ const [scrubbed, setScrubbed] = useState10(null);
2345
2396
  const provider = controller.effectsProvider;
2346
2397
  const state = controller.getState();
2347
2398
  const layer = state.activeLayerId ? findLayer(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -2384,18 +2435,18 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2384
2435
  });
2385
2436
  };
2386
2437
  const shown = scrubbed ?? timing?.time ?? 0;
2387
- return /* @__PURE__ */ jsxs11("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
2388
- !provider && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
2389
- generator && layer && /* @__PURE__ */ jsxs11("div", { className: "space-y-2", "data-effect-part": "generator", children: [
2390
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
2391
- /* @__PURE__ */ jsx12("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
2392
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
2393
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
2438
+ return /* @__PURE__ */ jsxs12("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
2439
+ !provider && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
2440
+ generator && layer && /* @__PURE__ */ jsxs12("div", { className: "space-y-2", "data-effect-part": "generator", children: [
2441
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
2442
+ /* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
2443
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
2444
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
2394
2445
  ] }),
2395
- browse === "change" && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
2396
- timing && /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
2397
- /* @__PURE__ */ jsxs11("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
2398
- /* @__PURE__ */ jsx12(
2446
+ browse === "change" && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
2447
+ timing && /* @__PURE__ */ jsxs12("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
2448
+ /* @__PURE__ */ jsxs12("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
2449
+ /* @__PURE__ */ jsx13(
2399
2450
  "button",
2400
2451
  {
2401
2452
  type: "button",
@@ -2406,7 +2457,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2406
2457
  children: "Still frame"
2407
2458
  }
2408
2459
  ),
2409
- /* @__PURE__ */ jsx12(
2460
+ /* @__PURE__ */ jsx13(
2410
2461
  "button",
2411
2462
  {
2412
2463
  type: "button",
@@ -2418,9 +2469,9 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2418
2469
  }
2419
2470
  )
2420
2471
  ] }),
2421
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
2422
- /* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
2423
- /* @__PURE__ */ jsx12(
2472
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2473
+ /* @__PURE__ */ jsx13("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
2474
+ /* @__PURE__ */ jsx13(
2424
2475
  ImageRange,
2425
2476
  {
2426
2477
  min: 0,
@@ -2434,11 +2485,11 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2434
2485
  onChange: (t) => scrubTo(layer.id, t)
2435
2486
  }
2436
2487
  ),
2437
- /* @__PURE__ */ jsx12("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
2488
+ /* @__PURE__ */ jsx13("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
2438
2489
  ] }),
2439
- timing.mode === "animate" && /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5", children: [
2440
- /* @__PURE__ */ jsx12("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
2441
- /* @__PURE__ */ jsx12(
2490
+ timing.mode === "animate" && /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2491
+ /* @__PURE__ */ jsx13("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
2492
+ /* @__PURE__ */ jsx13(
2442
2493
  "input",
2443
2494
  {
2444
2495
  type: "number",
@@ -2455,13 +2506,13 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2455
2506
  },
2456
2507
  timing.duration
2457
2508
  ),
2458
- /* @__PURE__ */ jsxs11("span", { className: "text-muted-foreground", children: [
2509
+ /* @__PURE__ */ jsxs12("span", { className: "text-muted-foreground", children: [
2459
2510
  "s",
2460
2511
  timing.loops ? ` \xB7 loops every ${fmt(timing.range)}` : ""
2461
2512
  ] })
2462
2513
  ] })
2463
2514
  ] }),
2464
- /* @__PURE__ */ jsx12(
2515
+ /* @__PURE__ */ jsx13(
2465
2516
  ImageEffectControls,
2466
2517
  {
2467
2518
  provider,
@@ -2474,19 +2525,19 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2474
2525
  }
2475
2526
  )
2476
2527
  ] }),
2477
- layer && canFilter && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
2478
- /* @__PURE__ */ jsx12("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
2479
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
2528
+ layer && canFilter && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
2529
+ /* @__PURE__ */ jsx13("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
2530
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
2480
2531
  ] }),
2481
- browse === "filter" && layer && /* @__PURE__ */ jsx12(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
2482
- filters.length > 0 && layer && /* @__PURE__ */ jsx12("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
2532
+ browse === "filter" && layer && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
2533
+ filters.length > 0 && layer && /* @__PURE__ */ jsx13("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
2483
2534
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
2484
2535
  const all = layer.smartFilters.filters;
2485
2536
  const index = all.indexOf(f);
2486
2537
  if (f.kind !== "effect") return null;
2487
- return /* @__PURE__ */ jsxs11("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
2488
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
2489
- /* @__PURE__ */ jsx12(
2538
+ return /* @__PURE__ */ jsxs12("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
2539
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
2540
+ /* @__PURE__ */ jsx13(
2490
2541
  ImageCheckbox,
2491
2542
  {
2492
2543
  checked: f.enabled,
@@ -2494,15 +2545,15 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2494
2545
  onChange: (enabled) => run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }))
2495
2546
  }
2496
2547
  ),
2497
- /* @__PURE__ */ jsx12("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
2498
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
2499
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
2500
- /* @__PURE__ */ jsx12("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
2548
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
2549
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
2550
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
2551
+ /* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
2501
2552
  ] }),
2502
- open === f.id && /* @__PURE__ */ jsxs11("div", { className: "mt-1 space-y-2", children: [
2503
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
2504
- /* @__PURE__ */ jsx12("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
2505
- /* @__PURE__ */ jsx12(
2553
+ open === f.id && /* @__PURE__ */ jsxs12("div", { className: "mt-1 space-y-2", children: [
2554
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
2555
+ /* @__PURE__ */ jsx13("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
2556
+ /* @__PURE__ */ jsx13(
2506
2557
  ImageRange,
2507
2558
  {
2508
2559
  min: 0,
@@ -2515,7 +2566,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2515
2566
  }
2516
2567
  )
2517
2568
  ] }),
2518
- /* @__PURE__ */ jsx12(
2569
+ /* @__PURE__ */ jsx13(
2519
2570
  ImageEffectControls,
2520
2571
  {
2521
2572
  provider,
@@ -2530,14 +2581,14 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2530
2581
  ] })
2531
2582
  ] }, f.id);
2532
2583
  }) }),
2533
- layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties; new effect layers are added from the layers panel." }),
2534
- !layer && /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
2535
- message && /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2584
+ layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties; new effect layers are added from the layers panel." }),
2585
+ !layer && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
2586
+ message && /* @__PURE__ */ jsx13("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2536
2587
  ] });
2537
2588
  }
2538
2589
 
2539
2590
  // src/image-editor/BrushOptionsBar.tsx
2540
- import { useEffect as useEffect8, useState as useState10 } from "react";
2591
+ import { useEffect as useEffect8, useState as useState11 } from "react";
2541
2592
  import {
2542
2593
  BRUSH_OPTION_CONTROLS,
2543
2594
  MIXER_MIXING_OPTIONS,
@@ -2558,15 +2609,15 @@ import { DEFAULT_PAINT_GRADIENT, userErrorMessage } from "@pixerate/editor/image
2558
2609
 
2559
2610
  // src/image-editor/PaintGradientEditor.tsx
2560
2611
  import { PAINT_GRADIENT_KIT } from "@pixerate/editor/image-editor";
2561
- import { jsx as jsx13 } from "react/jsx-runtime";
2562
- var PaintGradientEditor = (props) => /* @__PURE__ */ jsx13(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
2612
+ import { jsx as jsx14 } from "react/jsx-runtime";
2613
+ var PaintGradientEditor = (props) => /* @__PURE__ */ jsx14(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
2563
2614
 
2564
2615
  // src/image-editor/BrushOptionsBar.tsx
2565
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2616
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2566
2617
  var BrushOptionsBar = ({ controller, className }) => {
2567
- const [, setTick] = useState10(0);
2618
+ const [, setTick] = useState11(0);
2568
2619
  useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2569
- const [error, setError] = useState10(null);
2620
+ const [error, setError] = useState11(null);
2570
2621
  const state = controller.getState();
2571
2622
  const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
2572
2623
  const tool = state.activeTool;
@@ -2578,8 +2629,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2578
2629
  setError(userErrorMessage(err));
2579
2630
  }
2580
2631
  };
2581
- return /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
2582
- /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx14(
2632
+ return /* @__PURE__ */ jsxs13("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
2633
+ /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx15(
2583
2634
  "button",
2584
2635
  {
2585
2636
  type: "button",
@@ -2591,18 +2642,18 @@ var BrushOptionsBar = ({ controller, className }) => {
2591
2642
  },
2592
2643
  t.id
2593
2644
  )) }),
2594
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2595
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
2596
- /* @__PURE__ */ jsx14(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
2597
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "FG" })
2645
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2646
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2647
+ /* @__PURE__ */ jsx15(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
2648
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "FG" })
2598
2649
  ] }),
2599
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
2600
- /* @__PURE__ */ jsx14(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
2601
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: "BG" })
2650
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2651
+ /* @__PURE__ */ jsx15(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
2652
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "BG" })
2602
2653
  ] }),
2603
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
2604
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
2605
- state.activeTool === "brush" && /* @__PURE__ */ jsx14(
2654
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
2655
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
2656
+ state.activeTool === "brush" && /* @__PURE__ */ jsx15(
2606
2657
  "button",
2607
2658
  {
2608
2659
  type: "button",
@@ -2614,8 +2665,8 @@ var BrushOptionsBar = ({ controller, className }) => {
2614
2665
  }
2615
2666
  )
2616
2667
  ] }),
2617
- state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx14(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
2618
- BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(
2668
+ state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ jsx15(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
2669
+ BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx15(
2619
2670
  ControlSlider,
2620
2671
  {
2621
2672
  spec,
@@ -2624,9 +2675,9 @@ var BrushOptionsBar = ({ controller, className }) => {
2624
2675
  },
2625
2676
  spec.id
2626
2677
  )),
2627
- state.activeTool === "mixer" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
2628
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2629
- /* @__PURE__ */ jsx14(
2678
+ state.activeTool === "mixer" && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
2679
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2680
+ /* @__PURE__ */ jsx15(
2630
2681
  "span",
2631
2682
  {
2632
2683
  "aria-label": "Brush load",
@@ -2635,10 +2686,10 @@ var BrushOptionsBar = ({ controller, className }) => {
2635
2686
  style: { background: mixerLoad.reservoir ? rgbUnitToHex(mixerLoad.reservoir) : "transparent" }
2636
2687
  }
2637
2688
  ),
2638
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
2639
- /* @__PURE__ */ jsx14("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
2689
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
2690
+ /* @__PURE__ */ jsx15("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
2640
2691
  ] }),
2641
- /* @__PURE__ */ jsx14("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx14(
2692
+ /* @__PURE__ */ jsx15("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ jsx15(
2642
2693
  "button",
2643
2694
  {
2644
2695
  type: "button",
@@ -2650,34 +2701,34 @@ var BrushOptionsBar = ({ controller, className }) => {
2650
2701
  },
2651
2702
  m.id
2652
2703
  )) }),
2653
- MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
2654
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
2655
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2656
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
2704
+ MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ jsx15(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
2705
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
2706
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2707
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
2657
2708
  "Load each stroke"
2658
2709
  ] }),
2659
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2660
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
2710
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2711
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
2661
2712
  "Clean each stroke"
2662
2713
  ] })
2663
2714
  ] })
2664
2715
  ] }),
2665
- isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
2666
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2667
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
2668
- cloneSource && /* @__PURE__ */ jsx14("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
2716
+ isRetouchPaintTool(tool) && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
2717
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2718
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: cloneSourceLabel(controller) }),
2719
+ cloneSource && /* @__PURE__ */ jsx15("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
2669
2720
  ] }),
2670
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
2671
- CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
2672
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
2673
- /* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className: imageChipClass(cloneTransformView(controller).flipH), onClick: () => setCloneTransformValue(controller, "flipH"), children: "Flip H" }),
2674
- /* @__PURE__ */ jsx14("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass(cloneTransformView(controller).flipV), onClick: () => setCloneTransformValue(controller, "flipV"), children: "Flip V" }),
2675
- !cloneTransformView(controller).identity && /* @__PURE__ */ jsx14("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
2721
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
2722
+ CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ jsx15(ControlSlider, { spec, value: cloneTransformView(controller)[spec.id], onChange: (v) => setCloneTransformValue(controller, spec.id, v) }, spec.id)),
2723
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
2724
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipH, title: "Mirror the source left to right", className: imageChipClass(cloneTransformView(controller).flipH), onClick: () => setCloneTransformValue(controller, "flipH"), children: "Flip H" }),
2725
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": cloneTransformView(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass(cloneTransformView(controller).flipV), onClick: () => setCloneTransformValue(controller, "flipV"), children: "Flip V" }),
2726
+ !cloneTransformView(controller).identity && /* @__PURE__ */ jsx15("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
2676
2727
  ] })
2677
2728
  ] }),
2678
- RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
2679
- /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: choice.label }),
2680
- choice.options.map((o) => /* @__PURE__ */ jsx14(
2729
+ RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
2730
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: choice.label }),
2731
+ choice.options.map((o) => /* @__PURE__ */ jsx15(
2681
2732
  "button",
2682
2733
  {
2683
2734
  type: "button",
@@ -2690,43 +2741,43 @@ var BrushOptionsBar = ({ controller, className }) => {
2690
2741
  o.id
2691
2742
  ))
2692
2743
  ] }, choice.id)),
2693
- RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx14(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
2694
- /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2695
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
2744
+ RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ jsx15(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
2745
+ /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-3 text-foreground", children: RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2746
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
2696
2747
  t.label
2697
2748
  ] }, t.id)) })
2698
2749
  ] }),
2699
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
2700
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2701
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
2750
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
2751
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2752
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
2702
2753
  "Pressure size"
2703
2754
  ] }),
2704
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1.5", children: [
2705
- /* @__PURE__ */ jsx14(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
2755
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5", children: [
2756
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
2706
2757
  "Pressure opacity"
2707
2758
  ] })
2708
2759
  ] }),
2709
- /* @__PURE__ */ jsxs12("div", { className: "flex gap-1", children: [
2710
- /* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
2711
- /* @__PURE__ */ jsx14("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
2760
+ /* @__PURE__ */ jsxs13("div", { className: "flex gap-1", children: [
2761
+ /* @__PURE__ */ jsx15("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
2762
+ /* @__PURE__ */ jsx15("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
2712
2763
  ] }),
2713
- error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "text-destructive", children: error })
2764
+ error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error })
2714
2765
  ] });
2715
2766
  };
2716
2767
 
2717
2768
  // src/image-editor/ColorProfilePanel.tsx
2718
- import { useEffect as useEffect9, useState as useState11 } from "react";
2769
+ import { useEffect as useEffect9, useState as useState12 } from "react";
2719
2770
  import { COLOR_MODE_OPTIONS, INTENT_OPTIONS, PROOF_PROFILE_OPTIONS, WORKING_SPACE_OPTIONS, colorPanelView } from "@pixerate/editor/image-editor";
2720
- import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2771
+ import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2721
2772
  var chip = imageChipClass(false);
2722
2773
  var select = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
2723
2774
  var ColorProfilePanel = ({ controller, className }) => {
2724
- const [, setTick] = useState11(0);
2775
+ const [, setTick] = useState12(0);
2725
2776
  useEffect9(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2726
- const [target, setTarget] = useState11("display-p3");
2727
- const [intent, setIntent] = useState11("relative");
2728
- const [bpc, setBpc] = useState11(true);
2729
- const [error, setError] = useState11(null);
2777
+ const [target, setTarget] = useState12("display-p3");
2778
+ const [intent, setIntent] = useState12("relative");
2779
+ const [bpc, setBpc] = useState12(true);
2780
+ const [error, setError] = useState12(null);
2730
2781
  const view = colorPanelView(controller);
2731
2782
  const attempt = (fn) => {
2732
2783
  try {
@@ -2748,29 +2799,29 @@ var ColorProfilePanel = ({ controller, className }) => {
2748
2799
  })
2749
2800
  );
2750
2801
  };
2751
- return /* @__PURE__ */ jsxs13("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
2752
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2753
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Profile" }),
2754
- /* @__PURE__ */ jsx15("span", { "data-testid": "color-profile-name", children: view.profileName })
2802
+ return /* @__PURE__ */ jsxs14("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
2803
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
2804
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Profile" }),
2805
+ /* @__PURE__ */ jsx16("span", { "data-testid": "color-profile-name", children: view.profileName })
2755
2806
  ] }),
2756
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
2757
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Mode" }),
2758
- /* @__PURE__ */ jsx15("select", { "aria-label": "Colour mode", className: select, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2759
- view.cmykProfileName && /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: view.cmykProfileName })
2807
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
2808
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Mode" }),
2809
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Colour mode", className: select, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2810
+ view.cmykProfileName && /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: view.cmykProfileName })
2760
2811
  ] }),
2761
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
2762
- /* @__PURE__ */ jsx15("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id)) }),
2763
- /* @__PURE__ */ jsx15("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2764
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2765
- /* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
2812
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
2813
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Target profile", className: select, value: target, onChange: (e) => setTarget(e.target.value), children: WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id)) }),
2814
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Rendering intent", className: select, value: intent, onChange: (e) => setIntent(e.target.value), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
2815
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
2816
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
2766
2817
  "BPC"
2767
2818
  ] }),
2768
- /* @__PURE__ */ jsx15("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
2769
- /* @__PURE__ */ jsx15("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
2819
+ /* @__PURE__ */ jsx16("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
2820
+ /* @__PURE__ */ jsx16("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
2770
2821
  ] }),
2771
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
2772
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Proof" }),
2773
- /* @__PURE__ */ jsxs13(
2822
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
2823
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Proof" }),
2824
+ /* @__PURE__ */ jsxs14(
2774
2825
  "select",
2775
2826
  {
2776
2827
  "aria-label": "Proof profile",
@@ -2778,29 +2829,88 @@ var ColorProfilePanel = ({ controller, className }) => {
2778
2829
  value: view.proof?.id ?? "",
2779
2830
  onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
2780
2831
  children: [
2781
- /* @__PURE__ */ jsx15("option", { value: "", children: "Off" }),
2782
- PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id))
2832
+ /* @__PURE__ */ jsx16("option", { value: "", children: "Off" }),
2833
+ PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id))
2783
2834
  ]
2784
2835
  }
2785
2836
  ),
2786
- view.proof && /* @__PURE__ */ jsxs13(Fragment2, { children: [
2787
- /* @__PURE__ */ jsx15("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx15("option", { value: o.id, children: o.label }, o.id)) }),
2788
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2789
- /* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
2837
+ view.proof && /* @__PURE__ */ jsxs14(Fragment3, { children: [
2838
+ /* @__PURE__ */ jsx16("select", { "aria-label": "Proof intent", className: select, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: INTENT_OPTIONS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id)) }),
2839
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
2840
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
2790
2841
  "Paper"
2791
2842
  ] }),
2792
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
2793
- /* @__PURE__ */ jsx15("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
2843
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
2844
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
2794
2845
  "Gamut warning"
2795
2846
  ] })
2796
2847
  ] })
2797
2848
  ] }),
2798
- error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error })
2849
+ error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error })
2850
+ ] });
2851
+ };
2852
+
2853
+ // src/image-editor/SelectionOptionsBar.tsx
2854
+ import { useRef as useRef10, useState as useState16 } from "react";
2855
+
2856
+ // src/image-editor/SelectionRecipePanel.tsx
2857
+ import { useState as useState13 } from "react";
2858
+ import { describeRecipeStep, recipeStepSetting } from "@pixerate/editor/image-editor";
2859
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
2860
+ var MODES2 = ["replace", "add", "subtract", "intersect"];
2861
+ var button = "px-1.5 py-0.5 rounded border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
2862
+ var SelectionRecipePanel = ({ controller, className = "" }) => {
2863
+ const [error, setError] = useState13(null);
2864
+ const recipe = controller.getSelectionRecipe();
2865
+ if (!recipe.live) return null;
2866
+ const run = (p) => {
2867
+ setError(null);
2868
+ Promise.resolve(p).catch((err) => setError(err instanceof Error ? err.message : String(err)));
2869
+ };
2870
+ return /* @__PURE__ */ jsxs15("div", { "data-testid": "selection-recipe", className: `flex flex-col gap-1 text-xs ${className}`, children: [
2871
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
2872
+ /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Selection steps" }),
2873
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, title: "Keep the selection, drop its steps", onClick: () => run(controller.freezeSelection()), children: "Freeze" })
2874
+ ] }),
2875
+ /* @__PURE__ */ jsx17("ol", { className: "flex flex-col gap-1", children: recipe.steps.map((step) => {
2876
+ const setting = recipeStepSetting(step);
2877
+ const shape = "mode" in step || ["rect", "ellipse", "polygon", "magic-wand", "color-range", "color-range-preset"].includes(step.op);
2878
+ return /* @__PURE__ */ jsxs15("li", { "data-testid": "selection-step", className: "flex flex-wrap items-center gap-1", children: [
2879
+ /* @__PURE__ */ jsx17("span", { className: "flex-1 min-w-0 truncate text-foreground", children: describeRecipeStep(step) }),
2880
+ shape && step.index > 0 && /* @__PURE__ */ jsx17(
2881
+ "select",
2882
+ {
2883
+ "aria-label": `Step ${step.index + 1} mode`,
2884
+ value: step.mode ?? "replace",
2885
+ onChange: (e) => run(controller.editSelectionStep(step.index, { mode: e.target.value })),
2886
+ className: "bg-background border border-border rounded px-1 py-0.5 text-foreground",
2887
+ children: MODES2.map((m) => /* @__PURE__ */ jsx17("option", { value: m, children: m }, m))
2888
+ }
2889
+ ),
2890
+ setting && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2891
+ setting.label,
2892
+ /* @__PURE__ */ jsx17(
2893
+ "input",
2894
+ {
2895
+ type: "number",
2896
+ min: setting.min,
2897
+ max: setting.max,
2898
+ "aria-label": `Step ${step.index + 1} ${setting.label}`,
2899
+ defaultValue: setting.value,
2900
+ onBlur: (e) => Number(e.target.value) !== setting.value && run(controller.editSelectionStep(step.index, setting.change(Number(e.target.value)))),
2901
+ onKeyDown: (e) => e.key === "Enter" && e.currentTarget.blur(),
2902
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
2903
+ }
2904
+ )
2905
+ ] }),
2906
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, "aria-label": `Remove step ${step.index + 1}`, disabled: recipe.steps.length === 1, onClick: () => run(controller.removeSelectionStep(step.index)), children: "\xD7" })
2907
+ ] }, `${step.index}:${JSON.stringify(step)}`);
2908
+ }) }),
2909
+ error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error })
2799
2910
  ] });
2800
2911
  };
2801
2912
 
2802
2913
  // src/image-editor/SelectionOptionsBar.tsx
2803
- import { useRef as useRef10, useState as useState14 } from "react";
2804
2914
  import {
2805
2915
  COLOR_RANGE_PRESETS,
2806
2916
  COLOR_RANGE_PRESET_LABELS,
@@ -2811,18 +2921,18 @@ import {
2811
2921
  } from "@pixerate/editor/image-editor";
2812
2922
 
2813
2923
  // src/image-editor/SelectAndMaskWorkspace.tsx
2814
- import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as useState12 } from "react";
2924
+ import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef8, useState as useState14 } from "react";
2815
2925
  import { REFINE_EDGE_CONTROLS, REFINE_OUTPUTS, SELECT_AND_MASK_TOOLS, SELECT_AND_MASK_VIEWS, SelectAndMaskSession } from "@pixerate/editor/image-editor";
2816
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2817
- var button = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
2818
- var toggle = (on) => `${button} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
2926
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2927
+ var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
2928
+ var toggle = (on) => `${button2} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
2819
2929
  var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2820
2930
  const session = useMemo4(() => new SelectAndMaskSession(controller), [controller]);
2821
- const [, setRevision] = useState12(0);
2822
- const [zoom, setZoom] = useState12(1);
2823
- const [pan, setPan] = useState12({ x: 0, y: 0 });
2824
- const [busy, setBusy] = useState12(false);
2825
- const [error, setError] = useState12(null);
2931
+ const [, setRevision] = useState14(0);
2932
+ const [zoom, setZoom] = useState14(1);
2933
+ const [pan, setPan] = useState14({ x: 0, y: 0 });
2934
+ const [busy, setBusy] = useState14(false);
2935
+ const [error, setError] = useState14(null);
2826
2936
  const canvasRef = useRef8(null);
2827
2937
  const panFrom = useRef8(null);
2828
2938
  const settings = session.settings;
@@ -2898,7 +3008,7 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2898
3008
  };
2899
3009
  const toLayer = settings.output !== "selection" && settings.output !== "layer-mask";
2900
3010
  const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
2901
- return /* @__PURE__ */ jsxs14(
3011
+ return /* @__PURE__ */ jsxs16(
2902
3012
  "div",
2903
3013
  {
2904
3014
  "data-testid": "select-and-mask-workspace",
@@ -2906,12 +3016,12 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2906
3016
  "aria-label": "Select and Mask",
2907
3017
  className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
2908
3018
  children: [
2909
- /* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ jsx16("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
2910
- /* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col min-w-0", children: [
2911
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
2912
- brushTool && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3019
+ /* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ jsx18("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3020
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1 flex flex-col min-w-0", children: [
3021
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
3022
+ brushTool && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2913
3023
  "Size",
2914
- /* @__PURE__ */ jsx16(
3024
+ /* @__PURE__ */ jsx18(
2915
3025
  "input",
2916
3026
  {
2917
3027
  type: "number",
@@ -2924,22 +3034,22 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2924
3034
  ),
2925
3035
  "px"
2926
3036
  ] }),
2927
- settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
2928
- /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
2929
- /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
3037
+ settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
3038
+ /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
3039
+ /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
2930
3040
  ] }),
2931
- /* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground", children: [
3041
+ /* @__PURE__ */ jsxs16("span", { className: "text-muted-foreground", children: [
2932
3042
  session.edits.length,
2933
3043
  " strokes"
2934
3044
  ] }),
2935
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
2936
- /* @__PURE__ */ jsxs14("span", { className: "font-mono text-muted-foreground", children: [
3045
+ /* @__PURE__ */ jsx18("button", { type: "button", className: button2, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
3046
+ /* @__PURE__ */ jsxs16("span", { className: "font-mono text-muted-foreground", children: [
2937
3047
  Math.round(zoom * 100),
2938
3048
  "%"
2939
3049
  ] }),
2940
- session.computing && /* @__PURE__ */ jsx16("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
3050
+ session.computing && /* @__PURE__ */ jsx18("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
2941
3051
  ] }),
2942
- /* @__PURE__ */ jsx16("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx16(
3052
+ /* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx18(
2943
3053
  "canvas",
2944
3054
  {
2945
3055
  ref: canvasRef,
@@ -2958,11 +3068,11 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2958
3068
  }
2959
3069
  ) })
2960
3070
  ] }),
2961
- /* @__PURE__ */ jsxs14("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
2962
- /* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "View Mode" }),
2963
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3071
+ /* @__PURE__ */ jsxs16("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
3072
+ /* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "View Mode" }),
3073
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
2964
3074
  "View",
2965
- /* @__PURE__ */ jsx16(
3075
+ /* @__PURE__ */ jsx18(
2966
3076
  ImageSelect,
2967
3077
  {
2968
3078
  label: "View",
@@ -2972,36 +3082,36 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2972
3082
  }
2973
3083
  )
2974
3084
  ] }),
2975
- /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
2976
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
2977
- /* @__PURE__ */ jsx16("span", { children: "Opacity" }),
2978
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3085
+ /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3086
+ /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3087
+ /* @__PURE__ */ jsx18("span", { children: "Opacity" }),
3088
+ /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
2979
3089
  Math.round(settings.opacity * 100),
2980
3090
  "%"
2981
3091
  ] })
2982
3092
  ] }),
2983
- /* @__PURE__ */ jsx16(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
3093
+ /* @__PURE__ */ jsx18(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
2984
3094
  ] }),
2985
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2986
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
3095
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3096
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
2987
3097
  "Show Edge (J)"
2988
3098
  ] }),
2989
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2990
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
3099
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3100
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
2991
3101
  "Show Original (P)"
2992
3102
  ] }),
2993
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2994
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
3103
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3104
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
2995
3105
  "Real-Time Refinement"
2996
3106
  ] }),
2997
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
2998
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
3107
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3108
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
2999
3109
  "High Quality Preview"
3000
3110
  ] }),
3001
- /* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
3002
- controller.segmentationProvider && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3111
+ /* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
3112
+ controller.segmentationProvider && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3003
3113
  "Mode",
3004
- /* @__PURE__ */ jsx16(
3114
+ /* @__PURE__ */ jsx18(
3005
3115
  ImageSelect,
3006
3116
  {
3007
3117
  label: "Refine mode",
@@ -3014,37 +3124,37 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
3014
3124
  }
3015
3125
  )
3016
3126
  ] }),
3017
- REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3018
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3019
- /* @__PURE__ */ jsx16("span", { children: c.label }),
3020
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3127
+ REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3128
+ /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3129
+ /* @__PURE__ */ jsx18("span", { children: c.label }),
3130
+ /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3021
3131
  settings.params[c.id],
3022
3132
  c.unit
3023
3133
  ] })
3024
3134
  ] }),
3025
- /* @__PURE__ */ jsx16(ImageRange, { label: `Workspace ${c.label}`, min: c.min, max: c.max, step: c.step, value: settings.params[c.id], onChange: (v) => set({ params: { ...settings.params, [c.id]: v } }) })
3135
+ /* @__PURE__ */ jsx18(ImageRange, { label: `Workspace ${c.label}`, min: c.min, max: c.max, step: c.step, value: settings.params[c.id], onChange: (v) => set({ params: { ...settings.params, [c.id]: v } }) })
3026
3136
  ] }, c.id)),
3027
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3028
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
3137
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3138
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
3029
3139
  "Smart Radius"
3030
3140
  ] }),
3031
- /* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3032
- /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3033
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3034
- /* @__PURE__ */ jsxs14("span", { children: [
3141
+ /* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3142
+ /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3143
+ /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3144
+ /* @__PURE__ */ jsxs16("span", { children: [
3035
3145
  "Decontaminate Colors",
3036
3146
  toLayer ? "" : " (new layer or document outputs)"
3037
3147
  ] }),
3038
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3148
+ /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3039
3149
  settings.decontaminate,
3040
3150
  "%"
3041
3151
  ] })
3042
3152
  ] }),
3043
- /* @__PURE__ */ jsx16(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
3153
+ /* @__PURE__ */ jsx18(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
3044
3154
  ] }),
3045
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3155
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3046
3156
  "Output To",
3047
- /* @__PURE__ */ jsx16(
3157
+ /* @__PURE__ */ jsx18(
3048
3158
  ImageSelect,
3049
3159
  {
3050
3160
  label: "Output to",
@@ -3054,16 +3164,16 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
3054
3164
  }
3055
3165
  )
3056
3166
  ] }),
3057
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2", children: [
3058
- /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
3167
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2", children: [
3168
+ /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
3059
3169
  "Remember Settings"
3060
3170
  ] }),
3061
- (error ?? session.error) && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3062
- session.note && /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: session.note }),
3063
- /* @__PURE__ */ jsxs14("div", { className: "flex gap-1 mt-auto", children: [
3064
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => session.reset(), children: "Reset" }),
3065
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => onClose(null), children: "Cancel" }),
3066
- /* @__PURE__ */ jsx16("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3171
+ (error ?? session.error) && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3172
+ session.note && /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: session.note }),
3173
+ /* @__PURE__ */ jsxs16("div", { className: "flex gap-1 mt-auto", children: [
3174
+ /* @__PURE__ */ jsx18("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
3175
+ /* @__PURE__ */ jsx18("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
3176
+ /* @__PURE__ */ jsx18("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3067
3177
  ] })
3068
3178
  ] })
3069
3179
  ]
@@ -3072,18 +3182,18 @@ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
3072
3182
  };
3073
3183
 
3074
3184
  // src/image-editor/ContentAwareFillWorkspace.tsx
3075
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState13 } from "react";
3185
+ import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState15 } from "react";
3076
3186
  import { CONTENT_AWARE_FILL_SAMPLING, CONTENT_AWARE_FILL_TOOLS, ContentAwareFillSession } from "@pixerate/editor/image-editor";
3077
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3078
- var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3079
- var toggle2 = (on) => `${button2} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
3187
+ import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3188
+ var button3 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3189
+ var toggle2 = (on) => `${button3} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
3080
3190
  var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3081
3191
  const session = useMemo5(() => new ContentAwareFillSession(controller), [controller]);
3082
- const [, setRevision] = useState13(0);
3083
- const [zoom, setZoom] = useState13(1);
3084
- const [pan, setPan] = useState13({ x: 0, y: 0 });
3085
- const [busy, setBusy] = useState13(false);
3086
- const [error, setError] = useState13(null);
3192
+ const [, setRevision] = useState15(0);
3193
+ const [zoom, setZoom] = useState15(1);
3194
+ const [pan, setPan] = useState15({ x: 0, y: 0 });
3195
+ const [busy, setBusy] = useState15(false);
3196
+ const [error, setError] = useState15(null);
3087
3197
  const sourceRef = useRef9(null);
3088
3198
  const previewRef = useRef9(null);
3089
3199
  const panFrom = useRef9(null);
@@ -3162,14 +3272,14 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3162
3272
  session.end();
3163
3273
  };
3164
3274
  const view = { maxWidth: "100%", maxHeight: "100%", transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`, imageRendering: zoom > 2 ? "pixelated" : void 0 };
3165
- return /* @__PURE__ */ jsxs15("div", { "data-testid": "content-aware-fill-workspace", role: "dialog", "aria-label": "Content-Aware Fill", className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`, children: [
3166
- /* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ jsx17("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3167
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 flex flex-col min-w-0", children: [
3168
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
3169
- settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs15(Fragment3, { children: [
3170
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3275
+ return /* @__PURE__ */ jsxs17("div", { "data-testid": "content-aware-fill-workspace", role: "dialog", "aria-label": "Content-Aware Fill", className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`, children: [
3276
+ /* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Content-Aware Fill tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: CONTENT_AWARE_FILL_TOOLS.map((t) => /* @__PURE__ */ jsx19("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle2(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3277
+ /* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col min-w-0", children: [
3278
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
3279
+ settings.tool === "sampling-brush" && /* @__PURE__ */ jsxs17(Fragment4, { children: [
3280
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3171
3281
  "Size",
3172
- /* @__PURE__ */ jsx17(
3282
+ /* @__PURE__ */ jsx19(
3173
3283
  "input",
3174
3284
  {
3175
3285
  type: "number",
@@ -3182,22 +3292,22 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3182
3292
  ),
3183
3293
  "px"
3184
3294
  ] }),
3185
- /* @__PURE__ */ jsxs15("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
3186
- /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
3187
- /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
3295
+ /* @__PURE__ */ jsxs17("div", { role: "group", "aria-label": "Sampling brush mode", className: "flex gap-1", children: [
3296
+ /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle2(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
3297
+ /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle2(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
3188
3298
  ] })
3189
3299
  ] }),
3190
- /* @__PURE__ */ jsxs15("span", { className: "font-mono text-muted-foreground", children: [
3300
+ /* @__PURE__ */ jsxs17("span", { className: "font-mono text-muted-foreground", children: [
3191
3301
  Math.round(zoom * 100),
3192
3302
  "%"
3193
3303
  ] }),
3194
- !session.showsWholeImage && /* @__PURE__ */ jsx17("button", { type: "button", className: button2, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
3195
- session.computing && /* @__PURE__ */ jsx17("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
3304
+ !session.showsWholeImage && /* @__PURE__ */ jsx19("button", { type: "button", className: button3, title: "Show (and sample from) more of the image around the selection", onClick: () => session.expandView(), children: "Expand View" }),
3305
+ session.computing && /* @__PURE__ */ jsx19("span", { role: "status", className: "text-muted-foreground", children: "Updating preview\u2026" })
3196
3306
  ] }),
3197
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
3198
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col min-h-0", children: [
3199
- /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
3200
- /* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17(
3307
+ /* @__PURE__ */ jsxs17("div", { className: "flex-1 grid grid-cols-2 gap-2 p-2 min-h-0", children: [
3308
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-col min-h-0", children: [
3309
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Source (green: sampling area)" }),
3310
+ /* @__PURE__ */ jsx19("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx19(
3201
3311
  "canvas",
3202
3312
  {
3203
3313
  ref: sourceRef,
@@ -3209,33 +3319,33 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3209
3319
  }
3210
3320
  ) })
3211
3321
  ] }),
3212
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col min-h-0", children: [
3213
- /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: "Preview" }),
3214
- /* @__PURE__ */ jsx17("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx17("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
3322
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-col min-h-0", children: [
3323
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Preview" }),
3324
+ /* @__PURE__ */ jsx19("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx19("canvas", { ref: previewRef, "data-testid": "content-aware-fill-preview", style: view }) })
3215
3325
  ] })
3216
3326
  ] })
3217
3327
  ] }),
3218
- /* @__PURE__ */ jsxs15("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
3219
- /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
3220
- /* @__PURE__ */ jsx17("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": settings.sampling === m.id, className: toggle2(settings.sampling === m.id), onClick: () => set({ sampling: m.id }), children: m.label }, m.id)) }),
3221
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3222
- /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
3328
+ /* @__PURE__ */ jsxs17("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
3329
+ /* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Sampling Area Options" }),
3330
+ /* @__PURE__ */ jsx19("div", { role: "group", "aria-label": "Sampling area", className: "flex gap-1", children: CONTENT_AWARE_FILL_SAMPLING.map((m) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": settings.sampling === m.id, className: toggle2(settings.sampling === m.id), onClick: () => set({ sampling: m.id }), children: m.label }, m.id)) }),
3331
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2", children: [
3332
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Show Sampling Area", checked: settings.showSampling, onChange: (on) => set({ showSampling: on }) }),
3223
3333
  "Show Sampling Area"
3224
3334
  ] }),
3225
- /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3226
- /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3227
- /* @__PURE__ */ jsx17("span", { children: "Opacity" }),
3228
- /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3335
+ /* @__PURE__ */ jsxs17("label", { className: "flex flex-col gap-1", children: [
3336
+ /* @__PURE__ */ jsxs17("span", { className: "flex justify-between text-muted-foreground", children: [
3337
+ /* @__PURE__ */ jsx19("span", { children: "Opacity" }),
3338
+ /* @__PURE__ */ jsxs17("span", { className: "font-mono", children: [
3229
3339
  Math.round(settings.opacity * 100),
3230
3340
  "%"
3231
3341
  ] })
3232
3342
  ] }),
3233
- /* @__PURE__ */ jsx17(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
3343
+ /* @__PURE__ */ jsx19(ImageRange, { label: "Sampling overlay opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
3234
3344
  ] }),
3235
- /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
3236
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3345
+ /* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Fill Settings" }),
3346
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3237
3347
  "Seed",
3238
- /* @__PURE__ */ jsx17(
3348
+ /* @__PURE__ */ jsx19(
3239
3349
  "input",
3240
3350
  {
3241
3351
  type: "number",
@@ -3246,17 +3356,17 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3246
3356
  className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
3247
3357
  }
3248
3358
  ),
3249
- /* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
3359
+ /* @__PURE__ */ jsx19("button", { type: "button", className: button3, onClick: () => set({ seed: settings.seed + 1 }), children: "Try Another" })
3250
3360
  ] }),
3251
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3252
- /* @__PURE__ */ jsx17(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
3361
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2", children: [
3362
+ /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Live Preview", checked: settings.livePreview, onChange: (on) => set({ livePreview: on }) }),
3253
3363
  "Live Preview"
3254
3364
  ] }),
3255
- !settings.livePreview && /* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
3256
- /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3257
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2", children: [
3365
+ !settings.livePreview && /* @__PURE__ */ jsx19("button", { type: "button", className: button3, disabled: session.computing, onClick: () => void session.refresh(), children: "Preview" }),
3366
+ /* @__PURE__ */ jsx19("span", { className: imageSectionTitleClass, children: "Output Settings" }),
3367
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2", children: [
3258
3368
  "Output To",
3259
- /* @__PURE__ */ jsx17(
3369
+ /* @__PURE__ */ jsx19(
3260
3370
  ImageSelect,
3261
3371
  {
3262
3372
  label: "Fill output",
@@ -3270,18 +3380,18 @@ var ContentAwareFillWorkspace = ({ controller, onClose, className = "" }) => {
3270
3380
  }
3271
3381
  )
3272
3382
  ] }),
3273
- (error ?? session.error) && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3274
- /* @__PURE__ */ jsxs15("div", { className: "flex gap-1 mt-auto", children: [
3275
- /* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => session.reset(), children: "Reset" }),
3276
- /* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => onClose(null), children: "Cancel" }),
3277
- /* @__PURE__ */ jsx17("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3383
+ (error ?? session.error) && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
3384
+ /* @__PURE__ */ jsxs17("div", { className: "flex gap-1 mt-auto", children: [
3385
+ /* @__PURE__ */ jsx19("button", { type: "button", className: button3, onClick: () => session.reset(), children: "Reset" }),
3386
+ /* @__PURE__ */ jsx19("button", { type: "button", className: button3, onClick: () => onClose(null), children: "Cancel" }),
3387
+ /* @__PURE__ */ jsx19("button", { type: "button", className: toggle2(true), disabled: busy || !win, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
3278
3388
  ] })
3279
3389
  ] })
3280
3390
  ] });
3281
3391
  };
3282
3392
 
3283
3393
  // src/image-editor/SelectionOptionsBar.tsx
3284
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3394
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3285
3395
  var MODIFY_OPS = [
3286
3396
  { op: "expand", label: "Expand" },
3287
3397
  { op: "contract", label: "Contract" },
@@ -3305,15 +3415,15 @@ var SelectionOptionsBar = ({
3305
3415
  selectionDisplay,
3306
3416
  className = ""
3307
3417
  }) => {
3308
- const [radius, setRadius] = useState14(2);
3418
+ const [radius, setRadius] = useState16(2);
3309
3419
  const set = (patch) => onOptionsChange({ ...options, ...patch });
3310
3420
  const sel = selection === void 0 ? controller.getSelection() : selection;
3311
3421
  const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
3312
- const [preset, setPreset] = useState14("reds");
3313
- const [rangeStatus, setRangeStatus] = useState14(null);
3314
- const [colorStatus, setColorStatus] = useState14(null);
3315
- const [strokeWidth, setStrokeWidth] = useState14(4);
3316
- const [strokeLocation, setStrokeLocation] = useState14("outside");
3422
+ const [preset, setPreset] = useState16("reds");
3423
+ const [rangeStatus, setRangeStatus] = useState16(null);
3424
+ const [colorStatus, setColorStatus] = useState16(null);
3425
+ const [strokeWidth, setStrokeWidth] = useState16(4);
3426
+ const [strokeLocation, setStrokeLocation] = useState16("outside");
3317
3427
  const edit = (fn) => {
3318
3428
  setColorStatus(null);
3319
3429
  try {
@@ -3346,7 +3456,7 @@ var SelectionOptionsBar = ({
3346
3456
  setRangeStatus(err instanceof Error ? err.message : String(err));
3347
3457
  }
3348
3458
  };
3349
- const [task, setTask] = useState14(null);
3459
+ const [task, setTask] = useState16(null);
3350
3460
  const taskAbort = useRef10(null);
3351
3461
  const tracked = () => {
3352
3462
  const abort = new AbortController();
@@ -3359,9 +3469,9 @@ var SelectionOptionsBar = ({
3359
3469
  setTask(null);
3360
3470
  };
3361
3471
  const failure = (err) => err?.name === "AbortError" ? "Cancelled." : err instanceof Error ? err.message : String(err);
3362
- const [subject, setSubject] = useState14("");
3363
- const [segmenting, setSegmenting] = useState14(false);
3364
- const [subjectStatus, setSubjectStatus] = useState14(null);
3472
+ const [subject, setSubject] = useState16("");
3473
+ const [segmenting, setSegmenting] = useState16(false);
3474
+ const [subjectStatus, setSubjectStatus] = useState16(null);
3365
3475
  const selectSubject = async () => {
3366
3476
  const target = subject.trim();
3367
3477
  const canSegment = Boolean(controller.segmentationProvider);
@@ -3378,10 +3488,10 @@ var SelectionOptionsBar = ({
3378
3488
  setSegmenting(false);
3379
3489
  }
3380
3490
  };
3381
- const [workspace, setWorkspace] = useState14(false);
3382
- const [fillWorkspace, setFillWorkspace] = useState14(false);
3383
- const [skying, setSkying] = useState14(false);
3384
- const [skyStatus, setSkyStatus] = useState14(null);
3491
+ const [workspace, setWorkspace] = useState16(false);
3492
+ const [fillWorkspace, setFillWorkspace] = useState16(false);
3493
+ const [skying, setSkying] = useState16(false);
3494
+ const [skyStatus, setSkyStatus] = useState16(null);
3385
3495
  const selectSky = async () => {
3386
3496
  if (skying) return;
3387
3497
  setSkying(true);
@@ -3396,8 +3506,8 @@ var SelectionOptionsBar = ({
3396
3506
  setSkying(false);
3397
3507
  }
3398
3508
  };
3399
- const [focusing, setFocusing] = useState14(false);
3400
- const [focusStatus, setFocusStatus] = useState14(null);
3509
+ const [focusing, setFocusing] = useState16(false);
3510
+ const [focusStatus, setFocusStatus] = useState16(null);
3401
3511
  const selectFocusArea = async () => {
3402
3512
  if (focusing) return;
3403
3513
  setFocusing(true);
@@ -3418,24 +3528,24 @@ var SelectionOptionsBar = ({
3418
3528
  setFocusing(false);
3419
3529
  }
3420
3530
  };
3421
- return /* @__PURE__ */ jsxs16("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3422
- /* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3423
- /* @__PURE__ */ jsx18("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
3424
- options.tool === "wand" && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
3425
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3426
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3427
- /* @__PURE__ */ jsx18("span", { children: "Tolerance" }),
3428
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.tolerance })
3531
+ return /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3532
+ /* @__PURE__ */ jsx20("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3533
+ /* @__PURE__ */ jsx20("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
3534
+ options.tool === "wand" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
3535
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3536
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3537
+ /* @__PURE__ */ jsx20("span", { children: "Tolerance" }),
3538
+ /* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.tolerance })
3429
3539
  ] }),
3430
- /* @__PURE__ */ jsx18(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
3540
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
3431
3541
  ] }),
3432
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3433
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
3542
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3543
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
3434
3544
  "Contiguous"
3435
3545
  ] }),
3436
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3546
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3437
3547
  "Distance",
3438
- /* @__PURE__ */ jsx18(
3548
+ /* @__PURE__ */ jsx20(
3439
3549
  ImageSelect,
3440
3550
  {
3441
3551
  label: "Colour distance",
@@ -3448,13 +3558,13 @@ var SelectionOptionsBar = ({
3448
3558
  }
3449
3559
  )
3450
3560
  ] }),
3451
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3452
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
3561
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3562
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
3453
3563
  "Sample adjusted image"
3454
3564
  ] }),
3455
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3565
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3456
3566
  "Sample",
3457
- /* @__PURE__ */ jsx18(
3567
+ /* @__PURE__ */ jsx20(
3458
3568
  ImageSelect,
3459
3569
  {
3460
3570
  label: "Sample from",
@@ -3468,77 +3578,77 @@ var SelectionOptionsBar = ({
3468
3578
  )
3469
3579
  ] })
3470
3580
  ] }),
3471
- options.tool === "polygon" && /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
3472
- options.tool === "magnetic" && /* @__PURE__ */ jsxs16("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
3473
- /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Click on an edge, then move along it: the outline snaps to the edge and adds points as it goes. Click to add a point; double-click, Enter or a click on the start closes it, Backspace removes the last point, Escape cancels." }),
3474
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3475
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3476
- /* @__PURE__ */ jsx18("span", { children: "Width" }),
3477
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3581
+ options.tool === "polygon" && /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
3582
+ options.tool === "magnetic" && /* @__PURE__ */ jsxs18("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
3583
+ /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Click on an edge, then move along it: the outline snaps to the edge and adds points as it goes. Click to add a point; double-click, Enter or a click on the start closes it, Backspace removes the last point, Escape cancels." }),
3584
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3585
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3586
+ /* @__PURE__ */ jsx20("span", { children: "Width" }),
3587
+ /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
3478
3588
  options.magneticWidth ?? 10,
3479
3589
  " px"
3480
3590
  ] })
3481
3591
  ] }),
3482
- /* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
3592
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
3483
3593
  ] }),
3484
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3485
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3486
- /* @__PURE__ */ jsx18("span", { children: "Contrast" }),
3487
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3594
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3595
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3596
+ /* @__PURE__ */ jsx20("span", { children: "Contrast" }),
3597
+ /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
3488
3598
  options.magneticContrast ?? 10,
3489
3599
  "%"
3490
3600
  ] })
3491
3601
  ] }),
3492
- /* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
3602
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
3493
3603
  ] }),
3494
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3495
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3496
- /* @__PURE__ */ jsx18("span", { children: "Frequency" }),
3497
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
3604
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3605
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3606
+ /* @__PURE__ */ jsx20("span", { children: "Frequency" }),
3607
+ /* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
3498
3608
  ] }),
3499
- /* @__PURE__ */ jsx18(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
3609
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
3500
3610
  ] })
3501
3611
  ] }),
3502
- options.tool === "quick" && /* @__PURE__ */ jsxs16("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
3503
- /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
3504
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3505
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3506
- /* @__PURE__ */ jsx18("span", { children: "Size" }),
3507
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3612
+ options.tool === "quick" && /* @__PURE__ */ jsxs18("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
3613
+ /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
3614
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3615
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3616
+ /* @__PURE__ */ jsx20("span", { children: "Size" }),
3617
+ /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
3508
3618
  options.quickSize ?? 30,
3509
3619
  " px"
3510
3620
  ] })
3511
3621
  ] }),
3512
- /* @__PURE__ */ jsx18(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
3622
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
3513
3623
  ] }),
3514
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3515
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
3624
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3625
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
3516
3626
  "Sample all layers"
3517
3627
  ] }),
3518
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3519
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
3628
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3629
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
3520
3630
  "Auto-enhance edges"
3521
3631
  ] })
3522
3632
  ] }),
3523
- options.tool === "object" && /* @__PURE__ */ jsxs16("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
3524
- /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
3525
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3526
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
3633
+ options.tool === "object" && /* @__PURE__ */ jsxs18("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
3634
+ /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
3635
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3636
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
3527
3637
  "Sample all layers"
3528
3638
  ] }),
3529
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3530
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
3639
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3640
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
3531
3641
  "Auto-enhance edges"
3532
3642
  ] })
3533
3643
  ] }),
3534
- (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs16("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
3535
- /* @__PURE__ */ jsxs16("p", { className: "text-muted-foreground", children: [
3644
+ (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs18("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
3645
+ /* @__PURE__ */ jsxs18("p", { className: "text-muted-foreground", children: [
3536
3646
  options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
3537
3647
  " Shift-click adds, Alt-click subtracts."
3538
3648
  ] }),
3539
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3649
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3540
3650
  "Text",
3541
- /* @__PURE__ */ jsx18(
3651
+ /* @__PURE__ */ jsx20(
3542
3652
  "input",
3543
3653
  {
3544
3654
  type: "text",
@@ -3549,9 +3659,9 @@ var SelectionOptionsBar = ({
3549
3659
  }
3550
3660
  )
3551
3661
  ] }),
3552
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3662
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3553
3663
  "Size",
3554
- /* @__PURE__ */ jsx18(
3664
+ /* @__PURE__ */ jsx20(
3555
3665
  "input",
3556
3666
  {
3557
3667
  type: "number",
@@ -3565,9 +3675,9 @@ var SelectionOptionsBar = ({
3565
3675
  ),
3566
3676
  "px"
3567
3677
  ] }),
3568
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3678
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3569
3679
  "Font",
3570
- /* @__PURE__ */ jsx18(
3680
+ /* @__PURE__ */ jsx20(
3571
3681
  "input",
3572
3682
  {
3573
3683
  type: "text",
@@ -3579,18 +3689,18 @@ var SelectionOptionsBar = ({
3579
3689
  )
3580
3690
  ] })
3581
3691
  ] }),
3582
- options.tool === "range" && /* @__PURE__ */ jsxs16("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
3583
- /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
3584
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3585
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3586
- /* @__PURE__ */ jsx18("span", { children: "Fuzziness" }),
3587
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.fuzziness ?? 40 })
3692
+ options.tool === "range" && /* @__PURE__ */ jsxs18("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
3693
+ /* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
3694
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3695
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3696
+ /* @__PURE__ */ jsx20("span", { children: "Fuzziness" }),
3697
+ /* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.fuzziness ?? 40 })
3588
3698
  ] }),
3589
- /* @__PURE__ */ jsx18(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
3699
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
3590
3700
  ] }),
3591
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3701
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3592
3702
  "Localized radius",
3593
- /* @__PURE__ */ jsx18(
3703
+ /* @__PURE__ */ jsx20(
3594
3704
  "input",
3595
3705
  {
3596
3706
  type: "number",
@@ -3604,12 +3714,12 @@ var SelectionOptionsBar = ({
3604
3714
  ),
3605
3715
  "px"
3606
3716
  ] }),
3607
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3608
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
3717
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3718
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
3609
3719
  "Invert"
3610
3720
  ] }),
3611
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
3612
- /* @__PURE__ */ jsx18(
3721
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
3722
+ /* @__PURE__ */ jsx20(
3613
3723
  ImageSelect,
3614
3724
  {
3615
3725
  label: "Color Range preset",
@@ -3618,13 +3728,13 @@ var SelectionOptionsBar = ({
3618
3728
  onChange: (v) => setPreset(v)
3619
3729
  }
3620
3730
  ),
3621
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
3731
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
3622
3732
  ] }),
3623
- rangeStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
3733
+ rangeStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
3624
3734
  ] }),
3625
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3735
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3626
3736
  "Feather",
3627
- /* @__PURE__ */ jsx18(
3737
+ /* @__PURE__ */ jsx20(
3628
3738
  "input",
3629
3739
  {
3630
3740
  type: "number",
@@ -3639,7 +3749,7 @@ var SelectionOptionsBar = ({
3639
3749
  ),
3640
3750
  "px"
3641
3751
  ] }),
3642
- /* @__PURE__ */ jsxs16(
3752
+ /* @__PURE__ */ jsxs18(
3643
3753
  "form",
3644
3754
  {
3645
3755
  "data-testid": "select-subject",
@@ -3649,8 +3759,8 @@ var SelectionOptionsBar = ({
3649
3759
  void selectSubject();
3650
3760
  },
3651
3761
  children: [
3652
- /* @__PURE__ */ jsxs16("div", { className: "flex gap-1", children: [
3653
- controller.segmentationProvider && /* @__PURE__ */ jsx18(
3762
+ /* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
3763
+ controller.segmentationProvider && /* @__PURE__ */ jsx20(
3654
3764
  "input",
3655
3765
  {
3656
3766
  type: "text",
@@ -3662,7 +3772,7 @@ var SelectionOptionsBar = ({
3662
3772
  className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
3663
3773
  }
3664
3774
  ),
3665
- /* @__PURE__ */ jsx18(
3775
+ /* @__PURE__ */ jsx20(
3666
3776
  "button",
3667
3777
  {
3668
3778
  type: "submit",
@@ -3674,12 +3784,12 @@ var SelectionOptionsBar = ({
3674
3784
  }
3675
3785
  )
3676
3786
  ] }),
3677
- subjectStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
3787
+ subjectStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
3678
3788
  ]
3679
3789
  }
3680
3790
  ),
3681
- task && /* @__PURE__ */ jsxs16("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
3682
- /* @__PURE__ */ jsx18(
3791
+ task && /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-progress", className: "flex items-center gap-2", children: [
3792
+ /* @__PURE__ */ jsx20(
3683
3793
  "div",
3684
3794
  {
3685
3795
  role: "progressbar",
@@ -3688,69 +3798,69 @@ var SelectionOptionsBar = ({
3688
3798
  "aria-valuemax": 100,
3689
3799
  "aria-valuenow": Math.round(task.fraction * 100),
3690
3800
  className: "flex-1 h-1.5 rounded bg-muted overflow-hidden",
3691
- children: /* @__PURE__ */ jsx18("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
3801
+ children: /* @__PURE__ */ jsx20("div", { className: "h-full bg-primary", style: { width: `${Math.round(task.fraction * 100)}%` } })
3692
3802
  }
3693
3803
  ),
3694
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: task.stage }),
3695
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
3804
+ /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: task.stage }),
3805
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => taskAbort.current?.abort(), children: "Cancel" })
3696
3806
  ] }),
3697
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
3698
- workspace && /* @__PURE__ */ jsx18(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
3699
- /* @__PURE__ */ jsxs16("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
3700
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
3701
- skyStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
3807
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
3808
+ workspace && /* @__PURE__ */ jsx20(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
3809
+ /* @__PURE__ */ jsxs18("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
3810
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
3811
+ skyStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
3702
3812
  ] }),
3703
- /* @__PURE__ */ jsxs16("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
3704
- /* @__PURE__ */ jsx18("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
3705
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2 pt-2", children: [
3706
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3707
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3708
- /* @__PURE__ */ jsx18("span", { children: "In-focus range" }),
3709
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.focusRange ?? 50 })
3813
+ /* @__PURE__ */ jsxs18("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
3814
+ /* @__PURE__ */ jsx20("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
3815
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2 pt-2", children: [
3816
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3817
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3818
+ /* @__PURE__ */ jsx20("span", { children: "In-focus range" }),
3819
+ /* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.focusRange ?? 50 })
3710
3820
  ] }),
3711
- /* @__PURE__ */ jsx18(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
3821
+ /* @__PURE__ */ jsx20(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
3712
3822
  ] }),
3713
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3714
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3715
- /* @__PURE__ */ jsx18("span", { children: "Image noise level" }),
3716
- /* @__PURE__ */ jsx18("span", { className: "font-mono", children: options.focusNoise ?? 0 })
3823
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3824
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3825
+ /* @__PURE__ */ jsx20("span", { children: "Image noise level" }),
3826
+ /* @__PURE__ */ jsx20("span", { className: "font-mono", children: options.focusNoise ?? 0 })
3717
3827
  ] }),
3718
- /* @__PURE__ */ jsx18(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
3828
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
3719
3829
  ] }),
3720
- /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
3721
- /* @__PURE__ */ jsxs16("span", { className: "flex justify-between text-muted-foreground", children: [
3722
- /* @__PURE__ */ jsx18("span", { children: "Soften edge" }),
3723
- /* @__PURE__ */ jsxs16("span", { className: "font-mono", children: [
3830
+ /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3831
+ /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3832
+ /* @__PURE__ */ jsx20("span", { children: "Soften edge" }),
3833
+ /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
3724
3834
  options.focusSoftness ?? 4,
3725
3835
  " px"
3726
3836
  ] })
3727
3837
  ] }),
3728
- /* @__PURE__ */ jsx18(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
3838
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
3729
3839
  ] }),
3730
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
3731
- focusStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
3840
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
3841
+ focusStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
3732
3842
  ] })
3733
3843
  ] }),
3734
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-foreground", children: [
3735
- /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
3844
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3845
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
3736
3846
  "Anti-alias"
3737
3847
  ] }),
3738
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap gap-1", children: [
3739
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
3740
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
3741
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
3742
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
3743
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
3744
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
3848
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
3849
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
3850
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
3851
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
3852
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
3853
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
3854
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
3745
3855
  ] }),
3746
- /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
3747
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Show" }),
3748
- DISPLAYS.map((d) => /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
3856
+ /* @__PURE__ */ jsxs18("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
3857
+ /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: "Show" }),
3858
+ DISPLAYS.map((d) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
3749
3859
  ] }),
3750
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-1", children: [
3751
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3860
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-1", children: [
3861
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3752
3862
  "Radius",
3753
- /* @__PURE__ */ jsx18(
3863
+ /* @__PURE__ */ jsx20(
3754
3864
  "input",
3755
3865
  {
3756
3866
  type: "number",
@@ -3764,12 +3874,12 @@ var SelectionOptionsBar = ({
3764
3874
  }
3765
3875
  )
3766
3876
  ] }),
3767
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
3877
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
3768
3878
  ] }),
3769
- /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
3770
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3879
+ /* @__PURE__ */ jsxs18("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
3880
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3771
3881
  "Stroke",
3772
- /* @__PURE__ */ jsx18(
3882
+ /* @__PURE__ */ jsx20(
3773
3883
  "input",
3774
3884
  {
3775
3885
  type: "number",
@@ -3784,7 +3894,7 @@ var SelectionOptionsBar = ({
3784
3894
  ),
3785
3895
  "px"
3786
3896
  ] }),
3787
- /* @__PURE__ */ jsx18(
3897
+ /* @__PURE__ */ jsx20(
3788
3898
  ImageSelect,
3789
3899
  {
3790
3900
  label: "Stroke location",
@@ -3797,28 +3907,29 @@ var SelectionOptionsBar = ({
3797
3907
  onChange: (v) => setStrokeLocation(v)
3798
3908
  }
3799
3909
  ),
3800
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
3801
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
3802
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
3803
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
3804
- fillWorkspace && /* @__PURE__ */ jsx18(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
3910
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
3911
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
3912
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" }),
3913
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => setFillWorkspace(true), children: "Content-Aware Fill\u2026" }),
3914
+ fillWorkspace && /* @__PURE__ */ jsx20(ContentAwareFillWorkspace, { controller, onClose: () => setFillWorkspace(false) })
3805
3915
  ] }),
3806
- /* @__PURE__ */ jsxs16("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
3807
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
3808
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
3809
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
3810
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
3811
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
3812
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
3813
- /* @__PURE__ */ jsx18("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
3916
+ /* @__PURE__ */ jsxs18("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
3917
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
3918
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
3919
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
3920
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
3921
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
3922
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
3923
+ /* @__PURE__ */ jsx20("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
3814
3924
  ] }),
3815
- colorStatus && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
3816
- /* @__PURE__ */ jsx18("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
3925
+ colorStatus && /* @__PURE__ */ jsx20("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
3926
+ /* @__PURE__ */ jsx20("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) }),
3927
+ /* @__PURE__ */ jsx20(SelectionRecipePanel, { controller, selection: sel })
3817
3928
  ] });
3818
3929
  };
3819
3930
 
3820
3931
  // src/image-editor/RefineEdgePanel.tsx
3821
- import { useState as useState18 } from "react";
3932
+ import { useState as useState20 } from "react";
3822
3933
  import {
3823
3934
  ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
3824
3935
  REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
@@ -3828,14 +3939,14 @@ import {
3828
3939
  } from "@pixerate/editor/image-editor";
3829
3940
 
3830
3941
  // src/image-editor/MaskEdgeCheck.tsx
3831
- import React14, { useState as useState15 } from "react";
3942
+ import React16, { useState as useState17 } from "react";
3832
3943
  import { MASK_EDGE_THRESHOLDS } from "@pixerate/editor/image-editor";
3833
- import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3834
- var button3 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3944
+ import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3945
+ var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3835
3946
  var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
3836
3947
  const sel = selection === void 0 ? controller.getSelection() : selection;
3837
- const [result, setResult] = useState15(null);
3838
- const [error, setError] = useState15(null);
3948
+ const [result, setResult] = useState17(null);
3949
+ const [error, setError] = useState17(null);
3839
3950
  const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
3840
3951
  const check = () => {
3841
3952
  setError(null);
@@ -3853,35 +3964,35 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
3853
3964
  { label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
3854
3965
  { label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
3855
3966
  ] : [];
3856
- return /* @__PURE__ */ jsxs17("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3857
- /* @__PURE__ */ jsx19("button", { type: "button", className: `${button3} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
3858
- report && /* @__PURE__ */ jsxs17(Fragment4, { children: [
3859
- /* @__PURE__ */ jsxs17("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
3860
- rows.map((r) => /* @__PURE__ */ jsxs17(React14.Fragment, { children: [
3861
- /* @__PURE__ */ jsx19("dt", { className: "text-muted-foreground", children: r.label }),
3862
- /* @__PURE__ */ jsx19("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
3967
+ return /* @__PURE__ */ jsxs19("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3968
+ /* @__PURE__ */ jsx21("button", { type: "button", className: `${button4} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
3969
+ report && /* @__PURE__ */ jsxs19(Fragment5, { children: [
3970
+ /* @__PURE__ */ jsxs19("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
3971
+ rows.map((r) => /* @__PURE__ */ jsxs19(React16.Fragment, { children: [
3972
+ /* @__PURE__ */ jsx21("dt", { className: "text-muted-foreground", children: r.label }),
3973
+ /* @__PURE__ */ jsx21("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
3863
3974
  ] }, r.label)),
3864
- /* @__PURE__ */ jsx19("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
3865
- /* @__PURE__ */ jsxs17("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
3975
+ /* @__PURE__ */ jsx21("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
3976
+ /* @__PURE__ */ jsxs19("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
3866
3977
  report.holes.count,
3867
3978
  " / ",
3868
3979
  report.islands.count
3869
3980
  ] })
3870
3981
  ] }),
3871
- report.issues.length ? /* @__PURE__ */ jsx19("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx19("li", { children: s }, s)) }) : /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "The edge looks clean." })
3982
+ report.issues.length ? /* @__PURE__ */ jsx21("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ jsx21("li", { children: s }, s)) }) : /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "The edge looks clean." })
3872
3983
  ] }),
3873
- error && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error })
3984
+ error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
3874
3985
  ] });
3875
3986
  };
3876
3987
 
3877
3988
  // src/image-editor/SelectionChangeCheck.tsx
3878
- import { useState as useState16 } from "react";
3879
- import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3880
- var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3989
+ import { useState as useState18 } from "react";
3990
+ import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
3991
+ var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3881
3992
  var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3882
3993
  const sel = selection === void 0 ? controller.getSelection() : selection;
3883
- const [result, setResult] = useState16(null);
3884
- const [error, setError] = useState16(null);
3994
+ const [result, setResult] = useState18(null);
3995
+ const [error, setError] = useState18(null);
3885
3996
  const diff = result && result.for === sel ? result.diff : null;
3886
3997
  const show = () => {
3887
3998
  setError(null);
@@ -3892,16 +4003,16 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3892
4003
  setError(err instanceof Error ? err.message : String(err));
3893
4004
  }
3894
4005
  };
3895
- return /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
3896
- /* @__PURE__ */ jsx20("button", { type: "button", className: `${button4} self-start`, onClick: show, children: "Show Last Change" }),
3897
- diff && /* @__PURE__ */ jsx20("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs18(Fragment5, { children: [
3898
- /* @__PURE__ */ jsxs18("span", { className: "text-green-600", children: [
4006
+ return /* @__PURE__ */ jsxs20("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
4007
+ /* @__PURE__ */ jsx22("button", { type: "button", className: `${button5} self-start`, onClick: show, children: "Show Last Change" }),
4008
+ diff && /* @__PURE__ */ jsx22("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs20(Fragment6, { children: [
4009
+ /* @__PURE__ */ jsxs20("span", { className: "text-green-600", children: [
3899
4010
  "+",
3900
4011
  diff.added.area,
3901
4012
  " px"
3902
4013
  ] }),
3903
4014
  " ",
3904
- /* @__PURE__ */ jsxs18("span", { className: "text-destructive", children: [
4015
+ /* @__PURE__ */ jsxs20("span", { className: "text-destructive", children: [
3905
4016
  "\u2212",
3906
4017
  diff.removed.area,
3907
4018
  " px"
@@ -3910,20 +4021,20 @@ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3910
4021
  Math.round(diff.iou * 100),
3911
4022
  "%"
3912
4023
  ] }) }),
3913
- error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
4024
+ error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
3914
4025
  ] });
3915
4026
  };
3916
4027
 
3917
4028
  // src/image-editor/SeparateSubjectPanel.tsx
3918
- import { useRef as useRef11, useState as useState17 } from "react";
3919
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3920
- var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
4029
+ import { useRef as useRef11, useState as useState19 } from "react";
4030
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4031
+ var button6 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3921
4032
  var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3922
4033
  const sel = selection === void 0 ? controller.getSelection() : selection;
3923
- const [dilate, setDilate] = useState17(8);
3924
- const [fill, setFill] = useState17(true);
3925
- const [progress, setProgress] = useState17(null);
3926
- const [error, setError] = useState17(null);
4034
+ const [dilate, setDilate] = useState19(8);
4035
+ const [fill, setFill] = useState19(true);
4036
+ const [progress, setProgress] = useState19(null);
4037
+ const [error, setError] = useState19(null);
3927
4038
  const abort = useRef11(null);
3928
4039
  const run = async () => {
3929
4040
  setError(null);
@@ -3943,13 +4054,13 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3943
4054
  setProgress(null);
3944
4055
  }
3945
4056
  };
3946
- return /* @__PURE__ */ jsxs19("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3947
- /* @__PURE__ */ jsx21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
3948
- /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
3949
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", children: [
3950
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4057
+ return /* @__PURE__ */ jsxs21("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
4058
+ /* @__PURE__ */ jsx23("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
4059
+ /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
4060
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2", children: [
4061
+ /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3951
4062
  "Grow",
3952
- /* @__PURE__ */ jsx21(
4063
+ /* @__PURE__ */ jsx23(
3953
4064
  "input",
3954
4065
  {
3955
4066
  type: "number",
@@ -3963,34 +4074,34 @@ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3963
4074
  ),
3964
4075
  "px"
3965
4076
  ] }),
3966
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-foreground", children: [
3967
- /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
4077
+ /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1 text-foreground", children: [
4078
+ /* @__PURE__ */ jsx23("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
3968
4079
  "Fill the background"
3969
4080
  ] })
3970
4081
  ] }),
3971
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", children: [
3972
- /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
3973
- progress !== null && /* @__PURE__ */ jsx21("button", { type: "button", className: button5, onClick: () => abort.current?.abort(), children: "Cancel" })
4082
+ /* @__PURE__ */ jsxs21("div", { className: "flex gap-1", children: [
4083
+ /* @__PURE__ */ jsx23("button", { type: "button", className: button6, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
4084
+ progress !== null && /* @__PURE__ */ jsx23("button", { type: "button", className: button6, onClick: () => abort.current?.abort(), children: "Cancel" })
3974
4085
  ] }),
3975
- progress !== null && /* @__PURE__ */ jsx21("p", { role: "status", className: "text-muted-foreground", children: progress }),
3976
- error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
4086
+ progress !== null && /* @__PURE__ */ jsx23("p", { role: "status", className: "text-muted-foreground", children: progress }),
4087
+ error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
3977
4088
  ] });
3978
4089
  };
3979
4090
 
3980
4091
  // src/image-editor/RefineEdgePanel.tsx
3981
- import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4092
+ import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
3982
4093
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3983
- var button6 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
4094
+ var button7 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3984
4095
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3985
- const [params, setParams] = useState18(DEFAULT_PARAMS);
3986
- const [busy, setBusy] = useState18(false);
3987
- const [error, setError] = useState18(null);
3988
- const [layerId, setLayerId] = useState18("");
3989
- const [newKind, setNewKind] = useState18("hueSaturation");
3990
- const [output, setOutput] = useState18("selection");
3991
- const [decontaminate, setDecontaminate] = useState18(0);
3992
- const [objectAware, setObjectAware] = useState18(false);
3993
- const [onlyUncertain, setOnlyUncertain] = useState18(false);
4096
+ const [params, setParams] = useState20(DEFAULT_PARAMS);
4097
+ const [busy, setBusy] = useState20(false);
4098
+ const [error, setError] = useState20(null);
4099
+ const [layerId, setLayerId] = useState20("");
4100
+ const [newKind, setNewKind] = useState20("hueSaturation");
4101
+ const [output, setOutput] = useState20("selection");
4102
+ const [decontaminate, setDecontaminate] = useState20(0);
4103
+ const [objectAware, setObjectAware] = useState20(false);
4104
+ const [onlyUncertain, setOnlyUncertain] = useState20(false);
3994
4105
  const canObject = Boolean(controller.segmentationProvider);
3995
4106
  const toLayer = output !== "selection" && output !== "layer-mask";
3996
4107
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -4013,17 +4124,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4013
4124
  setBusy(false);
4014
4125
  }
4015
4126
  };
4016
- return /* @__PURE__ */ jsxs20("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4017
- /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4018
- REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4019
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4020
- /* @__PURE__ */ jsx22("span", { children: c.label }),
4021
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4127
+ return /* @__PURE__ */ jsxs22("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4128
+ /* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4129
+ REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
4130
+ /* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
4131
+ /* @__PURE__ */ jsx24("span", { children: c.label }),
4132
+ /* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
4022
4133
  params[c.id],
4023
4134
  c.unit
4024
4135
  ] })
4025
4136
  ] }),
4026
- /* @__PURE__ */ jsx22(
4137
+ /* @__PURE__ */ jsx24(
4027
4138
  "input",
4028
4139
  {
4029
4140
  type: "range",
@@ -4037,43 +4148,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4037
4148
  }
4038
4149
  )
4039
4150
  ] }, c.id)),
4040
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4041
- /* @__PURE__ */ jsx22("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4151
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-foreground", children: [
4152
+ /* @__PURE__ */ jsx24("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4042
4153
  "Smart Radius"
4043
4154
  ] }),
4044
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
4045
- /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
4155
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
4156
+ /* @__PURE__ */ jsx24("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
4046
4157
  "Only uncertain areas"
4047
4158
  ] }),
4048
- canObject && /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4049
- /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
4159
+ canObject && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-foreground", children: [
4160
+ /* @__PURE__ */ jsx24("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
4050
4161
  "Object aware (segmentation model)"
4051
4162
  ] }),
4052
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
4163
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
4053
4164
  "Output to",
4054
- /* @__PURE__ */ jsx22(
4165
+ /* @__PURE__ */ jsx24(
4055
4166
  "select",
4056
4167
  {
4057
4168
  "aria-label": "Refine output",
4058
4169
  value: output,
4059
4170
  onChange: (e) => setOutput(e.target.value),
4060
4171
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4061
- children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx22("option", { value: o.id, children: o.label }, o.id))
4172
+ children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx24("option", { value: o.id, children: o.label }, o.id))
4062
4173
  }
4063
4174
  )
4064
4175
  ] }),
4065
- /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4066
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4067
- /* @__PURE__ */ jsxs20("span", { children: [
4176
+ /* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
4177
+ /* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
4178
+ /* @__PURE__ */ jsxs22("span", { children: [
4068
4179
  "Decontaminate colors",
4069
4180
  toLayer ? "" : " (new layer or document outputs)"
4070
4181
  ] }),
4071
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4182
+ /* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
4072
4183
  decontaminate,
4073
4184
  "%"
4074
4185
  ] })
4075
4186
  ] }),
4076
- /* @__PURE__ */ jsx22(
4187
+ /* @__PURE__ */ jsx24(
4077
4188
  "input",
4078
4189
  {
4079
4190
  type: "range",
@@ -4088,66 +4199,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4088
4199
  }
4089
4200
  )
4090
4201
  ] }),
4091
- /* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
4092
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4093
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4202
+ /* @__PURE__ */ jsxs22("div", { className: "flex gap-1", children: [
4203
+ /* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4204
+ /* @__PURE__ */ jsx24("button", { type: "button", className: button7, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4094
4205
  ] }),
4095
- error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error }),
4096
- /* @__PURE__ */ jsx22(MaskEdgeCheck, { controller, selection: sel }),
4097
- /* @__PURE__ */ jsx22(SelectionChangeCheck, { controller, selection: sel }),
4098
- /* @__PURE__ */ jsx22(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
4099
- /* @__PURE__ */ jsx22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4100
- /* @__PURE__ */ jsxs20("div", { className: "flex gap-1 items-center", children: [
4101
- /* @__PURE__ */ jsx22(
4206
+ error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error }),
4207
+ /* @__PURE__ */ jsx24(MaskEdgeCheck, { controller, selection: sel }),
4208
+ /* @__PURE__ */ jsx24(SelectionChangeCheck, { controller, selection: sel }),
4209
+ /* @__PURE__ */ jsx24(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
4210
+ /* @__PURE__ */ jsx24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4211
+ /* @__PURE__ */ jsxs22("div", { className: "flex gap-1 items-center", children: [
4212
+ /* @__PURE__ */ jsx24(
4102
4213
  "select",
4103
4214
  {
4104
4215
  "aria-label": "New masked layer kind",
4105
4216
  value: newKind,
4106
4217
  onChange: (e) => setNewKind(e.target.value),
4107
4218
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4108
- children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx22("option", { value: k.kind, children: k.label }, k.kind))
4219
+ children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx24("option", { value: k.kind, children: k.label }, k.kind))
4109
4220
  }
4110
4221
  ),
4111
- /* @__PURE__ */ jsx22(
4222
+ /* @__PURE__ */ jsx24(
4112
4223
  "button",
4113
4224
  {
4114
4225
  type: "button",
4115
- className: button6,
4226
+ className: button7,
4116
4227
  disabled: !sel,
4117
4228
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
4118
4229
  children: "New Masked Layer"
4119
4230
  }
4120
4231
  )
4121
4232
  ] }),
4122
- list.length > 0 && target && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
4123
- /* @__PURE__ */ jsx22(
4233
+ list.length > 0 && target && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-2", children: [
4234
+ /* @__PURE__ */ jsx24(
4124
4235
  "select",
4125
4236
  {
4126
4237
  "aria-label": "Mask layer",
4127
4238
  value: target.id,
4128
4239
  onChange: (e) => setLayerId(e.target.value),
4129
4240
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4130
- children: list.map((l) => /* @__PURE__ */ jsxs20("option", { value: l.id, children: [
4241
+ children: list.map((l) => /* @__PURE__ */ jsxs22("option", { value: l.id, children: [
4131
4242
  l.name || adjustmentKindLabel2(l.kind),
4132
4243
  l.mask ? " (masked)" : ""
4133
4244
  ] }, l.id))
4134
4245
  }
4135
4246
  ),
4136
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4137
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4138
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4139
- /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4247
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4248
+ /* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4249
+ /* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4250
+ /* @__PURE__ */ jsx24("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4140
4251
  ] }),
4141
- target.mask && /* @__PURE__ */ jsxs20(Fragment6, { children: [
4142
- /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4143
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4144
- /* @__PURE__ */ jsx22("span", { children: "Density" }),
4145
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4252
+ target.mask && /* @__PURE__ */ jsxs22(Fragment7, { children: [
4253
+ /* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
4254
+ /* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
4255
+ /* @__PURE__ */ jsx24("span", { children: "Density" }),
4256
+ /* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
4146
4257
  Math.round((target.mask.density ?? 1) * 100),
4147
4258
  "%"
4148
4259
  ] })
4149
4260
  ] }),
4150
- /* @__PURE__ */ jsx22(
4261
+ /* @__PURE__ */ jsx24(
4151
4262
  "input",
4152
4263
  {
4153
4264
  type: "range",
@@ -4161,15 +4272,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4161
4272
  }
4162
4273
  )
4163
4274
  ] }),
4164
- /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4165
- /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4166
- /* @__PURE__ */ jsx22("span", { children: "Mask Feather" }),
4167
- /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4275
+ /* @__PURE__ */ jsxs22("label", { className: "flex flex-col gap-1", children: [
4276
+ /* @__PURE__ */ jsxs22("span", { className: "flex justify-between text-muted-foreground", children: [
4277
+ /* @__PURE__ */ jsx24("span", { children: "Mask Feather" }),
4278
+ /* @__PURE__ */ jsxs22("span", { className: "font-mono", children: [
4168
4279
  target.mask.feather ?? 0,
4169
4280
  "px"
4170
4281
  ] })
4171
4282
  ] }),
4172
- /* @__PURE__ */ jsx22(
4283
+ /* @__PURE__ */ jsx24(
4173
4284
  "input",
4174
4285
  {
4175
4286
  type: "range",
@@ -4189,9 +4300,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4189
4300
  };
4190
4301
 
4191
4302
  // src/image-editor/ChannelsPanel.tsx
4192
- import { useEffect as useEffect12, useRef as useRef12, useState as useState19 } from "react";
4303
+ import { useEffect as useEffect12, useRef as useRef12, useState as useState21 } from "react";
4193
4304
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
4194
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4305
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4195
4306
  var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
4196
4307
  var ChannelThumb = ({ channel, size }) => {
4197
4308
  const ref = useRef12(null);
@@ -4206,14 +4317,14 @@ var ChannelThumb = ({ channel, size }) => {
4206
4317
  img.data.set(px.data);
4207
4318
  ctx.putImageData(img, 0, 0);
4208
4319
  }, [channel.mask]);
4209
- return /* @__PURE__ */ jsx23("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4320
+ return /* @__PURE__ */ jsx25("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4210
4321
  };
4211
4322
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4212
- const [, setTick] = useState19(0);
4323
+ const [, setTick] = useState21(0);
4213
4324
  useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4214
- const [activeId, setActiveId] = useState19(null);
4215
- const [renaming, setRenaming] = useState19(null);
4216
- const [error, setError] = useState19(null);
4325
+ const [activeId, setActiveId] = useState21(null);
4326
+ const [renaming, setRenaming] = useState21(null);
4327
+ const [error, setError] = useState21(null);
4217
4328
  const fileInput = useRef12(null);
4218
4329
  const channels = controller.getChannels();
4219
4330
  const active = channels.find((c) => c.id === activeId) ?? null;
@@ -4236,13 +4347,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4236
4347
  setError(err instanceof Error ? err.message : String(err));
4237
4348
  }
4238
4349
  };
4239
- return /* @__PURE__ */ jsxs21("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4240
- /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
4241
- /* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Channels" }),
4242
- /* @__PURE__ */ jsx23("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
4350
+ return /* @__PURE__ */ jsxs23("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4351
+ /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between", children: [
4352
+ /* @__PURE__ */ jsx25("span", { className: imageSectionTitleClass, children: "Channels" }),
4353
+ /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
4243
4354
  ] }),
4244
- channels.length === 0 && /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4245
- /* @__PURE__ */ jsx23("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs21(
4355
+ channels.length === 0 && /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4356
+ /* @__PURE__ */ jsx25("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs23(
4246
4357
  "li",
4247
4358
  {
4248
4359
  "data-testid": "channel-row",
@@ -4254,7 +4365,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4254
4365
  },
4255
4366
  onDoubleClick: () => setRenaming(c.id),
4256
4367
  children: [
4257
- /* @__PURE__ */ jsx23(
4368
+ /* @__PURE__ */ jsx25(
4258
4369
  "button",
4259
4370
  {
4260
4371
  type: "button",
@@ -4268,8 +4379,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4268
4379
  children: c.visible ? "\u25CF" : "\u25CB"
4269
4380
  }
4270
4381
  ),
4271
- /* @__PURE__ */ jsx23(ChannelThumb, { channel: c, size: thumbnailSize }),
4272
- renaming === c.id ? /* @__PURE__ */ jsx23(
4382
+ /* @__PURE__ */ jsx25(ChannelThumb, { channel: c, size: thumbnailSize }),
4383
+ renaming === c.id ? /* @__PURE__ */ jsx25(
4273
4384
  "input",
4274
4385
  {
4275
4386
  autoFocus: true,
@@ -4286,16 +4397,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4286
4397
  if (e.key === "Escape") setRenaming(null);
4287
4398
  }
4288
4399
  }
4289
- ) : /* @__PURE__ */ jsx23("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4400
+ ) : /* @__PURE__ */ jsx25("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4290
4401
  ]
4291
4402
  },
4292
4403
  c.id
4293
4404
  )) }),
4294
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4295
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4296
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
4297
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4298
- /* @__PURE__ */ jsx23(
4405
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
4406
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4407
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
4408
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4409
+ /* @__PURE__ */ jsx25(
4299
4410
  "button",
4300
4411
  {
4301
4412
  type: "button",
@@ -4308,8 +4419,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4308
4419
  children: "Delete"
4309
4420
  }
4310
4421
  ),
4311
- /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4312
- /* @__PURE__ */ jsx23(
4422
+ /* @__PURE__ */ jsx25("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4423
+ /* @__PURE__ */ jsx25(
4313
4424
  "button",
4314
4425
  {
4315
4426
  type: "button",
@@ -4320,7 +4431,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4320
4431
  children: "Export PNG"
4321
4432
  }
4322
4433
  ),
4323
- /* @__PURE__ */ jsx23(
4434
+ /* @__PURE__ */ jsx25(
4324
4435
  "input",
4325
4436
  {
4326
4437
  ref: fileInput,
@@ -4335,22 +4446,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4335
4446
  }
4336
4447
  )
4337
4448
  ] }),
4338
- error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4449
+ error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
4339
4450
  ] });
4340
4451
  };
4341
4452
 
4342
4453
  // src/image-editor/PathsPanel.tsx
4343
- import { useEffect as useEffect13, useState as useState20 } from "react";
4454
+ import { useEffect as useEffect13, useState as useState22 } from "react";
4344
4455
  import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
4345
- import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4456
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4346
4457
  var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
4347
4458
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4348
- const [, setTick] = useState20(0);
4459
+ const [, setTick] = useState22(0);
4349
4460
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4350
- const [renaming, setRenaming] = useState20(null);
4351
- const [color, setColor] = useState20("#000000");
4352
- const [width, setWidth] = useState20(2);
4353
- const [error, setError] = useState20(null);
4461
+ const [renaming, setRenaming] = useState22(null);
4462
+ const [color, setColor] = useState22("#000000");
4463
+ const [width, setWidth] = useState22(2);
4464
+ const [error, setError] = useState22(null);
4354
4465
  const paths = controller.getPaths();
4355
4466
  const activeId = controller.getState().activePathId ?? null;
4356
4467
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -4366,10 +4477,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4366
4477
  };
4367
4478
  return (
4368
4479
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
4369
- /* @__PURE__ */ jsxs22("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4370
- /* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Paths" }),
4371
- paths.length === 0 && /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4372
- /* @__PURE__ */ jsx24("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs22(
4480
+ /* @__PURE__ */ jsxs24("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4481
+ /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Paths" }),
4482
+ paths.length === 0 && /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4483
+ /* @__PURE__ */ jsx26("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs24(
4373
4484
  "li",
4374
4485
  {
4375
4486
  "data-testid": "path-row",
@@ -4378,8 +4489,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4378
4489
  onClick: () => attempt(() => controller.setActivePath(p.id)),
4379
4490
  onDoubleClick: () => setRenaming(p.id),
4380
4491
  children: [
4381
- /* @__PURE__ */ jsx24("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx24("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4382
- renaming === p.id ? /* @__PURE__ */ jsx24(
4492
+ /* @__PURE__ */ jsx26("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx26("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4493
+ renaming === p.id ? /* @__PURE__ */ jsx26(
4383
4494
  "input",
4384
4495
  {
4385
4496
  autoFocus: true,
@@ -4398,13 +4509,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4398
4509
  if (e.key === "Escape") setRenaming(null);
4399
4510
  }
4400
4511
  }
4401
- ) : /* @__PURE__ */ jsx24("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4512
+ ) : /* @__PURE__ */ jsx26("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4402
4513
  ]
4403
4514
  },
4404
4515
  p.id
4405
4516
  )) }),
4406
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4407
- /* @__PURE__ */ jsx24(
4517
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap gap-1", children: [
4518
+ /* @__PURE__ */ jsx26(
4408
4519
  "button",
4409
4520
  {
4410
4521
  type: "button",
@@ -4415,15 +4526,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4415
4526
  children: "Load as Selection"
4416
4527
  }
4417
4528
  ),
4418
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4419
- active?.work && /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4420
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4529
+ /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4530
+ active?.work && /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4531
+ /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4421
4532
  ] }),
4422
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-1", children: [
4423
- /* @__PURE__ */ jsx24("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
4424
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4425
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4426
- /* @__PURE__ */ jsx24(
4533
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-1", children: [
4534
+ /* @__PURE__ */ jsx26("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
4535
+ /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4536
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4537
+ /* @__PURE__ */ jsx26(
4427
4538
  "input",
4428
4539
  {
4429
4540
  type: "number",
@@ -4438,24 +4549,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4438
4549
  ),
4439
4550
  "px"
4440
4551
  ] }),
4441
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4552
+ /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4442
4553
  ] }),
4443
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4444
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4445
- /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4554
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap gap-1", children: [
4555
+ /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4556
+ /* @__PURE__ */ jsx26("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4446
4557
  ] }),
4447
- error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4558
+ error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4448
4559
  ] })
4449
4560
  );
4450
4561
  };
4451
4562
 
4452
4563
  // src/image-editor/FreeTransformOptionsBar.tsx
4453
- import { useEffect as useEffect14, useState as useState21 } from "react";
4564
+ import { useEffect as useEffect14, useState as useState23 } from "react";
4454
4565
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
4455
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4566
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4456
4567
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4457
4568
  var FreeTransformOptionsBar = ({ tool, className }) => {
4458
- const [, setTick] = useState21(0);
4569
+ const [, setTick] = useState23(0);
4459
4570
  useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4460
4571
  const bar = tool.bar();
4461
4572
  if (!tool.active || !bar) return null;
@@ -4468,17 +4579,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4468
4579
  const v = Number(raw);
4469
4580
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4470
4581
  };
4471
- return /* @__PURE__ */ jsxs23("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4472
- /* @__PURE__ */ jsx25("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx25("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4473
- /* @__PURE__ */ jsx25("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4474
- tool.mode === "warp" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4475
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4476
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Warp" }),
4477
- /* @__PURE__ */ jsx25("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx25("option", { value: o.id, children: o.label }, o.id)) })
4582
+ return /* @__PURE__ */ jsxs25("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4583
+ /* @__PURE__ */ jsx27("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx27("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4584
+ /* @__PURE__ */ jsx27("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4585
+ tool.mode === "warp" && /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4586
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4587
+ /* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "Warp" }),
4588
+ /* @__PURE__ */ jsx27("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx27("option", { value: o.id, children: o.label }, o.id)) })
4478
4589
  ] }),
4479
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4480
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4481
- /* @__PURE__ */ jsx25(
4590
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4591
+ /* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4592
+ /* @__PURE__ */ jsx27(
4482
4593
  "input",
4483
4594
  {
4484
4595
  type: "number",
@@ -4499,9 +4610,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4499
4610
  },
4500
4611
  `${k}:${warp[k]}`
4501
4612
  ),
4502
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "%" })
4613
+ /* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "%" })
4503
4614
  ] }, k)),
4504
- /* @__PURE__ */ jsx25(
4615
+ /* @__PURE__ */ jsx27(
4505
4616
  "button",
4506
4617
  {
4507
4618
  type: "button",
@@ -4513,9 +4624,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4513
4624
  children: "Vertical"
4514
4625
  }
4515
4626
  ),
4516
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4517
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Grid" }),
4518
- /* @__PURE__ */ jsx25(
4627
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4628
+ /* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "Grid" }),
4629
+ /* @__PURE__ */ jsx27(
4519
4630
  "select",
4520
4631
  {
4521
4632
  "aria-label": "Warp grid",
@@ -4525,14 +4636,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4525
4636
  tool.setWarp({ columns: g.columns, rows: g.rows });
4526
4637
  },
4527
4638
  className: imageFieldClass,
4528
- children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx25("option", { value: g.id, children: g.label }, g.id))
4639
+ children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx27("option", { value: g.id, children: g.label }, g.id))
4529
4640
  }
4530
4641
  )
4531
4642
  ] })
4532
4643
  ] }),
4533
- tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", title: f.title, children: [
4534
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.label }),
4535
- /* @__PURE__ */ jsx25(
4644
+ tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", title: f.title, children: [
4645
+ /* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: f.label }),
4646
+ /* @__PURE__ */ jsx27(
4536
4647
  "input",
4537
4648
  {
4538
4649
  type: "number",
@@ -4552,8 +4663,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4552
4663
  },
4553
4664
  `${f.id}:${round(bar[f.id], f.unit)}`
4554
4665
  ),
4555
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.unit }),
4556
- f.id === "scaleX" && /* @__PURE__ */ jsx25(
4666
+ /* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: f.unit }),
4667
+ f.id === "scaleX" && /* @__PURE__ */ jsx27(
4557
4668
  "button",
4558
4669
  {
4559
4670
  type: "button",
@@ -4568,33 +4679,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4568
4679
  }
4569
4680
  )
4570
4681
  ] }, f.id)),
4571
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4572
- /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Interpolation" }),
4573
- /* @__PURE__ */ jsx25(
4682
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4683
+ /* @__PURE__ */ jsx27("span", { className: "text-muted-foreground", children: "Interpolation" }),
4684
+ /* @__PURE__ */ jsx27(
4574
4685
  "select",
4575
4686
  {
4576
4687
  "aria-label": "Interpolation",
4577
4688
  value: tool.interpolation,
4578
4689
  onChange: (e) => tool.setInterpolation(e.target.value),
4579
4690
  className: imageFieldClass,
4580
- children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx25("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4691
+ children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx27("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4581
4692
  }
4582
4693
  )
4583
4694
  ] }),
4584
- /* @__PURE__ */ jsx25("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4585
- /* @__PURE__ */ jsx25("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4586
- tool.error && /* @__PURE__ */ jsx25("span", { role: "alert", className: "text-destructive", children: tool.error })
4695
+ /* @__PURE__ */ jsx27("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4696
+ /* @__PURE__ */ jsx27("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4697
+ tool.error && /* @__PURE__ */ jsx27("span", { role: "alert", className: "text-destructive", children: tool.error })
4587
4698
  ] });
4588
4699
  };
4589
4700
 
4590
4701
  // src/image-editor/ShapeOptionsBar.tsx
4591
- import { useEffect as useEffect15, useState as useState22 } from "react";
4702
+ import { useEffect as useEffect15, useState as useState24 } from "react";
4592
4703
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4593
- import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4704
+ import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4594
4705
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4595
- const [, setTick] = useState22(0);
4706
+ const [, setTick] = useState24(0);
4596
4707
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4597
- const [error, setError] = useState22(null);
4708
+ const [error, setError] = useState24(null);
4598
4709
  const active = controller.getActiveLayer();
4599
4710
  const shapeId = active?.type === "shape" ? active.id : null;
4600
4711
  const set = (change) => {
@@ -4608,22 +4719,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4608
4719
  }
4609
4720
  };
4610
4721
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4611
- return /* @__PURE__ */ jsxs24("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4612
- /* @__PURE__ */ jsx26("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4613
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4614
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4615
- /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4722
+ return /* @__PURE__ */ jsxs26("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4723
+ /* @__PURE__ */ jsx28("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4724
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-3", children: [
4725
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4726
+ /* @__PURE__ */ jsx28(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4616
4727
  "Fill",
4617
- /* @__PURE__ */ jsx26(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4728
+ /* @__PURE__ */ jsx28(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4618
4729
  ] }),
4619
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4620
- /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4730
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4731
+ /* @__PURE__ */ jsx28(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4621
4732
  "Stroke",
4622
- /* @__PURE__ */ jsx26(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4733
+ /* @__PURE__ */ jsx28(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4623
4734
  ] }),
4624
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4735
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4625
4736
  "Width",
4626
- /* @__PURE__ */ jsx26(
4737
+ /* @__PURE__ */ jsx28(
4627
4738
  "input",
4628
4739
  {
4629
4740
  type: "number",
@@ -4637,52 +4748,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4637
4748
  )
4638
4749
  ] })
4639
4750
  ] }),
4640
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4641
- options.kind === "rect" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4751
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-3", children: [
4752
+ options.kind === "rect" && /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4642
4753
  "Radius",
4643
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4754
+ /* @__PURE__ */ jsx28("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4644
4755
  ] }),
4645
- options.kind === "polygon" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4756
+ options.kind === "polygon" && /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4646
4757
  "Sides",
4647
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4758
+ /* @__PURE__ */ jsx28("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4648
4759
  ] }),
4649
- options.kind === "star" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4650
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4760
+ options.kind === "star" && /* @__PURE__ */ jsxs26(Fragment8, { children: [
4761
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4651
4762
  "Points",
4652
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4763
+ /* @__PURE__ */ jsx28("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4653
4764
  ] }),
4654
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4765
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4655
4766
  "Inner",
4656
- /* @__PURE__ */ jsx26(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4767
+ /* @__PURE__ */ jsx28(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4657
4768
  ] })
4658
4769
  ] }),
4659
- options.kind === "line" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4660
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4770
+ options.kind === "line" && /* @__PURE__ */ jsxs26(Fragment8, { children: [
4771
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4661
4772
  "Weight",
4662
- /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4773
+ /* @__PURE__ */ jsx28("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4663
4774
  ] }),
4664
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4665
- /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4775
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4776
+ /* @__PURE__ */ jsx28(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4666
4777
  "Arrowhead"
4667
4778
  ] })
4668
4779
  ] })
4669
4780
  ] }),
4670
- /* @__PURE__ */ jsx26("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4671
- error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4781
+ /* @__PURE__ */ jsx28("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4782
+ error && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: error })
4672
4783
  ] });
4673
4784
  };
4674
4785
 
4675
4786
  // src/image-editor/TypeOptionsBar.tsx
4676
- import { useEffect as useEffect16, useState as useState23 } from "react";
4787
+ import { useEffect as useEffect16, useState as useState25 } from "react";
4677
4788
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
4678
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4789
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
4679
4790
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4680
4791
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
4681
4792
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4682
- const [, setTick] = useState23(0);
4793
+ const [, setTick] = useState25(0);
4683
4794
  useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4684
4795
  useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4685
- const [error, setError] = useState23(null);
4796
+ const [error, setError] = useState25(null);
4686
4797
  const active = controller.getActiveLayer();
4687
4798
  const typeId = !session && active?.type === "type" ? active.id : null;
4688
4799
  const here = session?.alive ? session.styleHere() : {};
@@ -4735,11 +4846,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4735
4846
  setError(e instanceof Error ? e.message : String(e));
4736
4847
  }
4737
4848
  };
4738
- return /* @__PURE__ */ jsxs25("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4739
- /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", children: [
4740
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4849
+ return /* @__PURE__ */ jsxs27("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4850
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-2", children: [
4851
+ /* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-1", children: [
4741
4852
  "Font",
4742
- /* @__PURE__ */ jsx27(
4853
+ /* @__PURE__ */ jsx29(
4743
4854
  "input",
4744
4855
  {
4745
4856
  list: "pixerate-type-fonts",
@@ -4749,11 +4860,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4749
4860
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4750
4861
  }
4751
4862
  ),
4752
- /* @__PURE__ */ jsx27("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx27("option", { value: f }, f)) })
4863
+ /* @__PURE__ */ jsx29("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx29("option", { value: f }, f)) })
4753
4864
  ] }),
4754
- /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4865
+ /* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-1", children: [
4755
4866
  "Size",
4756
- /* @__PURE__ */ jsx27(
4867
+ /* @__PURE__ */ jsx29(
4757
4868
  "input",
4758
4869
  {
4759
4870
  type: "number",
@@ -4766,14 +4877,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4766
4877
  }
4767
4878
  )
4768
4879
  ] }),
4769
- /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4770
- /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4771
- /* @__PURE__ */ jsx27(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4880
+ /* @__PURE__ */ jsx29("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4881
+ /* @__PURE__ */ jsx29("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4882
+ /* @__PURE__ */ jsx29(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4772
4883
  ] }),
4773
- /* @__PURE__ */ jsx27("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4774
- /* @__PURE__ */ jsxs25("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4775
- TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4776
- orientation === "vertical" && editedId && /* @__PURE__ */ jsx27(
4884
+ /* @__PURE__ */ jsx29("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx29("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4885
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4886
+ TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx29("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4887
+ orientation === "vertical" && editedId && /* @__PURE__ */ jsx29(
4777
4888
  "button",
4778
4889
  {
4779
4890
  type: "button",
@@ -4785,19 +4896,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4785
4896
  }
4786
4897
  )
4787
4898
  ] }),
4788
- /* @__PURE__ */ jsx27("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4789
- missing.length > 0 && /* @__PURE__ */ jsxs25("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4899
+ /* @__PURE__ */ jsx29("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4900
+ missing.length > 0 && /* @__PURE__ */ jsxs27("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4790
4901
  "Missing ",
4791
4902
  missing.length === 1 ? "font" : "fonts",
4792
4903
  ": ",
4793
4904
  missing.join(", ")
4794
4905
  ] }),
4795
- error && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: error })
4906
+ error && /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-destructive", children: error })
4796
4907
  ] });
4797
4908
  };
4798
4909
 
4799
4910
  // src/image-editor/ImageEditor.tsx
4800
- import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4911
+ import { Fragment as Fragment9, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
4801
4912
  var ImageEditor = ({
4802
4913
  editor: externalEditor,
4803
4914
  src,
@@ -4822,7 +4933,7 @@ var ImageEditor = ({
4822
4933
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
4823
4934
  });
4824
4935
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
4825
- const [activeTab, setActiveTab] = useState24("crop");
4936
+ const [activeTab, setActiveTab] = useState26("crop");
4826
4937
  const rootRef = useRef13(null);
4827
4938
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4828
4939
  const activeTabRef = useRef13(activeTab);
@@ -4832,14 +4943,14 @@ var ImageEditor = ({
4832
4943
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4833
4944
  await new Promise((resolve) => setTimeout(resolve, 60));
4834
4945
  };
4835
- const [activeCropRatio, setActiveCropRatio] = useState24(null);
4836
- const [selectionOptions, setSelectionOptions] = useState24(DEFAULT_SELECTION_TOOL_OPTIONS2);
4837
- const [shapeOptions, setShapeOptions] = useState24(DEFAULT_SHAPE_TOOL_OPTIONS2);
4838
- const [typeOptions, setTypeOptions] = useState24(DEFAULT_TYPE_TOOL_OPTIONS2);
4839
- const [typeSession, setTypeSession] = useState24(null);
4840
- const [selectionError, setSelectionError] = useState24(null);
4841
- const [paintError, setPaintError] = useState24(null);
4842
- const [shapeTypeError, setShapeTypeError] = useState24(null);
4946
+ const [activeCropRatio, setActiveCropRatio] = useState26(null);
4947
+ const [selectionOptions, setSelectionOptions] = useState26(DEFAULT_SELECTION_TOOL_OPTIONS2);
4948
+ const [shapeOptions, setShapeOptions] = useState26(DEFAULT_SHAPE_TOOL_OPTIONS2);
4949
+ const [typeOptions, setTypeOptions] = useState26(DEFAULT_TYPE_TOOL_OPTIONS2);
4950
+ const [typeSession, setTypeSession] = useState26(null);
4951
+ const [selectionError, setSelectionError] = useState26(null);
4952
+ const [paintError, setPaintError] = useState26(null);
4953
+ const [shapeTypeError, setShapeTypeError] = useState26(null);
4843
4954
  const handleCanvasError = (source, message) => {
4844
4955
  if (source === "paint") setPaintError(message);
4845
4956
  else if (source === "select") setSelectionError(message);
@@ -4856,16 +4967,16 @@ var ImageEditor = ({
4856
4967
  transformControllerRef.current = controller;
4857
4968
  }
4858
4969
  const transformTool = transformToolRef.current;
4859
- const [, setTransformTick] = useState24(0);
4970
+ const [, setTransformTick] = useState26(0);
4860
4971
  useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4861
4972
  useEffect17(() => () => transformToolRef.current?.cancel(), []);
4862
- const [inpaintPrompt, setInpaintPrompt] = useState24("");
4863
- const [inpaintMaskMode, setInpaintMaskMode] = useState24("annotations");
4864
- const [isRemovingBg, setIsRemovingBg] = useState24(false);
4865
- const [isInpainting, setIsInpainting] = useState24(false);
4866
- const [aiError, setAiError] = useState24(null);
4867
- const [aiSuccess, setAiSuccess] = useState24(null);
4868
- const [aiTarget, setAiTarget] = useState24("auto");
4973
+ const [inpaintPrompt, setInpaintPrompt] = useState26("");
4974
+ const [inpaintMaskMode, setInpaintMaskMode] = useState26("annotations");
4975
+ const [isRemovingBg, setIsRemovingBg] = useState26(false);
4976
+ const [isInpainting, setIsInpainting] = useState26(false);
4977
+ const [aiError, setAiError] = useState26(null);
4978
+ const [aiSuccess, setAiSuccess] = useState26(null);
4979
+ const [aiTarget, setAiTarget] = useState26("auto");
4869
4980
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4870
4981
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4871
4982
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4928,10 +5039,10 @@ var ImageEditor = ({
4928
5039
  setIsInpainting(false);
4929
5040
  }
4930
5041
  };
4931
- const [activeColor, setActiveColor] = useState24("#ef4444");
4932
- const [strokeWidth, setStrokeWidth] = useState24(3);
4933
- const [fontSize, setFontSize] = useState24(24);
4934
- const [textInput, setTextInput] = useState24("");
5042
+ const [activeColor, setActiveColor] = useState26("#ef4444");
5043
+ const [strokeWidth, setStrokeWidth] = useState26(3);
5044
+ const [fontSize, setFontSize] = useState26(24);
5045
+ const [textInput, setTextInput] = useState26("");
4935
5046
  useEffect17(() => {
4936
5047
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4937
5048
  editor.setTool("crop");
@@ -4960,16 +5071,16 @@ var ImageEditor = ({
4960
5071
  link.click();
4961
5072
  }
4962
5073
  };
4963
- return /* @__PURE__ */ jsxs26(
5074
+ return /* @__PURE__ */ jsxs28(
4964
5075
  "div",
4965
5076
  {
4966
5077
  ref: rootRef,
4967
5078
  className: `${imageEditorFrameClass} ${className}`,
4968
5079
  style,
4969
5080
  children: [
4970
- /* @__PURE__ */ jsxs26("div", { className: imageEditorHeaderClass, children: [
4971
- /* @__PURE__ */ jsxs26("div", { role: "tablist", className: imageTabListClass, children: [
4972
- /* @__PURE__ */ jsx28(
5081
+ /* @__PURE__ */ jsxs28("div", { className: imageEditorHeaderClass, children: [
5082
+ /* @__PURE__ */ jsxs28("div", { role: "tablist", className: imageTabListClass, children: [
5083
+ /* @__PURE__ */ jsx30(
4973
5084
  "button",
4974
5085
  {
4975
5086
  type: "button",
@@ -4984,7 +5095,7 @@ var ImageEditor = ({
4984
5095
  children: "Transform & Crop"
4985
5096
  }
4986
5097
  ),
4987
- /* @__PURE__ */ jsx28(
5098
+ /* @__PURE__ */ jsx30(
4988
5099
  "button",
4989
5100
  {
4990
5101
  type: "button",
@@ -4999,7 +5110,7 @@ var ImageEditor = ({
4999
5110
  children: "Adjustments"
5000
5111
  }
5001
5112
  ),
5002
- /* @__PURE__ */ jsx28(
5113
+ /* @__PURE__ */ jsx30(
5003
5114
  "button",
5004
5115
  {
5005
5116
  type: "button",
@@ -5014,7 +5125,7 @@ var ImageEditor = ({
5014
5125
  children: "Layers"
5015
5126
  }
5016
5127
  ),
5017
- /* @__PURE__ */ jsx28(
5128
+ /* @__PURE__ */ jsx30(
5018
5129
  "button",
5019
5130
  {
5020
5131
  type: "button",
@@ -5029,7 +5140,7 @@ var ImageEditor = ({
5029
5140
  children: "Paint"
5030
5141
  }
5031
5142
  ),
5032
- /* @__PURE__ */ jsx28(
5143
+ /* @__PURE__ */ jsx30(
5033
5144
  "button",
5034
5145
  {
5035
5146
  type: "button",
@@ -5044,7 +5155,7 @@ var ImageEditor = ({
5044
5155
  children: "Select & Mask"
5045
5156
  }
5046
5157
  ),
5047
- /* @__PURE__ */ jsx28(
5158
+ /* @__PURE__ */ jsx30(
5048
5159
  "button",
5049
5160
  {
5050
5161
  type: "button",
@@ -5059,7 +5170,7 @@ var ImageEditor = ({
5059
5170
  children: "Annotations"
5060
5171
  }
5061
5172
  ),
5062
- /* @__PURE__ */ jsx28(
5173
+ /* @__PURE__ */ jsx30(
5063
5174
  "button",
5064
5175
  {
5065
5176
  type: "button",
@@ -5074,7 +5185,7 @@ var ImageEditor = ({
5074
5185
  children: "Depth Mask"
5075
5186
  }
5076
5187
  ),
5077
- /* @__PURE__ */ jsxs26(
5188
+ /* @__PURE__ */ jsxs28(
5078
5189
  "button",
5079
5190
  {
5080
5191
  type: "button",
@@ -5087,14 +5198,14 @@ var ImageEditor = ({
5087
5198
  "aria-selected": activeTab === "ai",
5088
5199
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
5089
5200
  children: [
5090
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5201
+ /* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5091
5202
  "AI Tools"
5092
5203
  ]
5093
5204
  }
5094
5205
  )
5095
5206
  ] }),
5096
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 text-xs", children: [
5097
- /* @__PURE__ */ jsx28(
5207
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 text-xs", children: [
5208
+ /* @__PURE__ */ jsx30(
5098
5209
  "button",
5099
5210
  {
5100
5211
  type: "button",
@@ -5105,7 +5216,7 @@ var ImageEditor = ({
5105
5216
  children: "\u21A9"
5106
5217
  }
5107
5218
  ),
5108
- /* @__PURE__ */ jsx28(
5219
+ /* @__PURE__ */ jsx30(
5109
5220
  "button",
5110
5221
  {
5111
5222
  type: "button",
@@ -5116,7 +5227,7 @@ var ImageEditor = ({
5116
5227
  children: "\u21AA"
5117
5228
  }
5118
5229
  ),
5119
- /* @__PURE__ */ jsx28(
5230
+ /* @__PURE__ */ jsx30(
5120
5231
  "button",
5121
5232
  {
5122
5233
  type: "button",
@@ -5125,8 +5236,8 @@ var ImageEditor = ({
5125
5236
  children: "Reset"
5126
5237
  }
5127
5238
  ),
5128
- /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5129
- /* @__PURE__ */ jsx28(
5239
+ /* @__PURE__ */ jsx30("div", { className: "h-4 w-px bg-muted mx-1" }),
5240
+ /* @__PURE__ */ jsx30(
5130
5241
  "button",
5131
5242
  {
5132
5243
  type: "button",
@@ -5136,11 +5247,11 @@ var ImageEditor = ({
5136
5247
  children: "-"
5137
5248
  }
5138
5249
  ),
5139
- /* @__PURE__ */ jsxs26("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5250
+ /* @__PURE__ */ jsxs28("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5140
5251
  Math.round(state.zoom * 100),
5141
5252
  "%"
5142
5253
  ] }),
5143
- /* @__PURE__ */ jsx28(
5254
+ /* @__PURE__ */ jsx30(
5144
5255
  "button",
5145
5256
  {
5146
5257
  type: "button",
@@ -5150,8 +5261,8 @@ var ImageEditor = ({
5150
5261
  children: "+"
5151
5262
  }
5152
5263
  ),
5153
- /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5154
- /* @__PURE__ */ jsx28(
5264
+ /* @__PURE__ */ jsx30("div", { className: "h-4 w-px bg-muted mx-1" }),
5265
+ /* @__PURE__ */ jsx30(
5155
5266
  "button",
5156
5267
  {
5157
5268
  type: "button",
@@ -5162,7 +5273,7 @@ var ImageEditor = ({
5162
5273
  children: "Hold Compare"
5163
5274
  }
5164
5275
  ),
5165
- /* @__PURE__ */ jsx28(
5276
+ /* @__PURE__ */ jsx30(
5166
5277
  "button",
5167
5278
  {
5168
5279
  type: "button",
@@ -5173,10 +5284,10 @@ var ImageEditor = ({
5173
5284
  )
5174
5285
  ] })
5175
5286
  ] }),
5176
- transformTool.active && /* @__PURE__ */ jsx28(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5177
- !transformTool.active && transformTool.error && /* @__PURE__ */ jsx28("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5178
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5179
- /* @__PURE__ */ jsx28(
5287
+ transformTool.active && /* @__PURE__ */ jsx30(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5288
+ !transformTool.active && transformTool.error && /* @__PURE__ */ jsx30("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5289
+ /* @__PURE__ */ jsxs28("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5290
+ /* @__PURE__ */ jsx30(
5180
5291
  ImageEditorCanvas,
5181
5292
  {
5182
5293
  editor,
@@ -5200,11 +5311,11 @@ var ImageEditor = ({
5200
5311
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5201
5312
  }
5202
5313
  ),
5203
- /* @__PURE__ */ jsxs26("div", { className: imageSidebarClass, children: [
5204
- activeTab === "crop" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5205
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5206
- /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-3 gap-2", children: [
5207
- /* @__PURE__ */ jsx28(
5314
+ /* @__PURE__ */ jsxs28("div", { className: imageSidebarClass, children: [
5315
+ activeTab === "crop" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-4 text-xs", children: [
5316
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5317
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-3 gap-2", children: [
5318
+ /* @__PURE__ */ jsx30(
5208
5319
  "button",
5209
5320
  {
5210
5321
  type: "button",
@@ -5216,7 +5327,7 @@ var ImageEditor = ({
5216
5327
  children: "Freeform"
5217
5328
  }
5218
5329
  ),
5219
- /* @__PURE__ */ jsx28(
5330
+ /* @__PURE__ */ jsx30(
5220
5331
  "button",
5221
5332
  {
5222
5333
  type: "button",
@@ -5228,7 +5339,7 @@ var ImageEditor = ({
5228
5339
  children: "1:1 Square"
5229
5340
  }
5230
5341
  ),
5231
- /* @__PURE__ */ jsx28(
5342
+ /* @__PURE__ */ jsx30(
5232
5343
  "button",
5233
5344
  {
5234
5345
  type: "button",
@@ -5240,7 +5351,7 @@ var ImageEditor = ({
5240
5351
  children: "4:3 Standard"
5241
5352
  }
5242
5353
  ),
5243
- /* @__PURE__ */ jsx28(
5354
+ /* @__PURE__ */ jsx30(
5244
5355
  "button",
5245
5356
  {
5246
5357
  type: "button",
@@ -5252,7 +5363,7 @@ var ImageEditor = ({
5252
5363
  children: "16:9 Wide"
5253
5364
  }
5254
5365
  ),
5255
- /* @__PURE__ */ jsx28(
5366
+ /* @__PURE__ */ jsx30(
5256
5367
  "button",
5257
5368
  {
5258
5369
  type: "button",
@@ -5264,7 +5375,7 @@ var ImageEditor = ({
5264
5375
  children: "3:2 Photo"
5265
5376
  }
5266
5377
  ),
5267
- /* @__PURE__ */ jsx28(
5378
+ /* @__PURE__ */ jsx30(
5268
5379
  "button",
5269
5380
  {
5270
5381
  type: "button",
@@ -5277,10 +5388,10 @@ var ImageEditor = ({
5277
5388
  }
5278
5389
  )
5279
5390
  ] }),
5280
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5281
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5282
- /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-2", children: [
5283
- /* @__PURE__ */ jsx28(
5391
+ /* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
5392
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5393
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-2 gap-2", children: [
5394
+ /* @__PURE__ */ jsx30(
5284
5395
  "button",
5285
5396
  {
5286
5397
  type: "button",
@@ -5289,7 +5400,7 @@ var ImageEditor = ({
5289
5400
  children: "Rotate -90\xB0"
5290
5401
  }
5291
5402
  ),
5292
- /* @__PURE__ */ jsx28(
5403
+ /* @__PURE__ */ jsx30(
5293
5404
  "button",
5294
5405
  {
5295
5406
  type: "button",
@@ -5298,7 +5409,7 @@ var ImageEditor = ({
5298
5409
  children: "Rotate +90\xB0"
5299
5410
  }
5300
5411
  ),
5301
- /* @__PURE__ */ jsx28(
5412
+ /* @__PURE__ */ jsx30(
5302
5413
  "button",
5303
5414
  {
5304
5415
  type: "button",
@@ -5307,7 +5418,7 @@ var ImageEditor = ({
5307
5418
  children: "Flip Horizontal"
5308
5419
  }
5309
5420
  ),
5310
- /* @__PURE__ */ jsx28(
5421
+ /* @__PURE__ */ jsx30(
5311
5422
  "button",
5312
5423
  {
5313
5424
  type: "button",
@@ -5318,10 +5429,10 @@ var ImageEditor = ({
5318
5429
  )
5319
5430
  ] })
5320
5431
  ] }),
5321
- activeTab === "adjust" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5322
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5323
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5324
- /* @__PURE__ */ jsx28(
5432
+ activeTab === "adjust" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
5433
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
5434
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5435
+ /* @__PURE__ */ jsx30(
5325
5436
  "button",
5326
5437
  {
5327
5438
  type: "button",
@@ -5331,9 +5442,9 @@ var ImageEditor = ({
5331
5442
  }
5332
5443
  )
5333
5444
  ] }),
5334
- /* @__PURE__ */ jsx28(Histogram, { histogram: editor.histogram }),
5335
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs26(React23.Fragment, { children: [
5336
- /* @__PURE__ */ jsx28(
5445
+ /* @__PURE__ */ jsx30(Histogram, { histogram: editor.histogram }),
5446
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs28(React25.Fragment, { children: [
5447
+ /* @__PURE__ */ jsx30(
5337
5448
  ControlSlider,
5338
5449
  {
5339
5450
  spec,
@@ -5342,14 +5453,14 @@ var ImageEditor = ({
5342
5453
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5343
5454
  }
5344
5455
  ),
5345
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs26(
5456
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs28(
5346
5457
  "div",
5347
5458
  {
5348
5459
  className: "flex items-center justify-between gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-600",
5349
5460
  "data-testid": "image-editor-process-notice",
5350
5461
  children: [
5351
- /* @__PURE__ */ jsx28("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5352
- /* @__PURE__ */ jsx28(
5462
+ /* @__PURE__ */ jsx30("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5463
+ /* @__PURE__ */ jsx30(
5353
5464
  "button",
5354
5465
  {
5355
5466
  type: "button",
@@ -5362,7 +5473,7 @@ var ImageEditor = ({
5362
5473
  }
5363
5474
  )
5364
5475
  ] }, spec.id)),
5365
- /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(
5476
+ /* @__PURE__ */ jsx30("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx30(
5366
5477
  AdjustmentLayersPanel,
5367
5478
  {
5368
5479
  controller,
@@ -5371,9 +5482,9 @@ var ImageEditor = ({
5371
5482
  }
5372
5483
  ) })
5373
5484
  ] }),
5374
- activeTab === "layers" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5375
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Layers" }),
5376
- /* @__PURE__ */ jsx28(
5485
+ activeTab === "layers" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
5486
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Layers" }),
5487
+ /* @__PURE__ */ jsx30(
5377
5488
  "button",
5378
5489
  {
5379
5490
  type: "button",
@@ -5384,15 +5495,15 @@ var ImageEditor = ({
5384
5495
  children: "Free Transform"
5385
5496
  }
5386
5497
  ),
5387
- /* @__PURE__ */ jsx28(LayersPanel, { controller }),
5388
- effectsShown && /* @__PURE__ */ jsx28(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5389
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Colour" }),
5390
- /* @__PURE__ */ jsx28(ColorProfilePanel, { controller })
5498
+ /* @__PURE__ */ jsx30(LayersPanel, { controller }),
5499
+ effectsShown && /* @__PURE__ */ jsx30(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5500
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Colour" }),
5501
+ /* @__PURE__ */ jsx30(ColorProfilePanel, { controller })
5391
5502
  ] }),
5392
- activeTab === "paint" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5393
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Paint" }),
5394
- /* @__PURE__ */ jsx28(BrushOptionsBar, { controller }),
5395
- /* @__PURE__ */ jsx28(
5503
+ activeTab === "paint" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
5504
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Paint" }),
5505
+ /* @__PURE__ */ jsx30(BrushOptionsBar, { controller }),
5506
+ /* @__PURE__ */ jsx30(
5396
5507
  "button",
5397
5508
  {
5398
5509
  type: "button",
@@ -5403,12 +5514,12 @@ var ImageEditor = ({
5403
5514
  children: "Free Transform"
5404
5515
  }
5405
5516
  ),
5406
- paintError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5407
- /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(LayersPanel, { controller }) })
5517
+ paintError && /* @__PURE__ */ jsx30("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5518
+ /* @__PURE__ */ jsx30("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx30(LayersPanel, { controller }) })
5408
5519
  ] }),
5409
- activeTab === "annotate" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5410
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5411
- /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx28(
5520
+ activeTab === "annotate" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
5521
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5522
+ /* @__PURE__ */ jsx30("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx30(
5412
5523
  "button",
5413
5524
  {
5414
5525
  type: "button",
@@ -5419,13 +5530,13 @@ var ImageEditor = ({
5419
5530
  },
5420
5531
  t
5421
5532
  )) }),
5422
- state.activeTool === "shape" && /* @__PURE__ */ jsx28(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5423
- state.activeTool === "type" && /* @__PURE__ */ jsx28(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5424
- state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx28("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5425
- shapeTypeError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5426
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5427
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5428
- /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx28(
5533
+ state.activeTool === "shape" && /* @__PURE__ */ jsx30(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5534
+ state.activeTool === "type" && /* @__PURE__ */ jsx30(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5535
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx30("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5536
+ shapeTypeError && /* @__PURE__ */ jsx30("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5537
+ /* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
5538
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5539
+ /* @__PURE__ */ jsx30("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx30(
5429
5540
  "button",
5430
5541
  {
5431
5542
  type: "button",
@@ -5435,18 +5546,18 @@ var ImageEditor = ({
5435
5546
  },
5436
5547
  t
5437
5548
  )) }),
5438
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 mt-2", children: [
5439
- /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground", children: "Color:" }),
5440
- /* @__PURE__ */ jsx28(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5441
- /* @__PURE__ */ jsxs26("div", { className: "flex-1 ml-2", children: [
5442
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5443
- /* @__PURE__ */ jsx28("span", { children: "Width:" }),
5444
- /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5549
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 mt-2", children: [
5550
+ /* @__PURE__ */ jsx30("label", { className: "text-muted-foreground", children: "Color:" }),
5551
+ /* @__PURE__ */ jsx30(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5552
+ /* @__PURE__ */ jsxs28("div", { className: "flex-1 ml-2", children: [
5553
+ /* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5554
+ /* @__PURE__ */ jsx30("span", { children: "Width:" }),
5555
+ /* @__PURE__ */ jsxs28("span", { className: "font-mono", children: [
5445
5556
  strokeWidth,
5446
5557
  "px"
5447
5558
  ] })
5448
5559
  ] }),
5449
- /* @__PURE__ */ jsx28(
5560
+ /* @__PURE__ */ jsx30(
5450
5561
  "input",
5451
5562
  {
5452
5563
  type: "range",
@@ -5459,10 +5570,10 @@ var ImageEditor = ({
5459
5570
  )
5460
5571
  ] })
5461
5572
  ] }),
5462
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5463
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Add Text" }),
5464
- /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5465
- /* @__PURE__ */ jsx28(
5573
+ /* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
5574
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Add Text" }),
5575
+ /* @__PURE__ */ jsxs28("div", { className: "flex gap-2", children: [
5576
+ /* @__PURE__ */ jsx30(
5466
5577
  "input",
5467
5578
  {
5468
5579
  type: "text",
@@ -5473,7 +5584,7 @@ var ImageEditor = ({
5473
5584
  className: "flex-1 bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary"
5474
5585
  }
5475
5586
  ),
5476
- /* @__PURE__ */ jsx28(
5587
+ /* @__PURE__ */ jsx30(
5477
5588
  "button",
5478
5589
  {
5479
5590
  type: "button",
@@ -5483,14 +5594,14 @@ var ImageEditor = ({
5483
5594
  }
5484
5595
  )
5485
5596
  ] }),
5486
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5487
- /* @__PURE__ */ jsx28("span", { children: "Font Size:" }),
5488
- /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5597
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5598
+ /* @__PURE__ */ jsx30("span", { children: "Font Size:" }),
5599
+ /* @__PURE__ */ jsxs28("span", { className: "font-mono", children: [
5489
5600
  fontSize,
5490
5601
  "px"
5491
5602
  ] })
5492
5603
  ] }),
5493
- /* @__PURE__ */ jsx28(
5604
+ /* @__PURE__ */ jsx30(
5494
5605
  "input",
5495
5606
  {
5496
5607
  type: "range",
@@ -5501,14 +5612,14 @@ var ImageEditor = ({
5501
5612
  className: imageRangeClass
5502
5613
  }
5503
5614
  ),
5504
- /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5505
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5506
- /* @__PURE__ */ jsxs26("span", { className: "text-muted-foreground", children: [
5615
+ /* @__PURE__ */ jsx30("div", { className: imageDividerClass }),
5616
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
5617
+ /* @__PURE__ */ jsxs28("span", { className: "text-muted-foreground", children: [
5507
5618
  "Layers (",
5508
5619
  state.annotations.length,
5509
5620
  ")"
5510
5621
  ] }),
5511
- state.selectedAnnotationId && /* @__PURE__ */ jsx28(
5622
+ state.selectedAnnotationId && /* @__PURE__ */ jsx30(
5512
5623
  "button",
5513
5624
  {
5514
5625
  type: "button",
@@ -5517,7 +5628,7 @@ var ImageEditor = ({
5517
5628
  children: "Delete Selected"
5518
5629
  }
5519
5630
  ),
5520
- state.annotations.length > 0 && /* @__PURE__ */ jsx28(
5631
+ state.annotations.length > 0 && /* @__PURE__ */ jsx30(
5521
5632
  "button",
5522
5633
  {
5523
5634
  type: "button",
@@ -5528,10 +5639,10 @@ var ImageEditor = ({
5528
5639
  )
5529
5640
  ] })
5530
5641
  ] }),
5531
- activeTab === "depth" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5532
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5533
- /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5534
- /* @__PURE__ */ jsx28(
5642
+ activeTab === "depth" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-3 text-xs", children: [
5643
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
5644
+ /* @__PURE__ */ jsx30("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5645
+ /* @__PURE__ */ jsx30(
5535
5646
  "button",
5536
5647
  {
5537
5648
  type: "button",
@@ -5541,8 +5652,8 @@ var ImageEditor = ({
5541
5652
  }
5542
5653
  )
5543
5654
  ] }),
5544
- /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5545
- /* @__PURE__ */ jsx28(
5655
+ /* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5656
+ /* @__PURE__ */ jsx30(
5546
5657
  "input",
5547
5658
  {
5548
5659
  type: "checkbox",
@@ -5551,12 +5662,12 @@ var ImageEditor = ({
5551
5662
  className: "rounded accent-primary"
5552
5663
  }
5553
5664
  ),
5554
- /* @__PURE__ */ jsx28("span", { children: "Enable Depth / Alpha Mask" })
5665
+ /* @__PURE__ */ jsx30("span", { children: "Enable Depth / Alpha Mask" })
5555
5666
  ] }),
5556
- state.depthMask.enabled && /* @__PURE__ */ jsxs26(Fragment8, { children: [
5557
- /* @__PURE__ */ jsxs26("div", { children: [
5558
- /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5559
- /* @__PURE__ */ jsx28(
5667
+ state.depthMask.enabled && /* @__PURE__ */ jsxs28(Fragment9, { children: [
5668
+ /* @__PURE__ */ jsxs28("div", { children: [
5669
+ /* @__PURE__ */ jsx30("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5670
+ /* @__PURE__ */ jsx30(
5560
5671
  "input",
5561
5672
  {
5562
5673
  type: "text",
@@ -5567,8 +5678,8 @@ var ImageEditor = ({
5567
5678
  }
5568
5679
  )
5569
5680
  ] }),
5570
- /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5571
- /* @__PURE__ */ jsx28(
5681
+ /* @__PURE__ */ jsxs28("div", { className: "flex gap-2", children: [
5682
+ /* @__PURE__ */ jsx30(
5572
5683
  "button",
5573
5684
  {
5574
5685
  type: "button",
@@ -5577,7 +5688,7 @@ var ImageEditor = ({
5577
5688
  children: "Threshold Mode"
5578
5689
  }
5579
5690
  ),
5580
- /* @__PURE__ */ jsx28(
5691
+ /* @__PURE__ */ jsx30(
5581
5692
  "button",
5582
5693
  {
5583
5694
  type: "button",
@@ -5587,12 +5698,12 @@ var ImageEditor = ({
5587
5698
  }
5588
5699
  )
5589
5700
  ] }),
5590
- /* @__PURE__ */ jsxs26("div", { children: [
5591
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5592
- /* @__PURE__ */ jsx28("span", { children: "Depth Start (Lower):" }),
5593
- /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5701
+ /* @__PURE__ */ jsxs28("div", { children: [
5702
+ /* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5703
+ /* @__PURE__ */ jsx30("span", { children: "Depth Start (Lower):" }),
5704
+ /* @__PURE__ */ jsx30("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5594
5705
  ] }),
5595
- /* @__PURE__ */ jsx28(
5706
+ /* @__PURE__ */ jsx30(
5596
5707
  "input",
5597
5708
  {
5598
5709
  type: "range",
@@ -5606,12 +5717,12 @@ var ImageEditor = ({
5606
5717
  }
5607
5718
  )
5608
5719
  ] }),
5609
- /* @__PURE__ */ jsxs26("div", { children: [
5610
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5611
- /* @__PURE__ */ jsx28("span", { children: "Depth Stop (Upper):" }),
5612
- /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5720
+ /* @__PURE__ */ jsxs28("div", { children: [
5721
+ /* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5722
+ /* @__PURE__ */ jsx30("span", { children: "Depth Stop (Upper):" }),
5723
+ /* @__PURE__ */ jsx30("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5613
5724
  ] }),
5614
- /* @__PURE__ */ jsx28(
5725
+ /* @__PURE__ */ jsx30(
5615
5726
  "input",
5616
5727
  {
5617
5728
  type: "range",
@@ -5625,12 +5736,12 @@ var ImageEditor = ({
5625
5736
  }
5626
5737
  )
5627
5738
  ] }),
5628
- /* @__PURE__ */ jsxs26("div", { children: [
5629
- /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5630
- /* @__PURE__ */ jsx28("span", { children: "Softness:" }),
5631
- /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.softness })
5739
+ /* @__PURE__ */ jsxs28("div", { children: [
5740
+ /* @__PURE__ */ jsxs28("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5741
+ /* @__PURE__ */ jsx30("span", { children: "Softness:" }),
5742
+ /* @__PURE__ */ jsx30("span", { className: "font-mono", children: state.depthMask.softness })
5632
5743
  ] }),
5633
- /* @__PURE__ */ jsx28(
5744
+ /* @__PURE__ */ jsx30(
5634
5745
  "input",
5635
5746
  {
5636
5747
  type: "range",
@@ -5642,8 +5753,8 @@ var ImageEditor = ({
5642
5753
  }
5643
5754
  )
5644
5755
  ] }),
5645
- /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5646
- /* @__PURE__ */ jsx28(
5756
+ /* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5757
+ /* @__PURE__ */ jsx30(
5647
5758
  "input",
5648
5759
  {
5649
5760
  type: "checkbox",
@@ -5652,12 +5763,12 @@ var ImageEditor = ({
5652
5763
  className: "rounded accent-primary"
5653
5764
  }
5654
5765
  ),
5655
- /* @__PURE__ */ jsx28("span", { children: "Invert Mask" })
5766
+ /* @__PURE__ */ jsx30("span", { children: "Invert Mask" })
5656
5767
  ] })
5657
5768
  ] })
5658
5769
  ] }),
5659
- activeTab === "select" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5660
- /* @__PURE__ */ jsx28(
5770
+ activeTab === "select" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-4 text-xs", children: [
5771
+ /* @__PURE__ */ jsx30(
5661
5772
  SelectionOptionsBar,
5662
5773
  {
5663
5774
  controller,
@@ -5668,9 +5779,9 @@ var ImageEditor = ({
5668
5779
  selectionDisplay: state.selectionDisplay
5669
5780
  }
5670
5781
  ),
5671
- selectionError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: selectionError }),
5672
- /* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
5673
- /* @__PURE__ */ jsx28(
5782
+ selectionError && /* @__PURE__ */ jsx30("p", { role: "alert", className: "text-destructive", children: selectionError }),
5783
+ /* @__PURE__ */ jsxs28("div", { className: "flex gap-1", children: [
5784
+ /* @__PURE__ */ jsx30(
5674
5785
  "button",
5675
5786
  {
5676
5787
  type: "button",
@@ -5681,7 +5792,7 @@ var ImageEditor = ({
5681
5792
  children: "Transform Selection"
5682
5793
  }
5683
5794
  ),
5684
- /* @__PURE__ */ jsx28(
5795
+ /* @__PURE__ */ jsx30(
5685
5796
  "button",
5686
5797
  {
5687
5798
  type: "button",
@@ -5693,14 +5804,14 @@ var ImageEditor = ({
5693
5804
  }
5694
5805
  )
5695
5806
  ] }),
5696
- /* @__PURE__ */ jsx28(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5697
- /* @__PURE__ */ jsx28(ChannelsPanel, { controller }),
5698
- /* @__PURE__ */ jsx28(PathsPanel, { controller })
5807
+ /* @__PURE__ */ jsx30(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5808
+ /* @__PURE__ */ jsx30(ChannelsPanel, { controller }),
5809
+ /* @__PURE__ */ jsx30(PathsPanel, { controller })
5699
5810
  ] }),
5700
- activeTab === "ai" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5701
- /* @__PURE__ */ jsxs26("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5702
- /* @__PURE__ */ jsx28("span", { children: "Results go to" }),
5703
- /* @__PURE__ */ jsxs26(
5811
+ activeTab === "ai" && /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-4 text-xs", children: [
5812
+ /* @__PURE__ */ jsxs28("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5813
+ /* @__PURE__ */ jsx30("span", { children: "Results go to" }),
5814
+ /* @__PURE__ */ jsxs28(
5704
5815
  "select",
5705
5816
  {
5706
5817
  "aria-label": "AI result target",
@@ -5708,54 +5819,54 @@ var ImageEditor = ({
5708
5819
  onChange: (e) => setAiTarget(e.target.value),
5709
5820
  className: imageSelectClass,
5710
5821
  children: [
5711
- /* @__PURE__ */ jsx28("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5712
- /* @__PURE__ */ jsx28("option", { value: "new-layer", children: "New layer / mask" }),
5713
- /* @__PURE__ */ jsx28("option", { value: "replace", children: "Replace image" })
5822
+ /* @__PURE__ */ jsx30("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5823
+ /* @__PURE__ */ jsx30("option", { value: "new-layer", children: "New layer / mask" }),
5824
+ /* @__PURE__ */ jsx30("option", { value: "replace", children: "Replace image" })
5714
5825
  ]
5715
5826
  }
5716
5827
  )
5717
5828
  ] }),
5718
- /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5719
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5720
- /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5721
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5829
+ /* @__PURE__ */ jsxs28("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5830
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
5831
+ /* @__PURE__ */ jsxs28("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5832
+ /* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5722
5833
  "Background Removal"
5723
5834
  ] }),
5724
- isRemovingBg && /* @__PURE__ */ jsx28("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5835
+ isRemovingBg && /* @__PURE__ */ jsx30("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5725
5836
  ] }),
5726
- /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5727
- /* @__PURE__ */ jsx28(
5837
+ /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5838
+ /* @__PURE__ */ jsx30(
5728
5839
  "button",
5729
5840
  {
5730
5841
  type: "button",
5731
5842
  onClick: handleRemoveBackground,
5732
5843
  disabled: isRemovingBg || isInpainting,
5733
5844
  className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
5734
- children: isRemovingBg ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5735
- /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5845
+ children: isRemovingBg ? /* @__PURE__ */ jsxs28(Fragment9, { children: [
5846
+ /* @__PURE__ */ jsx30("div", { className: imageSpinnerClass }),
5736
5847
  "Removing Background..."
5737
- ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5738
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5848
+ ] }) : /* @__PURE__ */ jsxs28(Fragment9, { children: [
5849
+ /* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5739
5850
  "Remove Background"
5740
5851
  ] })
5741
5852
  }
5742
5853
  )
5743
5854
  ] }),
5744
- /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5745
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5746
- /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5747
- /* @__PURE__ */ jsxs26("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5748
- /* @__PURE__ */ jsx28("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5749
- /* @__PURE__ */ jsx28("path", { d: "m14 7 3 3" })
5855
+ /* @__PURE__ */ jsxs28("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5856
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
5857
+ /* @__PURE__ */ jsxs28("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5858
+ /* @__PURE__ */ jsxs28("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5859
+ /* @__PURE__ */ jsx30("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5860
+ /* @__PURE__ */ jsx30("path", { d: "m14 7 3 3" })
5750
5861
  ] }),
5751
5862
  "Generative Inpainting"
5752
5863
  ] }),
5753
- isInpainting && /* @__PURE__ */ jsx28("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5864
+ isInpainting && /* @__PURE__ */ jsx30("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5754
5865
  ] }),
5755
- /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5756
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5757
- /* @__PURE__ */ jsx28("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5758
- /* @__PURE__ */ jsx28(
5866
+ /* @__PURE__ */ jsx30("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5867
+ /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-1", children: [
5868
+ /* @__PURE__ */ jsx30("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5869
+ /* @__PURE__ */ jsx30(
5759
5870
  "textarea",
5760
5871
  {
5761
5872
  id: "ai-inpaint-prompt-react",
@@ -5767,10 +5878,10 @@ var ImageEditor = ({
5767
5878
  }
5768
5879
  )
5769
5880
  ] }),
5770
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5771
- /* @__PURE__ */ jsx28("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5772
- /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-1.5", children: [
5773
- /* @__PURE__ */ jsxs26(
5881
+ /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-1", children: [
5882
+ /* @__PURE__ */ jsx30("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5883
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-2 gap-1.5", children: [
5884
+ /* @__PURE__ */ jsxs28(
5774
5885
  "button",
5775
5886
  {
5776
5887
  type: "button",
@@ -5783,7 +5894,7 @@ var ImageEditor = ({
5783
5894
  ]
5784
5895
  }
5785
5896
  ),
5786
- /* @__PURE__ */ jsxs26(
5897
+ /* @__PURE__ */ jsxs28(
5787
5898
  "button",
5788
5899
  {
5789
5900
  type: "button",
@@ -5798,25 +5909,25 @@ var ImageEditor = ({
5798
5909
  )
5799
5910
  ] })
5800
5911
  ] }),
5801
- /* @__PURE__ */ jsx28(
5912
+ /* @__PURE__ */ jsx30(
5802
5913
  "button",
5803
5914
  {
5804
5915
  type: "button",
5805
5916
  onClick: handleInpaint,
5806
5917
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5807
5918
  className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
5808
- children: isInpainting ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5809
- /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5919
+ children: isInpainting ? /* @__PURE__ */ jsxs28(Fragment9, { children: [
5920
+ /* @__PURE__ */ jsx30("div", { className: imageSpinnerClass }),
5810
5921
  "Generating Inpaint..."
5811
- ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5812
- /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5922
+ ] }) : /* @__PURE__ */ jsxs28(Fragment9, { children: [
5923
+ /* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx30("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5813
5924
  "Apply Inpainting"
5814
5925
  ] })
5815
5926
  }
5816
5927
  )
5817
5928
  ] }),
5818
- aiError && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5819
- aiSuccess && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5929
+ aiError && /* @__PURE__ */ jsx30("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5930
+ aiSuccess && /* @__PURE__ */ jsx30("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5820
5931
  ] })
5821
5932
  ] })
5822
5933
  ] })
@@ -5842,12 +5953,14 @@ export {
5842
5953
  AdjustmentLayersPanel,
5843
5954
  LayerEffectsPanel,
5844
5955
  EdgeColorPanel,
5956
+ VectorMaskEdgesPanel,
5845
5957
  LayersPanel,
5846
5958
  ImageEffectControls,
5847
5959
  ImageProviderEffectsPanel,
5848
5960
  PaintGradientEditor,
5849
5961
  BrushOptionsBar,
5850
5962
  ColorProfilePanel,
5963
+ SelectionRecipePanel,
5851
5964
  SelectAndMaskWorkspace,
5852
5965
  ContentAwareFillWorkspace,
5853
5966
  SelectionOptionsBar,