@pixerate/editor-react 0.135.0 → 0.137.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
190
190
  }
191
191
 
192
192
  // src/image-editor/ImageEditor.tsx
193
- import React16, { useRef as useRef8, useEffect as useEffect14, useState as useState17 } from "react";
193
+ import React17, { useRef as useRef9, useEffect as useEffect15, useState as useState18 } from "react";
194
194
  import {
195
195
  normalizeProcessVersion,
196
196
  LATEST_PROCESS_VERSION,
@@ -2663,7 +2663,7 @@ var ColorProfilePanel = ({ controller, className }) => {
2663
2663
  };
2664
2664
 
2665
2665
  // src/image-editor/SelectionOptionsBar.tsx
2666
- import { useState as useState11 } from "react";
2666
+ import { useState as useState12 } from "react";
2667
2667
  import {
2668
2668
  COLOR_RANGE_PRESETS,
2669
2669
  COLOR_RANGE_PRESET_LABELS,
@@ -2672,7 +2672,269 @@ import {
2672
2672
  SELECTION_TOOLS,
2673
2673
  describeSelection
2674
2674
  } from "@pixerate/editor/image-editor";
2675
+
2676
+ // src/image-editor/SelectAndMaskWorkspace.tsx
2677
+ import { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef7, useState as useState11 } from "react";
2678
+ import { REFINE_EDGE_CONTROLS, REFINE_OUTPUTS, SELECT_AND_MASK_TOOLS, SELECT_AND_MASK_VIEWS, SelectAndMaskSession } from "@pixerate/editor/image-editor";
2675
2679
  import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2680
+ var button = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
2681
+ var toggle = (on) => `${button} ${on ? "bg-primary text-primary-foreground border-primary" : ""}`;
2682
+ var SelectAndMaskWorkspace = ({ controller, onClose, className = "" }) => {
2683
+ const session = useMemo4(() => new SelectAndMaskSession(controller), [controller]);
2684
+ const [, setRevision] = useState11(0);
2685
+ const [zoom, setZoom] = useState11(1);
2686
+ const [pan, setPan] = useState11({ x: 0, y: 0 });
2687
+ const [busy, setBusy] = useState11(false);
2688
+ const [error, setError] = useState11(null);
2689
+ const canvasRef = useRef7(null);
2690
+ const panFrom = useRef7(null);
2691
+ const settings = session.settings;
2692
+ const size = session.previewSize;
2693
+ useEffect10(() => {
2694
+ const off = session.subscribe(() => setRevision(session.revision));
2695
+ void session.open();
2696
+ return () => {
2697
+ off();
2698
+ };
2699
+ }, [session]);
2700
+ useEffect10(() => {
2701
+ const canvas = canvasRef.current;
2702
+ const ctx = canvas?.getContext?.("2d");
2703
+ if (!canvas || !ctx || !size.width || typeof ImageData === "undefined") return;
2704
+ canvas.width = size.width;
2705
+ canvas.height = size.height;
2706
+ ctx.putImageData(new ImageData(session.render(), size.width, size.height), 0, 0);
2707
+ });
2708
+ const set = (changes) => session.update(changes);
2709
+ const ok = async () => {
2710
+ setBusy(true);
2711
+ setError(null);
2712
+ try {
2713
+ onClose(await session.commit());
2714
+ } catch (err) {
2715
+ setError(err instanceof Error ? err.message : String(err));
2716
+ setBusy(false);
2717
+ }
2718
+ };
2719
+ useEffect10(() => {
2720
+ const onKey = (e) => {
2721
+ const t = e.target;
2722
+ if (t && (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA")) return;
2723
+ if (e.key === "Escape") onClose(null);
2724
+ else if (e.key === "Enter") void ok();
2725
+ else if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z") session.undoEdit();
2726
+ else if (e.ctrlKey || e.metaKey || e.altKey || !session.handleKey(e.key)) return;
2727
+ e.preventDefault();
2728
+ };
2729
+ window.addEventListener("keydown", onKey);
2730
+ return () => window.removeEventListener("keydown", onKey);
2731
+ });
2732
+ const toImage = (e) => {
2733
+ const rect = e.currentTarget.getBoundingClientRect();
2734
+ const naturalW = size.width / size.scale;
2735
+ const naturalH = size.height / size.scale;
2736
+ return { x: (e.clientX - rect.left) / Math.max(1, rect.width) * naturalW, y: (e.clientY - rect.top) / Math.max(1, rect.height) * naturalH };
2737
+ };
2738
+ const onDown = (e) => {
2739
+ if (settings.tool === "hand") {
2740
+ panFrom.current = { x: e.clientX, y: e.clientY, pan };
2741
+ return;
2742
+ }
2743
+ if (settings.tool === "zoom") {
2744
+ setZoom((z) => Math.min(16, Math.max(0.25, e.altKey ? z / 1.25 : z * 1.25)));
2745
+ return;
2746
+ }
2747
+ e.currentTarget.setPointerCapture?.(e.pointerId);
2748
+ session.begin(toImage(e), { altKey: e.altKey });
2749
+ };
2750
+ const onMove = (e) => {
2751
+ if (panFrom.current) {
2752
+ const p = panFrom.current;
2753
+ setPan({ x: p.pan.x + e.clientX - p.x, y: p.pan.y + e.clientY - p.y });
2754
+ return;
2755
+ }
2756
+ if (e.buttons) session.move(toImage(e));
2757
+ };
2758
+ const onUp = () => {
2759
+ panFrom.current = null;
2760
+ session.end();
2761
+ };
2762
+ const toLayer = settings.output === "new-layer" || settings.output === "new-layer-with-mask";
2763
+ const brushTool = settings.tool === "quick-select" || settings.tool === "brush" || settings.tool === "refine-brush";
2764
+ return /* @__PURE__ */ jsxs13(
2765
+ "div",
2766
+ {
2767
+ "data-testid": "select-and-mask-workspace",
2768
+ role: "dialog",
2769
+ "aria-label": "Select and Mask",
2770
+ className: `fixed inset-0 z-50 flex bg-background text-xs text-foreground ${className}`,
2771
+ children: [
2772
+ /* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Select and Mask tool", className: "flex flex-col gap-1 p-2 border-r border-border", children: SELECT_AND_MASK_TOOLS.map((t) => /* @__PURE__ */ jsx15("button", { type: "button", title: `${t.label} (${t.key.toUpperCase()})`, "aria-pressed": settings.tool === t.id, className: toggle(settings.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
2773
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1 flex flex-col min-w-0", children: [
2774
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-2 p-2 border-b border-border", children: [
2775
+ brushTool && /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2776
+ "Size",
2777
+ /* @__PURE__ */ jsx15(
2778
+ "input",
2779
+ {
2780
+ type: "number",
2781
+ min: 1,
2782
+ "aria-label": "Brush size",
2783
+ value: settings.brushSize,
2784
+ onChange: (e) => set({ brushSize: Math.max(1, Number(e.target.value) || 1) }),
2785
+ className: "w-16 bg-background border border-border rounded px-1 py-0.5 text-foreground"
2786
+ }
2787
+ ),
2788
+ "px"
2789
+ ] }),
2790
+ settings.tool !== "refine-brush" && settings.tool !== "hand" && settings.tool !== "zoom" && /* @__PURE__ */ jsxs13("div", { role: "group", "aria-label": "Stroke mode", className: "flex gap-1", children: [
2791
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": settings.brushMode === "add", className: toggle(settings.brushMode === "add"), onClick: () => set({ brushMode: "add" }), children: "Add" }),
2792
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": settings.brushMode === "subtract", className: toggle(settings.brushMode === "subtract"), onClick: () => set({ brushMode: "subtract" }), children: "Subtract" })
2793
+ ] }),
2794
+ /* @__PURE__ */ jsxs13("span", { className: "text-muted-foreground", children: [
2795
+ session.edits.length,
2796
+ " strokes"
2797
+ ] }),
2798
+ /* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !session.edits.length, onClick: () => session.undoEdit(), children: "Undo Stroke" }),
2799
+ /* @__PURE__ */ jsxs13("span", { className: "font-mono text-muted-foreground", children: [
2800
+ Math.round(zoom * 100),
2801
+ "%"
2802
+ ] })
2803
+ ] }),
2804
+ /* @__PURE__ */ jsx15("div", { className: "flex-1 overflow-hidden flex items-center justify-center bg-muted/30", children: /* @__PURE__ */ jsx15(
2805
+ "canvas",
2806
+ {
2807
+ ref: canvasRef,
2808
+ "data-testid": "select-and-mask-preview",
2809
+ onPointerDown: onDown,
2810
+ onPointerMove: onMove,
2811
+ onPointerUp: onUp,
2812
+ style: {
2813
+ // Fitted to the area at its own aspect ratio; zoom and pan are a transform.
2814
+ maxWidth: "100%",
2815
+ maxHeight: "100%",
2816
+ transform: `translate(${pan.x}px, ${pan.y}px) scale(${zoom})`,
2817
+ imageRendering: zoom > 2 ? "pixelated" : void 0,
2818
+ cursor: settings.tool === "hand" ? "grab" : settings.tool === "zoom" ? "zoom-in" : "crosshair"
2819
+ }
2820
+ }
2821
+ ) })
2822
+ ] }),
2823
+ /* @__PURE__ */ jsxs13("div", { className: "w-64 flex flex-col gap-3 p-3 border-l border-border overflow-y-auto", children: [
2824
+ /* @__PURE__ */ jsx15("span", { className: imageSectionTitleClass, children: "View Mode" }),
2825
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2826
+ "View",
2827
+ /* @__PURE__ */ jsx15(
2828
+ ImageSelect,
2829
+ {
2830
+ label: "View",
2831
+ value: settings.view,
2832
+ options: SELECT_AND_MASK_VIEWS.map((v) => ({ value: v.id, label: `${v.label} (${v.key.toUpperCase()})` })),
2833
+ onChange: (v) => set({ view: v })
2834
+ }
2835
+ )
2836
+ ] }),
2837
+ /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2838
+ /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2839
+ /* @__PURE__ */ jsx15("span", { children: "Opacity" }),
2840
+ /* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
2841
+ Math.round(settings.opacity * 100),
2842
+ "%"
2843
+ ] })
2844
+ ] }),
2845
+ /* @__PURE__ */ jsx15(ImageRange, { label: "View opacity", min: 0, max: 100, step: 1, value: Math.round(settings.opacity * 100), onChange: (v) => set({ opacity: v / 100 }) })
2846
+ ] }),
2847
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2848
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Show Edge", checked: settings.showEdge, onChange: (on) => set({ showEdge: on }) }),
2849
+ "Show Edge (J)"
2850
+ ] }),
2851
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2852
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Show Original", checked: settings.showOriginal, onChange: (on) => set({ showOriginal: on }) }),
2853
+ "Show Original (P)"
2854
+ ] }),
2855
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2856
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Real-Time Refinement", checked: settings.realTime, onChange: (on) => set({ realTime: on }) }),
2857
+ "Real-Time Refinement"
2858
+ ] }),
2859
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2860
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "High Quality Preview", checked: settings.highQuality, onChange: (on) => set({ highQuality: on }) }),
2861
+ "High Quality Preview"
2862
+ ] }),
2863
+ /* @__PURE__ */ jsx15("span", { className: imageSectionTitleClass, children: "Edge Detection and Refinement" }),
2864
+ controller.segmentationProvider && /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2865
+ "Mode",
2866
+ /* @__PURE__ */ jsx15(
2867
+ ImageSelect,
2868
+ {
2869
+ label: "Refine mode",
2870
+ value: settings.refineMode,
2871
+ options: [
2872
+ { value: "color", label: "Color Aware" },
2873
+ { value: "object", label: "Object Aware" }
2874
+ ],
2875
+ onChange: (v) => set({ refineMode: v })
2876
+ }
2877
+ )
2878
+ ] }),
2879
+ REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2880
+ /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2881
+ /* @__PURE__ */ jsx15("span", { children: c.label }),
2882
+ /* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
2883
+ settings.params[c.id],
2884
+ c.unit
2885
+ ] })
2886
+ ] }),
2887
+ /* @__PURE__ */ jsx15(ImageRange, { label: `Workspace ${c.label}`, min: c.min, max: c.max, step: c.step, value: settings.params[c.id], onChange: (v) => set({ params: { ...settings.params, [c.id]: v } }) })
2888
+ ] }, c.id)),
2889
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2890
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Workspace Smart Radius", checked: settings.params.smartRadius, onChange: (on) => set({ params: { ...settings.params, smartRadius: on } }) }),
2891
+ "Smart Radius"
2892
+ ] }),
2893
+ /* @__PURE__ */ jsx15("span", { className: imageSectionTitleClass, children: "Output Settings" }),
2894
+ /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2895
+ /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2896
+ /* @__PURE__ */ jsxs13("span", { children: [
2897
+ "Decontaminate Colors",
2898
+ toLayer ? "" : " (new layer outputs)"
2899
+ ] }),
2900
+ /* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
2901
+ settings.decontaminate,
2902
+ "%"
2903
+ ] })
2904
+ ] }),
2905
+ /* @__PURE__ */ jsx15(ImageRange, { label: "Workspace decontaminate amount", min: 0, max: 100, step: 1, value: settings.decontaminate, disabled: !toLayer, onChange: (v) => set({ decontaminate: v }) })
2906
+ ] }),
2907
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2908
+ "Output To",
2909
+ /* @__PURE__ */ jsx15(
2910
+ ImageSelect,
2911
+ {
2912
+ label: "Output to",
2913
+ value: settings.output,
2914
+ options: REFINE_OUTPUTS.map((o) => ({ value: o.id, label: o.label })),
2915
+ onChange: (v) => set({ output: v })
2916
+ }
2917
+ )
2918
+ ] }),
2919
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2", children: [
2920
+ /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Remember Settings", checked: settings.remember, onChange: (on) => set({ remember: on }) }),
2921
+ "Remember Settings"
2922
+ ] }),
2923
+ (error ?? session.error) && /* @__PURE__ */ jsx15("p", { role: "alert", className: "text-destructive", children: error ?? session.error }),
2924
+ session.note && /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: session.note }),
2925
+ /* @__PURE__ */ jsxs13("div", { className: "flex gap-1 mt-auto", children: [
2926
+ /* @__PURE__ */ jsx15("button", { type: "button", className: button, onClick: () => session.reset(), children: "Reset" }),
2927
+ /* @__PURE__ */ jsx15("button", { type: "button", className: button, onClick: () => onClose(null), children: "Cancel" }),
2928
+ /* @__PURE__ */ jsx15("button", { type: "button", className: toggle(true), disabled: busy, "aria-busy": busy, onClick: () => void ok(), children: "OK" })
2929
+ ] })
2930
+ ] })
2931
+ ]
2932
+ }
2933
+ );
2934
+ };
2935
+
2936
+ // src/image-editor/SelectionOptionsBar.tsx
2937
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2676
2938
  var MODIFY_OPS = [
2677
2939
  { op: "expand", label: "Expand" },
2678
2940
  { op: "contract", label: "Contract" },
@@ -2696,15 +2958,15 @@ var SelectionOptionsBar = ({
2696
2958
  selectionDisplay,
2697
2959
  className = ""
2698
2960
  }) => {
2699
- const [radius, setRadius] = useState11(2);
2961
+ const [radius, setRadius] = useState12(2);
2700
2962
  const set = (patch) => onOptionsChange({ ...options, ...patch });
2701
2963
  const sel = selection === void 0 ? controller.getSelection() : selection;
2702
2964
  const display = selectionDisplay ?? (quickMask === void 0 ? controller.getSelectionDisplay() : quickMask ? "quickMask" : "ants");
2703
- const [preset, setPreset] = useState11("reds");
2704
- const [rangeStatus, setRangeStatus] = useState11(null);
2705
- const [colorStatus, setColorStatus] = useState11(null);
2706
- const [strokeWidth, setStrokeWidth] = useState11(4);
2707
- const [strokeLocation, setStrokeLocation] = useState11("outside");
2965
+ const [preset, setPreset] = useState12("reds");
2966
+ const [rangeStatus, setRangeStatus] = useState12(null);
2967
+ const [colorStatus, setColorStatus] = useState12(null);
2968
+ const [strokeWidth, setStrokeWidth] = useState12(4);
2969
+ const [strokeLocation, setStrokeLocation] = useState12("outside");
2708
2970
  const edit = (fn) => {
2709
2971
  setColorStatus(null);
2710
2972
  try {
@@ -2737,9 +2999,9 @@ var SelectionOptionsBar = ({
2737
2999
  setRangeStatus(err instanceof Error ? err.message : String(err));
2738
3000
  }
2739
3001
  };
2740
- const [subject, setSubject] = useState11("");
2741
- const [segmenting, setSegmenting] = useState11(false);
2742
- const [subjectStatus, setSubjectStatus] = useState11(null);
3002
+ const [subject, setSubject] = useState12("");
3003
+ const [segmenting, setSegmenting] = useState12(false);
3004
+ const [subjectStatus, setSubjectStatus] = useState12(null);
2743
3005
  const selectSubject = async () => {
2744
3006
  const target = subject.trim();
2745
3007
  const canSegment = Boolean(controller.segmentationProvider);
@@ -2755,8 +3017,9 @@ var SelectionOptionsBar = ({
2755
3017
  setSegmenting(false);
2756
3018
  }
2757
3019
  };
2758
- const [skying, setSkying] = useState11(false);
2759
- const [skyStatus, setSkyStatus] = useState11(null);
3020
+ const [workspace, setWorkspace] = useState12(false);
3021
+ const [skying, setSkying] = useState12(false);
3022
+ const [skyStatus, setSkyStatus] = useState12(null);
2760
3023
  const selectSky = async () => {
2761
3024
  if (skying) return;
2762
3025
  setSkying(true);
@@ -2770,8 +3033,8 @@ var SelectionOptionsBar = ({
2770
3033
  setSkying(false);
2771
3034
  }
2772
3035
  };
2773
- const [focusing, setFocusing] = useState11(false);
2774
- const [focusStatus, setFocusStatus] = useState11(null);
3036
+ const [focusing, setFocusing] = useState12(false);
3037
+ const [focusStatus, setFocusStatus] = useState12(null);
2775
3038
  const selectFocusArea = async () => {
2776
3039
  if (focusing) return;
2777
3040
  setFocusing(true);
@@ -2790,24 +3053,24 @@ var SelectionOptionsBar = ({
2790
3053
  setFocusing(false);
2791
3054
  }
2792
3055
  };
2793
- return /* @__PURE__ */ jsxs13("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
2794
- /* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx15("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)) }),
2795
- /* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
2796
- options.tool === "wand" && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
2797
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2798
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2799
- /* @__PURE__ */ jsx15("span", { children: "Tolerance" }),
2800
- /* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.tolerance })
3056
+ return /* @__PURE__ */ jsxs14("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3057
+ /* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx16("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)) }),
3058
+ /* @__PURE__ */ jsx16("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
3059
+ options.tool === "wand" && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
3060
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3061
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3062
+ /* @__PURE__ */ jsx16("span", { children: "Tolerance" }),
3063
+ /* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.tolerance })
2801
3064
  ] }),
2802
- /* @__PURE__ */ jsx15(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
3065
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
2803
3066
  ] }),
2804
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
2805
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
3067
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3068
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
2806
3069
  "Contiguous"
2807
3070
  ] }),
2808
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
3071
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
2809
3072
  "Distance",
2810
- /* @__PURE__ */ jsx15(
3073
+ /* @__PURE__ */ jsx16(
2811
3074
  ImageSelect,
2812
3075
  {
2813
3076
  label: "Colour distance",
@@ -2820,13 +3083,13 @@ var SelectionOptionsBar = ({
2820
3083
  }
2821
3084
  )
2822
3085
  ] }),
2823
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
2824
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
3086
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3087
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
2825
3088
  "Sample adjusted image"
2826
3089
  ] }),
2827
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
3090
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
2828
3091
  "Sample",
2829
- /* @__PURE__ */ jsx15(
3092
+ /* @__PURE__ */ jsx16(
2830
3093
  ImageSelect,
2831
3094
  {
2832
3095
  label: "Sample from",
@@ -2840,77 +3103,77 @@ var SelectionOptionsBar = ({
2840
3103
  )
2841
3104
  ] })
2842
3105
  ] }),
2843
- options.tool === "polygon" && /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
2844
- options.tool === "magnetic" && /* @__PURE__ */ jsxs13("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
2845
- /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Click on an edge, then move along it: the outline snaps to the edge and adds points as it goes. Click to add a point; double-click, Enter or a click on the start closes it, Backspace removes the last point, Escape cancels." }),
2846
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2847
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2848
- /* @__PURE__ */ jsx15("span", { children: "Width" }),
2849
- /* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
3106
+ options.tool === "polygon" && /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
3107
+ options.tool === "magnetic" && /* @__PURE__ */ jsxs14("div", { "data-testid": "magnetic-lasso-options", className: "flex flex-col gap-2", children: [
3108
+ /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Click on an edge, then move along it: the outline snaps to the edge and adds points as it goes. Click to add a point; double-click, Enter or a click on the start closes it, Backspace removes the last point, Escape cancels." }),
3109
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3110
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3111
+ /* @__PURE__ */ jsx16("span", { children: "Width" }),
3112
+ /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
2850
3113
  options.magneticWidth ?? 10,
2851
3114
  " px"
2852
3115
  ] })
2853
3116
  ] }),
2854
- /* @__PURE__ */ jsx15(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
3117
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Magnetic lasso width", min: 1, max: 256, step: 1, value: options.magneticWidth ?? 10, onChange: (v) => set({ magneticWidth: v }) })
2855
3118
  ] }),
2856
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2857
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2858
- /* @__PURE__ */ jsx15("span", { children: "Contrast" }),
2859
- /* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
3119
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3120
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3121
+ /* @__PURE__ */ jsx16("span", { children: "Contrast" }),
3122
+ /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
2860
3123
  options.magneticContrast ?? 10,
2861
3124
  "%"
2862
3125
  ] })
2863
3126
  ] }),
2864
- /* @__PURE__ */ jsx15(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
3127
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Magnetic lasso contrast", min: 1, max: 100, step: 1, value: options.magneticContrast ?? 10, onChange: (v) => set({ magneticContrast: v }) })
2865
3128
  ] }),
2866
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2867
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2868
- /* @__PURE__ */ jsx15("span", { children: "Frequency" }),
2869
- /* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
3129
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3130
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3131
+ /* @__PURE__ */ jsx16("span", { children: "Frequency" }),
3132
+ /* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.magneticFrequency ?? 57 })
2870
3133
  ] }),
2871
- /* @__PURE__ */ jsx15(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
3134
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Magnetic lasso frequency", min: 0, max: 100, step: 1, value: options.magneticFrequency ?? 57, onChange: (v) => set({ magneticFrequency: v }) })
2872
3135
  ] })
2873
3136
  ] }),
2874
- options.tool === "quick" && /* @__PURE__ */ jsxs13("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
2875
- /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
2876
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2877
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2878
- /* @__PURE__ */ jsx15("span", { children: "Size" }),
2879
- /* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
3137
+ options.tool === "quick" && /* @__PURE__ */ jsxs14("div", { "data-testid": "quick-selection-options", className: "flex flex-col gap-2", children: [
3138
+ /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Paint inside the area: the selection grows out to its edges. Each stroke adds (Alt-drag subtracts)." }),
3139
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3140
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3141
+ /* @__PURE__ */ jsx16("span", { children: "Size" }),
3142
+ /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
2880
3143
  options.quickSize ?? 30,
2881
3144
  " px"
2882
3145
  ] })
2883
3146
  ] }),
2884
- /* @__PURE__ */ jsx15(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
3147
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Quick selection size", min: 1, max: 500, step: 1, value: options.quickSize ?? 30, onChange: (v) => set({ quickSize: v }) })
2885
3148
  ] }),
2886
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
2887
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
3149
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3150
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Sample all layers", checked: options.quickSampleAll ?? true, onChange: (on) => set({ quickSampleAll: on }) }),
2888
3151
  "Sample all layers"
2889
3152
  ] }),
2890
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
2891
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
3153
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3154
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Auto-enhance edges", checked: options.quickEnhance ?? false, onChange: (on) => set({ quickEnhance: on }) }),
2892
3155
  "Auto-enhance edges"
2893
3156
  ] })
2894
3157
  ] }),
2895
- options.tool === "object" && /* @__PURE__ */ jsxs13("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
2896
- /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
2897
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
2898
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
3158
+ options.tool === "object" && /* @__PURE__ */ jsxs14("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
3159
+ /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
3160
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3161
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
2899
3162
  "Sample all layers"
2900
3163
  ] }),
2901
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
2902
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
3164
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3165
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
2903
3166
  "Auto-enhance edges"
2904
3167
  ] })
2905
3168
  ] }),
2906
- (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs13("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
2907
- /* @__PURE__ */ jsxs13("p", { className: "text-muted-foreground", children: [
3169
+ (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs14("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
3170
+ /* @__PURE__ */ jsxs14("p", { className: "text-muted-foreground", children: [
2908
3171
  options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
2909
3172
  " Shift-click adds, Alt-click subtracts."
2910
3173
  ] }),
2911
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3174
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2912
3175
  "Text",
2913
- /* @__PURE__ */ jsx15(
3176
+ /* @__PURE__ */ jsx16(
2914
3177
  "input",
2915
3178
  {
2916
3179
  type: "text",
@@ -2921,9 +3184,9 @@ var SelectionOptionsBar = ({
2921
3184
  }
2922
3185
  )
2923
3186
  ] }),
2924
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3187
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2925
3188
  "Size",
2926
- /* @__PURE__ */ jsx15(
3189
+ /* @__PURE__ */ jsx16(
2927
3190
  "input",
2928
3191
  {
2929
3192
  type: "number",
@@ -2937,9 +3200,9 @@ var SelectionOptionsBar = ({
2937
3200
  ),
2938
3201
  "px"
2939
3202
  ] }),
2940
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3203
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2941
3204
  "Font",
2942
- /* @__PURE__ */ jsx15(
3205
+ /* @__PURE__ */ jsx16(
2943
3206
  "input",
2944
3207
  {
2945
3208
  type: "text",
@@ -2951,18 +3214,18 @@ var SelectionOptionsBar = ({
2951
3214
  )
2952
3215
  ] })
2953
3216
  ] }),
2954
- options.tool === "range" && /* @__PURE__ */ jsxs13("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
2955
- /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
2956
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
2957
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
2958
- /* @__PURE__ */ jsx15("span", { children: "Fuzziness" }),
2959
- /* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.fuzziness ?? 40 })
3217
+ options.tool === "range" && /* @__PURE__ */ jsxs14("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
3218
+ /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
3219
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3220
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3221
+ /* @__PURE__ */ jsx16("span", { children: "Fuzziness" }),
3222
+ /* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.fuzziness ?? 40 })
2960
3223
  ] }),
2961
- /* @__PURE__ */ jsx15(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
3224
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Fuzziness", min: 0, max: 200, step: 1, value: options.fuzziness ?? 40, onChange: (v) => set({ fuzziness: v }) })
2962
3225
  ] }),
2963
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3226
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2964
3227
  "Localized radius",
2965
- /* @__PURE__ */ jsx15(
3228
+ /* @__PURE__ */ jsx16(
2966
3229
  "input",
2967
3230
  {
2968
3231
  type: "number",
@@ -2976,12 +3239,12 @@ var SelectionOptionsBar = ({
2976
3239
  ),
2977
3240
  "px"
2978
3241
  ] }),
2979
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
2980
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
3242
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3243
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Invert", checked: options.rangeInvert ?? false, onChange: (on) => set({ rangeInvert: on }) }),
2981
3244
  "Invert"
2982
3245
  ] }),
2983
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
2984
- /* @__PURE__ */ jsx15(
3246
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
3247
+ /* @__PURE__ */ jsx16(
2985
3248
  ImageSelect,
2986
3249
  {
2987
3250
  label: "Color Range preset",
@@ -2990,13 +3253,13 @@ var SelectionOptionsBar = ({
2990
3253
  onChange: (v) => setPreset(v)
2991
3254
  }
2992
3255
  ),
2993
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
3256
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => void applyPreset(), children: "Select" })
2994
3257
  ] }),
2995
- rangeStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
3258
+ rangeStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: rangeStatus })
2996
3259
  ] }),
2997
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3260
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2998
3261
  "Feather",
2999
- /* @__PURE__ */ jsx15(
3262
+ /* @__PURE__ */ jsx16(
3000
3263
  "input",
3001
3264
  {
3002
3265
  type: "number",
@@ -3011,7 +3274,7 @@ var SelectionOptionsBar = ({
3011
3274
  ),
3012
3275
  "px"
3013
3276
  ] }),
3014
- /* @__PURE__ */ jsxs13(
3277
+ /* @__PURE__ */ jsxs14(
3015
3278
  "form",
3016
3279
  {
3017
3280
  "data-testid": "select-subject",
@@ -3021,8 +3284,8 @@ var SelectionOptionsBar = ({
3021
3284
  void selectSubject();
3022
3285
  },
3023
3286
  children: [
3024
- /* @__PURE__ */ jsxs13("div", { className: "flex gap-1", children: [
3025
- controller.segmentationProvider && /* @__PURE__ */ jsx15(
3287
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
3288
+ controller.segmentationProvider && /* @__PURE__ */ jsx16(
3026
3289
  "input",
3027
3290
  {
3028
3291
  type: "text",
@@ -3034,7 +3297,7 @@ var SelectionOptionsBar = ({
3034
3297
  className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
3035
3298
  }
3036
3299
  ),
3037
- /* @__PURE__ */ jsx15(
3300
+ /* @__PURE__ */ jsx16(
3038
3301
  "button",
3039
3302
  {
3040
3303
  type: "submit",
@@ -3046,65 +3309,67 @@ var SelectionOptionsBar = ({
3046
3309
  }
3047
3310
  )
3048
3311
  ] }),
3049
- subjectStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
3312
+ subjectStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
3050
3313
  ]
3051
3314
  }
3052
3315
  ),
3053
- /* @__PURE__ */ jsxs13("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
3054
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
3055
- skyStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
3316
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => setWorkspace(true), children: "Select and Mask\u2026" }),
3317
+ workspace && /* @__PURE__ */ jsx16(SelectAndMaskWorkspace, { controller, onClose: () => setWorkspace(false) }),
3318
+ /* @__PURE__ */ jsxs14("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
3319
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
3320
+ skyStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
3056
3321
  ] }),
3057
- /* @__PURE__ */ jsxs13("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
3058
- /* @__PURE__ */ jsx15("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
3059
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 pt-2", children: [
3060
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
3061
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
3062
- /* @__PURE__ */ jsx15("span", { children: "In-focus range" }),
3063
- /* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.focusRange ?? 50 })
3322
+ /* @__PURE__ */ jsxs14("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
3323
+ /* @__PURE__ */ jsx16("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
3324
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2 pt-2", children: [
3325
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3326
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3327
+ /* @__PURE__ */ jsx16("span", { children: "In-focus range" }),
3328
+ /* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.focusRange ?? 50 })
3064
3329
  ] }),
3065
- /* @__PURE__ */ jsx15(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
3330
+ /* @__PURE__ */ jsx16(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
3066
3331
  ] }),
3067
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
3068
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
3069
- /* @__PURE__ */ jsx15("span", { children: "Image noise level" }),
3070
- /* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.focusNoise ?? 0 })
3332
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3333
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3334
+ /* @__PURE__ */ jsx16("span", { children: "Image noise level" }),
3335
+ /* @__PURE__ */ jsx16("span", { className: "font-mono", children: options.focusNoise ?? 0 })
3071
3336
  ] }),
3072
- /* @__PURE__ */ jsx15(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
3337
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
3073
3338
  ] }),
3074
- /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
3075
- /* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
3076
- /* @__PURE__ */ jsx15("span", { children: "Soften edge" }),
3077
- /* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
3339
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3340
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3341
+ /* @__PURE__ */ jsx16("span", { children: "Soften edge" }),
3342
+ /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3078
3343
  options.focusSoftness ?? 4,
3079
3344
  " px"
3080
3345
  ] })
3081
3346
  ] }),
3082
- /* @__PURE__ */ jsx15(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
3347
+ /* @__PURE__ */ jsx16(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
3083
3348
  ] }),
3084
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
3085
- focusStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
3349
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
3350
+ focusStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
3086
3351
  ] })
3087
3352
  ] }),
3088
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
3089
- /* @__PURE__ */ jsx15(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
3353
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3354
+ /* @__PURE__ */ jsx16(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
3090
3355
  "Anti-alias"
3091
3356
  ] }),
3092
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-1", children: [
3093
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
3094
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
3095
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
3096
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
3097
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
3098
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
3357
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-1", children: [
3358
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
3359
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
3360
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
3361
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !controller.canReselect(), onClick: () => controller.reselect(), children: "Reselect" }),
3362
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, title: "Add connected pixels of a selected colour (wand tolerance)", onClick: () => void runColor("grow"), children: "Grow" }),
3363
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, title: "Add every pixel of a selected colour (wand tolerance)", onClick: () => void runColor("similar"), children: "Similar" })
3099
3364
  ] }),
3100
- /* @__PURE__ */ jsxs13("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
3101
- /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: "Show" }),
3102
- DISPLAYS.map((d) => /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
3365
+ /* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Show selection", className: "flex flex-wrap items-center gap-1", children: [
3366
+ /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: "Show" }),
3367
+ DISPLAYS.map((d) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-pressed": display === d.id, className: btn(display === d.id), onClick: () => controller.setSelectionDisplay(d.id), children: d.label }, d.id))
3103
3368
  ] }),
3104
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", children: [
3105
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3369
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", children: [
3370
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3106
3371
  "Radius",
3107
- /* @__PURE__ */ jsx15(
3372
+ /* @__PURE__ */ jsx16(
3108
3373
  "input",
3109
3374
  {
3110
3375
  type: "number",
@@ -3118,12 +3383,12 @@ var SelectionOptionsBar = ({
3118
3383
  }
3119
3384
  )
3120
3385
  ] }),
3121
- MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
3386
+ MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
3122
3387
  ] }),
3123
- /* @__PURE__ */ jsxs13("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
3124
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3388
+ /* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Edit selection", className: "flex flex-wrap items-center gap-1", children: [
3389
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
3125
3390
  "Stroke",
3126
- /* @__PURE__ */ jsx15(
3391
+ /* @__PURE__ */ jsx16(
3127
3392
  "input",
3128
3393
  {
3129
3394
  type: "number",
@@ -3138,7 +3403,7 @@ var SelectionOptionsBar = ({
3138
3403
  ),
3139
3404
  "px"
3140
3405
  ] }),
3141
- /* @__PURE__ */ jsx15(
3406
+ /* @__PURE__ */ jsx16(
3142
3407
  ImageSelect,
3143
3408
  {
3144
3409
  label: "Stroke location",
@@ -3151,44 +3416,46 @@ var SelectionOptionsBar = ({
3151
3416
  onChange: (v) => setStrokeLocation(v)
3152
3417
  }
3153
3418
  ),
3154
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
3155
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
3156
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" })
3419
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.strokeSelection({ width: strokeWidth, location: strokeLocation })), children: "Stroke" }),
3420
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cropToSelection()), children: "Crop to Selection" }),
3421
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.contentAwareFill({ output: "new-layer" })), children: "Content-Aware Fill" })
3157
3422
  ] }),
3158
- /* @__PURE__ */ jsxs13("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
3159
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
3160
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
3161
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
3162
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
3163
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
3164
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
3165
- /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
3423
+ /* @__PURE__ */ jsxs14("div", { role: "group", "aria-label": "Clipboard", className: "flex flex-wrap gap-1", children: [
3424
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels()), children: "Copy" }),
3425
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.copyPixels({ merged: true })), children: "Copy Merged" }),
3426
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.cutPixels()), children: "Cut" }),
3427
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("new-layer")), children: "Paste" }),
3428
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), onClick: () => edit(() => controller.pastePixels("in-place")), children: "Paste in Place" }),
3429
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("into")), children: "Paste Into" }),
3430
+ /* @__PURE__ */ jsx16("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => edit(() => controller.pastePixels("outside")), children: "Paste Outside" })
3166
3431
  ] }),
3167
- colorStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
3168
- /* @__PURE__ */ jsx15("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
3432
+ colorStatus && /* @__PURE__ */ jsx16("p", { role: "status", className: "text-muted-foreground", children: colorStatus }),
3433
+ /* @__PURE__ */ jsx16("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: describeSelection(sel) })
3169
3434
  ] });
3170
3435
  };
3171
3436
 
3172
3437
  // src/image-editor/RefineEdgePanel.tsx
3173
- import { useState as useState12 } from "react";
3438
+ import { useState as useState13 } from "react";
3174
3439
  import {
3175
3440
  ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
3176
- REFINE_EDGE_CONTROLS,
3177
- REFINE_OUTPUTS,
3441
+ REFINE_EDGE_CONTROLS as REFINE_EDGE_CONTROLS2,
3442
+ REFINE_OUTPUTS as REFINE_OUTPUTS2,
3178
3443
  adjustmentKindLabel as adjustmentKindLabel2,
3179
3444
  layerMaskFromSelection
3180
3445
  } from "@pixerate/editor/image-editor";
3181
- import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3446
+ import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3182
3447
  var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
3183
- var button = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
3448
+ 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";
3184
3449
  var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3185
- const [params, setParams] = useState12(DEFAULT_PARAMS);
3186
- const [busy, setBusy] = useState12(false);
3187
- const [error, setError] = useState12(null);
3188
- const [layerId, setLayerId] = useState12("");
3189
- const [newKind, setNewKind] = useState12("hueSaturation");
3190
- const [output, setOutput] = useState12("selection");
3191
- const [decontaminate, setDecontaminate] = useState12(0);
3450
+ const [params, setParams] = useState13(DEFAULT_PARAMS);
3451
+ const [busy, setBusy] = useState13(false);
3452
+ const [error, setError] = useState13(null);
3453
+ const [layerId, setLayerId] = useState13("");
3454
+ const [newKind, setNewKind] = useState13("hueSaturation");
3455
+ const [output, setOutput] = useState13("selection");
3456
+ const [decontaminate, setDecontaminate] = useState13(0);
3457
+ const [objectAware, setObjectAware] = useState13(false);
3458
+ const canObject = Boolean(controller.segmentationProvider);
3192
3459
  const toLayer = output === "new-layer" || output === "new-layer-with-mask";
3193
3460
  const sel = selection === void 0 ? controller.getSelection() : selection;
3194
3461
  const list = layers ?? controller.getAdjustmentLayers();
@@ -3197,24 +3464,27 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3197
3464
  setBusy(true);
3198
3465
  setError(null);
3199
3466
  try {
3200
- await controller.refineSelectionTo(params, output, { decontaminate: toLayer ? decontaminate : 0 });
3467
+ await controller.refineSelectionTo(params, output, {
3468
+ decontaminate: toLayer ? decontaminate : 0,
3469
+ refineMode: canObject && objectAware ? "object" : "color"
3470
+ });
3201
3471
  } catch (err) {
3202
3472
  setError(err instanceof Error ? err.message : String(err));
3203
3473
  } finally {
3204
3474
  setBusy(false);
3205
3475
  }
3206
3476
  };
3207
- return /* @__PURE__ */ jsxs14("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3208
- /* @__PURE__ */ jsx16("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
3209
- REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3210
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3211
- /* @__PURE__ */ jsx16("span", { children: c.label }),
3212
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3477
+ return /* @__PURE__ */ jsxs15("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3478
+ /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
3479
+ REFINE_EDGE_CONTROLS2.map((c) => /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3480
+ /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3481
+ /* @__PURE__ */ jsx17("span", { children: c.label }),
3482
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3213
3483
  params[c.id],
3214
3484
  c.unit
3215
3485
  ] })
3216
3486
  ] }),
3217
- /* @__PURE__ */ jsx16(
3487
+ /* @__PURE__ */ jsx17(
3218
3488
  "input",
3219
3489
  {
3220
3490
  type: "range",
@@ -3228,35 +3498,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3228
3498
  }
3229
3499
  )
3230
3500
  ] }, c.id)),
3231
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
3232
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3501
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
3502
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3233
3503
  "Smart Radius"
3234
3504
  ] }),
3235
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3505
+ canObject && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-foreground", children: [
3506
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
3507
+ "Object aware (segmentation model)"
3508
+ ] }),
3509
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3236
3510
  "Output to",
3237
- /* @__PURE__ */ jsx16(
3511
+ /* @__PURE__ */ jsx17(
3238
3512
  "select",
3239
3513
  {
3240
3514
  "aria-label": "Refine output",
3241
3515
  value: output,
3242
3516
  onChange: (e) => setOutput(e.target.value),
3243
3517
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3244
- children: REFINE_OUTPUTS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id))
3518
+ children: REFINE_OUTPUTS2.map((o) => /* @__PURE__ */ jsx17("option", { value: o.id, children: o.label }, o.id))
3245
3519
  }
3246
3520
  )
3247
3521
  ] }),
3248
- /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3249
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3250
- /* @__PURE__ */ jsxs14("span", { children: [
3522
+ /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3523
+ /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3524
+ /* @__PURE__ */ jsxs15("span", { children: [
3251
3525
  "Decontaminate colors",
3252
3526
  toLayer ? "" : " (new layer outputs)"
3253
3527
  ] }),
3254
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3528
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3255
3529
  decontaminate,
3256
3530
  "%"
3257
3531
  ] })
3258
3532
  ] }),
3259
- /* @__PURE__ */ jsx16(
3533
+ /* @__PURE__ */ jsx17(
3260
3534
  "input",
3261
3535
  {
3262
3536
  type: "range",
@@ -3271,63 +3545,63 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3271
3545
  }
3272
3546
  )
3273
3547
  ] }),
3274
- /* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
3275
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3276
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
3548
+ /* @__PURE__ */ jsxs15("div", { className: "flex gap-1", children: [
3549
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3550
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
3277
3551
  ] }),
3278
- error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "text-destructive", children: error }),
3279
- /* @__PURE__ */ jsx16("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
3280
- /* @__PURE__ */ jsxs14("div", { className: "flex gap-1 items-center", children: [
3281
- /* @__PURE__ */ jsx16(
3552
+ error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error }),
3553
+ /* @__PURE__ */ jsx17("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
3554
+ /* @__PURE__ */ jsxs15("div", { className: "flex gap-1 items-center", children: [
3555
+ /* @__PURE__ */ jsx17(
3282
3556
  "select",
3283
3557
  {
3284
3558
  "aria-label": "New masked layer kind",
3285
3559
  value: newKind,
3286
3560
  onChange: (e) => setNewKind(e.target.value),
3287
3561
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3288
- children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx16("option", { value: k.kind, children: k.label }, k.kind))
3562
+ children: ADJUSTMENT_KINDS2.map((k) => /* @__PURE__ */ jsx17("option", { value: k.kind, children: k.label }, k.kind))
3289
3563
  }
3290
3564
  ),
3291
- /* @__PURE__ */ jsx16(
3565
+ /* @__PURE__ */ jsx17(
3292
3566
  "button",
3293
3567
  {
3294
3568
  type: "button",
3295
- className: button,
3569
+ className: button2,
3296
3570
  disabled: !sel,
3297
3571
  onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: layerMaskFromSelection(sel) })),
3298
3572
  children: "New Masked Layer"
3299
3573
  }
3300
3574
  )
3301
3575
  ] }),
3302
- list.length > 0 && target && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
3303
- /* @__PURE__ */ jsx16(
3576
+ list.length > 0 && target && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2", children: [
3577
+ /* @__PURE__ */ jsx17(
3304
3578
  "select",
3305
3579
  {
3306
3580
  "aria-label": "Mask layer",
3307
3581
  value: target.id,
3308
3582
  onChange: (e) => setLayerId(e.target.value),
3309
3583
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
3310
- children: list.map((l) => /* @__PURE__ */ jsxs14("option", { value: l.id, children: [
3584
+ children: list.map((l) => /* @__PURE__ */ jsxs15("option", { value: l.id, children: [
3311
3585
  l.name || adjustmentKindLabel2(l.kind),
3312
3586
  l.mask ? " (masked)" : ""
3313
3587
  ] }, l.id))
3314
3588
  }
3315
3589
  ),
3316
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-1", children: [
3317
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
3318
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
3319
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
3590
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap gap-1", children: [
3591
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
3592
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
3593
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
3320
3594
  ] }),
3321
- target.mask && /* @__PURE__ */ jsxs14(Fragment3, { children: [
3322
- /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3323
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3324
- /* @__PURE__ */ jsx16("span", { children: "Density" }),
3325
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3595
+ target.mask && /* @__PURE__ */ jsxs15(Fragment3, { children: [
3596
+ /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3597
+ /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3598
+ /* @__PURE__ */ jsx17("span", { children: "Density" }),
3599
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3326
3600
  Math.round((target.mask.density ?? 1) * 100),
3327
3601
  "%"
3328
3602
  ] })
3329
3603
  ] }),
3330
- /* @__PURE__ */ jsx16(
3604
+ /* @__PURE__ */ jsx17(
3331
3605
  "input",
3332
3606
  {
3333
3607
  type: "range",
@@ -3341,15 +3615,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3341
3615
  }
3342
3616
  )
3343
3617
  ] }),
3344
- /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3345
- /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3346
- /* @__PURE__ */ jsx16("span", { children: "Mask Feather" }),
3347
- /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3618
+ /* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
3619
+ /* @__PURE__ */ jsxs15("span", { className: "flex justify-between text-muted-foreground", children: [
3620
+ /* @__PURE__ */ jsx17("span", { children: "Mask Feather" }),
3621
+ /* @__PURE__ */ jsxs15("span", { className: "font-mono", children: [
3348
3622
  target.mask.feather ?? 0,
3349
3623
  "px"
3350
3624
  ] })
3351
3625
  ] }),
3352
- /* @__PURE__ */ jsx16(
3626
+ /* @__PURE__ */ jsx17(
3353
3627
  "input",
3354
3628
  {
3355
3629
  type: "range",
@@ -3369,13 +3643,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3369
3643
  };
3370
3644
 
3371
3645
  // src/image-editor/ChannelsPanel.tsx
3372
- import { useEffect as useEffect10, useRef as useRef7, useState as useState13 } from "react";
3646
+ import { useEffect as useEffect11, useRef as useRef8, useState as useState14 } from "react";
3373
3647
  import { MASK_FILE_ACCEPT, channelThumbnail, downloadMaskImage, openMaskFile, selectionModeFromModifiers } from "@pixerate/editor/image-editor";
3374
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3648
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3375
3649
  var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
3376
3650
  var ChannelThumb = ({ channel, size }) => {
3377
- const ref = useRef7(null);
3378
- useEffect10(() => {
3651
+ const ref = useRef8(null);
3652
+ useEffect11(() => {
3379
3653
  const canvas = ref.current;
3380
3654
  const ctx = canvas?.getContext("2d");
3381
3655
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
@@ -3386,15 +3660,15 @@ var ChannelThumb = ({ channel, size }) => {
3386
3660
  img.data.set(px.data);
3387
3661
  ctx.putImageData(img, 0, 0);
3388
3662
  }, [channel.mask]);
3389
- return /* @__PURE__ */ jsx17("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
3663
+ return /* @__PURE__ */ jsx18("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
3390
3664
  };
3391
3665
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3392
- const [, setTick] = useState13(0);
3393
- useEffect10(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3394
- const [activeId, setActiveId] = useState13(null);
3395
- const [renaming, setRenaming] = useState13(null);
3396
- const [error, setError] = useState13(null);
3397
- const fileInput = useRef7(null);
3666
+ const [, setTick] = useState14(0);
3667
+ useEffect11(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3668
+ const [activeId, setActiveId] = useState14(null);
3669
+ const [renaming, setRenaming] = useState14(null);
3670
+ const [error, setError] = useState14(null);
3671
+ const fileInput = useRef8(null);
3398
3672
  const channels = controller.getChannels();
3399
3673
  const active = channels.find((c) => c.id === activeId) ?? null;
3400
3674
  const hasSelection = Boolean(controller.getSelection());
@@ -3416,13 +3690,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3416
3690
  setError(err instanceof Error ? err.message : String(err));
3417
3691
  }
3418
3692
  };
3419
- return /* @__PURE__ */ jsxs15("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
3420
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
3421
- /* @__PURE__ */ jsx17("span", { className: imageSectionTitleClass, children: "Channels" }),
3422
- /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
3693
+ return /* @__PURE__ */ jsxs16("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
3694
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
3695
+ /* @__PURE__ */ jsx18("span", { className: imageSectionTitleClass, children: "Channels" }),
3696
+ /* @__PURE__ */ jsx18("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
3423
3697
  ] }),
3424
- channels.length === 0 && /* @__PURE__ */ jsx17("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
3425
- /* @__PURE__ */ jsx17("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs15(
3698
+ channels.length === 0 && /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
3699
+ /* @__PURE__ */ jsx18("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ jsxs16(
3426
3700
  "li",
3427
3701
  {
3428
3702
  "data-testid": "channel-row",
@@ -3434,7 +3708,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3434
3708
  },
3435
3709
  onDoubleClick: () => setRenaming(c.id),
3436
3710
  children: [
3437
- /* @__PURE__ */ jsx17(
3711
+ /* @__PURE__ */ jsx18(
3438
3712
  "button",
3439
3713
  {
3440
3714
  type: "button",
@@ -3448,8 +3722,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3448
3722
  children: c.visible ? "\u25CF" : "\u25CB"
3449
3723
  }
3450
3724
  ),
3451
- /* @__PURE__ */ jsx17(ChannelThumb, { channel: c, size: thumbnailSize }),
3452
- renaming === c.id ? /* @__PURE__ */ jsx17(
3725
+ /* @__PURE__ */ jsx18(ChannelThumb, { channel: c, size: thumbnailSize }),
3726
+ renaming === c.id ? /* @__PURE__ */ jsx18(
3453
3727
  "input",
3454
3728
  {
3455
3729
  autoFocus: true,
@@ -3466,16 +3740,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3466
3740
  if (e.key === "Escape") setRenaming(null);
3467
3741
  }
3468
3742
  }
3469
- ) : /* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate", children: c.name })
3743
+ ) : /* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 truncate", children: c.name })
3470
3744
  ]
3471
3745
  },
3472
3746
  c.id
3473
3747
  )) }),
3474
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap gap-1", children: [
3475
- /* @__PURE__ */ jsx17("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
3476
- /* @__PURE__ */ jsx17("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
3477
- /* @__PURE__ */ jsx17("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
3478
- /* @__PURE__ */ jsx17(
3748
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap gap-1", children: [
3749
+ /* @__PURE__ */ jsx18("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
3750
+ /* @__PURE__ */ jsx18("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
3751
+ /* @__PURE__ */ jsx18("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
3752
+ /* @__PURE__ */ jsx18(
3479
3753
  "button",
3480
3754
  {
3481
3755
  type: "button",
@@ -3488,8 +3762,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3488
3762
  children: "Delete"
3489
3763
  }
3490
3764
  ),
3491
- /* @__PURE__ */ jsx17("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
3492
- /* @__PURE__ */ jsx17(
3765
+ /* @__PURE__ */ jsx18("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
3766
+ /* @__PURE__ */ jsx18(
3493
3767
  "button",
3494
3768
  {
3495
3769
  type: "button",
@@ -3500,7 +3774,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3500
3774
  children: "Export PNG"
3501
3775
  }
3502
3776
  ),
3503
- /* @__PURE__ */ jsx17(
3777
+ /* @__PURE__ */ jsx18(
3504
3778
  "input",
3505
3779
  {
3506
3780
  ref: fileInput,
@@ -3515,18 +3789,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
3515
3789
  }
3516
3790
  )
3517
3791
  ] }),
3518
- error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "text-destructive", children: error })
3792
+ error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "text-destructive", children: error })
3519
3793
  ] });
3520
3794
  };
3521
3795
 
3522
3796
  // src/image-editor/FreeTransformOptionsBar.tsx
3523
- import { useEffect as useEffect11, useState as useState14 } from "react";
3797
+ import { useEffect as useEffect12, useState as useState15 } from "react";
3524
3798
  import { FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODE_OPTIONS, INTERPOLATIONS, TRANSFORM_ANCHORS, WARP_GRID_OPTIONS, WARP_STYLE_OPTIONS } from "@pixerate/editor/image-editor";
3525
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3799
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3526
3800
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
3527
3801
  var FreeTransformOptionsBar = ({ tool, className }) => {
3528
- const [, setTick] = useState14(0);
3529
- useEffect11(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
3802
+ const [, setTick] = useState15(0);
3803
+ useEffect12(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
3530
3804
  const bar = tool.bar();
3531
3805
  if (!tool.active || !bar) return null;
3532
3806
  const warp = tool.warpBar();
@@ -3538,17 +3812,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
3538
3812
  const v = Number(raw);
3539
3813
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
3540
3814
  };
3541
- return /* @__PURE__ */ jsxs16("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: [
3542
- /* @__PURE__ */ jsx18("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx18("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)) }),
3543
- /* @__PURE__ */ jsx18("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx18("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)) }),
3544
- tool.mode === "warp" && /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
3545
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
3546
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Warp" }),
3547
- /* @__PURE__ */ jsx18("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx18("option", { value: o.id, children: o.label }, o.id)) })
3815
+ return /* @__PURE__ */ jsxs17("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: [
3816
+ /* @__PURE__ */ jsx19("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ jsx19("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)) }),
3817
+ /* @__PURE__ */ jsx19("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ jsx19("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)) }),
3818
+ tool.mode === "warp" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
3819
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3820
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Warp" }),
3821
+ /* @__PURE__ */ jsx19("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ jsx19("option", { value: o.id, children: o.label }, o.id)) })
3548
3822
  ] }),
3549
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
3550
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
3551
- /* @__PURE__ */ jsx18(
3823
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3824
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
3825
+ /* @__PURE__ */ jsx19(
3552
3826
  "input",
3553
3827
  {
3554
3828
  type: "number",
@@ -3569,9 +3843,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
3569
3843
  },
3570
3844
  `${k}:${warp[k]}`
3571
3845
  ),
3572
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "%" })
3846
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "%" })
3573
3847
  ] }, k)),
3574
- /* @__PURE__ */ jsx18(
3848
+ /* @__PURE__ */ jsx19(
3575
3849
  "button",
3576
3850
  {
3577
3851
  type: "button",
@@ -3583,9 +3857,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
3583
3857
  children: "Vertical"
3584
3858
  }
3585
3859
  ),
3586
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
3587
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Grid" }),
3588
- /* @__PURE__ */ jsx18(
3860
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3861
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Grid" }),
3862
+ /* @__PURE__ */ jsx19(
3589
3863
  "select",
3590
3864
  {
3591
3865
  "aria-label": "Warp grid",
@@ -3595,14 +3869,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
3595
3869
  tool.setWarp({ columns: g.columns, rows: g.rows });
3596
3870
  },
3597
3871
  className: imageFieldClass,
3598
- children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx18("option", { value: g.id, children: g.label }, g.id))
3872
+ children: WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ jsx19("option", { value: g.id, children: g.label }, g.id))
3599
3873
  }
3600
3874
  )
3601
3875
  ] })
3602
3876
  ] }),
3603
- tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", title: f.title, children: [
3604
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: f.label }),
3605
- /* @__PURE__ */ jsx18(
3877
+ tool.mode !== "warp" && FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", title: f.title, children: [
3878
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: f.label }),
3879
+ /* @__PURE__ */ jsx19(
3606
3880
  "input",
3607
3881
  {
3608
3882
  type: "number",
@@ -3622,8 +3896,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
3622
3896
  },
3623
3897
  `${f.id}:${round(bar[f.id], f.unit)}`
3624
3898
  ),
3625
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: f.unit }),
3626
- f.id === "scaleX" && /* @__PURE__ */ jsx18(
3899
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: f.unit }),
3900
+ f.id === "scaleX" && /* @__PURE__ */ jsx19(
3627
3901
  "button",
3628
3902
  {
3629
3903
  type: "button",
@@ -3638,33 +3912,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
3638
3912
  }
3639
3913
  )
3640
3914
  ] }, f.id)),
3641
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
3642
- /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: "Interpolation" }),
3643
- /* @__PURE__ */ jsx18(
3915
+ /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3916
+ /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: "Interpolation" }),
3917
+ /* @__PURE__ */ jsx19(
3644
3918
  "select",
3645
3919
  {
3646
3920
  "aria-label": "Interpolation",
3647
3921
  value: tool.interpolation,
3648
3922
  onChange: (e) => tool.setInterpolation(e.target.value),
3649
3923
  className: imageFieldClass,
3650
- children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx18("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
3924
+ children: INTERPOLATIONS.map((i) => /* @__PURE__ */ jsx19("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
3651
3925
  }
3652
3926
  )
3653
3927
  ] }),
3654
- /* @__PURE__ */ jsx18("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" }),
3655
- /* @__PURE__ */ jsx18("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
3656
- tool.error && /* @__PURE__ */ jsx18("span", { role: "alert", className: "text-destructive", children: tool.error })
3928
+ /* @__PURE__ */ jsx19("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" }),
3929
+ /* @__PURE__ */ jsx19("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
3930
+ tool.error && /* @__PURE__ */ jsx19("span", { role: "alert", className: "text-destructive", children: tool.error })
3657
3931
  ] });
3658
3932
  };
3659
3933
 
3660
3934
  // src/image-editor/ShapeOptionsBar.tsx
3661
- import { useEffect as useEffect12, useState as useState15 } from "react";
3935
+ import { useEffect as useEffect13, useState as useState16 } from "react";
3662
3936
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
3663
- import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3937
+ import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3664
3938
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
3665
- const [, setTick] = useState15(0);
3666
- useEffect12(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3667
- const [error, setError] = useState15(null);
3939
+ const [, setTick] = useState16(0);
3940
+ useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3941
+ const [error, setError] = useState16(null);
3668
3942
  const active = controller.getActiveLayer();
3669
3943
  const shapeId = active?.type === "shape" ? active.id : null;
3670
3944
  const set = (change) => {
@@ -3678,22 +3952,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
3678
3952
  }
3679
3953
  };
3680
3954
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
3681
- return /* @__PURE__ */ jsxs17("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
3682
- /* @__PURE__ */ jsx19("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
3683
- /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-3", children: [
3684
- /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3685
- /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
3955
+ return /* @__PURE__ */ jsxs18("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
3956
+ /* @__PURE__ */ jsx20("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
3957
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-3", children: [
3958
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3959
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
3686
3960
  "Fill",
3687
- /* @__PURE__ */ jsx19(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
3961
+ /* @__PURE__ */ jsx20(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
3688
3962
  ] }),
3689
- /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3690
- /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
3963
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3964
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
3691
3965
  "Stroke",
3692
- /* @__PURE__ */ jsx19(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
3966
+ /* @__PURE__ */ jsx20(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
3693
3967
  ] }),
3694
- /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3968
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3695
3969
  "Width",
3696
- /* @__PURE__ */ jsx19(
3970
+ /* @__PURE__ */ jsx20(
3697
3971
  "input",
3698
3972
  {
3699
3973
  type: "number",
@@ -3707,52 +3981,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
3707
3981
  )
3708
3982
  ] })
3709
3983
  ] }),
3710
- /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-3", children: [
3711
- options.kind === "rect" && /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3984
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-3", children: [
3985
+ options.kind === "rect" && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3712
3986
  "Radius",
3713
- /* @__PURE__ */ jsx19("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}` })
3987
+ /* @__PURE__ */ jsx20("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}` })
3714
3988
  ] }),
3715
- options.kind === "polygon" && /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3989
+ options.kind === "polygon" && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3716
3990
  "Sides",
3717
- /* @__PURE__ */ jsx19("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}` })
3991
+ /* @__PURE__ */ jsx20("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}` })
3718
3992
  ] }),
3719
- options.kind === "star" && /* @__PURE__ */ jsxs17(Fragment4, { children: [
3720
- /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3993
+ options.kind === "star" && /* @__PURE__ */ jsxs18(Fragment4, { children: [
3994
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3721
3995
  "Points",
3722
- /* @__PURE__ */ jsx19("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}` })
3996
+ /* @__PURE__ */ jsx20("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}` })
3723
3997
  ] }),
3724
- /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3998
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3725
3999
  "Inner",
3726
- /* @__PURE__ */ jsx19(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
4000
+ /* @__PURE__ */ jsx20(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
3727
4001
  ] })
3728
4002
  ] }),
3729
- options.kind === "line" && /* @__PURE__ */ jsxs17(Fragment4, { children: [
3730
- /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
4003
+ options.kind === "line" && /* @__PURE__ */ jsxs18(Fragment4, { children: [
4004
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
3731
4005
  "Weight",
3732
- /* @__PURE__ */ jsx19("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}` })
4006
+ /* @__PURE__ */ jsx20("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}` })
3733
4007
  ] }),
3734
- /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-1", children: [
3735
- /* @__PURE__ */ jsx19(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
4008
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
4009
+ /* @__PURE__ */ jsx20(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
3736
4010
  "Arrowhead"
3737
4011
  ] })
3738
4012
  ] })
3739
4013
  ] }),
3740
- /* @__PURE__ */ jsx19("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." }),
3741
- error && /* @__PURE__ */ jsx19("p", { role: "alert", className: "text-destructive", children: error })
4014
+ /* @__PURE__ */ jsx20("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." }),
4015
+ error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
3742
4016
  ] });
3743
4017
  };
3744
4018
 
3745
4019
  // src/image-editor/TypeOptionsBar.tsx
3746
- import { useEffect as useEffect13, useState as useState16 } from "react";
4020
+ import { useEffect as useEffect14, useState as useState17 } from "react";
3747
4021
  import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
3748
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
4022
+ import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
3749
4023
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
3750
4024
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
3751
4025
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
3752
- const [, setTick] = useState16(0);
3753
- useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3754
- useEffect13(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
3755
- const [error, setError] = useState16(null);
4026
+ const [, setTick] = useState17(0);
4027
+ useEffect14(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4028
+ useEffect14(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
4029
+ const [error, setError] = useState17(null);
3756
4030
  const active = controller.getActiveLayer();
3757
4031
  const typeId = !session && active?.type === "type" ? active.id : null;
3758
4032
  const here = session?.alive ? session.styleHere() : {};
@@ -3805,11 +4079,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3805
4079
  setError(e instanceof Error ? e.message : String(e));
3806
4080
  }
3807
4081
  };
3808
- return /* @__PURE__ */ jsxs18("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
3809
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-2", children: [
3810
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
4082
+ return /* @__PURE__ */ jsxs19("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
4083
+ /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", children: [
4084
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
3811
4085
  "Font",
3812
- /* @__PURE__ */ jsx20(
4086
+ /* @__PURE__ */ jsx21(
3813
4087
  "input",
3814
4088
  {
3815
4089
  list: "pixerate-type-fonts",
@@ -3819,11 +4093,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3819
4093
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
3820
4094
  }
3821
4095
  ),
3822
- /* @__PURE__ */ jsx20("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx20("option", { value: f }, f)) })
4096
+ /* @__PURE__ */ jsx21("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ jsx21("option", { value: f }, f)) })
3823
4097
  ] }),
3824
- /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-1", children: [
4098
+ /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-1", children: [
3825
4099
  "Size",
3826
- /* @__PURE__ */ jsx20(
4100
+ /* @__PURE__ */ jsx21(
3827
4101
  "input",
3828
4102
  {
3829
4103
  type: "number",
@@ -3836,14 +4110,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3836
4110
  }
3837
4111
  )
3838
4112
  ] }),
3839
- /* @__PURE__ */ jsx20("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" }),
3840
- /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
3841
- /* @__PURE__ */ jsx20(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4113
+ /* @__PURE__ */ jsx21("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" }),
4114
+ /* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4115
+ /* @__PURE__ */ jsx21(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
3842
4116
  ] }),
3843
- /* @__PURE__ */ jsx20("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
3844
- /* @__PURE__ */ jsxs18("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
3845
- TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
3846
- orientation === "vertical" && editedId && /* @__PURE__ */ jsx20(
4117
+ /* @__PURE__ */ jsx21("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4118
+ /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
4119
+ TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx21("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
4120
+ orientation === "vertical" && editedId && /* @__PURE__ */ jsx21(
3847
4121
  "button",
3848
4122
  {
3849
4123
  type: "button",
@@ -3855,19 +4129,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3855
4129
  }
3856
4130
  )
3857
4131
  ] }),
3858
- /* @__PURE__ */ jsx20("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
3859
- missing.length > 0 && /* @__PURE__ */ jsxs18("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
4132
+ /* @__PURE__ */ jsx21("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
4133
+ missing.length > 0 && /* @__PURE__ */ jsxs19("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
3860
4134
  "Missing ",
3861
4135
  missing.length === 1 ? "font" : "fonts",
3862
4136
  ": ",
3863
4137
  missing.join(", ")
3864
4138
  ] }),
3865
- error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-destructive", children: error })
4139
+ error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: error })
3866
4140
  ] });
3867
4141
  };
3868
4142
 
3869
4143
  // src/image-editor/ImageEditor.tsx
3870
- import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4144
+ import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
3871
4145
  var ImageEditor = ({
3872
4146
  editor: externalEditor,
3873
4147
  src,
@@ -3892,32 +4166,32 @@ var ImageEditor = ({
3892
4166
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
3893
4167
  });
3894
4168
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
3895
- const [activeTab, setActiveTab] = useState17("crop");
3896
- const rootRef = useRef8(null);
4169
+ const [activeTab, setActiveTab] = useState18("crop");
4170
+ const rootRef = useRef9(null);
3897
4171
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
3898
- const activeTabRef = useRef8(activeTab);
4172
+ const activeTabRef = useRef9(activeTab);
3899
4173
  activeTabRef.current = activeTab;
3900
4174
  const openPanel = async (ref) => {
3901
4175
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
3902
4176
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
3903
4177
  await new Promise((resolve) => setTimeout(resolve, 60));
3904
4178
  };
3905
- const [activeCropRatio, setActiveCropRatio] = useState17(null);
3906
- const [selectionOptions, setSelectionOptions] = useState17(DEFAULT_SELECTION_TOOL_OPTIONS2);
3907
- const [shapeOptions, setShapeOptions] = useState17(DEFAULT_SHAPE_TOOL_OPTIONS2);
3908
- const [typeOptions, setTypeOptions] = useState17(DEFAULT_TYPE_TOOL_OPTIONS2);
3909
- const [typeSession, setTypeSession] = useState17(null);
3910
- const [selectionError, setSelectionError] = useState17(null);
3911
- const [paintError, setPaintError] = useState17(null);
3912
- const [shapeTypeError, setShapeTypeError] = useState17(null);
4179
+ const [activeCropRatio, setActiveCropRatio] = useState18(null);
4180
+ const [selectionOptions, setSelectionOptions] = useState18(DEFAULT_SELECTION_TOOL_OPTIONS2);
4181
+ const [shapeOptions, setShapeOptions] = useState18(DEFAULT_SHAPE_TOOL_OPTIONS2);
4182
+ const [typeOptions, setTypeOptions] = useState18(DEFAULT_TYPE_TOOL_OPTIONS2);
4183
+ const [typeSession, setTypeSession] = useState18(null);
4184
+ const [selectionError, setSelectionError] = useState18(null);
4185
+ const [paintError, setPaintError] = useState18(null);
4186
+ const [shapeTypeError, setShapeTypeError] = useState18(null);
3913
4187
  const handleCanvasError = (source, message) => {
3914
4188
  if (source === "paint") setPaintError(message);
3915
4189
  else if (source === "select") setSelectionError(message);
3916
4190
  else setShapeTypeError(message);
3917
4191
  };
3918
4192
  const finishTyping = () => setTypeSession(null);
3919
- const transformToolRef = useRef8(null);
3920
- const transformControllerRef = useRef8(controller);
4193
+ const transformToolRef = useRef9(null);
4194
+ const transformControllerRef = useRef9(controller);
3921
4195
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
3922
4196
  transformToolRef.current?.cancel();
3923
4197
  transformToolRef.current = new FreeTransformTool2(controller, {
@@ -3926,16 +4200,16 @@ var ImageEditor = ({
3926
4200
  transformControllerRef.current = controller;
3927
4201
  }
3928
4202
  const transformTool = transformToolRef.current;
3929
- const [, setTransformTick] = useState17(0);
3930
- useEffect14(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
3931
- useEffect14(() => () => transformToolRef.current?.cancel(), []);
3932
- const [inpaintPrompt, setInpaintPrompt] = useState17("");
3933
- const [inpaintMaskMode, setInpaintMaskMode] = useState17("annotations");
3934
- const [isRemovingBg, setIsRemovingBg] = useState17(false);
3935
- const [isInpainting, setIsInpainting] = useState17(false);
3936
- const [aiError, setAiError] = useState17(null);
3937
- const [aiSuccess, setAiSuccess] = useState17(null);
3938
- const [aiTarget, setAiTarget] = useState17("auto");
4203
+ const [, setTransformTick] = useState18(0);
4204
+ useEffect15(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
4205
+ useEffect15(() => () => transformToolRef.current?.cancel(), []);
4206
+ const [inpaintPrompt, setInpaintPrompt] = useState18("");
4207
+ const [inpaintMaskMode, setInpaintMaskMode] = useState18("annotations");
4208
+ const [isRemovingBg, setIsRemovingBg] = useState18(false);
4209
+ const [isInpainting, setIsInpainting] = useState18(false);
4210
+ const [aiError, setAiError] = useState18(null);
4211
+ const [aiSuccess, setAiSuccess] = useState18(null);
4212
+ const [aiTarget, setAiTarget] = useState18("auto");
3939
4213
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
3940
4214
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
3941
4215
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -3998,11 +4272,11 @@ var ImageEditor = ({
3998
4272
  setIsInpainting(false);
3999
4273
  }
4000
4274
  };
4001
- const [activeColor, setActiveColor] = useState17("#ef4444");
4002
- const [strokeWidth, setStrokeWidth] = useState17(3);
4003
- const [fontSize, setFontSize] = useState17(24);
4004
- const [textInput, setTextInput] = useState17("");
4005
- useEffect14(() => {
4275
+ const [activeColor, setActiveColor] = useState18("#ef4444");
4276
+ const [strokeWidth, setStrokeWidth] = useState18(3);
4277
+ const [fontSize, setFontSize] = useState18(24);
4278
+ const [textInput, setTextInput] = useState18("");
4279
+ useEffect15(() => {
4006
4280
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
4007
4281
  editor.setTool("crop");
4008
4282
  }
@@ -4030,16 +4304,16 @@ var ImageEditor = ({
4030
4304
  link.click();
4031
4305
  }
4032
4306
  };
4033
- return /* @__PURE__ */ jsxs19(
4307
+ return /* @__PURE__ */ jsxs20(
4034
4308
  "div",
4035
4309
  {
4036
4310
  ref: rootRef,
4037
4311
  className: `${imageEditorFrameClass} ${className}`,
4038
4312
  style,
4039
4313
  children: [
4040
- /* @__PURE__ */ jsxs19("div", { className: imageEditorHeaderClass, children: [
4041
- /* @__PURE__ */ jsxs19("div", { role: "tablist", className: imageTabListClass, children: [
4042
- /* @__PURE__ */ jsx21(
4314
+ /* @__PURE__ */ jsxs20("div", { className: imageEditorHeaderClass, children: [
4315
+ /* @__PURE__ */ jsxs20("div", { role: "tablist", className: imageTabListClass, children: [
4316
+ /* @__PURE__ */ jsx22(
4043
4317
  "button",
4044
4318
  {
4045
4319
  type: "button",
@@ -4054,7 +4328,7 @@ var ImageEditor = ({
4054
4328
  children: "Transform & Crop"
4055
4329
  }
4056
4330
  ),
4057
- /* @__PURE__ */ jsx21(
4331
+ /* @__PURE__ */ jsx22(
4058
4332
  "button",
4059
4333
  {
4060
4334
  type: "button",
@@ -4069,7 +4343,7 @@ var ImageEditor = ({
4069
4343
  children: "Adjustments"
4070
4344
  }
4071
4345
  ),
4072
- /* @__PURE__ */ jsx21(
4346
+ /* @__PURE__ */ jsx22(
4073
4347
  "button",
4074
4348
  {
4075
4349
  type: "button",
@@ -4084,7 +4358,7 @@ var ImageEditor = ({
4084
4358
  children: "Layers"
4085
4359
  }
4086
4360
  ),
4087
- /* @__PURE__ */ jsx21(
4361
+ /* @__PURE__ */ jsx22(
4088
4362
  "button",
4089
4363
  {
4090
4364
  type: "button",
@@ -4099,7 +4373,7 @@ var ImageEditor = ({
4099
4373
  children: "Paint"
4100
4374
  }
4101
4375
  ),
4102
- /* @__PURE__ */ jsx21(
4376
+ /* @__PURE__ */ jsx22(
4103
4377
  "button",
4104
4378
  {
4105
4379
  type: "button",
@@ -4114,7 +4388,7 @@ var ImageEditor = ({
4114
4388
  children: "Select & Mask"
4115
4389
  }
4116
4390
  ),
4117
- /* @__PURE__ */ jsx21(
4391
+ /* @__PURE__ */ jsx22(
4118
4392
  "button",
4119
4393
  {
4120
4394
  type: "button",
@@ -4129,7 +4403,7 @@ var ImageEditor = ({
4129
4403
  children: "Annotations"
4130
4404
  }
4131
4405
  ),
4132
- /* @__PURE__ */ jsx21(
4406
+ /* @__PURE__ */ jsx22(
4133
4407
  "button",
4134
4408
  {
4135
4409
  type: "button",
@@ -4144,7 +4418,7 @@ var ImageEditor = ({
4144
4418
  children: "Depth Mask"
4145
4419
  }
4146
4420
  ),
4147
- /* @__PURE__ */ jsxs19(
4421
+ /* @__PURE__ */ jsxs20(
4148
4422
  "button",
4149
4423
  {
4150
4424
  type: "button",
@@ -4157,14 +4431,14 @@ var ImageEditor = ({
4157
4431
  "aria-selected": activeTab === "ai",
4158
4432
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
4159
4433
  children: [
4160
- /* @__PURE__ */ jsx21("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx21("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" }) }),
4434
+ /* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("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" }) }),
4161
4435
  "AI Tools"
4162
4436
  ]
4163
4437
  }
4164
4438
  )
4165
4439
  ] }),
4166
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 text-xs", children: [
4167
- /* @__PURE__ */ jsx21(
4440
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 text-xs", children: [
4441
+ /* @__PURE__ */ jsx22(
4168
4442
  "button",
4169
4443
  {
4170
4444
  type: "button",
@@ -4175,7 +4449,7 @@ var ImageEditor = ({
4175
4449
  children: "\u21A9"
4176
4450
  }
4177
4451
  ),
4178
- /* @__PURE__ */ jsx21(
4452
+ /* @__PURE__ */ jsx22(
4179
4453
  "button",
4180
4454
  {
4181
4455
  type: "button",
@@ -4186,7 +4460,7 @@ var ImageEditor = ({
4186
4460
  children: "\u21AA"
4187
4461
  }
4188
4462
  ),
4189
- /* @__PURE__ */ jsx21(
4463
+ /* @__PURE__ */ jsx22(
4190
4464
  "button",
4191
4465
  {
4192
4466
  type: "button",
@@ -4195,8 +4469,8 @@ var ImageEditor = ({
4195
4469
  children: "Reset"
4196
4470
  }
4197
4471
  ),
4198
- /* @__PURE__ */ jsx21("div", { className: "h-4 w-px bg-muted mx-1" }),
4199
- /* @__PURE__ */ jsx21(
4472
+ /* @__PURE__ */ jsx22("div", { className: "h-4 w-px bg-muted mx-1" }),
4473
+ /* @__PURE__ */ jsx22(
4200
4474
  "button",
4201
4475
  {
4202
4476
  type: "button",
@@ -4206,11 +4480,11 @@ var ImageEditor = ({
4206
4480
  children: "-"
4207
4481
  }
4208
4482
  ),
4209
- /* @__PURE__ */ jsxs19("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
4483
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
4210
4484
  Math.round(state.zoom * 100),
4211
4485
  "%"
4212
4486
  ] }),
4213
- /* @__PURE__ */ jsx21(
4487
+ /* @__PURE__ */ jsx22(
4214
4488
  "button",
4215
4489
  {
4216
4490
  type: "button",
@@ -4220,8 +4494,8 @@ var ImageEditor = ({
4220
4494
  children: "+"
4221
4495
  }
4222
4496
  ),
4223
- /* @__PURE__ */ jsx21("div", { className: "h-4 w-px bg-muted mx-1" }),
4224
- /* @__PURE__ */ jsx21(
4497
+ /* @__PURE__ */ jsx22("div", { className: "h-4 w-px bg-muted mx-1" }),
4498
+ /* @__PURE__ */ jsx22(
4225
4499
  "button",
4226
4500
  {
4227
4501
  type: "button",
@@ -4232,7 +4506,7 @@ var ImageEditor = ({
4232
4506
  children: "Hold Compare"
4233
4507
  }
4234
4508
  ),
4235
- /* @__PURE__ */ jsx21(
4509
+ /* @__PURE__ */ jsx22(
4236
4510
  "button",
4237
4511
  {
4238
4512
  type: "button",
@@ -4243,10 +4517,10 @@ var ImageEditor = ({
4243
4517
  )
4244
4518
  ] })
4245
4519
  ] }),
4246
- transformTool.active && /* @__PURE__ */ jsx21(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
4247
- !transformTool.active && transformTool.error && /* @__PURE__ */ jsx21("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
4248
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
4249
- /* @__PURE__ */ jsx21(
4520
+ transformTool.active && /* @__PURE__ */ jsx22(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
4521
+ !transformTool.active && transformTool.error && /* @__PURE__ */ jsx22("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
4522
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
4523
+ /* @__PURE__ */ jsx22(
4250
4524
  ImageEditorCanvas,
4251
4525
  {
4252
4526
  editor,
@@ -4270,11 +4544,11 @@ var ImageEditor = ({
4270
4544
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
4271
4545
  }
4272
4546
  ),
4273
- /* @__PURE__ */ jsxs19("div", { className: imageSidebarClass, children: [
4274
- activeTab === "crop" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-4 text-xs", children: [
4275
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
4276
- /* @__PURE__ */ jsxs19("div", { className: "grid grid-cols-3 gap-2", children: [
4277
- /* @__PURE__ */ jsx21(
4547
+ /* @__PURE__ */ jsxs20("div", { className: imageSidebarClass, children: [
4548
+ activeTab === "crop" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 text-xs", children: [
4549
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
4550
+ /* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-3 gap-2", children: [
4551
+ /* @__PURE__ */ jsx22(
4278
4552
  "button",
4279
4553
  {
4280
4554
  type: "button",
@@ -4286,7 +4560,7 @@ var ImageEditor = ({
4286
4560
  children: "Freeform"
4287
4561
  }
4288
4562
  ),
4289
- /* @__PURE__ */ jsx21(
4563
+ /* @__PURE__ */ jsx22(
4290
4564
  "button",
4291
4565
  {
4292
4566
  type: "button",
@@ -4298,7 +4572,7 @@ var ImageEditor = ({
4298
4572
  children: "1:1 Square"
4299
4573
  }
4300
4574
  ),
4301
- /* @__PURE__ */ jsx21(
4575
+ /* @__PURE__ */ jsx22(
4302
4576
  "button",
4303
4577
  {
4304
4578
  type: "button",
@@ -4310,7 +4584,7 @@ var ImageEditor = ({
4310
4584
  children: "4:3 Standard"
4311
4585
  }
4312
4586
  ),
4313
- /* @__PURE__ */ jsx21(
4587
+ /* @__PURE__ */ jsx22(
4314
4588
  "button",
4315
4589
  {
4316
4590
  type: "button",
@@ -4322,7 +4596,7 @@ var ImageEditor = ({
4322
4596
  children: "16:9 Wide"
4323
4597
  }
4324
4598
  ),
4325
- /* @__PURE__ */ jsx21(
4599
+ /* @__PURE__ */ jsx22(
4326
4600
  "button",
4327
4601
  {
4328
4602
  type: "button",
@@ -4334,7 +4608,7 @@ var ImageEditor = ({
4334
4608
  children: "3:2 Photo"
4335
4609
  }
4336
4610
  ),
4337
- /* @__PURE__ */ jsx21(
4611
+ /* @__PURE__ */ jsx22(
4338
4612
  "button",
4339
4613
  {
4340
4614
  type: "button",
@@ -4347,10 +4621,10 @@ var ImageEditor = ({
4347
4621
  }
4348
4622
  )
4349
4623
  ] }),
4350
- /* @__PURE__ */ jsx21("div", { className: imageDividerClass }),
4351
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
4352
- /* @__PURE__ */ jsxs19("div", { className: "grid grid-cols-2 gap-2", children: [
4353
- /* @__PURE__ */ jsx21(
4624
+ /* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
4625
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
4626
+ /* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-2 gap-2", children: [
4627
+ /* @__PURE__ */ jsx22(
4354
4628
  "button",
4355
4629
  {
4356
4630
  type: "button",
@@ -4359,7 +4633,7 @@ var ImageEditor = ({
4359
4633
  children: "Rotate -90\xB0"
4360
4634
  }
4361
4635
  ),
4362
- /* @__PURE__ */ jsx21(
4636
+ /* @__PURE__ */ jsx22(
4363
4637
  "button",
4364
4638
  {
4365
4639
  type: "button",
@@ -4368,7 +4642,7 @@ var ImageEditor = ({
4368
4642
  children: "Rotate +90\xB0"
4369
4643
  }
4370
4644
  ),
4371
- /* @__PURE__ */ jsx21(
4645
+ /* @__PURE__ */ jsx22(
4372
4646
  "button",
4373
4647
  {
4374
4648
  type: "button",
@@ -4377,7 +4651,7 @@ var ImageEditor = ({
4377
4651
  children: "Flip Horizontal"
4378
4652
  }
4379
4653
  ),
4380
- /* @__PURE__ */ jsx21(
4654
+ /* @__PURE__ */ jsx22(
4381
4655
  "button",
4382
4656
  {
4383
4657
  type: "button",
@@ -4388,10 +4662,10 @@ var ImageEditor = ({
4388
4662
  )
4389
4663
  ] })
4390
4664
  ] }),
4391
- activeTab === "adjust" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3 text-xs", children: [
4392
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4393
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
4394
- /* @__PURE__ */ jsx21(
4665
+ activeTab === "adjust" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
4666
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
4667
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
4668
+ /* @__PURE__ */ jsx22(
4395
4669
  "button",
4396
4670
  {
4397
4671
  type: "button",
@@ -4401,9 +4675,9 @@ var ImageEditor = ({
4401
4675
  }
4402
4676
  )
4403
4677
  ] }),
4404
- /* @__PURE__ */ jsx21(Histogram, { histogram: editor.histogram }),
4405
- IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs19(React16.Fragment, { children: [
4406
- /* @__PURE__ */ jsx21(
4678
+ /* @__PURE__ */ jsx22(Histogram, { histogram: editor.histogram }),
4679
+ IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ jsxs20(React17.Fragment, { children: [
4680
+ /* @__PURE__ */ jsx22(
4407
4681
  ControlSlider,
4408
4682
  {
4409
4683
  spec,
@@ -4412,14 +4686,14 @@ var ImageEditor = ({
4412
4686
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
4413
4687
  }
4414
4688
  ),
4415
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs19(
4689
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ jsxs20(
4416
4690
  "div",
4417
4691
  {
4418
4692
  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",
4419
4693
  "data-testid": "image-editor-process-notice",
4420
4694
  children: [
4421
- /* @__PURE__ */ jsx21("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
4422
- /* @__PURE__ */ jsx21(
4695
+ /* @__PURE__ */ jsx22("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
4696
+ /* @__PURE__ */ jsx22(
4423
4697
  "button",
4424
4698
  {
4425
4699
  type: "button",
@@ -4432,7 +4706,7 @@ var ImageEditor = ({
4432
4706
  }
4433
4707
  )
4434
4708
  ] }, spec.id)),
4435
- /* @__PURE__ */ jsx21("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx21(
4709
+ /* @__PURE__ */ jsx22("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx22(
4436
4710
  AdjustmentLayersPanel,
4437
4711
  {
4438
4712
  controller,
@@ -4441,9 +4715,9 @@ var ImageEditor = ({
4441
4715
  }
4442
4716
  ) })
4443
4717
  ] }),
4444
- activeTab === "layers" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3 text-xs", children: [
4445
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Layers" }),
4446
- /* @__PURE__ */ jsx21(
4718
+ activeTab === "layers" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
4719
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Layers" }),
4720
+ /* @__PURE__ */ jsx22(
4447
4721
  "button",
4448
4722
  {
4449
4723
  type: "button",
@@ -4454,15 +4728,15 @@ var ImageEditor = ({
4454
4728
  children: "Free Transform"
4455
4729
  }
4456
4730
  ),
4457
- /* @__PURE__ */ jsx21(LayersPanel, { controller }),
4458
- effectsShown && /* @__PURE__ */ jsx21(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
4459
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Colour" }),
4460
- /* @__PURE__ */ jsx21(ColorProfilePanel, { controller })
4731
+ /* @__PURE__ */ jsx22(LayersPanel, { controller }),
4732
+ effectsShown && /* @__PURE__ */ jsx22(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
4733
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Colour" }),
4734
+ /* @__PURE__ */ jsx22(ColorProfilePanel, { controller })
4461
4735
  ] }),
4462
- activeTab === "paint" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3 text-xs", children: [
4463
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Paint" }),
4464
- /* @__PURE__ */ jsx21(BrushOptionsBar, { controller }),
4465
- /* @__PURE__ */ jsx21(
4736
+ activeTab === "paint" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
4737
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Paint" }),
4738
+ /* @__PURE__ */ jsx22(BrushOptionsBar, { controller }),
4739
+ /* @__PURE__ */ jsx22(
4466
4740
  "button",
4467
4741
  {
4468
4742
  type: "button",
@@ -4473,12 +4747,12 @@ var ImageEditor = ({
4473
4747
  children: "Free Transform"
4474
4748
  }
4475
4749
  ),
4476
- paintError && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
4477
- /* @__PURE__ */ jsx21("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx21(LayersPanel, { controller }) })
4750
+ paintError && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
4751
+ /* @__PURE__ */ jsx22("div", { className: imageSectionClass, children: /* @__PURE__ */ jsx22(LayersPanel, { controller }) })
4478
4752
  ] }),
4479
- activeTab === "annotate" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3 text-xs", children: [
4480
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
4481
- /* @__PURE__ */ jsx21("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx21(
4753
+ activeTab === "annotate" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
4754
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
4755
+ /* @__PURE__ */ jsx22("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ jsx22(
4482
4756
  "button",
4483
4757
  {
4484
4758
  type: "button",
@@ -4489,13 +4763,13 @@ var ImageEditor = ({
4489
4763
  },
4490
4764
  t
4491
4765
  )) }),
4492
- state.activeTool === "shape" && /* @__PURE__ */ jsx21(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
4493
- state.activeTool === "type" && /* @__PURE__ */ jsx21(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
4494
- state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx21("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" }),
4495
- shapeTypeError && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
4496
- /* @__PURE__ */ jsx21("div", { className: imageDividerClass }),
4497
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
4498
- /* @__PURE__ */ jsx21("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx21(
4766
+ state.activeTool === "shape" && /* @__PURE__ */ jsx22(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
4767
+ state.activeTool === "type" && /* @__PURE__ */ jsx22(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
4768
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ jsx22("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" }),
4769
+ shapeTypeError && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
4770
+ /* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
4771
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
4772
+ /* @__PURE__ */ jsx22("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ jsx22(
4499
4773
  "button",
4500
4774
  {
4501
4775
  type: "button",
@@ -4505,18 +4779,18 @@ var ImageEditor = ({
4505
4779
  },
4506
4780
  t
4507
4781
  )) }),
4508
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 mt-2", children: [
4509
- /* @__PURE__ */ jsx21("label", { className: "text-muted-foreground", children: "Color:" }),
4510
- /* @__PURE__ */ jsx21(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
4511
- /* @__PURE__ */ jsxs19("div", { className: "flex-1 ml-2", children: [
4512
- /* @__PURE__ */ jsxs19("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
4513
- /* @__PURE__ */ jsx21("span", { children: "Width:" }),
4514
- /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
4782
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 mt-2", children: [
4783
+ /* @__PURE__ */ jsx22("label", { className: "text-muted-foreground", children: "Color:" }),
4784
+ /* @__PURE__ */ jsx22(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
4785
+ /* @__PURE__ */ jsxs20("div", { className: "flex-1 ml-2", children: [
4786
+ /* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
4787
+ /* @__PURE__ */ jsx22("span", { children: "Width:" }),
4788
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4515
4789
  strokeWidth,
4516
4790
  "px"
4517
4791
  ] })
4518
4792
  ] }),
4519
- /* @__PURE__ */ jsx21(
4793
+ /* @__PURE__ */ jsx22(
4520
4794
  "input",
4521
4795
  {
4522
4796
  type: "range",
@@ -4529,10 +4803,10 @@ var ImageEditor = ({
4529
4803
  )
4530
4804
  ] })
4531
4805
  ] }),
4532
- /* @__PURE__ */ jsx21("div", { className: imageDividerClass }),
4533
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Add Text" }),
4534
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-2", children: [
4535
- /* @__PURE__ */ jsx21(
4806
+ /* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
4807
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Add Text" }),
4808
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-2", children: [
4809
+ /* @__PURE__ */ jsx22(
4536
4810
  "input",
4537
4811
  {
4538
4812
  type: "text",
@@ -4543,7 +4817,7 @@ var ImageEditor = ({
4543
4817
  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"
4544
4818
  }
4545
4819
  ),
4546
- /* @__PURE__ */ jsx21(
4820
+ /* @__PURE__ */ jsx22(
4547
4821
  "button",
4548
4822
  {
4549
4823
  type: "button",
@@ -4553,14 +4827,14 @@ var ImageEditor = ({
4553
4827
  }
4554
4828
  )
4555
4829
  ] }),
4556
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between text-muted-foreground", children: [
4557
- /* @__PURE__ */ jsx21("span", { children: "Font Size:" }),
4558
- /* @__PURE__ */ jsxs19("span", { className: "font-mono", children: [
4830
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between text-muted-foreground", children: [
4831
+ /* @__PURE__ */ jsx22("span", { children: "Font Size:" }),
4832
+ /* @__PURE__ */ jsxs20("span", { className: "font-mono", children: [
4559
4833
  fontSize,
4560
4834
  "px"
4561
4835
  ] })
4562
4836
  ] }),
4563
- /* @__PURE__ */ jsx21(
4837
+ /* @__PURE__ */ jsx22(
4564
4838
  "input",
4565
4839
  {
4566
4840
  type: "range",
@@ -4571,14 +4845,14 @@ var ImageEditor = ({
4571
4845
  className: imageRangeClass
4572
4846
  }
4573
4847
  ),
4574
- /* @__PURE__ */ jsx21("div", { className: imageDividerClass }),
4575
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4576
- /* @__PURE__ */ jsxs19("span", { className: "text-muted-foreground", children: [
4848
+ /* @__PURE__ */ jsx22("div", { className: imageDividerClass }),
4849
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
4850
+ /* @__PURE__ */ jsxs20("span", { className: "text-muted-foreground", children: [
4577
4851
  "Layers (",
4578
4852
  state.annotations.length,
4579
4853
  ")"
4580
4854
  ] }),
4581
- state.selectedAnnotationId && /* @__PURE__ */ jsx21(
4855
+ state.selectedAnnotationId && /* @__PURE__ */ jsx22(
4582
4856
  "button",
4583
4857
  {
4584
4858
  type: "button",
@@ -4587,7 +4861,7 @@ var ImageEditor = ({
4587
4861
  children: "Delete Selected"
4588
4862
  }
4589
4863
  ),
4590
- state.annotations.length > 0 && /* @__PURE__ */ jsx21(
4864
+ state.annotations.length > 0 && /* @__PURE__ */ jsx22(
4591
4865
  "button",
4592
4866
  {
4593
4867
  type: "button",
@@ -4598,10 +4872,10 @@ var ImageEditor = ({
4598
4872
  )
4599
4873
  ] })
4600
4874
  ] }),
4601
- activeTab === "depth" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3 text-xs", children: [
4602
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4603
- /* @__PURE__ */ jsx21("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
4604
- /* @__PURE__ */ jsx21(
4875
+ activeTab === "depth" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-3 text-xs", children: [
4876
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
4877
+ /* @__PURE__ */ jsx22("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
4878
+ /* @__PURE__ */ jsx22(
4605
4879
  "button",
4606
4880
  {
4607
4881
  type: "button",
@@ -4611,8 +4885,8 @@ var ImageEditor = ({
4611
4885
  }
4612
4886
  )
4613
4887
  ] }),
4614
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
4615
- /* @__PURE__ */ jsx21(
4888
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
4889
+ /* @__PURE__ */ jsx22(
4616
4890
  "input",
4617
4891
  {
4618
4892
  type: "checkbox",
@@ -4621,12 +4895,12 @@ var ImageEditor = ({
4621
4895
  className: "rounded accent-primary"
4622
4896
  }
4623
4897
  ),
4624
- /* @__PURE__ */ jsx21("span", { children: "Enable Depth / Alpha Mask" })
4898
+ /* @__PURE__ */ jsx22("span", { children: "Enable Depth / Alpha Mask" })
4625
4899
  ] }),
4626
- state.depthMask.enabled && /* @__PURE__ */ jsxs19(Fragment5, { children: [
4627
- /* @__PURE__ */ jsxs19("div", { children: [
4628
- /* @__PURE__ */ jsx21("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
4629
- /* @__PURE__ */ jsx21(
4900
+ state.depthMask.enabled && /* @__PURE__ */ jsxs20(Fragment5, { children: [
4901
+ /* @__PURE__ */ jsxs20("div", { children: [
4902
+ /* @__PURE__ */ jsx22("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
4903
+ /* @__PURE__ */ jsx22(
4630
4904
  "input",
4631
4905
  {
4632
4906
  type: "text",
@@ -4637,8 +4911,8 @@ var ImageEditor = ({
4637
4911
  }
4638
4912
  )
4639
4913
  ] }),
4640
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-2", children: [
4641
- /* @__PURE__ */ jsx21(
4914
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-2", children: [
4915
+ /* @__PURE__ */ jsx22(
4642
4916
  "button",
4643
4917
  {
4644
4918
  type: "button",
@@ -4647,7 +4921,7 @@ var ImageEditor = ({
4647
4921
  children: "Threshold Mode"
4648
4922
  }
4649
4923
  ),
4650
- /* @__PURE__ */ jsx21(
4924
+ /* @__PURE__ */ jsx22(
4651
4925
  "button",
4652
4926
  {
4653
4927
  type: "button",
@@ -4657,12 +4931,12 @@ var ImageEditor = ({
4657
4931
  }
4658
4932
  )
4659
4933
  ] }),
4660
- /* @__PURE__ */ jsxs19("div", { children: [
4661
- /* @__PURE__ */ jsxs19("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
4662
- /* @__PURE__ */ jsx21("span", { children: "Depth Start (Lower):" }),
4663
- /* @__PURE__ */ jsx21("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
4934
+ /* @__PURE__ */ jsxs20("div", { children: [
4935
+ /* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
4936
+ /* @__PURE__ */ jsx22("span", { children: "Depth Start (Lower):" }),
4937
+ /* @__PURE__ */ jsx22("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
4664
4938
  ] }),
4665
- /* @__PURE__ */ jsx21(
4939
+ /* @__PURE__ */ jsx22(
4666
4940
  "input",
4667
4941
  {
4668
4942
  type: "range",
@@ -4676,12 +4950,12 @@ var ImageEditor = ({
4676
4950
  }
4677
4951
  )
4678
4952
  ] }),
4679
- /* @__PURE__ */ jsxs19("div", { children: [
4680
- /* @__PURE__ */ jsxs19("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
4681
- /* @__PURE__ */ jsx21("span", { children: "Depth Stop (Upper):" }),
4682
- /* @__PURE__ */ jsx21("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
4953
+ /* @__PURE__ */ jsxs20("div", { children: [
4954
+ /* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
4955
+ /* @__PURE__ */ jsx22("span", { children: "Depth Stop (Upper):" }),
4956
+ /* @__PURE__ */ jsx22("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
4683
4957
  ] }),
4684
- /* @__PURE__ */ jsx21(
4958
+ /* @__PURE__ */ jsx22(
4685
4959
  "input",
4686
4960
  {
4687
4961
  type: "range",
@@ -4695,12 +4969,12 @@ var ImageEditor = ({
4695
4969
  }
4696
4970
  )
4697
4971
  ] }),
4698
- /* @__PURE__ */ jsxs19("div", { children: [
4699
- /* @__PURE__ */ jsxs19("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
4700
- /* @__PURE__ */ jsx21("span", { children: "Softness:" }),
4701
- /* @__PURE__ */ jsx21("span", { className: "font-mono", children: state.depthMask.softness })
4972
+ /* @__PURE__ */ jsxs20("div", { children: [
4973
+ /* @__PURE__ */ jsxs20("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
4974
+ /* @__PURE__ */ jsx22("span", { children: "Softness:" }),
4975
+ /* @__PURE__ */ jsx22("span", { className: "font-mono", children: state.depthMask.softness })
4702
4976
  ] }),
4703
- /* @__PURE__ */ jsx21(
4977
+ /* @__PURE__ */ jsx22(
4704
4978
  "input",
4705
4979
  {
4706
4980
  type: "range",
@@ -4712,8 +4986,8 @@ var ImageEditor = ({
4712
4986
  }
4713
4987
  )
4714
4988
  ] }),
4715
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
4716
- /* @__PURE__ */ jsx21(
4989
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
4990
+ /* @__PURE__ */ jsx22(
4717
4991
  "input",
4718
4992
  {
4719
4993
  type: "checkbox",
@@ -4722,12 +4996,12 @@ var ImageEditor = ({
4722
4996
  className: "rounded accent-primary"
4723
4997
  }
4724
4998
  ),
4725
- /* @__PURE__ */ jsx21("span", { children: "Invert Mask" })
4999
+ /* @__PURE__ */ jsx22("span", { children: "Invert Mask" })
4726
5000
  ] })
4727
5001
  ] })
4728
5002
  ] }),
4729
- activeTab === "select" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-4 text-xs", children: [
4730
- /* @__PURE__ */ jsx21(
5003
+ activeTab === "select" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 text-xs", children: [
5004
+ /* @__PURE__ */ jsx22(
4731
5005
  SelectionOptionsBar,
4732
5006
  {
4733
5007
  controller,
@@ -4738,9 +5012,9 @@ var ImageEditor = ({
4738
5012
  selectionDisplay: state.selectionDisplay
4739
5013
  }
4740
5014
  ),
4741
- selectionError && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-destructive", children: selectionError }),
4742
- /* @__PURE__ */ jsxs19("div", { className: "flex gap-1", children: [
4743
- /* @__PURE__ */ jsx21(
5015
+ selectionError && /* @__PURE__ */ jsx22("p", { role: "alert", className: "text-destructive", children: selectionError }),
5016
+ /* @__PURE__ */ jsxs20("div", { className: "flex gap-1", children: [
5017
+ /* @__PURE__ */ jsx22(
4744
5018
  "button",
4745
5019
  {
4746
5020
  type: "button",
@@ -4751,7 +5025,7 @@ var ImageEditor = ({
4751
5025
  children: "Transform Selection"
4752
5026
  }
4753
5027
  ),
4754
- /* @__PURE__ */ jsx21(
5028
+ /* @__PURE__ */ jsx22(
4755
5029
  "button",
4756
5030
  {
4757
5031
  type: "button",
@@ -4763,13 +5037,13 @@ var ImageEditor = ({
4763
5037
  }
4764
5038
  )
4765
5039
  ] }),
4766
- /* @__PURE__ */ jsx21(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
4767
- /* @__PURE__ */ jsx21(ChannelsPanel, { controller })
5040
+ /* @__PURE__ */ jsx22(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
5041
+ /* @__PURE__ */ jsx22(ChannelsPanel, { controller })
4768
5042
  ] }),
4769
- activeTab === "ai" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-4 text-xs", children: [
4770
- /* @__PURE__ */ jsxs19("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
4771
- /* @__PURE__ */ jsx21("span", { children: "Results go to" }),
4772
- /* @__PURE__ */ jsxs19(
5043
+ activeTab === "ai" && /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-4 text-xs", children: [
5044
+ /* @__PURE__ */ jsxs20("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
5045
+ /* @__PURE__ */ jsx22("span", { children: "Results go to" }),
5046
+ /* @__PURE__ */ jsxs20(
4773
5047
  "select",
4774
5048
  {
4775
5049
  "aria-label": "AI result target",
@@ -4777,54 +5051,54 @@ var ImageEditor = ({
4777
5051
  onChange: (e) => setAiTarget(e.target.value),
4778
5052
  className: imageSelectClass,
4779
5053
  children: [
4780
- /* @__PURE__ */ jsx21("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
4781
- /* @__PURE__ */ jsx21("option", { value: "new-layer", children: "New layer / mask" }),
4782
- /* @__PURE__ */ jsx21("option", { value: "replace", children: "Replace image" })
5054
+ /* @__PURE__ */ jsx22("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
5055
+ /* @__PURE__ */ jsx22("option", { value: "new-layer", children: "New layer / mask" }),
5056
+ /* @__PURE__ */ jsx22("option", { value: "replace", children: "Replace image" })
4783
5057
  ]
4784
5058
  }
4785
5059
  )
4786
5060
  ] }),
4787
- /* @__PURE__ */ jsxs19("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
4788
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4789
- /* @__PURE__ */ jsxs19("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4790
- /* @__PURE__ */ jsx21("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx21("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" }) }),
5061
+ /* @__PURE__ */ jsxs20("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5062
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
5063
+ /* @__PURE__ */ jsxs20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5064
+ /* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("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" }) }),
4791
5065
  "Background Removal"
4792
5066
  ] }),
4793
- isRemovingBg && /* @__PURE__ */ jsx21("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..." })
5067
+ isRemovingBg && /* @__PURE__ */ jsx22("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..." })
4794
5068
  ] }),
4795
- /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
4796
- /* @__PURE__ */ jsx21(
5069
+ /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
5070
+ /* @__PURE__ */ jsx22(
4797
5071
  "button",
4798
5072
  {
4799
5073
  type: "button",
4800
5074
  onClick: handleRemoveBackground,
4801
5075
  disabled: isRemovingBg || isInpainting,
4802
5076
  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",
4803
- children: isRemovingBg ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
4804
- /* @__PURE__ */ jsx21("div", { className: imageSpinnerClass }),
5077
+ children: isRemovingBg ? /* @__PURE__ */ jsxs20(Fragment5, { children: [
5078
+ /* @__PURE__ */ jsx22("div", { className: imageSpinnerClass }),
4805
5079
  "Removing Background..."
4806
- ] }) : /* @__PURE__ */ jsxs19(Fragment5, { children: [
4807
- /* @__PURE__ */ jsx21("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx21("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" }) }),
5080
+ ] }) : /* @__PURE__ */ jsxs20(Fragment5, { children: [
5081
+ /* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("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" }) }),
4808
5082
  "Remove Background"
4809
5083
  ] })
4810
5084
  }
4811
5085
  )
4812
5086
  ] }),
4813
- /* @__PURE__ */ jsxs19("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
4814
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
4815
- /* @__PURE__ */ jsxs19("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
4816
- /* @__PURE__ */ jsxs19("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
4817
- /* @__PURE__ */ jsx21("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" }),
4818
- /* @__PURE__ */ jsx21("path", { d: "m14 7 3 3" })
5087
+ /* @__PURE__ */ jsxs20("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
5088
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
5089
+ /* @__PURE__ */ jsxs20("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
5090
+ /* @__PURE__ */ jsxs20("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5091
+ /* @__PURE__ */ jsx22("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" }),
5092
+ /* @__PURE__ */ jsx22("path", { d: "m14 7 3 3" })
4819
5093
  ] }),
4820
5094
  "Generative Inpainting"
4821
5095
  ] }),
4822
- isInpainting && /* @__PURE__ */ jsx21("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..." })
5096
+ isInpainting && /* @__PURE__ */ jsx22("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..." })
4823
5097
  ] }),
4824
- /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
4825
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", children: [
4826
- /* @__PURE__ */ jsx21("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
4827
- /* @__PURE__ */ jsx21(
5098
+ /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
5099
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
5100
+ /* @__PURE__ */ jsx22("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
5101
+ /* @__PURE__ */ jsx22(
4828
5102
  "textarea",
4829
5103
  {
4830
5104
  id: "ai-inpaint-prompt-react",
@@ -4836,10 +5110,10 @@ var ImageEditor = ({
4836
5110
  }
4837
5111
  )
4838
5112
  ] }),
4839
- /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", children: [
4840
- /* @__PURE__ */ jsx21("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
4841
- /* @__PURE__ */ jsxs19("div", { className: "grid grid-cols-2 gap-1.5", children: [
4842
- /* @__PURE__ */ jsxs19(
5113
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", children: [
5114
+ /* @__PURE__ */ jsx22("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
5115
+ /* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-2 gap-1.5", children: [
5116
+ /* @__PURE__ */ jsxs20(
4843
5117
  "button",
4844
5118
  {
4845
5119
  type: "button",
@@ -4852,7 +5126,7 @@ var ImageEditor = ({
4852
5126
  ]
4853
5127
  }
4854
5128
  ),
4855
- /* @__PURE__ */ jsxs19(
5129
+ /* @__PURE__ */ jsxs20(
4856
5130
  "button",
4857
5131
  {
4858
5132
  type: "button",
@@ -4867,25 +5141,25 @@ var ImageEditor = ({
4867
5141
  )
4868
5142
  ] })
4869
5143
  ] }),
4870
- /* @__PURE__ */ jsx21(
5144
+ /* @__PURE__ */ jsx22(
4871
5145
  "button",
4872
5146
  {
4873
5147
  type: "button",
4874
5148
  onClick: handleInpaint,
4875
5149
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
4876
5150
  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",
4877
- children: isInpainting ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
4878
- /* @__PURE__ */ jsx21("div", { className: imageSpinnerClass }),
5151
+ children: isInpainting ? /* @__PURE__ */ jsxs20(Fragment5, { children: [
5152
+ /* @__PURE__ */ jsx22("div", { className: imageSpinnerClass }),
4879
5153
  "Generating Inpaint..."
4880
- ] }) : /* @__PURE__ */ jsxs19(Fragment5, { children: [
4881
- /* @__PURE__ */ jsx21("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx21("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" }) }),
5154
+ ] }) : /* @__PURE__ */ jsxs20(Fragment5, { children: [
5155
+ /* @__PURE__ */ jsx22("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx22("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" }) }),
4882
5156
  "Apply Inpainting"
4883
5157
  ] })
4884
5158
  }
4885
5159
  )
4886
5160
  ] }),
4887
- aiError && /* @__PURE__ */ jsx21("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
4888
- aiSuccess && /* @__PURE__ */ jsx21("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
5161
+ aiError && /* @__PURE__ */ jsx22("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
5162
+ aiSuccess && /* @__PURE__ */ jsx22("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
4889
5163
  ] })
4890
5164
  ] })
4891
5165
  ] })
@@ -4916,6 +5190,7 @@ export {
4916
5190
  PaintGradientEditor,
4917
5191
  BrushOptionsBar,
4918
5192
  ColorProfilePanel,
5193
+ SelectAndMaskWorkspace,
4919
5194
  SelectionOptionsBar,
4920
5195
  RefineEdgePanel,
4921
5196
  ChannelsPanel,