@pixerate/editor-react 0.146.0 → 0.148.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
190
190
  }
191
191
 
192
192
  // src/image-editor/ImageEditor.tsx
193
- import React21, { useRef as useRef12, useEffect as useEffect17, useState as useState22 } from "react";
193
+ import React23, { useRef as useRef13, useEffect as useEffect17, useState as useState24 } from "react";
194
194
  import {
195
195
  normalizeProcessVersion,
196
196
  LATEST_PROCESS_VERSION,
@@ -3818,7 +3818,7 @@ var SelectionOptionsBar = ({
3818
3818
  };
3819
3819
 
3820
3820
  // src/image-editor/RefineEdgePanel.tsx
3821
- import { useState as useState16 } from "react";
3821
+ import { useState as useState18 } from "react";
3822
3822
  import {
3823
3823
  ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
3824
3824
  REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
@@ -3874,20 +3874,123 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
3874
3874
  ] });
3875
3875
  };
3876
3876
 
3877
- // src/image-editor/RefineEdgePanel.tsx
3877
+ // src/image-editor/SelectionChangeCheck.tsx
3878
+ import { useState as useState16 } from "react";
3878
3879
  import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3879
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3880
3880
  var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3881
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3882
- const [params, setParams] = useState16(DEFAULT_PARAMS);
3883
- const [busy, setBusy] = useState16(false);
3881
+ var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
3882
+ const sel = selection === void 0 ? controller.getSelection() : selection;
3883
+ const [result, setResult] = useState16(null);
3884
3884
  const [error, setError] = useState16(null);
3885
- const [layerId, setLayerId] = useState16("");
3886
- const [newKind, setNewKind] = useState16("hueSaturation");
3887
- const [output, setOutput] = useState16("selection");
3888
- const [decontaminate, setDecontaminate] = useState16(0);
3889
- const [objectAware, setObjectAware] = useState16(false);
3890
- const [onlyUncertain, setOnlyUncertain] = useState16(false);
3885
+ const diff = result && result.for === sel ? result.diff : null;
3886
+ const show = () => {
3887
+ setError(null);
3888
+ try {
3889
+ setResult({ diff: controller.compareSelections(), for: sel });
3890
+ } catch (err) {
3891
+ setResult(null);
3892
+ setError(err instanceof Error ? err.message : String(err));
3893
+ }
3894
+ };
3895
+ return /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
3896
+ /* @__PURE__ */ jsx20("button", { type: "button", className: `${button4} self-start`, onClick: show, children: "Show Last Change" }),
3897
+ diff && /* @__PURE__ */ jsx20("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ jsxs18(Fragment5, { children: [
3898
+ /* @__PURE__ */ jsxs18("span", { className: "text-green-600", children: [
3899
+ "+",
3900
+ diff.added.area,
3901
+ " px"
3902
+ ] }),
3903
+ " ",
3904
+ /* @__PURE__ */ jsxs18("span", { className: "text-destructive", children: [
3905
+ "\u2212",
3906
+ diff.removed.area,
3907
+ " px"
3908
+ ] }),
3909
+ ", overlap ",
3910
+ Math.round(diff.iou * 100),
3911
+ "%"
3912
+ ] }) }),
3913
+ error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
3914
+ ] });
3915
+ };
3916
+
3917
+ // src/image-editor/SeparateSubjectPanel.tsx
3918
+ import { useRef as useRef11, useState as useState17 } from "react";
3919
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3920
+ var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3921
+ var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
3922
+ const sel = selection === void 0 ? controller.getSelection() : selection;
3923
+ const [dilate, setDilate] = useState17(8);
3924
+ const [fill, setFill] = useState17(true);
3925
+ const [progress, setProgress] = useState17(null);
3926
+ const [error, setError] = useState17(null);
3927
+ const abort = useRef11(null);
3928
+ const run = async () => {
3929
+ setError(null);
3930
+ abort.current = new AbortController();
3931
+ setProgress("Starting");
3932
+ try {
3933
+ await controller.separateSubject({
3934
+ dilate,
3935
+ fill: fill ? "content-aware" : "none",
3936
+ signal: abort.current.signal,
3937
+ onProgress: (fraction, stage) => setProgress(`${stage ?? "Filling"} ${Math.round(fraction * 100)}%`)
3938
+ });
3939
+ } catch (err) {
3940
+ if (!abort.current.signal.aborted) setError(err instanceof Error ? err.message : String(err));
3941
+ } finally {
3942
+ abort.current = null;
3943
+ setProgress(null);
3944
+ }
3945
+ };
3946
+ return /* @__PURE__ */ jsxs19("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
3947
+ /* @__PURE__ */ jsx21("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
3948
+ /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
3949
+ /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", children: [
3950
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3951
+ "Grow",
3952
+ /* @__PURE__ */ jsx21(
3953
+ "input",
3954
+ {
3955
+ type: "number",
3956
+ min: 0,
3957
+ max: 200,
3958
+ "aria-label": "Separate grow",
3959
+ value: dilate,
3960
+ onChange: (e) => setDilate(Math.min(200, Math.max(0, Number(e.target.value) || 0))),
3961
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
3962
+ }
3963
+ ),
3964
+ "px"
3965
+ ] }),
3966
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1 text-foreground", children: [
3967
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
3968
+ "Fill the background"
3969
+ ] })
3970
+ ] }),
3971
+ /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", children: [
3972
+ /* @__PURE__ */ jsx21("button", { type: "button", className: button5, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
3973
+ progress !== null && /* @__PURE__ */ jsx21("button", { type: "button", className: button5, onClick: () => abort.current?.abort(), children: "Cancel" })
3974
+ ] }),
3975
+ progress !== null && /* @__PURE__ */ jsx21("p", { role: "status", className: "text-muted-foreground", children: progress }),
3976
+ error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
3977
+ ] });
3978
+ };
3979
+
3980
+ // src/image-editor/RefineEdgePanel.tsx
3981
+ import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
3982
+ var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3983
+ var button6 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3984
+ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3985
+ const [params, setParams] = useState18(DEFAULT_PARAMS);
3986
+ const [busy, setBusy] = useState18(false);
3987
+ const [error, setError] = useState18(null);
3988
+ const [layerId, setLayerId] = useState18("");
3989
+ const [newKind, setNewKind] = useState18("hueSaturation");
3990
+ const [output, setOutput] = useState18("selection");
3991
+ const [decontaminate, setDecontaminate] = useState18(0);
3992
+ const [objectAware, setObjectAware] = useState18(false);
3993
+ const [onlyUncertain, setOnlyUncertain] = useState18(false);
3891
3994
  const canObject = Boolean(controller.segmentationProvider);
3892
3995
  const toLayer = output !== "selection" && output !== "layer-mask";
3893
3996
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -3910,17 +4013,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3910
4013
  setBusy(false);
3911
4014
  }
3912
4015
  };
3913
- return /* @__PURE__ */ jsxs18("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3914
- /* @__PURE__ */ jsx20("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
3915
- REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3916
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3917
- /* @__PURE__ */ jsx20("span", { children: c.label }),
3918
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4016
+ return /* @__PURE__ */ jsxs20("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4017
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4018
+ REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4019
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4020
+ /* @__PURE__ */ jsx22("span", { children: c.label }),
4021
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
3919
4022
  params[c.id],
3920
4023
  c.unit
3921
4024
  ] })
3922
4025
  ] }),
3923
- /* @__PURE__ */ jsx20(
4026
+ /* @__PURE__ */ jsx22(
3924
4027
  "input",
3925
4028
  {
3926
4029
  type: "range",
@@ -3934,43 +4037,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3934
4037
  }
3935
4038
  )
3936
4039
  ] }, c.id)),
3937
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3938
- /* @__PURE__ */ jsx20("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4040
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4041
+ /* @__PURE__ */ jsx22("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3939
4042
  "Smart Radius"
3940
4043
  ] }),
3941
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
3942
- /* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
4044
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
4045
+ /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
3943
4046
  "Only uncertain areas"
3944
4047
  ] }),
3945
- canObject && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3946
- /* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
4048
+ canObject && /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-foreground", children: [
4049
+ /* @__PURE__ */ jsx22("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
3947
4050
  "Object aware (segmentation model)"
3948
4051
  ] }),
3949
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
4052
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3950
4053
  "Output to",
3951
- /* @__PURE__ */ jsx20(
4054
+ /* @__PURE__ */ jsx22(
3952
4055
  "select",
3953
4056
  {
3954
4057
  "aria-label": "Refine output",
3955
4058
  value: output,
3956
4059
  onChange: (e) => setOutput(e.target.value),
3957
4060
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3958
- children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx20("option", { value: o.id, children: o.label }, o.id))
4061
+ children: REFINE_OUTPUTS2.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ jsx22("option", { value: o.id, children: o.label }, o.id))
3959
4062
  }
3960
4063
  )
3961
4064
  ] }),
3962
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
3963
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
3964
- /* @__PURE__ */ jsxs18("span", { children: [
4065
+ /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4066
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4067
+ /* @__PURE__ */ jsxs20("span", { children: [
3965
4068
  "Decontaminate colors",
3966
4069
  toLayer ? "" : " (new layer or document outputs)"
3967
4070
  ] }),
3968
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4071
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
3969
4072
  decontaminate,
3970
4073
  "%"
3971
4074
  ] })
3972
4075
  ] }),
3973
- /* @__PURE__ */ jsx20(
4076
+ /* @__PURE__ */ jsx22(
3974
4077
  "input",
3975
4078
  {
3976
4079
  type: "range",
@@ -3985,64 +4088,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3985
4088
  }
3986
4089
  )
3987
4090
  ] }),
3988
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-1", children: [
3989
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3990
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4091
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
4092
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4093
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
3991
4094
  ] }),
3992
- error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error }),
3993
- /* @__PURE__ */ jsx20(MaskEdgeCheck, { controller, selection: sel }),
3994
- /* @__PURE__ */ jsx20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
3995
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-1 items-center", children: [
3996
- /* @__PURE__ */ jsx20(
4095
+ error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error }),
4096
+ /* @__PURE__ */ jsx22(MaskEdgeCheck, { controller, selection: sel }),
4097
+ /* @__PURE__ */ jsx22(SelectionChangeCheck, { controller, selection: sel }),
4098
+ /* @__PURE__ */ jsx22(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
4099
+ /* @__PURE__ */ jsx22("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4100
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-1 items-center", children: [
4101
+ /* @__PURE__ */ jsx22(
3997
4102
  "select",
3998
4103
  {
3999
4104
  "aria-label": "New masked layer kind",
4000
4105
  value: newKind,
4001
4106
  onChange: (e) => setNewKind(e.target.value),
4002
4107
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4003
- children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx20("option", { value: k.kind, children: k.label }, k.kind))
4108
+ children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx22("option", { value: k.kind, children: k.label }, k.kind))
4004
4109
  }
4005
4110
  ),
4006
- /* @__PURE__ */ jsx20(
4111
+ /* @__PURE__ */ jsx22(
4007
4112
  "button",
4008
4113
  {
4009
4114
  type: "button",
4010
- className: button4,
4115
+ className: button6,
4011
4116
  disabled: !sel,
4012
4117
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
4013
4118
  children: "New Masked Layer"
4014
4119
  }
4015
4120
  )
4016
4121
  ] }),
4017
- list.length > 0 && target && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
4018
- /* @__PURE__ */ jsx20(
4122
+ list.length > 0 && target && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-2", children: [
4123
+ /* @__PURE__ */ jsx22(
4019
4124
  "select",
4020
4125
  {
4021
4126
  "aria-label": "Mask layer",
4022
4127
  value: target.id,
4023
4128
  onChange: (e) => setLayerId(e.target.value),
4024
4129
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4025
- children: list.map((l) => /* @__PURE__ */ jsxs18("option", { value: l.id, children: [
4130
+ children: list.map((l) => /* @__PURE__ */ jsxs20("option", { value: l.id, children: [
4026
4131
  l.name || adjustmentKindLabel2(l.kind),
4027
4132
  l.mask ? " (masked)" : ""
4028
4133
  ] }, l.id))
4029
4134
  }
4030
4135
  ),
4031
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap gap-1", children: [
4032
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4033
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4034
- /* @__PURE__ */ jsx20("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4136
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4137
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4138
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4139
+ /* @__PURE__ */ jsx22("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4035
4140
  ] }),
4036
- target.mask && /* @__PURE__ */ jsxs18(Fragment5, { children: [
4037
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
4038
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
4039
- /* @__PURE__ */ jsx20("span", { children: "Density" }),
4040
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4141
+ target.mask && /* @__PURE__ */ jsxs20(Fragment6, { children: [
4142
+ /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4143
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4144
+ /* @__PURE__ */ jsx22("span", { children: "Density" }),
4145
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4041
4146
  Math.round((target.mask.density ?? 1) * 100),
4042
4147
  "%"
4043
4148
  ] })
4044
4149
  ] }),
4045
- /* @__PURE__ */ jsx20(
4150
+ /* @__PURE__ */ jsx22(
4046
4151
  "input",
4047
4152
  {
4048
4153
  type: "range",
@@ -4056,15 +4161,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4056
4161
  }
4057
4162
  )
4058
4163
  ] }),
4059
- /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
4060
- /* @__PURE__ */ jsxs18("span", { className: "flex justify-between text-muted-foreground", children: [
4061
- /* @__PURE__ */ jsx20("span", { children: "Mask Feather" }),
4062
- /* @__PURE__ */ jsxs18("span", { className: "font-mono", children: [
4164
+ /* @__PURE__ */ jsxs20("label", { className: "flex flex-col gap-1", children: [
4165
+ /* @__PURE__ */ jsxs20("span", { className: "flex justify-between text-muted-foreground", children: [
4166
+ /* @__PURE__ */ jsx22("span", { children: "Mask Feather" }),
4167
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4063
4168
  target.mask.feather ?? 0,
4064
4169
  "px"
4065
4170
  ] })
4066
4171
  ] }),
4067
- /* @__PURE__ */ jsx20(
4172
+ /* @__PURE__ */ jsx22(
4068
4173
  "input",
4069
4174
  {
4070
4175
  type: "range",
@@ -4084,12 +4189,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4084
4189
  };
4085
4190
 
4086
4191
  // src/image-editor/ChannelsPanel.tsx
4087
- import { useEffect as useEffect12, useRef as useRef11, useState as useState17 } from "react";
4192
+ import { useEffect as useEffect12, useRef as useRef12, useState as useState19 } from "react";
4088
4193
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
4089
- import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4194
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4090
4195
  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"}`;
4091
4196
  var ChannelThumb = ({ channel, size }) => {
4092
- const ref = useRef11(null);
4197
+ const ref = useRef12(null);
4093
4198
  useEffect12(() => {
4094
4199
  const canvas = ref.current;
4095
4200
  const ctx = canvas?.getContext("2d");
@@ -4101,15 +4206,15 @@ var ChannelThumb = ({ channel, size }) => {
4101
4206
  img.data.set(px.data);
4102
4207
  ctx.putImageData(img, 0, 0);
4103
4208
  }, [channel.mask]);
4104
- return /* @__PURE__ */ jsx21("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4209
+ return /* @__PURE__ */ jsx23("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
4105
4210
  };
4106
4211
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4107
- const [, setTick] = useState17(0);
4212
+ const [, setTick] = useState19(0);
4108
4213
  useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4109
- const [activeId, setActiveId] = useState17(null);
4110
- const [renaming, setRenaming] = useState17(null);
4111
- const [error, setError] = useState17(null);
4112
- const fileInput = useRef11(null);
4214
+ const [activeId, setActiveId] = useState19(null);
4215
+ const [renaming, setRenaming] = useState19(null);
4216
+ const [error, setError] = useState19(null);
4217
+ const fileInput = useRef12(null);
4113
4218
  const channels = controller.getChannels();
4114
4219
  const active = channels.find((c) => c.id === activeId) ?? null;
4115
4220
  const hasSelection = Boolean(controller.getSelection());
@@ -4131,13 +4236,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4131
4236
  setError(err instanceof Error ? err.message : String(err));
4132
4237
  }
4133
4238
  };
4134
- return /* @__PURE__ */ jsxs19("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4135
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4136
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Channels" }),
4137
- /* @__PURE__ */ jsx21("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" })
4239
+ return /* @__PURE__ */ jsxs21("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
4240
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
4241
+ /* @__PURE__ */ jsx23("span", { className: imageSectionTitleClass, children: "Channels" }),
4242
+ /* @__PURE__ */ jsx23("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
4138
4243
  ] }),
4139
- channels.length === 0 && /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4140
- /* @__PURE__ */ jsx21("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs19(
4244
+ channels.length === 0 && /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
4245
+ /* @__PURE__ */ jsx23("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs21(
4141
4246
  "li",
4142
4247
  {
4143
4248
  "data-testid": "channel-row",
@@ -4149,7 +4254,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4149
4254
  },
4150
4255
  onDoubleClick: () => setRenaming(c.id),
4151
4256
  children: [
4152
- /* @__PURE__ */ jsx21(
4257
+ /* @__PURE__ */ jsx23(
4153
4258
  "button",
4154
4259
  {
4155
4260
  type: "button",
@@ -4163,8 +4268,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4163
4268
  children: c.visible ? "\u25CF" : "\u25CB"
4164
4269
  }
4165
4270
  ),
4166
- /* @__PURE__ */ jsx21(ChannelThumb, { channel: c, size: thumbnailSize }),
4167
- renaming === c.id ? /* @__PURE__ */ jsx21(
4271
+ /* @__PURE__ */ jsx23(ChannelThumb, { channel: c, size: thumbnailSize }),
4272
+ renaming === c.id ? /* @__PURE__ */ jsx23(
4168
4273
  "input",
4169
4274
  {
4170
4275
  autoFocus: true,
@@ -4181,16 +4286,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4181
4286
  if (e.key === "Escape") setRenaming(null);
4182
4287
  }
4183
4288
  }
4184
- ) : /* @__PURE__ */ jsx21("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4289
+ ) : /* @__PURE__ */ jsx23("span", { className: "min-w-0 flex-1 truncate", children: c.name })
4185
4290
  ]
4186
4291
  },
4187
4292
  c.id
4188
4293
  )) }),
4189
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-1", children: [
4190
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4191
- /* @__PURE__ */ jsx21("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" }),
4192
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4193
- /* @__PURE__ */ jsx21(
4294
+ /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1", children: [
4295
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
4296
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
4297
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
4298
+ /* @__PURE__ */ jsx23(
4194
4299
  "button",
4195
4300
  {
4196
4301
  type: "button",
@@ -4203,8 +4308,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4203
4308
  children: "Delete"
4204
4309
  }
4205
4310
  ),
4206
- /* @__PURE__ */ jsx21("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4207
- /* @__PURE__ */ jsx21(
4311
+ /* @__PURE__ */ jsx23("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
4312
+ /* @__PURE__ */ jsx23(
4208
4313
  "button",
4209
4314
  {
4210
4315
  type: "button",
@@ -4215,7 +4320,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4215
4320
  children: "Export PNG"
4216
4321
  }
4217
4322
  ),
4218
- /* @__PURE__ */ jsx21(
4323
+ /* @__PURE__ */ jsx23(
4219
4324
  "input",
4220
4325
  {
4221
4326
  ref: fileInput,
@@ -4230,22 +4335,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4230
4335
  }
4231
4336
  )
4232
4337
  ] }),
4233
- error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
4338
+ error && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-destructive", children: error })
4234
4339
  ] });
4235
4340
  };
4236
4341
 
4237
4342
  // src/image-editor/PathsPanel.tsx
4238
- import { useEffect as useEffect13, useState as useState18 } from "react";
4343
+ import { useEffect as useEffect13, useState as useState20 } from "react";
4239
4344
  import { pathSvgData, selectionModeFromModifiers as selectionModeFromModifiers2 } from "@pixerate/editor/image-editor";
4240
- import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4345
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4241
4346
  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"}`;
4242
4347
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4243
- const [, setTick] = useState18(0);
4348
+ const [, setTick] = useState20(0);
4244
4349
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4245
- const [renaming, setRenaming] = useState18(null);
4246
- const [color, setColor] = useState18("#000000");
4247
- const [width, setWidth] = useState18(2);
4248
- const [error, setError] = useState18(null);
4350
+ const [renaming, setRenaming] = useState20(null);
4351
+ const [color, setColor] = useState20("#000000");
4352
+ const [width, setWidth] = useState20(2);
4353
+ const [error, setError] = useState20(null);
4249
4354
  const paths = controller.getPaths();
4250
4355
  const activeId = controller.getState().activePathId ?? null;
4251
4356
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -4261,10 +4366,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4261
4366
  };
4262
4367
  return (
4263
4368
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
4264
- /* @__PURE__ */ jsxs20("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: [
4265
- /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Paths" }),
4266
- paths.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4267
- /* @__PURE__ */ jsx22("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__ */ jsxs20(
4369
+ /* @__PURE__ */ jsxs22("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
4370
+ /* @__PURE__ */ jsx24("span", { className: imageSectionTitleClass, children: "Paths" }),
4371
+ paths.length === 0 && /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
4372
+ /* @__PURE__ */ jsx24("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ jsxs22(
4268
4373
  "li",
4269
4374
  {
4270
4375
  "data-testid": "path-row",
@@ -4273,8 +4378,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4273
4378
  onClick: () => attempt(() => controller.setActivePath(p.id)),
4274
4379
  onDoubleClick: () => setRenaming(p.id),
4275
4380
  children: [
4276
- /* @__PURE__ */ jsx22("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__ */ jsx22("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4277
- renaming === p.id ? /* @__PURE__ */ jsx22(
4381
+ /* @__PURE__ */ jsx24("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ jsx24("path", { d: pathSvgData(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
4382
+ renaming === p.id ? /* @__PURE__ */ jsx24(
4278
4383
  "input",
4279
4384
  {
4280
4385
  autoFocus: true,
@@ -4293,13 +4398,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4293
4398
  if (e.key === "Escape") setRenaming(null);
4294
4399
  }
4295
4400
  }
4296
- ) : /* @__PURE__ */ jsx22("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4401
+ ) : /* @__PURE__ */ jsx24("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
4297
4402
  ]
4298
4403
  },
4299
4404
  p.id
4300
4405
  )) }),
4301
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4302
- /* @__PURE__ */ jsx22(
4406
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4407
+ /* @__PURE__ */ jsx24(
4303
4408
  "button",
4304
4409
  {
4305
4410
  type: "button",
@@ -4310,15 +4415,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4310
4415
  children: "Load as Selection"
4311
4416
  }
4312
4417
  ),
4313
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4314
- active?.work && /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4315
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4418
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
4419
+ active?.work && /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
4420
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
4316
4421
  ] }),
4317
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-1", children: [
4318
- /* @__PURE__ */ jsx22("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" }),
4319
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4320
- /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4321
- /* @__PURE__ */ jsx22(
4422
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-1", children: [
4423
+ /* @__PURE__ */ jsx24("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
4424
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
4425
+ /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4426
+ /* @__PURE__ */ jsx24(
4322
4427
  "input",
4323
4428
  {
4324
4429
  type: "number",
@@ -4333,24 +4438,24 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
4333
4438
  ),
4334
4439
  "px"
4335
4440
  ] }),
4336
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4441
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
4337
4442
  ] }),
4338
- /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap gap-1", children: [
4339
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4340
- /* @__PURE__ */ jsx22("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4443
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap gap-1", children: [
4444
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
4445
+ /* @__PURE__ */ jsx24("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
4341
4446
  ] }),
4342
- error && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: error })
4447
+ error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4343
4448
  ] })
4344
4449
  );
4345
4450
  };
4346
4451
 
4347
4452
  // src/image-editor/FreeTransformOptionsBar.tsx
4348
- import { useEffect as useEffect14, useState as useState19 } from "react";
4453
+ import { useEffect as useEffect14, useState as useState21 } from "react";
4349
4454
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
4350
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4455
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4351
4456
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4352
4457
  var FreeTransformOptionsBar = ({ tool, className }) => {
4353
- const [, setTick] = useState19(0);
4458
+ const [, setTick] = useState21(0);
4354
4459
  useEffect14(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4355
4460
  const bar = tool.bar();
4356
4461
  if (!tool.active || !bar) return null;
@@ -4363,17 +4468,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4363
4468
  const v = Number(raw);
4364
4469
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4365
4470
  };
4366
- return /* @__PURE__ */ jsxs21("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: [
4367
- /* @__PURE__ */ jsx23("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx23("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)) }),
4368
- /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx23("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)) }),
4369
- tool.mode === "warp" && /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4370
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4371
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Warp" }),
4372
- /* @__PURE__ */ jsx23("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx23("option", { value: o.id, children: o.label }, o.id)) })
4471
+ return /* @__PURE__ */ jsxs23("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4472
+ /* @__PURE__ */ jsx25("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx25("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4473
+ /* @__PURE__ */ jsx25("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4474
+ tool.mode === "warp" && /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4475
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4476
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Warp" }),
4477
+ /* @__PURE__ */ jsx25("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx25("option", { value: o.id, children: o.label }, o.id)) })
4373
4478
  ] }),
4374
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4375
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4376
- /* @__PURE__ */ jsx23(
4479
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4480
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4481
+ /* @__PURE__ */ jsx25(
4377
4482
  "input",
4378
4483
  {
4379
4484
  type: "number",
@@ -4394,9 +4499,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4394
4499
  },
4395
4500
  `${k}:${warp[k]}`
4396
4501
  ),
4397
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "%" })
4502
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "%" })
4398
4503
  ] }, k)),
4399
- /* @__PURE__ */ jsx23(
4504
+ /* @__PURE__ */ jsx25(
4400
4505
  "button",
4401
4506
  {
4402
4507
  type: "button",
@@ -4408,9 +4513,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4408
4513
  children: "Vertical"
4409
4514
  }
4410
4515
  ),
4411
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4412
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Grid" }),
4413
- /* @__PURE__ */ jsx23(
4516
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4517
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Grid" }),
4518
+ /* @__PURE__ */ jsx25(
4414
4519
  "select",
4415
4520
  {
4416
4521
  "aria-label": "Warp grid",
@@ -4420,14 +4525,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4420
4525
  tool.setWarp({ columns: g.columns, rows: g.rows });
4421
4526
  },
4422
4527
  className: imageFieldClass,
4423
- children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx23("option", { value: g.id, children: g.label }, g.id))
4528
+ children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx25("option", { value: g.id, children: g.label }, g.id))
4424
4529
  }
4425
4530
  )
4426
4531
  ] })
4427
4532
  ] }),
4428
- tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", title: f.title, children: [
4429
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.label }),
4430
- /* @__PURE__ */ jsx23(
4533
+ tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", title: f.title, children: [
4534
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.label }),
4535
+ /* @__PURE__ */ jsx25(
4431
4536
  "input",
4432
4537
  {
4433
4538
  type: "number",
@@ -4447,8 +4552,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4447
4552
  },
4448
4553
  `${f.id}:${round(bar[f.id], f.unit)}`
4449
4554
  ),
4450
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: f.unit }),
4451
- f.id === "scaleX" && /* @__PURE__ */ jsx23(
4555
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: f.unit }),
4556
+ f.id === "scaleX" && /* @__PURE__ */ jsx25(
4452
4557
  "button",
4453
4558
  {
4454
4559
  type: "button",
@@ -4463,33 +4568,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4463
4568
  }
4464
4569
  )
4465
4570
  ] }, f.id)),
4466
- /* @__PURE__ */ jsxs21("label", { className: "flex items-center gap-1", children: [
4467
- /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "Interpolation" }),
4468
- /* @__PURE__ */ jsx23(
4571
+ /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4572
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "Interpolation" }),
4573
+ /* @__PURE__ */ jsx25(
4469
4574
  "select",
4470
4575
  {
4471
4576
  "aria-label": "Interpolation",
4472
4577
  value: tool.interpolation,
4473
4578
  onChange: (e) => tool.setInterpolation(e.target.value),
4474
4579
  className: imageFieldClass,
4475
- children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx23("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4580
+ children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx25("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4476
4581
  }
4477
4582
  )
4478
4583
  ] }),
4479
- /* @__PURE__ */ jsx23("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" }),
4480
- /* @__PURE__ */ jsx23("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4481
- tool.error && /* @__PURE__ */ jsx23("span", { role: "alert", className: "text-destructive", children: tool.error })
4584
+ /* @__PURE__ */ jsx25("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4585
+ /* @__PURE__ */ jsx25("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4586
+ tool.error && /* @__PURE__ */ jsx25("span", { role: "alert", className: "text-destructive", children: tool.error })
4482
4587
  ] });
4483
4588
  };
4484
4589
 
4485
4590
  // src/image-editor/ShapeOptionsBar.tsx
4486
- import { useEffect as useEffect15, useState as useState20 } from "react";
4591
+ import { useEffect as useEffect15, useState as useState22 } from "react";
4487
4592
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4488
- import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4593
+ import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4489
4594
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4490
- const [, setTick] = useState20(0);
4595
+ const [, setTick] = useState22(0);
4491
4596
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4492
- const [error, setError] = useState20(null);
4597
+ const [error, setError] = useState22(null);
4493
4598
  const active = controller.getActiveLayer();
4494
4599
  const shapeId = active?.type === "shape" ? active.id : null;
4495
4600
  const set = (change) => {
@@ -4503,22 +4608,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4503
4608
  }
4504
4609
  };
4505
4610
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4506
- return /* @__PURE__ */ jsxs22("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4507
- /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx24("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4508
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
4509
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4510
- /* @__PURE__ */ jsx24(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4611
+ return /* @__PURE__ */ jsxs24("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4612
+ /* @__PURE__ */ jsx26("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx26("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4613
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4614
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4615
+ /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4511
4616
  "Fill",
4512
- /* @__PURE__ */ jsx24(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4617
+ /* @__PURE__ */ jsx26(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4513
4618
  ] }),
4514
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4515
- /* @__PURE__ */ jsx24(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4619
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4620
+ /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4516
4621
  "Stroke",
4517
- /* @__PURE__ */ jsx24(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4622
+ /* @__PURE__ */ jsx26(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4518
4623
  ] }),
4519
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4624
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4520
4625
  "Width",
4521
- /* @__PURE__ */ jsx24(
4626
+ /* @__PURE__ */ jsx26(
4522
4627
  "input",
4523
4628
  {
4524
4629
  type: "number",
@@ -4532,52 +4637,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4532
4637
  )
4533
4638
  ] })
4534
4639
  ] }),
4535
- /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center gap-3", children: [
4536
- options.kind === "rect" && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4640
+ /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-3", children: [
4641
+ options.kind === "rect" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4537
4642
  "Radius",
4538
- /* @__PURE__ */ jsx24("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}` })
4643
+ /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4539
4644
  ] }),
4540
- options.kind === "polygon" && /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4645
+ options.kind === "polygon" && /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4541
4646
  "Sides",
4542
- /* @__PURE__ */ jsx24("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}` })
4647
+ /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4543
4648
  ] }),
4544
- options.kind === "star" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4545
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4649
+ options.kind === "star" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4650
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4546
4651
  "Points",
4547
- /* @__PURE__ */ jsx24("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}` })
4652
+ /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4548
4653
  ] }),
4549
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4654
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4550
4655
  "Inner",
4551
- /* @__PURE__ */ jsx24(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4656
+ /* @__PURE__ */ jsx26(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4552
4657
  ] })
4553
4658
  ] }),
4554
- options.kind === "line" && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4555
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4659
+ options.kind === "line" && /* @__PURE__ */ jsxs24(Fragment7, { children: [
4660
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4556
4661
  "Weight",
4557
- /* @__PURE__ */ jsx24("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}` })
4662
+ /* @__PURE__ */ jsx26("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4558
4663
  ] }),
4559
- /* @__PURE__ */ jsxs22("label", { className: "flex items-center gap-1", children: [
4560
- /* @__PURE__ */ jsx24(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4664
+ /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-1", children: [
4665
+ /* @__PURE__ */ jsx26(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4561
4666
  "Arrowhead"
4562
4667
  ] })
4563
4668
  ] })
4564
4669
  ] }),
4565
- /* @__PURE__ */ jsx24("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." }),
4566
- error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: error })
4670
+ /* @__PURE__ */ jsx26("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4671
+ error && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: error })
4567
4672
  ] });
4568
4673
  };
4569
4674
 
4570
4675
  // src/image-editor/TypeOptionsBar.tsx
4571
- import { useEffect as useEffect16, useState as useState21 } from "react";
4676
+ import { useEffect as useEffect16, useState as useState23 } from "react";
4572
4677
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
4573
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4678
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
4574
4679
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4575
4680
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
4576
4681
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4577
- const [, setTick] = useState21(0);
4682
+ const [, setTick] = useState23(0);
4578
4683
  useEffect16(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4579
4684
  useEffect16(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4580
- const [error, setError] = useState21(null);
4685
+ const [error, setError] = useState23(null);
4581
4686
  const active = controller.getActiveLayer();
4582
4687
  const typeId = !session && active?.type === "type" ? active.id : null;
4583
4688
  const here = session?.alive ? session.styleHere() : {};
@@ -4630,11 +4735,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4630
4735
  setError(e instanceof Error ? e.message : String(e));
4631
4736
  }
4632
4737
  };
4633
- return /* @__PURE__ */ jsxs23("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4634
- /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2", children: [
4635
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4738
+ return /* @__PURE__ */ jsxs25("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4739
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", children: [
4740
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4636
4741
  "Font",
4637
- /* @__PURE__ */ jsx25(
4742
+ /* @__PURE__ */ jsx27(
4638
4743
  "input",
4639
4744
  {
4640
4745
  list: "pixerate-type-fonts",
@@ -4644,11 +4749,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4644
4749
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4645
4750
  }
4646
4751
  ),
4647
- /* @__PURE__ */ jsx25("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx25("option", { value: f }, f)) })
4752
+ /* @__PURE__ */ jsx27("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx27("option", { value: f }, f)) })
4648
4753
  ] }),
4649
- /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-1", children: [
4754
+ /* @__PURE__ */ jsxs25("label", { className: "flex items-center gap-1", children: [
4650
4755
  "Size",
4651
- /* @__PURE__ */ jsx25(
4756
+ /* @__PURE__ */ jsx27(
4652
4757
  "input",
4653
4758
  {
4654
4759
  type: "number",
@@ -4661,14 +4766,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4661
4766
  }
4662
4767
  )
4663
4768
  ] }),
4664
- /* @__PURE__ */ jsx25("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" }),
4665
- /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4666
- /* @__PURE__ */ jsx25(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4769
+ /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4770
+ /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4771
+ /* @__PURE__ */ jsx27(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4667
4772
  ] }),
4668
- /* @__PURE__ */ jsx25("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4669
- /* @__PURE__ */ jsxs23("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4670
- TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx25("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4671
- orientation === "vertical" && editedId && /* @__PURE__ */ jsx25(
4773
+ /* @__PURE__ */ jsx27("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4774
+ /* @__PURE__ */ jsxs25("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4775
+ TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx27("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4776
+ orientation === "vertical" && editedId && /* @__PURE__ */ jsx27(
4672
4777
  "button",
4673
4778
  {
4674
4779
  type: "button",
@@ -4680,19 +4785,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4680
4785
  }
4681
4786
  )
4682
4787
  ] }),
4683
- /* @__PURE__ */ jsx25("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." }),
4684
- missing.length > 0 && /* @__PURE__ */ jsxs23("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4788
+ /* @__PURE__ */ jsx27("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4789
+ missing.length > 0 && /* @__PURE__ */ jsxs25("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4685
4790
  "Missing ",
4686
4791
  missing.length === 1 ? "font" : "fonts",
4687
4792
  ": ",
4688
4793
  missing.join(", ")
4689
4794
  ] }),
4690
- error && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-destructive", children: error })
4795
+ error && /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-destructive", children: error })
4691
4796
  ] });
4692
4797
  };
4693
4798
 
4694
4799
  // src/image-editor/ImageEditor.tsx
4695
- import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
4800
+ import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4696
4801
  var ImageEditor = ({
4697
4802
  editor: externalEditor,
4698
4803
  src,
@@ -4717,32 +4822,32 @@ var ImageEditor = ({
4717
4822
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
4718
4823
  });
4719
4824
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
4720
- const [activeTab, setActiveTab] = useState22("crop");
4721
- const rootRef = useRef12(null);
4825
+ const [activeTab, setActiveTab] = useState24("crop");
4826
+ const rootRef = useRef13(null);
4722
4827
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4723
- const activeTabRef = useRef12(activeTab);
4828
+ const activeTabRef = useRef13(activeTab);
4724
4829
  activeTabRef.current = activeTab;
4725
4830
  const openPanel = async (ref) => {
4726
4831
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
4727
4832
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4728
4833
  await new Promise((resolve) => setTimeout(resolve, 60));
4729
4834
  };
4730
- const [activeCropRatio, setActiveCropRatio] = useState22(null);
4731
- const [selectionOptions, setSelectionOptions] = useState22(DEFAULT_SELECTION_TOOL_OPTIONS2);
4732
- const [shapeOptions, setShapeOptions] = useState22(DEFAULT_SHAPE_TOOL_OPTIONS2);
4733
- const [typeOptions, setTypeOptions] = useState22(DEFAULT_TYPE_TOOL_OPTIONS2);
4734
- const [typeSession, setTypeSession] = useState22(null);
4735
- const [selectionError, setSelectionError] = useState22(null);
4736
- const [paintError, setPaintError] = useState22(null);
4737
- const [shapeTypeError, setShapeTypeError] = useState22(null);
4835
+ const [activeCropRatio, setActiveCropRatio] = useState24(null);
4836
+ const [selectionOptions, setSelectionOptions] = useState24(DEFAULT_SELECTION_TOOL_OPTIONS2);
4837
+ const [shapeOptions, setShapeOptions] = useState24(DEFAULT_SHAPE_TOOL_OPTIONS2);
4838
+ const [typeOptions, setTypeOptions] = useState24(DEFAULT_TYPE_TOOL_OPTIONS2);
4839
+ const [typeSession, setTypeSession] = useState24(null);
4840
+ const [selectionError, setSelectionError] = useState24(null);
4841
+ const [paintError, setPaintError] = useState24(null);
4842
+ const [shapeTypeError, setShapeTypeError] = useState24(null);
4738
4843
  const handleCanvasError = (source, message) => {
4739
4844
  if (source === "paint") setPaintError(message);
4740
4845
  else if (source === "select") setSelectionError(message);
4741
4846
  else setShapeTypeError(message);
4742
4847
  };
4743
4848
  const finishTyping = () => setTypeSession(null);
4744
- const transformToolRef = useRef12(null);
4745
- const transformControllerRef = useRef12(controller);
4849
+ const transformToolRef = useRef13(null);
4850
+ const transformControllerRef = useRef13(controller);
4746
4851
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
4747
4852
  transformToolRef.current?.cancel();
4748
4853
  transformToolRef.current = new FreeTransformTool2(controller, {
@@ -4751,16 +4856,16 @@ var ImageEditor = ({
4751
4856
  transformControllerRef.current = controller;
4752
4857
  }
4753
4858
  const transformTool = transformToolRef.current;
4754
- const [, setTransformTick] = useState22(0);
4859
+ const [, setTransformTick] = useState24(0);
4755
4860
  useEffect17(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4756
4861
  useEffect17(() => () => transformToolRef.current?.cancel(), []);
4757
- const [inpaintPrompt, setInpaintPrompt] = useState22("");
4758
- const [inpaintMaskMode, setInpaintMaskMode] = useState22("annotations");
4759
- const [isRemovingBg, setIsRemovingBg] = useState22(false);
4760
- const [isInpainting, setIsInpainting] = useState22(false);
4761
- const [aiError, setAiError] = useState22(null);
4762
- const [aiSuccess, setAiSuccess] = useState22(null);
4763
- const [aiTarget, setAiTarget] = useState22("auto");
4862
+ const [inpaintPrompt, setInpaintPrompt] = useState24("");
4863
+ const [inpaintMaskMode, setInpaintMaskMode] = useState24("annotations");
4864
+ const [isRemovingBg, setIsRemovingBg] = useState24(false);
4865
+ const [isInpainting, setIsInpainting] = useState24(false);
4866
+ const [aiError, setAiError] = useState24(null);
4867
+ const [aiSuccess, setAiSuccess] = useState24(null);
4868
+ const [aiTarget, setAiTarget] = useState24("auto");
4764
4869
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4765
4870
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4766
4871
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -4823,10 +4928,10 @@ var ImageEditor = ({
4823
4928
  setIsInpainting(false);
4824
4929
  }
4825
4930
  };
4826
- const [activeColor, setActiveColor] = useState22("#ef4444");
4827
- const [strokeWidth, setStrokeWidth] = useState22(3);
4828
- const [fontSize, setFontSize] = useState22(24);
4829
- const [textInput, setTextInput] = useState22("");
4931
+ const [activeColor, setActiveColor] = useState24("#ef4444");
4932
+ const [strokeWidth, setStrokeWidth] = useState24(3);
4933
+ const [fontSize, setFontSize] = useState24(24);
4934
+ const [textInput, setTextInput] = useState24("");
4830
4935
  useEffect17(() => {
4831
4936
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4832
4937
  editor.setTool("crop");
@@ -4855,16 +4960,16 @@ var ImageEditor = ({
4855
4960
  link.click();
4856
4961
  }
4857
4962
  };
4858
- return /* @__PURE__ */ jsxs24(
4963
+ return /* @__PURE__ */ jsxs26(
4859
4964
  "div",
4860
4965
  {
4861
4966
  ref: rootRef,
4862
4967
  className: `${imageEditorFrameClass} ${className}`,
4863
4968
  style,
4864
4969
  children: [
4865
- /* @__PURE__ */ jsxs24("div", { className: imageEditorHeaderClass, children: [
4866
- /* @__PURE__ */ jsxs24("div", { role: "tablist", className: imageTabListClass, children: [
4867
- /* @__PURE__ */ jsx26(
4970
+ /* @__PURE__ */ jsxs26("div", { className: imageEditorHeaderClass, children: [
4971
+ /* @__PURE__ */ jsxs26("div", { role: "tablist", className: imageTabListClass, children: [
4972
+ /* @__PURE__ */ jsx28(
4868
4973
  "button",
4869
4974
  {
4870
4975
  type: "button",
@@ -4879,7 +4984,7 @@ var ImageEditor = ({
4879
4984
  children: "Transform & Crop"
4880
4985
  }
4881
4986
  ),
4882
- /* @__PURE__ */ jsx26(
4987
+ /* @__PURE__ */ jsx28(
4883
4988
  "button",
4884
4989
  {
4885
4990
  type: "button",
@@ -4894,7 +4999,7 @@ var ImageEditor = ({
4894
4999
  children: "Adjustments"
4895
5000
  }
4896
5001
  ),
4897
- /* @__PURE__ */ jsx26(
5002
+ /* @__PURE__ */ jsx28(
4898
5003
  "button",
4899
5004
  {
4900
5005
  type: "button",
@@ -4909,7 +5014,7 @@ var ImageEditor = ({
4909
5014
  children: "Layers"
4910
5015
  }
4911
5016
  ),
4912
- /* @__PURE__ */ jsx26(
5017
+ /* @__PURE__ */ jsx28(
4913
5018
  "button",
4914
5019
  {
4915
5020
  type: "button",
@@ -4924,7 +5029,7 @@ var ImageEditor = ({
4924
5029
  children: "Paint"
4925
5030
  }
4926
5031
  ),
4927
- /* @__PURE__ */ jsx26(
5032
+ /* @__PURE__ */ jsx28(
4928
5033
  "button",
4929
5034
  {
4930
5035
  type: "button",
@@ -4939,7 +5044,7 @@ var ImageEditor = ({
4939
5044
  children: "Select & Mask"
4940
5045
  }
4941
5046
  ),
4942
- /* @__PURE__ */ jsx26(
5047
+ /* @__PURE__ */ jsx28(
4943
5048
  "button",
4944
5049
  {
4945
5050
  type: "button",
@@ -4954,7 +5059,7 @@ var ImageEditor = ({
4954
5059
  children: "Annotations"
4955
5060
  }
4956
5061
  ),
4957
- /* @__PURE__ */ jsx26(
5062
+ /* @__PURE__ */ jsx28(
4958
5063
  "button",
4959
5064
  {
4960
5065
  type: "button",
@@ -4969,7 +5074,7 @@ var ImageEditor = ({
4969
5074
  children: "Depth Mask"
4970
5075
  }
4971
5076
  ),
4972
- /* @__PURE__ */ jsxs24(
5077
+ /* @__PURE__ */ jsxs26(
4973
5078
  "button",
4974
5079
  {
4975
5080
  type: "button",
@@ -4982,14 +5087,14 @@ var ImageEditor = ({
4982
5087
  "aria-selected": activeTab === "ai",
4983
5088
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
4984
5089
  children: [
4985
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5090
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
4986
5091
  "AI Tools"
4987
5092
  ]
4988
5093
  }
4989
5094
  )
4990
5095
  ] }),
4991
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 text-xs", children: [
4992
- /* @__PURE__ */ jsx26(
5096
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 text-xs", children: [
5097
+ /* @__PURE__ */ jsx28(
4993
5098
  "button",
4994
5099
  {
4995
5100
  type: "button",
@@ -5000,7 +5105,7 @@ var ImageEditor = ({
5000
5105
  children: "\u21A9"
5001
5106
  }
5002
5107
  ),
5003
- /* @__PURE__ */ jsx26(
5108
+ /* @__PURE__ */ jsx28(
5004
5109
  "button",
5005
5110
  {
5006
5111
  type: "button",
@@ -5011,7 +5116,7 @@ var ImageEditor = ({
5011
5116
  children: "\u21AA"
5012
5117
  }
5013
5118
  ),
5014
- /* @__PURE__ */ jsx26(
5119
+ /* @__PURE__ */ jsx28(
5015
5120
  "button",
5016
5121
  {
5017
5122
  type: "button",
@@ -5020,8 +5125,8 @@ var ImageEditor = ({
5020
5125
  children: "Reset"
5021
5126
  }
5022
5127
  ),
5023
- /* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
5024
- /* @__PURE__ */ jsx26(
5128
+ /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5129
+ /* @__PURE__ */ jsx28(
5025
5130
  "button",
5026
5131
  {
5027
5132
  type: "button",
@@ -5031,11 +5136,11 @@ var ImageEditor = ({
5031
5136
  children: "-"
5032
5137
  }
5033
5138
  ),
5034
- /* @__PURE__ */ jsxs24("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5139
+ /* @__PURE__ */ jsxs26("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5035
5140
  Math.round(state.zoom * 100),
5036
5141
  "%"
5037
5142
  ] }),
5038
- /* @__PURE__ */ jsx26(
5143
+ /* @__PURE__ */ jsx28(
5039
5144
  "button",
5040
5145
  {
5041
5146
  type: "button",
@@ -5045,8 +5150,8 @@ var ImageEditor = ({
5045
5150
  children: "+"
5046
5151
  }
5047
5152
  ),
5048
- /* @__PURE__ */ jsx26("div", { className: "h-4 w-px bg-muted mx-1" }),
5049
- /* @__PURE__ */ jsx26(
5153
+ /* @__PURE__ */ jsx28("div", { className: "h-4 w-px bg-muted mx-1" }),
5154
+ /* @__PURE__ */ jsx28(
5050
5155
  "button",
5051
5156
  {
5052
5157
  type: "button",
@@ -5057,7 +5162,7 @@ var ImageEditor = ({
5057
5162
  children: "Hold Compare"
5058
5163
  }
5059
5164
  ),
5060
- /* @__PURE__ */ jsx26(
5165
+ /* @__PURE__ */ jsx28(
5061
5166
  "button",
5062
5167
  {
5063
5168
  type: "button",
@@ -5068,10 +5173,10 @@ var ImageEditor = ({
5068
5173
  )
5069
5174
  ] })
5070
5175
  ] }),
5071
- transformTool.active && /* @__PURE__ */ jsx26(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5072
- !transformTool.active && transformTool.error && /* @__PURE__ */ jsx26("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5073
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5074
- /* @__PURE__ */ jsx26(
5176
+ transformTool.active && /* @__PURE__ */ jsx28(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5177
+ !transformTool.active && transformTool.error && /* @__PURE__ */ jsx28("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5178
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5179
+ /* @__PURE__ */ jsx28(
5075
5180
  ImageEditorCanvas,
5076
5181
  {
5077
5182
  editor,
@@ -5095,11 +5200,11 @@ var ImageEditor = ({
5095
5200
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5096
5201
  }
5097
5202
  ),
5098
- /* @__PURE__ */ jsxs24("div", { className: imageSidebarClass, children: [
5099
- activeTab === "crop" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5100
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5101
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-3 gap-2", children: [
5102
- /* @__PURE__ */ jsx26(
5203
+ /* @__PURE__ */ jsxs26("div", { className: imageSidebarClass, children: [
5204
+ activeTab === "crop" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5205
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5206
+ /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-3 gap-2", children: [
5207
+ /* @__PURE__ */ jsx28(
5103
5208
  "button",
5104
5209
  {
5105
5210
  type: "button",
@@ -5111,7 +5216,7 @@ var ImageEditor = ({
5111
5216
  children: "Freeform"
5112
5217
  }
5113
5218
  ),
5114
- /* @__PURE__ */ jsx26(
5219
+ /* @__PURE__ */ jsx28(
5115
5220
  "button",
5116
5221
  {
5117
5222
  type: "button",
@@ -5123,7 +5228,7 @@ var ImageEditor = ({
5123
5228
  children: "1:1 Square"
5124
5229
  }
5125
5230
  ),
5126
- /* @__PURE__ */ jsx26(
5231
+ /* @__PURE__ */ jsx28(
5127
5232
  "button",
5128
5233
  {
5129
5234
  type: "button",
@@ -5135,7 +5240,7 @@ var ImageEditor = ({
5135
5240
  children: "4:3 Standard"
5136
5241
  }
5137
5242
  ),
5138
- /* @__PURE__ */ jsx26(
5243
+ /* @__PURE__ */ jsx28(
5139
5244
  "button",
5140
5245
  {
5141
5246
  type: "button",
@@ -5147,7 +5252,7 @@ var ImageEditor = ({
5147
5252
  children: "16:9 Wide"
5148
5253
  }
5149
5254
  ),
5150
- /* @__PURE__ */ jsx26(
5255
+ /* @__PURE__ */ jsx28(
5151
5256
  "button",
5152
5257
  {
5153
5258
  type: "button",
@@ -5159,7 +5264,7 @@ var ImageEditor = ({
5159
5264
  children: "3:2 Photo"
5160
5265
  }
5161
5266
  ),
5162
- /* @__PURE__ */ jsx26(
5267
+ /* @__PURE__ */ jsx28(
5163
5268
  "button",
5164
5269
  {
5165
5270
  type: "button",
@@ -5172,10 +5277,10 @@ var ImageEditor = ({
5172
5277
  }
5173
5278
  )
5174
5279
  ] }),
5175
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5176
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5177
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-2", children: [
5178
- /* @__PURE__ */ jsx26(
5280
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5281
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5282
+ /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-2", children: [
5283
+ /* @__PURE__ */ jsx28(
5179
5284
  "button",
5180
5285
  {
5181
5286
  type: "button",
@@ -5184,7 +5289,7 @@ var ImageEditor = ({
5184
5289
  children: "Rotate -90\xB0"
5185
5290
  }
5186
5291
  ),
5187
- /* @__PURE__ */ jsx26(
5292
+ /* @__PURE__ */ jsx28(
5188
5293
  "button",
5189
5294
  {
5190
5295
  type: "button",
@@ -5193,7 +5298,7 @@ var ImageEditor = ({
5193
5298
  children: "Rotate +90\xB0"
5194
5299
  }
5195
5300
  ),
5196
- /* @__PURE__ */ jsx26(
5301
+ /* @__PURE__ */ jsx28(
5197
5302
  "button",
5198
5303
  {
5199
5304
  type: "button",
@@ -5202,7 +5307,7 @@ var ImageEditor = ({
5202
5307
  children: "Flip Horizontal"
5203
5308
  }
5204
5309
  ),
5205
- /* @__PURE__ */ jsx26(
5310
+ /* @__PURE__ */ jsx28(
5206
5311
  "button",
5207
5312
  {
5208
5313
  type: "button",
@@ -5213,10 +5318,10 @@ var ImageEditor = ({
5213
5318
  )
5214
5319
  ] })
5215
5320
  ] }),
5216
- activeTab === "adjust" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5217
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5218
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5219
- /* @__PURE__ */ jsx26(
5321
+ activeTab === "adjust" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5322
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5323
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5324
+ /* @__PURE__ */ jsx28(
5220
5325
  "button",
5221
5326
  {
5222
5327
  type: "button",
@@ -5226,9 +5331,9 @@ var ImageEditor = ({
5226
5331
  }
5227
5332
  )
5228
5333
  ] }),
5229
- /* @__PURE__ */ jsx26(Histogram, { histogram: editor.histogram }),
5230
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs24(React21.Fragment, { children: [
5231
- /* @__PURE__ */ jsx26(
5334
+ /* @__PURE__ */ jsx28(Histogram, { histogram: editor.histogram }),
5335
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs26(React23.Fragment, { children: [
5336
+ /* @__PURE__ */ jsx28(
5232
5337
  ControlSlider,
5233
5338
  {
5234
5339
  spec,
@@ -5237,14 +5342,14 @@ var ImageEditor = ({
5237
5342
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5238
5343
  }
5239
5344
  ),
5240
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs24(
5345
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs26(
5241
5346
  "div",
5242
5347
  {
5243
5348
  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",
5244
5349
  "data-testid": "image-editor-process-notice",
5245
5350
  children: [
5246
- /* @__PURE__ */ jsx26("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5247
- /* @__PURE__ */ jsx26(
5351
+ /* @__PURE__ */ jsx28("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5352
+ /* @__PURE__ */ jsx28(
5248
5353
  "button",
5249
5354
  {
5250
5355
  type: "button",
@@ -5257,7 +5362,7 @@ var ImageEditor = ({
5257
5362
  }
5258
5363
  )
5259
5364
  ] }, spec.id)),
5260
- /* @__PURE__ */ jsx26("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx26(
5365
+ /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(
5261
5366
  AdjustmentLayersPanel,
5262
5367
  {
5263
5368
  controller,
@@ -5266,9 +5371,9 @@ var ImageEditor = ({
5266
5371
  }
5267
5372
  ) })
5268
5373
  ] }),
5269
- activeTab === "layers" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5270
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Layers" }),
5271
- /* @__PURE__ */ jsx26(
5374
+ activeTab === "layers" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5375
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Layers" }),
5376
+ /* @__PURE__ */ jsx28(
5272
5377
  "button",
5273
5378
  {
5274
5379
  type: "button",
@@ -5279,15 +5384,15 @@ var ImageEditor = ({
5279
5384
  children: "Free Transform"
5280
5385
  }
5281
5386
  ),
5282
- /* @__PURE__ */ jsx26(LayersPanel, { controller }),
5283
- effectsShown && /* @__PURE__ */ jsx26(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5284
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Colour" }),
5285
- /* @__PURE__ */ jsx26(ColorProfilePanel, { controller })
5387
+ /* @__PURE__ */ jsx28(LayersPanel, { controller }),
5388
+ effectsShown && /* @__PURE__ */ jsx28(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5389
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Colour" }),
5390
+ /* @__PURE__ */ jsx28(ColorProfilePanel, { controller })
5286
5391
  ] }),
5287
- activeTab === "paint" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5288
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Paint" }),
5289
- /* @__PURE__ */ jsx26(BrushOptionsBar, { controller }),
5290
- /* @__PURE__ */ jsx26(
5392
+ activeTab === "paint" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5393
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Paint" }),
5394
+ /* @__PURE__ */ jsx28(BrushOptionsBar, { controller }),
5395
+ /* @__PURE__ */ jsx28(
5291
5396
  "button",
5292
5397
  {
5293
5398
  type: "button",
@@ -5298,12 +5403,12 @@ var ImageEditor = ({
5298
5403
  children: "Free Transform"
5299
5404
  }
5300
5405
  ),
5301
- paintError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5302
- /* @__PURE__ */ jsx26("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx26(LayersPanel, { controller }) })
5406
+ paintError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5407
+ /* @__PURE__ */ jsx28("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx28(LayersPanel, { controller }) })
5303
5408
  ] }),
5304
- activeTab === "annotate" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5305
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5306
- /* @__PURE__ */ jsx26("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx26(
5409
+ activeTab === "annotate" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5410
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
5411
+ /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ jsx28(
5307
5412
  "button",
5308
5413
  {
5309
5414
  type: "button",
@@ -5314,13 +5419,13 @@ var ImageEditor = ({
5314
5419
  },
5315
5420
  t
5316
5421
  )) }),
5317
- state.activeTool === "shape" && /* @__PURE__ */ jsx26(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5318
- state.activeTool === "type" && /* @__PURE__ */ jsx26(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5319
- state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx26("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" }),
5320
- shapeTypeError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5321
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5322
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5323
- /* @__PURE__ */ jsx26("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx26(
5422
+ state.activeTool === "shape" && /* @__PURE__ */ jsx28(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5423
+ state.activeTool === "type" && /* @__PURE__ */ jsx28(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5424
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx28("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5425
+ shapeTypeError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5426
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5427
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5428
+ /* @__PURE__ */ jsx28("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx28(
5324
5429
  "button",
5325
5430
  {
5326
5431
  type: "button",
@@ -5330,18 +5435,18 @@ var ImageEditor = ({
5330
5435
  },
5331
5436
  t
5332
5437
  )) }),
5333
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 mt-2", children: [
5334
- /* @__PURE__ */ jsx26("label", { className: "text-muted-foreground", children: "Color:" }),
5335
- /* @__PURE__ */ jsx26(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5336
- /* @__PURE__ */ jsxs24("div", { className: "flex-1 ml-2", children: [
5337
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5338
- /* @__PURE__ */ jsx26("span", { children: "Width:" }),
5339
- /* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
5438
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 mt-2", children: [
5439
+ /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground", children: "Color:" }),
5440
+ /* @__PURE__ */ jsx28(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5441
+ /* @__PURE__ */ jsxs26("div", { className: "flex-1 ml-2", children: [
5442
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5443
+ /* @__PURE__ */ jsx28("span", { children: "Width:" }),
5444
+ /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5340
5445
  strokeWidth,
5341
5446
  "px"
5342
5447
  ] })
5343
5448
  ] }),
5344
- /* @__PURE__ */ jsx26(
5449
+ /* @__PURE__ */ jsx28(
5345
5450
  "input",
5346
5451
  {
5347
5452
  type: "range",
@@ -5354,10 +5459,10 @@ var ImageEditor = ({
5354
5459
  )
5355
5460
  ] })
5356
5461
  ] }),
5357
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5358
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Add Text" }),
5359
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
5360
- /* @__PURE__ */ jsx26(
5462
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5463
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Add Text" }),
5464
+ /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5465
+ /* @__PURE__ */ jsx28(
5361
5466
  "input",
5362
5467
  {
5363
5468
  type: "text",
@@ -5368,7 +5473,7 @@ var ImageEditor = ({
5368
5473
  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"
5369
5474
  }
5370
5475
  ),
5371
- /* @__PURE__ */ jsx26(
5476
+ /* @__PURE__ */ jsx28(
5372
5477
  "button",
5373
5478
  {
5374
5479
  type: "button",
@@ -5378,14 +5483,14 @@ var ImageEditor = ({
5378
5483
  }
5379
5484
  )
5380
5485
  ] }),
5381
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5382
- /* @__PURE__ */ jsx26("span", { children: "Font Size:" }),
5383
- /* @__PURE__ */ jsxs24("span", { className: "font-mono", children: [
5486
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5487
+ /* @__PURE__ */ jsx28("span", { children: "Font Size:" }),
5488
+ /* @__PURE__ */ jsxs26("span", { className: "font-mono", children: [
5384
5489
  fontSize,
5385
5490
  "px"
5386
5491
  ] })
5387
5492
  ] }),
5388
- /* @__PURE__ */ jsx26(
5493
+ /* @__PURE__ */ jsx28(
5389
5494
  "input",
5390
5495
  {
5391
5496
  type: "range",
@@ -5396,14 +5501,14 @@ var ImageEditor = ({
5396
5501
  className: imageRangeClass
5397
5502
  }
5398
5503
  ),
5399
- /* @__PURE__ */ jsx26("div", { className: imageDividerClass }),
5400
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5401
- /* @__PURE__ */ jsxs24("span", { className: "text-muted-foreground", children: [
5504
+ /* @__PURE__ */ jsx28("div", { className: imageDividerClass }),
5505
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5506
+ /* @__PURE__ */ jsxs26("span", { className: "text-muted-foreground", children: [
5402
5507
  "Layers (",
5403
5508
  state.annotations.length,
5404
5509
  ")"
5405
5510
  ] }),
5406
- state.selectedAnnotationId && /* @__PURE__ */ jsx26(
5511
+ state.selectedAnnotationId && /* @__PURE__ */ jsx28(
5407
5512
  "button",
5408
5513
  {
5409
5514
  type: "button",
@@ -5412,7 +5517,7 @@ var ImageEditor = ({
5412
5517
  children: "Delete Selected"
5413
5518
  }
5414
5519
  ),
5415
- state.annotations.length > 0 && /* @__PURE__ */ jsx26(
5520
+ state.annotations.length > 0 && /* @__PURE__ */ jsx28(
5416
5521
  "button",
5417
5522
  {
5418
5523
  type: "button",
@@ -5423,10 +5528,10 @@ var ImageEditor = ({
5423
5528
  )
5424
5529
  ] })
5425
5530
  ] }),
5426
- activeTab === "depth" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-3 text-xs", children: [
5427
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5428
- /* @__PURE__ */ jsx26("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5429
- /* @__PURE__ */ jsx26(
5531
+ activeTab === "depth" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3 text-xs", children: [
5532
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5533
+ /* @__PURE__ */ jsx28("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5534
+ /* @__PURE__ */ jsx28(
5430
5535
  "button",
5431
5536
  {
5432
5537
  type: "button",
@@ -5436,8 +5541,8 @@ var ImageEditor = ({
5436
5541
  }
5437
5542
  )
5438
5543
  ] }),
5439
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5440
- /* @__PURE__ */ jsx26(
5544
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5545
+ /* @__PURE__ */ jsx28(
5441
5546
  "input",
5442
5547
  {
5443
5548
  type: "checkbox",
@@ -5446,12 +5551,12 @@ var ImageEditor = ({
5446
5551
  className: "rounded accent-primary"
5447
5552
  }
5448
5553
  ),
5449
- /* @__PURE__ */ jsx26("span", { children: "Enable Depth / Alpha Mask" })
5554
+ /* @__PURE__ */ jsx28("span", { children: "Enable Depth / Alpha Mask" })
5450
5555
  ] }),
5451
- state.depthMask.enabled && /* @__PURE__ */ jsxs24(Fragment7, { children: [
5452
- /* @__PURE__ */ jsxs24("div", { children: [
5453
- /* @__PURE__ */ jsx26("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5454
- /* @__PURE__ */ jsx26(
5556
+ state.depthMask.enabled && /* @__PURE__ */ jsxs26(Fragment8, { children: [
5557
+ /* @__PURE__ */ jsxs26("div", { children: [
5558
+ /* @__PURE__ */ jsx28("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5559
+ /* @__PURE__ */ jsx28(
5455
5560
  "input",
5456
5561
  {
5457
5562
  type: "text",
@@ -5462,8 +5567,8 @@ var ImageEditor = ({
5462
5567
  }
5463
5568
  )
5464
5569
  ] }),
5465
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
5466
- /* @__PURE__ */ jsx26(
5570
+ /* @__PURE__ */ jsxs26("div", { className: "flex gap-2", children: [
5571
+ /* @__PURE__ */ jsx28(
5467
5572
  "button",
5468
5573
  {
5469
5574
  type: "button",
@@ -5472,7 +5577,7 @@ var ImageEditor = ({
5472
5577
  children: "Threshold Mode"
5473
5578
  }
5474
5579
  ),
5475
- /* @__PURE__ */ jsx26(
5580
+ /* @__PURE__ */ jsx28(
5476
5581
  "button",
5477
5582
  {
5478
5583
  type: "button",
@@ -5482,12 +5587,12 @@ var ImageEditor = ({
5482
5587
  }
5483
5588
  )
5484
5589
  ] }),
5485
- /* @__PURE__ */ jsxs24("div", { children: [
5486
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5487
- /* @__PURE__ */ jsx26("span", { children: "Depth Start (Lower):" }),
5488
- /* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5590
+ /* @__PURE__ */ jsxs26("div", { children: [
5591
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5592
+ /* @__PURE__ */ jsx28("span", { children: "Depth Start (Lower):" }),
5593
+ /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5489
5594
  ] }),
5490
- /* @__PURE__ */ jsx26(
5595
+ /* @__PURE__ */ jsx28(
5491
5596
  "input",
5492
5597
  {
5493
5598
  type: "range",
@@ -5501,12 +5606,12 @@ var ImageEditor = ({
5501
5606
  }
5502
5607
  )
5503
5608
  ] }),
5504
- /* @__PURE__ */ jsxs24("div", { children: [
5505
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5506
- /* @__PURE__ */ jsx26("span", { children: "Depth Stop (Upper):" }),
5507
- /* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5609
+ /* @__PURE__ */ jsxs26("div", { children: [
5610
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5611
+ /* @__PURE__ */ jsx28("span", { children: "Depth Stop (Upper):" }),
5612
+ /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5508
5613
  ] }),
5509
- /* @__PURE__ */ jsx26(
5614
+ /* @__PURE__ */ jsx28(
5510
5615
  "input",
5511
5616
  {
5512
5617
  type: "range",
@@ -5520,12 +5625,12 @@ var ImageEditor = ({
5520
5625
  }
5521
5626
  )
5522
5627
  ] }),
5523
- /* @__PURE__ */ jsxs24("div", { children: [
5524
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5525
- /* @__PURE__ */ jsx26("span", { children: "Softness:" }),
5526
- /* @__PURE__ */ jsx26("span", { className: "font-mono", children: state.depthMask.softness })
5628
+ /* @__PURE__ */ jsxs26("div", { children: [
5629
+ /* @__PURE__ */ jsxs26("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5630
+ /* @__PURE__ */ jsx28("span", { children: "Softness:" }),
5631
+ /* @__PURE__ */ jsx28("span", { className: "font-mono", children: state.depthMask.softness })
5527
5632
  ] }),
5528
- /* @__PURE__ */ jsx26(
5633
+ /* @__PURE__ */ jsx28(
5529
5634
  "input",
5530
5635
  {
5531
5636
  type: "range",
@@ -5537,8 +5642,8 @@ var ImageEditor = ({
5537
5642
  }
5538
5643
  )
5539
5644
  ] }),
5540
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5541
- /* @__PURE__ */ jsx26(
5645
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5646
+ /* @__PURE__ */ jsx28(
5542
5647
  "input",
5543
5648
  {
5544
5649
  type: "checkbox",
@@ -5547,12 +5652,12 @@ var ImageEditor = ({
5547
5652
  className: "rounded accent-primary"
5548
5653
  }
5549
5654
  ),
5550
- /* @__PURE__ */ jsx26("span", { children: "Invert Mask" })
5655
+ /* @__PURE__ */ jsx28("span", { children: "Invert Mask" })
5551
5656
  ] })
5552
5657
  ] })
5553
5658
  ] }),
5554
- activeTab === "select" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5555
- /* @__PURE__ */ jsx26(
5659
+ activeTab === "select" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5660
+ /* @__PURE__ */ jsx28(
5556
5661
  SelectionOptionsBar,
5557
5662
  {
5558
5663
  controller,
@@ -5563,9 +5668,9 @@ var ImageEditor = ({
5563
5668
  selectionDisplay: state.selectionDisplay
5564
5669
  }
5565
5670
  ),
5566
- selectionError && /* @__PURE__ */ jsx26("p", { role: "alert", className: "text-destructive", children: selectionError }),
5567
- /* @__PURE__ */ jsxs24("div", { className: "flex gap-1", children: [
5568
- /* @__PURE__ */ jsx26(
5671
+ selectionError && /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-destructive", children: selectionError }),
5672
+ /* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
5673
+ /* @__PURE__ */ jsx28(
5569
5674
  "button",
5570
5675
  {
5571
5676
  type: "button",
@@ -5576,7 +5681,7 @@ var ImageEditor = ({
5576
5681
  children: "Transform Selection"
5577
5682
  }
5578
5683
  ),
5579
- /* @__PURE__ */ jsx26(
5684
+ /* @__PURE__ */ jsx28(
5580
5685
  "button",
5581
5686
  {
5582
5687
  type: "button",
@@ -5588,14 +5693,14 @@ var ImageEditor = ({
5588
5693
  }
5589
5694
  )
5590
5695
  ] }),
5591
- /* @__PURE__ */ jsx26(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5592
- /* @__PURE__ */ jsx26(ChannelsPanel, { controller }),
5593
- /* @__PURE__ */ jsx26(PathsPanel, { controller })
5696
+ /* @__PURE__ */ jsx28(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5697
+ /* @__PURE__ */ jsx28(ChannelsPanel, { controller }),
5698
+ /* @__PURE__ */ jsx28(PathsPanel, { controller })
5594
5699
  ] }),
5595
- activeTab === "ai" && /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-4 text-xs", children: [
5596
- /* @__PURE__ */ jsxs24("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5597
- /* @__PURE__ */ jsx26("span", { children: "Results go to" }),
5598
- /* @__PURE__ */ jsxs24(
5700
+ activeTab === "ai" && /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4 text-xs", children: [
5701
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5702
+ /* @__PURE__ */ jsx28("span", { children: "Results go to" }),
5703
+ /* @__PURE__ */ jsxs26(
5599
5704
  "select",
5600
5705
  {
5601
5706
  "aria-label": "AI result target",
@@ -5603,54 +5708,54 @@ var ImageEditor = ({
5603
5708
  onChange: (e) => setAiTarget(e.target.value),
5604
5709
  className: imageSelectClass,
5605
5710
  children: [
5606
- /* @__PURE__ */ jsx26("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5607
- /* @__PURE__ */ jsx26("option", { value: "new-layer", children: "New layer / mask" }),
5608
- /* @__PURE__ */ jsx26("option", { value: "replace", children: "Replace image" })
5711
+ /* @__PURE__ */ jsx28("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5712
+ /* @__PURE__ */ jsx28("option", { value: "new-layer", children: "New layer / mask" }),
5713
+ /* @__PURE__ */ jsx28("option", { value: "replace", children: "Replace image" })
5609
5714
  ]
5610
5715
  }
5611
5716
  )
5612
5717
  ] }),
5613
- /* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5614
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5615
- /* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5616
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5718
+ /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5719
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5720
+ /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5721
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5617
5722
  "Background Removal"
5618
5723
  ] }),
5619
- isRemovingBg && /* @__PURE__ */ jsx26("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..." })
5724
+ isRemovingBg && /* @__PURE__ */ jsx28("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5620
5725
  ] }),
5621
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5622
- /* @__PURE__ */ jsx26(
5726
+ /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5727
+ /* @__PURE__ */ jsx28(
5623
5728
  "button",
5624
5729
  {
5625
5730
  type: "button",
5626
5731
  onClick: handleRemoveBackground,
5627
5732
  disabled: isRemovingBg || isInpainting,
5628
5733
  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",
5629
- children: isRemovingBg ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
5630
- /* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
5734
+ children: isRemovingBg ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5735
+ /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5631
5736
  "Removing Background..."
5632
- ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
5633
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5737
+ ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5738
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5634
5739
  "Remove Background"
5635
5740
  ] })
5636
5741
  }
5637
5742
  )
5638
5743
  ] }),
5639
- /* @__PURE__ */ jsxs24("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5640
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
5641
- /* @__PURE__ */ jsxs24("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5642
- /* @__PURE__ */ jsxs24("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5643
- /* @__PURE__ */ jsx26("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" }),
5644
- /* @__PURE__ */ jsx26("path", { d: "m14 7 3 3" })
5744
+ /* @__PURE__ */ jsxs26("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5745
+ /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
5746
+ /* @__PURE__ */ jsxs26("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5747
+ /* @__PURE__ */ jsxs26("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5748
+ /* @__PURE__ */ jsx28("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5749
+ /* @__PURE__ */ jsx28("path", { d: "m14 7 3 3" })
5645
5750
  ] }),
5646
5751
  "Generative Inpainting"
5647
5752
  ] }),
5648
- isInpainting && /* @__PURE__ */ jsx26("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..." })
5753
+ isInpainting && /* @__PURE__ */ jsx28("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5649
5754
  ] }),
5650
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5651
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
5652
- /* @__PURE__ */ jsx26("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5653
- /* @__PURE__ */ jsx26(
5755
+ /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5756
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5757
+ /* @__PURE__ */ jsx28("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5758
+ /* @__PURE__ */ jsx28(
5654
5759
  "textarea",
5655
5760
  {
5656
5761
  id: "ai-inpaint-prompt-react",
@@ -5662,10 +5767,10 @@ var ImageEditor = ({
5662
5767
  }
5663
5768
  )
5664
5769
  ] }),
5665
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
5666
- /* @__PURE__ */ jsx26("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5667
- /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-1.5", children: [
5668
- /* @__PURE__ */ jsxs24(
5770
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1", children: [
5771
+ /* @__PURE__ */ jsx28("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5772
+ /* @__PURE__ */ jsxs26("div", { className: "grid grid-cols-2 gap-1.5", children: [
5773
+ /* @__PURE__ */ jsxs26(
5669
5774
  "button",
5670
5775
  {
5671
5776
  type: "button",
@@ -5678,7 +5783,7 @@ var ImageEditor = ({
5678
5783
  ]
5679
5784
  }
5680
5785
  ),
5681
- /* @__PURE__ */ jsxs24(
5786
+ /* @__PURE__ */ jsxs26(
5682
5787
  "button",
5683
5788
  {
5684
5789
  type: "button",
@@ -5693,25 +5798,25 @@ var ImageEditor = ({
5693
5798
  )
5694
5799
  ] })
5695
5800
  ] }),
5696
- /* @__PURE__ */ jsx26(
5801
+ /* @__PURE__ */ jsx28(
5697
5802
  "button",
5698
5803
  {
5699
5804
  type: "button",
5700
5805
  onClick: handleInpaint,
5701
5806
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5702
5807
  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",
5703
- children: isInpainting ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
5704
- /* @__PURE__ */ jsx26("div", { className: imageSpinnerClass }),
5808
+ children: isInpainting ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5809
+ /* @__PURE__ */ jsx28("div", { className: imageSpinnerClass }),
5705
5810
  "Generating Inpaint..."
5706
- ] }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
5707
- /* @__PURE__ */ jsx26("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx26("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" }) }),
5811
+ ] }) : /* @__PURE__ */ jsxs26(Fragment8, { children: [
5812
+ /* @__PURE__ */ jsx28("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx28("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5708
5813
  "Apply Inpainting"
5709
5814
  ] })
5710
5815
  }
5711
5816
  )
5712
5817
  ] }),
5713
- aiError && /* @__PURE__ */ jsx26("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5714
- aiSuccess && /* @__PURE__ */ jsx26("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5818
+ aiError && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5819
+ aiSuccess && /* @__PURE__ */ jsx28("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5715
5820
  ] })
5716
5821
  ] })
5717
5822
  ] })
@@ -5747,6 +5852,8 @@ export {
5747
5852
  ContentAwareFillWorkspace,
5748
5853
  SelectionOptionsBar,
5749
5854
  MaskEdgeCheck,
5855
+ SelectionChangeCheck,
5856
+ SeparateSubjectPanel,
5750
5857
  RefineEdgePanel,
5751
5858
  ChannelsPanel,
5752
5859
  PathsPanel,