@pixerate/editor-react 0.146.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,20 +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);
5817
- const [onlyUncertain, setOnlyUncertain] = (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);
5818
5859
  const canObject = Boolean(controller.segmentationProvider);
5819
5860
  const toLayer = output !== "selection" && output !== "layer-mask";
5820
5861
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -5837,17 +5878,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5837
5878
  setBusy(false);
5838
5879
  }
5839
5880
  };
5840
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5841
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
5842
- import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5843
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5844
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: c.label }),
5845
- /* @__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: [
5846
5887
  params[c.id],
5847
5888
  c.unit
5848
5889
  ] })
5849
5890
  ] }),
5850
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5891
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5851
5892
  "input",
5852
5893
  {
5853
5894
  type: "range",
@@ -5861,43 +5902,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5861
5902
  }
5862
5903
  )
5863
5904
  ] }, c.id)),
5864
- /* @__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", 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 }) }),
5866
5907
  "Smart Radius"
5867
5908
  ] }),
5868
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
5869
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(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) }),
5870
5911
  "Only uncertain areas"
5871
5912
  ] }),
5872
- canObject && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5873
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
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) }),
5874
5915
  "Object aware (segmentation model)"
5875
5916
  ] }),
5876
- /* @__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: [
5877
5918
  "Output to",
5878
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5919
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5879
5920
  "select",
5880
5921
  {
5881
5922
  "aria-label": "Refine output",
5882
5923
  value: output,
5883
5924
  onChange: (e) => setOutput(e.target.value),
5884
5925
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5885
- 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))
5886
5927
  }
5887
5928
  )
5888
5929
  ] }),
5889
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5890
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5891
- /* @__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: [
5892
5933
  "Decontaminate colors",
5893
5934
  toLayer ? "" : " (new layer or document outputs)"
5894
5935
  ] }),
5895
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
5936
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "font-mono", children: [
5896
5937
  decontaminate,
5897
5938
  "%"
5898
5939
  ] })
5899
5940
  ] }),
5900
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5941
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5901
5942
  "input",
5902
5943
  {
5903
5944
  type: "range",
@@ -5912,64 +5953,65 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5912
5953
  }
5913
5954
  )
5914
5955
  ] }),
5915
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
5916
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5917
- /* @__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" })
5918
5959
  ] }),
5919
- error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
5920
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MaskEdgeCheck, { controller, selection: sel }),
5921
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
5922
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1 items-center", children: [
5923
- /* @__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)(
5924
5966
  "select",
5925
5967
  {
5926
5968
  "aria-label": "New masked layer kind",
5927
5969
  value: newKind,
5928
5970
  onChange: (e) => setNewKind(e.target.value),
5929
5971
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5930
- 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))
5931
5973
  }
5932
5974
  ),
5933
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5975
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5934
5976
  "button",
5935
5977
  {
5936
5978
  type: "button",
5937
- className: button5,
5979
+ className: button6,
5938
5980
  disabled: !sel,
5939
5981
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
5940
5982
  children: "New Masked Layer"
5941
5983
  }
5942
5984
  )
5943
5985
  ] }),
5944
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", children: [
5945
- /* @__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)(
5946
5988
  "select",
5947
5989
  {
5948
5990
  "aria-label": "Mask layer",
5949
5991
  value: target.id,
5950
5992
  onChange: (e) => setLayerId(e.target.value),
5951
5993
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
5952
- 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: [
5953
5995
  l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
5954
5996
  l.mask ? " (masked)" : ""
5955
5997
  ] }, l.id))
5956
5998
  }
5957
5999
  ),
5958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
5959
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
5960
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
5961
- /* @__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" })
5962
6004
  ] }),
5963
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
5964
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5965
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5966
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Density" }),
5967
- /* @__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: [
5968
6010
  Math.round((target.mask.density ?? 1) * 100),
5969
6011
  "%"
5970
6012
  ] })
5971
6013
  ] }),
5972
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6014
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5973
6015
  "input",
5974
6016
  {
5975
6017
  type: "range",
@@ -5983,15 +6025,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5983
6025
  }
5984
6026
  )
5985
6027
  ] }),
5986
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
5987
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5988
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Mask Feather" }),
5989
- /* @__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: [
5990
6032
  target.mask.feather ?? 0,
5991
6033
  "px"
5992
6034
  ] })
5993
6035
  ] }),
5994
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6036
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5995
6037
  "input",
5996
6038
  {
5997
6039
  type: "range",
@@ -6011,13 +6053,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
6011
6053
  };
6012
6054
 
6013
6055
  // src/image-editor/ChannelsPanel.tsx
6014
- var import_react31 = require("react");
6056
+ var import_react32 = require("react");
6015
6057
  var import_image_editor19 = require("@pixerate/editor/image-editor");
6016
- var import_jsx_runtime31 = require("react/jsx-runtime");
6058
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6017
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"}`;
6018
6060
  var ChannelThumb = ({ channel, size }) => {
6019
- const ref = (0, import_react31.useRef)(null);
6020
- (0, import_react31.useEffect)(() => {
6061
+ const ref = (0, import_react32.useRef)(null);
6062
+ (0, import_react32.useEffect)(() => {
6021
6063
  const canvas = ref.current;
6022
6064
  const ctx = canvas?.getContext("2d");
6023
6065
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
@@ -6028,15 +6070,15 @@ var ChannelThumb = ({ channel, size }) => {
6028
6070
  img.data.set(px.data);
6029
6071
  ctx.putImageData(img, 0, 0);
6030
6072
  }, [channel.mask]);
6031
- 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" });
6032
6074
  };
6033
6075
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6034
- const [, setTick] = (0, import_react31.useState)(0);
6035
- (0, import_react31.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6036
- const [activeId, setActiveId] = (0, import_react31.useState)(null);
6037
- const [renaming, setRenaming] = (0, import_react31.useState)(null);
6038
- const [error, setError] = (0, import_react31.useState)(null);
6039
- 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);
6040
6082
  const channels = controller.getChannels();
6041
6083
  const active = channels.find((c) => c.id === activeId) ?? null;
6042
6084
  const hasSelection = Boolean(controller.getSelection());
@@ -6058,13 +6100,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6058
6100
  setError(err instanceof Error ? err.message : String(err));
6059
6101
  }
6060
6102
  };
6061
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
6062
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between", children: [
6063
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
6064
- /* @__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" })
6065
6107
  ] }),
6066
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
6067
- /* @__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)(
6068
6110
  "li",
6069
6111
  {
6070
6112
  "data-testid": "channel-row",
@@ -6076,7 +6118,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6076
6118
  },
6077
6119
  onDoubleClick: () => setRenaming(c.id),
6078
6120
  children: [
6079
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6121
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6080
6122
  "button",
6081
6123
  {
6082
6124
  type: "button",
@@ -6090,8 +6132,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6090
6132
  children: c.visible ? "\u25CF" : "\u25CB"
6091
6133
  }
6092
6134
  ),
6093
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
6094
- 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)(
6095
6137
  "input",
6096
6138
  {
6097
6139
  autoFocus: true,
@@ -6108,16 +6150,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6108
6150
  if (e.key === "Escape") setRenaming(null);
6109
6151
  }
6110
6152
  }
6111
- ) : /* @__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 })
6112
6154
  ]
6113
6155
  },
6114
6156
  c.id
6115
6157
  )) }),
6116
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6117
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
6118
- /* @__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" }),
6119
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
6120
- /* @__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)(
6121
6163
  "button",
6122
6164
  {
6123
6165
  type: "button",
@@ -6130,8 +6172,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6130
6172
  children: "Delete"
6131
6173
  }
6132
6174
  ),
6133
- /* @__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" }),
6134
- /* @__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)(
6135
6177
  "button",
6136
6178
  {
6137
6179
  type: "button",
@@ -6142,7 +6184,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6142
6184
  children: "Export PNG"
6143
6185
  }
6144
6186
  ),
6145
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6187
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6146
6188
  "input",
6147
6189
  {
6148
6190
  ref: fileInput,
@@ -6157,22 +6199,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6157
6199
  }
6158
6200
  )
6159
6201
  ] }),
6160
- 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 })
6161
6203
  ] });
6162
6204
  };
6163
6205
 
6164
6206
  // src/image-editor/PathsPanel.tsx
6165
- var import_react32 = require("react");
6207
+ var import_react33 = require("react");
6166
6208
  var import_image_editor20 = require("@pixerate/editor/image-editor");
6167
- var import_jsx_runtime32 = require("react/jsx-runtime");
6209
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6168
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"}`;
6169
6211
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6170
- const [, setTick] = (0, import_react32.useState)(0);
6171
- (0, import_react32.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6172
- const [renaming, setRenaming] = (0, import_react32.useState)(null);
6173
- const [color, setColor] = (0, import_react32.useState)("#000000");
6174
- const [width, setWidth] = (0, import_react32.useState)(2);
6175
- 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);
6176
6218
  const paths = controller.getPaths();
6177
6219
  const activeId = controller.getState().activePathId ?? null;
6178
6220
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -6188,10 +6230,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6188
6230
  };
6189
6231
  return (
6190
6232
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
6191
- /* @__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: [
6192
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
6193
- paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
6194
- /* @__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)(
6195
6237
  "li",
6196
6238
  {
6197
6239
  "data-testid": "path-row",
@@ -6200,8 +6242,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6200
6242
  onClick: () => attempt(() => controller.setActivePath(p.id)),
6201
6243
  onDoubleClick: () => setRenaming(p.id),
6202
6244
  children: [
6203
- /* @__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" }) }),
6204
- 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)(
6205
6247
  "input",
6206
6248
  {
6207
6249
  autoFocus: true,
@@ -6220,13 +6262,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6220
6262
  if (e.key === "Escape") setRenaming(null);
6221
6263
  }
6222
6264
  }
6223
- ) : /* @__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 })
6224
6266
  ]
6225
6267
  },
6226
6268
  p.id
6227
6269
  )) }),
6228
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6229
- /* @__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)(
6230
6272
  "button",
6231
6273
  {
6232
6274
  type: "button",
@@ -6237,15 +6279,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6237
6279
  children: "Load as Selection"
6238
6280
  }
6239
6281
  ),
6240
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
6241
- active?.work && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
6242
- /* @__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" })
6243
6285
  ] }),
6244
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
6245
- /* @__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" }),
6246
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
6247
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
6248
- /* @__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)(
6249
6291
  "input",
6250
6292
  {
6251
6293
  type: "number",
@@ -6260,25 +6302,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
6260
6302
  ),
6261
6303
  "px"
6262
6304
  ] }),
6263
- /* @__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" })
6264
6306
  ] }),
6265
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
6266
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
6267
- /* @__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" })
6268
6310
  ] }),
6269
- 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 })
6270
6312
  ] })
6271
6313
  );
6272
6314
  };
6273
6315
 
6274
6316
  // src/image-editor/FreeTransformOptionsBar.tsx
6275
- var import_react33 = require("react");
6317
+ var import_react34 = require("react");
6276
6318
  var import_image_editor21 = require("@pixerate/editor/image-editor");
6277
- var import_jsx_runtime33 = require("react/jsx-runtime");
6319
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6278
6320
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
6279
6321
  var FreeTransformOptionsBar = ({ tool, className }) => {
6280
- const [, setTick] = (0, import_react33.useState)(0);
6281
- (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]);
6282
6324
  const bar = tool.bar();
6283
6325
  if (!tool.active || !bar) return null;
6284
6326
  const warp = tool.warpBar();
@@ -6290,17 +6332,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6290
6332
  const v = Number(raw);
6291
6333
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
6292
6334
  };
6293
- 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: [
6294
- /* @__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)) }),
6295
- /* @__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)) }),
6296
- 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: [
6297
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6298
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
6299
- /* @__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)) })
6300
6342
  ] }),
6301
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6302
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
6303
- /* @__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)(
6304
6346
  "input",
6305
6347
  {
6306
6348
  type: "number",
@@ -6321,9 +6363,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6321
6363
  },
6322
6364
  `${k}:${warp[k]}`
6323
6365
  ),
6324
- /* @__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: "%" })
6325
6367
  ] }, k)),
6326
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6368
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6327
6369
  "button",
6328
6370
  {
6329
6371
  type: "button",
@@ -6335,9 +6377,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6335
6377
  children: "Vertical"
6336
6378
  }
6337
6379
  ),
6338
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6339
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
6340
- /* @__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)(
6341
6383
  "select",
6342
6384
  {
6343
6385
  "aria-label": "Warp grid",
@@ -6347,14 +6389,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6347
6389
  tool.setWarp({ columns: g.columns, rows: g.rows });
6348
6390
  },
6349
6391
  className: imageFieldClass,
6350
- 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))
6351
6393
  }
6352
6394
  )
6353
6395
  ] })
6354
6396
  ] }),
6355
- 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: [
6356
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: f.label }),
6357
- /* @__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)(
6358
6400
  "input",
6359
6401
  {
6360
6402
  type: "number",
@@ -6374,8 +6416,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6374
6416
  },
6375
6417
  `${f.id}:${round(bar[f.id], f.unit)}`
6376
6418
  ),
6377
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
6378
- 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)(
6379
6421
  "button",
6380
6422
  {
6381
6423
  type: "button",
@@ -6390,33 +6432,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6390
6432
  }
6391
6433
  )
6392
6434
  ] }, f.id)),
6393
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
6394
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
6395
- /* @__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)(
6396
6438
  "select",
6397
6439
  {
6398
6440
  "aria-label": "Interpolation",
6399
6441
  value: tool.interpolation,
6400
6442
  onChange: (e) => tool.setInterpolation(e.target.value),
6401
6443
  className: imageFieldClass,
6402
- 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))
6403
6445
  }
6404
6446
  )
6405
6447
  ] }),
6406
- /* @__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" }),
6407
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
6408
- 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 })
6409
6451
  ] });
6410
6452
  };
6411
6453
 
6412
6454
  // src/image-editor/ShapeOptionsBar.tsx
6413
- var import_react34 = require("react");
6455
+ var import_react35 = require("react");
6414
6456
  var import_image_editor22 = require("@pixerate/editor/image-editor");
6415
- var import_jsx_runtime34 = require("react/jsx-runtime");
6457
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6416
6458
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6417
- const [, setTick] = (0, import_react34.useState)(0);
6418
- (0, import_react34.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6419
- 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);
6420
6462
  const active = controller.getActiveLayer();
6421
6463
  const shapeId = active?.type === "shape" ? active.id : null;
6422
6464
  const set = (change) => {
@@ -6430,22 +6472,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6430
6472
  }
6431
6473
  };
6432
6474
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
6433
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6434
- /* @__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)) }),
6435
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6436
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6437
- /* @__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 }) }),
6438
6480
  "Fill",
6439
- /* @__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 }) })
6440
6482
  ] }),
6441
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6442
- /* @__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 }) }),
6443
6485
  "Stroke",
6444
- /* @__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 }) })
6445
6487
  ] }),
6446
- /* @__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: [
6447
6489
  "Width",
6448
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6490
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6449
6491
  "input",
6450
6492
  {
6451
6493
  type: "number",
@@ -6459,52 +6501,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6459
6501
  )
6460
6502
  ] })
6461
6503
  ] }),
6462
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6463
- 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: [
6464
6506
  "Radius",
6465
- /* @__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}` })
6466
6508
  ] }),
6467
- 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: [
6468
6510
  "Sides",
6469
- /* @__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}` })
6470
6512
  ] }),
6471
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6472
- /* @__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: [
6473
6515
  "Points",
6474
- /* @__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}` })
6475
6517
  ] }),
6476
- /* @__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: [
6477
6519
  "Inner",
6478
- /* @__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 }) })
6479
6521
  ] })
6480
6522
  ] }),
6481
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6482
- /* @__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: [
6483
6525
  "Weight",
6484
- /* @__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}` })
6485
6527
  ] }),
6486
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
6487
- /* @__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 }) }),
6488
6530
  "Arrowhead"
6489
6531
  ] })
6490
6532
  ] })
6491
6533
  ] }),
6492
- /* @__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." }),
6493
- 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 })
6494
6536
  ] });
6495
6537
  };
6496
6538
 
6497
6539
  // src/image-editor/TypeOptionsBar.tsx
6498
- var import_react35 = require("react");
6540
+ var import_react36 = require("react");
6499
6541
  var import_image_editor23 = require("@pixerate/editor/image-editor");
6500
- var import_jsx_runtime35 = require("react/jsx-runtime");
6542
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6501
6543
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
6502
6544
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
6503
6545
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
6504
- const [, setTick] = (0, import_react35.useState)(0);
6505
- (0, import_react35.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6506
- (0, import_react35.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
6507
- 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);
6508
6550
  const active = controller.getActiveLayer();
6509
6551
  const typeId = !session && active?.type === "type" ? active.id : null;
6510
6552
  const here = session?.alive ? session.styleHere() : {};
@@ -6557,11 +6599,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6557
6599
  setError(e instanceof Error ? e.message : String(e));
6558
6600
  }
6559
6601
  };
6560
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
6561
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
6562
- /* @__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: [
6563
6605
  "Font",
6564
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6606
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6565
6607
  "input",
6566
6608
  {
6567
6609
  list: "pixerate-type-fonts",
@@ -6571,11 +6613,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6571
6613
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
6572
6614
  }
6573
6615
  ),
6574
- /* @__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)) })
6575
6617
  ] }),
6576
- /* @__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: [
6577
6619
  "Size",
6578
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6620
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6579
6621
  "input",
6580
6622
  {
6581
6623
  type: "number",
@@ -6588,14 +6630,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6588
6630
  }
6589
6631
  )
6590
6632
  ] }),
6591
- /* @__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" }),
6592
- /* @__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" }),
6593
- /* @__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 }) })
6594
6636
  ] }),
6595
- /* @__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)) }),
6596
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
6597
- 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)),
6598
- 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)(
6599
6641
  "button",
6600
6642
  {
6601
6643
  type: "button",
@@ -6607,19 +6649,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
6607
6649
  }
6608
6650
  )
6609
6651
  ] }),
6610
- /* @__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." }),
6611
- 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: [
6612
6654
  "Missing ",
6613
6655
  missing.length === 1 ? "font" : "fonts",
6614
6656
  ": ",
6615
6657
  missing.join(", ")
6616
6658
  ] }),
6617
- 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 })
6618
6660
  ] });
6619
6661
  };
6620
6662
 
6621
6663
  // src/image-editor/ImageEditor.tsx
6622
- var import_jsx_runtime36 = require("react/jsx-runtime");
6664
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6623
6665
  var ImageEditor = ({
6624
6666
  editor: externalEditor,
6625
6667
  src,
@@ -6644,32 +6686,32 @@ var ImageEditor = ({
6644
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);
6645
6687
  });
6646
6688
  const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
6647
- const [activeTab, setActiveTab] = (0, import_react36.useState)("crop");
6648
- const rootRef = (0, import_react36.useRef)(null);
6689
+ const [activeTab, setActiveTab] = (0, import_react37.useState)("crop");
6690
+ const rootRef = (0, import_react37.useRef)(null);
6649
6691
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
6650
- const activeTabRef = (0, import_react36.useRef)(activeTab);
6692
+ const activeTabRef = (0, import_react37.useRef)(activeTab);
6651
6693
  activeTabRef.current = activeTab;
6652
6694
  const openPanel = async (ref) => {
6653
6695
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
6654
6696
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
6655
6697
  await new Promise((resolve) => setTimeout(resolve, 60));
6656
6698
  };
6657
- const [activeCropRatio, setActiveCropRatio] = (0, import_react36.useState)(null);
6658
- const [selectionOptions, setSelectionOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
6659
- const [shapeOptions, setShapeOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
6660
- const [typeOptions, setTypeOptions] = (0, import_react36.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
6661
- const [typeSession, setTypeSession] = (0, import_react36.useState)(null);
6662
- const [selectionError, setSelectionError] = (0, import_react36.useState)(null);
6663
- const [paintError, setPaintError] = (0, import_react36.useState)(null);
6664
- 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);
6665
6707
  const handleCanvasError = (source, message) => {
6666
6708
  if (source === "paint") setPaintError(message);
6667
6709
  else if (source === "select") setSelectionError(message);
6668
6710
  else setShapeTypeError(message);
6669
6711
  };
6670
6712
  const finishTyping = () => setTypeSession(null);
6671
- const transformToolRef = (0, import_react36.useRef)(null);
6672
- const transformControllerRef = (0, import_react36.useRef)(controller);
6713
+ const transformToolRef = (0, import_react37.useRef)(null);
6714
+ const transformControllerRef = (0, import_react37.useRef)(controller);
6673
6715
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
6674
6716
  transformToolRef.current?.cancel();
6675
6717
  transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
@@ -6678,16 +6720,16 @@ var ImageEditor = ({
6678
6720
  transformControllerRef.current = controller;
6679
6721
  }
6680
6722
  const transformTool = transformToolRef.current;
6681
- const [, setTransformTick] = (0, import_react36.useState)(0);
6682
- (0, import_react36.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
6683
- (0, import_react36.useEffect)(() => () => transformToolRef.current?.cancel(), []);
6684
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react36.useState)("");
6685
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react36.useState)("annotations");
6686
- const [isRemovingBg, setIsRemovingBg] = (0, import_react36.useState)(false);
6687
- const [isInpainting, setIsInpainting] = (0, import_react36.useState)(false);
6688
- const [aiError, setAiError] = (0, import_react36.useState)(null);
6689
- const [aiSuccess, setAiSuccess] = (0, import_react36.useState)(null);
6690
- 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");
6691
6733
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
6692
6734
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
6693
6735
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -6750,11 +6792,11 @@ var ImageEditor = ({
6750
6792
  setIsInpainting(false);
6751
6793
  }
6752
6794
  };
6753
- const [activeColor, setActiveColor] = (0, import_react36.useState)("#ef4444");
6754
- const [strokeWidth, setStrokeWidth] = (0, import_react36.useState)(3);
6755
- const [fontSize, setFontSize] = (0, import_react36.useState)(24);
6756
- const [textInput, setTextInput] = (0, import_react36.useState)("");
6757
- (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)(() => {
6758
6800
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
6759
6801
  editor.setTool("crop");
6760
6802
  }
@@ -6782,16 +6824,16 @@ var ImageEditor = ({
6782
6824
  link.click();
6783
6825
  }
6784
6826
  };
6785
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
6827
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6786
6828
  "div",
6787
6829
  {
6788
6830
  ref: rootRef,
6789
6831
  className: `${imageEditorFrameClass} ${className}`,
6790
6832
  style,
6791
6833
  children: [
6792
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: imageEditorHeaderClass, children: [
6793
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
6794
- /* @__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)(
6795
6837
  "button",
6796
6838
  {
6797
6839
  type: "button",
@@ -6806,7 +6848,7 @@ var ImageEditor = ({
6806
6848
  children: "Transform & Crop"
6807
6849
  }
6808
6850
  ),
6809
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6851
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6810
6852
  "button",
6811
6853
  {
6812
6854
  type: "button",
@@ -6821,7 +6863,7 @@ var ImageEditor = ({
6821
6863
  children: "Adjustments"
6822
6864
  }
6823
6865
  ),
6824
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6866
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6825
6867
  "button",
6826
6868
  {
6827
6869
  type: "button",
@@ -6836,7 +6878,7 @@ var ImageEditor = ({
6836
6878
  children: "Layers"
6837
6879
  }
6838
6880
  ),
6839
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6881
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6840
6882
  "button",
6841
6883
  {
6842
6884
  type: "button",
@@ -6851,7 +6893,7 @@ var ImageEditor = ({
6851
6893
  children: "Paint"
6852
6894
  }
6853
6895
  ),
6854
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6896
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6855
6897
  "button",
6856
6898
  {
6857
6899
  type: "button",
@@ -6866,7 +6908,7 @@ var ImageEditor = ({
6866
6908
  children: "Select & Mask"
6867
6909
  }
6868
6910
  ),
6869
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6911
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6870
6912
  "button",
6871
6913
  {
6872
6914
  type: "button",
@@ -6881,7 +6923,7 @@ var ImageEditor = ({
6881
6923
  children: "Annotations"
6882
6924
  }
6883
6925
  ),
6884
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6926
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6885
6927
  "button",
6886
6928
  {
6887
6929
  type: "button",
@@ -6896,7 +6938,7 @@ var ImageEditor = ({
6896
6938
  children: "Depth Mask"
6897
6939
  }
6898
6940
  ),
6899
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
6941
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6900
6942
  "button",
6901
6943
  {
6902
6944
  type: "button",
@@ -6909,14 +6951,14 @@ var ImageEditor = ({
6909
6951
  "aria-selected": activeTab === "ai",
6910
6952
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
6911
6953
  children: [
6912
- /* @__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" }) }),
6913
6955
  "AI Tools"
6914
6956
  ]
6915
6957
  }
6916
6958
  )
6917
6959
  ] }),
6918
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
6919
- /* @__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)(
6920
6962
  "button",
6921
6963
  {
6922
6964
  type: "button",
@@ -6927,7 +6969,7 @@ var ImageEditor = ({
6927
6969
  children: "\u21A9"
6928
6970
  }
6929
6971
  ),
6930
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6972
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6931
6973
  "button",
6932
6974
  {
6933
6975
  type: "button",
@@ -6938,7 +6980,7 @@ var ImageEditor = ({
6938
6980
  children: "\u21AA"
6939
6981
  }
6940
6982
  ),
6941
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6983
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6942
6984
  "button",
6943
6985
  {
6944
6986
  type: "button",
@@ -6947,8 +6989,8 @@ var ImageEditor = ({
6947
6989
  children: "Reset"
6948
6990
  }
6949
6991
  ),
6950
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6951
- /* @__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)(
6952
6994
  "button",
6953
6995
  {
6954
6996
  type: "button",
@@ -6958,11 +7000,11 @@ var ImageEditor = ({
6958
7000
  children: "-"
6959
7001
  }
6960
7002
  ),
6961
- /* @__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: [
6962
7004
  Math.round(state.zoom * 100),
6963
7005
  "%"
6964
7006
  ] }),
6965
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7007
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6966
7008
  "button",
6967
7009
  {
6968
7010
  type: "button",
@@ -6972,8 +7014,8 @@ var ImageEditor = ({
6972
7014
  children: "+"
6973
7015
  }
6974
7016
  ),
6975
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
6976
- /* @__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)(
6977
7019
  "button",
6978
7020
  {
6979
7021
  type: "button",
@@ -6984,7 +7026,7 @@ var ImageEditor = ({
6984
7026
  children: "Hold Compare"
6985
7027
  }
6986
7028
  ),
6987
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7029
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6988
7030
  "button",
6989
7031
  {
6990
7032
  type: "button",
@@ -6995,10 +7037,10 @@ var ImageEditor = ({
6995
7037
  )
6996
7038
  ] })
6997
7039
  ] }),
6998
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
6999
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
7000
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
7001
- /* @__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)(
7002
7044
  ImageEditorCanvas,
7003
7045
  {
7004
7046
  editor,
@@ -7022,11 +7064,11 @@ var ImageEditor = ({
7022
7064
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
7023
7065
  }
7024
7066
  ),
7025
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: imageSidebarClass, children: [
7026
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7027
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
7028
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
7029
- /* @__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)(
7030
7072
  "button",
7031
7073
  {
7032
7074
  type: "button",
@@ -7038,7 +7080,7 @@ var ImageEditor = ({
7038
7080
  children: "Freeform"
7039
7081
  }
7040
7082
  ),
7041
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7083
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7042
7084
  "button",
7043
7085
  {
7044
7086
  type: "button",
@@ -7050,7 +7092,7 @@ var ImageEditor = ({
7050
7092
  children: "1:1 Square"
7051
7093
  }
7052
7094
  ),
7053
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7095
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7054
7096
  "button",
7055
7097
  {
7056
7098
  type: "button",
@@ -7062,7 +7104,7 @@ var ImageEditor = ({
7062
7104
  children: "4:3 Standard"
7063
7105
  }
7064
7106
  ),
7065
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7107
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7066
7108
  "button",
7067
7109
  {
7068
7110
  type: "button",
@@ -7074,7 +7116,7 @@ var ImageEditor = ({
7074
7116
  children: "16:9 Wide"
7075
7117
  }
7076
7118
  ),
7077
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7119
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7078
7120
  "button",
7079
7121
  {
7080
7122
  type: "button",
@@ -7086,7 +7128,7 @@ var ImageEditor = ({
7086
7128
  children: "3:2 Photo"
7087
7129
  }
7088
7130
  ),
7089
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7131
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7090
7132
  "button",
7091
7133
  {
7092
7134
  type: "button",
@@ -7099,10 +7141,10 @@ var ImageEditor = ({
7099
7141
  }
7100
7142
  )
7101
7143
  ] }),
7102
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7103
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
7104
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
7105
- /* @__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)(
7106
7148
  "button",
7107
7149
  {
7108
7150
  type: "button",
@@ -7111,7 +7153,7 @@ var ImageEditor = ({
7111
7153
  children: "Rotate -90\xB0"
7112
7154
  }
7113
7155
  ),
7114
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7156
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7115
7157
  "button",
7116
7158
  {
7117
7159
  type: "button",
@@ -7120,7 +7162,7 @@ var ImageEditor = ({
7120
7162
  children: "Rotate +90\xB0"
7121
7163
  }
7122
7164
  ),
7123
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7165
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7124
7166
  "button",
7125
7167
  {
7126
7168
  type: "button",
@@ -7129,7 +7171,7 @@ var ImageEditor = ({
7129
7171
  children: "Flip Horizontal"
7130
7172
  }
7131
7173
  ),
7132
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7174
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7133
7175
  "button",
7134
7176
  {
7135
7177
  type: "button",
@@ -7140,10 +7182,10 @@ var ImageEditor = ({
7140
7182
  )
7141
7183
  ] })
7142
7184
  ] }),
7143
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7144
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7145
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
7146
- /* @__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)(
7147
7189
  "button",
7148
7190
  {
7149
7191
  type: "button",
@@ -7153,9 +7195,9 @@ var ImageEditor = ({
7153
7195
  }
7154
7196
  )
7155
7197
  ] }),
7156
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Histogram, { histogram: editor.histogram }),
7157
- import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react36.default.Fragment, { children: [
7158
- /* @__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)(
7159
7201
  ControlSlider,
7160
7202
  {
7161
7203
  spec,
@@ -7164,14 +7206,14 @@ var ImageEditor = ({
7164
7206
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
7165
7207
  }
7166
7208
  ),
7167
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7209
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7168
7210
  "div",
7169
7211
  {
7170
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",
7171
7213
  "data-testid": "image-editor-process-notice",
7172
7214
  children: [
7173
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
7174
- /* @__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)(
7175
7217
  "button",
7176
7218
  {
7177
7219
  type: "button",
@@ -7184,7 +7226,7 @@ var ImageEditor = ({
7184
7226
  }
7185
7227
  )
7186
7228
  ] }, spec.id)),
7187
- /* @__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)(
7188
7230
  AdjustmentLayersPanel,
7189
7231
  {
7190
7232
  controller,
@@ -7193,9 +7235,9 @@ var ImageEditor = ({
7193
7235
  }
7194
7236
  ) })
7195
7237
  ] }),
7196
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7197
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
7198
- /* @__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)(
7199
7241
  "button",
7200
7242
  {
7201
7243
  type: "button",
@@ -7206,15 +7248,15 @@ var ImageEditor = ({
7206
7248
  children: "Free Transform"
7207
7249
  }
7208
7250
  ),
7209
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayersPanel, { controller }),
7210
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
7211
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
7212
- /* @__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 })
7213
7255
  ] }),
7214
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7215
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
7216
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BrushOptionsBar, { controller }),
7217
- /* @__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)(
7218
7260
  "button",
7219
7261
  {
7220
7262
  type: "button",
@@ -7225,12 +7267,12 @@ var ImageEditor = ({
7225
7267
  children: "Free Transform"
7226
7268
  }
7227
7269
  ),
7228
- paintError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
7229
- /* @__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 }) })
7230
7272
  ] }),
7231
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7232
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
7233
- /* @__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)(
7234
7276
  "button",
7235
7277
  {
7236
7278
  type: "button",
@@ -7241,13 +7283,13 @@ var ImageEditor = ({
7241
7283
  },
7242
7284
  t
7243
7285
  )) }),
7244
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
7245
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
7246
- 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" }),
7247
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
7248
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7249
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
7250
- /* @__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)(
7251
7293
  "button",
7252
7294
  {
7253
7295
  type: "button",
@@ -7257,18 +7299,18 @@ var ImageEditor = ({
7257
7299
  },
7258
7300
  t
7259
7301
  )) }),
7260
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
7261
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
7262
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
7263
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex-1 ml-2", children: [
7264
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
7265
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Width:" }),
7266
- /* @__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: [
7267
7309
  strokeWidth,
7268
7310
  "px"
7269
7311
  ] })
7270
7312
  ] }),
7271
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7313
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7272
7314
  "input",
7273
7315
  {
7274
7316
  type: "range",
@@ -7281,10 +7323,10 @@ var ImageEditor = ({
7281
7323
  )
7282
7324
  ] })
7283
7325
  ] }),
7284
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7285
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
7286
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-2", children: [
7287
- /* @__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)(
7288
7330
  "input",
7289
7331
  {
7290
7332
  type: "text",
@@ -7295,7 +7337,7 @@ var ImageEditor = ({
7295
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"
7296
7338
  }
7297
7339
  ),
7298
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7340
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7299
7341
  "button",
7300
7342
  {
7301
7343
  type: "button",
@@ -7305,14 +7347,14 @@ var ImageEditor = ({
7305
7347
  }
7306
7348
  )
7307
7349
  ] }),
7308
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
7309
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Font Size:" }),
7310
- /* @__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: [
7311
7353
  fontSize,
7312
7354
  "px"
7313
7355
  ] })
7314
7356
  ] }),
7315
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7357
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7316
7358
  "input",
7317
7359
  {
7318
7360
  type: "range",
@@ -7323,14 +7365,14 @@ var ImageEditor = ({
7323
7365
  className: imageRangeClass
7324
7366
  }
7325
7367
  ),
7326
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: imageDividerClass }),
7327
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7328
- /* @__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: [
7329
7371
  "Layers (",
7330
7372
  state.annotations.length,
7331
7373
  ")"
7332
7374
  ] }),
7333
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7375
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7334
7376
  "button",
7335
7377
  {
7336
7378
  type: "button",
@@ -7339,7 +7381,7 @@ var ImageEditor = ({
7339
7381
  children: "Delete Selected"
7340
7382
  }
7341
7383
  ),
7342
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7384
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7343
7385
  "button",
7344
7386
  {
7345
7387
  type: "button",
@@ -7350,10 +7392,10 @@ var ImageEditor = ({
7350
7392
  )
7351
7393
  ] })
7352
7394
  ] }),
7353
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
7354
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7355
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
7356
- /* @__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)(
7357
7399
  "button",
7358
7400
  {
7359
7401
  type: "button",
@@ -7363,8 +7405,8 @@ var ImageEditor = ({
7363
7405
  }
7364
7406
  )
7365
7407
  ] }),
7366
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
7367
- /* @__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)(
7368
7410
  "input",
7369
7411
  {
7370
7412
  type: "checkbox",
@@ -7373,12 +7415,12 @@ var ImageEditor = ({
7373
7415
  className: "rounded accent-primary"
7374
7416
  }
7375
7417
  ),
7376
- /* @__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" })
7377
7419
  ] }),
7378
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7379
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7380
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
7381
- /* @__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)(
7382
7424
  "input",
7383
7425
  {
7384
7426
  type: "text",
@@ -7389,8 +7431,8 @@ var ImageEditor = ({
7389
7431
  }
7390
7432
  )
7391
7433
  ] }),
7392
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-2", children: [
7393
- /* @__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)(
7394
7436
  "button",
7395
7437
  {
7396
7438
  type: "button",
@@ -7399,7 +7441,7 @@ var ImageEditor = ({
7399
7441
  children: "Threshold Mode"
7400
7442
  }
7401
7443
  ),
7402
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7444
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7403
7445
  "button",
7404
7446
  {
7405
7447
  type: "button",
@@ -7409,12 +7451,12 @@ var ImageEditor = ({
7409
7451
  }
7410
7452
  )
7411
7453
  ] }),
7412
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7413
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7414
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Depth Start (Lower):" }),
7415
- /* @__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] })
7416
7458
  ] }),
7417
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7459
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7418
7460
  "input",
7419
7461
  {
7420
7462
  type: "range",
@@ -7428,12 +7470,12 @@ var ImageEditor = ({
7428
7470
  }
7429
7471
  )
7430
7472
  ] }),
7431
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7432
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7433
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Depth Stop (Upper):" }),
7434
- /* @__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] })
7435
7477
  ] }),
7436
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7478
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7437
7479
  "input",
7438
7480
  {
7439
7481
  type: "range",
@@ -7447,12 +7489,12 @@ var ImageEditor = ({
7447
7489
  }
7448
7490
  )
7449
7491
  ] }),
7450
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
7451
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
7452
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Softness:" }),
7453
- /* @__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 })
7454
7496
  ] }),
7455
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7497
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7456
7498
  "input",
7457
7499
  {
7458
7500
  type: "range",
@@ -7464,8 +7506,8 @@ var ImageEditor = ({
7464
7506
  }
7465
7507
  )
7466
7508
  ] }),
7467
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
7468
- /* @__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)(
7469
7511
  "input",
7470
7512
  {
7471
7513
  type: "checkbox",
@@ -7474,12 +7516,12 @@ var ImageEditor = ({
7474
7516
  className: "rounded accent-primary"
7475
7517
  }
7476
7518
  ),
7477
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Invert Mask" })
7519
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Invert Mask" })
7478
7520
  ] })
7479
7521
  ] })
7480
7522
  ] }),
7481
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7482
- /* @__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)(
7483
7525
  SelectionOptionsBar,
7484
7526
  {
7485
7527
  controller,
@@ -7490,9 +7532,9 @@ var ImageEditor = ({
7490
7532
  selectionDisplay: state.selectionDisplay
7491
7533
  }
7492
7534
  ),
7493
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
7494
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-1", children: [
7495
- /* @__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)(
7496
7538
  "button",
7497
7539
  {
7498
7540
  type: "button",
@@ -7503,7 +7545,7 @@ var ImageEditor = ({
7503
7545
  children: "Transform Selection"
7504
7546
  }
7505
7547
  ),
7506
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7548
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7507
7549
  "button",
7508
7550
  {
7509
7551
  type: "button",
@@ -7515,14 +7557,14 @@ var ImageEditor = ({
7515
7557
  }
7516
7558
  )
7517
7559
  ] }),
7518
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
7519
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChannelsPanel, { controller }),
7520
- /* @__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 })
7521
7563
  ] }),
7522
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
7523
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
7524
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Results go to" }),
7525
- /* @__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)(
7526
7568
  "select",
7527
7569
  {
7528
7570
  "aria-label": "AI result target",
@@ -7530,54 +7572,54 @@ var ImageEditor = ({
7530
7572
  onChange: (e) => setAiTarget(e.target.value),
7531
7573
  className: imageSelectClass,
7532
7574
  children: [
7533
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
7534
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
7535
- /* @__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" })
7536
7578
  ]
7537
7579
  }
7538
7580
  )
7539
7581
  ] }),
7540
- /* @__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: [
7541
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7542
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7543
- /* @__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" }) }),
7544
7586
  "Background Removal"
7545
7587
  ] }),
7546
- 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..." })
7547
7589
  ] }),
7548
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
7549
- /* @__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)(
7550
7592
  "button",
7551
7593
  {
7552
7594
  type: "button",
7553
7595
  onClick: handleRemoveBackground,
7554
7596
  disabled: isRemovingBg || isInpainting,
7555
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",
7556
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7557
- /* @__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 }),
7558
7600
  "Removing Background..."
7559
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7560
- /* @__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" }) }),
7561
7603
  "Remove Background"
7562
7604
  ] })
7563
7605
  }
7564
7606
  )
7565
7607
  ] }),
7566
- /* @__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: [
7567
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between", children: [
7568
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
7569
- /* @__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: [
7570
- /* @__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" }),
7571
- /* @__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" })
7572
7614
  ] }),
7573
7615
  "Generative Inpainting"
7574
7616
  ] }),
7575
- 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..." })
7576
7618
  ] }),
7577
- /* @__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." }),
7578
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", children: [
7579
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
7580
- /* @__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)(
7581
7623
  "textarea",
7582
7624
  {
7583
7625
  id: "ai-inpaint-prompt-react",
@@ -7589,10 +7631,10 @@ var ImageEditor = ({
7589
7631
  }
7590
7632
  )
7591
7633
  ] }),
7592
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-1", children: [
7593
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
7594
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
7595
- /* @__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)(
7596
7638
  "button",
7597
7639
  {
7598
7640
  type: "button",
@@ -7605,7 +7647,7 @@ var ImageEditor = ({
7605
7647
  ]
7606
7648
  }
7607
7649
  ),
7608
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7650
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7609
7651
  "button",
7610
7652
  {
7611
7653
  type: "button",
@@ -7620,25 +7662,25 @@ var ImageEditor = ({
7620
7662
  )
7621
7663
  ] })
7622
7664
  ] }),
7623
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7665
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7624
7666
  "button",
7625
7667
  {
7626
7668
  type: "button",
7627
7669
  onClick: handleInpaint,
7628
7670
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
7629
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",
7630
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7631
- /* @__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 }),
7632
7674
  "Generating Inpaint..."
7633
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7634
- /* @__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" }) }),
7635
7677
  "Apply Inpainting"
7636
7678
  ] })
7637
7679
  }
7638
7680
  )
7639
7681
  ] }),
7640
- 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 }),
7641
- 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 })
7642
7684
  ] })
7643
7685
  ] })
7644
7686
  ] })
@@ -7674,6 +7716,7 @@ var ImageEditor = ({
7674
7716
  PathsPanel,
7675
7717
  RefineEdgePanel,
7676
7718
  SelectAndMaskWorkspace,
7719
+ SelectionChangeCheck,
7677
7720
  SelectionOptionsBar,
7678
7721
  ShapeOptionsBar,
7679
7722
  TypeOptionsBar,