@pixerate/editor-react 0.112.1 → 0.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,10 +38,14 @@ __export(image_editor_exports, {
38
38
  CurvesEditor: () => CurvesEditor,
39
39
  FreeTransformOptionsBar: () => FreeTransformOptionsBar,
40
40
  Histogram: () => Histogram,
41
+ ImageCheckbox: () => ImageCheckbox,
41
42
  ImageEditor: () => ImageEditor,
42
43
  ImageEditorCanvas: () => ImageEditorCanvas,
44
+ ImageEditorControlsProvider: () => ImageEditorControlsProvider,
43
45
  ImageEffectControls: () => ImageEffectControls,
44
46
  ImageProviderEffectsPanel: () => ImageProviderEffectsPanel,
47
+ ImageRange: () => ImageRange,
48
+ ImageSelect: () => ImageSelect,
45
49
  LayerEffectsPanel: () => LayerEffectsPanel,
46
50
  LayersPanel: () => LayersPanel,
47
51
  PaintGradientEditor: () => PaintGradientEditor,
@@ -50,6 +54,7 @@ __export(image_editor_exports, {
50
54
  ShapeOptionsBar: () => ShapeOptionsBar,
51
55
  TypeOptionsBar: () => TypeOptionsBar,
52
56
  useImageEditor: () => useImageEditor,
57
+ useImageEditorControls: () => useImageEditorControls,
53
58
  useImageEffectsTools: () => useImageEffectsTools,
54
59
  useImageHistogram: () => useImageHistogram
55
60
  });
@@ -224,7 +229,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
224
229
  }
225
230
 
226
231
  // src/image-editor/ImageEditor.tsx
227
- var import_react28 = __toESM(require("react"), 1);
232
+ var import_react29 = __toESM(require("react"), 1);
228
233
  var import_image_editor19 = require("@pixerate/editor/image-editor");
229
234
 
230
235
  // src/image-editor/ImageEditorCanvas.tsx
@@ -484,6 +489,7 @@ var ImageEditorCanvas = ({
484
489
  viewportWidth: viewport.width,
485
490
  viewportHeight: viewport.height,
486
491
  pixelRatio: viewport.pixelRatio,
492
+ hostScale: viewport.hostScale,
487
493
  fit,
488
494
  showCropOverlay: mode === "crop",
489
495
  showSelectionOverlay: true,
@@ -1051,37 +1057,109 @@ var ImageEditorCanvas = ({
1051
1057
 
1052
1058
  // src/image-editor/ControlSlider.tsx
1053
1059
  var import_image_editor3 = require("@pixerate/editor/image-editor");
1060
+
1061
+ // src/image-editor/controls/controls.tsx
1062
+ var import_react6 = require("react");
1063
+
1064
+ // src/image-editor/styles.ts
1065
+ var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
1066
+ var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
1067
+ var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
1068
+ var imageTabClass = (active) => `px-3 py-1.5 rounded-md font-medium transition-colors ${active ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:text-foreground hover:bg-muted"}`;
1069
+ var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
1070
+ var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
1071
+ var imageSidebarClass = "w-full md:w-80 bg-background border-t md:border-t-0 md:border-l border-border p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]";
1072
+ var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
1073
+ var imageSectionClass = "border-t border-border pt-3";
1074
+ var imageDividerClass = "h-px bg-border my-1";
1075
+ var imageSmallButtonClass = "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start disabled:opacity-40";
1076
+ var imageIconButtonClass = "px-1.5 py-0.5 rounded text-[10px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
1077
+ var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
1078
+ var imageChipClass = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-foreground hover:bg-accent hover:text-accent-foreground"}`;
1079
+ var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
1080
+ var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
1081
+ var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
1082
+ var imageRangeClass = "w-full accent-primary";
1083
+ var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
1084
+ var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
1085
+
1086
+ // src/image-editor/controls/controls.tsx
1054
1087
  var import_jsx_runtime4 = require("react/jsx-runtime");
1088
+ var ControlsContext = (0, import_react6.createContext)({});
1089
+ function ImageEditorControlsProvider({ controls, children }) {
1090
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ControlsContext.Provider, { value: controls, children });
1091
+ }
1092
+ function useImageEditorControls() {
1093
+ return (0, import_react6.useContext)(ControlsContext);
1094
+ }
1095
+ function ImageCheckbox(props) {
1096
+ const Host = useImageEditorControls().Checkbox;
1097
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
1098
+ const { checked, label, disabled, onChange, className = "" } = props;
1099
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1100
+ "input",
1101
+ {
1102
+ type: "checkbox",
1103
+ "aria-label": label,
1104
+ checked,
1105
+ disabled,
1106
+ onChange: (e) => onChange(e.target.checked),
1107
+ className: `accent-primary ${className}`
1108
+ }
1109
+ );
1110
+ }
1111
+ function ImageRange(props) {
1112
+ const Host = useImageEditorControls().Range;
1113
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
1114
+ const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1115
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1116
+ "input",
1117
+ {
1118
+ type: "range",
1119
+ "aria-label": label,
1120
+ min,
1121
+ max,
1122
+ step,
1123
+ value,
1124
+ disabled,
1125
+ onPointerDown: () => onStart?.(),
1126
+ onPointerUp: () => onEnd?.(),
1127
+ onKeyDown: () => onStart?.(),
1128
+ onKeyUp: () => onEnd?.(),
1129
+ onChange: (e) => onChange(Number(e.target.value)),
1130
+ className: `w-full accent-primary disabled:opacity-40 ${className}`
1131
+ }
1132
+ );
1133
+ }
1134
+ function ImageSelect(props) {
1135
+ const Host = useImageEditorControls().Select;
1136
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
1137
+ const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1138
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1139
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: placeholder }),
1140
+ options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: o.value, children: o.label }, o.value))
1141
+ ] });
1142
+ }
1143
+
1144
+ // src/image-editor/ControlSlider.tsx
1145
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1055
1146
  var ControlSlider = ({ spec, value, onChange, disabled, label, className }) => {
1056
1147
  const name = label ?? spec.label;
1057
1148
  const track = (0, import_image_editor3.controlTrackBackground)(spec);
1058
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-control-id": spec.id, className, children: [
1059
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
1060
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: name }),
1061
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-mono", children: (0, import_image_editor3.formatControlValue)(spec, value) })
1149
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-control-id": spec.id, className, children: [
1150
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
1151
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: name }),
1152
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "font-mono", children: (0, import_image_editor3.formatControlValue)(spec, value) })
1062
1153
  ] }),
1063
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1064
- "input",
1065
- {
1066
- type: "range",
1067
- min: spec.min,
1068
- max: spec.max,
1069
- step: spec.step,
1070
- "aria-label": name,
1071
- disabled,
1072
- value,
1073
- onChange: (e) => onChange(Number(e.target.value)),
1074
- className: "w-full accent-primary disabled:opacity-40"
1075
- }
1076
- ),
1077
- track && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
1154
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ImageRange, { min: spec.min, max: spec.max, step: spec.step, label: name, disabled, value, onChange }),
1155
+ track && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "h-0.5 rounded-full opacity-70", style: { background: track } })
1078
1156
  ] });
1079
1157
  };
1080
1158
 
1081
1159
  // src/image-editor/Histogram.tsx
1082
- var import_react6 = require("react");
1160
+ var import_react7 = require("react");
1083
1161
  var import_image_editor4 = require("@pixerate/editor/image-editor");
1084
- var import_jsx_runtime5 = require("react/jsx-runtime");
1162
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1085
1163
  var FILL = {
1086
1164
  luminance: "rgba(148, 163, 184, 0.45)",
1087
1165
  red: "rgba(239, 68, 68, 0.45)",
@@ -1091,14 +1169,14 @@ var FILL = {
1091
1169
  var W = 256;
1092
1170
  var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", style }) => {
1093
1171
  const channels = channel === "rgb" ? ["luminance", "red", "green", "blue"] : [channel];
1094
- const paths = (0, import_react6.useMemo)(
1172
+ const paths = (0, import_react7.useMemo)(
1095
1173
  () => histogram && histogram.samples > 0 ? channels.map((c) => ({ c, d: (0, import_image_editor4.histogramPath)(histogram, c, W, height) })) : [],
1096
1174
  // eslint-disable-next-line react-hooks/exhaustive-deps
1097
1175
  [histogram, channel, height]
1098
1176
  );
1099
1177
  const clipLow = histogram && histogram.samples ? Math.max(...histogram.shadows) / histogram.samples : 0;
1100
1178
  const clipHigh = histogram && histogram.samples ? Math.max(...histogram.highlights) / histogram.samples : 0;
1101
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1179
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1102
1180
  "svg",
1103
1181
  {
1104
1182
  viewBox: `0 0 ${W} ${height}`,
@@ -1109,32 +1187,32 @@ var Histogram = ({ histogram, channel = "rgb", height = 64, className = "", styl
1109
1187
  className: `w-full rounded bg-muted/40 ${className}`,
1110
1188
  style: { height, ...style },
1111
1189
  children: [
1112
- paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
1113
- clipLow > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: 0, y: 0, width: 3, height, fill: "#3b82f6", "data-testid": "histogram-clip-shadows" }),
1114
- clipHigh > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: W - 3, y: 0, width: 3, height, fill: "#ef4444", "data-testid": "histogram-clip-highlights" })
1190
+ paths.map(({ c, d }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d, fill: FILL[c], stroke: "none" }, c)),
1191
+ clipLow > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: 0, y: 0, width: 3, height, fill: "#3b82f6", "data-testid": "histogram-clip-shadows" }),
1192
+ clipHigh > 5e-3 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: W - 3, y: 0, width: 3, height, fill: "#ef4444", "data-testid": "histogram-clip-highlights" })
1115
1193
  ]
1116
1194
  }
1117
1195
  );
1118
1196
  };
1119
1197
  function useImageHistogram(controller) {
1120
- const [histogram, setHistogram] = (0, import_react6.useState)(() => controller.getHistogram());
1121
- (0, import_react6.useEffect)(() => controller.subscribeHistogram(setHistogram), [controller]);
1198
+ const [histogram, setHistogram] = (0, import_react7.useState)(() => controller.getHistogram());
1199
+ (0, import_react7.useEffect)(() => controller.subscribeHistogram(setHistogram), [controller]);
1122
1200
  return histogram;
1123
1201
  }
1124
1202
 
1125
1203
  // src/image-editor/AdjustmentLayersPanel.tsx
1126
- var import_react8 = require("react");
1204
+ var import_react9 = require("react");
1127
1205
  var import_image_editor6 = require("@pixerate/editor/image-editor");
1128
1206
 
1129
1207
  // src/image-editor/CurvesEditor.tsx
1130
- var import_react7 = require("react");
1208
+ var import_react8 = require("react");
1131
1209
  var import_image_editor5 = require("@pixerate/editor/image-editor");
1132
- var import_jsx_runtime6 = require("react/jsx-runtime");
1210
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1133
1211
  var BOX = 256;
1134
1212
  var STROKE = { master: "var(--foreground, #e2e8f0)", red: "#ef4444", green: "#22c55e", blue: "#3b82f6" };
1135
1213
  var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 200, className = "" }) => {
1136
- const svgRef = (0, import_react7.useRef)(null);
1137
- const [drag, setDrag] = (0, import_react7.useState)(null);
1214
+ const svgRef = (0, import_react8.useRef)(null);
1215
+ const [drag, setDrag] = (0, import_react8.useState)(null);
1138
1216
  const toBox = (e) => {
1139
1217
  const rect = svgRef.current?.getBoundingClientRect();
1140
1218
  if (!rect || !rect.width || !rect.height) return { x: 0, y: 0 };
@@ -1163,7 +1241,7 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
1163
1241
  if (index !== -1 && points.length > 2) onChange((0, import_image_editor5.removeCurvePoint)(points, index), true);
1164
1242
  };
1165
1243
  const histChannel = channel === "master" ? "luminance" : channel;
1166
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1244
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1167
1245
  "svg",
1168
1246
  {
1169
1247
  ref: svgRef,
@@ -1180,16 +1258,16 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
1180
1258
  onPointerCancel: () => setDrag(null),
1181
1259
  onDoubleClick,
1182
1260
  children: [
1183
- histogram && histogram.samples > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: (0, import_image_editor5.histogramPath)(histogram, histChannel, BOX, BOX), fill: "rgba(148, 163, 184, 0.25)" }),
1184
- [64, 128, 192].map((v) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("g", { stroke: "rgba(148, 163, 184, 0.2)", strokeWidth: 1, children: [
1185
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: v, y1: 0, x2: v, y2: BOX }),
1186
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: 0, y1: v, x2: BOX, y2: v })
1261
+ histogram && histogram.samples > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: (0, import_image_editor5.histogramPath)(histogram, histChannel, BOX, BOX), fill: "rgba(148, 163, 184, 0.25)" }),
1262
+ [64, 128, 192].map((v) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("g", { stroke: "rgba(148, 163, 184, 0.2)", strokeWidth: 1, children: [
1263
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: v, y1: 0, x2: v, y2: BOX }),
1264
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: 0, y1: v, x2: BOX, y2: v })
1187
1265
  ] }, v)),
1188
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: 0, y1: BOX, x2: BOX, y2: 0, stroke: "rgba(148, 163, 184, 0.35)", strokeDasharray: "4 4" }),
1189
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: (0, import_image_editor5.curveSvgPath)(points, BOX, BOX), fill: "none", stroke: STROKE[channel], strokeWidth: 2 }),
1266
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: 0, y1: BOX, x2: BOX, y2: 0, stroke: "rgba(148, 163, 184, 0.35)", strokeDasharray: "4 4" }),
1267
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: (0, import_image_editor5.curveSvgPath)(points, BOX, BOX), fill: "none", stroke: STROKE[channel], strokeWidth: 2 }),
1190
1268
  points.map((p, i) => {
1191
1269
  const b = (0, import_image_editor5.curvePointToBox)(p, BOX, BOX);
1192
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1270
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1193
1271
  "circle",
1194
1272
  {
1195
1273
  cx: b.x,
@@ -1208,30 +1286,8 @@ var CurvesEditor = ({ points, onChange, histogram, channel = "master", size = 20
1208
1286
  );
1209
1287
  };
1210
1288
 
1211
- // src/image-editor/styles.ts
1212
- var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
1213
- var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
1214
- var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
1215
- var imageTabClass = (active) => `px-3 py-1.5 rounded-md font-medium transition-colors ${active ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:text-foreground hover:bg-muted"}`;
1216
- var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
1217
- var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
1218
- var imageSidebarClass = "w-full md:w-80 bg-background border-t md:border-t-0 md:border-l border-border p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]";
1219
- var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
1220
- var imageSectionClass = "border-t border-border pt-3";
1221
- var imageDividerClass = "h-px bg-border my-1";
1222
- var imageSmallButtonClass = "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start disabled:opacity-40";
1223
- var imageIconButtonClass = "px-1.5 py-0.5 rounded text-[10px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
1224
- var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
1225
- var imageChipClass = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-foreground hover:bg-accent hover:text-accent-foreground"}`;
1226
- var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
1227
- var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
1228
- var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
1229
- var imageRangeClass = "w-full accent-primary";
1230
- var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
1231
- var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
1232
-
1233
1289
  // src/image-editor/AdjustmentLayersPanel.tsx
1234
- var import_jsx_runtime7 = require("react/jsx-runtime");
1290
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1235
1291
  var CHANNELS = [
1236
1292
  { id: "master", label: "RGB" },
1237
1293
  { id: "red", label: "Red" },
@@ -1246,26 +1302,26 @@ var TONES = [
1246
1302
  var chipClass = (on) => `px-2 py-0.5 rounded text-[10px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:text-foreground"}`;
1247
1303
  var HueRangeStrip = ({ bounds }) => {
1248
1304
  const pts = Array.from({ length: 73 }, (_, i) => `${i / 72 * 360},${20 - (0, import_image_editor6.hueRangeWeight)({ bounds }, i * 5) * 18}`).join(" ");
1249
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
1250
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("linearGradient", { id: "pixerate-hue-strip", children: [0, 60, 120, 180, 240, 300, 360].map((h) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("stop", { offset: `${h / 360 * 100}%`, stopColor: `hsl(${h}, 90%, 50%)` }, h)) }) }),
1251
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { width: 360, height: 20, fill: "url(#pixerate-hue-strip)", opacity: 0.6 }),
1252
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
1305
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 360 20", preserveAspectRatio: "none", className: "w-full h-4 rounded", "data-testid": "hue-range-strip", children: [
1306
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("linearGradient", { id: "pixerate-hue-strip", children: [0, 60, 120, 180, 240, 300, 360].map((h) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("stop", { offset: `${h / 360 * 100}%`, stopColor: `hsl(${h}, 90%, 50%)` }, h)) }) }),
1307
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("rect", { width: 360, height: 20, fill: "url(#pixerate-hue-strip)", opacity: 0.6 }),
1308
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: pts, fill: "none", stroke: "#fff", strokeWidth: 1.5 })
1253
1309
  ] });
1254
1310
  };
1255
1311
  var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, className = "" }) => {
1256
1312
  const follow = layersProp === void 0;
1257
- const [, setTick] = (0, import_react8.useState)(0);
1258
- (0, import_react8.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
1313
+ const [, setTick] = (0, import_react9.useState)(0);
1314
+ (0, import_react9.useEffect)(() => follow ? controller.subscribe(() => setTick((n) => n + 1)) : void 0, [controller, follow]);
1259
1315
  const layers = layersProp ?? controller.getAdjustmentLayers();
1260
- const [newKind, setNewKind] = (0, import_react8.useState)("curves");
1261
- const [selectedId, setSelectedId] = (0, import_react8.useState)(null);
1262
- const [channel, setChannel] = (0, import_react8.useState)("master");
1263
- const [range, setRange] = (0, import_react8.useState)(-1);
1264
- const [tone, setTone] = (0, import_react8.useState)("midtones");
1316
+ const [newKind, setNewKind] = (0, import_react9.useState)("curves");
1317
+ const [selectedId, setSelectedId] = (0, import_react9.useState)(null);
1318
+ const [channel, setChannel] = (0, import_react9.useState)("master");
1319
+ const [range, setRange] = (0, import_react9.useState)(-1);
1320
+ const [tone, setTone] = (0, import_react9.useState)("midtones");
1265
1321
  const selected = layers.find((l) => l.id === selectedId) ?? null;
1266
1322
  const topFirst = [...layers].reverse();
1267
1323
  const setParam = (layer, path, value, commit = true) => controller.updateAdjustmentLayer(layer.id, { params: (0, import_image_editor6.setControlPath)(layer.params, path, value) }, commit);
1268
- const slider = (layer, spec, label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1324
+ const slider = (layer, spec, label) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1269
1325
  ControlSlider,
1270
1326
  {
1271
1327
  spec,
@@ -1276,24 +1332,16 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1276
1332
  spec.id
1277
1333
  );
1278
1334
  const controlsOf = (layer, filter = () => true) => import_image_editor6.ADJUSTMENT_LAYER_CONTROLS[layer.kind].filter(filter);
1279
- const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1280
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1281
- "input",
1282
- {
1283
- type: "checkbox",
1284
- checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)),
1285
- onChange: (e) => setParam(layer, path, e.target.checked),
1286
- className: "accent-primary"
1287
- }
1288
- ),
1335
+ const checkbox = (layer, path, label) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1336
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label, checked: Boolean((0, import_image_editor6.getControlPath)(layer.params, path)), onChange: (on) => setParam(layer, path, on) }),
1289
1337
  label
1290
1338
  ] });
1291
1339
  const editor = (layer) => {
1292
1340
  switch (layer.kind) {
1293
1341
  case "curves":
1294
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
1295
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Curve channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
1296
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1342
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1343
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Curve channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
1344
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1297
1345
  CurvesEditor,
1298
1346
  {
1299
1347
  points: layer.params[channel],
@@ -1304,43 +1352,35 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1304
1352
  )
1305
1353
  ] });
1306
1354
  case "levels":
1307
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
1308
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Levels channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
1355
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1356
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Levels channel", children: CHANNELS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(channel === c.id), onClick: () => setChannel(c.id), children: c.label }, c.id)) }),
1309
1357
  controlsOf(layer, (s) => s.id.startsWith(`${channel}.`)).map((s) => slider(layer, s))
1310
1358
  ] });
1311
1359
  case "hueSaturation":
1312
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
1313
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Hue range", children: [
1314
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: chipClass(range === -1), onClick: () => setRange(-1), children: "Master" }),
1315
- import_image_editor6.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: chipClass(range === i), onClick: () => setRange(i), disabled: layer.params.colorize, children: name }, name))
1360
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1361
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Hue range", children: [
1362
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(range === -1), onClick: () => setRange(-1), children: "Master" }),
1363
+ import_image_editor6.HUE_RANGE_LABELS.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(range === i), onClick: () => setRange(i), disabled: layer.params.colorize, children: name }, name))
1316
1364
  ] }),
1317
- range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HueRangeStrip, { bounds: layer.params.ranges[range].bounds }),
1365
+ range >= 0 && !layer.params.colorize && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HueRangeStrip, { bounds: layer.params.ranges[range].bounds }),
1318
1366
  controlsOf(layer, (s) => range === -1 || layer.params.colorize ? !s.id.startsWith("ranges.") : s.id.startsWith(`ranges.${range}.`)).map(
1319
1367
  (s) => slider(layer, s)
1320
1368
  ),
1321
1369
  range === -1 && checkbox(layer, "colorize", "Colorize")
1322
1370
  ] });
1323
1371
  case "colorBalance":
1324
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
1325
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Tone", children: TONES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: chipClass(tone === t.id), onClick: () => setTone(t.id), children: t.label }, t.id)) }),
1372
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1373
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Tone", children: TONES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: chipClass(tone === t.id), onClick: () => setTone(t.id), children: t.label }, t.id)) }),
1326
1374
  controlsOf(layer, (s) => s.id.startsWith(`${tone}.`)).map((s) => slider(layer, s)),
1327
1375
  checkbox(layer, "preserveLuminosity", "Preserve luminosity")
1328
1376
  ] });
1329
1377
  case "blackWhite":
1330
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
1378
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1331
1379
  controlsOf(layer).map((s) => slider(layer, s)),
1332
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1333
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1334
- "input",
1335
- {
1336
- type: "checkbox",
1337
- checked: layer.params.tint !== null,
1338
- onChange: (e) => setParam(layer, "tint", e.target.checked ? "#e1d3b3" : null),
1339
- className: "accent-primary"
1340
- }
1341
- ),
1380
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1381
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
1342
1382
  "Tint",
1343
- layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1383
+ layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1344
1384
  "input",
1345
1385
  {
1346
1386
  type: "color",
@@ -1353,10 +1393,10 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1353
1393
  ] })
1354
1394
  ] });
1355
1395
  case "photoFilter":
1356
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2", children: [
1357
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1396
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1397
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1358
1398
  "Filter colour",
1359
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1399
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1360
1400
  "input",
1361
1401
  {
1362
1402
  type: "color",
@@ -1371,25 +1411,25 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1371
1411
  checkbox(layer, "preserveLuminosity", "Preserve luminosity")
1372
1412
  ] });
1373
1413
  case "invert":
1374
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
1414
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-muted-foreground text-[11px]", children: "Invert has no settings." });
1375
1415
  default:
1376
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
1416
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-2", children: controlsOf(layer).map((s) => slider(layer, s)) });
1377
1417
  }
1378
1418
  };
1379
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
1380
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
1381
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-1.5", children: [
1382
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1383
- "select",
1419
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-2 text-xs ${className}`.trim(), "data-testid": "adjustment-layers-panel", children: [
1420
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: imageSectionTitleClass, children: "Adjustment Layers" }) }),
1421
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex gap-1.5", children: [
1422
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1423
+ ImageSelect,
1384
1424
  {
1385
- "aria-label": "New adjustment layer kind",
1386
- className: `${imageSelectClass} flex-1`,
1425
+ label: "New adjustment layer kind",
1426
+ className: "flex-1",
1387
1427
  value: newKind,
1388
- onChange: (e) => setNewKind(e.target.value),
1389
- children: import_image_editor6.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: k.kind, children: k.label }, k.kind))
1428
+ options: import_image_editor6.ADJUSTMENT_KINDS.map((k) => ({ value: k.kind, label: k.label })),
1429
+ onChange: (v) => setNewKind(v)
1390
1430
  }
1391
1431
  ),
1392
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1432
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1393
1433
  "button",
1394
1434
  {
1395
1435
  type: "button",
@@ -1403,25 +1443,16 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1403
1443
  }
1404
1444
  )
1405
1445
  ] }),
1406
- topFirst.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Adjustment layers", children: topFirst.map((layer) => {
1446
+ topFirst.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Adjustment layers", children: topFirst.map((layer) => {
1407
1447
  const index = layers.indexOf(layer);
1408
1448
  const label = layer.name || (0, import_image_editor6.adjustmentKindLabel)(layer.kind);
1409
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1449
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1410
1450
  "li",
1411
1451
  {
1412
1452
  className: `flex items-center gap-1.5 rounded px-1.5 py-1 ${layer.id === selectedId ? "bg-primary/20 ring-1 ring-primary/50" : "bg-muted/60"}`,
1413
1453
  children: [
1414
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1415
- "input",
1416
- {
1417
- type: "checkbox",
1418
- "aria-label": `Show ${label}`,
1419
- checked: layer.enabled,
1420
- onChange: () => controller.toggleAdjustmentLayer(layer.id),
1421
- className: "accent-primary"
1422
- }
1423
- ),
1424
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1454
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label: `Show ${label}`, checked: layer.enabled, onChange: () => controller.toggleAdjustmentLayer(layer.id) }),
1455
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1425
1456
  "button",
1426
1457
  {
1427
1458
  type: "button",
@@ -1431,7 +1462,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1431
1462
  children: label
1432
1463
  }
1433
1464
  ),
1434
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1465
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1435
1466
  "button",
1436
1467
  {
1437
1468
  type: "button",
@@ -1442,7 +1473,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1442
1473
  children: "\u2191"
1443
1474
  }
1444
1475
  ),
1445
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1476
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1446
1477
  "button",
1447
1478
  {
1448
1479
  type: "button",
@@ -1453,7 +1484,7 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1453
1484
  children: "\u2193"
1454
1485
  }
1455
1486
  ),
1456
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1487
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1457
1488
  "button",
1458
1489
  {
1459
1490
  type: "button",
@@ -1471,21 +1502,21 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1471
1502
  layer.id
1472
1503
  );
1473
1504
  }) }),
1474
- selected && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
1475
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
1476
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground", children: "Blend" }),
1477
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1478
- "select",
1505
+ selected && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2 rounded border border-border p-2", "data-testid": "adjustment-layer-editor", children: [
1506
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
1507
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: "Blend" }),
1508
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1509
+ ImageSelect,
1479
1510
  {
1480
- "aria-label": "Blend mode",
1481
- className: `${imageSelectClass} flex-1`,
1511
+ label: "Blend mode",
1512
+ className: "flex-1",
1482
1513
  value: selected.blend,
1483
- onChange: (e) => controller.updateAdjustmentLayer(selected.id, { blend: e.target.value }),
1484
- children: import_image_editor6.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: m.id, children: m.label }, m.id))
1514
+ options: import_image_editor6.BLEND_MODES.map((m) => ({ value: m.id, label: m.label })),
1515
+ onChange: (v) => controller.updateAdjustmentLayer(selected.id, { blend: v })
1485
1516
  }
1486
1517
  )
1487
1518
  ] }),
1488
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1519
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1489
1520
  ControlSlider,
1490
1521
  {
1491
1522
  spec: import_image_editor6.ADJUSTMENT_LAYER_OPACITY_CONTROL,
@@ -1500,18 +1531,18 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1500
1531
  };
1501
1532
 
1502
1533
  // src/image-editor/LayersPanel.tsx
1503
- var import_react10 = require("react");
1534
+ var import_react11 = require("react");
1504
1535
 
1505
1536
  // src/image-editor/LayerEffectsPanel.tsx
1506
- var import_react9 = require("react");
1537
+ var import_react10 = require("react");
1507
1538
  var import_image_editor7 = require("@pixerate/editor/image-editor");
1508
- var import_jsx_runtime8 = require("react/jsx-runtime");
1539
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1509
1540
  var LayerEffectsPanel = ({ controller, layerId, className }) => {
1510
- const [, setTick] = (0, import_react9.useState)(0);
1511
- (0, import_react9.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1512
- const [open, setOpen] = (0, import_react9.useState)(null);
1513
- const [error, setError] = (0, import_react9.useState)(null);
1514
- const commitNext = (0, import_react9.useRef)(true);
1541
+ const [, setTick] = (0, import_react10.useState)(0);
1542
+ (0, import_react10.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1543
+ const [open, setOpen] = (0, import_react10.useState)(null);
1544
+ const [error, setError] = (0, import_react10.useState)(null);
1545
+ const commitNext = (0, import_react10.useRef)(true);
1515
1546
  const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
1516
1547
  const model = (0, import_image_editor7.layerEffectsPanel)(layer);
1517
1548
  const id = layer?.id;
@@ -1523,13 +1554,8 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1523
1554
  setError(err instanceof Error ? err.message : String(err));
1524
1555
  }
1525
1556
  };
1526
- const sliderEvents = {
1527
- onPointerDown: () => commitNext.current = true,
1528
- onPointerUp: () => commitNext.current = true,
1529
- onKeyDown: () => commitNext.current = true
1530
- };
1531
1557
  if (!model.available || !id) {
1532
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1558
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1533
1559
  }
1534
1560
  const effects = controller.getLayerEffects(id);
1535
1561
  const patterns = controller.getDocumentPatterns();
@@ -1544,77 +1570,65 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1544
1570
  case "range": {
1545
1571
  const k = c.percent ? 100 : 1;
1546
1572
  const shown = Math.round(c.value * k * 100) / 100;
1547
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1548
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-muted-foreground", children: [
1573
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1574
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
1549
1575
  label,
1550
1576
  " ",
1551
1577
  shown,
1552
1578
  c.unit
1553
1579
  ] }),
1554
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1555
- "input",
1580
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1581
+ ImageRange,
1556
1582
  {
1557
- type: "range",
1558
- "aria-label": label,
1583
+ label,
1559
1584
  min: c.min * k,
1560
1585
  max: c.max * k,
1561
1586
  step: c.step * k,
1562
1587
  value: shown,
1563
1588
  disabled: model.readOnly,
1564
- ...sliderEvents,
1565
- onChange: (e) => change(effectId, c, Number(e.target.value) / k, true),
1566
- className: "accent-primary"
1589
+ onStart: () => commitNext.current = true,
1590
+ onEnd: () => commitNext.current = true,
1591
+ onChange: (v) => change(effectId, c, v / k, true)
1567
1592
  }
1568
1593
  )
1569
1594
  ] }, c.key);
1570
1595
  }
1571
1596
  case "color":
1572
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1573
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
1597
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
1574
1599
  label
1575
1600
  ] }, c.key);
1576
1601
  case "checkbox":
1577
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1578
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": label, checked: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.checked), className: "accent-primary" }),
1602
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1603
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1579
1604
  label
1580
1605
  ] }, c.key);
1581
1606
  case "select":
1582
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1583
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-muted-foreground", children: label }),
1584
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1585
- "select",
1607
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1608
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", children: label }),
1609
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1610
+ ImageSelect,
1586
1611
  {
1587
- "aria-label": label,
1588
- value: c.value,
1612
+ label,
1613
+ value: String(c.value),
1589
1614
  disabled: model.readOnly,
1590
- onChange: (e) => change(effectId, c, e.target.value),
1591
- className: imageSelectClass,
1592
- children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: o.value, children: o.label }, o.value))
1615
+ options: c.options.map((o) => ({ value: String(o.value), label: o.label })),
1616
+ onChange: (v) => change(effectId, c, v)
1593
1617
  }
1594
1618
  )
1595
1619
  ] }, c.key);
1596
1620
  }
1597
1621
  };
1598
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
1599
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1600
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
1601
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1602
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1603
- "input",
1604
- {
1605
- type: "checkbox",
1606
- "aria-label": "Effects on",
1607
- checked: model.enabled,
1608
- disabled: model.readOnly,
1609
- onChange: (e) => attempt(() => controller.setLayerEffectsEnabled(id, e.target.checked)),
1610
- className: "accent-primary"
1611
- }
1612
- ),
1622
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
1623
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1624
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
1625
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1626
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1613
1627
  "On"
1614
1628
  ] }),
1615
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1629
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1616
1630
  "Scale",
1617
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1631
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1618
1632
  "input",
1619
1633
  {
1620
1634
  type: "number",
@@ -1633,43 +1647,30 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1633
1647
  ),
1634
1648
  "%"
1635
1649
  ] }),
1636
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1637
- "select",
1650
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1651
+ ImageSelect,
1638
1652
  {
1639
- "aria-label": "Add effect",
1653
+ label: "Add effect",
1640
1654
  value: "",
1655
+ placeholder: "Add effect\u2026",
1641
1656
  disabled: model.readOnly,
1642
- onChange: (e) => {
1643
- const kind = e.target.value;
1657
+ options: import_image_editor7.LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
1658
+ onChange: (v) => {
1659
+ const kind = v;
1644
1660
  if (!kind) return;
1645
1661
  attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
1646
- },
1647
- className: imageSelectClass,
1648
- children: [
1649
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "Add effect\u2026" }),
1650
- import_image_editor7.LAYER_EFFECT_MENU.map((m) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: m.kind, children: m.label }, m.kind))
1651
- ]
1662
+ }
1652
1663
  }
1653
1664
  )
1654
1665
  ] }),
1655
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1656
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1666
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1667
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1657
1668
  const effect = effects.items.find((e) => e.id === row.id);
1658
1669
  const expanded = open === row.id;
1659
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1660
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1661
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1662
- "input",
1663
- {
1664
- type: "checkbox",
1665
- "aria-label": `${row.label} on`,
1666
- checked: row.enabled,
1667
- disabled: model.readOnly,
1668
- onChange: (e) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: e.target.checked })),
1669
- className: "accent-primary"
1670
- }
1671
- ),
1672
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1670
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1671
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1672
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1673
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1673
1674
  "button",
1674
1675
  {
1675
1676
  type: "button",
@@ -1679,18 +1680,18 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1679
1680
  children: row.label
1680
1681
  }
1681
1682
  ),
1682
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1683
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1683
1684
  ] }),
1684
- expanded && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_image_editor7.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1685
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_image_editor7.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1685
1686
  ] }, row.id);
1686
1687
  }) }),
1687
- error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1688
+ error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1688
1689
  ] });
1689
1690
  };
1690
1691
 
1691
1692
  // src/image-editor/LayersPanel.tsx
1692
1693
  var import_image_editor8 = require("@pixerate/editor/image-editor");
1693
- var import_jsx_runtime9 = require("react/jsx-runtime");
1694
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1694
1695
  var rowClass = (active) => `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${active ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`;
1695
1696
  var Thumbnail = ({
1696
1697
  pixels,
@@ -1700,8 +1701,8 @@ var Thumbnail = ({
1700
1701
  selected,
1701
1702
  testId
1702
1703
  }) => {
1703
- const ref = (0, import_react10.useRef)(null);
1704
- (0, import_react10.useEffect)(() => {
1704
+ const ref = (0, import_react11.useRef)(null);
1705
+ (0, import_react11.useEffect)(() => {
1705
1706
  const canvas = ref.current;
1706
1707
  const ctx = canvas?.getContext("2d");
1707
1708
  if (!canvas || !ctx || !pixels || typeof ctx.createImageData !== "function") return;
@@ -1711,7 +1712,7 @@ var Thumbnail = ({
1711
1712
  img.data.set(pixels.data);
1712
1713
  ctx.putImageData(img, 0, 0);
1713
1714
  }, [pixels]);
1714
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1715
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1715
1716
  "canvas",
1716
1717
  {
1717
1718
  ref,
@@ -1725,14 +1726,14 @@ var Thumbnail = ({
1725
1726
  );
1726
1727
  };
1727
1728
  var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "image", effects = true, className }) => {
1728
- const [, setTick] = (0, import_react10.useState)(0);
1729
- (0, import_react10.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1730
- const [error, setError] = (0, import_react10.useState)(null);
1731
- const [renaming, setRenaming] = (0, import_react10.useState)(null);
1732
- const [menu, setMenu] = (0, import_react10.useState)(null);
1733
- const [drag, setDrag] = (0, import_react10.useState)(null);
1734
- const [psdNotes, setPsdNotes] = (0, import_react10.useState)([]);
1735
- const fileInput = (0, import_react10.useRef)(null);
1729
+ const [, setTick] = (0, import_react11.useState)(0);
1730
+ (0, import_react11.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1731
+ const [error, setError] = (0, import_react11.useState)(null);
1732
+ const [renaming, setRenaming] = (0, import_react11.useState)(null);
1733
+ const [menu, setMenu] = (0, import_react11.useState)(null);
1734
+ const [drag, setDrag] = (0, import_react11.useState)(null);
1735
+ const [psdNotes, setPsdNotes] = (0, import_react11.useState)([]);
1736
+ const fileInput = (0, import_react11.useRef)(null);
1736
1737
  const psdTask = async (fn) => {
1737
1738
  try {
1738
1739
  setError(null);
@@ -1741,7 +1742,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1741
1742
  setError(err instanceof Error ? err.message : String(err));
1742
1743
  }
1743
1744
  };
1744
- const commitNext = (0, import_react10.useRef)(true);
1745
+ const commitNext = (0, import_react11.useRef)(true);
1745
1746
  const state = controller.getState();
1746
1747
  const rows = (0, import_image_editor8.layerPanelRows)(state.layers, state.activeLayerId);
1747
1748
  const active = controller.getActiveLayer();
@@ -1779,14 +1780,14 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1779
1780
  const thumb = (layer) => (0, import_image_editor8.layerHasThumbnail)(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
1780
1781
  const maskThumb = (layer) => layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
1781
1782
  const locked = (layer) => Boolean(layer.locks?.all || layer.locks?.pixels || layer.locks?.position || layer.locks?.transparency);
1782
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
1783
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
1784
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
1785
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
1786
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
1787
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
1788
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
1789
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1783
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "layers-panel", onClick: () => menu && setMenu(null), children: [
1784
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "toolbar", "aria-label": "Layer actions", children: [
1785
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-layer"), children: "New Layer" }),
1786
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => run("new-group"), children: "New Group" }),
1787
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("duplicate"), children: "Duplicate" }),
1788
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("add-mask"), children: "Add Mask" }),
1789
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, disabled: !active, onClick: () => run("delete"), children: "Delete" }),
1790
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1790
1791
  "button",
1791
1792
  {
1792
1793
  type: "button",
@@ -1801,7 +1802,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1801
1802
  children: "\u22EF"
1802
1803
  }
1803
1804
  ),
1804
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1805
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1805
1806
  "select",
1806
1807
  {
1807
1808
  "aria-label": "Bits per channel",
@@ -1809,13 +1810,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1809
1810
  className: "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground",
1810
1811
  value: controller.bitDepth,
1811
1812
  onChange: (e) => attempt(() => controller.setBitDepth(Number(e.target.value))),
1812
- children: import_image_editor8.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
1813
+ children: import_image_editor8.BIT_DEPTH_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: o.depth, title: o.title, children: o.label }, o.depth))
1813
1814
  }
1814
1815
  ),
1815
- psd && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1816
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
1817
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0, import_image_editor8.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
1818
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1816
+ psd && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1817
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => fileInput.current?.click(), children: "Open PSD\u2026" }),
1818
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, onClick: () => psdTask(async () => (await (0, import_image_editor8.downloadPsd)(controller, psdFileName)).warnings), children: "Export PSD" }),
1819
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1819
1820
  "input",
1820
1821
  {
1821
1822
  ref: fileInput,
@@ -1833,18 +1834,18 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1833
1834
  )
1834
1835
  ] })
1835
1836
  ] }),
1836
- psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
1837
- psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: n }, n)),
1838
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
1837
+ psdNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { className: "rounded bg-amber-500/10 text-amber-600 px-2 py-1 space-y-0.5", "data-testid": "psd-warnings", "aria-label": "PSD warnings", children: [
1838
+ psdNotes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: n }, n)),
1839
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "underline", onClick: () => setPsdNotes([]), children: "Dismiss" }) })
1839
1840
  ] }),
1840
- active && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
1841
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1842
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
1841
+ active && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 items-center", "data-testid": "layer-properties", children: [
1842
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1843
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-muted-foreground", children: [
1843
1844
  "Opacity ",
1844
1845
  Math.round(active.opacity * 100),
1845
1846
  "%"
1846
1847
  ] }),
1847
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1848
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1848
1849
  "input",
1849
1850
  {
1850
1851
  type: "range",
@@ -1858,13 +1859,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1858
1859
  }
1859
1860
  )
1860
1861
  ] }),
1861
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1862
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-muted-foreground", children: [
1862
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1863
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-muted-foreground", children: [
1863
1864
  "Fill ",
1864
1865
  Math.round(((active.type === "pixel" ? active.fillOpacity : void 0) ?? 1) * 100),
1865
1866
  "%"
1866
1867
  ] }),
1867
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1868
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1868
1869
  "input",
1869
1870
  {
1870
1871
  type: "range",
@@ -1879,7 +1880,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1879
1880
  }
1880
1881
  )
1881
1882
  ] }),
1882
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1883
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1883
1884
  "select",
1884
1885
  {
1885
1886
  "aria-label": "Layer blend mode",
@@ -1887,13 +1888,13 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1887
1888
  value: active.blend,
1888
1889
  onChange: (e) => attempt(() => controller.setLayerProperties(active.id, { blend: e.target.value })),
1889
1890
  children: [
1890
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "pass-through", children: "Pass Through" }),
1891
- import_image_editor8.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: m.id, children: m.label }, m.id))
1891
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "pass-through", children: "Pass Through" }),
1892
+ import_image_editor8.BLEND_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: m.id, children: m.label }, m.id))
1892
1893
  ]
1893
1894
  }
1894
1895
  ),
1895
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1896
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1896
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1897
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1897
1898
  "input",
1898
1899
  {
1899
1900
  type: "checkbox",
@@ -1905,8 +1906,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1905
1906
  ),
1906
1907
  "Clip to below"
1907
1908
  ] }),
1908
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1", children: [
1909
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1909
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "col-span-2 flex flex-wrap gap-2 text-muted-foreground", role: "group", "aria-label": "Layer locks", children: ["pixels", "transparency", "position", "all"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1", children: [
1910
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1910
1911
  "input",
1911
1912
  {
1912
1913
  type: "checkbox",
@@ -1919,10 +1920,10 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1919
1920
  k
1920
1921
  ] }, k)) })
1921
1922
  ] }),
1922
- effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
1923
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
1923
+ effects && active && active.type !== "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LayerEffectsPanel, { controller, className: "border-t border-border pt-1.5" }),
1924
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "flex flex-col gap-0.5", role: "tree", "aria-label": "Layers", children: rows.map((row) => {
1924
1925
  const { layer } = row;
1925
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1926
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1926
1927
  "li",
1927
1928
  {
1928
1929
  role: "treeitem",
@@ -1952,7 +1953,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1952
1953
  className: rowClass(row.active),
1953
1954
  style: { paddingLeft: 6 + row.depth * 14 },
1954
1955
  children: [
1955
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1956
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1956
1957
  "button",
1957
1958
  {
1958
1959
  type: "button",
@@ -1966,7 +1967,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1966
1967
  children: layer.visible ? "\u25CF" : "\u25CB"
1967
1968
  }
1968
1969
  ),
1969
- layer.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1970
+ layer.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1970
1971
  "button",
1971
1972
  {
1972
1973
  type: "button",
@@ -1979,9 +1980,9 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1979
1980
  children: layer.collapsed ? "\u25B8" : "\u25BE"
1980
1981
  }
1981
1982
  ),
1982
- row.clipped && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
1983
- (0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "relative shrink-0", children: [
1984
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1983
+ row.clipped && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-muted-foreground", "aria-label": "Clipped", children: "\u21B3" }),
1984
+ (0, import_image_editor8.layerHasThumbnail)(layer) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "relative shrink-0", children: [
1985
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1985
1986
  Thumbnail,
1986
1987
  {
1987
1988
  pixels: thumb(layer),
@@ -1990,7 +1991,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1990
1991
  selected: row.active && state.activeTarget === "pixels" && Boolean(layer.mask)
1991
1992
  }
1992
1993
  ),
1993
- layer.type !== "pixel" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1994
+ layer.type !== "pixel" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1994
1995
  "span",
1995
1996
  {
1996
1997
  "data-testid": "layer-kind-badge",
@@ -1998,7 +1999,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
1998
1999
  children: (0, import_image_editor8.layerBadge)(layer)
1999
2000
  }
2000
2001
  )
2001
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2002
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2002
2003
  "span",
2003
2004
  {
2004
2005
  className: "shrink-0 grid place-items-center rounded bg-muted text-[9px] text-muted-foreground ring-1 ring-border",
@@ -2006,7 +2007,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2006
2007
  children: (0, import_image_editor8.layerBadge)(layer)
2007
2008
  }
2008
2009
  ),
2009
- layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2010
+ layer.mask && !layer.mask.source && layer.type === "pixel" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2010
2011
  "button",
2011
2012
  {
2012
2013
  type: "button",
@@ -2022,7 +2023,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2022
2023
  children: layer.mask.linked === false ? "\u26D3\uFE0E\u0338" : "\u26D3\uFE0E"
2023
2024
  }
2024
2025
  ),
2025
- layer.mask && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2026
+ layer.mask && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2026
2027
  Thumbnail,
2027
2028
  {
2028
2029
  pixels: maskThumb(layer),
@@ -2037,7 +2038,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2037
2038
  }
2038
2039
  }
2039
2040
  ),
2040
- renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2041
+ renaming === layer.id ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2041
2042
  "input",
2042
2043
  {
2043
2044
  autoFocus: true,
@@ -2054,7 +2055,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2054
2055
  if (e.key === "Escape") setRenaming(null);
2055
2056
  }
2056
2057
  }
2057
- ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2058
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2058
2059
  "span",
2059
2060
  {
2060
2061
  className: `flex-1 min-w-0 truncate ${layer.visible ? "" : "text-muted-foreground"}`,
@@ -2065,8 +2066,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2065
2066
  children: row.label
2066
2067
  }
2067
2068
  ),
2068
- (0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor8.layerWarning)(layer), title: (0, import_image_editor8.layerWarning)(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
2069
- (0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2069
+ (0, import_image_editor8.layerWarning)(layer) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { role: "img", "data-testid": "layer-warning", "aria-label": (0, import_image_editor8.layerWarning)(layer), title: (0, import_image_editor8.layerWarning)(layer), className: "text-[10px] text-amber-600", children: "\u26A0" }),
2070
+ (0, import_image_editor8.layerEffectsBadge)(layer) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2070
2071
  "button",
2071
2072
  {
2072
2073
  type: "button",
@@ -2081,15 +2082,15 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2081
2082
  children: "fx"
2082
2083
  }
2083
2084
  ),
2084
- locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
2085
- layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
2085
+ locked(layer) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-label": "Locked", className: "text-muted-foreground", children: "\u{1F512}" }),
2086
+ layer.blend !== "normal" && layer.blend !== "pass-through" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[9px] text-muted-foreground", children: layer.blend })
2086
2087
  ]
2087
2088
  },
2088
2089
  layer.id
2089
2090
  );
2090
2091
  }) }),
2091
- error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
2092
- menu && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2092
+ error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
2093
+ menu && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2093
2094
  "div",
2094
2095
  {
2095
2096
  role: "menu",
@@ -2098,7 +2099,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2098
2099
  style: { left: menu.x, top: menu.y },
2099
2100
  onClick: (e) => e.stopPropagation(),
2100
2101
  onKeyDown: (e) => e.key === "Escape" && setMenu(null),
2101
- children: (0, import_image_editor8.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2102
+ children: (0, import_image_editor8.layerMenu)(controller).map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2102
2103
  "button",
2103
2104
  {
2104
2105
  type: "button",
@@ -2116,21 +2117,21 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2116
2117
  };
2117
2118
 
2118
2119
  // src/image-editor/ImageProviderEffectsPanel.tsx
2119
- var import_react19 = __toESM(require("react"), 1);
2120
+ var import_react20 = __toESM(require("react"), 1);
2120
2121
  var import_image_editor9 = require("@pixerate/editor/image-editor");
2121
2122
 
2122
2123
  // src/effects/useEffects.ts
2123
- var import_react11 = require("react");
2124
+ var import_react12 = require("react");
2124
2125
  function useEffects(host, provider) {
2125
- (0, import_react11.useEffect)(() => {
2126
+ (0, import_react12.useEffect)(() => {
2126
2127
  if (!host || !provider) return;
2127
2128
  return host.useEffects(provider);
2128
2129
  }, [host, provider]);
2129
2130
  }
2130
2131
  function useEffectDescription(provider, effect) {
2131
- const [state, setState] = (0, import_react11.useState)({ key: "", description: null, error: null });
2132
+ const [state, setState] = (0, import_react12.useState)({ key: "", description: null, error: null });
2132
2133
  const key = provider && effect ? `${provider.id}:${effect}` : "";
2133
- (0, import_react11.useEffect)(() => {
2134
+ (0, import_react12.useEffect)(() => {
2134
2135
  if (!provider || !effect) return;
2135
2136
  let live = true;
2136
2137
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -2145,13 +2146,13 @@ function useEffectDescription(provider, effect) {
2145
2146
  }
2146
2147
 
2147
2148
  // src/effects/EffectThumbnail.tsx
2148
- var import_react12 = require("react");
2149
+ var import_react13 = require("react");
2149
2150
  var import_effects = require("@pixerate/editor/effects");
2150
- var import_jsx_runtime10 = require("react/jsx-runtime");
2151
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2151
2152
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2152
- const ref = (0, import_react12.useRef)(null);
2153
- const [failed, setFailed] = (0, import_react12.useState)(effect.kind === "motion");
2154
- (0, import_react12.useEffect)(() => {
2153
+ const ref = (0, import_react13.useRef)(null);
2154
+ const [failed, setFailed] = (0, import_react13.useState)(effect.kind === "motion");
2155
+ (0, import_react13.useEffect)(() => {
2155
2156
  if (effect.kind === "motion") return;
2156
2157
  let live = true;
2157
2158
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -2166,28 +2167,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2166
2167
  live = false;
2167
2168
  };
2168
2169
  }, [provider, effect, width, height]);
2169
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2170
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2170
2171
  "div",
2171
2172
  {
2172
2173
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2173
2174
  style: { aspectRatio: `${width} / ${height}` },
2174
2175
  "data-effect-thumbnail": effect.id,
2175
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2176
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind === "motion" ? "Motion" : "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2176
2177
  }
2177
2178
  );
2178
2179
  }
2179
2180
 
2180
2181
  // src/effects/EffectsBrowser.tsx
2181
- var import_react13 = require("react");
2182
+ var import_react14 = require("react");
2182
2183
  var import_effects2 = require("@pixerate/editor/effects");
2183
- var import_jsx_runtime11 = require("react/jsx-runtime");
2184
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2184
2185
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2185
- const [all, setAll] = (0, import_react13.useState)([]);
2186
- const [query, setQuery] = (0, import_react13.useState)("");
2187
- const [category, setCategory] = (0, import_react13.useState)("");
2188
- const [use, setUse] = (0, import_react13.useState)("");
2189
- const [error, setError] = (0, import_react13.useState)(null);
2190
- (0, import_react13.useEffect)(() => {
2186
+ const [all, setAll] = (0, import_react14.useState)([]);
2187
+ const [query, setQuery] = (0, import_react14.useState)("");
2188
+ const [category, setCategory] = (0, import_react14.useState)("");
2189
+ const [use, setUse] = (0, import_react14.useState)("");
2190
+ const [error, setError] = (0, import_react14.useState)(null);
2191
+ (0, import_react14.useEffect)(() => {
2191
2192
  if (!provider) return setAll([]);
2192
2193
  let live = true;
2193
2194
  Promise.resolve().then(() => provider.list()).then(
@@ -2198,8 +2199,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2198
2199
  live = false;
2199
2200
  };
2200
2201
  }, [provider]);
2201
- const [found, setFound] = (0, import_react13.useState)([]);
2202
- (0, import_react13.useEffect)(() => {
2202
+ const [found, setFound] = (0, import_react14.useState)([]);
2203
+ (0, import_react14.useEffect)(() => {
2203
2204
  if (!provider) return setFound([]);
2204
2205
  let live = true;
2205
2206
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -2208,14 +2209,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2208
2209
  };
2209
2210
  }, [provider, query, category, use]);
2210
2211
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (uses ? e.kind !== "motion" || uses.includes("motion") : e.kind !== "motion") && (!uses || e.uses.some((u) => uses.includes(u)));
2211
- const categories = (0, import_react13.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2212
+ const categories = (0, import_react14.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2212
2213
  const shown = found.filter(allowed);
2213
2214
  if (!provider)
2214
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
2215
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2216
- title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2217
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2218
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2215
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
2216
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2217
+ title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2218
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2219
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2219
2220
  "input",
2220
2221
  {
2221
2222
  type: "search",
@@ -2226,17 +2227,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2226
2227
  onChange: (e) => setQuery(e.currentTarget.value)
2227
2228
  }
2228
2229
  ),
2229
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2230
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "All categories" }),
2231
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: c, children: c }, c))
2230
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2231
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "All categories" }),
2232
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: c, children: c }, c))
2232
2233
  ] }),
2233
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2234
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: "Any use" }),
2235
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2234
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2235
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Any use" }),
2236
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2236
2237
  ] })
2237
2238
  ] }),
2238
- error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2239
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2239
+ error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2240
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2240
2241
  "button",
2241
2242
  {
2242
2243
  type: "button",
@@ -2245,23 +2246,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2245
2246
  "data-effect-id": e.id,
2246
2247
  onClick: () => onPick(e),
2247
2248
  children: [
2248
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectThumbnail, { provider, effect: e }),
2249
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2250
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2249
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EffectThumbnail, { provider, effect: e }),
2250
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2251
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2251
2252
  ]
2252
2253
  }
2253
2254
  ) }, e.id)) }),
2254
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2255
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2255
2256
  ] });
2256
2257
  }
2257
2258
 
2258
2259
  // src/effects/EffectParameters.tsx
2259
- var import_react18 = __toESM(require("react"), 1);
2260
+ var import_react19 = __toESM(require("react"), 1);
2260
2261
  var import_effects3 = require("@pixerate/editor/effects");
2261
2262
  var import_parameters2 = require("@pixerate/editor/parameters");
2262
2263
 
2263
2264
  // src/parameters/fields.tsx
2264
- var import_react17 = require("react");
2265
+ var import_react18 = require("react");
2265
2266
  var import_parameters = require("@pixerate/editor/parameters");
2266
2267
 
2267
2268
  // src/color/index.ts
@@ -2274,9 +2275,9 @@ __export(color_exports, {
2274
2275
  });
2275
2276
 
2276
2277
  // src/color/ColorPicker.tsx
2277
- var import_react14 = require("react");
2278
+ var import_react15 = require("react");
2278
2279
  var import_color = require("@pixerate/editor/color");
2279
- var import_jsx_runtime12 = require("react/jsx-runtime");
2280
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2280
2281
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2281
2282
  function readLocalRecents() {
2282
2283
  try {
@@ -2314,24 +2315,24 @@ var ColorPicker = ({
2314
2315
  id,
2315
2316
  "aria-label": ariaLabel = "Color picker"
2316
2317
  }) => {
2317
- const generatedId = (0, import_react14.useId)();
2318
+ const generatedId = (0, import_react15.useId)();
2318
2319
  const pickerId = id || generatedId;
2319
- const [pickerState, setPickerState] = (0, import_react14.useState)(
2320
+ const [pickerState, setPickerState] = (0, import_react15.useState)(
2320
2321
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2321
2322
  );
2322
- const stateRef = (0, import_react14.useRef)(pickerState);
2323
+ const stateRef = (0, import_react15.useRef)(pickerState);
2323
2324
  stateRef.current = pickerState;
2324
- (0, import_react14.useEffect)(() => {
2325
+ (0, import_react15.useEffect)(() => {
2325
2326
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2326
2327
  if (next) {
2327
2328
  setPickerState(next);
2328
2329
  }
2329
2330
  }, [value]);
2330
- const [internalRecent, setInternalRecent] = (0, import_react14.useState)(
2331
+ const [internalRecent, setInternalRecent] = (0, import_react15.useState)(
2331
2332
  () => controlledRecent ? [] : readLocalRecents()
2332
2333
  );
2333
2334
  const activeRecent = controlledRecent ?? internalRecent;
2334
- const recordRecent = (0, import_react14.useCallback)(
2335
+ const recordRecent = (0, import_react15.useCallback)(
2335
2336
  (color) => {
2336
2337
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2337
2338
  if (!controlledRecent) {
@@ -2342,11 +2343,11 @@ var ColorPicker = ({
2342
2343
  },
2343
2344
  [activeRecent, controlledRecent, onRecentChange]
2344
2345
  );
2345
- const [textDraft, setTextDraft] = (0, import_react14.useState)(value);
2346
- const [isInvalid, setIsInvalid] = (0, import_react14.useState)(false);
2347
- const [isClipped, setIsClipped] = (0, import_react14.useState)(false);
2348
- const isTypingRef = (0, import_react14.useRef)(false);
2349
- (0, import_react14.useEffect)(() => {
2346
+ const [textDraft, setTextDraft] = (0, import_react15.useState)(value);
2347
+ const [isInvalid, setIsInvalid] = (0, import_react15.useState)(false);
2348
+ const [isClipped, setIsClipped] = (0, import_react15.useState)(false);
2349
+ const isTypingRef = (0, import_react15.useRef)(false);
2350
+ (0, import_react15.useEffect)(() => {
2350
2351
  if (!isTypingRef.current) {
2351
2352
  setTextDraft(value);
2352
2353
  setIsInvalid(false);
@@ -2354,11 +2355,11 @@ var ColorPicker = ({
2354
2355
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2355
2356
  }
2356
2357
  }, [value]);
2357
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react14.useState)(false);
2358
- (0, import_react14.useEffect)(() => {
2358
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react15.useState)(false);
2359
+ (0, import_react15.useEffect)(() => {
2359
2360
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2360
2361
  }, []);
2361
- const emitColorChange = (0, import_react14.useCallback)(
2362
+ const emitColorChange = (0, import_react15.useCallback)(
2362
2363
  (nextState) => {
2363
2364
  setPickerState(nextState);
2364
2365
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2366,10 +2367,10 @@ var ColorPicker = ({
2366
2367
  },
2367
2368
  [alpha, onChange]
2368
2369
  );
2369
- const latest = (0, import_react14.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2370
+ const latest = (0, import_react15.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2370
2371
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2371
- const endDragRef = (0, import_react14.useRef)(null);
2372
- (0, import_react14.useEffect)(() => () => endDragRef.current?.(), []);
2372
+ const endDragRef = (0, import_react15.useRef)(null);
2373
+ (0, import_react15.useEffect)(() => () => endDragRef.current?.(), []);
2373
2374
  const startDrag = (e, next) => {
2374
2375
  if (disabled) return;
2375
2376
  e.preventDefault();
@@ -2471,7 +2472,7 @@ var ColorPicker = ({
2471
2472
  } catch {
2472
2473
  }
2473
2474
  };
2474
- const contrastResult = (0, import_react14.useMemo)(() => {
2475
+ const contrastResult = (0, import_react15.useMemo)(() => {
2475
2476
  if (!contrastAgainst) return null;
2476
2477
  const fg = (0, import_color.parseColor)(value);
2477
2478
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -2483,7 +2484,7 @@ var ColorPicker = ({
2483
2484
  }, [value, contrastAgainst]);
2484
2485
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2485
2486
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2486
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2487
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2487
2488
  "div",
2488
2489
  {
2489
2490
  id: pickerId,
@@ -2507,7 +2508,7 @@ var ColorPicker = ({
2507
2508
  pointerEvents: disabled ? "none" : "auto"
2508
2509
  },
2509
2510
  children: [
2510
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2511
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2511
2512
  "span",
2512
2513
  {
2513
2514
  role: "status",
@@ -2526,7 +2527,7 @@ var ColorPicker = ({
2526
2527
  children: liveDescription
2527
2528
  }
2528
2529
  ),
2529
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2530
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2530
2531
  "div",
2531
2532
  {
2532
2533
  role: "slider",
@@ -2548,7 +2549,7 @@ var ColorPicker = ({
2548
2549
  touchAction: "none",
2549
2550
  outline: "none"
2550
2551
  },
2551
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2552
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2552
2553
  "div",
2553
2554
  {
2554
2555
  style: {
@@ -2568,7 +2569,7 @@ var ColorPicker = ({
2568
2569
  )
2569
2570
  }
2570
2571
  ),
2571
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2572
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2572
2573
  "div",
2573
2574
  {
2574
2575
  role: "slider",
@@ -2591,7 +2592,7 @@ var ColorPicker = ({
2591
2592
  touchAction: "none",
2592
2593
  outline: "none"
2593
2594
  },
2594
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2595
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2595
2596
  "div",
2596
2597
  {
2597
2598
  style: {
@@ -2611,7 +2612,7 @@ var ColorPicker = ({
2611
2612
  )
2612
2613
  }
2613
2614
  ),
2614
- alpha && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2615
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2615
2616
  "div",
2616
2617
  {
2617
2618
  role: "slider",
@@ -2637,7 +2638,7 @@ var ColorPicker = ({
2637
2638
  overflow: "hidden"
2638
2639
  },
2639
2640
  children: [
2640
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2641
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2641
2642
  "div",
2642
2643
  {
2643
2644
  style: {
@@ -2647,7 +2648,7 @@ var ColorPicker = ({
2647
2648
  }
2648
2649
  }
2649
2650
  ),
2650
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2651
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2651
2652
  "div",
2652
2653
  {
2653
2654
  style: {
@@ -2668,8 +2669,8 @@ var ColorPicker = ({
2668
2669
  ]
2669
2670
  }
2670
2671
  ),
2671
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2672
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2672
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2673
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2673
2674
  "div",
2674
2675
  {
2675
2676
  style: {
@@ -2683,7 +2684,7 @@ var ColorPicker = ({
2683
2684
  flexShrink: 0,
2684
2685
  border: "1px solid rgba(255,255,255,0.15)"
2685
2686
  },
2686
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2687
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2687
2688
  "div",
2688
2689
  {
2689
2690
  style: {
@@ -2695,7 +2696,7 @@ var ColorPicker = ({
2695
2696
  )
2696
2697
  }
2697
2698
  ),
2698
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2699
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2699
2700
  "input",
2700
2701
  {
2701
2702
  type: "text",
@@ -2725,7 +2726,7 @@ var ColorPicker = ({
2725
2726
  }
2726
2727
  }
2727
2728
  ),
2728
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2729
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2729
2730
  "button",
2730
2731
  {
2731
2732
  type: "button",
@@ -2745,7 +2746,7 @@ var ColorPicker = ({
2745
2746
  color: "inherit",
2746
2747
  cursor: disabled ? "default" : "pointer"
2747
2748
  },
2748
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2749
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2749
2750
  "svg",
2750
2751
  {
2751
2752
  width: "14",
@@ -2757,16 +2758,16 @@ var ColorPicker = ({
2757
2758
  strokeLinecap: "round",
2758
2759
  strokeLinejoin: "round",
2759
2760
  children: [
2760
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2761
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2762
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m14 6 4 4" })
2761
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2762
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2763
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m14 6 4 4" })
2763
2764
  ]
2764
2765
  }
2765
2766
  )
2766
2767
  }
2767
2768
  )
2768
2769
  ] }),
2769
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2770
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2770
2771
  "div",
2771
2772
  {
2772
2773
  role: "note",
@@ -2782,10 +2783,10 @@ var ColorPicker = ({
2782
2783
  borderRadius: "4px",
2783
2784
  alignSelf: "flex-start"
2784
2785
  },
2785
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2786
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2786
2787
  }
2787
2788
  ),
2788
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2789
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2789
2790
  "div",
2790
2791
  {
2791
2792
  style: {
@@ -2799,15 +2800,15 @@ var ColorPicker = ({
2799
2800
  border: "1px solid rgba(255,255,255,0.1)"
2800
2801
  },
2801
2802
  children: [
2802
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
2803
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
2803
2804
  "Contrast: ",
2804
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
2805
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { children: [
2805
2806
  contrastResult.ratio.toFixed(2),
2806
2807
  ":1"
2807
2808
  ] })
2808
2809
  ] }),
2809
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2810
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2810
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2811
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2811
2812
  "span",
2812
2813
  {
2813
2814
  style: {
@@ -2820,7 +2821,7 @@ var ColorPicker = ({
2820
2821
  ]
2821
2822
  }
2822
2823
  ),
2823
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2824
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2824
2825
  "span",
2825
2826
  {
2826
2827
  style: {
@@ -2837,9 +2838,9 @@ var ColorPicker = ({
2837
2838
  ]
2838
2839
  }
2839
2840
  ),
2840
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2841
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2842
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2841
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2842
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2843
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2843
2844
  "button",
2844
2845
  {
2845
2846
  type: "button",
@@ -2865,9 +2866,9 @@ var ColorPicker = ({
2865
2866
  `${color}-${idx}`
2866
2867
  )) })
2867
2868
  ] }),
2868
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2869
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2870
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2869
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2870
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2871
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2871
2872
  "button",
2872
2873
  {
2873
2874
  type: "button",
@@ -2898,9 +2899,9 @@ var ColorPicker = ({
2898
2899
  };
2899
2900
 
2900
2901
  // src/color/DualColorPicker.tsx
2901
- var import_react15 = require("react");
2902
+ var import_react16 = require("react");
2902
2903
  var import_color2 = require("@pixerate/editor/color");
2903
- var import_jsx_runtime13 = require("react/jsx-runtime");
2904
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2904
2905
  function DualColorPicker({
2905
2906
  value,
2906
2907
  onChange,
@@ -2915,8 +2916,8 @@ function DualColorPicker({
2915
2916
  disabled = false,
2916
2917
  className = ""
2917
2918
  }) {
2918
- const sameId = (0, import_react15.useId)();
2919
- const [internalScheme, setInternalScheme] = (0, import_react15.useState)("light");
2919
+ const sameId = (0, import_react16.useId)();
2920
+ const [internalScheme, setInternalScheme] = (0, import_react16.useState)("light");
2920
2921
  const activeScheme = controlledScheme ?? internalScheme;
2921
2922
  const handleSchemeSelect = (nextScheme) => {
2922
2923
  if (onSchemeChange) {
@@ -2927,7 +2928,7 @@ function DualColorPicker({
2927
2928
  };
2928
2929
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2929
2930
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2930
- const [sameInBoth, setSameInBoth] = (0, import_react15.useState)(isSame);
2931
+ const [sameInBoth, setSameInBoth] = (0, import_react16.useState)(isSame);
2931
2932
  const handleSameToggle = (e) => {
2932
2933
  const nextSame = e.target.checked;
2933
2934
  setSameInBoth(nextSame);
@@ -2959,7 +2960,7 @@ function DualColorPicker({
2959
2960
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2960
2961
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2961
2962
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2962
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2963
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2963
2964
  "div",
2964
2965
  {
2965
2966
  className: `pixerate-dual-color-picker ${className}`,
@@ -2978,7 +2979,7 @@ function DualColorPicker({
2978
2979
  boxSizing: "border-box"
2979
2980
  },
2980
2981
  children: [
2981
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2982
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2982
2983
  "div",
2983
2984
  {
2984
2985
  role: "tablist",
@@ -2991,7 +2992,7 @@ function DualColorPicker({
2991
2992
  gap: "2px"
2992
2993
  },
2993
2994
  children: [
2994
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2995
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2995
2996
  "button",
2996
2997
  {
2997
2998
  type: "button",
@@ -3014,7 +3015,7 @@ function DualColorPicker({
3014
3015
  children: "Light"
3015
3016
  }
3016
3017
  ),
3017
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3018
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3018
3019
  "button",
3019
3020
  {
3020
3021
  type: "button",
@@ -3040,8 +3041,8 @@ function DualColorPicker({
3040
3041
  ]
3041
3042
  }
3042
3043
  ),
3043
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3044
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3044
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3045
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3045
3046
  "button",
3046
3047
  {
3047
3048
  type: "button",
@@ -3063,7 +3064,7 @@ function DualColorPicker({
3063
3064
  outline: "none"
3064
3065
  },
3065
3066
  children: [
3066
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3067
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3067
3068
  "span",
3068
3069
  {
3069
3070
  style: {
@@ -3075,11 +3076,11 @@ function DualColorPicker({
3075
3076
  }
3076
3077
  }
3077
3078
  ),
3078
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3079
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3079
3080
  ]
3080
3081
  }
3081
3082
  ),
3082
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3083
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3083
3084
  "button",
3084
3085
  {
3085
3086
  type: "button",
@@ -3101,7 +3102,7 @@ function DualColorPicker({
3101
3102
  outline: "none"
3102
3103
  },
3103
3104
  children: [
3104
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3105
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3105
3106
  "span",
3106
3107
  {
3107
3108
  style: {
@@ -3113,12 +3114,12 @@ function DualColorPicker({
3113
3114
  }
3114
3115
  }
3115
3116
  ),
3116
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3117
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3117
3118
  ]
3118
3119
  }
3119
3120
  )
3120
3121
  ] }),
3121
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3122
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3122
3123
  "div",
3123
3124
  {
3124
3125
  style: {
@@ -3129,7 +3130,7 @@ function DualColorPicker({
3129
3130
  padding: "2px 0"
3130
3131
  },
3131
3132
  children: [
3132
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3133
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3133
3134
  "label",
3134
3135
  {
3135
3136
  htmlFor: sameId,
@@ -3143,7 +3144,7 @@ function DualColorPicker({
3143
3144
  color: "#c4cad4"
3144
3145
  },
3145
3146
  children: [
3146
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3147
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3147
3148
  "input",
3148
3149
  {
3149
3150
  id: sameId,
@@ -3154,11 +3155,11 @@ function DualColorPicker({
3154
3155
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3155
3156
  }
3156
3157
  ),
3157
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "Same in both" })
3158
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Same in both" })
3158
3159
  ]
3159
3160
  }
3160
3161
  ),
3161
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3162
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3162
3163
  "button",
3163
3164
  {
3164
3165
  type: "button",
@@ -3180,7 +3181,7 @@ function DualColorPicker({
3180
3181
  ]
3181
3182
  }
3182
3183
  ),
3183
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3184
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3184
3185
  "div",
3185
3186
  {
3186
3187
  "data-testid": "dual-contrast-summary",
@@ -3194,20 +3195,20 @@ function DualColorPicker({
3194
3195
  color: "#8c95a6"
3195
3196
  },
3196
3197
  children: [
3197
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
3198
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
3198
3199
  "Light:",
3199
3200
  " ",
3200
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3201
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3201
3202
  dualContrast.light.ratio.toFixed(2),
3202
3203
  " (",
3203
3204
  dualContrast.light.level,
3204
3205
  ")"
3205
3206
  ] })
3206
3207
  ] }),
3207
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
3208
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
3208
3209
  "Dark:",
3209
3210
  " ",
3210
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3211
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3211
3212
  dualContrast.dark.ratio.toFixed(2),
3212
3213
  " (",
3213
3214
  dualContrast.dark.level,
@@ -3217,7 +3218,7 @@ function DualColorPicker({
3217
3218
  ]
3218
3219
  }
3219
3220
  ),
3220
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3221
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3221
3222
  ColorPicker,
3222
3223
  {
3223
3224
  value: activeColor,
@@ -3236,7 +3237,7 @@ function DualColorPicker({
3236
3237
  }
3237
3238
 
3238
3239
  // src/color/useColorScheme.ts
3239
- var import_react16 = require("react");
3240
+ var import_react17 = require("react");
3240
3241
  var import_color3 = require("@pixerate/editor/color");
3241
3242
  function getSnapshot(attribute) {
3242
3243
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3261,7 +3262,7 @@ function getServerSnapshot() {
3261
3262
  function useColorScheme(options) {
3262
3263
  const override = options?.override;
3263
3264
  const attribute = options?.attribute;
3264
- const subscribe = (0, import_react16.useMemo)(() => {
3265
+ const subscribe = (0, import_react17.useMemo)(() => {
3265
3266
  return (callback) => {
3266
3267
  if (typeof window === "undefined" || typeof document === "undefined") {
3267
3268
  return () => {
@@ -3287,7 +3288,7 @@ function useColorScheme(options) {
3287
3288
  };
3288
3289
  };
3289
3290
  }, [attribute]);
3290
- const detected = (0, import_react16.useSyncExternalStore)(
3291
+ const detected = (0, import_react17.useSyncExternalStore)(
3291
3292
  subscribe,
3292
3293
  () => getSnapshot(attribute),
3293
3294
  getServerSnapshot
@@ -3304,7 +3305,7 @@ function useResolvedColor(value, scheme) {
3304
3305
  __reExport(color_exports, require("@pixerate/editor/color"));
3305
3306
 
3306
3307
  // src/parameters/fields.tsx
3307
- var import_jsx_runtime14 = require("react/jsx-runtime");
3308
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3308
3309
  var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
3309
3310
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
3310
3311
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -3328,7 +3329,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3328
3329
  onKeyDown: keyDown,
3329
3330
  ...rest
3330
3331
  };
3331
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "text", ...props }, value);
3332
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "text", ...props }, value);
3332
3333
  }
3333
3334
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3334
3335
  function ParameterNumberInput({
@@ -3339,8 +3340,8 @@ function ParameterNumberInput({
3339
3340
  id,
3340
3341
  "aria-label": ariaLabel
3341
3342
  }) {
3342
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3343
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3343
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3344
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3344
3345
  ParameterCommitInput,
3345
3346
  {
3346
3347
  id,
@@ -3362,21 +3363,21 @@ function ParameterNumberInput({
3362
3363
  }
3363
3364
  }
3364
3365
  ),
3365
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3366
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3366
3367
  ] });
3367
3368
  }
3368
3369
  function ParameterSlider(props) {
3369
3370
  const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
3370
- const dragging = (0, import_react17.useRef)(false);
3371
+ const dragging = (0, import_react18.useRef)(false);
3371
3372
  const end = () => {
3372
3373
  if (!dragging.current) return;
3373
3374
  dragging.current = false;
3374
3375
  onGestureEnd?.();
3375
3376
  };
3376
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterNumberInput, { ...props });
3377
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props });
3377
3378
  const step = (0, import_parameters.parameterStep)(field);
3378
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
3379
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3379
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
3380
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3380
3381
  "input",
3381
3382
  {
3382
3383
  type: "range",
@@ -3399,11 +3400,11 @@ function ParameterSlider(props) {
3399
3400
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3400
3401
  }
3401
3402
  ),
3402
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3403
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3403
3404
  ] });
3404
3405
  }
3405
3406
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3406
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3407
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3407
3408
  "button",
3408
3409
  {
3409
3410
  type: "button",
@@ -3414,7 +3415,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3414
3415
  disabled: disabled || field.readOnly,
3415
3416
  onClick: () => onChange(!value),
3416
3417
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
3417
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3418
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3418
3419
  "span",
3419
3420
  {
3420
3421
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3427,7 +3428,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
3427
3428
  const options = (0, import_parameters.getChoiceOptions)(field);
3428
3429
  const off = disabled || field.readOnly;
3429
3430
  if (field.control === "segmented") {
3430
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3431
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3431
3432
  "button",
3432
3433
  {
3433
3434
  type: "button",
@@ -3443,7 +3444,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
3443
3444
  )) });
3444
3445
  }
3445
3446
  const index = options.findIndex((o) => o.value === value);
3446
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3447
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3447
3448
  "select",
3448
3449
  {
3449
3450
  id,
@@ -3455,22 +3456,22 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
3455
3456
  if (option) onChange(option.value);
3456
3457
  },
3457
3458
  className: parameterInputClass,
3458
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3459
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3459
3460
  }
3460
3461
  );
3461
3462
  }
3462
3463
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
3463
- const [open, setOpen] = (0, import_react17.useState)(false);
3464
- const containerRef = (0, import_react17.useRef)(null);
3465
- const buttonRef = (0, import_react17.useRef)(null);
3466
- const popoverRef = (0, import_react17.useRef)(null);
3464
+ const [open, setOpen] = (0, import_react18.useState)(false);
3465
+ const containerRef = (0, import_react18.useRef)(null);
3466
+ const buttonRef = (0, import_react18.useRef)(null);
3467
+ const popoverRef = (0, import_react18.useRef)(null);
3467
3468
  const alpha = !!field.alpha;
3468
3469
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3469
3470
  const rgb = hex.slice(0, 7);
3470
3471
  const shown = alpha ? hex : rgb;
3471
3472
  const off = disabled || field.readOnly;
3472
3473
  const name = (0, import_parameters.parameterLabel)(field);
3473
- (0, import_react17.useEffect)(() => {
3474
+ (0, import_react18.useEffect)(() => {
3474
3475
  if (!open) return;
3475
3476
  const onPointerDown = (e) => {
3476
3477
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3491,9 +3492,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3491
3492
  window.removeEventListener("keydown", onKeyDown, true);
3492
3493
  };
3493
3494
  }, [open]);
3494
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3495
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
3496
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3495
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3496
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
3497
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3497
3498
  "button",
3498
3499
  {
3499
3500
  ref: buttonRef,
@@ -3504,10 +3505,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3504
3505
  disabled: off,
3505
3506
  onClick: () => setOpen((prev) => !prev),
3506
3507
  className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
3507
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3508
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3508
3509
  }
3509
3510
  ),
3510
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3511
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3511
3512
  ParameterCommitInput,
3512
3513
  {
3513
3514
  id,
@@ -3523,7 +3524,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3523
3524
  }
3524
3525
  )
3525
3526
  ] }),
3526
- open && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3527
+ open && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3527
3528
  "div",
3528
3529
  {
3529
3530
  ref: popoverRef,
@@ -3537,7 +3538,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3537
3538
  },
3538
3539
  className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
3539
3540
  style: { background: "var(--popover, var(--background, #fff))" },
3540
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3541
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3541
3542
  ColorPicker,
3542
3543
  {
3543
3544
  value: shown,
@@ -3555,11 +3556,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3555
3556
  }
3556
3557
  function ParameterVector({ field, value, onChange, disabled, id }) {
3557
3558
  const size = (0, import_parameters.vectorSize)(field);
3558
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3559
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3559
3560
  const component = (0, import_parameters.vectorComponentField)(field, i);
3560
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3561
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3562
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3561
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3562
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3563
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3563
3564
  ParameterNumberInput,
3564
3565
  {
3565
3566
  field: component,
@@ -3576,11 +3577,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
3576
3577
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3577
3578
  const off = disabled || field.readOnly;
3578
3579
  const name = (0, import_parameters.parameterLabel)(field);
3579
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1.5", children: [
3580
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
3581
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3582
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3583
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3580
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1.5", children: [
3581
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
3582
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3583
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3584
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3584
3585
  ParameterCommitInput,
3585
3586
  {
3586
3587
  id,
@@ -3591,10 +3592,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3591
3592
  onCommit: (text) => onChange(text.trim())
3592
3593
  }
3593
3594
  ),
3594
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex gap-1", children: [
3595
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
3595
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
3596
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
3596
3597
  "Choose file\u2026",
3597
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3598
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3598
3599
  "input",
3599
3600
  {
3600
3601
  type: "file",
@@ -3610,11 +3611,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3610
3611
  }
3611
3612
  )
3612
3613
  ] }),
3613
- value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
3614
+ value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
3614
3615
  ] })
3615
3616
  ] })
3616
3617
  ] }),
3617
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3618
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3618
3619
  "button",
3619
3620
  {
3620
3621
  type: "button",
@@ -3624,14 +3625,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3624
3625
  disabled: off,
3625
3626
  onClick: () => onChange(o.url),
3626
3627
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3627
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3628
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3628
3629
  },
3629
3630
  o.url
3630
3631
  )) })
3631
3632
  ] });
3632
3633
  }
3633
3634
  function ParameterText({ field, value, onChange, disabled, id }) {
3634
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3635
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3635
3636
  ParameterCommitInput,
3636
3637
  {
3637
3638
  id,
@@ -3650,24 +3651,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3650
3651
  switch (field.type) {
3651
3652
  case "number":
3652
3653
  case "int":
3653
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3654
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3654
3655
  case "boolean":
3655
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3656
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3656
3657
  case "choice":
3657
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3658
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3658
3659
  case "color":
3659
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3660
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3660
3661
  case "vector":
3661
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3662
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3662
3663
  case "image":
3663
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3664
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3664
3665
  case "text":
3665
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3666
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3666
3667
  }
3667
3668
  }
3668
3669
 
3669
3670
  // src/effects/EffectParameters.tsx
3670
- var import_jsx_runtime15 = require("react/jsx-runtime");
3671
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3671
3672
  function EffectParameters({
3672
3673
  description,
3673
3674
  values,
@@ -3681,12 +3682,12 @@ function EffectParameters({
3681
3682
  disabled = false,
3682
3683
  className = ""
3683
3684
  }) {
3684
- const fields = (0, import_react18.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3685
- const idBase = (0, import_react18.useId)();
3686
- const gesture = import_react18.default.useRef(null);
3687
- const count = import_react18.default.useRef(0);
3688
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3689
- (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3685
+ const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3686
+ const idBase = (0, import_react19.useId)();
3687
+ const gesture = import_react19.default.useRef(null);
3688
+ const count = import_react19.default.useRef(0);
3689
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3690
+ (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3690
3691
  "select",
3691
3692
  {
3692
3693
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -3704,8 +3705,8 @@ function EffectParameters({
3704
3705
  }
3705
3706
  },
3706
3707
  children: [
3707
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Presets\u2026" }),
3708
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: p.name, children: p.name }, p.name))
3708
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Presets\u2026" }),
3709
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: p.name, children: p.name }, p.name))
3709
3710
  ]
3710
3711
  }
3711
3712
  ),
@@ -3715,14 +3716,14 @@ function EffectParameters({
3715
3716
  const keyed = keyframed?.has(field.id) ?? false;
3716
3717
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3717
3718
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3718
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3719
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3720
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3721
- keyed && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3719
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3720
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3721
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3722
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3722
3723
  renderControlAddon?.(field.id),
3723
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
3724
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
3724
3725
  ] }),
3725
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3726
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3726
3727
  ParameterFieldControl,
3727
3728
  {
3728
3729
  field,
@@ -3736,34 +3737,34 @@ function EffectParameters({
3736
3737
  )
3737
3738
  ] }, field.id);
3738
3739
  }),
3739
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3740
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3740
3741
  ] });
3741
3742
  }
3742
3743
 
3743
3744
  // src/image-editor/ImageEffectControls.tsx
3744
- var import_jsx_runtime16 = require("react/jsx-runtime");
3745
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3745
3746
  function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
3746
3747
  const { description, error } = useEffectDescription(provider, effect);
3747
3748
  let body;
3748
- if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
3749
+ if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
3749
3750
  'No effects provider: "',
3750
3751
  name ?? effect,
3751
3752
  '" is kept but not drawn.'
3752
3753
  ] });
3753
- else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
3754
- else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3755
- else body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
3756
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
3754
+ else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
3755
+ else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3756
+ else body = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset });
3757
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
3757
3758
  }
3758
3759
 
3759
3760
  // src/image-editor/ImageProviderEffectsPanel.tsx
3760
- var import_jsx_runtime17 = require("react/jsx-runtime");
3761
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3761
3762
  function ImageProviderEffectsPanel({ controller, className = "" }) {
3762
- const [, setTick] = (0, import_react19.useState)(0);
3763
- (0, import_react19.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3764
- const [browse, setBrowse] = (0, import_react19.useState)(null);
3765
- const [message, setMessage] = (0, import_react19.useState)(null);
3766
- const [open, setOpen] = (0, import_react19.useState)(null);
3763
+ const [, setTick] = (0, import_react20.useState)(0);
3764
+ (0, import_react20.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3765
+ const [browse, setBrowse] = (0, import_react20.useState)(null);
3766
+ const [message, setMessage] = (0, import_react20.useState)(null);
3767
+ const [open, setOpen] = (0, import_react20.useState)(null);
3767
3768
  const provider = controller.effectsProvider;
3768
3769
  const state = controller.getState();
3769
3770
  const layer = state.activeLayerId ? (0, import_image_editor9.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -3771,7 +3772,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3771
3772
  setMessage(null);
3772
3773
  Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
3773
3774
  };
3774
- const drags = import_react19.default.useRef(/* @__PURE__ */ new Set());
3775
+ const drags = import_react20.default.useRef(/* @__PURE__ */ new Set());
3775
3776
  const commit = (gesture) => {
3776
3777
  if (gesture) {
3777
3778
  if (!drags.current.has(gesture)) {
@@ -3785,21 +3786,21 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3785
3786
  const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
3786
3787
  const generator = layer?.type === "pixel" ? layer.generator : void 0;
3787
3788
  const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
3788
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
3789
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
3790
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
3791
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
3792
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
3789
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
3790
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3791
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
3792
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
3793
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
3793
3794
  ] }),
3794
- !provider && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
3795
- browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
3796
- browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
3797
- generator && layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
3798
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
3799
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
3800
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
3795
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
3796
+ browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
3797
+ browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EffectsBrowser, { provider, uses: ["generator", "overlay", "title"], title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
3798
+ generator && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
3799
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3800
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
3801
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
3801
3802
  ] }),
3802
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3803
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3803
3804
  ImageEffectControls,
3804
3805
  {
3805
3806
  provider,
@@ -3811,26 +3812,26 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3811
3812
  }
3812
3813
  )
3813
3814
  ] }),
3814
- filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
3815
+ filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
3815
3816
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
3816
3817
  const all = layer.smartFilters.filters;
3817
3818
  const index = all.indexOf(f);
3818
3819
  if (f.kind !== "effect") return null;
3819
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
3820
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
3821
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
3820
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
3821
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3822
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "checkbox", checked: f.enabled, "aria-label": `${label} on`, onChange: (e) => {
3822
3823
  const enabled = e.currentTarget.checked;
3823
3824
  run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }));
3824
3825
  } }),
3825
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
3826
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
3827
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
3828
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
3826
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
3827
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
3828
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
3829
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
3829
3830
  ] }),
3830
- open === f.id && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mt-1 space-y-2", children: [
3831
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1", children: [
3832
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
3833
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3831
+ open === f.id && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mt-1 space-y-2", children: [
3832
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
3833
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
3834
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3834
3835
  "input",
3835
3836
  {
3836
3837
  type: "range",
@@ -3847,7 +3848,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3847
3848
  }
3848
3849
  )
3849
3850
  ] }),
3850
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3851
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3851
3852
  ImageEffectControls,
3852
3853
  {
3853
3854
  provider,
@@ -3861,13 +3862,13 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
3861
3862
  ] })
3862
3863
  ] }, f.id);
3863
3864
  }) }),
3864
- !layer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
3865
- message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3865
+ !layer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
3866
+ message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3866
3867
  ] });
3867
3868
  }
3868
3869
 
3869
3870
  // src/image-editor/BrushOptionsBar.tsx
3870
- var import_react21 = require("react");
3871
+ var import_react22 = require("react");
3871
3872
  var import_image_editor11 = require("@pixerate/editor/image-editor");
3872
3873
  var import_image_editor12 = require("@pixerate/editor/image-editor");
3873
3874
 
@@ -3875,8 +3876,8 @@ var import_image_editor12 = require("@pixerate/editor/image-editor");
3875
3876
  var import_image_editor10 = require("@pixerate/editor/image-editor");
3876
3877
 
3877
3878
  // src/paint-editor/PaintGradientEditorView.tsx
3878
- var import_react20 = require("react");
3879
- var import_jsx_runtime18 = require("react/jsx-runtime");
3879
+ var import_react21 = require("react");
3880
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3880
3881
  var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
3881
3882
  var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
3882
3883
  var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
@@ -3897,7 +3898,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3897
3898
  reversePaintGradient,
3898
3899
  updatePaintGradientStop
3899
3900
  } = kit;
3900
- const [selected, setSelected] = (0, import_react20.useState)(0);
3901
+ const [selected, setSelected] = (0, import_react21.useState)(0);
3901
3902
  const sel = Math.min(selected, value.stops.length - 1);
3902
3903
  const stop = value.stops[sel];
3903
3904
  const map = value.map;
@@ -3907,15 +3908,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3907
3908
  setSelected(r.index);
3908
3909
  onChange(r.paint);
3909
3910
  };
3910
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
3911
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3912
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
3913
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Presets\u2026" }),
3914
- PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: i, children: p.name }, p.name))
3911
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
3912
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3913
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
3914
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "Presets\u2026" }),
3915
+ PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: i, children: p.name }, p.name))
3915
3916
  ] }),
3916
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
3917
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
3917
3918
  ] }),
3918
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3919
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3919
3920
  "div",
3920
3921
  {
3921
3922
  role: "slider",
@@ -3937,7 +3938,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3937
3938
  }
3938
3939
  }
3939
3940
  ),
3940
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3941
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3941
3942
  "button",
3942
3943
  {
3943
3944
  type: "button",
@@ -3949,63 +3950,63 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
3949
3950
  },
3950
3951
  i
3951
3952
  )) }),
3952
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
3953
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
3954
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "color", children: "Colour" }),
3955
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "paint", children: "Paint colour" }),
3956
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "secondary", children: "Second colour" })
3953
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
3954
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
3955
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "color", children: "Colour" }),
3956
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "paint", children: "Paint colour" }),
3957
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "secondary", children: "Second colour" })
3957
3958
  ] }),
3958
- stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
3959
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
3959
+ stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
3960
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3960
3961
  "At",
3961
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
3962
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
3962
3963
  "%"
3963
3964
  ] }),
3964
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
3965
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3965
3966
  "Opacity",
3966
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
3967
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
3967
3968
  "%"
3968
3969
  ] }),
3969
- sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1", children: [
3970
+ sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-1", children: [
3970
3971
  "Midpoint",
3971
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
3972
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
3972
3973
  "%"
3973
3974
  ] }),
3974
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
3975
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
3975
3976
  ] }),
3976
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
3977
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
3978
- map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
3979
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3980
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
3981
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "px", children: "px" }),
3982
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "dabs", children: "dabs" })
3977
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
3978
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
3979
+ map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3980
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3981
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
3982
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "px", children: "px" }),
3983
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "dabs", children: "dabs" })
3983
3984
  ] })
3984
3985
  ] }),
3985
- map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3986
- map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
3987
- (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
3986
+ map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
3987
+ map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
3988
+ (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
3988
3989
  ] }),
3989
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3990
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
3991
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
3990
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3991
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
3992
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
3992
3993
  "Softness",
3993
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
3994
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
3994
3995
  ] })
3995
3996
  ] })
3996
3997
  ] });
3997
3998
  };
3998
3999
 
3999
4000
  // src/image-editor/PaintGradientEditor.tsx
4000
- var import_jsx_runtime19 = require("react/jsx-runtime");
4001
- var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor10.PAINT_GRADIENT_KIT });
4001
+ var import_jsx_runtime20 = require("react/jsx-runtime");
4002
+ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor10.PAINT_GRADIENT_KIT });
4002
4003
 
4003
4004
  // src/image-editor/BrushOptionsBar.tsx
4004
- var import_jsx_runtime20 = require("react/jsx-runtime");
4005
+ var import_jsx_runtime21 = require("react/jsx-runtime");
4005
4006
  var BrushOptionsBar = ({ controller, className }) => {
4006
- const [, setTick] = (0, import_react21.useState)(0);
4007
- (0, import_react21.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4008
- const [error, setError] = (0, import_react21.useState)(null);
4007
+ const [, setTick] = (0, import_react22.useState)(0);
4008
+ (0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4009
+ const [error, setError] = (0, import_react22.useState)(null);
4009
4010
  const state = controller.getState();
4010
4011
  const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
4011
4012
  const tool = state.activeTool;
@@ -4017,8 +4018,8 @@ var BrushOptionsBar = ({ controller, className }) => {
4017
4018
  setError((0, import_image_editor12.userErrorMessage)(err));
4018
4019
  }
4019
4020
  };
4020
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
4021
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4021
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
4022
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4022
4023
  "button",
4023
4024
  {
4024
4025
  type: "button",
@@ -4030,9 +4031,9 @@ var BrushOptionsBar = ({ controller, className }) => {
4030
4031
  },
4031
4032
  t.id
4032
4033
  )) }),
4033
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
4034
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
4035
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4034
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
4035
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4036
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4036
4037
  "input",
4037
4038
  {
4038
4039
  type: "color",
@@ -4042,10 +4043,10 @@ var BrushOptionsBar = ({ controller, className }) => {
4042
4043
  className: imageColorInputClass
4043
4044
  }
4044
4045
  ),
4045
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "FG" })
4046
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "FG" })
4046
4047
  ] }),
4047
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
4048
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4048
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4049
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4049
4050
  "input",
4050
4051
  {
4051
4052
  type: "color",
@@ -4055,11 +4056,11 @@ var BrushOptionsBar = ({ controller, className }) => {
4055
4056
  className: imageColorInputClass
4056
4057
  }
4057
4058
  ),
4058
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: "BG" })
4059
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "BG" })
4059
4060
  ] }),
4060
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
4061
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
4062
- state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4061
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
4062
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
4063
+ state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4063
4064
  "button",
4064
4065
  {
4065
4066
  type: "button",
@@ -4071,8 +4072,8 @@ var BrushOptionsBar = ({ controller, className }) => {
4071
4072
  }
4072
4073
  )
4073
4074
  ] }),
4074
- state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
4075
- import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4075
+ state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
4076
+ import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4076
4077
  ControlSlider,
4077
4078
  {
4078
4079
  spec,
@@ -4081,9 +4082,9 @@ var BrushOptionsBar = ({ controller, className }) => {
4081
4082
  },
4082
4083
  spec.id
4083
4084
  )),
4084
- state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
4085
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
4086
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4085
+ state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
4086
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
4087
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4087
4088
  "span",
4088
4089
  {
4089
4090
  "aria-label": "Brush load",
@@ -4092,10 +4093,10 @@ var BrushOptionsBar = ({ controller, className }) => {
4092
4093
  style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
4093
4094
  }
4094
4095
  ),
4095
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
4096
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
4096
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
4097
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
4097
4098
  ] }),
4098
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4099
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4099
4100
  "button",
4100
4101
  {
4101
4102
  type: "button",
@@ -4107,52 +4108,34 @@ var BrushOptionsBar = ({ controller, className }) => {
4107
4108
  },
4108
4109
  m.id
4109
4110
  )) }),
4110
- import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
4111
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
4112
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4113
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4114
- "input",
4115
- {
4116
- type: "checkbox",
4117
- "aria-label": "Load the brush after each stroke",
4118
- checked: mixer.loadEachStroke,
4119
- onChange: (e) => controller.setPaintOptions({ mixer: { loadEachStroke: e.target.checked } }),
4120
- className: "accent-primary"
4121
- }
4122
- ),
4111
+ import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
4112
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
4113
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4114
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
4123
4115
  "Load each stroke"
4124
4116
  ] }),
4125
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4126
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4127
- "input",
4128
- {
4129
- type: "checkbox",
4130
- "aria-label": "Clean the brush after each stroke",
4131
- checked: mixer.cleanEachStroke,
4132
- onChange: (e) => controller.setPaintOptions({ mixer: { cleanEachStroke: e.target.checked } }),
4133
- className: "accent-primary"
4134
- }
4135
- ),
4117
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
4136
4119
  "Clean each stroke"
4137
4120
  ] })
4138
4121
  ] })
4139
4122
  ] }),
4140
- (0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
4141
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
4142
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
4143
- cloneSource && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
4123
+ (0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
4124
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
4125
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
4126
+ cloneSource && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
4144
4127
  ] }),
4145
- (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
4146
- import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
4147
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
4148
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
4149
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
4150
- !(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
4128
+ (tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
4129
+ import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
4130
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
4131
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
4132
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
4133
+ !(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
4151
4134
  ] })
4152
4135
  ] }),
4153
- import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
4154
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
4155
- choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4136
+ import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
4137
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
4138
+ choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4156
4139
  "button",
4157
4140
  {
4158
4141
  type: "button",
@@ -4165,70 +4148,43 @@ var BrushOptionsBar = ({ controller, className }) => {
4165
4148
  o.id
4166
4149
  ))
4167
4150
  ] }, choice.id)),
4168
- import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
4169
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4170
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4171
- "input",
4172
- {
4173
- type: "checkbox",
4174
- "aria-label": t.label,
4175
- checked: retouch[t.id],
4176
- onChange: (e) => controller.setPaintOptions({ retouch: { [t.id]: e.target.checked } }),
4177
- className: "accent-primary"
4178
- }
4179
- ),
4151
+ import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
4152
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4153
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
4180
4154
  t.label
4181
4155
  ] }, t.id)) })
4182
4156
  ] }),
4183
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
4184
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4185
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4186
- "input",
4187
- {
4188
- type: "checkbox",
4189
- "aria-label": "Pressure controls size",
4190
- checked: brush.pressureSize,
4191
- onChange: (e) => controller.setPaintOptions({ brush: { pressureSize: e.target.checked } }),
4192
- className: "accent-primary"
4193
- }
4194
- ),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
4158
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4159
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
4195
4160
  "Pressure size"
4196
4161
  ] }),
4197
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4198
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4199
- "input",
4200
- {
4201
- type: "checkbox",
4202
- "aria-label": "Pressure controls opacity",
4203
- checked: brush.pressureOpacity,
4204
- onChange: (e) => controller.setPaintOptions({ brush: { pressureOpacity: e.target.checked } }),
4205
- className: "accent-primary"
4206
- }
4207
- ),
4162
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4163
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
4208
4164
  "Pressure opacity"
4209
4165
  ] })
4210
4166
  ] }),
4211
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", children: [
4212
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
4213
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
4167
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex gap-1", children: [
4168
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
4169
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
4214
4170
  ] }),
4215
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4171
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4216
4172
  ] });
4217
4173
  };
4218
4174
 
4219
4175
  // src/image-editor/ColorProfilePanel.tsx
4220
- var import_react22 = require("react");
4176
+ var import_react23 = require("react");
4221
4177
  var import_image_editor13 = require("@pixerate/editor/image-editor");
4222
- var import_jsx_runtime21 = require("react/jsx-runtime");
4178
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4223
4179
  var chip = imageChipClass(false);
4224
4180
  var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
4225
4181
  var ColorProfilePanel = ({ controller, className }) => {
4226
- const [, setTick] = (0, import_react22.useState)(0);
4227
- (0, import_react22.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4228
- const [target, setTarget] = (0, import_react22.useState)("display-p3");
4229
- const [intent, setIntent] = (0, import_react22.useState)("relative");
4230
- const [bpc, setBpc] = (0, import_react22.useState)(true);
4231
- const [error, setError] = (0, import_react22.useState)(null);
4182
+ const [, setTick] = (0, import_react23.useState)(0);
4183
+ (0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4184
+ const [target, setTarget] = (0, import_react23.useState)("display-p3");
4185
+ const [intent, setIntent] = (0, import_react23.useState)("relative");
4186
+ const [bpc, setBpc] = (0, import_react23.useState)(true);
4187
+ const [error, setError] = (0, import_react23.useState)(null);
4232
4188
  const view = (0, import_image_editor13.colorPanelView)(controller);
4233
4189
  const attempt = (fn) => {
4234
4190
  try {
@@ -4250,29 +4206,29 @@ var ColorProfilePanel = ({ controller, className }) => {
4250
4206
  })
4251
4207
  );
4252
4208
  };
4253
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
4254
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
4255
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
4256
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
4209
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
4210
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
4211
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
4212
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
4257
4213
  ] }),
4258
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
4259
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
4260
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4261
- view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
4214
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
4215
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
4216
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4217
+ view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
4262
4218
  ] }),
4263
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
4264
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4265
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4266
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4267
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
4219
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
4220
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4221
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
4222
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4223
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
4268
4224
  "BPC"
4269
4225
  ] }),
4270
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
4271
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
4226
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
4227
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
4272
4228
  ] }),
4273
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
4274
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
4275
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4229
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
4230
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
4231
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4276
4232
  "select",
4277
4233
  {
4278
4234
  "aria-label": "Proof profile",
@@ -4280,31 +4236,31 @@ var ColorProfilePanel = ({ controller, className }) => {
4280
4236
  value: view.proof?.id ?? "",
4281
4237
  onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
4282
4238
  children: [
4283
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "Off" }),
4284
- import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, children: o.label }, o.id))
4239
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Off" }),
4240
+ import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id))
4285
4241
  ]
4286
4242
  }
4287
4243
  ),
4288
- view.proof && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
4289
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4290
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4291
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
4244
+ view.proof && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4245
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
4246
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4247
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
4292
4248
  "Paper"
4293
4249
  ] }),
4294
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
4295
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
4250
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
4251
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
4296
4252
  "Gamut warning"
4297
4253
  ] })
4298
4254
  ] })
4299
4255
  ] }),
4300
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4256
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4301
4257
  ] });
4302
4258
  };
4303
4259
 
4304
4260
  // src/image-editor/SelectionOptionsBar.tsx
4305
- var import_react23 = require("react");
4261
+ var import_react24 = require("react");
4306
4262
  var import_image_editor14 = require("@pixerate/editor/image-editor");
4307
- var import_jsx_runtime22 = require("react/jsx-runtime");
4263
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4308
4264
  var MODIFY_OPS = [
4309
4265
  { op: "grow", label: "Grow" },
4310
4266
  { op: "shrink", label: "Shrink" },
@@ -4321,72 +4277,59 @@ var SelectionOptionsBar = ({
4321
4277
  quickMask,
4322
4278
  className = ""
4323
4279
  }) => {
4324
- const [radius, setRadius] = (0, import_react23.useState)(2);
4280
+ const [radius, setRadius] = (0, import_react24.useState)(2);
4325
4281
  const set = (patch) => onOptionsChange({ ...options, ...patch });
4326
4282
  const sel = selection === void 0 ? controller.getSelection() : selection;
4327
4283
  const qm = quickMask ?? Boolean(controller.getState().quickMask);
4328
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4329
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
4330
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
4331
- options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-2", children: [
4332
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex flex-col gap-1", children: [
4333
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4334
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Tolerance" }),
4335
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-mono", children: options.tolerance })
4284
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4285
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
4286
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
4287
+ options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", children: [
4288
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
4289
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4290
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Tolerance" }),
4291
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-mono", children: options.tolerance })
4336
4292
  ] }),
4337
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4338
- "input",
4339
- {
4340
- type: "range",
4341
- min: 0,
4342
- max: 255,
4343
- step: 1,
4344
- "aria-label": "Tolerance",
4345
- value: options.tolerance,
4346
- onChange: (e) => set({ tolerance: Number(e.target.value) }),
4347
- className: imageRangeClass
4348
- }
4349
- )
4293
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
4350
4294
  ] }),
4351
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4352
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.contiguous, onChange: (e) => set({ contiguous: e.target.checked }) }),
4295
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4296
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
4353
4297
  "Contiguous"
4354
4298
  ] }),
4355
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4356
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.sampleMerged, onChange: (e) => set({ sampleMerged: e.target.checked }) }),
4299
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4300
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
4357
4301
  "Sample adjusted image"
4358
4302
  ] }),
4359
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4303
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4360
4304
  "Sample",
4361
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4362
- "select",
4305
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4306
+ ImageSelect,
4363
4307
  {
4364
- "aria-label": "Sample from",
4308
+ label: "Sample from",
4365
4309
  value: options.sample ?? "composite",
4366
- onChange: (e) => set({ sample: e.target.value }),
4367
- className: "bg-muted border border-border rounded px-1 py-0.5",
4368
- children: [
4369
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "composite", children: "All layers" }),
4370
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "active-layer", children: "Active layer" })
4371
- ]
4310
+ options: [
4311
+ { value: "composite", label: "All layers" },
4312
+ { value: "active-layer", label: "Active layer" }
4313
+ ],
4314
+ onChange: (v) => set({ sample: v })
4372
4315
  }
4373
4316
  )
4374
4317
  ] })
4375
4318
  ] }),
4376
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4377
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: options.antiAlias, onChange: (e) => set({ antiAlias: e.target.checked }) }),
4319
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4320
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
4378
4321
  "Anti-alias"
4379
4322
  ] }),
4380
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4381
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
4382
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
4383
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
4384
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
4323
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4324
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
4325
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
4326
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
4327
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
4385
4328
  ] }),
4386
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4387
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4329
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4330
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4388
4331
  "Radius",
4389
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4332
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4390
4333
  "input",
4391
4334
  {
4392
4335
  type: "number",
@@ -4400,24 +4343,24 @@ var SelectionOptionsBar = ({
4400
4343
  }
4401
4344
  )
4402
4345
  ] }),
4403
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
4346
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
4404
4347
  ] }),
4405
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
4348
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
4406
4349
  ] });
4407
4350
  };
4408
4351
 
4409
4352
  // src/image-editor/RefineEdgePanel.tsx
4410
- var import_react24 = require("react");
4353
+ var import_react25 = require("react");
4411
4354
  var import_image_editor15 = require("@pixerate/editor/image-editor");
4412
- var import_jsx_runtime23 = require("react/jsx-runtime");
4355
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4413
4356
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
4414
4357
  var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
4415
4358
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4416
- const [params, setParams] = (0, import_react24.useState)(DEFAULT_PARAMS);
4417
- const [busy, setBusy] = (0, import_react24.useState)(false);
4418
- const [error, setError] = (0, import_react24.useState)(null);
4419
- const [layerId, setLayerId] = (0, import_react24.useState)("");
4420
- const [newKind, setNewKind] = (0, import_react24.useState)("hueSaturation");
4359
+ const [params, setParams] = (0, import_react25.useState)(DEFAULT_PARAMS);
4360
+ const [busy, setBusy] = (0, import_react25.useState)(false);
4361
+ const [error, setError] = (0, import_react25.useState)(null);
4362
+ const [layerId, setLayerId] = (0, import_react25.useState)("");
4363
+ const [newKind, setNewKind] = (0, import_react25.useState)("hueSaturation");
4421
4364
  const sel = selection === void 0 ? controller.getSelection() : selection;
4422
4365
  const list = layers ?? controller.getAdjustmentLayers();
4423
4366
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -4432,17 +4375,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4432
4375
  setBusy(false);
4433
4376
  }
4434
4377
  };
4435
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4436
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4437
- import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
4438
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4439
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: c.label }),
4440
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
4378
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
4379
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
4380
+ import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
4381
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4382
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: c.label }),
4383
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
4441
4384
  params[c.id],
4442
4385
  c.unit
4443
4386
  ] })
4444
4387
  ] }),
4445
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4388
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4446
4389
  "input",
4447
4390
  {
4448
4391
  type: "range",
@@ -4456,28 +4399,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4456
4399
  }
4457
4400
  )
4458
4401
  ] }, c.id)),
4459
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4460
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4402
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
4403
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
4461
4404
  "Smart Radius"
4462
4405
  ] }),
4463
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
4464
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4465
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4406
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1", children: [
4407
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
4408
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
4466
4409
  ] }),
4467
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
4468
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4469
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1 items-center", children: [
4470
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4410
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
4411
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
4412
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1 items-center", children: [
4413
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4471
4414
  "select",
4472
4415
  {
4473
4416
  "aria-label": "New masked layer kind",
4474
4417
  value: newKind,
4475
4418
  onChange: (e) => setNewKind(e.target.value),
4476
4419
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
4477
- children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: k.kind, children: k.label }, k.kind))
4420
+ children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: k.kind, children: k.label }, k.kind))
4478
4421
  }
4479
4422
  ),
4480
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4423
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4481
4424
  "button",
4482
4425
  {
4483
4426
  type: "button",
@@ -4488,35 +4431,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4488
4431
  }
4489
4432
  )
4490
4433
  ] }),
4491
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", children: [
4492
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4434
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-2", children: [
4435
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4493
4436
  "select",
4494
4437
  {
4495
4438
  "aria-label": "Mask layer",
4496
4439
  value: target.id,
4497
4440
  onChange: (e) => setLayerId(e.target.value),
4498
4441
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
4499
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("option", { value: l.id, children: [
4442
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: l.id, children: [
4500
4443
  l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
4501
4444
  l.mask ? " (masked)" : ""
4502
4445
  ] }, l.id))
4503
4446
  }
4504
4447
  ),
4505
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4506
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4507
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4508
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4448
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4449
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
4450
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
4451
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
4509
4452
  ] }),
4510
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4511
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
4512
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4513
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Density" }),
4514
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
4453
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
4454
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
4455
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4456
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Density" }),
4457
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
4515
4458
  Math.round((target.mask.density ?? 1) * 100),
4516
4459
  "%"
4517
4460
  ] })
4518
4461
  ] }),
4519
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4462
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4520
4463
  "input",
4521
4464
  {
4522
4465
  type: "range",
@@ -4530,15 +4473,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4530
4473
  }
4531
4474
  )
4532
4475
  ] }),
4533
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex flex-col gap-1", children: [
4534
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4535
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Mask Feather" }),
4536
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-mono", children: [
4476
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
4477
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
4478
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Mask Feather" }),
4479
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-mono", children: [
4537
4480
  target.mask.feather ?? 0,
4538
4481
  "px"
4539
4482
  ] })
4540
4483
  ] }),
4541
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4484
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4542
4485
  "input",
4543
4486
  {
4544
4487
  type: "range",
@@ -4558,13 +4501,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
4558
4501
  };
4559
4502
 
4560
4503
  // src/image-editor/FreeTransformOptionsBar.tsx
4561
- var import_react25 = require("react");
4504
+ var import_react26 = require("react");
4562
4505
  var import_image_editor16 = require("@pixerate/editor/image-editor");
4563
- var import_jsx_runtime24 = require("react/jsx-runtime");
4506
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4564
4507
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
4565
4508
  var FreeTransformOptionsBar = ({ tool, className }) => {
4566
- const [, setTick] = (0, import_react25.useState)(0);
4567
- (0, import_react25.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4509
+ const [, setTick] = (0, import_react26.useState)(0);
4510
+ (0, import_react26.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
4568
4511
  const bar = tool.bar();
4569
4512
  if (!tool.active || !bar) return null;
4570
4513
  const warp = tool.warpBar();
@@ -4576,17 +4519,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4576
4519
  const v = Number(raw);
4577
4520
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
4578
4521
  };
4579
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4580
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4581
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4582
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4583
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
4584
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
4585
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id)) })
4522
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
4523
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
4524
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
4525
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
4526
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4527
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
4528
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: o.id, children: o.label }, o.id)) })
4586
4529
  ] }),
4587
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
4588
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4589
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4530
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4531
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
4532
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4590
4533
  "input",
4591
4534
  {
4592
4535
  type: "number",
@@ -4607,9 +4550,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4607
4550
  },
4608
4551
  `${k}:${warp[k]}`
4609
4552
  ),
4610
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "%" })
4553
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "%" })
4611
4554
  ] }, k)),
4612
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4555
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4613
4556
  "button",
4614
4557
  {
4615
4558
  type: "button",
@@ -4621,9 +4564,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4621
4564
  children: "Vertical"
4622
4565
  }
4623
4566
  ),
4624
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
4625
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
4626
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4567
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4568
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
4569
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4627
4570
  "select",
4628
4571
  {
4629
4572
  "aria-label": "Warp grid",
@@ -4633,14 +4576,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4633
4576
  tool.setWarp({ columns: g.columns, rows: g.rows });
4634
4577
  },
4635
4578
  className: imageFieldClass,
4636
- children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: g.id, children: g.label }, g.id))
4579
+ children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: g.id, children: g.label }, g.id))
4637
4580
  }
4638
4581
  )
4639
4582
  ] })
4640
4583
  ] }),
4641
- tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
4642
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: f.label }),
4643
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4584
+ tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
4585
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: f.label }),
4586
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4644
4587
  "input",
4645
4588
  {
4646
4589
  type: "number",
@@ -4660,8 +4603,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4660
4603
  },
4661
4604
  `${f.id}:${round(bar[f.id], f.unit)}`
4662
4605
  ),
4663
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
4664
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4606
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
4607
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4665
4608
  "button",
4666
4609
  {
4667
4610
  type: "button",
@@ -4676,33 +4619,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4676
4619
  }
4677
4620
  )
4678
4621
  ] }, f.id)),
4679
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
4680
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
4681
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4622
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4623
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
4624
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4682
4625
  "select",
4683
4626
  {
4684
4627
  "aria-label": "Interpolation",
4685
4628
  value: tool.interpolation,
4686
4629
  onChange: (e) => tool.setInterpolation(e.target.value),
4687
4630
  className: imageFieldClass,
4688
- children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4631
+ children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
4689
4632
  }
4690
4633
  )
4691
4634
  ] }),
4692
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4693
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4694
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
4635
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
4636
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
4637
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
4695
4638
  ] });
4696
4639
  };
4697
4640
 
4698
4641
  // src/image-editor/ShapeOptionsBar.tsx
4699
- var import_react26 = require("react");
4642
+ var import_react27 = require("react");
4700
4643
  var import_image_editor17 = require("@pixerate/editor/image-editor");
4701
- var import_jsx_runtime25 = require("react/jsx-runtime");
4644
+ var import_jsx_runtime26 = require("react/jsx-runtime");
4702
4645
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4703
- const [, setTick] = (0, import_react26.useState)(0);
4704
- (0, import_react26.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4705
- const [error, setError] = (0, import_react26.useState)(null);
4646
+ const [, setTick] = (0, import_react27.useState)(0);
4647
+ (0, import_react27.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4648
+ const [error, setError] = (0, import_react27.useState)(null);
4706
4649
  const active = controller.getActiveLayer();
4707
4650
  const shapeId = active?.type === "shape" ? active.id : null;
4708
4651
  const set = (change) => {
@@ -4716,13 +4659,13 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4716
4659
  }
4717
4660
  };
4718
4661
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4719
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4720
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
4721
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4722
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4723
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", "aria-label": "Fill", checked: options.fill !== null, onChange: (e) => set({ fill: e.target.checked ? "#4f46e5" : null }) }),
4662
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4663
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
4664
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4665
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4666
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4724
4667
  "Fill",
4725
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4668
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4726
4669
  "input",
4727
4670
  {
4728
4671
  type: "color",
@@ -4734,10 +4677,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4734
4677
  }
4735
4678
  )
4736
4679
  ] }),
4737
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4738
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", "aria-label": "Stroke", checked: options.stroke !== null, onChange: (e) => set({ stroke: e.target.checked ? "#000000" : null }) }),
4680
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4681
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4739
4682
  "Stroke",
4740
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4683
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4741
4684
  "input",
4742
4685
  {
4743
4686
  type: "color",
@@ -4749,9 +4692,9 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4749
4692
  }
4750
4693
  )
4751
4694
  ] }),
4752
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4695
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4753
4696
  "Width",
4754
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4697
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4755
4698
  "input",
4756
4699
  {
4757
4700
  type: "number",
@@ -4765,63 +4708,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4765
4708
  )
4766
4709
  ] })
4767
4710
  ] }),
4768
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4769
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4711
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
4712
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4770
4713
  "Radius",
4771
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4714
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
4772
4715
  ] }),
4773
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4716
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4774
4717
  "Sides",
4775
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4718
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4776
4719
  ] }),
4777
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4778
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4720
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4721
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4779
4722
  "Points",
4780
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4723
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
4781
4724
  ] }),
4782
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4725
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4783
4726
  "Inner",
4784
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4785
- "input",
4786
- {
4787
- type: "range",
4788
- "aria-label": "Inner radius",
4789
- min: 0.05,
4790
- max: 1,
4791
- step: 0.05,
4792
- value: options.innerRatio,
4793
- onChange: (e) => set({ innerRatio: Number(e.target.value) }),
4794
- className: "accent-primary"
4795
- }
4796
- )
4727
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4797
4728
  ] })
4798
4729
  ] }),
4799
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4800
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4730
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
4731
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4801
4732
  "Weight",
4802
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4733
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
4803
4734
  ] }),
4804
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
4805
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", "aria-label": "Arrowhead", checked: options.arrow, onChange: (e) => set({ arrow: e.target.checked }) }),
4735
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4736
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4806
4737
  "Arrowhead"
4807
4738
  ] })
4808
4739
  ] })
4809
4740
  ] }),
4810
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4811
- error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4741
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
4742
+ error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4812
4743
  ] });
4813
4744
  };
4814
4745
 
4815
4746
  // src/image-editor/TypeOptionsBar.tsx
4816
- var import_react27 = require("react");
4747
+ var import_react28 = require("react");
4817
4748
  var import_image_editor18 = require("@pixerate/editor/image-editor");
4818
- var import_jsx_runtime26 = require("react/jsx-runtime");
4749
+ var import_jsx_runtime27 = require("react/jsx-runtime");
4819
4750
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
4820
4751
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
4821
- const [, setTick] = (0, import_react27.useState)(0);
4822
- (0, import_react27.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4823
- (0, import_react27.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4824
- const [error, setError] = (0, import_react27.useState)(null);
4752
+ const [, setTick] = (0, import_react28.useState)(0);
4753
+ (0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4754
+ (0, import_react28.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4755
+ const [error, setError] = (0, import_react28.useState)(null);
4825
4756
  const active = controller.getActiveLayer();
4826
4757
  const typeId = !session && active?.type === "type" ? active.id : null;
4827
4758
  const here = session?.alive ? session.styleHere() : {};
@@ -4853,11 +4784,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4853
4784
  setError(e instanceof Error ? e.message : String(e));
4854
4785
  }
4855
4786
  };
4856
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4857
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4858
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4787
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4788
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4789
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4859
4790
  "Font",
4860
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4791
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4861
4792
  "input",
4862
4793
  {
4863
4794
  list: "pixerate-type-fonts",
@@ -4867,11 +4798,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4867
4798
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
4868
4799
  }
4869
4800
  ),
4870
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: f }, f)) })
4801
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: f }, f)) })
4871
4802
  ] }),
4872
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
4803
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
4873
4804
  "Size",
4874
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4805
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4875
4806
  "input",
4876
4807
  {
4877
4808
  type: "number",
@@ -4884,24 +4815,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4884
4815
  }
4885
4816
  )
4886
4817
  ] }),
4887
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4888
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4889
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
4818
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
4819
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4820
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
4890
4821
  ] }),
4891
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4892
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
4893
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4822
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4823
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
4824
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4894
4825
  "Missing ",
4895
4826
  missing.length === 1 ? "font" : "fonts",
4896
4827
  ": ",
4897
4828
  missing.join(", ")
4898
4829
  ] }),
4899
- error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4830
+ error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: error })
4900
4831
  ] });
4901
4832
  };
4902
4833
 
4903
4834
  // src/image-editor/ImageEditor.tsx
4904
- var import_jsx_runtime27 = require("react/jsx-runtime");
4835
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4905
4836
  var ImageEditor = ({
4906
4837
  editor: externalEditor,
4907
4838
  src,
@@ -4926,32 +4857,32 @@ var ImageEditor = ({
4926
4857
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
4927
4858
  });
4928
4859
  const legacyProcess = (0, import_image_editor19.normalizeProcessVersion)(state.adjustments.process) < import_image_editor19.LATEST_PROCESS_VERSION;
4929
- const [activeTab, setActiveTab] = (0, import_react28.useState)("crop");
4930
- const rootRef = (0, import_react28.useRef)(null);
4860
+ const [activeTab, setActiveTab] = (0, import_react29.useState)("crop");
4861
+ const rootRef = (0, import_react29.useRef)(null);
4931
4862
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
4932
- const activeTabRef = (0, import_react28.useRef)(activeTab);
4863
+ const activeTabRef = (0, import_react29.useRef)(activeTab);
4933
4864
  activeTabRef.current = activeTab;
4934
4865
  const openPanel = async (ref) => {
4935
4866
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
4936
4867
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
4937
4868
  await new Promise((resolve) => setTimeout(resolve, 60));
4938
4869
  };
4939
- const [activeCropRatio, setActiveCropRatio] = (0, import_react28.useState)(null);
4940
- const [selectionOptions, setSelectionOptions] = (0, import_react28.useState)(import_image_editor19.DEFAULT_SELECTION_TOOL_OPTIONS);
4941
- const [shapeOptions, setShapeOptions] = (0, import_react28.useState)(import_image_editor19.DEFAULT_SHAPE_TOOL_OPTIONS);
4942
- const [typeOptions, setTypeOptions] = (0, import_react28.useState)(import_image_editor19.DEFAULT_TYPE_TOOL_OPTIONS);
4943
- const [typeSession, setTypeSession] = (0, import_react28.useState)(null);
4944
- const [selectionError, setSelectionError] = (0, import_react28.useState)(null);
4945
- const [paintError, setPaintError] = (0, import_react28.useState)(null);
4946
- const [shapeTypeError, setShapeTypeError] = (0, import_react28.useState)(null);
4870
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react29.useState)(null);
4871
+ const [selectionOptions, setSelectionOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_SELECTION_TOOL_OPTIONS);
4872
+ const [shapeOptions, setShapeOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_SHAPE_TOOL_OPTIONS);
4873
+ const [typeOptions, setTypeOptions] = (0, import_react29.useState)(import_image_editor19.DEFAULT_TYPE_TOOL_OPTIONS);
4874
+ const [typeSession, setTypeSession] = (0, import_react29.useState)(null);
4875
+ const [selectionError, setSelectionError] = (0, import_react29.useState)(null);
4876
+ const [paintError, setPaintError] = (0, import_react29.useState)(null);
4877
+ const [shapeTypeError, setShapeTypeError] = (0, import_react29.useState)(null);
4947
4878
  const handleCanvasError = (source, message) => {
4948
4879
  if (source === "paint") setPaintError(message);
4949
4880
  else if (source === "select") setSelectionError(message);
4950
4881
  else setShapeTypeError(message);
4951
4882
  };
4952
4883
  const finishTyping = () => setTypeSession(null);
4953
- const transformToolRef = (0, import_react28.useRef)(null);
4954
- const transformControllerRef = (0, import_react28.useRef)(controller);
4884
+ const transformToolRef = (0, import_react29.useRef)(null);
4885
+ const transformControllerRef = (0, import_react29.useRef)(controller);
4955
4886
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
4956
4887
  transformToolRef.current?.cancel();
4957
4888
  transformToolRef.current = new import_image_editor19.FreeTransformTool(controller, {
@@ -4960,16 +4891,16 @@ var ImageEditor = ({
4960
4891
  transformControllerRef.current = controller;
4961
4892
  }
4962
4893
  const transformTool = transformToolRef.current;
4963
- const [, setTransformTick] = (0, import_react28.useState)(0);
4964
- (0, import_react28.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4965
- (0, import_react28.useEffect)(() => () => transformToolRef.current?.cancel(), []);
4966
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react28.useState)("");
4967
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react28.useState)("annotations");
4968
- const [isRemovingBg, setIsRemovingBg] = (0, import_react28.useState)(false);
4969
- const [isInpainting, setIsInpainting] = (0, import_react28.useState)(false);
4970
- const [aiError, setAiError] = (0, import_react28.useState)(null);
4971
- const [aiSuccess, setAiSuccess] = (0, import_react28.useState)(null);
4972
- const [aiTarget, setAiTarget] = (0, import_react28.useState)("auto");
4894
+ const [, setTransformTick] = (0, import_react29.useState)(0);
4895
+ (0, import_react29.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4896
+ (0, import_react29.useEffect)(() => () => transformToolRef.current?.cancel(), []);
4897
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react29.useState)("");
4898
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react29.useState)("annotations");
4899
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react29.useState)(false);
4900
+ const [isInpainting, setIsInpainting] = (0, import_react29.useState)(false);
4901
+ const [aiError, setAiError] = (0, import_react29.useState)(null);
4902
+ const [aiSuccess, setAiSuccess] = (0, import_react29.useState)(null);
4903
+ const [aiTarget, setAiTarget] = (0, import_react29.useState)("auto");
4973
4904
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
4974
4905
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
4975
4906
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -5032,11 +4963,11 @@ var ImageEditor = ({
5032
4963
  setIsInpainting(false);
5033
4964
  }
5034
4965
  };
5035
- const [activeColor, setActiveColor] = (0, import_react28.useState)("#ef4444");
5036
- const [strokeWidth, setStrokeWidth] = (0, import_react28.useState)(3);
5037
- const [fontSize, setFontSize] = (0, import_react28.useState)(24);
5038
- const [textInput, setTextInput] = (0, import_react28.useState)("");
5039
- (0, import_react28.useEffect)(() => {
4966
+ const [activeColor, setActiveColor] = (0, import_react29.useState)("#ef4444");
4967
+ const [strokeWidth, setStrokeWidth] = (0, import_react29.useState)(3);
4968
+ const [fontSize, setFontSize] = (0, import_react29.useState)(24);
4969
+ const [textInput, setTextInput] = (0, import_react29.useState)("");
4970
+ (0, import_react29.useEffect)(() => {
5040
4971
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
5041
4972
  editor.setTool("crop");
5042
4973
  }
@@ -5064,16 +4995,16 @@ var ImageEditor = ({
5064
4995
  link.click();
5065
4996
  }
5066
4997
  };
5067
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4998
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5068
4999
  "div",
5069
5000
  {
5070
5001
  ref: rootRef,
5071
5002
  className: `${imageEditorFrameClass} ${className}`,
5072
5003
  style,
5073
5004
  children: [
5074
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: imageEditorHeaderClass, children: [
5075
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
5076
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5005
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: imageEditorHeaderClass, children: [
5006
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
5007
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5077
5008
  "button",
5078
5009
  {
5079
5010
  type: "button",
@@ -5088,7 +5019,7 @@ var ImageEditor = ({
5088
5019
  children: "Transform & Crop"
5089
5020
  }
5090
5021
  ),
5091
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5022
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5092
5023
  "button",
5093
5024
  {
5094
5025
  type: "button",
@@ -5103,7 +5034,7 @@ var ImageEditor = ({
5103
5034
  children: "Adjustments"
5104
5035
  }
5105
5036
  ),
5106
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5037
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5107
5038
  "button",
5108
5039
  {
5109
5040
  type: "button",
@@ -5118,7 +5049,7 @@ var ImageEditor = ({
5118
5049
  children: "Layers"
5119
5050
  }
5120
5051
  ),
5121
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5052
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5122
5053
  "button",
5123
5054
  {
5124
5055
  type: "button",
@@ -5133,7 +5064,7 @@ var ImageEditor = ({
5133
5064
  children: "Paint"
5134
5065
  }
5135
5066
  ),
5136
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5067
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5137
5068
  "button",
5138
5069
  {
5139
5070
  type: "button",
@@ -5148,7 +5079,7 @@ var ImageEditor = ({
5148
5079
  children: "Select & Mask"
5149
5080
  }
5150
5081
  ),
5151
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5082
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5152
5083
  "button",
5153
5084
  {
5154
5085
  type: "button",
@@ -5163,7 +5094,7 @@ var ImageEditor = ({
5163
5094
  children: "Annotations"
5164
5095
  }
5165
5096
  ),
5166
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5097
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5167
5098
  "button",
5168
5099
  {
5169
5100
  type: "button",
@@ -5178,7 +5109,7 @@ var ImageEditor = ({
5178
5109
  children: "Depth Mask"
5179
5110
  }
5180
5111
  ),
5181
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5112
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5182
5113
  "button",
5183
5114
  {
5184
5115
  type: "button",
@@ -5191,14 +5122,14 @@ var ImageEditor = ({
5191
5122
  "aria-selected": activeTab === "ai",
5192
5123
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
5193
5124
  children: [
5194
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5125
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5195
5126
  "AI Tools"
5196
5127
  ]
5197
5128
  }
5198
5129
  )
5199
5130
  ] }),
5200
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
5201
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5131
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
5132
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5202
5133
  "button",
5203
5134
  {
5204
5135
  type: "button",
@@ -5209,7 +5140,7 @@ var ImageEditor = ({
5209
5140
  children: "\u21A9"
5210
5141
  }
5211
5142
  ),
5212
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5143
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5213
5144
  "button",
5214
5145
  {
5215
5146
  type: "button",
@@ -5220,7 +5151,7 @@ var ImageEditor = ({
5220
5151
  children: "\u21AA"
5221
5152
  }
5222
5153
  ),
5223
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5154
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5224
5155
  "button",
5225
5156
  {
5226
5157
  type: "button",
@@ -5229,8 +5160,8 @@ var ImageEditor = ({
5229
5160
  children: "Reset"
5230
5161
  }
5231
5162
  ),
5232
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5233
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5163
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5164
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5234
5165
  "button",
5235
5166
  {
5236
5167
  type: "button",
@@ -5240,11 +5171,11 @@ var ImageEditor = ({
5240
5171
  children: "-"
5241
5172
  }
5242
5173
  ),
5243
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5174
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
5244
5175
  Math.round(state.zoom * 100),
5245
5176
  "%"
5246
5177
  ] }),
5247
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5178
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5248
5179
  "button",
5249
5180
  {
5250
5181
  type: "button",
@@ -5254,8 +5185,8 @@ var ImageEditor = ({
5254
5185
  children: "+"
5255
5186
  }
5256
5187
  ),
5257
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5258
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5188
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
5189
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5259
5190
  "button",
5260
5191
  {
5261
5192
  type: "button",
@@ -5266,7 +5197,7 @@ var ImageEditor = ({
5266
5197
  children: "Hold Compare"
5267
5198
  }
5268
5199
  ),
5269
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5200
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5270
5201
  "button",
5271
5202
  {
5272
5203
  type: "button",
@@ -5277,10 +5208,10 @@ var ImageEditor = ({
5277
5208
  )
5278
5209
  ] })
5279
5210
  ] }),
5280
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5281
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5282
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5283
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5211
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
5212
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
5213
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
5214
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5284
5215
  ImageEditorCanvas,
5285
5216
  {
5286
5217
  editor,
@@ -5304,11 +5235,11 @@ var ImageEditor = ({
5304
5235
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
5305
5236
  }
5306
5237
  ),
5307
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: imageSidebarClass, children: [
5308
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5309
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5310
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
5311
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5238
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: imageSidebarClass, children: [
5239
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5240
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
5241
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
5242
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5312
5243
  "button",
5313
5244
  {
5314
5245
  type: "button",
@@ -5320,7 +5251,7 @@ var ImageEditor = ({
5320
5251
  children: "Freeform"
5321
5252
  }
5322
5253
  ),
5323
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5254
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5324
5255
  "button",
5325
5256
  {
5326
5257
  type: "button",
@@ -5332,7 +5263,7 @@ var ImageEditor = ({
5332
5263
  children: "1:1 Square"
5333
5264
  }
5334
5265
  ),
5335
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5266
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5336
5267
  "button",
5337
5268
  {
5338
5269
  type: "button",
@@ -5344,7 +5275,7 @@ var ImageEditor = ({
5344
5275
  children: "4:3 Standard"
5345
5276
  }
5346
5277
  ),
5347
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5278
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5348
5279
  "button",
5349
5280
  {
5350
5281
  type: "button",
@@ -5356,7 +5287,7 @@ var ImageEditor = ({
5356
5287
  children: "16:9 Wide"
5357
5288
  }
5358
5289
  ),
5359
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5290
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5360
5291
  "button",
5361
5292
  {
5362
5293
  type: "button",
@@ -5368,7 +5299,7 @@ var ImageEditor = ({
5368
5299
  children: "3:2 Photo"
5369
5300
  }
5370
5301
  ),
5371
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5302
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5372
5303
  "button",
5373
5304
  {
5374
5305
  type: "button",
@@ -5381,10 +5312,10 @@ var ImageEditor = ({
5381
5312
  }
5382
5313
  )
5383
5314
  ] }),
5384
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
5385
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5386
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
5387
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5315
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5316
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
5317
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
5318
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5388
5319
  "button",
5389
5320
  {
5390
5321
  type: "button",
@@ -5393,7 +5324,7 @@ var ImageEditor = ({
5393
5324
  children: "Rotate -90\xB0"
5394
5325
  }
5395
5326
  ),
5396
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5327
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5397
5328
  "button",
5398
5329
  {
5399
5330
  type: "button",
@@ -5402,7 +5333,7 @@ var ImageEditor = ({
5402
5333
  children: "Rotate +90\xB0"
5403
5334
  }
5404
5335
  ),
5405
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5336
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5406
5337
  "button",
5407
5338
  {
5408
5339
  type: "button",
@@ -5411,7 +5342,7 @@ var ImageEditor = ({
5411
5342
  children: "Flip Horizontal"
5412
5343
  }
5413
5344
  ),
5414
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5345
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5415
5346
  "button",
5416
5347
  {
5417
5348
  type: "button",
@@ -5422,10 +5353,10 @@ var ImageEditor = ({
5422
5353
  )
5423
5354
  ] })
5424
5355
  ] }),
5425
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5426
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
5427
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5428
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5356
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5357
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5358
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
5359
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5429
5360
  "button",
5430
5361
  {
5431
5362
  type: "button",
@@ -5435,9 +5366,9 @@ var ImageEditor = ({
5435
5366
  }
5436
5367
  )
5437
5368
  ] }),
5438
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Histogram, { histogram: editor.histogram }),
5439
- import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react28.default.Fragment, { children: [
5440
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5369
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Histogram, { histogram: editor.histogram }),
5370
+ import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react29.default.Fragment, { children: [
5371
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5441
5372
  ControlSlider,
5442
5373
  {
5443
5374
  spec,
@@ -5446,14 +5377,14 @@ var ImageEditor = ({
5446
5377
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
5447
5378
  }
5448
5379
  ),
5449
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5380
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5450
5381
  "div",
5451
5382
  {
5452
5383
  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",
5453
5384
  "data-testid": "image-editor-process-notice",
5454
5385
  children: [
5455
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5456
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5386
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
5387
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5457
5388
  "button",
5458
5389
  {
5459
5390
  type: "button",
@@ -5466,7 +5397,7 @@ var ImageEditor = ({
5466
5397
  }
5467
5398
  )
5468
5399
  ] }, spec.id)),
5469
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5400
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5470
5401
  AdjustmentLayersPanel,
5471
5402
  {
5472
5403
  controller,
@@ -5475,9 +5406,9 @@ var ImageEditor = ({
5475
5406
  }
5476
5407
  ) })
5477
5408
  ] }),
5478
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5479
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
5480
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5409
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5410
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
5411
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5481
5412
  "button",
5482
5413
  {
5483
5414
  type: "button",
@@ -5488,15 +5419,15 @@ var ImageEditor = ({
5488
5419
  children: "Free Transform"
5489
5420
  }
5490
5421
  ),
5491
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayersPanel, { controller }),
5492
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5493
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
5494
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ColorProfilePanel, { controller })
5422
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayersPanel, { controller }),
5423
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
5424
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
5425
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ColorProfilePanel, { controller })
5495
5426
  ] }),
5496
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5497
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
5498
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BrushOptionsBar, { controller }),
5499
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5427
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5428
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
5429
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(BrushOptionsBar, { controller }),
5430
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5500
5431
  "button",
5501
5432
  {
5502
5433
  type: "button",
@@ -5507,12 +5438,12 @@ var ImageEditor = ({
5507
5438
  children: "Free Transform"
5508
5439
  }
5509
5440
  ),
5510
- paintError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5511
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayersPanel, { controller }) })
5441
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
5442
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayersPanel, { controller }) })
5512
5443
  ] }),
5513
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5514
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
5515
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5444
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5445
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
5446
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5516
5447
  "button",
5517
5448
  {
5518
5449
  type: "button",
@@ -5523,13 +5454,13 @@ var ImageEditor = ({
5523
5454
  },
5524
5455
  t
5525
5456
  )) }),
5526
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5527
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5528
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5529
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5530
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
5531
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5532
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5457
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
5458
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
5459
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
5460
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
5461
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5462
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
5463
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5533
5464
  "button",
5534
5465
  {
5535
5466
  type: "button",
@@ -5539,9 +5470,9 @@ var ImageEditor = ({
5539
5470
  },
5540
5471
  t
5541
5472
  )) }),
5542
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
5543
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
5544
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5473
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
5474
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
5475
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5545
5476
  "input",
5546
5477
  {
5547
5478
  type: "color",
@@ -5550,15 +5481,15 @@ var ImageEditor = ({
5550
5481
  className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
5551
5482
  }
5552
5483
  ),
5553
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex-1 ml-2", children: [
5554
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5555
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Width:" }),
5556
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5484
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex-1 ml-2", children: [
5485
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5486
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Width:" }),
5487
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5557
5488
  strokeWidth,
5558
5489
  "px"
5559
5490
  ] })
5560
5491
  ] }),
5561
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5492
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5562
5493
  "input",
5563
5494
  {
5564
5495
  type: "range",
@@ -5571,10 +5502,10 @@ var ImageEditor = ({
5571
5502
  )
5572
5503
  ] })
5573
5504
  ] }),
5574
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
5575
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
5576
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2", children: [
5577
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5505
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5506
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
5507
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-2", children: [
5508
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5578
5509
  "input",
5579
5510
  {
5580
5511
  type: "text",
@@ -5585,7 +5516,7 @@ var ImageEditor = ({
5585
5516
  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"
5586
5517
  }
5587
5518
  ),
5588
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5519
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5589
5520
  "button",
5590
5521
  {
5591
5522
  type: "button",
@@ -5595,14 +5526,14 @@ var ImageEditor = ({
5595
5526
  }
5596
5527
  )
5597
5528
  ] }),
5598
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5599
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Font Size:" }),
5600
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-mono", children: [
5529
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
5530
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Font Size:" }),
5531
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-mono", children: [
5601
5532
  fontSize,
5602
5533
  "px"
5603
5534
  ] })
5604
5535
  ] }),
5605
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5536
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5606
5537
  "input",
5607
5538
  {
5608
5539
  type: "range",
@@ -5613,14 +5544,14 @@ var ImageEditor = ({
5613
5544
  className: imageRangeClass
5614
5545
  }
5615
5546
  ),
5616
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageDividerClass }),
5617
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
5618
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-muted-foreground", children: [
5547
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageDividerClass }),
5548
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5549
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-muted-foreground", children: [
5619
5550
  "Layers (",
5620
5551
  state.annotations.length,
5621
5552
  ")"
5622
5553
  ] }),
5623
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5554
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5624
5555
  "button",
5625
5556
  {
5626
5557
  type: "button",
@@ -5629,7 +5560,7 @@ var ImageEditor = ({
5629
5560
  children: "Delete Selected"
5630
5561
  }
5631
5562
  ),
5632
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5563
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5633
5564
  "button",
5634
5565
  {
5635
5566
  type: "button",
@@ -5640,10 +5571,10 @@ var ImageEditor = ({
5640
5571
  )
5641
5572
  ] })
5642
5573
  ] }),
5643
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5644
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
5645
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5646
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5574
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
5575
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5576
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
5577
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5647
5578
  "button",
5648
5579
  {
5649
5580
  type: "button",
@@ -5653,8 +5584,8 @@ var ImageEditor = ({
5653
5584
  }
5654
5585
  )
5655
5586
  ] }),
5656
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5657
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5587
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
5588
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5658
5589
  "input",
5659
5590
  {
5660
5591
  type: "checkbox",
@@ -5663,12 +5594,12 @@ var ImageEditor = ({
5663
5594
  className: "rounded accent-primary"
5664
5595
  }
5665
5596
  ),
5666
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Enable Depth / Alpha Mask" })
5597
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Enable Depth / Alpha Mask" })
5667
5598
  ] }),
5668
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5669
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
5670
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5671
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5599
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5600
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5601
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
5602
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5672
5603
  "input",
5673
5604
  {
5674
5605
  type: "text",
@@ -5679,8 +5610,8 @@ var ImageEditor = ({
5679
5610
  }
5680
5611
  )
5681
5612
  ] }),
5682
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2", children: [
5683
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5613
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-2", children: [
5614
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5684
5615
  "button",
5685
5616
  {
5686
5617
  type: "button",
@@ -5689,7 +5620,7 @@ var ImageEditor = ({
5689
5620
  children: "Threshold Mode"
5690
5621
  }
5691
5622
  ),
5692
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5623
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5693
5624
  "button",
5694
5625
  {
5695
5626
  type: "button",
@@ -5699,12 +5630,12 @@ var ImageEditor = ({
5699
5630
  }
5700
5631
  )
5701
5632
  ] }),
5702
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
5703
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5704
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Depth Start (Lower):" }),
5705
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5633
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5634
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5635
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Depth Start (Lower):" }),
5636
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
5706
5637
  ] }),
5707
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5638
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5708
5639
  "input",
5709
5640
  {
5710
5641
  type: "range",
@@ -5718,12 +5649,12 @@ var ImageEditor = ({
5718
5649
  }
5719
5650
  )
5720
5651
  ] }),
5721
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
5722
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5723
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Depth Stop (Upper):" }),
5724
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5652
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5653
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5654
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Depth Stop (Upper):" }),
5655
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
5725
5656
  ] }),
5726
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5657
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5727
5658
  "input",
5728
5659
  {
5729
5660
  type: "range",
@@ -5737,12 +5668,12 @@ var ImageEditor = ({
5737
5668
  }
5738
5669
  )
5739
5670
  ] }),
5740
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
5741
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5742
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Softness:" }),
5743
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
5671
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5672
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
5673
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Softness:" }),
5674
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
5744
5675
  ] }),
5745
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5676
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5746
5677
  "input",
5747
5678
  {
5748
5679
  type: "range",
@@ -5754,8 +5685,8 @@ var ImageEditor = ({
5754
5685
  }
5755
5686
  )
5756
5687
  ] }),
5757
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5758
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5688
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
5689
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5759
5690
  "input",
5760
5691
  {
5761
5692
  type: "checkbox",
@@ -5764,12 +5695,12 @@ var ImageEditor = ({
5764
5695
  className: "rounded accent-primary"
5765
5696
  }
5766
5697
  ),
5767
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Invert Mask" })
5698
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Invert Mask" })
5768
5699
  ] })
5769
5700
  ] })
5770
5701
  ] }),
5771
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5772
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5702
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5703
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5773
5704
  SelectionOptionsBar,
5774
5705
  {
5775
5706
  controller,
@@ -5779,9 +5710,9 @@ var ImageEditor = ({
5779
5710
  quickMask: Boolean(state.quickMask)
5780
5711
  }
5781
5712
  ),
5782
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
5783
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
5784
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5713
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
5714
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
5715
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5785
5716
  "button",
5786
5717
  {
5787
5718
  type: "button",
@@ -5792,7 +5723,7 @@ var ImageEditor = ({
5792
5723
  children: "Transform Selection"
5793
5724
  }
5794
5725
  ),
5795
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5726
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5796
5727
  "button",
5797
5728
  {
5798
5729
  type: "button",
@@ -5804,12 +5735,12 @@ var ImageEditor = ({
5804
5735
  }
5805
5736
  )
5806
5737
  ] }),
5807
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
5738
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
5808
5739
  ] }),
5809
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5810
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5811
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Results go to" }),
5812
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5740
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
5741
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5742
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Results go to" }),
5743
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5813
5744
  "select",
5814
5745
  {
5815
5746
  "aria-label": "AI result target",
@@ -5817,54 +5748,54 @@ var ImageEditor = ({
5817
5748
  onChange: (e) => setAiTarget(e.target.value),
5818
5749
  className: imageSelectClass,
5819
5750
  children: [
5820
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5821
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
5822
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "replace", children: "Replace image" })
5751
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5752
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
5753
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "replace", children: "Replace image" })
5823
5754
  ]
5824
5755
  }
5825
5756
  )
5826
5757
  ] }),
5827
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5828
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
5829
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5830
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5758
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5759
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5760
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5761
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
5831
5762
  "Background Removal"
5832
5763
  ] }),
5833
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5764
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
5834
5765
  ] }),
5835
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5836
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5766
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5767
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5837
5768
  "button",
5838
5769
  {
5839
5770
  type: "button",
5840
5771
  onClick: handleRemoveBackground,
5841
5772
  disabled: isRemovingBg || isInpainting,
5842
5773
  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",
5843
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5844
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSpinnerClass }),
5774
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5775
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSpinnerClass }),
5845
5776
  "Removing Background..."
5846
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5847
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5777
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5778
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5848
5779
  "Remove Background"
5849
5780
  ] })
5850
5781
  }
5851
5782
  )
5852
5783
  ] }),
5853
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5854
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
5855
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5856
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5857
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5858
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m14 7 3 3" })
5784
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5785
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between", children: [
5786
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5787
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5788
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
5789
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 7 3 3" })
5859
5790
  ] }),
5860
5791
  "Generative Inpainting"
5861
5792
  ] }),
5862
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5793
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
5863
5794
  ] }),
5864
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5865
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-1", children: [
5866
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5867
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5795
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5796
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1", children: [
5797
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5798
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5868
5799
  "textarea",
5869
5800
  {
5870
5801
  id: "ai-inpaint-prompt-react",
@@ -5876,10 +5807,10 @@ var ImageEditor = ({
5876
5807
  }
5877
5808
  )
5878
5809
  ] }),
5879
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-1", children: [
5880
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5881
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
5882
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5810
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1", children: [
5811
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5812
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
5813
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5883
5814
  "button",
5884
5815
  {
5885
5816
  type: "button",
@@ -5892,7 +5823,7 @@ var ImageEditor = ({
5892
5823
  ]
5893
5824
  }
5894
5825
  ),
5895
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5826
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5896
5827
  "button",
5897
5828
  {
5898
5829
  type: "button",
@@ -5907,25 +5838,25 @@ var ImageEditor = ({
5907
5838
  )
5908
5839
  ] })
5909
5840
  ] }),
5910
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5841
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5911
5842
  "button",
5912
5843
  {
5913
5844
  type: "button",
5914
5845
  onClick: handleInpaint,
5915
5846
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
5916
5847
  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",
5917
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5918
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: imageSpinnerClass }),
5848
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5849
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: imageSpinnerClass }),
5919
5850
  "Generating Inpaint..."
5920
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5921
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5851
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5852
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
5922
5853
  "Apply Inpainting"
5923
5854
  ] })
5924
5855
  }
5925
5856
  )
5926
5857
  ] }),
5927
- aiError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5928
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5858
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5859
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5929
5860
  ] })
5930
5861
  ] })
5931
5862
  ] })
@@ -5942,10 +5873,14 @@ var ImageEditor = ({
5942
5873
  CurvesEditor,
5943
5874
  FreeTransformOptionsBar,
5944
5875
  Histogram,
5876
+ ImageCheckbox,
5945
5877
  ImageEditor,
5946
5878
  ImageEditorCanvas,
5879
+ ImageEditorControlsProvider,
5947
5880
  ImageEffectControls,
5948
5881
  ImageProviderEffectsPanel,
5882
+ ImageRange,
5883
+ ImageSelect,
5949
5884
  LayerEffectsPanel,
5950
5885
  LayersPanel,
5951
5886
  PaintGradientEditor,
@@ -5954,6 +5889,7 @@ var ImageEditor = ({
5954
5889
  ShapeOptionsBar,
5955
5890
  TypeOptionsBar,
5956
5891
  useImageEditor,
5892
+ useImageEditorControls,
5957
5893
  useImageEffectsTools,
5958
5894
  useImageHistogram
5959
5895
  });