@pixerate/editor-react 0.145.0 → 0.147.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.
@@ -57,6 +57,7 @@ __export(image_editor_exports, {
57
57
  PathsPanel: () => PathsPanel,
58
58
  RefineEdgePanel: () => RefineEdgePanel,
59
59
  SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
60
+ SelectionChangeCheck: () => SelectionChangeCheck,
60
61
  SelectionOptionsBar: () => SelectionOptionsBar,
61
62
  ShapeOptionsBar: () => ShapeOptionsBar,
62
63
  TypeOptionsBar: () => TypeOptionsBar,
@@ -236,7 +237,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
236
237
  }
237
238
 
238
239
  // src/image-editor/ImageEditor.tsx
239
- var import_react36 = __toESM(require("react"), 1);
240
+ var import_react37 = __toESM(require("react"), 1);
240
241
  var import_image_editor24 = require("@pixerate/editor/image-editor");
241
242
 
242
243
  // src/image-editor/ImageEditorCanvas.tsx
@@ -5751,7 +5752,7 @@ var SelectionOptionsBar = ({
5751
5752
  };
5752
5753
 
5753
5754
  // src/image-editor/RefineEdgePanel.tsx
5754
- var import_react30 = require("react");
5755
+ var import_react31 = require("react");
5755
5756
  var import_image_editor18 = require("@pixerate/editor/image-editor");
5756
5757
 
5757
5758
  // src/image-editor/MaskEdgeCheck.tsx
@@ -5801,19 +5802,60 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
5801
5802
  ] });
5802
5803
  };
5803
5804
 
5804
- // src/image-editor/RefineEdgePanel.tsx
5805
+ // src/image-editor/SelectionChangeCheck.tsx
5806
+ var import_react30 = require("react");
5805
5807
  var import_jsx_runtime30 = require("react/jsx-runtime");
5806
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
5807
5808
  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";
5808
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5809
- const [params, setParams] = (0, import_react30.useState)(DEFAULT_PARAMS);
5810
- const [busy, setBusy] = (0, import_react30.useState)(false);
5809
+ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
5810
+ const sel = selection === void 0 ? controller.getSelection() : selection;
5811
+ const [result, setResult] = (0, import_react30.useState)(null);
5811
5812
  const [error, setError] = (0, import_react30.useState)(null);
5812
- const [layerId, setLayerId] = (0, import_react30.useState)("");
5813
- const [newKind, setNewKind] = (0, import_react30.useState)("hueSaturation");
5814
- const [output, setOutput] = (0, import_react30.useState)("selection");
5815
- const [decontaminate, setDecontaminate] = (0, import_react30.useState)(0);
5816
- const [objectAware, setObjectAware] = (0, import_react30.useState)(false);
5813
+ const diff = result && result.for === sel ? result.diff : null;
5814
+ const show = () => {
5815
+ setError(null);
5816
+ try {
5817
+ setResult({ diff: controller.compareSelections(), for: sel });
5818
+ } catch (err) {
5819
+ setResult(null);
5820
+ setError(err instanceof Error ? err.message : String(err));
5821
+ }
5822
+ };
5823
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
5824
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: `${button5} self-start`, onClick: show, children: "Show Last Change" }),
5825
+ diff && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5826
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-green-600", children: [
5827
+ "+",
5828
+ diff.added.area,
5829
+ " px"
5830
+ ] }),
5831
+ " ",
5832
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-destructive", children: [
5833
+ "\u2212",
5834
+ diff.removed.area,
5835
+ " px"
5836
+ ] }),
5837
+ ", overlap ",
5838
+ Math.round(diff.iou * 100),
5839
+ "%"
5840
+ ] }) }),
5841
+ error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error })
5842
+ ] });
5843
+ };
5844
+
5845
+ // src/image-editor/RefineEdgePanel.tsx
5846
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5847
+ var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
5848
+ 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";
5849
+ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5850
+ const [params, setParams] = (0, import_react31.useState)(DEFAULT_PARAMS);
5851
+ const [busy, setBusy] = (0, import_react31.useState)(false);
5852
+ const [error, setError] = (0, import_react31.useState)(null);
5853
+ const [layerId, setLayerId] = (0, import_react31.useState)("");
5854
+ const [newKind, setNewKind] = (0, import_react31.useState)("hueSaturation");
5855
+ const [output, setOutput] = (0, import_react31.useState)("selection");
5856
+ const [decontaminate, setDecontaminate] = (0, import_react31.useState)(0);
5857
+ const [objectAware, setObjectAware] = (0, import_react31.useState)(false);
5858
+ const [onlyUncertain, setOnlyUncertain] = (0, import_react31.useState)(false);
5817
5859
  const canObject = Boolean(controller.segmentationProvider);
5818
5860
  const toLayer = output !== "selection" && output !== "layer-mask";
5819
5861
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -5823,9 +5865,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5823
5865
  setBusy(true);
5824
5866
  setError(null);
5825
5867
  try {
5868
+ const regions = onlyUncertain ? controller.selectionUncertainty().regions.map((r) => r.bounds) : void 0;
5869
+ if (regions && !regions.length) throw new Error("No uncertain areas: the selection's edge already follows edges in the image. Untick Only uncertain areas to refine everywhere.");
5826
5870
  await controller.refineSelectionTo(params, output, {
5827
5871
  decontaminate: toLayer ? decontaminate : 0,
5828
- refineMode: canObject && objectAware ? "object" : "color"
5872
+ refineMode: canObject && objectAware ? "object" : "color",
5873
+ ...regions ? { regions } : {}
5829
5874
  });
5830
5875
  } catch (err) {
5831
5876
  setError(err instanceof Error ? err.message : String(err));
@@ -5833,17 +5878,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5833
5878
  setBusy(false);
5834
5879
  }
5835
5880
  };
5836
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5837
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5838
- import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5839
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5840
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: c.label }),
5841
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
5881
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5882
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5883
+ import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
5884
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5885
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: c.label }),
5886
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
5842
5887
  params[c.id],
5843
5888
  c.unit
5844
5889
  ] })
5845
5890
  ] }),
5846
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5891
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5847
5892
  "input",
5848
5893
  {
5849
5894
  type: "range",
@@ -5857,39 +5902,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5857
5902
  }
5858
5903
  )
5859
5904
  ] }, c.id)),
5860
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5861
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5905
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5906
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5862
5907
  "Smart Radius"
5863
5908
  ] }),
5864
- canObject && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5865
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5909
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
5910
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
5911
+ "Only uncertain areas"
5912
+ ] }),
5913
+ canObject && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5914
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5866
5915
  "Object aware (segmentation model)"
5867
5916
  ] }),
5868
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5917
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5869
5918
  "Output to",
5870
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5919
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5871
5920
  "select",
5872
5921
  {
5873
5922
  "aria-label": "Refine output",
5874
5923
  value: output,
5875
5924
  onChange: (e) => setOutput(e.target.value),
5876
5925
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5877
- children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: o.id, children: o.label }, o.id))
5926
+ children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: o.id, children: o.label }, o.id))
5878
5927
  }
5879
5928
  )
5880
5929
  ] }),
5881
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5882
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5883
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
5930
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
5931
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5932
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { children: [
5884
5933
  "Decontaminate colors",
5885
5934
  toLayer ? "" : " (new layer or document outputs)"
5886
5935
  ] }),
5887
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
5936
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
5888
5937
  decontaminate,
5889
5938
  "%"
5890
5939
  ] })
5891
5940
  ] }),
5892
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5941
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5893
5942
  "input",
5894
5943
  {
5895
5944
  type: "range",
@@ -5904,64 +5953,65 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5904
5953
  }
5905
5954
  )
5906
5955
  ] }),
5907
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
5908
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5909
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5956
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
5957
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5958
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
5910
5959
  ] }),
5911
- error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5912
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MaskEdgeCheck, { controller, selection: sel }),
5913
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5914
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1 items-center", children: [
5915
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5960
+ error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5961
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(MaskEdgeCheck, { controller, selection: sel }),
5962
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectionChangeCheck, { controller, selection: sel }),
5963
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5964
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1 items-center", children: [
5965
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5916
5966
  "select",
5917
5967
  {
5918
5968
  "aria-label": "New masked layer kind",
5919
5969
  value: newKind,
5920
5970
  onChange: (e) => setNewKind(e.target.value),
5921
5971
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5922
- children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5972
+ children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: k.kind, children: k.label }, k.kind))
5923
5973
  }
5924
5974
  ),
5925
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5975
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5926
5976
  "button",
5927
5977
  {
5928
5978
  type: "button",
5929
- className: button5,
5979
+ className: button6,
5930
5980
  disabled: !sel,
5931
5981
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
5932
5982
  children: "New Masked Layer"
5933
5983
  }
5934
5984
  )
5935
5985
  ] }),
5936
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", children: [
5937
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5986
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-2", children: [
5987
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5938
5988
  "select",
5939
5989
  {
5940
5990
  "aria-label": "Mask layer",
5941
5991
  value: target.id,
5942
5992
  onChange: (e) => setLayerId(e.target.value),
5943
5993
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
5944
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("option", { value: l.id, children: [
5994
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("option", { value: l.id, children: [
5945
5995
  l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
5946
5996
  l.mask ? " (masked)" : ""
5947
5997
  ] }, l.id))
5948
5998
  }
5949
5999
  ),
5950
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5951
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5952
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5953
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
6000
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6001
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
6002
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
6003
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
5954
6004
  ] }),
5955
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5956
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5957
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Density" }),
5959
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
6005
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
6006
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
6007
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
6008
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Density" }),
6009
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
5960
6010
  Math.round((target.mask.density ?? 1) * 100),
5961
6011
  "%"
5962
6012
  ] })
5963
6013
  ] }),
5964
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6014
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5965
6015
  "input",
5966
6016
  {
5967
6017
  type: "range",
@@ -5975,15 +6025,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5975
6025
  }
5976
6026
  )
5977
6027
  ] }),
5978
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5979
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5980
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Mask Feather" }),
5981
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
6028
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex flex-col gap-1", children: [
6029
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
6030
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Mask Feather" }),
6031
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
5982
6032
  target.mask.feather ?? 0,
5983
6033
  "px"
5984
6034
  ] })
5985
6035
  ] }),
5986
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6036
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5987
6037
  "input",
5988
6038
  {
5989
6039
  type: "range",
@@ -6003,13 +6053,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
6003
6053
  };
6004
6054
 
6005
6055
  // src/image-editor/ChannelsPanel.tsx
6006
- var import_react31 = require("react");
6056
+ var import_react32 = require("react");
6007
6057
  var import_image_editor19 = require("@pixerate/editor/image-editor");
6008
- var import_jsx_runtime31 = require("react/jsx-runtime");
6058
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6009
6059
  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"}`;
6010
6060
  var ChannelThumb = ({ channel, size }) => {
6011
- const ref = (0, import_react31.useRef)(null);
6012
- (0, import_react31.useEffect)(() => {
6061
+ const ref = (0, import_react32.useRef)(null);
6062
+ (0, import_react32.useEffect)(() => {
6013
6063
  const canvas = ref.current;
6014
6064
  const ctx = canvas?.getContext("2d");
6015
6065
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
@@ -6020,15 +6070,15 @@ var ChannelThumb = ({ channel, size }) => {
6020
6070
  img.data.set(px.data);
6021
6071
  ctx.putImageData(img, 0, 0);
6022
6072
  }, [channel.mask]);
6023
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
6073
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
6024
6074
  };
6025
6075
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6026
- const [, setTick] = (0, import_react31.useState)(0);
6027
- (0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6028
- const [activeId, setActiveId] = (0, import_react31.useState)(null);
6029
- const [renaming, setRenaming] = (0, import_react31.useState)(null);
6030
- const [error, setError] = (0, import_react31.useState)(null);
6031
- const fileInput = (0, import_react31.useRef)(null);
6076
+ const [, setTick] = (0, import_react32.useState)(0);
6077
+ (0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6078
+ const [activeId, setActiveId] = (0, import_react32.useState)(null);
6079
+ const [renaming, setRenaming] = (0, import_react32.useState)(null);
6080
+ const [error, setError] = (0, import_react32.useState)(null);
6081
+ const fileInput = (0, import_react32.useRef)(null);
6032
6082
  const channels = controller.getChannels();
6033
6083
  const active = channels.find((c) => c.id === activeId) ?? null;
6034
6084
  const hasSelection = Boolean(controller.getSelection());
@@ -6050,13 +6100,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6050
6100
  setError(err instanceof Error ? err.message : String(err));
6051
6101
  }
6052
6102
  };
6053
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
6054
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
6055
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
6056
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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" })
6103
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
6104
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between", children: [
6105
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
6106
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" })
6057
6107
  ] }),
6058
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
6059
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6108
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
6109
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6060
6110
  "li",
6061
6111
  {
6062
6112
  "data-testid": "channel-row",
@@ -6068,7 +6118,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6068
6118
  },
6069
6119
  onDoubleClick: () => setRenaming(c.id),
6070
6120
  children: [
6071
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6121
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6072
6122
  "button",
6073
6123
  {
6074
6124
  type: "button",
@@ -6082,8 +6132,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6082
6132
  children: c.visible ? "\u25CF" : "\u25CB"
6083
6133
  }
6084
6134
  ),
6085
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
6086
- renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6135
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
6136
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6087
6137
  "input",
6088
6138
  {
6089
6139
  autoFocus: true,
@@ -6100,16 +6150,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6100
6150
  if (e.key === "Escape") setRenaming(null);
6101
6151
  }
6102
6152
  }
6103
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
6153
+ ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
6104
6154
  ]
6105
6155
  },
6106
6156
  c.id
6107
6157
  )) }),
6108
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6109
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
6110
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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" }),
6111
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
6112
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6158
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6159
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
6160
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }),
6161
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
6162
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6113
6163
  "button",
6114
6164
  {
6115
6165
  type: "button",
@@ -6122,8 +6172,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6122
6172
  children: "Delete"
6123
6173
  }
6124
6174
  ),
6125
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
6126
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6175
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
6176
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6127
6177
  "button",
6128
6178
  {
6129
6179
  type: "button",
@@ -6134,7 +6184,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6134
6184
  children: "Export PNG"
6135
6185
  }
6136
6186
  ),
6137
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6187
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6138
6188
  "input",
6139
6189
  {
6140
6190
  ref: fileInput,
@@ -6149,22 +6199,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6149
6199
  }
6150
6200
  )
6151
6201
  ] }),
6152
- error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6202
+ error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6153
6203
  ] });
6154
6204
  };
6155
6205
 
6156
6206
  // src/image-editor/PathsPanel.tsx
6157
- var import_react32 = require("react");
6207
+ var import_react33 = require("react");
6158
6208
  var import_image_editor20 = require("@pixerate/editor/image-editor");
6159
- var import_jsx_runtime32 = require("react/jsx-runtime");
6209
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6160
6210
  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"}`;
6161
6211
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6162
- const [, setTick] = (0, import_react32.useState)(0);
6163
- (0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6164
- const [renaming, setRenaming] = (0, import_react32.useState)(null);
6165
- const [color, setColor] = (0, import_react32.useState)("#000000");
6166
- const [width, setWidth] = (0, import_react32.useState)(2);
6167
- const [error, setError] = (0, import_react32.useState)(null);
6212
+ const [, setTick] = (0, import_react33.useState)(0);
6213
+ (0, import_react33.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6214
+ const [renaming, setRenaming] = (0, import_react33.useState)(null);
6215
+ const [color, setColor] = (0, import_react33.useState)("#000000");
6216
+ const [width, setWidth] = (0, import_react33.useState)(2);
6217
+ const [error, setError] = (0, import_react33.useState)(null);
6168
6218
  const paths = controller.getPaths();
6169
6219
  const activeId = controller.getState().activePathId ?? null;
6170
6220
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -6180,10 +6230,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6180
6230
  };
6181
6231
  return (
6182
6232
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
6183
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("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: [
6184
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
6185
- paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
6186
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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__ */ (0, import_jsx_runtime32.jsxs)(
6233
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("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: [
6234
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
6235
+ paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
6236
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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__ */ (0, import_jsx_runtime33.jsxs)(
6187
6237
  "li",
6188
6238
  {
6189
6239
  "data-testid": "path-row",
@@ -6192,8 +6242,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6192
6242
  onClick: () => attempt(() => controller.setActivePath(p.id)),
6193
6243
  onDoubleClick: () => setRenaming(p.id),
6194
6244
  children: [
6195
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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__ */ (0, import_jsx_runtime32.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
6196
- renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6245
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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__ */ (0, import_jsx_runtime33.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
6246
+ renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6197
6247
  "input",
6198
6248
  {
6199
6249
  autoFocus: true,
@@ -6212,13 +6262,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6212
6262
  if (e.key === "Escape") setRenaming(null);
6213
6263
  }
6214
6264
  }
6215
- ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
6265
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
6216
6266
  ]
6217
6267
  },
6218
6268
  p.id
6219
6269
  )) }),
6220
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6221
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6270
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6271
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6222
6272
  "button",
6223
6273
  {
6224
6274
  type: "button",
@@ -6229,15 +6279,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6229
6279
  children: "Load as Selection"
6230
6280
  }
6231
6281
  ),
6232
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6233
- active?.work && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6234
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
6282
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6283
+ active?.work && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6284
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
6235
6285
  ] }),
6236
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6237
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }),
6238
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6239
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6240
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6286
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6287
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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" }),
6288
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6289
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6290
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6241
6291
  "input",
6242
6292
  {
6243
6293
  type: "number",
@@ -6252,25 +6302,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6252
6302
  ),
6253
6303
  "px"
6254
6304
  ] }),
6255
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
6305
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
6256
6306
  ] }),
6257
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6258
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6259
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
6307
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6308
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6309
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
6260
6310
  ] }),
6261
- error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6311
+ error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6262
6312
  ] })
6263
6313
  );
6264
6314
  };
6265
6315
 
6266
6316
  // src/image-editor/FreeTransformOptionsBar.tsx
6267
- var import_react33 = require("react");
6317
+ var import_react34 = require("react");
6268
6318
  var import_image_editor21 = require("@pixerate/editor/image-editor");
6269
- var import_jsx_runtime33 = require("react/jsx-runtime");
6319
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6270
6320
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
6271
6321
  var FreeTransformOptionsBar = ({ tool, className }) => {
6272
- const [, setTick] = (0, import_react33.useState)(0);
6273
- (0, import_react33.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
6322
+ const [, setTick] = (0, import_react34.useState)(0);
6323
+ (0, import_react34.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
6274
6324
  const bar = tool.bar();
6275
6325
  if (!tool.active || !bar) return null;
6276
6326
  const warp = tool.warpBar();
@@ -6282,17 +6332,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6282
6332
  const v = Number(raw);
6283
6333
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
6284
6334
  };
6285
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("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: [
6286
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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)) }),
6287
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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)) }),
6288
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
6289
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6290
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6291
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: o.id, children: o.label }, o.id)) })
6335
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("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: [
6336
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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)) }),
6337
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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)) }),
6338
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
6339
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6340
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6341
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: o.id, children: o.label }, o.id)) })
6292
6342
  ] }),
6293
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6294
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6295
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6343
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6344
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6345
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6296
6346
  "input",
6297
6347
  {
6298
6348
  type: "number",
@@ -6313,9 +6363,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6313
6363
  },
6314
6364
  `${k}:${warp[k]}`
6315
6365
  ),
6316
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "%" })
6366
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground", children: "%" })
6317
6367
  ] }, k)),
6318
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6368
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6319
6369
  "button",
6320
6370
  {
6321
6371
  type: "button",
@@ -6327,9 +6377,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6327
6377
  children: "Vertical"
6328
6378
  }
6329
6379
  ),
6330
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6331
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6332
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6380
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6381
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6382
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6333
6383
  "select",
6334
6384
  {
6335
6385
  "aria-label": "Warp grid",
@@ -6339,14 +6389,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6339
6389
  tool.setWarp({ columns: g.columns, rows: g.rows });
6340
6390
  },
6341
6391
  className: imageFieldClass,
6342
- children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: g.id, children: g.label }, g.id))
6392
+ children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: g.id, children: g.label }, g.id))
6343
6393
  }
6344
6394
  )
6345
6395
  ] })
6346
6396
  ] }),
6347
- tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6348
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6349
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6397
+ tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
6398
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6399
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6350
6400
  "input",
6351
6401
  {
6352
6402
  type: "number",
@@ -6366,8 +6416,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6366
6416
  },
6367
6417
  `${f.id}:${round(bar[f.id], f.unit)}`
6368
6418
  ),
6369
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6370
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6419
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6420
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6371
6421
  "button",
6372
6422
  {
6373
6423
  type: "button",
@@ -6382,33 +6432,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6382
6432
  }
6383
6433
  )
6384
6434
  ] }, f.id)),
6385
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6386
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6387
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6435
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6436
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6437
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6388
6438
  "select",
6389
6439
  {
6390
6440
  "aria-label": "Interpolation",
6391
6441
  value: tool.interpolation,
6392
6442
  onChange: (e) => tool.setInterpolation(e.target.value),
6393
6443
  className: imageFieldClass,
6394
- children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
6444
+ children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
6395
6445
  }
6396
6446
  )
6397
6447
  ] }),
6398
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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" }),
6399
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6400
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
6448
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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" }),
6449
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6450
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
6401
6451
  ] });
6402
6452
  };
6403
6453
 
6404
6454
  // src/image-editor/ShapeOptionsBar.tsx
6405
- var import_react34 = require("react");
6455
+ var import_react35 = require("react");
6406
6456
  var import_image_editor22 = require("@pixerate/editor/image-editor");
6407
- var import_jsx_runtime34 = require("react/jsx-runtime");
6457
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6408
6458
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6409
- const [, setTick] = (0, import_react34.useState)(0);
6410
- (0, import_react34.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6411
- const [error, setError] = (0, import_react34.useState)(null);
6459
+ const [, setTick] = (0, import_react35.useState)(0);
6460
+ (0, import_react35.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6461
+ const [error, setError] = (0, import_react35.useState)(null);
6412
6462
  const active = controller.getActiveLayer();
6413
6463
  const shapeId = active?.type === "shape" ? active.id : null;
6414
6464
  const set = (change) => {
@@ -6422,22 +6472,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6422
6472
  }
6423
6473
  };
6424
6474
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
6425
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6426
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
6427
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6428
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6429
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
6475
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6476
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
6477
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6478
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6479
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
6430
6480
  "Fill",
6431
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6481
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
6432
6482
  ] }),
6433
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6434
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
6483
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6484
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
6435
6485
  "Stroke",
6436
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6486
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
6437
6487
  ] }),
6438
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6488
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6439
6489
  "Width",
6440
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6490
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6441
6491
  "input",
6442
6492
  {
6443
6493
  type: "number",
@@ -6451,52 +6501,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6451
6501
  )
6452
6502
  ] })
6453
6503
  ] }),
6454
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6455
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6504
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6505
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6456
6506
  "Radius",
6457
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
6507
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
6458
6508
  ] }),
6459
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6509
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6460
6510
  "Sides",
6461
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6511
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6462
6512
  ] }),
6463
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6464
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6513
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
6514
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6465
6515
  "Points",
6466
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6516
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
6467
6517
  ] }),
6468
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6518
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6469
6519
  "Inner",
6470
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
6520
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
6471
6521
  ] })
6472
6522
  ] }),
6473
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6474
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6523
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
6524
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6475
6525
  "Weight",
6476
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
6526
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
6477
6527
  ] }),
6478
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6479
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
6528
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6529
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
6480
6530
  "Arrowhead"
6481
6531
  ] })
6482
6532
  ] })
6483
6533
  ] }),
6484
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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." }),
6485
- error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6534
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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." }),
6535
+ error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6486
6536
  ] });
6487
6537
  };
6488
6538
 
6489
6539
  // src/image-editor/TypeOptionsBar.tsx
6490
- var import_react35 = require("react");
6540
+ var import_react36 = require("react");
6491
6541
  var import_image_editor23 = require("@pixerate/editor/image-editor");
6492
- var import_jsx_runtime35 = require("react/jsx-runtime");
6542
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6493
6543
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
6494
6544
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
6495
6545
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
6496
- const [, setTick] = (0, import_react35.useState)(0);
6497
- (0, import_react35.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6498
- (0, import_react35.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6499
- const [error, setError] = (0, import_react35.useState)(null);
6546
+ const [, setTick] = (0, import_react36.useState)(0);
6547
+ (0, import_react36.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6548
+ (0, import_react36.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6549
+ const [error, setError] = (0, import_react36.useState)(null);
6500
6550
  const active = controller.getActiveLayer();
6501
6551
  const typeId = !session && active?.type === "type" ? active.id : null;
6502
6552
  const here = session?.alive ? session.styleHere() : {};
@@ -6549,11 +6599,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6549
6599
  setError(e instanceof Error ? e.message : String(e));
6550
6600
  }
6551
6601
  };
6552
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6553
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6554
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6602
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6603
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6604
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6555
6605
  "Font",
6556
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6606
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6557
6607
  "input",
6558
6608
  {
6559
6609
  list: "pixerate-type-fonts",
@@ -6563,11 +6613,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6563
6613
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
6564
6614
  }
6565
6615
  ),
6566
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: f }, f)) })
6616
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: f }, f)) })
6567
6617
  ] }),
6568
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "flex items-center gap-1", children: [
6618
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1", children: [
6569
6619
  "Size",
6570
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6620
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6571
6621
  "input",
6572
6622
  {
6573
6623
  type: "number",
@@ -6580,14 +6630,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6580
6630
  }
6581
6631
  )
6582
6632
  ] }),
6583
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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" }),
6584
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6585
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6633
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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" }),
6634
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
6635
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
6586
6636
  ] }),
6587
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6588
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6589
- import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6590
- orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6637
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
6638
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6639
+ import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
6640
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6591
6641
  "button",
6592
6642
  {
6593
6643
  type: "button",
@@ -6599,19 +6649,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6599
6649
  }
6600
6650
  )
6601
6651
  ] }),
6602
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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." }),
6603
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6652
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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." }),
6653
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
6604
6654
  "Missing ",
6605
6655
  missing.length === 1 ? "font" : "fonts",
6606
6656
  ": ",
6607
6657
  missing.join(", ")
6608
6658
  ] }),
6609
- error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6659
+ error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: error })
6610
6660
  ] });
6611
6661
  };
6612
6662
 
6613
6663
  // src/image-editor/ImageEditor.tsx
6614
- var import_jsx_runtime36 = require("react/jsx-runtime");
6664
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6615
6665
  var ImageEditor = ({
6616
6666
  editor: externalEditor,
6617
6667
  src,
@@ -6636,32 +6686,32 @@ var ImageEditor = ({
6636
6686
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
6637
6687
  });
6638
6688
  const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
6639
- const [activeTab, setActiveTab] = (0, import_react36.useState)("crop");
6640
- const rootRef = (0, import_react36.useRef)(null);
6689
+ const [activeTab, setActiveTab] = (0, import_react37.useState)("crop");
6690
+ const rootRef = (0, import_react37.useRef)(null);
6641
6691
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
6642
- const activeTabRef = (0, import_react36.useRef)(activeTab);
6692
+ const activeTabRef = (0, import_react37.useRef)(activeTab);
6643
6693
  activeTabRef.current = activeTab;
6644
6694
  const openPanel = async (ref) => {
6645
6695
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
6646
6696
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
6647
6697
  await new Promise((resolve) => setTimeout(resolve, 60));
6648
6698
  };
6649
- const [activeCropRatio, setActiveCropRatio] = (0, import_react36.useState)(null);
6650
- const [selectionOptions, setSelectionOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
6651
- const [shapeOptions, setShapeOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
6652
- const [typeOptions, setTypeOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
6653
- const [typeSession, setTypeSession] = (0, import_react36.useState)(null);
6654
- const [selectionError, setSelectionError] = (0, import_react36.useState)(null);
6655
- const [paintError, setPaintError] = (0, import_react36.useState)(null);
6656
- const [shapeTypeError, setShapeTypeError] = (0, import_react36.useState)(null);
6699
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react37.useState)(null);
6700
+ const [selectionOptions, setSelectionOptions] = (0, import_react37.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
6701
+ const [shapeOptions, setShapeOptions] = (0, import_react37.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
6702
+ const [typeOptions, setTypeOptions] = (0, import_react37.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
6703
+ const [typeSession, setTypeSession] = (0, import_react37.useState)(null);
6704
+ const [selectionError, setSelectionError] = (0, import_react37.useState)(null);
6705
+ const [paintError, setPaintError] = (0, import_react37.useState)(null);
6706
+ const [shapeTypeError, setShapeTypeError] = (0, import_react37.useState)(null);
6657
6707
  const handleCanvasError = (source, message) => {
6658
6708
  if (source === "paint") setPaintError(message);
6659
6709
  else if (source === "select") setSelectionError(message);
6660
6710
  else setShapeTypeError(message);
6661
6711
  };
6662
6712
  const finishTyping = () => setTypeSession(null);
6663
- const transformToolRef = (0, import_react36.useRef)(null);
6664
- const transformControllerRef = (0, import_react36.useRef)(controller);
6713
+ const transformToolRef = (0, import_react37.useRef)(null);
6714
+ const transformControllerRef = (0, import_react37.useRef)(controller);
6665
6715
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
6666
6716
  transformToolRef.current?.cancel();
6667
6717
  transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
@@ -6670,16 +6720,16 @@ var ImageEditor = ({
6670
6720
  transformControllerRef.current = controller;
6671
6721
  }
6672
6722
  const transformTool = transformToolRef.current;
6673
- const [, setTransformTick] = (0, import_react36.useState)(0);
6674
- (0, import_react36.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6675
- (0, import_react36.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6676
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react36.useState)("");
6677
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react36.useState)("annotations");
6678
- const [isRemovingBg, setIsRemovingBg] = (0, import_react36.useState)(false);
6679
- const [isInpainting, setIsInpainting] = (0, import_react36.useState)(false);
6680
- const [aiError, setAiError] = (0, import_react36.useState)(null);
6681
- const [aiSuccess, setAiSuccess] = (0, import_react36.useState)(null);
6682
- const [aiTarget, setAiTarget] = (0, import_react36.useState)("auto");
6723
+ const [, setTransformTick] = (0, import_react37.useState)(0);
6724
+ (0, import_react37.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6725
+ (0, import_react37.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6726
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react37.useState)("");
6727
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react37.useState)("annotations");
6728
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react37.useState)(false);
6729
+ const [isInpainting, setIsInpainting] = (0, import_react37.useState)(false);
6730
+ const [aiError, setAiError] = (0, import_react37.useState)(null);
6731
+ const [aiSuccess, setAiSuccess] = (0, import_react37.useState)(null);
6732
+ const [aiTarget, setAiTarget] = (0, import_react37.useState)("auto");
6683
6733
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
6684
6734
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
6685
6735
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -6742,11 +6792,11 @@ var ImageEditor = ({
6742
6792
  setIsInpainting(false);
6743
6793
  }
6744
6794
  };
6745
- const [activeColor, setActiveColor] = (0, import_react36.useState)("#ef4444");
6746
- const [strokeWidth, setStrokeWidth] = (0, import_react36.useState)(3);
6747
- const [fontSize, setFontSize] = (0, import_react36.useState)(24);
6748
- const [textInput, setTextInput] = (0, import_react36.useState)("");
6749
- (0, import_react36.useEffect)(() => {
6795
+ const [activeColor, setActiveColor] = (0, import_react37.useState)("#ef4444");
6796
+ const [strokeWidth, setStrokeWidth] = (0, import_react37.useState)(3);
6797
+ const [fontSize, setFontSize] = (0, import_react37.useState)(24);
6798
+ const [textInput, setTextInput] = (0, import_react37.useState)("");
6799
+ (0, import_react37.useEffect)(() => {
6750
6800
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
6751
6801
  editor.setTool("crop");
6752
6802
  }
@@ -6774,16 +6824,16 @@ var ImageEditor = ({
6774
6824
  link.click();
6775
6825
  }
6776
6826
  };
6777
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
6827
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6778
6828
  "div",
6779
6829
  {
6780
6830
  ref: rootRef,
6781
6831
  className: `${imageEditorFrameClass} ${className}`,
6782
6832
  style,
6783
6833
  children: [
6784
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: imageEditorHeaderClass, children: [
6785
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6786
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6834
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: imageEditorHeaderClass, children: [
6835
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6836
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6787
6837
  "button",
6788
6838
  {
6789
6839
  type: "button",
@@ -6798,7 +6848,7 @@ var ImageEditor = ({
6798
6848
  children: "Transform & Crop"
6799
6849
  }
6800
6850
  ),
6801
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6851
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6802
6852
  "button",
6803
6853
  {
6804
6854
  type: "button",
@@ -6813,7 +6863,7 @@ var ImageEditor = ({
6813
6863
  children: "Adjustments"
6814
6864
  }
6815
6865
  ),
6816
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6866
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6817
6867
  "button",
6818
6868
  {
6819
6869
  type: "button",
@@ -6828,7 +6878,7 @@ var ImageEditor = ({
6828
6878
  children: "Layers"
6829
6879
  }
6830
6880
  ),
6831
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6881
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6832
6882
  "button",
6833
6883
  {
6834
6884
  type: "button",
@@ -6843,7 +6893,7 @@ var ImageEditor = ({
6843
6893
  children: "Paint"
6844
6894
  }
6845
6895
  ),
6846
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6896
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6847
6897
  "button",
6848
6898
  {
6849
6899
  type: "button",
@@ -6858,7 +6908,7 @@ var ImageEditor = ({
6858
6908
  children: "Select & Mask"
6859
6909
  }
6860
6910
  ),
6861
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6911
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6862
6912
  "button",
6863
6913
  {
6864
6914
  type: "button",
@@ -6873,7 +6923,7 @@ var ImageEditor = ({
6873
6923
  children: "Annotations"
6874
6924
  }
6875
6925
  ),
6876
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6926
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6877
6927
  "button",
6878
6928
  {
6879
6929
  type: "button",
@@ -6888,7 +6938,7 @@ var ImageEditor = ({
6888
6938
  children: "Depth Mask"
6889
6939
  }
6890
6940
  ),
6891
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
6941
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6892
6942
  "button",
6893
6943
  {
6894
6944
  type: "button",
@@ -6901,14 +6951,14 @@ var ImageEditor = ({
6901
6951
  "aria-selected": activeTab === "ai",
6902
6952
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
6903
6953
  children: [
6904
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
6954
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
6905
6955
  "AI Tools"
6906
6956
  ]
6907
6957
  }
6908
6958
  )
6909
6959
  ] }),
6910
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6911
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6960
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6961
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6912
6962
  "button",
6913
6963
  {
6914
6964
  type: "button",
@@ -6919,7 +6969,7 @@ var ImageEditor = ({
6919
6969
  children: "\u21A9"
6920
6970
  }
6921
6971
  ),
6922
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6972
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6923
6973
  "button",
6924
6974
  {
6925
6975
  type: "button",
@@ -6930,7 +6980,7 @@ var ImageEditor = ({
6930
6980
  children: "\u21AA"
6931
6981
  }
6932
6982
  ),
6933
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6983
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6934
6984
  "button",
6935
6985
  {
6936
6986
  type: "button",
@@ -6939,8 +6989,8 @@ var ImageEditor = ({
6939
6989
  children: "Reset"
6940
6990
  }
6941
6991
  ),
6942
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6943
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6992
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6993
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6944
6994
  "button",
6945
6995
  {
6946
6996
  type: "button",
@@ -6950,11 +7000,11 @@ var ImageEditor = ({
6950
7000
  children: "-"
6951
7001
  }
6952
7002
  ),
6953
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
7003
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
6954
7004
  Math.round(state.zoom * 100),
6955
7005
  "%"
6956
7006
  ] }),
6957
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7007
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6958
7008
  "button",
6959
7009
  {
6960
7010
  type: "button",
@@ -6964,8 +7014,8 @@ var ImageEditor = ({
6964
7014
  children: "+"
6965
7015
  }
6966
7016
  ),
6967
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6968
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7017
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
7018
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6969
7019
  "button",
6970
7020
  {
6971
7021
  type: "button",
@@ -6976,7 +7026,7 @@ var ImageEditor = ({
6976
7026
  children: "Hold Compare"
6977
7027
  }
6978
7028
  ),
6979
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7029
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6980
7030
  "button",
6981
7031
  {
6982
7032
  type: "button",
@@ -6987,10 +7037,10 @@ var ImageEditor = ({
6987
7037
  )
6988
7038
  ] })
6989
7039
  ] }),
6990
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6991
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
6992
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
6993
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7040
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
7041
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
7042
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
7043
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6994
7044
  ImageEditorCanvas,
6995
7045
  {
6996
7046
  editor,
@@ -7014,11 +7064,11 @@ var ImageEditor = ({
7014
7064
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
7015
7065
  }
7016
7066
  ),
7017
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: imageSidebarClass, children: [
7018
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7019
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
7020
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
7021
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7067
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: imageSidebarClass, children: [
7068
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7069
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
7070
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
7071
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7022
7072
  "button",
7023
7073
  {
7024
7074
  type: "button",
@@ -7030,7 +7080,7 @@ var ImageEditor = ({
7030
7080
  children: "Freeform"
7031
7081
  }
7032
7082
  ),
7033
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7083
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7034
7084
  "button",
7035
7085
  {
7036
7086
  type: "button",
@@ -7042,7 +7092,7 @@ var ImageEditor = ({
7042
7092
  children: "1:1 Square"
7043
7093
  }
7044
7094
  ),
7045
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7095
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7046
7096
  "button",
7047
7097
  {
7048
7098
  type: "button",
@@ -7054,7 +7104,7 @@ var ImageEditor = ({
7054
7104
  children: "4:3 Standard"
7055
7105
  }
7056
7106
  ),
7057
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7107
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7058
7108
  "button",
7059
7109
  {
7060
7110
  type: "button",
@@ -7066,7 +7116,7 @@ var ImageEditor = ({
7066
7116
  children: "16:9 Wide"
7067
7117
  }
7068
7118
  ),
7069
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7119
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7070
7120
  "button",
7071
7121
  {
7072
7122
  type: "button",
@@ -7078,7 +7128,7 @@ var ImageEditor = ({
7078
7128
  children: "3:2 Photo"
7079
7129
  }
7080
7130
  ),
7081
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7131
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7082
7132
  "button",
7083
7133
  {
7084
7134
  type: "button",
@@ -7091,10 +7141,10 @@ var ImageEditor = ({
7091
7141
  }
7092
7142
  )
7093
7143
  ] }),
7094
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7095
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
7096
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
7097
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7144
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageDividerClass }),
7145
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
7146
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
7147
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7098
7148
  "button",
7099
7149
  {
7100
7150
  type: "button",
@@ -7103,7 +7153,7 @@ var ImageEditor = ({
7103
7153
  children: "Rotate -90\xB0"
7104
7154
  }
7105
7155
  ),
7106
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7156
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7107
7157
  "button",
7108
7158
  {
7109
7159
  type: "button",
@@ -7112,7 +7162,7 @@ var ImageEditor = ({
7112
7162
  children: "Rotate +90\xB0"
7113
7163
  }
7114
7164
  ),
7115
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7165
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7116
7166
  "button",
7117
7167
  {
7118
7168
  type: "button",
@@ -7121,7 +7171,7 @@ var ImageEditor = ({
7121
7171
  children: "Flip Horizontal"
7122
7172
  }
7123
7173
  ),
7124
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7174
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7125
7175
  "button",
7126
7176
  {
7127
7177
  type: "button",
@@ -7132,10 +7182,10 @@ var ImageEditor = ({
7132
7182
  )
7133
7183
  ] })
7134
7184
  ] }),
7135
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7136
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7137
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
7138
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7185
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7186
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
7187
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
7188
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7139
7189
  "button",
7140
7190
  {
7141
7191
  type: "button",
@@ -7145,9 +7195,9 @@ var ImageEditor = ({
7145
7195
  }
7146
7196
  )
7147
7197
  ] }),
7148
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Histogram, { histogram: editor.histogram }),
7149
- import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react36.default.Fragment, { children: [
7150
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7198
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Histogram, { histogram: editor.histogram }),
7199
+ import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react37.default.Fragment, { children: [
7200
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7151
7201
  ControlSlider,
7152
7202
  {
7153
7203
  spec,
@@ -7156,14 +7206,14 @@ var ImageEditor = ({
7156
7206
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
7157
7207
  }
7158
7208
  ),
7159
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7209
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7160
7210
  "div",
7161
7211
  {
7162
7212
  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",
7163
7213
  "data-testid": "image-editor-process-notice",
7164
7214
  children: [
7165
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
7166
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7215
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
7216
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7167
7217
  "button",
7168
7218
  {
7169
7219
  type: "button",
@@ -7176,7 +7226,7 @@ var ImageEditor = ({
7176
7226
  }
7177
7227
  )
7178
7228
  ] }, spec.id)),
7179
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7229
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7180
7230
  AdjustmentLayersPanel,
7181
7231
  {
7182
7232
  controller,
@@ -7185,9 +7235,9 @@ var ImageEditor = ({
7185
7235
  }
7186
7236
  ) })
7187
7237
  ] }),
7188
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7189
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
7190
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7238
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7239
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
7240
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7191
7241
  "button",
7192
7242
  {
7193
7243
  type: "button",
@@ -7198,15 +7248,15 @@ var ImageEditor = ({
7198
7248
  children: "Free Transform"
7199
7249
  }
7200
7250
  ),
7201
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayersPanel, { controller }),
7202
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7203
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7204
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ColorProfilePanel, { controller })
7251
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(LayersPanel, { controller }),
7252
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7253
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7254
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ColorProfilePanel, { controller })
7205
7255
  ] }),
7206
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7207
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7208
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BrushOptionsBar, { controller }),
7209
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7256
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7257
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7258
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BrushOptionsBar, { controller }),
7259
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7210
7260
  "button",
7211
7261
  {
7212
7262
  type: "button",
@@ -7217,12 +7267,12 @@ var ImageEditor = ({
7217
7267
  children: "Free Transform"
7218
7268
  }
7219
7269
  ),
7220
- paintError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7221
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayersPanel, { controller }) })
7270
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7271
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(LayersPanel, { controller }) })
7222
7272
  ] }),
7223
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7224
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
7225
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7273
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7274
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
7275
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7226
7276
  "button",
7227
7277
  {
7228
7278
  type: "button",
@@ -7233,13 +7283,13 @@ var ImageEditor = ({
7233
7283
  },
7234
7284
  t
7235
7285
  )) }),
7236
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7237
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7238
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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" }),
7239
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7240
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7241
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7242
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7286
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7287
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7288
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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" }),
7289
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7290
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageDividerClass }),
7291
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7292
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7243
7293
  "button",
7244
7294
  {
7245
7295
  type: "button",
@@ -7249,18 +7299,18 @@ var ImageEditor = ({
7249
7299
  },
7250
7300
  t
7251
7301
  )) }),
7252
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7253
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7254
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7255
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex-1 ml-2", children: [
7256
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7257
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Width:" }),
7258
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-mono", children: [
7302
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7303
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7304
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7305
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex-1 ml-2", children: [
7306
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7307
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Width:" }),
7308
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-mono", children: [
7259
7309
  strokeWidth,
7260
7310
  "px"
7261
7311
  ] })
7262
7312
  ] }),
7263
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7313
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7264
7314
  "input",
7265
7315
  {
7266
7316
  type: "range",
@@ -7273,10 +7323,10 @@ var ImageEditor = ({
7273
7323
  )
7274
7324
  ] })
7275
7325
  ] }),
7276
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7277
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7278
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-2", children: [
7279
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7326
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageDividerClass }),
7327
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7328
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-2", children: [
7329
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7280
7330
  "input",
7281
7331
  {
7282
7332
  type: "text",
@@ -7287,7 +7337,7 @@ var ImageEditor = ({
7287
7337
  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"
7288
7338
  }
7289
7339
  ),
7290
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7340
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7291
7341
  "button",
7292
7342
  {
7293
7343
  type: "button",
@@ -7297,14 +7347,14 @@ var ImageEditor = ({
7297
7347
  }
7298
7348
  )
7299
7349
  ] }),
7300
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7301
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Font Size:" }),
7302
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-mono", children: [
7350
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7351
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Font Size:" }),
7352
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-mono", children: [
7303
7353
  fontSize,
7304
7354
  "px"
7305
7355
  ] })
7306
7356
  ] }),
7307
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7357
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7308
7358
  "input",
7309
7359
  {
7310
7360
  type: "range",
@@ -7315,14 +7365,14 @@ var ImageEditor = ({
7315
7365
  className: imageRangeClass
7316
7366
  }
7317
7367
  ),
7318
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7319
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7320
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "text-muted-foreground", children: [
7368
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageDividerClass }),
7369
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
7370
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "text-muted-foreground", children: [
7321
7371
  "Layers (",
7322
7372
  state.annotations.length,
7323
7373
  ")"
7324
7374
  ] }),
7325
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7375
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7326
7376
  "button",
7327
7377
  {
7328
7378
  type: "button",
@@ -7331,7 +7381,7 @@ var ImageEditor = ({
7331
7381
  children: "Delete Selected"
7332
7382
  }
7333
7383
  ),
7334
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7384
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7335
7385
  "button",
7336
7386
  {
7337
7387
  type: "button",
@@ -7342,10 +7392,10 @@ var ImageEditor = ({
7342
7392
  )
7343
7393
  ] })
7344
7394
  ] }),
7345
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7346
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7347
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7348
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7395
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7396
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
7397
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7398
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7349
7399
  "button",
7350
7400
  {
7351
7401
  type: "button",
@@ -7355,8 +7405,8 @@ var ImageEditor = ({
7355
7405
  }
7356
7406
  )
7357
7407
  ] }),
7358
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7359
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7408
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7409
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7360
7410
  "input",
7361
7411
  {
7362
7412
  type: "checkbox",
@@ -7365,12 +7415,12 @@ var ImageEditor = ({
7365
7415
  className: "rounded accent-primary"
7366
7416
  }
7367
7417
  ),
7368
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7418
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Enable Depth / Alpha Mask" })
7369
7419
  ] }),
7370
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7371
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7372
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7373
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7420
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
7421
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
7422
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7423
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7374
7424
  "input",
7375
7425
  {
7376
7426
  type: "text",
@@ -7381,8 +7431,8 @@ var ImageEditor = ({
7381
7431
  }
7382
7432
  )
7383
7433
  ] }),
7384
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-2", children: [
7385
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7434
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-2", children: [
7435
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7386
7436
  "button",
7387
7437
  {
7388
7438
  type: "button",
@@ -7391,7 +7441,7 @@ var ImageEditor = ({
7391
7441
  children: "Threshold Mode"
7392
7442
  }
7393
7443
  ),
7394
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7444
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7395
7445
  "button",
7396
7446
  {
7397
7447
  type: "button",
@@ -7401,12 +7451,12 @@ var ImageEditor = ({
7401
7451
  }
7402
7452
  )
7403
7453
  ] }),
7404
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7405
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7406
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Depth Start (Lower):" }),
7407
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
7454
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
7455
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7456
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Depth Start (Lower):" }),
7457
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
7408
7458
  ] }),
7409
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7459
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7410
7460
  "input",
7411
7461
  {
7412
7462
  type: "range",
@@ -7420,12 +7470,12 @@ var ImageEditor = ({
7420
7470
  }
7421
7471
  )
7422
7472
  ] }),
7423
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7424
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7425
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Depth Stop (Upper):" }),
7426
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
7473
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
7474
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7475
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Depth Stop (Upper):" }),
7476
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
7427
7477
  ] }),
7428
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7478
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7429
7479
  "input",
7430
7480
  {
7431
7481
  type: "range",
@@ -7439,12 +7489,12 @@ var ImageEditor = ({
7439
7489
  }
7440
7490
  )
7441
7491
  ] }),
7442
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7443
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7444
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Softness:" }),
7445
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
7492
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
7493
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7494
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Softness:" }),
7495
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
7446
7496
  ] }),
7447
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7497
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7448
7498
  "input",
7449
7499
  {
7450
7500
  type: "range",
@@ -7456,8 +7506,8 @@ var ImageEditor = ({
7456
7506
  }
7457
7507
  )
7458
7508
  ] }),
7459
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7460
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7509
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7510
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7461
7511
  "input",
7462
7512
  {
7463
7513
  type: "checkbox",
@@ -7466,12 +7516,12 @@ var ImageEditor = ({
7466
7516
  className: "rounded accent-primary"
7467
7517
  }
7468
7518
  ),
7469
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Invert Mask" })
7519
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Invert Mask" })
7470
7520
  ] })
7471
7521
  ] })
7472
7522
  ] }),
7473
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7474
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7523
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7524
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7475
7525
  SelectionOptionsBar,
7476
7526
  {
7477
7527
  controller,
@@ -7482,9 +7532,9 @@ var ImageEditor = ({
7482
7532
  selectionDisplay: state.selectionDisplay
7483
7533
  }
7484
7534
  ),
7485
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7486
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-1", children: [
7487
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7535
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7536
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-1", children: [
7537
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7488
7538
  "button",
7489
7539
  {
7490
7540
  type: "button",
@@ -7495,7 +7545,7 @@ var ImageEditor = ({
7495
7545
  children: "Transform Selection"
7496
7546
  }
7497
7547
  ),
7498
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7548
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7499
7549
  "button",
7500
7550
  {
7501
7551
  type: "button",
@@ -7507,14 +7557,14 @@ var ImageEditor = ({
7507
7557
  }
7508
7558
  )
7509
7559
  ] }),
7510
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7511
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelsPanel, { controller }),
7512
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PathsPanel, { controller })
7560
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7561
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChannelsPanel, { controller }),
7562
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PathsPanel, { controller })
7513
7563
  ] }),
7514
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7515
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7516
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Results go to" }),
7517
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7564
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7565
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7566
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Results go to" }),
7567
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7518
7568
  "select",
7519
7569
  {
7520
7570
  "aria-label": "AI result target",
@@ -7522,54 +7572,54 @@ var ImageEditor = ({
7522
7572
  onChange: (e) => setAiTarget(e.target.value),
7523
7573
  className: imageSelectClass,
7524
7574
  children: [
7525
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7526
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7527
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "replace", children: "Replace image" })
7575
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7576
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7577
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: "replace", children: "Replace image" })
7528
7578
  ]
7529
7579
  }
7530
7580
  )
7531
7581
  ] }),
7532
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7533
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7534
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7535
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
7582
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7583
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
7584
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7585
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
7536
7586
  "Background Removal"
7537
7587
  ] }),
7538
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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..." })
7588
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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..." })
7539
7589
  ] }),
7540
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7541
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7590
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7591
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7542
7592
  "button",
7543
7593
  {
7544
7594
  type: "button",
7545
7595
  onClick: handleRemoveBackground,
7546
7596
  disabled: isRemovingBg || isInpainting,
7547
7597
  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",
7548
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7549
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSpinnerClass }),
7598
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
7599
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageSpinnerClass }),
7550
7600
  "Removing Background..."
7551
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7552
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7601
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
7602
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7553
7603
  "Remove Background"
7554
7604
  ] })
7555
7605
  }
7556
7606
  )
7557
7607
  ] }),
7558
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7559
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7560
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7561
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7562
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
7563
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "m14 7 3 3" })
7608
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
7609
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between", children: [
7610
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7611
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
7612
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
7613
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "m14 7 3 3" })
7564
7614
  ] }),
7565
7615
  "Generative Inpainting"
7566
7616
  ] }),
7567
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("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..." })
7617
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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..." })
7568
7618
  ] }),
7569
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7570
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", children: [
7571
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7572
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7619
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
7620
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-1", children: [
7621
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7622
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7573
7623
  "textarea",
7574
7624
  {
7575
7625
  id: "ai-inpaint-prompt-react",
@@ -7581,10 +7631,10 @@ var ImageEditor = ({
7581
7631
  }
7582
7632
  )
7583
7633
  ] }),
7584
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", children: [
7585
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7586
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7587
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7634
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-1", children: [
7635
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7636
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7637
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7588
7638
  "button",
7589
7639
  {
7590
7640
  type: "button",
@@ -7597,7 +7647,7 @@ var ImageEditor = ({
7597
7647
  ]
7598
7648
  }
7599
7649
  ),
7600
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7650
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7601
7651
  "button",
7602
7652
  {
7603
7653
  type: "button",
@@ -7612,25 +7662,25 @@ var ImageEditor = ({
7612
7662
  )
7613
7663
  ] })
7614
7664
  ] }),
7615
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7665
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7616
7666
  "button",
7617
7667
  {
7618
7668
  type: "button",
7619
7669
  onClick: handleInpaint,
7620
7670
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
7621
7671
  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",
7622
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7623
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageSpinnerClass }),
7672
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
7673
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: imageSpinnerClass }),
7624
7674
  "Generating Inpaint..."
7625
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7626
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7675
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
7676
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
7627
7677
  "Apply Inpainting"
7628
7678
  ] })
7629
7679
  }
7630
7680
  )
7631
7681
  ] }),
7632
- aiError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7633
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7682
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
7683
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
7634
7684
  ] })
7635
7685
  ] })
7636
7686
  ] })
@@ -7666,6 +7716,7 @@ var ImageEditor = ({
7666
7716
  PathsPanel,
7667
7717
  RefineEdgePanel,
7668
7718
  SelectAndMaskWorkspace,
7719
+ SelectionChangeCheck,
7669
7720
  SelectionOptionsBar,
7670
7721
  ShapeOptionsBar,
7671
7722
  TypeOptionsBar,